@intlayer/core 5.5.11 → 5.6.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/README.md CHANGED
@@ -33,7 +33,7 @@
33
33
  <a href="https://www.facebook.com/intlayer" target="blank"><img align="center"
34
34
  src="https://img.shields.io/badge/facebook-4267B2.svg?style=for-the-badge&logo=facebook&logoColor=white"
35
35
  alt="Intlayer Facebook" height="30"/></a>
36
- <a href="https://www.instagram.com/intlayer_org/" target="blank"><img align="center"
36
+ <a href="https://www.instagram.com/intlayer/" target="blank"><img align="center"
37
37
  src="https://img.shields.io/badge/instagram-%23E4405F.svg?style=for-the-badge&logo=Instagram&logoColor=white"
38
38
  alt="Intlayer Instagram" height="30"/></a>
39
39
  <a href="https://x.com/Intlayer183096" target="blank"><img align="center"
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(getContent_exports);
34
34
  var import_built = __toESM(require("@intlayer/config/built"));
35
35
  var import_deepTransform = require('./deepTransform.cjs');
36
36
  var import_plugins = require('./plugins.cjs');
37
- const getContent = (node, nodeProps, locale = import_built.default.internationalization.defaultLocale) => {
37
+ const getContent = (node, nodeProps, locale = import_built.default?.internationalization.defaultLocale) => {
38
38
  const plugins = [
39
39
  import_plugins.insertionPlugin,
40
40
  (0, import_plugins.translationPlugin)(locale),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n conditionPlugin,\n enumerationPlugin,\n filePlugin,\n insertionPlugin,\n nestedPlugin,\n translationPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\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 = Locales,\n>(\n node: T,\n nodeProps: NodeProps,\n locale: L = configuration.internationalization.defaultLocale as L\n) => {\n const plugins: Plugins[] = [\n insertionPlugin,\n translationPlugin(locale),\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>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAG1B,2BAAkC;AAClC,qBAUO;AAQA,MAAM,aAAa,CAIxB,MACA,WACA,SAAY,aAAAA,QAAc,qBAAqB,kBAC5C;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,QACA,kCAAkB,MAAM;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,aAAO,wCAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":["configuration"]}
1
+ {"version":3,"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n conditionPlugin,\n enumerationPlugin,\n filePlugin,\n insertionPlugin,\n nestedPlugin,\n translationPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\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 = Locales,\n>(\n node: T,\n nodeProps: NodeProps,\n locale: L = configuration?.internationalization.defaultLocale as L\n) => {\n const plugins: Plugins[] = [\n insertionPlugin,\n translationPlugin(locale),\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>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAG1B,2BAAkC;AAClC,qBAUO;AAQA,MAAM,aAAa,CAIxB,MACA,WACA,SAAY,aAAAA,SAAe,qBAAqB,kBAC7C;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,QACA,kCAAkB,MAAM;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,aAAO,wCAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":["configuration"]}
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(getLocalisedContent_exports);
34
34
  var import_built = __toESM(require("@intlayer/config/built"));
35
35
  var import_deepTransform = require('./deepTransform.cjs');
36
36
  var import_plugins = require('./plugins.cjs');
37
- const getLocalisedContent = (node, locale = import_built.default.internationalization.defaultLocale, nodeProps, fallback = false) => {
37
+ const getLocalisedContent = (node, locale = import_built.default?.internationalization.defaultLocale, nodeProps, fallback = false) => {
38
38
  const plugins = [
39
39
  (0, import_plugins.translationPlugin)(locale, fallback),
40
40
  ...nodeProps.plugins ?? []
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/interpreter/getContent/getLocalisedContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n translationPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\n} from './plugins';\n\n/**\n * Transforms a node in a single pass, applying each plugin as needed.\n * In comparison to `getContent`, this function will only apply the translation plugin.\n * It will not transform enumerations, insertions, or other content types.\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 getLocalisedContent = <\n T extends ContentNode,\n L extends LocalesValues = Locales,\n>(\n node: T,\n locale: L = configuration.internationalization.defaultLocale as L,\n nodeProps: NodeProps,\n fallback: boolean = false // fallback mean that if field is not translated, it will use the default locale\n) => {\n const plugins: Plugins[] = [\n translationPlugin(locale, fallback),\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAG1B,2BAAkC;AAClC,qBAKO;AAUA,MAAM,sBAAsB,CAIjC,MACA,SAAY,aAAAA,QAAc,qBAAqB,eAC/C,WACA,WAAoB,UACjB;AACH,QAAM,UAAqB;AAAA,QACzB,kCAAkB,QAAQ,QAAQ;AAAA,IAClC,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,aAAO,wCAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":["configuration"]}
1
+ {"version":3,"sources":["../../../../src/interpreter/getContent/getLocalisedContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n translationPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\n} from './plugins';\n\n/**\n * Transforms a node in a single pass, applying each plugin as needed.\n * In comparison to `getContent`, this function will only apply the translation plugin.\n * It will not transform enumerations, insertions, or other content types.\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 getLocalisedContent = <\n T extends ContentNode,\n L extends LocalesValues = Locales,\n>(\n node: T,\n locale: L = configuration?.internationalization.defaultLocale as L,\n nodeProps: NodeProps,\n fallback: boolean = false // fallback mean that if field is not translated, it will use the default locale\n) => {\n const plugins: Plugins[] = [\n translationPlugin(locale, fallback),\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAG1B,2BAAkC;AAClC,qBAKO;AAUA,MAAM,sBAAsB,CAIjC,MACA,SAAY,aAAAA,SAAe,qBAAqB,eAChD,WACA,WAAoB,UACjB;AACH,QAAM,UAAqB;AAAA,QACzB,kCAAkB,QAAQ,QAAQ;AAAA,IAClC,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,aAAO,wCAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":["configuration"]}
@@ -52,7 +52,7 @@ const localeFlatMap = (mapper, locales = import_built.default.internationalizati
52
52
  urlPrefix: locale === defaultLocale && !prefixDefault ? "" : `/${locale}`
53
53
  })
54
54
  );
55
- const localeRecord = (mapper, locales = import_built.default.internationalization.locales, defaultLocale = import_built.default.internationalization.defaultLocale, prefixDefault = import_built.default.middleware.prefixDefault) => locales.reduce(
55
+ const localeRecord = (mapper, locales = import_built.default?.internationalization.locales, defaultLocale = import_built.default?.internationalization.defaultLocale, prefixDefault = import_built.default?.middleware.prefixDefault) => locales.reduce(
56
56
  (acc, locale) => {
57
57
  acc[locale] = mapper({
58
58
  locale,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/localization/localeMapper.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { Locales, LocalesValues } from '@intlayer/config/client';\n\nexport type LocaleData = {\n locale: LocalesValues;\n defaultLocale: LocalesValues;\n isDefault: boolean;\n locales: LocalesValues[];\n urlPrefix: string;\n};\n\n/**\n * Map the locale data to an array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * ({\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }),\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an object\n * @returns An array of objects\n */\nexport const localeMap = <T extends object>(\n mapper: (locale: LocaleData) => T,\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): T[] =>\n locales.map((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n })\n );\n\n/**\n * Flatten the locale map into a single array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * [{\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }],\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an array of objects\n * @returns An array of objects\n */\nexport const localeFlatMap = <T>(\n mapper: (locale: LocaleData) => T[],\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): T[] =>\n locales.flatMap((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n })\n );\n\n/**\n * Creates a record object mapping locales to values transformed by the mapper function\n *\n * @example\n * ```ts\n * const translations = localeRecord(({ locale }) =>\n * require(`./translations/${locale}.json`)\n * );\n *\n * // Result\n * {\n * en: { ... }, // Content of translations/en.json\n * fr: { ... }, // Content of translations/fr.json\n * es: { ... } // Content of translations/es.json\n * }\n * ```\n *\n * @param mapper - Function that takes locale data and returns a value for that locale\n * @param locales - Array of locale codes to map over (defaults to configured locales)\n * @param defaultLocale - The default locale (defaults to configured default)\n * @param prefixDefault - Whether to prefix the default locale in URLs (defaults to configured value)\n * @returns Record mapping locale codes to mapped values\n */\nexport const localeRecord = <T>(\n mapper: (locale: LocaleData) => T,\n locales: Locales[] = configuration.internationalization.locales,\n defaultLocale: Locales = configuration.internationalization.defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): Record<Locales, T> =>\n locales.reduce(\n (acc, locale) => {\n acc[locale] = mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix:\n locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n });\n return acc;\n },\n {} as Record<Locales, T>\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAqCnB,MAAM,YAAY,CACvB,QACA,UAA2B,aAAAA,QAAc,qBAAqB,SAC9D,gBAA+B,aAAAA,QAAc,qBAC1C,eACH,gBAAyB,aAAAA,QAAc,WAAW,kBAElD,QAAQ;AAAA,EAAI,CAAC,WACX,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,EACzE,CAAC;AACH;AA4BK,MAAM,gBAAgB,CAC3B,QACA,UAA2B,aAAAA,QAAc,qBAAqB,SAC9D,gBAA+B,aAAAA,QAAc,qBAC1C,eACH,gBAAyB,aAAAA,QAAc,WAAW,kBAElD,QAAQ;AAAA,EAAQ,CAAC,WACf,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,EACzE,CAAC;AACH;AAyBK,MAAM,eAAe,CAC1B,QACA,UAAqB,aAAAA,QAAc,qBAAqB,SACxD,gBAAyB,aAAAA,QAAc,qBAAqB,eAC5D,gBAAyB,aAAAA,QAAc,WAAW,kBAElD,QAAQ;AAAA,EACN,CAAC,KAAK,WAAW;AACf,QAAI,MAAM,IAAI,OAAO;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW,WAAW;AAAA,MACtB,WACE,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,IAChE,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EACA,CAAC;AACH;","names":["configuration"]}
1
+ {"version":3,"sources":["../../../src/localization/localeMapper.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { Locales, LocalesValues } from '@intlayer/config/client';\n\nexport type LocaleData = {\n locale: LocalesValues;\n defaultLocale: LocalesValues;\n isDefault: boolean;\n locales: LocalesValues[];\n urlPrefix: string;\n};\n\n/**\n * Map the locale data to an array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * ({\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }),\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an object\n * @returns An array of objects\n */\nexport const localeMap = <T>(\n mapper: (locale: LocaleData) => T,\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): T[] =>\n locales.map((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n })\n );\n\n/**\n * Flatten the locale map into a single array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * [{\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }],\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an array of objects\n * @returns An array of objects\n */\nexport const localeFlatMap = <T>(\n mapper: (locale: LocaleData) => T[],\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): T[] =>\n locales.flatMap((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n })\n );\n\n/**\n * Creates a record object mapping locales to values transformed by the mapper function\n *\n * @example\n * ```ts\n * const translations = localeRecord(({ locale }) =>\n * require(`./translations/${locale}.json`)\n * );\n *\n * // Result\n * {\n * en: { ... }, // Content of translations/en.json\n * fr: { ... }, // Content of translations/fr.json\n * es: { ... } // Content of translations/es.json\n * }\n * ```\n *\n * @param mapper - Function that takes locale data and returns a value for that locale\n * @param locales - Array of locale codes to map over (defaults to configured locales)\n * @param defaultLocale - The default locale (defaults to configured default)\n * @param prefixDefault - Whether to prefix the default locale in URLs (defaults to configured value)\n * @returns Record mapping locale codes to mapped values\n */\nexport const localeRecord = <T>(\n mapper: (locale: LocaleData) => T,\n locales: Locales[] = configuration?.internationalization.locales,\n defaultLocale: Locales = configuration?.internationalization.defaultLocale,\n prefixDefault: boolean = configuration?.middleware.prefixDefault\n): Record<Locales, T> =>\n locales.reduce(\n (acc, locale) => {\n acc[locale] = mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix:\n locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n });\n return acc;\n },\n {} as Record<Locales, T>\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAqCnB,MAAM,YAAY,CACvB,QACA,UAA2B,aAAAA,QAAc,qBAAqB,SAC9D,gBAA+B,aAAAA,QAAc,qBAC1C,eACH,gBAAyB,aAAAA,QAAc,WAAW,kBAElD,QAAQ;AAAA,EAAI,CAAC,WACX,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,EACzE,CAAC;AACH;AA4BK,MAAM,gBAAgB,CAC3B,QACA,UAA2B,aAAAA,QAAc,qBAAqB,SAC9D,gBAA+B,aAAAA,QAAc,qBAC1C,eACH,gBAAyB,aAAAA,QAAc,WAAW,kBAElD,QAAQ;AAAA,EAAQ,CAAC,WACf,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,EACzE,CAAC;AACH;AAyBK,MAAM,eAAe,CAC1B,QACA,UAAqB,aAAAA,SAAe,qBAAqB,SACzD,gBAAyB,aAAAA,SAAe,qBAAqB,eAC7D,gBAAyB,aAAAA,SAAe,WAAW,kBAEnD,QAAQ;AAAA,EACN,CAAC,KAAK,WAAW;AACf,QAAI,MAAM,IAAI,OAAO;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW,WAAW;AAAA,MACtB,WACE,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,IAChE,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EACA,CAAC;AACH;","names":["configuration"]}
@@ -8,7 +8,7 @@ import {
8
8
  nestedPlugin,
9
9
  translationPlugin
10
10
  } from "./plugins.mjs";
11
- const getContent = (node, nodeProps, locale = configuration.internationalization.defaultLocale) => {
11
+ const getContent = (node, nodeProps, locale = configuration?.internationalization.defaultLocale) => {
12
12
  const plugins = [
13
13
  insertionPlugin,
14
14
  translationPlugin(locale),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n conditionPlugin,\n enumerationPlugin,\n filePlugin,\n insertionPlugin,\n nestedPlugin,\n translationPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\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 = Locales,\n>(\n node: T,\n nodeProps: NodeProps,\n locale: L = configuration.internationalization.defaultLocale as L\n) => {\n const plugins: Plugins[] = [\n insertionPlugin,\n translationPlugin(locale),\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>;\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAG1B,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAQA,MAAM,aAAa,CAIxB,MACA,WACA,SAAY,cAAc,qBAAqB,kBAC5C;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA,kBAAkB,MAAM;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,SAAO,kBAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n conditionPlugin,\n enumerationPlugin,\n filePlugin,\n insertionPlugin,\n nestedPlugin,\n translationPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\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 = Locales,\n>(\n node: T,\n nodeProps: NodeProps,\n locale: L = configuration?.internationalization.defaultLocale as L\n) => {\n const plugins: Plugins[] = [\n insertionPlugin,\n translationPlugin(locale),\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>;\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAG1B,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAQA,MAAM,aAAa,CAIxB,MACA,WACA,SAAY,eAAe,qBAAqB,kBAC7C;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA,kBAAkB,MAAM;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,SAAO,kBAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -3,7 +3,7 @@ import { deepTransformNode } from "./deepTransform.mjs";
3
3
  import {
4
4
  translationPlugin
5
5
  } from "./plugins.mjs";
6
- const getLocalisedContent = (node, locale = configuration.internationalization.defaultLocale, nodeProps, fallback = false) => {
6
+ const getLocalisedContent = (node, locale = configuration?.internationalization.defaultLocale, nodeProps, fallback = false) => {
7
7
  const plugins = [
8
8
  translationPlugin(locale, fallback),
9
9
  ...nodeProps.plugins ?? []
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/interpreter/getContent/getLocalisedContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n translationPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\n} from './plugins';\n\n/**\n * Transforms a node in a single pass, applying each plugin as needed.\n * In comparison to `getContent`, this function will only apply the translation plugin.\n * It will not transform enumerations, insertions, or other content types.\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 getLocalisedContent = <\n T extends ContentNode,\n L extends LocalesValues = Locales,\n>(\n node: T,\n locale: L = configuration.internationalization.defaultLocale as L,\n nodeProps: NodeProps,\n fallback: boolean = false // fallback mean that if field is not translated, it will use the default locale\n) => {\n const plugins: Plugins[] = [\n translationPlugin(locale, fallback),\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAG1B,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,OAIK;AAUA,MAAM,sBAAsB,CAIjC,MACA,SAAY,cAAc,qBAAqB,eAC/C,WACA,WAAoB,UACjB;AACH,QAAM,UAAqB;AAAA,IACzB,kBAAkB,QAAQ,QAAQ;AAAA,IAClC,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,SAAO,kBAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../src/interpreter/getContent/getLocalisedContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n translationPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\n} from './plugins';\n\n/**\n * Transforms a node in a single pass, applying each plugin as needed.\n * In comparison to `getContent`, this function will only apply the translation plugin.\n * It will not transform enumerations, insertions, or other content types.\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 getLocalisedContent = <\n T extends ContentNode,\n L extends LocalesValues = Locales,\n>(\n node: T,\n locale: L = configuration?.internationalization.defaultLocale as L,\n nodeProps: NodeProps,\n fallback: boolean = false // fallback mean that if field is not translated, it will use the default locale\n) => {\n const plugins: Plugins[] = [\n translationPlugin(locale, fallback),\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAG1B,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,OAIK;AAUA,MAAM,sBAAsB,CAIjC,MACA,SAAY,eAAe,qBAAqB,eAChD,WACA,WAAoB,UACjB;AACH,QAAM,UAAqB;AAAA,IACzB,kBAAkB,QAAQ,QAAQ;AAAA,IAClC,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,SAAO,kBAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -17,7 +17,7 @@ const localeFlatMap = (mapper, locales = configuration.internationalization.loca
17
17
  urlPrefix: locale === defaultLocale && !prefixDefault ? "" : `/${locale}`
18
18
  })
19
19
  );
20
- const localeRecord = (mapper, locales = configuration.internationalization.locales, defaultLocale = configuration.internationalization.defaultLocale, prefixDefault = configuration.middleware.prefixDefault) => locales.reduce(
20
+ const localeRecord = (mapper, locales = configuration?.internationalization.locales, defaultLocale = configuration?.internationalization.defaultLocale, prefixDefault = configuration?.middleware.prefixDefault) => locales.reduce(
21
21
  (acc, locale) => {
22
22
  acc[locale] = mapper({
23
23
  locale,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/localization/localeMapper.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { Locales, LocalesValues } from '@intlayer/config/client';\n\nexport type LocaleData = {\n locale: LocalesValues;\n defaultLocale: LocalesValues;\n isDefault: boolean;\n locales: LocalesValues[];\n urlPrefix: string;\n};\n\n/**\n * Map the locale data to an array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * ({\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }),\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an object\n * @returns An array of objects\n */\nexport const localeMap = <T extends object>(\n mapper: (locale: LocaleData) => T,\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): T[] =>\n locales.map((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n })\n );\n\n/**\n * Flatten the locale map into a single array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * [{\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }],\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an array of objects\n * @returns An array of objects\n */\nexport const localeFlatMap = <T>(\n mapper: (locale: LocaleData) => T[],\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): T[] =>\n locales.flatMap((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n })\n );\n\n/**\n * Creates a record object mapping locales to values transformed by the mapper function\n *\n * @example\n * ```ts\n * const translations = localeRecord(({ locale }) =>\n * require(`./translations/${locale}.json`)\n * );\n *\n * // Result\n * {\n * en: { ... }, // Content of translations/en.json\n * fr: { ... }, // Content of translations/fr.json\n * es: { ... } // Content of translations/es.json\n * }\n * ```\n *\n * @param mapper - Function that takes locale data and returns a value for that locale\n * @param locales - Array of locale codes to map over (defaults to configured locales)\n * @param defaultLocale - The default locale (defaults to configured default)\n * @param prefixDefault - Whether to prefix the default locale in URLs (defaults to configured value)\n * @returns Record mapping locale codes to mapped values\n */\nexport const localeRecord = <T>(\n mapper: (locale: LocaleData) => T,\n locales: Locales[] = configuration.internationalization.locales,\n defaultLocale: Locales = configuration.internationalization.defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): Record<Locales, T> =>\n locales.reduce(\n (acc, locale) => {\n acc[locale] = mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix:\n locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n });\n return acc;\n },\n {} as Record<Locales, T>\n );\n"],"mappings":"AAAA,OAAO,mBAAmB;AAqCnB,MAAM,YAAY,CACvB,QACA,UAA2B,cAAc,qBAAqB,SAC9D,gBAA+B,cAAc,qBAC1C,eACH,gBAAyB,cAAc,WAAW,kBAElD,QAAQ;AAAA,EAAI,CAAC,WACX,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,EACzE,CAAC;AACH;AA4BK,MAAM,gBAAgB,CAC3B,QACA,UAA2B,cAAc,qBAAqB,SAC9D,gBAA+B,cAAc,qBAC1C,eACH,gBAAyB,cAAc,WAAW,kBAElD,QAAQ;AAAA,EAAQ,CAAC,WACf,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,EACzE,CAAC;AACH;AAyBK,MAAM,eAAe,CAC1B,QACA,UAAqB,cAAc,qBAAqB,SACxD,gBAAyB,cAAc,qBAAqB,eAC5D,gBAAyB,cAAc,WAAW,kBAElD,QAAQ;AAAA,EACN,CAAC,KAAK,WAAW;AACf,QAAI,MAAM,IAAI,OAAO;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW,WAAW;AAAA,MACtB,WACE,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,IAChE,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EACA,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../src/localization/localeMapper.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { Locales, LocalesValues } from '@intlayer/config/client';\n\nexport type LocaleData = {\n locale: LocalesValues;\n defaultLocale: LocalesValues;\n isDefault: boolean;\n locales: LocalesValues[];\n urlPrefix: string;\n};\n\n/**\n * Map the locale data to an array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * ({\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }),\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an object\n * @returns An array of objects\n */\nexport const localeMap = <T>(\n mapper: (locale: LocaleData) => T,\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): T[] =>\n locales.map((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n })\n );\n\n/**\n * Flatten the locale map into a single array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * [{\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }],\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an array of objects\n * @returns An array of objects\n */\nexport const localeFlatMap = <T>(\n mapper: (locale: LocaleData) => T[],\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): T[] =>\n locales.flatMap((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n })\n );\n\n/**\n * Creates a record object mapping locales to values transformed by the mapper function\n *\n * @example\n * ```ts\n * const translations = localeRecord(({ locale }) =>\n * require(`./translations/${locale}.json`)\n * );\n *\n * // Result\n * {\n * en: { ... }, // Content of translations/en.json\n * fr: { ... }, // Content of translations/fr.json\n * es: { ... } // Content of translations/es.json\n * }\n * ```\n *\n * @param mapper - Function that takes locale data and returns a value for that locale\n * @param locales - Array of locale codes to map over (defaults to configured locales)\n * @param defaultLocale - The default locale (defaults to configured default)\n * @param prefixDefault - Whether to prefix the default locale in URLs (defaults to configured value)\n * @returns Record mapping locale codes to mapped values\n */\nexport const localeRecord = <T>(\n mapper: (locale: LocaleData) => T,\n locales: Locales[] = configuration?.internationalization.locales,\n defaultLocale: Locales = configuration?.internationalization.defaultLocale,\n prefixDefault: boolean = configuration?.middleware.prefixDefault\n): Record<Locales, T> =>\n locales.reduce(\n (acc, locale) => {\n acc[locale] = mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix:\n locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n });\n return acc;\n },\n {} as Record<Locales, T>\n );\n"],"mappings":"AAAA,OAAO,mBAAmB;AAqCnB,MAAM,YAAY,CACvB,QACA,UAA2B,cAAc,qBAAqB,SAC9D,gBAA+B,cAAc,qBAC1C,eACH,gBAAyB,cAAc,WAAW,kBAElD,QAAQ;AAAA,EAAI,CAAC,WACX,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,EACzE,CAAC;AACH;AA4BK,MAAM,gBAAgB,CAC3B,QACA,UAA2B,cAAc,qBAAqB,SAC9D,gBAA+B,cAAc,qBAC1C,eACH,gBAAyB,cAAc,WAAW,kBAElD,QAAQ;AAAA,EAAQ,CAAC,WACf,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,EACzE,CAAC;AACH;AAyBK,MAAM,eAAe,CAC1B,QACA,UAAqB,eAAe,qBAAqB,SACzD,gBAAyB,eAAe,qBAAqB,eAC7D,gBAAyB,eAAe,WAAW,kBAEnD,QAAQ;AAAA,EACN,CAAC,KAAK,WAAW;AACf,QAAI,MAAM,IAAI,OAAO;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW,WAAW;AAAA,MACtB,WACE,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,IAChE,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EACA,CAAC;AACH;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"getContent.d.ts","sourceRoot":"","sources":["../../../../src/interpreter/getContent/getContent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAOL,KAAK,oBAAoB,EACzB,KAAK,SAAS,EAEf,MAAM,WAAW,CAAC;AAEnB;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GACrB,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,aAAa,GAAG,OAAO,EAEjC,MAAM,CAAC,EACP,WAAW,SAAS,EACpB,SAAQ,CAAyD,KAe3D,oBAAoB,CAAC,CAAC,CAC7B,CAAC"}
1
+ {"version":3,"file":"getContent.d.ts","sourceRoot":"","sources":["../../../../src/interpreter/getContent/getContent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAOL,KAAK,oBAAoB,EACzB,KAAK,SAAS,EAEf,MAAM,WAAW,CAAC;AAEnB;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GACrB,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,aAAa,GAAG,OAAO,EAEjC,MAAM,CAAC,EACP,WAAW,SAAS,EACpB,SAAQ,CAA0D,KAe5D,oBAAoB,CAAC,CAAC,CAC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getLocalisedContent.d.ts","sourceRoot":"","sources":["../../../../src/interpreter/getContent/getLocalisedContent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,SAAS,EAEf,MAAM,WAAW,CAAC;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,aAAa,GAAG,OAAO,EAEjC,MAAM,CAAC,EACP,QAAQ,CAAyD,EACjE,WAAW,SAAS,EACpB,WAAU,OAAe,KAUnB,oBAAoB,CAAC,CAAC,CAC7B,CAAC"}
1
+ {"version":3,"file":"getLocalisedContent.d.ts","sourceRoot":"","sources":["../../../../src/interpreter/getContent/getLocalisedContent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,SAAS,EAEf,MAAM,WAAW,CAAC;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,aAAa,GAAG,OAAO,EAEjC,MAAM,CAAC,EACP,QAAQ,CAA0D,EAClE,WAAW,SAAS,EACpB,WAAU,OAAe,KAUnB,oBAAoB,CAAC,CAAC,CAC7B,CAAC"}
@@ -32,7 +32,7 @@ export type LocaleData = {
32
32
  * @param mapper - The mapper function that returns an object
33
33
  * @returns An array of objects
34
34
  */
35
- export declare const localeMap: <T extends object>(mapper: (locale: LocaleData) => T, locales?: LocalesValues[], defaultLocale?: LocalesValues, prefixDefault?: boolean) => T[];
35
+ export declare const localeMap: <T>(mapper: (locale: LocaleData) => T, locales?: LocalesValues[], defaultLocale?: LocalesValues, prefixDefault?: boolean) => T[];
36
36
  /**
37
37
  * Flatten the locale map into a single array of objects
38
38
  *
@@ -1 +1 @@
1
- {"version":3,"file":"localeMapper.d.ts","sourceRoot":"","sources":["../../../src/localization/localeMapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,EACxC,QAAQ,CAAC,MAAM,EAAE,UAAU,KAAK,CAAC,EACjC,UAAS,aAAa,EAA+C,EACrE,gBAAe,aACC,EAChB,gBAAe,OAAgD,KAC9D,CAAC,EASD,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAC7B,QAAQ,CAAC,MAAM,EAAE,UAAU,KAAK,CAAC,EAAE,EACnC,UAAS,aAAa,EAA+C,EACrE,gBAAe,aACC,EAChB,gBAAe,OAAgD,KAC9D,CAAC,EASD,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAC5B,QAAQ,CAAC,MAAM,EAAE,UAAU,KAAK,CAAC,EACjC,UAAS,OAAO,EAA+C,EAC/D,gBAAe,OAA0D,EACzE,gBAAe,OAAgD,KAC9D,MAAM,CAAC,OAAO,EAAE,CAAC,CAcjB,CAAC"}
1
+ {"version":3,"file":"localeMapper.d.ts","sourceRoot":"","sources":["../../../src/localization/localeMapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EACzB,QAAQ,CAAC,MAAM,EAAE,UAAU,KAAK,CAAC,EACjC,UAAS,aAAa,EAA+C,EACrE,gBAAe,aACC,EAChB,gBAAe,OAAgD,KAC9D,CAAC,EASD,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAC7B,QAAQ,CAAC,MAAM,EAAE,UAAU,KAAK,CAAC,EAAE,EACnC,UAAS,aAAa,EAA+C,EACrE,gBAAe,aACC,EAChB,gBAAe,OAAgD,KAC9D,CAAC,EASD,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAC5B,QAAQ,CAAC,MAAM,EAAE,UAAU,KAAK,CAAC,EACjC,UAAS,OAAO,EAAgD,EAChE,gBAAe,OAA2D,EAC1E,gBAAe,OAAiD,KAC/D,MAAM,CAAC,OAAO,EAAE,CAAC,CAcjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "5.5.11",
3
+ "version": "5.6.0",
4
4
  "private": false,
5
5
  "description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
6
6
  "keywords": [
@@ -75,9 +75,9 @@
75
75
  ],
76
76
  "dependencies": {
77
77
  "negotiator": "^1.0.0",
78
- "@intlayer/api": "5.5.11",
79
- "@intlayer/dictionaries-entry": "5.5.11",
80
- "@intlayer/config": "5.5.11"
78
+ "@intlayer/api": "5.6.0",
79
+ "@intlayer/config": "5.6.0",
80
+ "@intlayer/dictionaries-entry": "5.6.0"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@types/negotiator": "^0.6.3",
@@ -91,16 +91,16 @@
91
91
  "tsup": "^8.5.0",
92
92
  "typescript": "^5.8.3",
93
93
  "vitest": "^3.2.2",
94
- "@utils/ts-config": "1.0.4",
95
94
  "@utils/eslint-config": "1.0.4",
95
+ "@utils/ts-config-types": "1.0.4",
96
96
  "@utils/tsup-config": "1.0.4",
97
- "@utils/ts-config-types": "1.0.4"
97
+ "@utils/ts-config": "1.0.4"
98
98
  },
99
99
  "peerDependencies": {
100
- "@intlayer/api": "5.5.11",
101
- "intlayer": "5.5.11",
102
- "@intlayer/config": "5.5.11",
103
- "@intlayer/dictionaries-entry": "5.5.11"
100
+ "@intlayer/api": "5.6.0",
101
+ "@intlayer/config": "5.6.0",
102
+ "@intlayer/dictionaries-entry": "5.6.0",
103
+ "intlayer": "5.6.0"
104
104
  },
105
105
  "engines": {
106
106
  "node": ">=14.18"