@intlayer/core 7.0.4-canary.0 → 7.0.5

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.
Files changed (34) hide show
  1. package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs +5 -0
  2. package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs.map +1 -1
  3. package/dist/cjs/deepTransformPlugins/getMultilingualDictionary.cjs +87 -0
  4. package/dist/cjs/deepTransformPlugins/getMultilingualDictionary.cjs.map +1 -0
  5. package/dist/cjs/deepTransformPlugins/index.cjs +3 -0
  6. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs +2 -1
  7. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs.map +1 -1
  8. package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs +1 -1
  9. package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs.map +1 -1
  10. package/dist/cjs/index.cjs +3 -0
  11. package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs +5 -1
  12. package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs.map +1 -1
  13. package/dist/esm/deepTransformPlugins/getMultilingualDictionary.mjs +87 -0
  14. package/dist/esm/deepTransformPlugins/getMultilingualDictionary.mjs.map +1 -0
  15. package/dist/esm/deepTransformPlugins/index.mjs +3 -2
  16. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs +2 -1
  17. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs.map +1 -1
  18. package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs +1 -1
  19. package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs.map +1 -1
  20. package/dist/esm/index.mjs +3 -2
  21. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +4 -4
  22. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +4 -4
  23. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +4 -4
  24. package/dist/types/deepTransformPlugins/getMissingLocalesContent.d.ts +3 -2
  25. package/dist/types/deepTransformPlugins/getMissingLocalesContent.d.ts.map +1 -1
  26. package/dist/types/deepTransformPlugins/getMultilingualDictionary.d.ts +33 -0
  27. package/dist/types/deepTransformPlugins/getMultilingualDictionary.d.ts.map +1 -0
  28. package/dist/types/deepTransformPlugins/index.d.ts +3 -2
  29. package/dist/types/dictionaryManipulator/mergeDictionaries.d.ts.map +1 -1
  30. package/dist/types/dictionaryManipulator/normalizeDictionary.d.ts.map +1 -1
  31. package/dist/types/index.d.ts +3 -2
  32. package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
  33. package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -1
  34. package/package.json +14 -14
@@ -38,8 +38,13 @@ const getMissingLocalesContent = (node, locales = __intlayer_config_built.defaul
38
38
  });
39
39
  return Array.from(missingLocales);
40
40
  };
41
+ const getMissingLocalesContentFromDictionary = (dictionary, locales = __intlayer_config_built.default?.internationalization?.locales) => getMissingLocalesContent(dictionary.content, locales, {
42
+ dictionaryKey: dictionary.key,
43
+ keyPath: []
44
+ });
41
45
 
42
46
  //#endregion
43
47
  exports.checkMissingLocalesPlugin = checkMissingLocalesPlugin;
44
48
  exports.getMissingLocalesContent = getMissingLocalesContent;
49
+ exports.getMissingLocalesContentFromDictionary = getMissingLocalesContentFromDictionary;
45
50
  //# sourceMappingURL=getMissingLocalesContent.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getMissingLocalesContent.cjs","names":["NodeType","configuration","plugins: Plugins[]"],"sources":["../../../src/deepTransformPlugins/getMissingLocalesContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n type ContentNode,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport type { DeepTransformContent, NodeProps, Plugins } from '../interpreter';\nimport { deepTransformNode } from '../interpreter/getContent/deepTransform';\nimport type { TranslationContent } from '../transpiler';\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const checkMissingLocalesPlugin = (\n locales: Locale[],\n onMissingLocale: (locale: Locale) => void\n): Plugins => ({\n id: 'check-missing-locales-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node: TranslationContent, props, deepTransformNode) => {\n for (const locale of locales) {\n if (\n !node[NodeType.Translation][\n locale as keyof (typeof node)[NodeType.Translation]\n ]\n ) {\n onMissingLocale(locale);\n }\n }\n\n // Continue traversal inside the translation values, but avoid re-applying this plugin on the same node\n const translations = node[NodeType.Translation] as Record<string, any>;\n for (const key in translations) {\n const child = translations[key];\n deepTransformNode(child, {\n ...props,\n children: child,\n });\n }\n\n // Return the original node; the return value is ignored by the caller\n return node;\n },\n});\n\n/**\n * Return the content of a node with only the translation plugin.\n *\n * @param node The node to transform.\n * @param locales The locales to check for missing translations.\n */\nexport const getMissingLocalesContent = <T extends ContentNode>(\n node: T,\n locales: LocalesValues[] = configuration?.internationalization?.locales,\n nodeProps: NodeProps\n): Locale[] => {\n const missingLocales = new Set<Locale>();\n\n const plugins: Plugins[] = [\n checkMissingLocalesPlugin(locales as Locale[], (locale) =>\n missingLocales.add(locale)\n ),\n ...(nodeProps.plugins ?? []),\n ];\n\n deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n\n return Array.from(missingLocales);\n};\n"],"mappings":";;;;;;;;;AAYA,MAAa,6BACX,SACA,qBACa;CACb,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAaA,0BAAS;CAC1D,YAAY,MAA0B,OAAO,wBAAsB;AACjE,OAAK,MAAM,UAAU,QACnB,KACE,CAAC,KAAKA,0BAAS,aACb,QAGF,iBAAgB,OAAO;EAK3B,MAAM,eAAe,KAAKA,0BAAS;AACnC,OAAK,MAAM,OAAO,cAAc;GAC9B,MAAM,QAAQ,aAAa;AAC3B,uBAAkB,OAAO;IACvB,GAAG;IACH,UAAU;IACX,CAAC;;AAIJ,SAAO;;CAEV;;;;;;;AAQD,MAAa,4BACX,MACA,UAA2BC,iCAAe,sBAAsB,SAChE,cACa;CACb,MAAM,iCAAiB,IAAI,KAAa;CAExC,MAAMC,UAAqB,CACzB,0BAA0B,UAAsB,WAC9C,eAAe,IAAI,OAAO,CAC3B,EACD,GAAI,UAAU,WAAW,EAAE,CAC5B;AAED,gEAAkB,MAAM;EACtB,GAAG;EACH;EACD,CAAC;AAEF,QAAO,MAAM,KAAK,eAAe"}
1
+ {"version":3,"file":"getMissingLocalesContent.cjs","names":["NodeType","configuration","plugins: Plugins[]"],"sources":["../../../src/deepTransformPlugins/getMissingLocalesContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/types';\nimport {\n type ContentNode,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport type { DeepTransformContent, NodeProps, Plugins } from '../interpreter';\nimport { deepTransformNode } from '../interpreter/getContent/deepTransform';\nimport type { TranslationContent } from '../transpiler';\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const checkMissingLocalesPlugin = (\n locales: Locale[],\n onMissingLocale: (locale: Locale) => void\n): Plugins => ({\n id: 'check-missing-locales-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node: TranslationContent, props, deepTransformNode) => {\n for (const locale of locales) {\n if (\n !node[NodeType.Translation][\n locale as keyof (typeof node)[NodeType.Translation]\n ]\n ) {\n onMissingLocale(locale);\n }\n }\n\n // Continue traversal inside the translation values, but avoid re-applying this plugin on the same node\n const translations = node[NodeType.Translation] as Record<string, any>;\n for (const key in translations) {\n const child = translations[key];\n deepTransformNode(child, {\n ...props,\n children: child,\n });\n }\n\n // Return the original node; the return value is ignored by the caller\n return node;\n },\n});\n\n/**\n * Return the content of a node with only the translation plugin.\n *\n * @param node The node to transform.\n * @param locales The locales to check for missing translations.\n */\nexport const getMissingLocalesContent = <T extends ContentNode>(\n node: T,\n locales: LocalesValues[] = configuration?.internationalization?.locales,\n nodeProps: NodeProps\n): Locale[] => {\n const missingLocales = new Set<Locale>();\n\n const plugins: Plugins[] = [\n checkMissingLocalesPlugin(locales as Locale[], (locale) =>\n missingLocales.add(locale)\n ),\n ...(nodeProps.plugins ?? []),\n ];\n\n deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n\n return Array.from(missingLocales);\n};\n\nexport const getMissingLocalesContentFromDictionary = (\n dictionary: Dictionary,\n locales: LocalesValues[] = configuration?.internationalization?.locales\n) =>\n getMissingLocalesContent(dictionary.content, locales, {\n dictionaryKey: dictionary.key,\n keyPath: [],\n });\n"],"mappings":";;;;;;;;;AAaA,MAAa,6BACX,SACA,qBACa;CACb,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAaA,0BAAS;CAC1D,YAAY,MAA0B,OAAO,wBAAsB;AACjE,OAAK,MAAM,UAAU,QACnB,KACE,CAAC,KAAKA,0BAAS,aACb,QAGF,iBAAgB,OAAO;EAK3B,MAAM,eAAe,KAAKA,0BAAS;AACnC,OAAK,MAAM,OAAO,cAAc;GAC9B,MAAM,QAAQ,aAAa;AAC3B,uBAAkB,OAAO;IACvB,GAAG;IACH,UAAU;IACX,CAAC;;AAIJ,SAAO;;CAEV;;;;;;;AAQD,MAAa,4BACX,MACA,UAA2BC,iCAAe,sBAAsB,SAChE,cACa;CACb,MAAM,iCAAiB,IAAI,KAAa;CAExC,MAAMC,UAAqB,CACzB,0BAA0B,UAAsB,WAC9C,eAAe,IAAI,OAAO,CAC3B,EACD,GAAI,UAAU,WAAW,EAAE,CAC5B;AAED,gEAAkB,MAAM;EACtB,GAAG;EACH;EACD,CAAC;AAEF,QAAO,MAAM,KAAK,eAAe;;AAGnC,MAAa,0CACX,YACA,UAA2BD,iCAAe,sBAAsB,YAEhE,yBAAyB,WAAW,SAAS,SAAS;CACpD,eAAe,WAAW;CAC1B,SAAS,EAAE;CACZ,CAAC"}
@@ -0,0 +1,87 @@
1
+ const require_interpreter_getContent_deepTransform = require('../interpreter/getContent/deepTransform.cjs');
2
+ const require_transpiler_translation_translation = require('../transpiler/translation/translation.cjs');
3
+
4
+ //#region src/deepTransformPlugins/getMultilingualDictionary.ts
5
+ /**
6
+ * Transform a per-locale dictionary into a multilingual dictionary.
7
+ *
8
+ * Example:
9
+ * ```json
10
+ * {
11
+ * "key": "about-page",
12
+ * "locale": "en",
13
+ * "content": {
14
+ * "myContent": "English content"
15
+ * }
16
+ * }
17
+ * ```
18
+ *
19
+ * ```json
20
+ * {
21
+ * "key": "about-page",
22
+ * "content": {
23
+ * "myContent": t({
24
+ * "en": "English content",
25
+ * })
26
+ * }
27
+ * }
28
+ * ```
29
+ */
30
+ const getMultilingualDictionary = (dictionary) => {
31
+ if (!dictionary.locale) return dictionary;
32
+ const locale = dictionary.locale;
33
+ const transformedContent = require_interpreter_getContent_deepTransform.deepTransformNode(JSON.parse(JSON.stringify(dictionary.content)), {
34
+ dictionaryKey: dictionary.key,
35
+ keyPath: [],
36
+ plugins: [{
37
+ id: "traverse-typed-node-plugin",
38
+ canHandle: (node) => typeof node === "object" && typeof node?.nodeType === "string",
39
+ transform: (node, props, transformFn) => {
40
+ const nodeType = node.nodeType;
41
+ const inner = structuredClone(node[nodeType]);
42
+ if (typeof inner !== "object" || inner === null) {
43
+ const transformed = transformFn(inner, {
44
+ ...props,
45
+ children: inner,
46
+ keyPath: [...props.keyPath, {
47
+ type: nodeType,
48
+ key: nodeType
49
+ }]
50
+ });
51
+ return {
52
+ ...node,
53
+ [nodeType]: transformed
54
+ };
55
+ }
56
+ for (const key in inner) {
57
+ const childProps = {
58
+ ...props,
59
+ children: inner[key],
60
+ keyPath: [...props.keyPath, {
61
+ type: nodeType,
62
+ key
63
+ }]
64
+ };
65
+ inner[key] = transformFn(inner[key], childProps);
66
+ }
67
+ return {
68
+ ...node,
69
+ [nodeType]: inner
70
+ };
71
+ }
72
+ }, {
73
+ id: "wrap-primitive-in-translation",
74
+ canHandle: (node) => typeof node === "string" || typeof node === "number" || typeof node === "boolean",
75
+ transform: (node) => require_transpiler_translation_translation.t({ [locale]: node })
76
+ }]
77
+ });
78
+ const { locale: _omitLocale,...rest } = dictionary;
79
+ return {
80
+ ...rest,
81
+ content: transformedContent
82
+ };
83
+ };
84
+
85
+ //#endregion
86
+ exports.getMultilingualDictionary = getMultilingualDictionary;
87
+ //# sourceMappingURL=getMultilingualDictionary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMultilingualDictionary.cjs","names":["deepTransformNode","childProps: NodeProps","t"],"sources":["../../../src/deepTransformPlugins/getMultilingualDictionary.ts"],"sourcesContent":["import type { Dictionary, KeyPath, NodeType, TypedNode } from '@intlayer/types';\nimport {\n deepTransformNode,\n type NodeProps,\n type Plugins,\n} from '../interpreter';\nimport { t } from '../transpiler';\n\n/**\n * Transform a per-locale dictionary into a multilingual dictionary.\n *\n * Example:\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"locale\": \"en\",\n * \"content\": {\n * \"myContent\": \"English content\"\n * }\n * }\n * ```\n *\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"content\": {\n * \"myContent\": t({\n * \"en\": \"English content\",\n * })\n * }\n * }\n * ```\n */\nexport const getMultilingualDictionary = (\n dictionary: Dictionary\n): Dictionary => {\n if (!dictionary.locale) {\n return dictionary;\n }\n\n const locale = dictionary.locale;\n\n const wrapPrimitiveInTranslationPlugin: Plugins = {\n id: 'wrap-primitive-in-translation',\n canHandle: (node) =>\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean',\n transform: (node) => t({ [locale]: node } as Record<string, unknown>),\n };\n\n const traverseTypedNodePlugin: Plugins = {\n id: 'traverse-typed-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' && typeof (node as any)?.nodeType === 'string',\n transform: (node: TypedNode, props, transformFn) => {\n const nodeType = (node as any).nodeType as NodeType;\n const inner = structuredClone(\n (node as any)[nodeType as unknown as keyof TypedNode] as any\n );\n\n if (typeof inner !== 'object' || inner === null) {\n const transformed = transformFn(inner, {\n ...props,\n children: inner,\n keyPath: [\n ...props.keyPath,\n { type: nodeType, key: nodeType } as KeyPath,\n ],\n });\n return {\n ...node,\n [nodeType as unknown as keyof TypedNode]: transformed,\n };\n }\n\n for (const key in inner) {\n const childProps: NodeProps = {\n ...props,\n children: inner[key as unknown as keyof typeof inner],\n keyPath: [...props.keyPath, { type: nodeType, key } as KeyPath],\n };\n inner[key as unknown as keyof typeof inner] = transformFn(\n inner[key as unknown as keyof typeof inner],\n childProps\n );\n }\n\n return { ...node, [nodeType as unknown as keyof TypedNode]: inner };\n },\n };\n\n const transformedContent = deepTransformNode(\n JSON.parse(JSON.stringify(dictionary.content)),\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [traverseTypedNodePlugin, wrapPrimitiveInTranslationPlugin],\n }\n );\n\n const { locale: _omitLocale, ...rest } = dictionary as any;\n return {\n ...rest,\n content: transformedContent,\n } as Dictionary;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,6BACX,eACe;AACf,KAAI,CAAC,WAAW,OACd,QAAO;CAGT,MAAM,SAAS,WAAW;CAoD1B,MAAM,qBAAqBA,+DACzB,KAAK,MAAM,KAAK,UAAU,WAAW,QAAQ,CAAC,EAC9C;EACE,eAAe,WAAW;EAC1B,SAAS,EAAE;EACX,SAAS,CA9C4B;GACvC,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAAY,OAAQ,MAAc,aAAa;GACjE,YAAY,MAAiB,OAAO,gBAAgB;IAClD,MAAM,WAAY,KAAa;IAC/B,MAAM,QAAQ,gBACX,KAAa,UACf;AAED,QAAI,OAAO,UAAU,YAAY,UAAU,MAAM;KAC/C,MAAM,cAAc,YAAY,OAAO;MACrC,GAAG;MACH,UAAU;MACV,SAAS,CACP,GAAG,MAAM,SACT;OAAE,MAAM;OAAU,KAAK;OAAU,CAClC;MACF,CAAC;AACF,YAAO;MACL,GAAG;OACF,WAAyC;MAC3C;;AAGH,SAAK,MAAM,OAAO,OAAO;KACvB,MAAMC,aAAwB;MAC5B,GAAG;MACH,UAAU,MAAM;MAChB,SAAS,CAAC,GAAG,MAAM,SAAS;OAAE,MAAM;OAAU;OAAK,CAAY;MAChE;AACD,WAAM,OAAwC,YAC5C,MAAM,MACN,WACD;;AAGH,WAAO;KAAE,GAAG;MAAO,WAAyC;KAAO;;GAEtE,EAhDiD;GAChD,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;GAClB,YAAY,SAASC,6CAAE,GAAG,SAAS,MAAM,CAA4B;GACtE,CAgDuE;EACrE,CACF;CAED,MAAM,EAAE,QAAQ,YAAa,GAAG,SAAS;AACzC,QAAO;EACL,GAAG;EACH,SAAS;EACV"}
@@ -4,6 +4,7 @@ const require_deepTransformPlugins_getFilterTranslationsOnlyContent = require('.
4
4
  const require_deepTransformPlugins_getLocalizedContent = require('./getLocalizedContent.cjs');
5
5
  const require_deepTransformPlugins_getMaskContent = require('./getMaskContent.cjs');
6
6
  const require_deepTransformPlugins_getMissingLocalesContent = require('./getMissingLocalesContent.cjs');
7
+ const require_deepTransformPlugins_getMultilingualDictionary = require('./getMultilingualDictionary.cjs');
7
8
  const require_deepTransformPlugins_getReplacedValuesContent = require('./getReplacedValuesContent.cjs');
8
9
  const require_deepTransformPlugins_getSplittedContent = require('./getSplittedContent.cjs');
9
10
  const require_deepTransformPlugins_insertContentInDictionary = require('./insertContentInDictionary.cjs');
@@ -21,6 +22,8 @@ exports.getFilteredLocalesDictionary = require_deepTransformPlugins_getFilteredL
21
22
  exports.getLocalizedContent = require_deepTransformPlugins_getLocalizedContent.getLocalizedContent;
22
23
  exports.getMaskContent = require_deepTransformPlugins_getMaskContent.getMaskContent;
23
24
  exports.getMissingLocalesContent = require_deepTransformPlugins_getMissingLocalesContent.getMissingLocalesContent;
25
+ exports.getMissingLocalesContentFromDictionary = require_deepTransformPlugins_getMissingLocalesContent.getMissingLocalesContentFromDictionary;
26
+ exports.getMultilingualDictionary = require_deepTransformPlugins_getMultilingualDictionary.getMultilingualDictionary;
24
27
  exports.getPerLocaleDictionary = require_deepTransformPlugins_getLocalizedContent.getPerLocaleDictionary;
25
28
  exports.getReplacedValuesContent = require_deepTransformPlugins_getReplacedValuesContent.getReplacedValuesContent;
26
29
  exports.getSplittedContent = require_deepTransformPlugins_getSplittedContent.getSplittedContent;
@@ -1,4 +1,5 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_deepTransformPlugins_getMultilingualDictionary = require('../deepTransformPlugins/getMultilingualDictionary.cjs');
2
3
  const require_dictionaryManipulator_getNodeType = require('./getNodeType.cjs');
3
4
  let __intlayer_config_client = require("@intlayer/config/client");
4
5
  __intlayer_config_client = require_rolldown_runtime.__toESM(__intlayer_config_client);
@@ -53,7 +54,7 @@ const mergeDictionaries = (dictionaries) => {
53
54
  if (new Set(dictionariesKeys).size !== 1) throw new Error("All dictionaries must have the same key");
54
55
  let mergedContent = dictionaries[0].content;
55
56
  for (let i = 1; i < dictionaries.length; i++) {
56
- const currentDictionary = dictionaries[i];
57
+ const currentDictionary = require_deepTransformPlugins_getMultilingualDictionary.getMultilingualDictionary(dictionaries[i]);
57
58
  checkTypesMatch(mergedContent, currentDictionary.content, currentDictionary.localId, currentDictionary.key, []);
58
59
  mergedContent = customMerge(mergedContent, currentDictionary.content);
59
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mergeDictionaries.cjs","names":["configuration","getNodeType","result: Record<string, MergeableContent>","result: MergeableContent[]","mergedContent: Dictionary['content']"],"sources":["../../../src/dictionaryManipulator/mergeDictionaries.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizeKey, getAppLogger } from '@intlayer/config/client';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types';\nimport { getNodeType } from './getNodeType';\n\n// Extended type that includes arrays for internal merge operations\ntype MergeableContent = ContentNode | ContentNode[];\n\nconst checkTypesMatch = (\n object1: ContentNode,\n object2: ContentNode,\n object2LocalId: LocalDictionaryId | undefined,\n dictionaryKey: string,\n path: string[] = []\n): void => {\n const appLogger = getAppLogger(configuration);\n\n // If either side is missing/undefined, allow merge without error\n if (\n object1 === undefined ||\n object1 === null ||\n object2 === undefined ||\n object2 === null\n )\n return;\n\n const type1 = getNodeType(object1);\n const type2 = getNodeType(object2);\n\n // Unknown types are treated as flexible; skip strict mismatch reporting\n if (type1 === 'unknown' || type2 === 'unknown') return;\n\n if (type1 !== type2) {\n appLogger(\n [\n `Error: Dictionary ${colorizeKey(dictionaryKey)} has a multiple content files with type mismatch at path \"${path.join('.')}\": Cannot merge ${type1} with ${type2} while merging ${object2LocalId}`,\n ],\n {\n level: 'error',\n }\n );\n\n return;\n }\n};\n\n// Custom merge function that prefers destination (first dictionary) values\nconst customMerge = (\n destination: ContentNode,\n source: ContentNode\n): MergeableContent => {\n // If destination is undefined/null, use source\n if (destination === undefined || destination === null) {\n return source;\n }\n\n // If source is undefined/null, use destination\n if (source === undefined || source === null) {\n return destination;\n }\n\n // For primitive values, prefer destination (first dictionary)\n if (typeof destination !== 'object' || typeof source !== 'object') {\n return destination;\n }\n\n // For arrays, use our custom array merge\n if (Array.isArray(destination) && Array.isArray(source)) {\n return arrayMerge(\n destination as ContentNode[],\n source as ContentNode[]\n ) as MergeableContent;\n }\n\n // For objects, recursively merge with our custom logic\n if (typeof destination === 'object' && typeof source === 'object') {\n const result: Record<string, MergeableContent> = {};\n const allKeys = new Set([\n ...Object.keys(destination as unknown as Record<string, ContentNode>),\n ...Object.keys(source as unknown as Record<string, ContentNode>),\n ]);\n\n for (const key of allKeys) {\n result[key] = customMerge(\n (destination as unknown as Record<string, ContentNode>)[key],\n (source as unknown as Record<string, ContentNode>)[key]\n );\n }\n\n return result as unknown as MergeableContent;\n }\n\n // Fallback to destination\n return destination;\n};\n\n// Custom array merge strategy that merges arrays by key when present, otherwise by index\nconst arrayMerge = (\n destinationArray: ContentNode[],\n sourceArray: ContentNode[]\n): MergeableContent[] => {\n // Check if both arrays contain only primitives\n const destHasOnlyPrimitives = destinationArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n const sourceHasOnlyPrimitives = sourceArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n\n // If both arrays contain only primitives, use the source array (second dictionary)\n if (destHasOnlyPrimitives && sourceHasOnlyPrimitives) {\n return sourceArray;\n }\n\n // Otherwise, merge by index with object merging logic\n const result: MergeableContent[] = [];\n const maxLength = Math.max(destinationArray.length, sourceArray.length);\n\n for (let i = 0; i < maxLength; i++) {\n const destItem = destinationArray[i];\n const sourceItem = sourceArray[i];\n\n if (destItem === undefined && sourceItem === undefined) {\n } else if (destItem === undefined) {\n // Only source exists, add it\n result.push(sourceItem);\n } else if (sourceItem === undefined) {\n // Only destination exists, add it\n result.push(destItem);\n } else {\n // Both exist, merge them\n if (\n typeof destItem === 'object' &&\n typeof sourceItem === 'object' &&\n destItem !== null &&\n sourceItem !== null\n ) {\n // Check if both objects have a 'key' property for keyed merging\n if (\n 'key' in destItem &&\n 'key' in sourceItem &&\n (destItem as Record<string, string>).key ===\n (sourceItem as Record<string, string>).key\n ) {\n // Merge objects with same key, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n } else {\n // Merge objects by index, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n }\n } else {\n // For primitives or non-objects, use destination value (first dictionary)\n result.push(destItem);\n }\n }\n }\n\n return result;\n};\n\nexport const mergeDictionaries = (dictionaries: Dictionary[]): Dictionary => {\n const localIds = Array.from(\n new Set<LocalDictionaryId>(\n dictionaries.filter((dict) => dict.localId).map((dict) => dict.localId!)\n )\n );\n\n const dictionariesKeys = dictionaries.map((dict) => dict.key);\n\n // Check if all dictionaries have the same key\n if (new Set(dictionariesKeys).size !== 1) {\n throw new Error('All dictionaries must have the same key');\n }\n\n let mergedContent: Dictionary['content'] = dictionaries[0].content;\n\n for (let i = 1; i < dictionaries.length; i++) {\n const currentDictionary = dictionaries[i];\n\n // Check types before merging\n checkTypesMatch(\n mergedContent,\n currentDictionary.content,\n currentDictionary.localId,\n currentDictionary.key,\n []\n );\n\n mergedContent = customMerge(\n mergedContent,\n currentDictionary.content\n ) as ContentNode;\n }\n\n const mergedDictionary: Dictionary = {\n key: dictionaries[0].key,\n\n content: mergedContent,\n localIds,\n };\n\n return mergedDictionary;\n};\n"],"mappings":";;;;;;;;AAYA,MAAM,mBACJ,SACA,SACA,gBACA,eACA,OAAiB,EAAE,KACV;CACT,MAAM,uDAAyBA,gCAAc;AAG7C,KACE,YAAY,UACZ,YAAY,QACZ,YAAY,UACZ,YAAY,KAEZ;CAEF,MAAM,QAAQC,sDAAY,QAAQ;CAClC,MAAM,QAAQA,sDAAY,QAAQ;AAGlC,KAAI,UAAU,aAAa,UAAU,UAAW;AAEhD,KAAI,UAAU,OAAO;AACnB,YACE,CACE,+DAAiC,cAAc,CAAC,4DAA4D,KAAK,KAAK,IAAI,CAAC,kBAAkB,MAAM,QAAQ,MAAM,iBAAiB,iBACnL,EACD,EACE,OAAO,SACR,CACF;AAED;;;AAKJ,MAAM,eACJ,aACA,WACqB;AAErB,KAAI,gBAAgB,UAAa,gBAAgB,KAC/C,QAAO;AAIT,KAAI,WAAW,UAAa,WAAW,KACrC,QAAO;AAIT,KAAI,OAAO,gBAAgB,YAAY,OAAO,WAAW,SACvD,QAAO;AAIT,KAAI,MAAM,QAAQ,YAAY,IAAI,MAAM,QAAQ,OAAO,CACrD,QAAO,WACL,aACA,OACD;AAIH,KAAI,OAAO,gBAAgB,YAAY,OAAO,WAAW,UAAU;EACjE,MAAMC,SAA2C,EAAE;EACnD,MAAM,UAAU,IAAI,IAAI,CACtB,GAAG,OAAO,KAAK,YAAsD,EACrE,GAAG,OAAO,KAAK,OAAiD,CACjE,CAAC;AAEF,OAAK,MAAM,OAAO,QAChB,QAAO,OAAO,YACX,YAAuD,MACvD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B,EAAE,CACH;AAED,kBAAgB,YACd,eACA,kBAAkB,QACnB;;AAUH,QAPqC;EACnC,KAAK,aAAa,GAAG;EAErB,SAAS;EACT;EACD"}
1
+ {"version":3,"file":"mergeDictionaries.cjs","names":["configuration","getNodeType","result: Record<string, MergeableContent>","result: MergeableContent[]","mergedContent: Dictionary['content']","getMultilingualDictionary"],"sources":["../../../src/dictionaryManipulator/mergeDictionaries.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizeKey, getAppLogger } from '@intlayer/config/client';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types';\nimport { getMultilingualDictionary } from '../deepTransformPlugins';\nimport { getNodeType } from './getNodeType';\n\n// Extended type that includes arrays for internal merge operations\ntype MergeableContent = ContentNode | ContentNode[];\n\nconst checkTypesMatch = (\n object1: ContentNode,\n object2: ContentNode,\n object2LocalId: LocalDictionaryId | undefined,\n dictionaryKey: string,\n path: string[] = []\n): void => {\n const appLogger = getAppLogger(configuration);\n\n // If either side is missing/undefined, allow merge without error\n if (\n object1 === undefined ||\n object1 === null ||\n object2 === undefined ||\n object2 === null\n )\n return;\n\n const type1 = getNodeType(object1);\n const type2 = getNodeType(object2);\n\n // Unknown types are treated as flexible; skip strict mismatch reporting\n if (type1 === 'unknown' || type2 === 'unknown') return;\n\n if (type1 !== type2) {\n appLogger(\n [\n `Error: Dictionary ${colorizeKey(dictionaryKey)} has a multiple content files with type mismatch at path \"${path.join('.')}\": Cannot merge ${type1} with ${type2} while merging ${object2LocalId}`,\n ],\n {\n level: 'error',\n }\n );\n\n return;\n }\n};\n\n// Custom merge function that prefers destination (first dictionary) values\nconst customMerge = (\n destination: ContentNode,\n source: ContentNode\n): MergeableContent => {\n // If destination is undefined/null, use source\n if (destination === undefined || destination === null) {\n return source;\n }\n\n // If source is undefined/null, use destination\n if (source === undefined || source === null) {\n return destination;\n }\n\n // For primitive values, prefer destination (first dictionary)\n if (typeof destination !== 'object' || typeof source !== 'object') {\n return destination;\n }\n\n // For arrays, use our custom array merge\n if (Array.isArray(destination) && Array.isArray(source)) {\n return arrayMerge(\n destination as ContentNode[],\n source as ContentNode[]\n ) as MergeableContent;\n }\n\n // For objects, recursively merge with our custom logic\n if (typeof destination === 'object' && typeof source === 'object') {\n const result: Record<string, MergeableContent> = {};\n const allKeys = new Set([\n ...Object.keys(destination as unknown as Record<string, ContentNode>),\n ...Object.keys(source as unknown as Record<string, ContentNode>),\n ]);\n\n for (const key of allKeys) {\n result[key] = customMerge(\n (destination as unknown as Record<string, ContentNode>)[key],\n (source as unknown as Record<string, ContentNode>)[key]\n );\n }\n\n return result as unknown as MergeableContent;\n }\n\n // Fallback to destination\n return destination;\n};\n\n// Custom array merge strategy that merges arrays by key when present, otherwise by index\nconst arrayMerge = (\n destinationArray: ContentNode[],\n sourceArray: ContentNode[]\n): MergeableContent[] => {\n // Check if both arrays contain only primitives\n const destHasOnlyPrimitives = destinationArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n const sourceHasOnlyPrimitives = sourceArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n\n // If both arrays contain only primitives, use the source array (second dictionary)\n if (destHasOnlyPrimitives && sourceHasOnlyPrimitives) {\n return sourceArray;\n }\n\n // Otherwise, merge by index with object merging logic\n const result: MergeableContent[] = [];\n const maxLength = Math.max(destinationArray.length, sourceArray.length);\n\n for (let i = 0; i < maxLength; i++) {\n const destItem = destinationArray[i];\n const sourceItem = sourceArray[i];\n\n if (destItem === undefined && sourceItem === undefined) {\n } else if (destItem === undefined) {\n // Only source exists, add it\n result.push(sourceItem);\n } else if (sourceItem === undefined) {\n // Only destination exists, add it\n result.push(destItem);\n } else {\n // Both exist, merge them\n if (\n typeof destItem === 'object' &&\n typeof sourceItem === 'object' &&\n destItem !== null &&\n sourceItem !== null\n ) {\n // Check if both objects have a 'key' property for keyed merging\n if (\n 'key' in destItem &&\n 'key' in sourceItem &&\n (destItem as Record<string, string>).key ===\n (sourceItem as Record<string, string>).key\n ) {\n // Merge objects with same key, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n } else {\n // Merge objects by index, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n }\n } else {\n // For primitives or non-objects, use destination value (first dictionary)\n result.push(destItem);\n }\n }\n }\n\n return result;\n};\n\nexport const mergeDictionaries = (dictionaries: Dictionary[]): Dictionary => {\n const localIds = Array.from(\n new Set<LocalDictionaryId>(\n dictionaries.filter((dict) => dict.localId).map((dict) => dict.localId!)\n )\n );\n\n const dictionariesKeys = dictionaries.map((dict) => dict.key);\n\n // Check if all dictionaries have the same key\n if (new Set(dictionariesKeys).size !== 1) {\n throw new Error('All dictionaries must have the same key');\n }\n\n let mergedContent: Dictionary['content'] = dictionaries[0].content;\n\n for (let i = 1; i < dictionaries.length; i++) {\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n const currentDictionary = getMultilingualDictionary(dictionaries[i]);\n\n // Check types before merging\n checkTypesMatch(\n mergedContent,\n currentDictionary.content,\n currentDictionary.localId,\n currentDictionary.key,\n []\n );\n\n mergedContent = customMerge(\n mergedContent,\n currentDictionary.content\n ) as ContentNode;\n }\n\n const mergedDictionary: Dictionary = {\n key: dictionaries[0].key,\n content: mergedContent,\n localIds,\n };\n\n return mergedDictionary;\n};\n"],"mappings":";;;;;;;;;AAaA,MAAM,mBACJ,SACA,SACA,gBACA,eACA,OAAiB,EAAE,KACV;CACT,MAAM,uDAAyBA,gCAAc;AAG7C,KACE,YAAY,UACZ,YAAY,QACZ,YAAY,UACZ,YAAY,KAEZ;CAEF,MAAM,QAAQC,sDAAY,QAAQ;CAClC,MAAM,QAAQA,sDAAY,QAAQ;AAGlC,KAAI,UAAU,aAAa,UAAU,UAAW;AAEhD,KAAI,UAAU,OAAO;AACnB,YACE,CACE,+DAAiC,cAAc,CAAC,4DAA4D,KAAK,KAAK,IAAI,CAAC,kBAAkB,MAAM,QAAQ,MAAM,iBAAiB,iBACnL,EACD,EACE,O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,KAAK,YAAY,UAAU,WAAW,CAAC;MAIhD,QAAO,KAAK,SAAS;;AAK3B,QAAO;;AAGT,MAAa,qBAAqB,iBAA2C;CAC3E,MAAM,WAAW,MAAM,KACrB,IAAI,IACF,aAAa,QAAQ,SAAS,KAAK,QAAQ,CAAC,KAAK,SAAS,KAAK,QAAS,CACzE,CACF;CAED,MAAM,mBAAmB,aAAa,KAAK,SAAS,KAAK,IAAI;AAG7D,KAAI,IAAI,IAAI,iBAAiB,CAAC,SAAS,EACrC,OAAM,IAAI,MAAM,0CAA0C;CAG5D,IAAIC,gBAAuC,aAAa,GAAG;AAE3D,MAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;EAE5C,MAAM,oBAAoBC,iFAA0B,aAAa,GAAG;AAGpE,kBACE,eACA,kBAAkB,SAClB,kBAAkB,SAClB,kBAAkB,KAClB,EAAE,CACH;AAED,kBAAgB,YACd,eACA,kBAAkB,QACnB;;AASH,QANqC;EACnC,KAAK,aAAa,GAAG;EACrB,SAAS;EACT;EACD"}
@@ -9,7 +9,7 @@ const normalizeDictionary = (dictionary, configuration) => {
9
9
  if (dictionary.locale) return {
10
10
  ...dictionary,
11
11
  locale: void 0,
12
- content: require_transpiler_translation_translation.t({ [dictionary.locale]: require_deepTransformPlugins_getLocalizedContent.getPerLocaleDictionary(dictionary.content, dictionary.locale) })
12
+ content: require_transpiler_translation_translation.t({ [dictionary.locale]: dictionary.content })
13
13
  };
14
14
  const perLocaleContent = locales.reduce((acc, locale) => {
15
15
  acc[locale] = require_deepTransformPlugins_getLocalizedContent.getPerLocaleDictionary(parsedDictionary, locale).content;
@@ -1 +1 @@
1
- {"version":3,"file":"normalizeDictionary.cjs","names":["t","getPerLocaleDictionary","orderDictionaries"],"sources":["../../../src/dictionaryManipulator/normalizeDictionary.ts"],"sourcesContent":["import type { Dictionary, IntlayerConfig, Locale } from '@intlayer/types';\nimport { getPerLocaleDictionary } from '../deepTransformPlugins';\nimport { t } from '../transpiler/translation';\nimport { orderDictionaries } from './orderDictionaries';\n\nexport const normalizeDictionary = (\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Dictionary => {\n const { locales } = configuration.internationalization;\n\n const parsedDictionary = JSON.parse(JSON.stringify(dictionary));\n\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n if (dictionary.locale) {\n return {\n ...dictionary,\n locale: undefined,\n content: t({\n // @ts-ignore Type instantiation is excessively deep and possibly infinite.\n [dictionary.locale]: getPerLocaleDictionary(\n dictionary.content,\n dictionary.locale\n ),\n }),\n };\n }\n\n const perLocaleContent = locales.reduce(\n (acc, locale) => {\n const perLocaleDictionary = getPerLocaleDictionary(\n parsedDictionary,\n locale\n );\n\n acc[locale] = perLocaleDictionary.content;\n return acc;\n },\n {} as Record<Locale, Dictionary['content']>\n );\n\n return {\n ...dictionary,\n content: t(perLocaleContent),\n };\n};\n\nexport const normalizeDictionaries = (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Dictionary[] => {\n const orderedDictionaries = orderDictionaries(dictionaries, configuration);\n\n const structuredDictionaries = orderedDictionaries.map((dictionary) =>\n normalizeDictionary(dictionary, configuration)\n );\n\n return structuredDictionaries;\n};\n"],"mappings":";;;;;AAKA,MAAa,uBACX,YACA,kBACe;CACf,MAAM,EAAE,YAAY,cAAc;CAElC,MAAM,mBAAmB,KAAK,MAAM,KAAK,UAAU,WAAW,CAAC;AAG/D,KAAI,WAAW,OACb,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAASA,6CAAE,GAER,WAAW,SAASC,wEACnB,WAAW,SACX,WAAW,OACZ,EACF,CAAC;EACH;CAGH,MAAM,mBAAmB,QAAQ,QAC9B,KAAK,WAAW;AAMf,MAAI,UALwBA,wEAC1B,kBACA,OACD,CAEiC;AAClC,SAAO;IAET,EAAE,CACH;AAED,QAAO;EACL,GAAG;EACH,SAASD,6CAAE,iBAAiB;EAC7B;;AAGH,MAAa,yBACX,cACA,kBACiB;AAOjB,QAN4BE,kEAAkB,cAAc,cAAc,CAEvB,KAAK,eACtD,oBAAoB,YAAY,cAAc,CAC/C"}
1
+ {"version":3,"file":"normalizeDictionary.cjs","names":["t","getPerLocaleDictionary","orderDictionaries"],"sources":["../../../src/dictionaryManipulator/normalizeDictionary.ts"],"sourcesContent":["import type { Dictionary, IntlayerConfig, Locale } from '@intlayer/types';\nimport { getPerLocaleDictionary } from '../deepTransformPlugins';\nimport { t } from '../transpiler/translation';\nimport { orderDictionaries } from './orderDictionaries';\n\nexport const normalizeDictionary = (\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Dictionary => {\n const { locales } = configuration.internationalization;\n\n const parsedDictionary = JSON.parse(JSON.stringify(dictionary));\n\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n if (dictionary.locale) {\n return {\n ...dictionary,\n locale: undefined,\n content: t({\n [dictionary.locale]: dictionary.content,\n }),\n };\n }\n\n const perLocaleContent = locales.reduce(\n (acc, locale) => {\n const perLocaleDictionary = getPerLocaleDictionary(\n parsedDictionary,\n locale\n );\n\n acc[locale] = perLocaleDictionary.content;\n return acc;\n },\n {} as Record<Locale, Dictionary['content']>\n );\n\n return {\n ...dictionary,\n content: t(perLocaleContent),\n };\n};\n\nexport const normalizeDictionaries = (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Dictionary[] => {\n const orderedDictionaries = orderDictionaries(dictionaries, configuration);\n\n const structuredDictionaries = orderedDictionaries.map((dictionary) =>\n normalizeDictionary(dictionary, configuration)\n );\n\n return structuredDictionaries;\n};\n"],"mappings":";;;;;AAKA,MAAa,uBACX,YACA,kBACe;CACf,MAAM,EAAE,YAAY,cAAc;CAElC,MAAM,mBAAmB,KAAK,MAAM,KAAK,UAAU,WAAW,CAAC;AAG/D,KAAI,WAAW,OACb,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAASA,6CAAE,GACR,WAAW,SAAS,WAAW,SACjC,CAAC;EACH;CAGH,MAAM,mBAAmB,QAAQ,QAC9B,KAAK,WAAW;AAMf,MAAI,UALwBC,wEAC1B,kBACA,OACD,CAEiC;AAClC,SAAO;IAET,EAAE,CACH;AAED,QAAO;EACL,GAAG;EACH,SAASD,6CAAE,iBAAiB;EAC7B;;AAGH,MAAa,yBACX,cACA,kBACiB;AAOjB,QAN4BE,kEAAkB,cAAc,cAAc,CAEvB,KAAK,eACtD,oBAAoB,YAAY,cAAc,CAC/C"}
@@ -24,6 +24,7 @@ const require_deepTransformPlugins_getFilterTranslationsOnlyContent = require('.
24
24
  const require_deepTransformPlugins_getLocalizedContent = require('./deepTransformPlugins/getLocalizedContent.cjs');
25
25
  const require_deepTransformPlugins_getMaskContent = require('./deepTransformPlugins/getMaskContent.cjs');
26
26
  const require_deepTransformPlugins_getMissingLocalesContent = require('./deepTransformPlugins/getMissingLocalesContent.cjs');
27
+ const require_deepTransformPlugins_getMultilingualDictionary = require('./deepTransformPlugins/getMultilingualDictionary.cjs');
27
28
  const require_deepTransformPlugins_getReplacedValuesContent = require('./deepTransformPlugins/getReplacedValuesContent.cjs');
28
29
  const require_deepTransformPlugins_getSplittedContent = require('./deepTransformPlugins/getSplittedContent.cjs');
29
30
  const require_deepTransformPlugins_insertContentInDictionary = require('./deepTransformPlugins/insertContentInDictionary.cjs');
@@ -112,6 +113,8 @@ exports.getLocalizedUrl = require_localization_getLocalizedUrl.getLocalizedUrl;
112
113
  exports.getMarkdownMetadata = require_transpiler_markdown_getMarkdownMetadata.getMarkdownMetadata;
113
114
  exports.getMaskContent = require_deepTransformPlugins_getMaskContent.getMaskContent;
114
115
  exports.getMissingLocalesContent = require_deepTransformPlugins_getMissingLocalesContent.getMissingLocalesContent;
116
+ exports.getMissingLocalesContentFromDictionary = require_deepTransformPlugins_getMissingLocalesContent.getMissingLocalesContentFromDictionary;
117
+ exports.getMultilingualDictionary = require_deepTransformPlugins_getMultilingualDictionary.getMultilingualDictionary;
115
118
  exports.getMultilingualUrls = require_localization_getMultilingualUrls.getMultilingualUrls;
116
119
  exports.getNesting = require_interpreter_getNesting.getNesting;
117
120
  exports.getNodeChildren = require_dictionaryManipulator_getNodeChildren.getNodeChildren;
@@ -35,7 +35,11 @@ const getMissingLocalesContent = (node, locales = configuration?.internationaliz
35
35
  });
36
36
  return Array.from(missingLocales);
37
37
  };
38
+ const getMissingLocalesContentFromDictionary = (dictionary, locales = configuration?.internationalization?.locales) => getMissingLocalesContent(dictionary.content, locales, {
39
+ dictionaryKey: dictionary.key,
40
+ keyPath: []
41
+ });
38
42
 
39
43
  //#endregion
40
- export { checkMissingLocalesPlugin, getMissingLocalesContent };
44
+ export { checkMissingLocalesPlugin, getMissingLocalesContent, getMissingLocalesContentFromDictionary };
41
45
  //# sourceMappingURL=getMissingLocalesContent.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getMissingLocalesContent.mjs","names":["plugins: Plugins[]"],"sources":["../../../src/deepTransformPlugins/getMissingLocalesContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n type ContentNode,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport type { DeepTransformContent, NodeProps, Plugins } from '../interpreter';\nimport { deepTransformNode } from '../interpreter/getContent/deepTransform';\nimport type { TranslationContent } from '../transpiler';\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const checkMissingLocalesPlugin = (\n locales: Locale[],\n onMissingLocale: (locale: Locale) => void\n): Plugins => ({\n id: 'check-missing-locales-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node: TranslationContent, props, deepTransformNode) => {\n for (const locale of locales) {\n if (\n !node[NodeType.Translation][\n locale as keyof (typeof node)[NodeType.Translation]\n ]\n ) {\n onMissingLocale(locale);\n }\n }\n\n // Continue traversal inside the translation values, but avoid re-applying this plugin on the same node\n const translations = node[NodeType.Translation] as Record<string, any>;\n for (const key in translations) {\n const child = translations[key];\n deepTransformNode(child, {\n ...props,\n children: child,\n });\n }\n\n // Return the original node; the return value is ignored by the caller\n return node;\n },\n});\n\n/**\n * Return the content of a node with only the translation plugin.\n *\n * @param node The node to transform.\n * @param locales The locales to check for missing translations.\n */\nexport const getMissingLocalesContent = <T extends ContentNode>(\n node: T,\n locales: LocalesValues[] = configuration?.internationalization?.locales,\n nodeProps: NodeProps\n): Locale[] => {\n const missingLocales = new Set<Locale>();\n\n const plugins: Plugins[] = [\n checkMissingLocalesPlugin(locales as Locale[], (locale) =>\n missingLocales.add(locale)\n ),\n ...(nodeProps.plugins ?? []),\n ];\n\n deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n\n return Array.from(missingLocales);\n};\n"],"mappings":";;;;;;AAYA,MAAa,6BACX,SACA,qBACa;CACb,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAA0B,OAAO,wBAAsB;AACjE,OAAK,MAAM,UAAU,QACnB,KACE,CAAC,KAAK,SAAS,aACb,QAGF,iBAAgB,OAAO;EAK3B,MAAM,eAAe,KAAK,SAAS;AACnC,OAAK,MAAM,OAAO,cAAc;GAC9B,MAAM,QAAQ,aAAa;AAC3B,uBAAkB,OAAO;IACvB,GAAG;IACH,UAAU;IACX,CAAC;;AAIJ,SAAO;;CAEV;;;;;;;AAQD,MAAa,4BACX,MACA,UAA2B,eAAe,sBAAsB,SAChE,cACa;CACb,MAAM,iCAAiB,IAAI,KAAa;CAExC,MAAMA,UAAqB,CACzB,0BAA0B,UAAsB,WAC9C,eAAe,IAAI,OAAO,CAC3B,EACD,GAAI,UAAU,WAAW,EAAE,CAC5B;AAED,mBAAkB,MAAM;EACtB,GAAG;EACH;EACD,CAAC;AAEF,QAAO,MAAM,KAAK,eAAe"}
1
+ {"version":3,"file":"getMissingLocalesContent.mjs","names":["plugins: Plugins[]"],"sources":["../../../src/deepTransformPlugins/getMissingLocalesContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/types';\nimport {\n type ContentNode,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport type { DeepTransformContent, NodeProps, Plugins } from '../interpreter';\nimport { deepTransformNode } from '../interpreter/getContent/deepTransform';\nimport type { TranslationContent } from '../transpiler';\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const checkMissingLocalesPlugin = (\n locales: Locale[],\n onMissingLocale: (locale: Locale) => void\n): Plugins => ({\n id: 'check-missing-locales-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node: TranslationContent, props, deepTransformNode) => {\n for (const locale of locales) {\n if (\n !node[NodeType.Translation][\n locale as keyof (typeof node)[NodeType.Translation]\n ]\n ) {\n onMissingLocale(locale);\n }\n }\n\n // Continue traversal inside the translation values, but avoid re-applying this plugin on the same node\n const translations = node[NodeType.Translation] as Record<string, any>;\n for (const key in translations) {\n const child = translations[key];\n deepTransformNode(child, {\n ...props,\n children: child,\n });\n }\n\n // Return the original node; the return value is ignored by the caller\n return node;\n },\n});\n\n/**\n * Return the content of a node with only the translation plugin.\n *\n * @param node The node to transform.\n * @param locales The locales to check for missing translations.\n */\nexport const getMissingLocalesContent = <T extends ContentNode>(\n node: T,\n locales: LocalesValues[] = configuration?.internationalization?.locales,\n nodeProps: NodeProps\n): Locale[] => {\n const missingLocales = new Set<Locale>();\n\n const plugins: Plugins[] = [\n checkMissingLocalesPlugin(locales as Locale[], (locale) =>\n missingLocales.add(locale)\n ),\n ...(nodeProps.plugins ?? []),\n ];\n\n deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n\n return Array.from(missingLocales);\n};\n\nexport const getMissingLocalesContentFromDictionary = (\n dictionary: Dictionary,\n locales: LocalesValues[] = configuration?.internationalization?.locales\n) =>\n getMissingLocalesContent(dictionary.content, locales, {\n dictionaryKey: dictionary.key,\n keyPath: [],\n });\n"],"mappings":";;;;;;AAaA,MAAa,6BACX,SACA,qBACa;CACb,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAA0B,OAAO,wBAAsB;AACjE,OAAK,MAAM,UAAU,QACnB,KACE,CAAC,KAAK,SAAS,aACb,QAGF,iBAAgB,OAAO;EAK3B,MAAM,eAAe,KAAK,SAAS;AACnC,OAAK,MAAM,OAAO,cAAc;GAC9B,MAAM,QAAQ,aAAa;AAC3B,uBAAkB,OAAO;IACvB,GAAG;IACH,UAAU;IACX,CAAC;;AAIJ,SAAO;;CAEV;;;;;;;AAQD,MAAa,4BACX,MACA,UAA2B,eAAe,sBAAsB,SAChE,cACa;CACb,MAAM,iCAAiB,IAAI,KAAa;CAExC,MAAMA,UAAqB,CACzB,0BAA0B,UAAsB,WAC9C,eAAe,IAAI,OAAO,CAC3B,EACD,GAAI,UAAU,WAAW,EAAE,CAC5B;AAED,mBAAkB,MAAM;EACtB,GAAG;EACH;EACD,CAAC;AAEF,QAAO,MAAM,KAAK,eAAe;;AAGnC,MAAa,0CACX,YACA,UAA2B,eAAe,sBAAsB,YAEhE,yBAAyB,WAAW,SAAS,SAAS;CACpD,eAAe,WAAW;CAC1B,SAAS,EAAE;CACZ,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { deepTransformNode } from "../interpreter/getContent/deepTransform.mjs";
2
+ import { t as translation } from "../transpiler/translation/translation.mjs";
3
+
4
+ //#region src/deepTransformPlugins/getMultilingualDictionary.ts
5
+ /**
6
+ * Transform a per-locale dictionary into a multilingual dictionary.
7
+ *
8
+ * Example:
9
+ * ```json
10
+ * {
11
+ * "key": "about-page",
12
+ * "locale": "en",
13
+ * "content": {
14
+ * "myContent": "English content"
15
+ * }
16
+ * }
17
+ * ```
18
+ *
19
+ * ```json
20
+ * {
21
+ * "key": "about-page",
22
+ * "content": {
23
+ * "myContent": t({
24
+ * "en": "English content",
25
+ * })
26
+ * }
27
+ * }
28
+ * ```
29
+ */
30
+ const getMultilingualDictionary = (dictionary) => {
31
+ if (!dictionary.locale) return dictionary;
32
+ const locale = dictionary.locale;
33
+ const transformedContent = deepTransformNode(JSON.parse(JSON.stringify(dictionary.content)), {
34
+ dictionaryKey: dictionary.key,
35
+ keyPath: [],
36
+ plugins: [{
37
+ id: "traverse-typed-node-plugin",
38
+ canHandle: (node) => typeof node === "object" && typeof node?.nodeType === "string",
39
+ transform: (node, props, transformFn) => {
40
+ const nodeType = node.nodeType;
41
+ const inner = structuredClone(node[nodeType]);
42
+ if (typeof inner !== "object" || inner === null) {
43
+ const transformed = transformFn(inner, {
44
+ ...props,
45
+ children: inner,
46
+ keyPath: [...props.keyPath, {
47
+ type: nodeType,
48
+ key: nodeType
49
+ }]
50
+ });
51
+ return {
52
+ ...node,
53
+ [nodeType]: transformed
54
+ };
55
+ }
56
+ for (const key in inner) {
57
+ const childProps = {
58
+ ...props,
59
+ children: inner[key],
60
+ keyPath: [...props.keyPath, {
61
+ type: nodeType,
62
+ key
63
+ }]
64
+ };
65
+ inner[key] = transformFn(inner[key], childProps);
66
+ }
67
+ return {
68
+ ...node,
69
+ [nodeType]: inner
70
+ };
71
+ }
72
+ }, {
73
+ id: "wrap-primitive-in-translation",
74
+ canHandle: (node) => typeof node === "string" || typeof node === "number" || typeof node === "boolean",
75
+ transform: (node) => translation({ [locale]: node })
76
+ }]
77
+ });
78
+ const { locale: _omitLocale,...rest } = dictionary;
79
+ return {
80
+ ...rest,
81
+ content: transformedContent
82
+ };
83
+ };
84
+
85
+ //#endregion
86
+ export { getMultilingualDictionary };
87
+ //# sourceMappingURL=getMultilingualDictionary.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMultilingualDictionary.mjs","names":["childProps: NodeProps","t"],"sources":["../../../src/deepTransformPlugins/getMultilingualDictionary.ts"],"sourcesContent":["import type { Dictionary, KeyPath, NodeType, TypedNode } from '@intlayer/types';\nimport {\n deepTransformNode,\n type NodeProps,\n type Plugins,\n} from '../interpreter';\nimport { t } from '../transpiler';\n\n/**\n * Transform a per-locale dictionary into a multilingual dictionary.\n *\n * Example:\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"locale\": \"en\",\n * \"content\": {\n * \"myContent\": \"English content\"\n * }\n * }\n * ```\n *\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"content\": {\n * \"myContent\": t({\n * \"en\": \"English content\",\n * })\n * }\n * }\n * ```\n */\nexport const getMultilingualDictionary = (\n dictionary: Dictionary\n): Dictionary => {\n if (!dictionary.locale) {\n return dictionary;\n }\n\n const locale = dictionary.locale;\n\n const wrapPrimitiveInTranslationPlugin: Plugins = {\n id: 'wrap-primitive-in-translation',\n canHandle: (node) =>\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean',\n transform: (node) => t({ [locale]: node } as Record<string, unknown>),\n };\n\n const traverseTypedNodePlugin: Plugins = {\n id: 'traverse-typed-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' && typeof (node as any)?.nodeType === 'string',\n transform: (node: TypedNode, props, transformFn) => {\n const nodeType = (node as any).nodeType as NodeType;\n const inner = structuredClone(\n (node as any)[nodeType as unknown as keyof TypedNode] as any\n );\n\n if (typeof inner !== 'object' || inner === null) {\n const transformed = transformFn(inner, {\n ...props,\n children: inner,\n keyPath: [\n ...props.keyPath,\n { type: nodeType, key: nodeType } as KeyPath,\n ],\n });\n return {\n ...node,\n [nodeType as unknown as keyof TypedNode]: transformed,\n };\n }\n\n for (const key in inner) {\n const childProps: NodeProps = {\n ...props,\n children: inner[key as unknown as keyof typeof inner],\n keyPath: [...props.keyPath, { type: nodeType, key } as KeyPath],\n };\n inner[key as unknown as keyof typeof inner] = transformFn(\n inner[key as unknown as keyof typeof inner],\n childProps\n );\n }\n\n return { ...node, [nodeType as unknown as keyof TypedNode]: inner };\n },\n };\n\n const transformedContent = deepTransformNode(\n JSON.parse(JSON.stringify(dictionary.content)),\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [traverseTypedNodePlugin, wrapPrimitiveInTranslationPlugin],\n }\n );\n\n const { locale: _omitLocale, ...rest } = dictionary as any;\n return {\n ...rest,\n content: transformedContent,\n } as Dictionary;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,6BACX,eACe;AACf,KAAI,CAAC,WAAW,OACd,QAAO;CAGT,MAAM,SAAS,WAAW;CAoD1B,MAAM,qBAAqB,kBACzB,KAAK,MAAM,KAAK,UAAU,WAAW,QAAQ,CAAC,EAC9C;EACE,eAAe,WAAW;EAC1B,SAAS,EAAE;EACX,SAAS,CA9C4B;GACvC,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAAY,OAAQ,MAAc,aAAa;GACjE,YAAY,MAAiB,OAAO,gBAAgB;IAClD,MAAM,WAAY,KAAa;IAC/B,MAAM,QAAQ,gBACX,KAAa,UACf;AAED,QAAI,OAAO,UAAU,YAAY,UAAU,MAAM;KAC/C,MAAM,cAAc,YAAY,OAAO;MACrC,GAAG;MACH,UAAU;MACV,SAAS,CACP,GAAG,MAAM,SACT;OAAE,MAAM;OAAU,KAAK;OAAU,CAClC;MACF,CAAC;AACF,YAAO;MACL,GAAG;OACF,WAAyC;MAC3C;;AAGH,SAAK,MAAM,OAAO,OAAO;KACvB,MAAMA,aAAwB;MAC5B,GAAG;MACH,UAAU,MAAM;MAChB,SAAS,CAAC,GAAG,MAAM,SAAS;OAAE,MAAM;OAAU;OAAK,CAAY;MAChE;AACD,WAAM,OAAwC,YAC5C,MAAM,MACN,WACD;;AAGH,WAAO;KAAE,GAAG;MAAO,WAAyC;KAAO;;GAEtE,EAhDiD;GAChD,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;GAClB,YAAY,SAASC,YAAE,GAAG,SAAS,MAAM,CAA4B;GACtE,CAgDuE;EACrE,CACF;CAED,MAAM,EAAE,QAAQ,YAAa,GAAG,SAAS;AACzC,QAAO;EACL,GAAG;EACH,SAAS;EACV"}
@@ -3,9 +3,10 @@ import { filterMissingTranslationsOnlyPlugin, getFilterMissingTranslationsConten
3
3
  import { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary } from "./getFilterTranslationsOnlyContent.mjs";
4
4
  import { getLocalizedContent, getPerLocaleDictionary } from "./getLocalizedContent.mjs";
5
5
  import { buildMaskPlugin, getMaskContent } from "./getMaskContent.mjs";
6
- import { checkMissingLocalesPlugin, getMissingLocalesContent } from "./getMissingLocalesContent.mjs";
6
+ import { checkMissingLocalesPlugin, getMissingLocalesContent, getMissingLocalesContentFromDictionary } from "./getMissingLocalesContent.mjs";
7
+ import { getMultilingualDictionary } from "./getMultilingualDictionary.mjs";
7
8
  import { getReplacedValuesContent } from "./getReplacedValuesContent.mjs";
8
9
  import { getSplittedContent, getSplittedDictionaryContent } from "./getSplittedContent.mjs";
9
10
  import { insertContentInDictionary } from "./insertContentInDictionary.mjs";
10
11
 
11
- export { buildMaskPlugin, checkMissingLocalesPlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getLocalizedContent, getMaskContent, getMissingLocalesContent, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, insertContentInDictionary };
12
+ export { buildMaskPlugin, checkMissingLocalesPlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getLocalizedContent, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, insertContentInDictionary };
@@ -1,3 +1,4 @@
1
+ import { getMultilingualDictionary } from "../deepTransformPlugins/getMultilingualDictionary.mjs";
1
2
  import { getNodeType } from "./getNodeType.mjs";
2
3
  import { colorizeKey, getAppLogger } from "@intlayer/config/client";
3
4
  import configuration from "@intlayer/config/built";
@@ -50,7 +51,7 @@ const mergeDictionaries = (dictionaries) => {
50
51
  if (new Set(dictionariesKeys).size !== 1) throw new Error("All dictionaries must have the same key");
51
52
  let mergedContent = dictionaries[0].content;
52
53
  for (let i = 1; i < dictionaries.length; i++) {
53
- const currentDictionary = dictionaries[i];
54
+ const currentDictionary = getMultilingualDictionary(dictionaries[i]);
54
55
  checkTypesMatch(mergedContent, currentDictionary.content, currentDictionary.localId, currentDictionary.key, []);
55
56
  mergedContent = customMerge(mergedContent, currentDictionary.content);
56
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mergeDictionaries.mjs","names":["result: Record<string, MergeableContent>","result: MergeableContent[]","mergedContent: Dictionary['content']"],"sources":["../../../src/dictionaryManipulator/mergeDictionaries.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizeKey, getAppLogger } from '@intlayer/config/client';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types';\nimport { getNodeType } from './getNodeType';\n\n// Extended type that includes arrays for internal merge operations\ntype MergeableContent = ContentNode | ContentNode[];\n\nconst checkTypesMatch = (\n object1: ContentNode,\n object2: ContentNode,\n object2LocalId: LocalDictionaryId | undefined,\n dictionaryKey: string,\n path: string[] = []\n): void => {\n const appLogger = getAppLogger(configuration);\n\n // If either side is missing/undefined, allow merge without error\n if (\n object1 === undefined ||\n object1 === null ||\n object2 === undefined ||\n object2 === null\n )\n return;\n\n const type1 = getNodeType(object1);\n const type2 = getNodeType(object2);\n\n // Unknown types are treated as flexible; skip strict mismatch reporting\n if (type1 === 'unknown' || type2 === 'unknown') return;\n\n if (type1 !== type2) {\n appLogger(\n [\n `Error: Dictionary ${colorizeKey(dictionaryKey)} has a multiple content files with type mismatch at path \"${path.join('.')}\": Cannot merge ${type1} with ${type2} while merging ${object2LocalId}`,\n ],\n {\n level: 'error',\n }\n );\n\n return;\n }\n};\n\n// Custom merge function that prefers destination (first dictionary) values\nconst customMerge = (\n destination: ContentNode,\n source: ContentNode\n): MergeableContent => {\n // If destination is undefined/null, use source\n if (destination === undefined || destination === null) {\n return source;\n }\n\n // If source is undefined/null, use destination\n if (source === undefined || source === null) {\n return destination;\n }\n\n // For primitive values, prefer destination (first dictionary)\n if (typeof destination !== 'object' || typeof source !== 'object') {\n return destination;\n }\n\n // For arrays, use our custom array merge\n if (Array.isArray(destination) && Array.isArray(source)) {\n return arrayMerge(\n destination as ContentNode[],\n source as ContentNode[]\n ) as MergeableContent;\n }\n\n // For objects, recursively merge with our custom logic\n if (typeof destination === 'object' && typeof source === 'object') {\n const result: Record<string, MergeableContent> = {};\n const allKeys = new Set([\n ...Object.keys(destination as unknown as Record<string, ContentNode>),\n ...Object.keys(source as unknown as Record<string, ContentNode>),\n ]);\n\n for (const key of allKeys) {\n result[key] = customMerge(\n (destination as unknown as Record<string, ContentNode>)[key],\n (source as unknown as Record<string, ContentNode>)[key]\n );\n }\n\n return result as unknown as MergeableContent;\n }\n\n // Fallback to destination\n return destination;\n};\n\n// Custom array merge strategy that merges arrays by key when present, otherwise by index\nconst arrayMerge = (\n destinationArray: ContentNode[],\n sourceArray: ContentNode[]\n): MergeableContent[] => {\n // Check if both arrays contain only primitives\n const destHasOnlyPrimitives = destinationArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n const sourceHasOnlyPrimitives = sourceArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n\n // If both arrays contain only primitives, use the source array (second dictionary)\n if (destHasOnlyPrimitives && sourceHasOnlyPrimitives) {\n return sourceArray;\n }\n\n // Otherwise, merge by index with object merging logic\n const result: MergeableContent[] = [];\n const maxLength = Math.max(destinationArray.length, sourceArray.length);\n\n for (let i = 0; i < maxLength; i++) {\n const destItem = destinationArray[i];\n const sourceItem = sourceArray[i];\n\n if (destItem === undefined && sourceItem === undefined) {\n } else if (destItem === undefined) {\n // Only source exists, add it\n result.push(sourceItem);\n } else if (sourceItem === undefined) {\n // Only destination exists, add it\n result.push(destItem);\n } else {\n // Both exist, merge them\n if (\n typeof destItem === 'object' &&\n typeof sourceItem === 'object' &&\n destItem !== null &&\n sourceItem !== null\n ) {\n // Check if both objects have a 'key' property for keyed merging\n if (\n 'key' in destItem &&\n 'key' in sourceItem &&\n (destItem as Record<string, string>).key ===\n (sourceItem as Record<string, string>).key\n ) {\n // Merge objects with same key, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n } else {\n // Merge objects by index, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n }\n } else {\n // For primitives or non-objects, use destination value (first dictionary)\n result.push(destItem);\n }\n }\n }\n\n return result;\n};\n\nexport const mergeDictionaries = (dictionaries: Dictionary[]): Dictionary => {\n const localIds = Array.from(\n new Set<LocalDictionaryId>(\n dictionaries.filter((dict) => dict.localId).map((dict) => dict.localId!)\n )\n );\n\n const dictionariesKeys = dictionaries.map((dict) => dict.key);\n\n // Check if all dictionaries have the same key\n if (new Set(dictionariesKeys).size !== 1) {\n throw new Error('All dictionaries must have the same key');\n }\n\n let mergedContent: Dictionary['content'] = dictionaries[0].content;\n\n for (let i = 1; i < dictionaries.length; i++) {\n const currentDictionary = dictionaries[i];\n\n // Check types before merging\n checkTypesMatch(\n mergedContent,\n currentDictionary.content,\n currentDictionary.localId,\n currentDictionary.key,\n []\n );\n\n mergedContent = customMerge(\n mergedContent,\n currentDictionary.content\n ) as ContentNode;\n }\n\n const mergedDictionary: Dictionary = {\n key: dictionaries[0].key,\n\n content: mergedContent,\n localIds,\n };\n\n return mergedDictionary;\n};\n"],"mappings":";;;;;AAYA,MAAM,mBACJ,SACA,SACA,gBACA,eACA,OAAiB,EAAE,KACV;CACT,MAAM,YAAY,aAAa,cAAc;AAG7C,KACE,YAAY,UACZ,YAAY,QACZ,YAAY,UACZ,YAAY,KAEZ;CAEF,MAAM,QAAQ,YAAY,QAAQ;CAClC,M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O,KAAK,WAAW;WACd,eAAe,OAExB,QAAO,KAAK,SAAS;WAInB,OAAO,aAAa,YACpB,OAAO,eAAe,YACtB,aAAa,QACb,eAAe,KAGf,KACE,SAAS,YACT,SAAS,cACR,SAAoC,QAClC,WAAsC,IAGzC,QAAO,KAAK,YAAY,UAAU,WAAW,CAAC;MAG9C,QAAO,KAAK,YAAY,UAAU,WAAW,CAAC;MAIhD,QAAO,KAAK,SAAS;;AAK3B,QAAO;;AAGT,MAAa,qBAAqB,iBAA2C;CAC3E,MAAM,WAAW,MAAM,KACrB,IAAI,IACF,aAAa,QAAQ,SAAS,KAAK,QAAQ,CAAC,KAAK,SAAS,KAAK,QAAS,CACzE,CACF;CAED,MAAM,mBAAmB,aAAa,KAAK,SAAS,KAAK,IAAI;AAG7D,KAAI,IAAI,IAAI,iBAAiB,CAAC,SAAS,EACrC,OAAM,IAAI,MAAM,0CAA0C;CAG5D,IAAIC,gBAAuC,aAAa,GAAG;AAE3D,MAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;EAC5C,MAAM,oBAAoB,aAAa;AAGvC,kBACE,eACA,kBAAkB,SAClB,kBAAkB,SAClB,kBAAkB,KAClB,EAAE,CACH;AAED,kBAAgB,YACd,eACA,kBAAkB,QACnB;;AAUH,QAPqC;EACnC,KAAK,aAAa,GAAG;EAErB,SAAS;EACT;EACD"}
1
+ {"version":3,"file":"mergeDictionaries.mjs","names":["result: Record<string, MergeableContent>","result: MergeableContent[]","mergedContent: Dictionary['content']"],"sources":["../../../src/dictionaryManipulator/mergeDictionaries.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizeKey, getAppLogger } from '@intlayer/config/client';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types';\nimport { getMultilingualDictionary } from '../deepTransformPlugins';\nimport { getNodeType } from './getNodeType';\n\n// Extended type that includes arrays for internal merge operations\ntype MergeableContent = ContentNode | ContentNode[];\n\nconst checkTypesMatch = (\n object1: ContentNode,\n object2: ContentNode,\n object2LocalId: LocalDictionaryId | undefined,\n dictionaryKey: string,\n path: string[] = []\n): void => {\n const appLogger = getAppLogger(configuration);\n\n // If either side is missing/undefined, allow merge without error\n if (\n object1 === undefined ||\n object1 === null ||\n object2 === undefined ||\n object2 === null\n )\n return;\n\n const type1 = getNodeType(object1);\n const type2 = getNodeType(object2);\n\n // Unknown types are treated as flexible; skip strict mismatch reporting\n if (type1 === 'unknown' || type2 === 'unknown') return;\n\n if (type1 !== type2) {\n appLogger(\n [\n `Error: Dictionary ${colorizeKey(dictionaryKey)} has a multiple content files with type mismatch at path \"${path.join('.')}\": Cannot merge ${type1} with ${type2} while merging ${object2LocalId}`,\n ],\n {\n level: 'error',\n }\n );\n\n return;\n }\n};\n\n// Custom merge function that prefers destination (first dictionary) values\nconst customMerge = (\n destination: ContentNode,\n source: ContentNode\n): MergeableContent => {\n // If destination is undefined/null, use source\n if (destination === undefined || destination === null) {\n return source;\n }\n\n // If source is undefined/null, use destination\n if (source === undefined || source === null) {\n return destination;\n }\n\n // For primitive values, prefer destination (first dictionary)\n if (typeof destination !== 'object' || typeof source !== 'object') {\n return destination;\n }\n\n // For arrays, use our custom array merge\n if (Array.isArray(destination) && Array.isArray(source)) {\n return arrayMerge(\n destination as ContentNode[],\n source as ContentNode[]\n ) as MergeableContent;\n }\n\n // For objects, recursively merge with our custom logic\n if (typeof destination === 'object' && typeof source === 'object') {\n const result: Record<string, MergeableContent> = {};\n const allKeys = new Set([\n ...Object.keys(destination as unknown as Record<string, ContentNode>),\n ...Object.keys(source as unknown as Record<string, ContentNode>),\n ]);\n\n for (const key of allKeys) {\n result[key] = customMerge(\n (destination as unknown as Record<string, ContentNode>)[key],\n (source as unknown as Record<string, ContentNode>)[key]\n );\n }\n\n return result as unknown as MergeableContent;\n }\n\n // Fallback to destination\n return destination;\n};\n\n// Custom array merge strategy that merges arrays by key when present, otherwise by index\nconst arrayMerge = (\n destinationArray: ContentNode[],\n sourceArray: ContentNode[]\n): MergeableContent[] => {\n // Check if both arrays contain only primitives\n const destHasOnlyPrimitives = destinationArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n const sourceHasOnlyPrimitives = sourceArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n\n // If both arrays contain only primitives, use the source array (second dictionary)\n if (destHasOnlyPrimitives && sourceHasOnlyPrimitives) {\n return sourceArray;\n }\n\n // Otherwise, merge by index with object merging logic\n const result: MergeableContent[] = [];\n const maxLength = Math.max(destinationArray.length, sourceArray.length);\n\n for (let i = 0; i < maxLength; i++) {\n const destItem = destinationArray[i];\n const sourceItem = sourceArray[i];\n\n if (destItem === undefined && sourceItem === undefined) {\n } else if (destItem === undefined) {\n // Only source exists, add it\n result.push(sourceItem);\n } else if (sourceItem === undefined) {\n // Only destination exists, add it\n result.push(destItem);\n } else {\n // Both exist, merge them\n if (\n typeof destItem === 'object' &&\n typeof sourceItem === 'object' &&\n destItem !== null &&\n sourceItem !== null\n ) {\n // Check if both objects have a 'key' property for keyed merging\n if (\n 'key' in destItem &&\n 'key' in sourceItem &&\n (destItem as Record<string, string>).key ===\n (sourceItem as Record<string, string>).key\n ) {\n // Merge objects with same key, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n } else {\n // Merge objects by index, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n }\n } else {\n // For primitives or non-objects, use destination value (first dictionary)\n result.push(destItem);\n }\n }\n }\n\n return result;\n};\n\nexport const mergeDictionaries = (dictionaries: Dictionary[]): Dictionary => {\n const localIds = Array.from(\n new Set<LocalDictionaryId>(\n dictionaries.filter((dict) => dict.localId).map((dict) => dict.localId!)\n )\n );\n\n const dictionariesKeys = dictionaries.map((dict) => dict.key);\n\n // Check if all dictionaries have the same key\n if (new Set(dictionariesKeys).size !== 1) {\n throw new Error('All dictionaries must have the same key');\n }\n\n let mergedContent: Dictionary['content'] = dictionaries[0].content;\n\n for (let i = 1; i < dictionaries.length; i++) {\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n const currentDictionary = getMultilingualDictionary(dictionaries[i]);\n\n // Check types before merging\n checkTypesMatch(\n mergedContent,\n currentDictionary.content,\n currentDictionary.localId,\n currentDictionary.key,\n []\n );\n\n mergedContent = customMerge(\n mergedContent,\n currentDictionary.content\n ) as ContentNode;\n }\n\n const mergedDictionary: Dictionary = {\n key: dictionaries[0].key,\n content: mergedContent,\n localIds,\n };\n\n return mergedDictionary;\n};\n"],"mappings":";;;;;;AAaA,MAAM,mBACJ,SACA,SACA,gBACA,eACA,OAAiB,EAAE,KACV;CACT,MAAM,YAAY,aAAa,cAAc;AAG7C,KACE,YAAY,UACZ,YAAY,QACZ,YAAY,UACZ,YAAY,KAEZ;CAEF,MAAM,QAAQ,YAAY,QAAQ;CAClC,MAAM,QAAQ,YAAY,QAAQ;AAGlC,KAAI,UAAU,aAAa,UAAU,UAAW;AAEhD,KAAI,UAAU,OAAO;AACnB,YACE,CACE,qBAAqB,YAAY,cAAc,CAAC,4DAA4D,KAAK,KAAK,IAAI,CAAC,kBAAkB,MAAM,QAAQ,MAAM,iBAAiB,iBACnL,EACD,EACE,OAAO,SACR,CACF;AAED;;;AAKJ,MAAM,eACJ,aACA,WACqB;AAErB,KAAI,gBAAgB,UAAa,gBAAgB,KAC/C,QAAO;AAIT,KAAI,WAAW,UAAa,WAAW,KACrC,QAAO;AAIT,KAAI,OAAO,gBAAgB,YAAY,OAAO,WAAW,SACvD,QAAO;AAIT,KAAI,MAAM,QAAQ,YAAY,IAAI,MAAM,QAAQ,OAAO,CACrD,QAAO,WACL,aACA,OACD;AAIH,KAAI,OAAO,gBAAgB,YAAY,OAAO,WAAW,UAAU;EACjE,MAAMA,SAA2C,EAAE;EACnD,MAAM,UAAU,IAAI,IAAI,CACtB,GAAG,OAAO,KAAK,YAAsD,EACrE,GAAG,OAAO,KAAK,OAAiD,CACjE,CAAC;AAEF,OAAK,MAAM,OAAO,QAChB,QAAO,OAAO,YACX,YAAuD,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,SAClB,kBAAkB,KAClB,EAAE,CACH;AAED,kBAAgB,YACd,eACA,kBAAkB,QACnB;;AASH,QANqC;EACnC,KAAK,aAAa,GAAG;EACrB,SAAS;EACT;EACD"}
@@ -9,7 +9,7 @@ const normalizeDictionary = (dictionary, configuration) => {
9
9
  if (dictionary.locale) return {
10
10
  ...dictionary,
11
11
  locale: void 0,
12
- content: translation({ [dictionary.locale]: getPerLocaleDictionary(dictionary.content, dictionary.locale) })
12
+ content: translation({ [dictionary.locale]: dictionary.content })
13
13
  };
14
14
  const perLocaleContent = locales.reduce((acc, locale) => {
15
15
  acc[locale] = getPerLocaleDictionary(parsedDictionary, locale).content;
@@ -1 +1 @@
1
- {"version":3,"file":"normalizeDictionary.mjs","names":["t"],"sources":["../../../src/dictionaryManipulator/normalizeDictionary.ts"],"sourcesContent":["import type { Dictionary, IntlayerConfig, Locale } from '@intlayer/types';\nimport { getPerLocaleDictionary } from '../deepTransformPlugins';\nimport { t } from '../transpiler/translation';\nimport { orderDictionaries } from './orderDictionaries';\n\nexport const normalizeDictionary = (\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Dictionary => {\n const { locales } = configuration.internationalization;\n\n const parsedDictionary = JSON.parse(JSON.stringify(dictionary));\n\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n if (dictionary.locale) {\n return {\n ...dictionary,\n locale: undefined,\n content: t({\n // @ts-ignore Type instantiation is excessively deep and possibly infinite.\n [dictionary.locale]: getPerLocaleDictionary(\n dictionary.content,\n dictionary.locale\n ),\n }),\n };\n }\n\n const perLocaleContent = locales.reduce(\n (acc, locale) => {\n const perLocaleDictionary = getPerLocaleDictionary(\n parsedDictionary,\n locale\n );\n\n acc[locale] = perLocaleDictionary.content;\n return acc;\n },\n {} as Record<Locale, Dictionary['content']>\n );\n\n return {\n ...dictionary,\n content: t(perLocaleContent),\n };\n};\n\nexport const normalizeDictionaries = (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Dictionary[] => {\n const orderedDictionaries = orderDictionaries(dictionaries, configuration);\n\n const structuredDictionaries = orderedDictionaries.map((dictionary) =>\n normalizeDictionary(dictionary, configuration)\n );\n\n return structuredDictionaries;\n};\n"],"mappings":";;;;;AAKA,MAAa,uBACX,YACA,kBACe;CACf,MAAM,EAAE,YAAY,cAAc;CAElC,MAAM,mBAAmB,KAAK,MAAM,KAAK,UAAU,WAAW,CAAC;AAG/D,KAAI,WAAW,OACb,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAASA,YAAE,GAER,WAAW,SAAS,uBACnB,WAAW,SACX,WAAW,OACZ,EACF,CAAC;EACH;CAGH,MAAM,mBAAmB,QAAQ,QAC9B,KAAK,WAAW;AAMf,MAAI,UALwB,uBAC1B,kBACA,OACD,CAEiC;AAClC,SAAO;IAET,EAAE,CACH;AAED,QAAO;EACL,GAAG;EACH,SAASA,YAAE,iBAAiB;EAC7B;;AAGH,MAAa,yBACX,cACA,kBACiB;AAOjB,QAN4B,kBAAkB,cAAc,cAAc,CAEvB,KAAK,eACtD,oBAAoB,YAAY,cAAc,CAC/C"}
1
+ {"version":3,"file":"normalizeDictionary.mjs","names":["t"],"sources":["../../../src/dictionaryManipulator/normalizeDictionary.ts"],"sourcesContent":["import type { Dictionary, IntlayerConfig, Locale } from '@intlayer/types';\nimport { getPerLocaleDictionary } from '../deepTransformPlugins';\nimport { t } from '../transpiler/translation';\nimport { orderDictionaries } from './orderDictionaries';\n\nexport const normalizeDictionary = (\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Dictionary => {\n const { locales } = configuration.internationalization;\n\n const parsedDictionary = JSON.parse(JSON.stringify(dictionary));\n\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n if (dictionary.locale) {\n return {\n ...dictionary,\n locale: undefined,\n content: t({\n [dictionary.locale]: dictionary.content,\n }),\n };\n }\n\n const perLocaleContent = locales.reduce(\n (acc, locale) => {\n const perLocaleDictionary = getPerLocaleDictionary(\n parsedDictionary,\n locale\n );\n\n acc[locale] = perLocaleDictionary.content;\n return acc;\n },\n {} as Record<Locale, Dictionary['content']>\n );\n\n return {\n ...dictionary,\n content: t(perLocaleContent),\n };\n};\n\nexport const normalizeDictionaries = (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Dictionary[] => {\n const orderedDictionaries = orderDictionaries(dictionaries, configuration);\n\n const structuredDictionaries = orderedDictionaries.map((dictionary) =>\n normalizeDictionary(dictionary, configuration)\n );\n\n return structuredDictionaries;\n};\n"],"mappings":";;;;;AAKA,MAAa,uBACX,YACA,kBACe;CACf,MAAM,EAAE,YAAY,cAAc;CAElC,MAAM,mBAAmB,KAAK,MAAM,KAAK,UAAU,WAAW,CAAC;AAG/D,KAAI,WAAW,OACb,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAASA,YAAE,GACR,WAAW,SAAS,WAAW,SACjC,CAAC;EACH;CAGH,MAAM,mBAAmB,QAAQ,QAC9B,KAAK,WAAW;AAMf,MAAI,UALwB,uBAC1B,kBACA,OACD,CAEiC;AAClC,SAAO;IAET,EAAE,CACH;AAED,QAAO;EACL,GAAG;EACH,SAASA,YAAE,iBAAiB;EAC7B;;AAGH,MAAa,yBACX,cACA,kBACiB;AAOjB,QAN4B,kBAAkB,cAAc,cAAc,CAEvB,KAAK,eACtD,oBAAoB,YAAY,cAAc,CAC/C"}
@@ -23,7 +23,8 @@ import { filterMissingTranslationsOnlyPlugin, getFilterMissingTranslationsConten
23
23
  import { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary } from "./deepTransformPlugins/getFilterTranslationsOnlyContent.mjs";
24
24
  import { getLocalizedContent, getPerLocaleDictionary } from "./deepTransformPlugins/getLocalizedContent.mjs";
25
25
  import { buildMaskPlugin, getMaskContent } from "./deepTransformPlugins/getMaskContent.mjs";
26
- import { checkMissingLocalesPlugin, getMissingLocalesContent } from "./deepTransformPlugins/getMissingLocalesContent.mjs";
26
+ import { checkMissingLocalesPlugin, getMissingLocalesContent, getMissingLocalesContentFromDictionary } from "./deepTransformPlugins/getMissingLocalesContent.mjs";
27
+ import { getMultilingualDictionary } from "./deepTransformPlugins/getMultilingualDictionary.mjs";
27
28
  import { getReplacedValuesContent } from "./deepTransformPlugins/getReplacedValuesContent.mjs";
28
29
  import { getSplittedContent, getSplittedDictionaryContent } from "./deepTransformPlugins/getSplittedContent.mjs";
29
30
  import { insertContentInDictionary } from "./deepTransformPlugins/insertContentInDictionary.mjs";
@@ -64,4 +65,4 @@ import { getLocalizedUrl } from "./localization/getLocalizedUrl.mjs";
64
65
  import { localeFlatMap, localeMap, localeRecord } from "./localization/localeMapper.mjs";
65
66
  import { isSameKeyPath } from "./utils/isSameKeyPath.mjs";
66
67
 
67
- export { CachedIntl, CachedIntl as Intl, LocaleStorage, buildMaskPlugin, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, condition as cond, conditionPlugin, createCachedIntl, currency, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, getBrowserLocale, getCondition, getContent, getContentNodeByKeyPath, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTMLTextDir, getInsertionValues, getIntlayer, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, getStorageAttributes, getTranslation, insertion as insert, insertContentInDictionary, insertionPlugin, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeDictionaries, normalizeDictionary, number, orderDictionaries, parseYaml, percentage, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, setLocaleInStorage, translation as t, translationPlugin, units, updateNodeChildren };
68
+ export { CachedIntl, CachedIntl as Intl, LocaleStorage, buildMaskPlugin, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, condition as cond, conditionPlugin, createCachedIntl, currency, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, getBrowserLocale, getCondition, getContent, getContentNodeByKeyPath, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTMLTextDir, getInsertionValues, getIntlayer, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, getStorageAttributes, getTranslation, insertion as insert, insertContentInDictionary, insertionPlugin, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeDictionaries, normalizeDictionary, number, orderDictionaries, parseYaml, percentage, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, setLocaleInStorage, translation as t, translationPlugin, units, updateNodeChildren };
@@ -1,5 +1,5 @@
1
1
  import { NodeProps, Plugins } from "../interpreter/getContent/plugins.js";
2
- import * as _intlayer_types5 from "@intlayer/types";
2
+ import * as _intlayer_types2 from "@intlayer/types";
3
3
  import { ContentNode, DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
4
4
 
5
5
  //#region src/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts
@@ -25,8 +25,8 @@ declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, l
25
25
  $schema?: string;
26
26
  id?: string;
27
27
  projectIds?: string[];
28
- localId?: _intlayer_types5.LocalDictionaryId;
29
- localIds?: _intlayer_types5.LocalDictionaryId[];
28
+ localId?: _intlayer_types2.LocalDictionaryId;
29
+ localIds?: _intlayer_types2.LocalDictionaryId[];
30
30
  key: string;
31
31
  title?: string;
32
32
  description?: string;
@@ -35,7 +35,7 @@ declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, l
35
35
  filePath?: string;
36
36
  tags?: string[];
37
37
  locale?: LocalesValues;
38
- fill?: _intlayer_types5.Fill;
38
+ fill?: _intlayer_types2.Fill;
39
39
  filled?: true;
40
40
  priority?: number;
41
41
  live?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { DeepTransformContent, NodeProps, Plugins } from "../interpreter/getContent/plugins.js";
2
- import * as _intlayer_types2 from "@intlayer/types";
2
+ import * as _intlayer_types0 from "@intlayer/types";
3
3
  import { ContentNode, DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
4
4
 
5
5
  //#region src/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts
@@ -17,8 +17,8 @@ declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, loca
17
17
  $schema?: string;
18
18
  id?: string;
19
19
  projectIds?: string[];
20
- localId?: _intlayer_types2.LocalDictionaryId;
21
- localIds?: _intlayer_types2.LocalDictionaryId[];
20
+ localId?: _intlayer_types0.LocalDictionaryId;
21
+ localIds?: _intlayer_types0.LocalDictionaryId[];
22
22
  key: string;
23
23
  title?: string;
24
24
  description?: string;
@@ -27,7 +27,7 @@ declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, loca
27
27
  filePath?: string;
28
28
  tags?: string[];
29
29
  locale?: LocalesValues;
30
- fill?: _intlayer_types2.Fill;
30
+ fill?: _intlayer_types0.Fill;
31
31
  filled?: true;
32
32
  priority?: number;
33
33
  live?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { NodeProps } from "../interpreter/getContent/plugins.js";
2
- import * as _intlayer_types0 from "@intlayer/types";
2
+ import * as _intlayer_types5 from "@intlayer/types";
3
3
  import { ContentNode, Dictionary, LocalesValues } from "@intlayer/types";
4
4
 
5
5
  //#region src/deepTransformPlugins/getFilteredLocalesContent.d.ts
@@ -9,8 +9,8 @@ declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: Loc
9
9
  $schema?: string;
10
10
  id?: string;
11
11
  projectIds?: string[];
12
- localId?: _intlayer_types0.LocalDictionaryId;
13
- localIds?: _intlayer_types0.LocalDictionaryId[];
12
+ localId?: _intlayer_types5.LocalDictionaryId;
13
+ localIds?: _intlayer_types5.LocalDictionaryId[];
14
14
  key: string;
15
15
  title?: string;
16
16
  description?: string;
@@ -19,7 +19,7 @@ declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: Loc
19
19
  filePath?: string;
20
20
  tags?: string[];
21
21
  locale?: LocalesValues;
22
- fill?: _intlayer_types0.Fill;
22
+ fill?: _intlayer_types5.Fill;
23
23
  filled?: true;
24
24
  priority?: number;
25
25
  live?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { NodeProps, Plugins } from "../interpreter/getContent/plugins.js";
2
- import { ContentNode, Locale, LocalesValues } from "@intlayer/types";
2
+ import { ContentNode, Dictionary, Locale, LocalesValues } from "@intlayer/types";
3
3
 
4
4
  //#region src/deepTransformPlugins/getMissingLocalesContent.d.ts
5
5
  /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
@@ -11,6 +11,7 @@ declare const checkMissingLocalesPlugin: (locales: Locale[], onMissingLocale: (l
11
11
  * @param locales The locales to check for missing translations.
12
12
  */
13
13
  declare const getMissingLocalesContent: <T extends ContentNode>(node: T, locales: LocalesValues[], nodeProps: NodeProps) => Locale[];
14
+ declare const getMissingLocalesContentFromDictionary: (dictionary: Dictionary, locales?: LocalesValues[]) => Locale[];
14
15
  //#endregion
15
- export { checkMissingLocalesPlugin, getMissingLocalesContent };
16
+ export { checkMissingLocalesPlugin, getMissingLocalesContent, getMissingLocalesContentFromDictionary };
16
17
  //# sourceMappingURL=getMissingLocalesContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getMissingLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getMissingLocalesContent.ts"],"sourcesContent":[],"mappings":";;;;;cAYa,qCACF,oCACiB,oBACzB;AAHH;;;;;AAuCA;AAAmD,cAAtC,wBAAsC,EAAA,CAAA,UAAA,WAAA,CAAA,CAAA,IAAA,EAC3C,CAD2C,EAAA,OAAA,EAExC,aAFwC,EAAA,EAAA,SAAA,EAGtC,SAHsC,EAAA,GAIhD,MAJgD,EAAA"}
1
+ {"version":3,"file":"getMissingLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getMissingLocalesContent.ts"],"sourcesContent":[],"mappings":";;;;;AAaa,cAAA,yBA+BX,EAAA,CAAA,OAAA,EA9BS,MA8BT,EAAA,EAAA,eAAA,EAAA,CAAA,MAAA,EA7B0B,MA6B1B,EAAA,GAAA,IAAA,EAAA,GA5BC,OA4BD;;;;;AAQF;;AACQ,cADK,wBACL,EAAA,CAAA,UAD2C,WAC3C,CAAA,CAAA,IAAA,EAAA,CAAA,EAAA,OAAA,EACG,aADH,EAAA,EAAA,SAAA,EAEK,SAFL,EAAA,GAGL,MAHK,EAAA;AACG,cAoBE,sCApBF,EAAA,CAAA,UAAA,EAqBG,UArBH,EAAA,OAAA,CAAA,EAsBA,aAtBA,EAAA,EAAA,GAsB8D,MAtB9D,EAAA"}
@@ -0,0 +1,33 @@
1
+ import { Dictionary } from "@intlayer/types";
2
+
3
+ //#region src/deepTransformPlugins/getMultilingualDictionary.d.ts
4
+
5
+ /**
6
+ * Transform a per-locale dictionary into a multilingual dictionary.
7
+ *
8
+ * Example:
9
+ * ```json
10
+ * {
11
+ * "key": "about-page",
12
+ * "locale": "en",
13
+ * "content": {
14
+ * "myContent": "English content"
15
+ * }
16
+ * }
17
+ * ```
18
+ *
19
+ * ```json
20
+ * {
21
+ * "key": "about-page",
22
+ * "content": {
23
+ * "myContent": t({
24
+ * "en": "English content",
25
+ * })
26
+ * }
27
+ * }
28
+ * ```
29
+ */
30
+ declare const getMultilingualDictionary: (dictionary: Dictionary) => Dictionary;
31
+ //#endregion
32
+ export { getMultilingualDictionary };
33
+ //# sourceMappingURL=getMultilingualDictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMultilingualDictionary.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getMultilingualDictionary.ts"],"sourcesContent":[],"mappings":";;;;;;AAiCA;;;;;;;;;;;;;;;;;;;;;;;cAAa,wCACC,eACX"}
@@ -3,8 +3,9 @@ import { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilt
3
3
  import { getFilteredLocalesContent, getFilteredLocalesDictionary } from "./getFilteredLocalesContent.js";
4
4
  import { getLocalizedContent, getPerLocaleDictionary } from "./getLocalizedContent.js";
5
5
  import { buildMaskPlugin, getMaskContent } from "./getMaskContent.js";
6
- import { checkMissingLocalesPlugin, getMissingLocalesContent } from "./getMissingLocalesContent.js";
6
+ import { checkMissingLocalesPlugin, getMissingLocalesContent, getMissingLocalesContentFromDictionary } from "./getMissingLocalesContent.js";
7
+ import { getMultilingualDictionary } from "./getMultilingualDictionary.js";
7
8
  import { getReplacedValuesContent } from "./getReplacedValuesContent.js";
8
9
  import { getSplittedContent, getSplittedDictionaryContent } from "./getSplittedContent.js";
9
10
  import { insertContentInDictionary } from "./insertContentInDictionary.js";
10
- export { buildMaskPlugin, checkMissingLocalesPlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getLocalizedContent, getMaskContent, getMissingLocalesContent, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, insertContentInDictionary };
11
+ export { buildMaskPlugin, checkMissingLocalesPlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getLocalizedContent, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, insertContentInDictionary };
@@ -1 +1 @@
1
- {"version":3,"file":"mergeDictionaries.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/mergeDictionaries.ts"],"sourcesContent":[],"mappings":";;;cAoKa,kCAAmC,iBAAe"}
1
+ {"version":3,"file":"mergeDictionaries.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/mergeDictionaries.ts"],"sourcesContent":[],"mappings":";;;cAqKa,kCAAmC,iBAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"normalizeDictionary.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/normalizeDictionary.ts"],"sourcesContent":[],"mappings":";;;cAKa,kCACC,2BACG,mBACd;cAuCU,sCACG,6BACC,mBACd"}
1
+ {"version":3,"file":"normalizeDictionary.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/normalizeDictionary.ts"],"sourcesContent":[],"mappings":";;;cAKa,kCACC,2BACG,mBACd;cAmCU,sCACG,6BACC,mBACd"}
@@ -22,7 +22,8 @@ import { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilt
22
22
  import { getFilteredLocalesContent, getFilteredLocalesDictionary } from "./deepTransformPlugins/getFilteredLocalesContent.js";
23
23
  import { getLocalizedContent, getPerLocaleDictionary } from "./deepTransformPlugins/getLocalizedContent.js";
24
24
  import { buildMaskPlugin, getMaskContent } from "./deepTransformPlugins/getMaskContent.js";
25
- import { checkMissingLocalesPlugin, getMissingLocalesContent } from "./deepTransformPlugins/getMissingLocalesContent.js";
25
+ import { checkMissingLocalesPlugin, getMissingLocalesContent, getMissingLocalesContentFromDictionary } from "./deepTransformPlugins/getMissingLocalesContent.js";
26
+ import { getMultilingualDictionary } from "./deepTransformPlugins/getMultilingualDictionary.js";
26
27
  import { getReplacedValuesContent } from "./deepTransformPlugins/getReplacedValuesContent.js";
27
28
  import { getSplittedContent, getSplittedDictionaryContent } from "./deepTransformPlugins/getSplittedContent.js";
28
29
  import { insertContentInDictionary } from "./deepTransformPlugins/insertContentInDictionary.js";
@@ -64,4 +65,4 @@ import { CachedIntl, createCachedIntl } from "./utils/intl.js";
64
65
  import { isSameKeyPath } from "./utils/isSameKeyPath.js";
65
66
  import { isValidElement } from "./utils/isValidReactElement.js";
66
67
  import { parseYaml } from "./utils/parseYaml.js";
67
- export { CachedIntl, CachedIntl as Intl, ConditionCond, ConditionContent, ConditionContentStates, DeepTransformContent, DotPath, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, FileCond, FileContent, FileContentConstructor, Gender, GenderCond, GenderContent, GenderContentStates, GetNestingResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, InsertionContent, InsertionContentConstructor, IsAny, LocaleStorage, LocaleStorageOptions, MarkdownContent, MarkdownContentConstructor, NestedCond, NestedContent, NestedContentState, NodeProps, Plugins, ProcessedStorageAttributes, TranslationCond, TranslationContent, ValidDotPathsFor, buildMaskPlugin, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, condition as cond, conditionPlugin, createCachedIntl, currency, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, file, fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, getBrowserLocale, getCondition, getContent, getContentNodeByKeyPath, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTMLTextDir, getInsertionValues, getIntlayer, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, getStorageAttributes, getTranslation, insertion as insert, insertContentInDictionary, insertionPlugin, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeDictionaries, normalizeDictionary, number, orderDictionaries, parseYaml, percentage, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, setLocaleInStorage, translation as t, translationPlugin, units, updateNodeChildren };
68
+ export { CachedIntl, CachedIntl as Intl, ConditionCond, ConditionContent, ConditionContentStates, DeepTransformContent, DotPath, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, FileCond, FileContent, FileContentConstructor, Gender, GenderCond, GenderContent, GenderContentStates, GetNestingResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, InsertionContent, InsertionContentConstructor, IsAny, LocaleStorage, LocaleStorageOptions, MarkdownContent, MarkdownContentConstructor, NestedCond, NestedContent, NestedContentState, NodeProps, Plugins, ProcessedStorageAttributes, TranslationCond, TranslationContent, ValidDotPathsFor, buildMaskPlugin, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, condition as cond, conditionPlugin, createCachedIntl, currency, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, file, fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, getBrowserLocale, getCondition, getContent, getContentNodeByKeyPath, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTMLTextDir, getInsertionValues, getIntlayer, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, getStorageAttributes, getTranslation, insertion as insert, insertContentInDictionary, insertionPlugin, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeDictionaries, normalizeDictionary, number, orderDictionaries, parseYaml, percentage, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, setLocaleInStorage, translation as t, translationPlugin, units, updateNodeChildren };
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAoCA;AAcA;;;;;;;AAIc,KAlBF,OAAA,GAkBE;EACR,EAAA,EAAA,MAAA;EAAgB,SAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,GAAA,OAAA;EACO,SAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,KAAA,EAflB,SAekB,EAAA,WAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,KAAA,EAdO,SAcP,EAAA,GAAA,GAAA,EAAA,GAAA,GAAA;CAAE;;;;AACM,KAPzB,eAOyB,CAAA,CAAA,EAAA,CAAA,EAAA,UAPO,aAOP,CAAA,GAPwB,CAOxB,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S,CAAA,CAAA,MA0CA,kBA1CA,CA0CmB,CA1CnB,EA0CsB,CA1CtB,EA0CyB,CA1CzB,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"enumeration.d.ts","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":[],"mappings":";;;KAEK,QAAA;KACA,QAAA;AAH2E,KAI3E,OAAA,GAAU,QAFF,GAEa,QAFb;AAAA,KAIR,KAAA,GAAQ,OAHA;AAAA,KAIR,WAAA,GAHO,IAGW,OAHR,EAAA;AAAmB,KAI7B,QAAA,GAFK,IAEU,OAFP,EAAA;AAAO,KAGf,eAAA,GAFW,KAEY,OAFL,EAAA;AAAO,KAGzB,QAAA,GAFQ,IAEO,OAFP,EAAO;AAAO,KAGtB,eAAA,GAFe,KAEQ,OAFA,EAAA;AACvB,KAGO,WAAA,GACR,KAJgB,GAKhB,WALuB,GAMvB,QANuB,GAOvB,eAPuB,GAQvB,QARuB,GASvB,eATuB;AACtB,KAUO,uBAVgB,CAAA,OAAO,CAAA,GAUY,OAVZ,CAWjC,MAXiC,CAW1B,WAX0B,EAWb,OAXa,CAAA,CAAA,GAAA;EAEvB,QAAA,CAAA,EAWC,OAXU;CACnB;AACA,KAYQ,kBAZR,CAAA,UAAA,OAAA,CAAA,GAYgD,cAZhD,CAaF,QAAA,CAAS,WAbP,EAcF,uBAdE,CAcsB,OAdtB,CAAA,CAAA;;;;;;AAMJ;;;;;;;AAMA;;;;;;AAGE;cAqBI,WAA0D,EAAA,CAAA,OAAA,CAAA,CAAA,OAAA,CAAA,EAAxB,uBAAwB,CAAA,OAAA,CAAA,EAAA,GAAQ,cAAR,CAAQ,QAAA,CAAA,WAAR,EAAQ,uBAAR,CAAQ,OAAR,CAAA,EAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"enumeration.d.ts","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":[],"mappings":";;;KAEK,QAAA;KACA,QAAA;AAH2E,KAI3E,OAAA,GAAU,QAFF,GAEa,QAFb;AAAA,KAIR,KAAA,GAAQ,OAHA;AAAA,KAIR,WAAA,GAHO,IAGW,OAHR,EAAA;AAAmB,KAI7B,QAAA,GAFK,IAEU,OAFP,EAAA;AAAO,KAGf,eAAA,GAFW,KAEY,OAFL,EAAA;AAAO,KAGzB,QAAA,GAFQ,IAEO,OAFA,EAAA;AAAO,KAGtB,eAAA,GAFe,KAEQ,OAFA,EAAA;AACvB,KAGO,WAAA,GACR,KAJgB,GAKhB,WALuB,GAMvB,QANuB,GAOvB,eAPuB,GAQvB,QARuB,GASvB,eATuB;AACtB,KAUO,uBAVgB,CAAA,OAAO,CAAA,GAUY,OAVZ,CAWjC,MAXiC,CAW1B,WAX0B,EAWb,OAXa,CAAA,CAAA,GAAA;EAEvB,QAAA,CAAA,EAWC,OAXU;CACnB;AACA,KAYQ,kBAZR,CAAA,UAAA,OAAA,CAAA,GAYgD,cAZhD,CAaF,QAAA,CAAS,WAbP,EAcF,uBAdE,CAcsB,OAdtB,CAAA,CAAA;;;;;;AAMJ;;;;;;;AAMA;;;;;;AAGE;cAqBI,WAA0D,EAAA,CAAA,OAAA,CAAA,CAAA,OAAA,CAAA,EAAxB,uBAAwB,CAAA,OAAA,CAAA,EAAA,GAAQ,cAAR,CAAQ,QAAA,CAAA,WAAR,EAAQ,uBAAR,CAAQ,OAAR,CAAA,EAAA,CAAA,CAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "7.0.4-canary.0",
3
+ "version": "7.0.5",
4
4
  "private": false,
5
5
  "description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
6
6
  "keywords": [
@@ -98,29 +98,29 @@
98
98
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
99
99
  },
100
100
  "dependencies": {
101
- "@intlayer/api": "workspace:*",
102
- "@intlayer/config": "workspace:*",
103
- "@intlayer/dictionaries-entry": "workspace:*",
104
- "@intlayer/types": "workspace:*",
105
- "@intlayer/unmerged-dictionaries-entry": "workspace:*",
101
+ "@intlayer/api": "7.0.5",
102
+ "@intlayer/config": "7.0.5",
103
+ "@intlayer/dictionaries-entry": "7.0.5",
104
+ "@intlayer/types": "7.0.5",
105
+ "@intlayer/unmerged-dictionaries-entry": "7.0.5",
106
106
  "deepmerge": "4.3.1"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@types/node": "24.9.2",
110
- "@utils/ts-config": "workspace:*",
111
- "@utils/ts-config-types": "workspace:*",
112
- "@utils/tsdown-config": "workspace:*",
110
+ "@utils/ts-config": "7.0.5",
111
+ "@utils/ts-config-types": "7.0.5",
112
+ "@utils/tsdown-config": "7.0.5",
113
113
  "rimraf": "6.0.1",
114
114
  "tsdown": "0.15.11",
115
115
  "typescript": "5.9.3",
116
116
  "vitest": "4.0.5"
117
117
  },
118
118
  "peerDependencies": {
119
- "@intlayer/api": "workspace:*",
120
- "@intlayer/config": "workspace:*",
121
- "@intlayer/dictionaries-entry": "workspace:*",
122
- "@intlayer/types": "workspace:*",
123
- "@intlayer/unmerged-dictionaries-entry": "workspace:*"
119
+ "@intlayer/api": "7.0.5",
120
+ "@intlayer/config": "7.0.5",
121
+ "@intlayer/dictionaries-entry": "7.0.5",
122
+ "@intlayer/types": "7.0.5",
123
+ "@intlayer/unmerged-dictionaries-entry": "7.0.5"
124
124
  },
125
125
  "engines": {
126
126
  "node": ">=14.18"