@intlayer/core 7.0.2-canary.0 → 7.0.2

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 (35) hide show
  1. package/dist/cjs/deepTransformPlugins/getSplittedContent.cjs +123 -0
  2. package/dist/cjs/deepTransformPlugins/getSplittedContent.cjs.map +1 -0
  3. package/dist/cjs/deepTransformPlugins/index.cjs +3 -0
  4. package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +7 -4
  5. package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
  6. package/dist/cjs/dictionaryManipulator/getUnmergedDictionaryByKeyPath.cjs +1 -1
  7. package/dist/cjs/dictionaryManipulator/getUnmergedDictionaryByKeyPath.cjs.map +1 -1
  8. package/dist/cjs/dictionaryManipulator/index.cjs +1 -3
  9. package/dist/cjs/index.cjs +4 -3
  10. package/dist/esm/deepTransformPlugins/getSplittedContent.mjs +120 -0
  11. package/dist/esm/deepTransformPlugins/getSplittedContent.mjs.map +1 -0
  12. package/dist/esm/deepTransformPlugins/index.mjs +2 -1
  13. package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +7 -4
  14. package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -1
  15. package/dist/esm/dictionaryManipulator/getUnmergedDictionaryByKeyPath.mjs +1 -1
  16. package/dist/esm/dictionaryManipulator/getUnmergedDictionaryByKeyPath.mjs.map +1 -1
  17. package/dist/esm/dictionaryManipulator/index.mjs +2 -3
  18. package/dist/esm/index.mjs +3 -3
  19. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +4 -4
  20. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +4 -4
  21. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +4 -4
  22. package/dist/types/deepTransformPlugins/getSplittedContent.d.ts +42 -0
  23. package/dist/types/deepTransformPlugins/getSplittedContent.d.ts.map +1 -0
  24. package/dist/types/deepTransformPlugins/index.d.ts +2 -1
  25. package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts +2 -2
  26. package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts.map +1 -1
  27. package/dist/types/dictionaryManipulator/getUnmergedDictionaryByKeyPath.d.ts +2 -2
  28. package/dist/types/dictionaryManipulator/index.d.ts +1 -2
  29. package/dist/types/dictionaryManipulator/orderDictionaries.d.ts +2 -2
  30. package/dist/types/index.d.ts +2 -2
  31. package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
  32. package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -1
  33. package/dist/types/transpiler/translation/translation.d.ts +1 -1
  34. package/dist/types/transpiler/translation/translation.d.ts.map +1 -1
  35. package/package.json +14 -14
@@ -0,0 +1,123 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __intlayer_types = require("@intlayer/types");
3
+ __intlayer_types = require_rolldown_runtime.__toESM(__intlayer_types);
4
+
5
+ //#region src/deepTransformPlugins/getSplittedContent.ts
6
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
7
+ const hasNodeType = (value) => isObject(value) && typeof value.nodeType === "string";
8
+ const mergeValues = (a, b) => {
9
+ if (a === void 0) return b;
10
+ if (b === void 0) return a;
11
+ if (Array.isArray(a) && Array.isArray(b)) return [...a, ...b];
12
+ if (isObject(a) && isObject(b) && !hasNodeType(a) && !hasNodeType(b)) {
13
+ const result = { ...a };
14
+ for (const key of Object.keys(b)) result[key] = mergeValues(result[key], b[key]);
15
+ return result;
16
+ }
17
+ return b;
18
+ };
19
+ const mergeSplitResults = (base, addition) => {
20
+ const result = { ...base };
21
+ result.common = mergeValues(base.common, addition.common);
22
+ const localeKeys = new Set([...Object.keys(base).filter((k) => k !== "common"), ...Object.keys(addition).filter((k) => k !== "common")]);
23
+ for (const key of localeKeys) result[key] = mergeValues(base[key], addition[key]);
24
+ return result;
25
+ };
26
+ const splitNode = (node) => {
27
+ if (isObject(node) && node?.nodeType === __intlayer_types.NodeType.Translation) {
28
+ const translations = node[__intlayer_types.NodeType.Translation];
29
+ const result = {};
30
+ for (const locale of Object.keys(translations)) {
31
+ const child = translations[locale];
32
+ const childSplit = splitNode(child);
33
+ const mergedForLocale = mergeValues(childSplit.common, void 0);
34
+ let recomposed;
35
+ for (const key of Object.keys(childSplit)) {
36
+ if (key === "common") continue;
37
+ recomposed = mergeValues(recomposed, childSplit[key]);
38
+ }
39
+ const finalLocaleNode = mergeValues(mergedForLocale, recomposed);
40
+ if (finalLocaleNode !== void 0) result[locale] = finalLocaleNode;
41
+ }
42
+ return result;
43
+ }
44
+ if (Array.isArray(node)) {
45
+ const commonArray = [];
46
+ const perLocaleArrays = {};
47
+ node.forEach((child) => {
48
+ const childSplit = splitNode(child);
49
+ if (childSplit.common !== void 0) commonArray.push(childSplit.common);
50
+ for (const key of Object.keys(childSplit)) {
51
+ if (key === "common") continue;
52
+ if (!perLocaleArrays[key]) perLocaleArrays[key] = [];
53
+ const value = childSplit[key];
54
+ if (value !== void 0) perLocaleArrays[key].push(value);
55
+ }
56
+ });
57
+ const result = {};
58
+ if (commonArray.length > 0) result.common = commonArray;
59
+ for (const key of Object.keys(perLocaleArrays)) result[key] = perLocaleArrays[key];
60
+ return result;
61
+ }
62
+ if (isObject(node) && !hasNodeType(node)) {
63
+ let accumulated = {};
64
+ for (const key of Object.keys(node)) {
65
+ const childSplit = splitNode(node[key]);
66
+ if (childSplit.common !== void 0) accumulated = mergeSplitResults(accumulated, { common: { [key]: childSplit.common } });
67
+ for (const locale of Object.keys(childSplit)) {
68
+ if (locale === "common") continue;
69
+ accumulated = mergeSplitResults(accumulated, { [locale]: { [key]: childSplit[locale] } });
70
+ }
71
+ }
72
+ return accumulated;
73
+ }
74
+ return { common: node };
75
+ };
76
+ const getSplittedContent = (content) => {
77
+ const split = splitNode(content);
78
+ const output = {};
79
+ if (split.common !== void 0) output.common = split.common;
80
+ for (const key of Object.keys(split)) {
81
+ if (key === "common") continue;
82
+ const value = split[key];
83
+ if (value !== void 0) output[key] = value;
84
+ }
85
+ return output;
86
+ };
87
+ /**
88
+ * Splits the `content` field of a Dictionary into "common" and per-locale buckets.
89
+ *
90
+ * Given a dictionary like:
91
+ * ```js
92
+ * {
93
+ * key: "my-key",
94
+ * content: {
95
+ * commonContent: "common content",
96
+ * multilingualContent: t({
97
+ * en: "english content",
98
+ * fr: "french content",
99
+ * de: "german content",
100
+ * }),
101
+ * },
102
+ * }
103
+ * ```
104
+ *
105
+ * It produces:
106
+ * ```js
107
+ * {
108
+ * common: { commonContent: "common content" },
109
+ * en: { multilingualContent: "english content" },
110
+ * fr: { multilingualContent: "french content" },
111
+ * de: { multilingualContent: "german content" },
112
+ * }
113
+ * ```
114
+ *
115
+ * @param dictionary - The input dictionary object with possible multilingual or common content.
116
+ * @returns An object mapping "common" and each locale to their corresponding content subtrees.
117
+ */
118
+ const getSplittedDictionaryContent = (dictionary) => getSplittedContent(dictionary.content);
119
+
120
+ //#endregion
121
+ exports.getSplittedContent = getSplittedContent;
122
+ exports.getSplittedDictionaryContent = getSplittedDictionaryContent;
123
+ //# sourceMappingURL=getSplittedContent.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSplittedContent.cjs","names":["result: Record<string, any>","result: SplitResult","NodeType","recomposed: ContentNode | undefined","commonArray: any[]","perLocaleArrays: Record<string, any[]>","accumulated: SplitResult","output: Record<string, ContentNode>"],"sources":["../../../src/deepTransformPlugins/getSplittedContent.ts"],"sourcesContent":["import {\n type ContentNode,\n type DeclaredLocales,\n type Dictionary,\n NodeType,\n} from '@intlayer/types';\n\ntype SplittedContentOutput<T = ContentNode> = Record<DeclaredLocales, T> & {\n common: T;\n};\n\ntype SplitResult = Record<string, ContentNode | undefined> & {\n common?: ContentNode;\n};\n\nconst isObject = (value: unknown): value is Record<string, any> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst hasNodeType = (value: unknown): value is { nodeType: string } =>\n isObject(value) && typeof (value as any).nodeType === 'string';\n\nconst mergeValues = (\n a: ContentNode | undefined,\n b: ContentNode | undefined\n): ContentNode | undefined => {\n if (a === undefined) return b;\n if (b === undefined) return a;\n\n if (Array.isArray(a) && Array.isArray(b)) {\n // Concatenate arrays when merging sibling results\n return [...a, ...b] as unknown as ContentNode;\n }\n\n if (isObject(a) && isObject(b) && !hasNodeType(a) && !hasNodeType(b)) {\n const result: Record<string, any> = { ...a };\n for (const key of Object.keys(b)) {\n result[key] = mergeValues(\n result[key] as unknown as ContentNode | undefined,\n (b as Record<string, any>)[key] as unknown as ContentNode | undefined\n );\n }\n return result as ContentNode;\n }\n\n // For primitives or differing structures, prefer b (more recent)\n return b;\n};\n\nconst mergeSplitResults = (\n base: SplitResult,\n addition: SplitResult\n): SplitResult => {\n const result: SplitResult = { ...base };\n\n // Merge common\n result.common = mergeValues(base.common, addition.common);\n\n // Merge each locale key present in either side\n const localeKeys = new Set<string>([\n ...Object.keys(base).filter((k) => k !== 'common'),\n ...Object.keys(addition).filter((k) => k !== 'common'),\n ]);\n\n for (const key of localeKeys) {\n // @ts-ignore: dynamic keys for locales\n result[key] = mergeValues(\n base[key] as ContentNode | undefined,\n addition[key] as ContentNode | undefined\n );\n }\n\n return result;\n};\n\nconst splitNode = (node: ContentNode): SplitResult => {\n // Translation node: allocate entirely to per-locale buckets\n if (isObject(node) && (node as any)?.nodeType === NodeType.Translation) {\n const translations = (node as any)[NodeType.Translation] as Record<\n string,\n ContentNode\n >;\n\n const result: SplitResult = {};\n for (const locale of Object.keys(translations)) {\n const child = translations[locale];\n const childSplit = splitNode(child);\n\n // The content under a translation belongs to the locale, not common\n // Merge common portion of the child (if any) into the locale as well\n const mergedForLocale = mergeValues(childSplit.common, undefined);\n\n // Compose locale content: prefer the fully rebuilt child by resolving deeper translations recursively\n // which are already split inside childSplit. We need to recompose a single node for this locale.\n // Recompose by merging all keys in childSplit except 'common' into a single node, then merge child's common.\n let recomposed: ContentNode | undefined;\n for (const key of Object.keys(childSplit)) {\n if (key === 'common') continue;\n recomposed = mergeValues(\n recomposed,\n childSplit[key] as ContentNode | undefined\n );\n }\n const finalLocaleNode = mergeValues(mergedForLocale, recomposed);\n\n if (finalLocaleNode !== undefined) {\n // @ts-ignore dynamic locale key\n result[locale] = finalLocaleNode;\n }\n }\n\n return result;\n }\n\n // Arrays: split each element and merge results index-wise\n if (Array.isArray(node)) {\n const commonArray: any[] = [];\n const perLocaleArrays: Record<string, any[]> = {};\n\n node.forEach((child) => {\n const childSplit = splitNode(child as ContentNode);\n\n if (childSplit.common !== undefined) {\n commonArray.push(childSplit.common);\n }\n\n for (const key of Object.keys(childSplit)) {\n if (key === 'common') continue;\n if (!perLocaleArrays[key]) perLocaleArrays[key] = [];\n const value = childSplit[key];\n if (value !== undefined) perLocaleArrays[key].push(value);\n }\n });\n\n const result: SplitResult = {};\n if (commonArray.length > 0)\n result.common = commonArray as unknown as ContentNode;\n for (const key of Object.keys(perLocaleArrays)) {\n // @ts-ignore dynamic locale key\n result[key] = perLocaleArrays[key] as unknown as ContentNode;\n }\n return result;\n }\n\n // Objects (non-typed): recursively split properties\n if (isObject(node) && !hasNodeType(node)) {\n let accumulated: SplitResult = {};\n\n for (const key of Object.keys(node)) {\n const childSplit = splitNode((node as any)[key] as ContentNode);\n\n // Assign property into common\n if (childSplit.common !== undefined) {\n accumulated = mergeSplitResults(accumulated, {\n common: { [key]: childSplit.common } as unknown as ContentNode,\n });\n }\n\n // Assign property into each locale bucket\n for (const locale of Object.keys(childSplit)) {\n if (locale === 'common') continue;\n accumulated = mergeSplitResults(accumulated, {\n // @ts-ignore dynamic locale key\n [locale]: { [key]: childSplit[locale] } as unknown as ContentNode,\n });\n }\n }\n\n return accumulated;\n }\n\n // Primitives or typed nodes (non-translation): entirely common\n return { common: node } as SplitResult;\n};\n\nexport const getSplittedContent = (\n content: ContentNode\n): SplittedContentOutput => {\n const split = splitNode(content);\n\n // Build final output with only defined sections\n const output: Record<string, ContentNode> = {};\n if (split.common !== undefined) {\n output.common = split.common;\n }\n for (const key of Object.keys(split)) {\n if (key === 'common') continue;\n const value = split[key] as ContentNode | undefined;\n if (value !== undefined) {\n output[key] = value;\n }\n }\n\n return output as unknown as SplittedContentOutput;\n};\n\n/**\n * Splits the `content` field of a Dictionary into \"common\" and per-locale buckets.\n *\n * Given a dictionary like:\n * ```js\n * {\n * key: \"my-key\",\n * content: {\n * commonContent: \"common content\",\n * multilingualContent: t({\n * en: \"english content\",\n * fr: \"french content\",\n * de: \"german content\",\n * }),\n * },\n * }\n * ```\n *\n * It produces:\n * ```js\n * {\n * common: { commonContent: \"common content\" },\n * en: { multilingualContent: \"english content\" },\n * fr: { multilingualContent: \"french content\" },\n * de: { multilingualContent: \"german content\" },\n * }\n * ```\n *\n * @param dictionary - The input dictionary object with possible multilingual or common content.\n * @returns An object mapping \"common\" and each locale to their corresponding content subtrees.\n */\nexport const getSplittedDictionaryContent = (\n dictionary: Dictionary\n): SplittedContentOutput<Dictionary['content']> =>\n getSplittedContent(dictionary.content);\n"],"mappings":";;;;;AAeA,MAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;AAEtE,MAAM,eAAe,UACnB,SAAS,MAAM,IAAI,OAAQ,MAAc,aAAa;AAExD,MAAM,eACJ,GACA,MAC4B;AAC5B,KAAI,MAAM,OAAW,QAAO;AAC5B,KAAI,MAAM,OAAW,QAAO;AAE5B,KAAI,MAAM,QAAQ,EAAE,IAAI,MAAM,QAAQ,EAAE,CAEtC,QAAO,CAAC,GAAG,GAAG,GAAG,EAAE;AAGrB,KAAI,SAAS,EAAE,IAAI,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE;EACpE,MAAMA,SAA8B,EAAE,GAAG,GAAG;AAC5C,OAAK,MAAM,OAAO,OAAO,KAAK,EAAE,CAC9B,QAAO,OAAO,YACZ,OAAO,MACN,EAA0B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,iBAAgB,OAAO,EAAE;IACpD,MAAM,QAAQ,WAAW;AACzB,QAAI,UAAU,OAAW,iBAAgB,KAAK,KAAK,MAAM;;IAE3D;EAEF,MAAMJ,SAAsB,EAAE;AAC9B,MAAI,YAAY,SAAS,EACvB,QAAO,SAAS;AAClB,OAAK,MAAM,OAAO,OAAO,KAAK,gBAAgB,CAE5C,QAAO,OAAO,gBAAgB;AAEhC,SAAO;;AAIT,KAAI,SAAS,KAAK,IAAI,CAAC,YAAY,KAAK,EAAE;EACxC,IAAIK,cAA2B,EAAE;AAEjC,OAAK,MAAM,OAAO,OAAO,KAAK,KAAK,EAAE;GACnC,MAAM,aAAa,UAAW,KAAa,KAAoB;AAG/D,OAAI,WAAW,WAAW,OACxB,eAAc,kBAAkB,aAAa,EAC3C,QAAQ,GAAG,MAAM,WAAW,QAAQ,EACrC,CAAC;AAIJ,QAAK,MAAM,UAAU,OAAO,KAAK,WAAW,EAAE;AAC5C,QAAI,WAAW,SAAU;AACzB,kBAAc,kBAAkB,aAAa,GAE1C,SAAS,GAAG,MAAM,WAAW,SAAS,EACxC,CAAC;;;AAIN,SAAO;;AAIT,QAAO,EAAE,QAAQ,MAAM;;AAGzB,MAAa,sBACX,YAC0B;CAC1B,MAAM,QAAQ,UAAU,QAAQ;CAGhC,MAAMC,SAAsC,EAAE;AAC9C,KAAI,MAAM,WAAW,OACnB,QAAO,SAAS,MAAM;AAExB,MAAK,MAAM,OAAO,OAAO,KAAK,MAAM,EAAE;AACpC,MAAI,QAAQ,SAAU;EACtB,MAAM,QAAQ,MAAM;AACpB,MAAI,UAAU,OACZ,QAAO,OAAO;;AAIlB,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCT,MAAa,gCACX,eAEA,mBAAmB,WAAW,QAAQ"}
@@ -5,6 +5,7 @@ const require_deepTransformPlugins_getLocalizedContent = require('./getLocalized
5
5
  const require_deepTransformPlugins_getMaskContent = require('./getMaskContent.cjs');
6
6
  const require_deepTransformPlugins_getMissingLocalesContent = require('./getMissingLocalesContent.cjs');
7
7
  const require_deepTransformPlugins_getReplacedValuesContent = require('./getReplacedValuesContent.cjs');
8
+ const require_deepTransformPlugins_getSplittedContent = require('./getSplittedContent.cjs');
8
9
  const require_deepTransformPlugins_insertContentInDictionary = require('./insertContentInDictionary.cjs');
9
10
 
10
11
  exports.buildMaskPlugin = require_deepTransformPlugins_getMaskContent.buildMaskPlugin;
@@ -22,4 +23,6 @@ exports.getMaskContent = require_deepTransformPlugins_getMaskContent.getMaskCont
22
23
  exports.getMissingLocalesContent = require_deepTransformPlugins_getMissingLocalesContent.getMissingLocalesContent;
23
24
  exports.getPerLocaleDictionary = require_deepTransformPlugins_getLocalizedContent.getPerLocaleDictionary;
24
25
  exports.getReplacedValuesContent = require_deepTransformPlugins_getReplacedValuesContent.getReplacedValuesContent;
26
+ exports.getSplittedContent = require_deepTransformPlugins_getSplittedContent.getSplittedContent;
27
+ exports.getSplittedDictionaryContent = require_deepTransformPlugins_getSplittedContent.getSplittedDictionaryContent;
25
28
  exports.insertContentInDictionary = require_deepTransformPlugins_insertContentInDictionary.insertContentInDictionary;
@@ -3,11 +3,14 @@ let __intlayer_types = require("@intlayer/types");
3
3
  __intlayer_types = require_rolldown_runtime.__toESM(__intlayer_types);
4
4
 
5
5
  //#region src/dictionaryManipulator/getContentNodeByKeyPath.ts
6
- const getContentNodeByKeyPath = (dictionaryContent, keyPath) => {
6
+ const getContentNodeByKeyPath = (dictionaryContent, keyPath, fallbackLocale) => {
7
7
  let currentValue = structuredClone(dictionaryContent);
8
- for (const keyObj of keyPath) if (keyObj.type === __intlayer_types.NodeType.Object || keyObj.type === __intlayer_types.NodeType.Array) currentValue = currentValue?.[keyObj.key];
9
- else if (keyObj.type === __intlayer_types.NodeType.Translation || keyObj.type === __intlayer_types.NodeType.Condition || keyObj.type === __intlayer_types.NodeType.Enumeration) currentValue = currentValue?.[keyObj.type]?.[keyObj.key];
10
- else if (keyObj.type === __intlayer_types.NodeType.Markdown || keyObj.type === __intlayer_types.NodeType.Insertion || keyObj.type === __intlayer_types.NodeType.File) currentValue = currentValue?.[keyObj.type];
8
+ for (const keyObj of keyPath) {
9
+ if (fallbackLocale && currentValue?.nodeType === __intlayer_types.NodeType.Translation) currentValue = currentValue?.[__intlayer_types.NodeType.Translation]?.[fallbackLocale];
10
+ if (keyObj.type === __intlayer_types.NodeType.Object || keyObj.type === __intlayer_types.NodeType.Array) currentValue = currentValue?.[keyObj.key];
11
+ if (keyObj.type === __intlayer_types.NodeType.Translation || keyObj.type === __intlayer_types.NodeType.Condition || keyObj.type === __intlayer_types.NodeType.Enumeration) currentValue = currentValue?.[keyObj.type]?.[keyObj.key];
12
+ if (keyObj.type === __intlayer_types.NodeType.Markdown || keyObj.type === __intlayer_types.NodeType.Insertion || keyObj.type === __intlayer_types.NodeType.File) currentValue = currentValue?.[keyObj.type];
13
+ }
11
14
  return currentValue;
12
15
  };
13
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"getContentNodeByKeyPath.cjs","names":["currentValue: any","NodeType"],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"sourcesContent":["import { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\n\nexport const getContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n keyPath: KeyPath[]\n): ContentNode => {\n let currentValue: any = structuredClone(dictionaryContent);\n\n for (const keyObj of keyPath) {\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n currentValue = currentValue?.[keyObj.key];\n } else if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Condition ||\n keyObj.type === NodeType.Enumeration\n ) {\n currentValue = currentValue?.[keyObj.type]?.[keyObj.key];\n } else if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n currentValue = currentValue?.[keyObj.type];\n }\n }\n\n return currentValue as ContentNode;\n};\n"],"mappings":";;;;;AAEA,MAAa,2BACX,mBACA,YACgB;CAChB,IAAIA,eAAoB,gBAAgB,kBAAkB;AAE1D,MAAK,MAAM,UAAU,QACnB,KAAI,OAAO,SAASC,0BAAS,UAAU,OAAO,SAASA,0BAAS,MAC9D,gBAAe,eAAe,OAAO;UAErC,OAAO,SAASA,0BAAS,eACzB,OAAO,SAASA,0BAAS,aACzB,OAAO,SAASA,0BAAS,YAEzB,gBAAe,eAAe,OAAO,QAAQ,OAAO;UAEpD,OAAO,SAASA,0BAAS,YACzB,OAAO,SAASA,0BAAS,aACzB,OAAO,SAASA,0BAAS,KAEzB,gBAAe,eAAe,OAAO;AAIzC,QAAO"}
1
+ {"version":3,"file":"getContentNodeByKeyPath.cjs","names":["currentValue: any","NodeType"],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"sourcesContent":["import {\n type ContentNode,\n type KeyPath,\n type Locale,\n NodeType,\n} from '@intlayer/types';\n\nexport const getContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n keyPath: KeyPath[],\n fallbackLocale?: Locale\n): ContentNode => {\n let currentValue: any = structuredClone(dictionaryContent);\n\n for (const keyObj of keyPath) {\n // Auto-resolve translation nodes when fallbackLocale is provided\n if (fallbackLocale && currentValue?.nodeType === NodeType.Translation) {\n currentValue = currentValue?.[NodeType.Translation]?.[fallbackLocale];\n }\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n currentValue = currentValue?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Condition ||\n keyObj.type === NodeType.Enumeration\n ) {\n currentValue = currentValue?.[keyObj.type]?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n currentValue = currentValue?.[keyObj.type];\n }\n }\n\n return currentValue as ContentNode;\n};\n"],"mappings":";;;;;AAOA,MAAa,2BACX,mBACA,SACA,mBACgB;CAChB,IAAIA,eAAoB,gBAAgB,kBAAkB;AAE1D,MAAK,MAAM,UAAU,SAAS;AAE5B,MAAI,kBAAkB,cAAc,aAAaC,0BAAS,YACxD,gBAAe,eAAeA,0BAAS,eAAe;AAGxD,MAAI,OAAO,SAASA,0BAAS,UAAU,OAAO,SAASA,0BAAS,MAC9D,gBAAe,eAAe,OAAO;AAGvC,MACE,OAAO,SAASA,0BAAS,eACzB,OAAO,SAASA,0BAAS,aACzB,OAAO,SAASA,0BAAS,YAEzB,gBAAe,eAAe,OAAO,QAAQ,OAAO;AAGtD,MACE,OAAO,SAASA,0BAAS,YACzB,OAAO,SAASA,0BAAS,aACzB,OAAO,SAASA,0BAAS,KAEzB,gBAAe,eAAe,OAAO;;AAIzC,QAAO"}
@@ -11,7 +11,7 @@ const getUnmergedDictionaryByKeyPath = (dictionaryKey, keyPath, dictionariesReco
11
11
  const unmergedEntries = (dictionariesRecord ?? (0, __intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(configuration))?.[dictionaryKey];
12
12
  if (!unmergedEntries) return null;
13
13
  const normalizedUnmergedEntries = require_dictionaryManipulator_normalizeDictionary.normalizeDictionaries(unmergedEntries, configuration);
14
- for (const dictionary of normalizedUnmergedEntries) if (require_dictionaryManipulator_getContentNodeByKeyPath.getContentNodeByKeyPath(dictionary.content, keyPath)) return dictionary;
14
+ for (const dictionary of normalizedUnmergedEntries) if (require_dictionaryManipulator_getContentNodeByKeyPath.getContentNodeByKeyPath(dictionary.content, keyPath)) return unmergedEntries.find((entry) => entry.localId === dictionary.localId);
15
15
  for (const dictionary of unmergedEntries) if (require_dictionaryManipulator_getContentNodeByKeyPath.getContentNodeByKeyPath(dictionary.content, keyPath)) return dictionary;
16
16
  };
17
17
 
@@ -1 +1 @@
1
- {"version":3,"file":"getUnmergedDictionaryByKeyPath.cjs","names":["intlayerConfiguration","normalizeDictionaries","getContentNodeByKeyPath"],"sources":["../../../src/dictionaryManipulator/getUnmergedDictionaryByKeyPath.ts"],"sourcesContent":["import intlayerConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig, KeyPath } from '@intlayer/types';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { getContentNodeByKeyPath } from './getContentNodeByKeyPath';\nimport { normalizeDictionaries } from './normalizeDictionary';\n\nexport const getUnmergedDictionaryByKeyPath = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n dictionariesRecord?: UnmergedDictionaries,\n configuration: IntlayerConfig = intlayerConfiguration\n) => {\n const unmergedEntries = (dictionariesRecord ??\n getUnmergedDictionaries(configuration))?.[dictionaryKey];\n\n if (!unmergedEntries) {\n return null;\n }\n\n const normalizedUnmergedEntries = normalizeDictionaries(\n unmergedEntries,\n configuration\n );\n\n for (const dictionary of normalizedUnmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return dictionary;\n }\n }\n\n for (const dictionary of unmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return dictionary;\n }\n }\n};\n"],"mappings":";;;;;;;;;AASA,MAAa,kCACX,eACA,SACA,oBACA,gBAAgCA,oCAC7B;CACH,MAAM,mBAAmB,0FACC,cAAc,IAAI;AAE5C,KAAI,CAAC,gBACH,QAAO;CAGT,MAAM,4BAA4BC,wEAChC,iBACA,cACD;AAED,MAAK,MAAM,cAAc,0BAGvB,KAFgBC,8EAAwB,WAAW,SAAS,QAAQ,CAGlE,QAAO;AAIX,MAAK,MAAM,cAAc,gBAGvB,KAFgBA,8EAAwB,WAAW,SAAS,QAAQ,CAGlE,QAAO"}
1
+ {"version":3,"file":"getUnmergedDictionaryByKeyPath.cjs","names":["intlayerConfiguration","normalizeDictionaries","getContentNodeByKeyPath"],"sources":["../../../src/dictionaryManipulator/getUnmergedDictionaryByKeyPath.ts"],"sourcesContent":["import intlayerConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig, KeyPath } from '@intlayer/types';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { getContentNodeByKeyPath } from './getContentNodeByKeyPath';\nimport { normalizeDictionaries } from './normalizeDictionary';\n\nexport const getUnmergedDictionaryByKeyPath = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n dictionariesRecord?: UnmergedDictionaries,\n configuration: IntlayerConfig = intlayerConfiguration\n) => {\n const unmergedEntries = (dictionariesRecord ??\n getUnmergedDictionaries(configuration))?.[dictionaryKey];\n\n if (!unmergedEntries) {\n return null;\n }\n\n // First search for the dictionary in the normalized dictionaries as it's what see the client editor selector\n // Then return the original unmerged dictionary if not found in the normalized dictionaries\n\n const normalizedUnmergedEntries = normalizeDictionaries(\n unmergedEntries,\n configuration\n );\n\n for (const dictionary of normalizedUnmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return unmergedEntries.find(\n (entry) => entry.localId === dictionary.localId\n );\n }\n }\n\n // If not found in the normalized dictionaries, search in the original unmerged dictionaries directly\n\n for (const dictionary of unmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return dictionary;\n }\n }\n};\n"],"mappings":";;;;;;;;;AASA,MAAa,kCACX,eACA,SACA,oBACA,gBAAgCA,oCAC7B;CACH,MAAM,mBAAmB,0FACC,cAAc,IAAI;AAE5C,KAAI,CAAC,gBACH,QAAO;CAMT,MAAM,4BAA4BC,wEAChC,iBACA,cACD;AAED,MAAK,MAAM,cAAc,0BAGvB,KAFgBC,8EAAwB,WAAW,SAAS,QAAQ,CAGlE,QAAO,gBAAgB,MACpB,UAAU,MAAM,YAAY,WAAW,QACzC;AAML,MAAK,MAAM,cAAc,gBAGvB,KAFgBA,8EAAwB,WAAW,SAAS,QAAQ,CAGlE,QAAO"}
@@ -4,10 +4,9 @@ const require_dictionaryManipulator_getDefaultNode = require('./getDefaultNode.c
4
4
  const require_dictionaryManipulator_getEmptyNode = require('./getEmptyNode.cjs');
5
5
  const require_dictionaryManipulator_getNodeChildren = require('./getNodeChildren.cjs');
6
6
  const require_dictionaryManipulator_getNodeType = require('./getNodeType.cjs');
7
+ const require_dictionaryManipulator_mergeDictionaries = require('./mergeDictionaries.cjs');
7
8
  const require_dictionaryManipulator_orderDictionaries = require('./orderDictionaries.cjs');
8
9
  const require_dictionaryManipulator_normalizeDictionary = require('./normalizeDictionary.cjs');
9
- const require_dictionaryManipulator_getUnmergedDictionaryByKeyPath = require('./getUnmergedDictionaryByKeyPath.cjs');
10
- const require_dictionaryManipulator_mergeDictionaries = require('./mergeDictionaries.cjs');
11
10
  const require_dictionaryManipulator_removeContentNodeByKeyPath = require('./removeContentNodeByKeyPath.cjs');
12
11
  const require_dictionaryManipulator_renameContentNodeByKeyPath = require('./renameContentNodeByKeyPath.cjs');
13
12
  const require_dictionaryManipulator_updateNodeChildren = require('./updateNodeChildren.cjs');
@@ -18,7 +17,6 @@ exports.getDefaultNode = require_dictionaryManipulator_getDefaultNode.getDefault
18
17
  exports.getEmptyNode = require_dictionaryManipulator_getEmptyNode.getEmptyNode;
19
18
  exports.getNodeChildren = require_dictionaryManipulator_getNodeChildren.getNodeChildren;
20
19
  exports.getNodeType = require_dictionaryManipulator_getNodeType.getNodeType;
21
- exports.getUnmergedDictionaryByKeyPath = require_dictionaryManipulator_getUnmergedDictionaryByKeyPath.getUnmergedDictionaryByKeyPath;
22
20
  exports.mergeDictionaries = require_dictionaryManipulator_mergeDictionaries.mergeDictionaries;
23
21
  exports.normalizeDictionaries = require_dictionaryManipulator_normalizeDictionary.normalizeDictionaries;
24
22
  exports.normalizeDictionary = require_dictionaryManipulator_normalizeDictionary.normalizeDictionary;
@@ -25,6 +25,7 @@ const require_deepTransformPlugins_getLocalizedContent = require('./deepTransfor
25
25
  const require_deepTransformPlugins_getMaskContent = require('./deepTransformPlugins/getMaskContent.cjs');
26
26
  const require_deepTransformPlugins_getMissingLocalesContent = require('./deepTransformPlugins/getMissingLocalesContent.cjs');
27
27
  const require_deepTransformPlugins_getReplacedValuesContent = require('./deepTransformPlugins/getReplacedValuesContent.cjs');
28
+ const require_deepTransformPlugins_getSplittedContent = require('./deepTransformPlugins/getSplittedContent.cjs');
28
29
  const require_deepTransformPlugins_insertContentInDictionary = require('./deepTransformPlugins/insertContentInDictionary.cjs');
29
30
  const require_dictionaryManipulator_editDictionaryByKeyPath = require('./dictionaryManipulator/editDictionaryByKeyPath.cjs');
30
31
  const require_dictionaryManipulator_getContentNodeByKeyPath = require('./dictionaryManipulator/getContentNodeByKeyPath.cjs');
@@ -33,10 +34,9 @@ const require_dictionaryManipulator_getEmptyNode = require('./dictionaryManipula
33
34
  const require_dictionaryManipulator_getNodeChildren = require('./dictionaryManipulator/getNodeChildren.cjs');
34
35
  const require_utils_isValidReactElement = require('./utils/isValidReactElement.cjs');
35
36
  const require_dictionaryManipulator_getNodeType = require('./dictionaryManipulator/getNodeType.cjs');
37
+ const require_dictionaryManipulator_mergeDictionaries = require('./dictionaryManipulator/mergeDictionaries.cjs');
36
38
  const require_dictionaryManipulator_orderDictionaries = require('./dictionaryManipulator/orderDictionaries.cjs');
37
39
  const require_dictionaryManipulator_normalizeDictionary = require('./dictionaryManipulator/normalizeDictionary.cjs');
38
- const require_dictionaryManipulator_getUnmergedDictionaryByKeyPath = require('./dictionaryManipulator/getUnmergedDictionaryByKeyPath.cjs');
39
- const require_dictionaryManipulator_mergeDictionaries = require('./dictionaryManipulator/mergeDictionaries.cjs');
40
40
  const require_dictionaryManipulator_removeContentNodeByKeyPath = require('./dictionaryManipulator/removeContentNodeByKeyPath.cjs');
41
41
  const require_dictionaryManipulator_renameContentNodeByKeyPath = require('./dictionaryManipulator/renameContentNodeByKeyPath.cjs');
42
42
  const require_dictionaryManipulator_updateNodeChildren = require('./dictionaryManipulator/updateNodeChildren.cjs');
@@ -119,9 +119,10 @@ exports.getNodeType = require_dictionaryManipulator_getNodeType.getNodeType;
119
119
  exports.getPathWithoutLocale = require_localization_getPathWithoutLocale.getPathWithoutLocale;
120
120
  exports.getPerLocaleDictionary = require_deepTransformPlugins_getLocalizedContent.getPerLocaleDictionary;
121
121
  exports.getReplacedValuesContent = require_deepTransformPlugins_getReplacedValuesContent.getReplacedValuesContent;
122
+ exports.getSplittedContent = require_deepTransformPlugins_getSplittedContent.getSplittedContent;
123
+ exports.getSplittedDictionaryContent = require_deepTransformPlugins_getSplittedContent.getSplittedDictionaryContent;
122
124
  exports.getStorageAttributes = require_getStorageAttributes.getStorageAttributes;
123
125
  exports.getTranslation = require_interpreter_getTranslation.getTranslation;
124
- exports.getUnmergedDictionaryByKeyPath = require_dictionaryManipulator_getUnmergedDictionaryByKeyPath.getUnmergedDictionaryByKeyPath;
125
126
  exports.insert = require_transpiler_insertion_insertion.insert;
126
127
  exports.insertContentInDictionary = require_deepTransformPlugins_insertContentInDictionary.insertContentInDictionary;
127
128
  exports.insertionPlugin = require_interpreter_getContent_plugins.insertionPlugin;
@@ -0,0 +1,120 @@
1
+ import { NodeType } from "@intlayer/types";
2
+
3
+ //#region src/deepTransformPlugins/getSplittedContent.ts
4
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5
+ const hasNodeType = (value) => isObject(value) && typeof value.nodeType === "string";
6
+ const mergeValues = (a, b) => {
7
+ if (a === void 0) return b;
8
+ if (b === void 0) return a;
9
+ if (Array.isArray(a) && Array.isArray(b)) return [...a, ...b];
10
+ if (isObject(a) && isObject(b) && !hasNodeType(a) && !hasNodeType(b)) {
11
+ const result = { ...a };
12
+ for (const key of Object.keys(b)) result[key] = mergeValues(result[key], b[key]);
13
+ return result;
14
+ }
15
+ return b;
16
+ };
17
+ const mergeSplitResults = (base, addition) => {
18
+ const result = { ...base };
19
+ result.common = mergeValues(base.common, addition.common);
20
+ const localeKeys = new Set([...Object.keys(base).filter((k) => k !== "common"), ...Object.keys(addition).filter((k) => k !== "common")]);
21
+ for (const key of localeKeys) result[key] = mergeValues(base[key], addition[key]);
22
+ return result;
23
+ };
24
+ const splitNode = (node) => {
25
+ if (isObject(node) && node?.nodeType === NodeType.Translation) {
26
+ const translations = node[NodeType.Translation];
27
+ const result = {};
28
+ for (const locale of Object.keys(translations)) {
29
+ const child = translations[locale];
30
+ const childSplit = splitNode(child);
31
+ const mergedForLocale = mergeValues(childSplit.common, void 0);
32
+ let recomposed;
33
+ for (const key of Object.keys(childSplit)) {
34
+ if (key === "common") continue;
35
+ recomposed = mergeValues(recomposed, childSplit[key]);
36
+ }
37
+ const finalLocaleNode = mergeValues(mergedForLocale, recomposed);
38
+ if (finalLocaleNode !== void 0) result[locale] = finalLocaleNode;
39
+ }
40
+ return result;
41
+ }
42
+ if (Array.isArray(node)) {
43
+ const commonArray = [];
44
+ const perLocaleArrays = {};
45
+ node.forEach((child) => {
46
+ const childSplit = splitNode(child);
47
+ if (childSplit.common !== void 0) commonArray.push(childSplit.common);
48
+ for (const key of Object.keys(childSplit)) {
49
+ if (key === "common") continue;
50
+ if (!perLocaleArrays[key]) perLocaleArrays[key] = [];
51
+ const value = childSplit[key];
52
+ if (value !== void 0) perLocaleArrays[key].push(value);
53
+ }
54
+ });
55
+ const result = {};
56
+ if (commonArray.length > 0) result.common = commonArray;
57
+ for (const key of Object.keys(perLocaleArrays)) result[key] = perLocaleArrays[key];
58
+ return result;
59
+ }
60
+ if (isObject(node) && !hasNodeType(node)) {
61
+ let accumulated = {};
62
+ for (const key of Object.keys(node)) {
63
+ const childSplit = splitNode(node[key]);
64
+ if (childSplit.common !== void 0) accumulated = mergeSplitResults(accumulated, { common: { [key]: childSplit.common } });
65
+ for (const locale of Object.keys(childSplit)) {
66
+ if (locale === "common") continue;
67
+ accumulated = mergeSplitResults(accumulated, { [locale]: { [key]: childSplit[locale] } });
68
+ }
69
+ }
70
+ return accumulated;
71
+ }
72
+ return { common: node };
73
+ };
74
+ const getSplittedContent = (content) => {
75
+ const split = splitNode(content);
76
+ const output = {};
77
+ if (split.common !== void 0) output.common = split.common;
78
+ for (const key of Object.keys(split)) {
79
+ if (key === "common") continue;
80
+ const value = split[key];
81
+ if (value !== void 0) output[key] = value;
82
+ }
83
+ return output;
84
+ };
85
+ /**
86
+ * Splits the `content` field of a Dictionary into "common" and per-locale buckets.
87
+ *
88
+ * Given a dictionary like:
89
+ * ```js
90
+ * {
91
+ * key: "my-key",
92
+ * content: {
93
+ * commonContent: "common content",
94
+ * multilingualContent: t({
95
+ * en: "english content",
96
+ * fr: "french content",
97
+ * de: "german content",
98
+ * }),
99
+ * },
100
+ * }
101
+ * ```
102
+ *
103
+ * It produces:
104
+ * ```js
105
+ * {
106
+ * common: { commonContent: "common content" },
107
+ * en: { multilingualContent: "english content" },
108
+ * fr: { multilingualContent: "french content" },
109
+ * de: { multilingualContent: "german content" },
110
+ * }
111
+ * ```
112
+ *
113
+ * @param dictionary - The input dictionary object with possible multilingual or common content.
114
+ * @returns An object mapping "common" and each locale to their corresponding content subtrees.
115
+ */
116
+ const getSplittedDictionaryContent = (dictionary) => getSplittedContent(dictionary.content);
117
+
118
+ //#endregion
119
+ export { getSplittedContent, getSplittedDictionaryContent };
120
+ //# sourceMappingURL=getSplittedContent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSplittedContent.mjs","names":["result: Record<string, any>","result: SplitResult","recomposed: ContentNode | undefined","commonArray: any[]","perLocaleArrays: Record<string, any[]>","accumulated: SplitResult","output: Record<string, ContentNode>"],"sources":["../../../src/deepTransformPlugins/getSplittedContent.ts"],"sourcesContent":["import {\n type ContentNode,\n type DeclaredLocales,\n type Dictionary,\n NodeType,\n} from '@intlayer/types';\n\ntype SplittedContentOutput<T = ContentNode> = Record<DeclaredLocales, T> & {\n common: T;\n};\n\ntype SplitResult = Record<string, ContentNode | undefined> & {\n common?: ContentNode;\n};\n\nconst isObject = (value: unknown): value is Record<string, any> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst hasNodeType = (value: unknown): value is { nodeType: string } =>\n isObject(value) && typeof (value as any).nodeType === 'string';\n\nconst mergeValues = (\n a: ContentNode | undefined,\n b: ContentNode | undefined\n): ContentNode | undefined => {\n if (a === undefined) return b;\n if (b === undefined) return a;\n\n if (Array.isArray(a) && Array.isArray(b)) {\n // Concatenate arrays when merging sibling results\n return [...a, ...b] as unknown as ContentNode;\n }\n\n if (isObject(a) && isObject(b) && !hasNodeType(a) && !hasNodeType(b)) {\n const result: Record<string, any> = { ...a };\n for (const key of Object.keys(b)) {\n result[key] = mergeValues(\n result[key] as unknown as ContentNode | undefined,\n (b as Record<string, any>)[key] as unknown as ContentNode | undefined\n );\n }\n return result as ContentNode;\n }\n\n // For primitives or differing structures, prefer b (more recent)\n return b;\n};\n\nconst mergeSplitResults = (\n base: SplitResult,\n addition: SplitResult\n): SplitResult => {\n const result: SplitResult = { ...base };\n\n // Merge common\n result.common = mergeValues(base.common, addition.common);\n\n // Merge each locale key present in either side\n const localeKeys = new Set<string>([\n ...Object.keys(base).filter((k) => k !== 'common'),\n ...Object.keys(addition).filter((k) => k !== 'common'),\n ]);\n\n for (const key of localeKeys) {\n // @ts-ignore: dynamic keys for locales\n result[key] = mergeValues(\n base[key] as ContentNode | undefined,\n addition[key] as ContentNode | undefined\n );\n }\n\n return result;\n};\n\nconst splitNode = (node: ContentNode): SplitResult => {\n // Translation node: allocate entirely to per-locale buckets\n if (isObject(node) && (node as any)?.nodeType === NodeType.Translation) {\n const translations = (node as any)[NodeType.Translation] as Record<\n string,\n ContentNode\n >;\n\n const result: SplitResult = {};\n for (const locale of Object.keys(translations)) {\n const child = translations[locale];\n const childSplit = splitNode(child);\n\n // The content under a translation belongs to the locale, not common\n // Merge common portion of the child (if any) into the locale as well\n const mergedForLocale = mergeValues(childSplit.common, undefined);\n\n // Compose locale content: prefer the fully rebuilt child by resolving deeper translations recursively\n // which are already split inside childSplit. We need to recompose a single node for this locale.\n // Recompose by merging all keys in childSplit except 'common' into a single node, then merge child's common.\n let recomposed: ContentNode | undefined;\n for (const key of Object.keys(childSplit)) {\n if (key === 'common') continue;\n recomposed = mergeValues(\n recomposed,\n childSplit[key] as ContentNode | undefined\n );\n }\n const finalLocaleNode = mergeValues(mergedForLocale, recomposed);\n\n if (finalLocaleNode !== undefined) {\n // @ts-ignore dynamic locale key\n result[locale] = finalLocaleNode;\n }\n }\n\n return result;\n }\n\n // Arrays: split each element and merge results index-wise\n if (Array.isArray(node)) {\n const commonArray: any[] = [];\n const perLocaleArrays: Record<string, any[]> = {};\n\n node.forEach((child) => {\n const childSplit = splitNode(child as ContentNode);\n\n if (childSplit.common !== undefined) {\n commonArray.push(childSplit.common);\n }\n\n for (const key of Object.keys(childSplit)) {\n if (key === 'common') continue;\n if (!perLocaleArrays[key]) perLocaleArrays[key] = [];\n const value = childSplit[key];\n if (value !== undefined) perLocaleArrays[key].push(value);\n }\n });\n\n const result: SplitResult = {};\n if (commonArray.length > 0)\n result.common = commonArray as unknown as ContentNode;\n for (const key of Object.keys(perLocaleArrays)) {\n // @ts-ignore dynamic locale key\n result[key] = perLocaleArrays[key] as unknown as ContentNode;\n }\n return result;\n }\n\n // Objects (non-typed): recursively split properties\n if (isObject(node) && !hasNodeType(node)) {\n let accumulated: SplitResult = {};\n\n for (const key of Object.keys(node)) {\n const childSplit = splitNode((node as any)[key] as ContentNode);\n\n // Assign property into common\n if (childSplit.common !== undefined) {\n accumulated = mergeSplitResults(accumulated, {\n common: { [key]: childSplit.common } as unknown as ContentNode,\n });\n }\n\n // Assign property into each locale bucket\n for (const locale of Object.keys(childSplit)) {\n if (locale === 'common') continue;\n accumulated = mergeSplitResults(accumulated, {\n // @ts-ignore dynamic locale key\n [locale]: { [key]: childSplit[locale] } as unknown as ContentNode,\n });\n }\n }\n\n return accumulated;\n }\n\n // Primitives or typed nodes (non-translation): entirely common\n return { common: node } as SplitResult;\n};\n\nexport const getSplittedContent = (\n content: ContentNode\n): SplittedContentOutput => {\n const split = splitNode(content);\n\n // Build final output with only defined sections\n const output: Record<string, ContentNode> = {};\n if (split.common !== undefined) {\n output.common = split.common;\n }\n for (const key of Object.keys(split)) {\n if (key === 'common') continue;\n const value = split[key] as ContentNode | undefined;\n if (value !== undefined) {\n output[key] = value;\n }\n }\n\n return output as unknown as SplittedContentOutput;\n};\n\n/**\n * Splits the `content` field of a Dictionary into \"common\" and per-locale buckets.\n *\n * Given a dictionary like:\n * ```js\n * {\n * key: \"my-key\",\n * content: {\n * commonContent: \"common content\",\n * multilingualContent: t({\n * en: \"english content\",\n * fr: \"french content\",\n * de: \"german content\",\n * }),\n * },\n * }\n * ```\n *\n * It produces:\n * ```js\n * {\n * common: { commonContent: \"common content\" },\n * en: { multilingualContent: \"english content\" },\n * fr: { multilingualContent: \"french content\" },\n * de: { multilingualContent: \"german content\" },\n * }\n * ```\n *\n * @param dictionary - The input dictionary object with possible multilingual or common content.\n * @returns An object mapping \"common\" and each locale to their corresponding content subtrees.\n */\nexport const getSplittedDictionaryContent = (\n dictionary: Dictionary\n): SplittedContentOutput<Dictionary['content']> =>\n getSplittedContent(dictionary.content);\n"],"mappings":";;;AAeA,MAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;AAEtE,MAAM,eAAe,UACnB,SAAS,MAAM,IAAI,OAAQ,MAAc,aAAa;AAExD,MAAM,eACJ,GACA,MAC4B;AAC5B,KAAI,MAAM,OAAW,QAAO;AAC5B,KAAI,MAAM,OAAW,QAAO;AAE5B,KAAI,MAAM,QAAQ,EAAE,IAAI,MAAM,QAAQ,EAAE,CAEtC,QAAO,CAAC,GAAG,GAAG,GAAG,EAAE;AAGrB,KAAI,SAAS,EAAE,IAAI,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE;EACpE,MAAMA,SAA8B,EAAE,GAAG,GAAG;AAC5C,OAAK,MAAM,OAAO,OAAO,KAAK,EAAE,CAC9B,QAAO,OAAO,YACZ,OAAO,MACN,EAA0B,KAC5B;AAEH,SAAO;;AAIT,QAAO;;AAGT,MAAM,qBACJ,MACA,aACgB;CAChB,MAAMC,SAAsB,EAAE,GAAG,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3D;EAEF,MAAMH,SAAsB,EAAE;AAC9B,MAAI,YAAY,SAAS,EACvB,QAAO,SAAS;AAClB,OAAK,MAAM,OAAO,OAAO,KAAK,gBAAgB,CAE5C,QAAO,OAAO,gBAAgB;AAEhC,SAAO;;AAIT,KAAI,SAAS,KAAK,IAAI,CAAC,YAAY,KAAK,EAAE;EACxC,IAAII,cAA2B,EAAE;AAEjC,OAAK,MAAM,OAAO,OAAO,KAAK,KAAK,EAAE;GACnC,MAAM,aAAa,UAAW,KAAa,KAAoB;AAG/D,OAAI,WAAW,WAAW,OACxB,eAAc,kBAAkB,aAAa,EAC3C,QAAQ,GAAG,MAAM,WAAW,QAAQ,EACrC,CAAC;AAIJ,QAAK,MAAM,UAAU,OAAO,KAAK,WAAW,EAAE;AAC5C,QAAI,WAAW,SAAU;AACzB,kBAAc,kBAAkB,aAAa,GAE1C,SAAS,GAAG,MAAM,WAAW,SAAS,EACxC,CAAC;;;AAIN,SAAO;;AAIT,QAAO,EAAE,QAAQ,MAAM;;AAGzB,MAAa,sBACX,YAC0B;CAC1B,MAAM,QAAQ,UAAU,QAAQ;CAGhC,MAAMC,SAAsC,EAAE;AAC9C,KAAI,MAAM,WAAW,OACnB,QAAO,SAAS,MAAM;AAExB,MAAK,MAAM,OAAO,OAAO,KAAK,MAAM,EAAE;AACpC,MAAI,QAAQ,SAAU;EACtB,MAAM,QAAQ,MAAM;AACpB,MAAI,UAAU,OACZ,QAAO,OAAO;;AAIlB,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCT,MAAa,gCACX,eAEA,mBAAmB,WAAW,QAAQ"}
@@ -5,6 +5,7 @@ import { getLocalizedContent, getPerLocaleDictionary } from "./getLocalizedConte
5
5
  import { buildMaskPlugin, getMaskContent } from "./getMaskContent.mjs";
6
6
  import { checkMissingLocalesPlugin, getMissingLocalesContent } from "./getMissingLocalesContent.mjs";
7
7
  import { getReplacedValuesContent } from "./getReplacedValuesContent.mjs";
8
+ import { getSplittedContent, getSplittedDictionaryContent } from "./getSplittedContent.mjs";
8
9
  import { insertContentInDictionary } from "./insertContentInDictionary.mjs";
9
10
 
10
- export { buildMaskPlugin, checkMissingLocalesPlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getLocalizedContent, getMaskContent, getMissingLocalesContent, getPerLocaleDictionary, getReplacedValuesContent, insertContentInDictionary };
11
+ export { buildMaskPlugin, checkMissingLocalesPlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getLocalizedContent, getMaskContent, getMissingLocalesContent, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, insertContentInDictionary };
@@ -1,11 +1,14 @@
1
1
  import { NodeType } from "@intlayer/types";
2
2
 
3
3
  //#region src/dictionaryManipulator/getContentNodeByKeyPath.ts
4
- const getContentNodeByKeyPath = (dictionaryContent, keyPath) => {
4
+ const getContentNodeByKeyPath = (dictionaryContent, keyPath, fallbackLocale) => {
5
5
  let currentValue = structuredClone(dictionaryContent);
6
- for (const keyObj of keyPath) if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) currentValue = currentValue?.[keyObj.key];
7
- else if (keyObj.type === NodeType.Translation || keyObj.type === NodeType.Condition || keyObj.type === NodeType.Enumeration) currentValue = currentValue?.[keyObj.type]?.[keyObj.key];
8
- else if (keyObj.type === NodeType.Markdown || keyObj.type === NodeType.Insertion || keyObj.type === NodeType.File) currentValue = currentValue?.[keyObj.type];
6
+ for (const keyObj of keyPath) {
7
+ if (fallbackLocale && currentValue?.nodeType === NodeType.Translation) currentValue = currentValue?.[NodeType.Translation]?.[fallbackLocale];
8
+ if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) currentValue = currentValue?.[keyObj.key];
9
+ if (keyObj.type === NodeType.Translation || keyObj.type === NodeType.Condition || keyObj.type === NodeType.Enumeration) currentValue = currentValue?.[keyObj.type]?.[keyObj.key];
10
+ if (keyObj.type === NodeType.Markdown || keyObj.type === NodeType.Insertion || keyObj.type === NodeType.File) currentValue = currentValue?.[keyObj.type];
11
+ }
9
12
  return currentValue;
10
13
  };
11
14
 
@@ -1 +1 @@
1
- {"version":3,"file":"getContentNodeByKeyPath.mjs","names":["currentValue: any"],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"sourcesContent":["import { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\n\nexport const getContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n keyPath: KeyPath[]\n): ContentNode => {\n let currentValue: any = structuredClone(dictionaryContent);\n\n for (const keyObj of keyPath) {\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n currentValue = currentValue?.[keyObj.key];\n } else if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Condition ||\n keyObj.type === NodeType.Enumeration\n ) {\n currentValue = currentValue?.[keyObj.type]?.[keyObj.key];\n } else if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n currentValue = currentValue?.[keyObj.type];\n }\n }\n\n return currentValue as ContentNode;\n};\n"],"mappings":";;;AAEA,MAAa,2BACX,mBACA,YACgB;CAChB,IAAIA,eAAoB,gBAAgB,kBAAkB;AAE1D,MAAK,MAAM,UAAU,QACnB,KAAI,OAAO,SAAS,SAAS,UAAU,OAAO,SAAS,SAAS,MAC9D,gBAAe,eAAe,OAAO;UAErC,OAAO,SAAS,SAAS,eACzB,OAAO,SAAS,SAAS,aACzB,OAAO,SAAS,SAAS,YAEzB,gBAAe,eAAe,OAAO,QAAQ,OAAO;UAEpD,OAAO,SAAS,SAAS,YACzB,OAAO,SAAS,SAAS,aACzB,OAAO,SAAS,SAAS,KAEzB,gBAAe,eAAe,OAAO;AAIzC,QAAO"}
1
+ {"version":3,"file":"getContentNodeByKeyPath.mjs","names":["currentValue: any"],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"sourcesContent":["import {\n type ContentNode,\n type KeyPath,\n type Locale,\n NodeType,\n} from '@intlayer/types';\n\nexport const getContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n keyPath: KeyPath[],\n fallbackLocale?: Locale\n): ContentNode => {\n let currentValue: any = structuredClone(dictionaryContent);\n\n for (const keyObj of keyPath) {\n // Auto-resolve translation nodes when fallbackLocale is provided\n if (fallbackLocale && currentValue?.nodeType === NodeType.Translation) {\n currentValue = currentValue?.[NodeType.Translation]?.[fallbackLocale];\n }\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n currentValue = currentValue?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Condition ||\n keyObj.type === NodeType.Enumeration\n ) {\n currentValue = currentValue?.[keyObj.type]?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n currentValue = currentValue?.[keyObj.type];\n }\n }\n\n return currentValue as ContentNode;\n};\n"],"mappings":";;;AAOA,MAAa,2BACX,mBACA,SACA,mBACgB;CAChB,IAAIA,eAAoB,gBAAgB,kBAAkB;AAE1D,MAAK,MAAM,UAAU,SAAS;AAE5B,MAAI,kBAAkB,cAAc,aAAa,SAAS,YACxD,gBAAe,eAAe,SAAS,eAAe;AAGxD,MAAI,OAAO,SAAS,SAAS,UAAU,OAAO,SAAS,SAAS,MAC9D,gBAAe,eAAe,OAAO;AAGvC,MACE,OAAO,SAAS,SAAS,eACzB,OAAO,SAAS,SAAS,aACzB,OAAO,SAAS,SAAS,YAEzB,gBAAe,eAAe,OAAO,QAAQ,OAAO;AAGtD,MACE,OAAO,SAAS,SAAS,YACzB,OAAO,SAAS,SAAS,aACzB,OAAO,SAAS,SAAS,KAEzB,gBAAe,eAAe,OAAO;;AAIzC,QAAO"}
@@ -8,7 +8,7 @@ const getUnmergedDictionaryByKeyPath = (dictionaryKey, keyPath, dictionariesReco
8
8
  const unmergedEntries = (dictionariesRecord ?? getUnmergedDictionaries(configuration$1))?.[dictionaryKey];
9
9
  if (!unmergedEntries) return null;
10
10
  const normalizedUnmergedEntries = normalizeDictionaries(unmergedEntries, configuration$1);
11
- for (const dictionary of normalizedUnmergedEntries) if (getContentNodeByKeyPath(dictionary.content, keyPath)) return dictionary;
11
+ for (const dictionary of normalizedUnmergedEntries) if (getContentNodeByKeyPath(dictionary.content, keyPath)) return unmergedEntries.find((entry) => entry.localId === dictionary.localId);
12
12
  for (const dictionary of unmergedEntries) if (getContentNodeByKeyPath(dictionary.content, keyPath)) return dictionary;
13
13
  };
14
14
 
@@ -1 +1 @@
1
- {"version":3,"file":"getUnmergedDictionaryByKeyPath.mjs","names":["intlayerConfiguration","configuration"],"sources":["../../../src/dictionaryManipulator/getUnmergedDictionaryByKeyPath.ts"],"sourcesContent":["import intlayerConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig, KeyPath } from '@intlayer/types';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { getContentNodeByKeyPath } from './getContentNodeByKeyPath';\nimport { normalizeDictionaries } from './normalizeDictionary';\n\nexport const getUnmergedDictionaryByKeyPath = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n dictionariesRecord?: UnmergedDictionaries,\n configuration: IntlayerConfig = intlayerConfiguration\n) => {\n const unmergedEntries = (dictionariesRecord ??\n getUnmergedDictionaries(configuration))?.[dictionaryKey];\n\n if (!unmergedEntries) {\n return null;\n }\n\n const normalizedUnmergedEntries = normalizeDictionaries(\n unmergedEntries,\n configuration\n );\n\n for (const dictionary of normalizedUnmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return dictionary;\n }\n }\n\n for (const dictionary of unmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return dictionary;\n }\n }\n};\n"],"mappings":";;;;;;AASA,MAAa,kCACX,eACA,SACA,oBACA,kBAAgCA,kBAC7B;CACH,MAAM,mBAAmB,sBACvB,wBAAwBC,gBAAc,IAAI;AAE5C,KAAI,CAAC,gBACH,QAAO;CAGT,MAAM,4BAA4B,sBAChC,iBACAA,gBACD;AAED,MAAK,MAAM,cAAc,0BAGvB,KAFgB,wBAAwB,WAAW,SAAS,QAAQ,CAGlE,QAAO;AAIX,MAAK,MAAM,cAAc,gBAGvB,KAFgB,wBAAwB,WAAW,SAAS,QAAQ,CAGlE,QAAO"}
1
+ {"version":3,"file":"getUnmergedDictionaryByKeyPath.mjs","names":["intlayerConfiguration","configuration"],"sources":["../../../src/dictionaryManipulator/getUnmergedDictionaryByKeyPath.ts"],"sourcesContent":["import intlayerConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig, KeyPath } from '@intlayer/types';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { getContentNodeByKeyPath } from './getContentNodeByKeyPath';\nimport { normalizeDictionaries } from './normalizeDictionary';\n\nexport const getUnmergedDictionaryByKeyPath = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n dictionariesRecord?: UnmergedDictionaries,\n configuration: IntlayerConfig = intlayerConfiguration\n) => {\n const unmergedEntries = (dictionariesRecord ??\n getUnmergedDictionaries(configuration))?.[dictionaryKey];\n\n if (!unmergedEntries) {\n return null;\n }\n\n // First search for the dictionary in the normalized dictionaries as it's what see the client editor selector\n // Then return the original unmerged dictionary if not found in the normalized dictionaries\n\n const normalizedUnmergedEntries = normalizeDictionaries(\n unmergedEntries,\n configuration\n );\n\n for (const dictionary of normalizedUnmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return unmergedEntries.find(\n (entry) => entry.localId === dictionary.localId\n );\n }\n }\n\n // If not found in the normalized dictionaries, search in the original unmerged dictionaries directly\n\n for (const dictionary of unmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return dictionary;\n }\n }\n};\n"],"mappings":";;;;;;AASA,MAAa,kCACX,eACA,SACA,oBACA,kBAAgCA,kBAC7B;CACH,MAAM,mBAAmB,sBACvB,wBAAwBC,gBAAc,IAAI;AAE5C,KAAI,CAAC,gBACH,QAAO;CAMT,MAAM,4BAA4B,sBAChC,iBACAA,gBACD;AAED,MAAK,MAAM,cAAc,0BAGvB,KAFgB,wBAAwB,WAAW,SAAS,QAAQ,CAGlE,QAAO,gBAAgB,MACpB,UAAU,MAAM,YAAY,WAAW,QACzC;AAML,MAAK,MAAM,cAAc,gBAGvB,KAFgB,wBAAwB,WAAW,SAAS,QAAQ,CAGlE,QAAO"}
@@ -4,12 +4,11 @@ import { getDefaultNode } from "./getDefaultNode.mjs";
4
4
  import { getEmptyNode } from "./getEmptyNode.mjs";
5
5
  import { getNodeChildren } from "./getNodeChildren.mjs";
6
6
  import { getNodeType } from "./getNodeType.mjs";
7
+ import { mergeDictionaries } from "./mergeDictionaries.mjs";
7
8
  import { orderDictionaries } from "./orderDictionaries.mjs";
8
9
  import { normalizeDictionaries, normalizeDictionary } from "./normalizeDictionary.mjs";
9
- import { getUnmergedDictionaryByKeyPath } from "./getUnmergedDictionaryByKeyPath.mjs";
10
- import { mergeDictionaries } from "./mergeDictionaries.mjs";
11
10
  import { removeContentNodeByKeyPath } from "./removeContentNodeByKeyPath.mjs";
12
11
  import { renameContentNodeByKeyPath } from "./renameContentNodeByKeyPath.mjs";
13
12
  import { updateNodeChildren } from "./updateNodeChildren.mjs";
14
13
 
15
- export { editDictionaryByKeyPath, getContentNodeByKeyPath, getDefaultNode, getEmptyNode, getNodeChildren, getNodeType, getUnmergedDictionaryByKeyPath, mergeDictionaries, normalizeDictionaries, normalizeDictionary, orderDictionaries, removeContentNodeByKeyPath, renameContentNodeByKeyPath, updateNodeChildren };
14
+ export { editDictionaryByKeyPath, getContentNodeByKeyPath, getDefaultNode, getEmptyNode, getNodeChildren, getNodeType, mergeDictionaries, normalizeDictionaries, normalizeDictionary, orderDictionaries, removeContentNodeByKeyPath, renameContentNodeByKeyPath, updateNodeChildren };
@@ -25,6 +25,7 @@ import { getLocalizedContent, getPerLocaleDictionary } from "./deepTransformPlug
25
25
  import { buildMaskPlugin, getMaskContent } from "./deepTransformPlugins/getMaskContent.mjs";
26
26
  import { checkMissingLocalesPlugin, getMissingLocalesContent } from "./deepTransformPlugins/getMissingLocalesContent.mjs";
27
27
  import { getReplacedValuesContent } from "./deepTransformPlugins/getReplacedValuesContent.mjs";
28
+ import { getSplittedContent, getSplittedDictionaryContent } from "./deepTransformPlugins/getSplittedContent.mjs";
28
29
  import { insertContentInDictionary } from "./deepTransformPlugins/insertContentInDictionary.mjs";
29
30
  import { editDictionaryByKeyPath } from "./dictionaryManipulator/editDictionaryByKeyPath.mjs";
30
31
  import { getContentNodeByKeyPath } from "./dictionaryManipulator/getContentNodeByKeyPath.mjs";
@@ -33,10 +34,9 @@ import { getEmptyNode } from "./dictionaryManipulator/getEmptyNode.mjs";
33
34
  import { getNodeChildren } from "./dictionaryManipulator/getNodeChildren.mjs";
34
35
  import { isValidElement } from "./utils/isValidReactElement.mjs";
35
36
  import { getNodeType } from "./dictionaryManipulator/getNodeType.mjs";
37
+ import { mergeDictionaries } from "./dictionaryManipulator/mergeDictionaries.mjs";
36
38
  import { orderDictionaries } from "./dictionaryManipulator/orderDictionaries.mjs";
37
39
  import { normalizeDictionaries, normalizeDictionary } from "./dictionaryManipulator/normalizeDictionary.mjs";
38
- import { getUnmergedDictionaryByKeyPath } from "./dictionaryManipulator/getUnmergedDictionaryByKeyPath.mjs";
39
- import { mergeDictionaries } from "./dictionaryManipulator/mergeDictionaries.mjs";
40
40
  import { removeContentNodeByKeyPath } from "./dictionaryManipulator/removeContentNodeByKeyPath.mjs";
41
41
  import { renameContentNodeByKeyPath } from "./dictionaryManipulator/renameContentNodeByKeyPath.mjs";
42
42
  import { updateNodeChildren } from "./dictionaryManipulator/updateNodeChildren.mjs";
@@ -64,4 +64,4 @@ import { getLocalizedUrl } from "./localization/getLocalizedUrl.mjs";
64
64
  import { localeFlatMap, localeMap, localeRecord } from "./localization/localeMapper.mjs";
65
65
  import { isSameKeyPath } from "./utils/isSameKeyPath.mjs";
66
66
 
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, getStorageAttributes, getTranslation, getUnmergedDictionaryByKeyPath, 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 };
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 };
@@ -1,5 +1,5 @@
1
1
  import { NodeProps, Plugins } from "../interpreter/getContent/plugins.js";
2
- import * as _intlayer_types0 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_types0.LocalDictionaryId;
29
- localIds?: _intlayer_types0.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_types0.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_types6 from "@intlayer/types";
2
+ import * as _intlayer_types5 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_types6.LocalDictionaryId;
21
- localIds?: _intlayer_types6.LocalDictionaryId[];
20
+ localId?: _intlayer_types5.LocalDictionaryId;
21
+ localIds?: _intlayer_types5.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_types6.Fill;
30
+ fill?: _intlayer_types5.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_types2 from "@intlayer/types";
2
+ import * as _intlayer_types0 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_types2.LocalDictionaryId;
13
- localIds?: _intlayer_types2.LocalDictionaryId[];
12
+ localId?: _intlayer_types0.LocalDictionaryId;
13
+ localIds?: _intlayer_types0.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_types2.Fill;
22
+ fill?: _intlayer_types0.Fill;
23
23
  filled?: true;
24
24
  priority?: number;
25
25
  live?: boolean;
@@ -0,0 +1,42 @@
1
+ import { ContentNode, DeclaredLocales, Dictionary } from "@intlayer/types";
2
+
3
+ //#region src/deepTransformPlugins/getSplittedContent.d.ts
4
+ type SplittedContentOutput<T = ContentNode> = Record<DeclaredLocales, T> & {
5
+ common: T;
6
+ };
7
+ declare const getSplittedContent: (content: ContentNode) => SplittedContentOutput;
8
+ /**
9
+ * Splits the `content` field of a Dictionary into "common" and per-locale buckets.
10
+ *
11
+ * Given a dictionary like:
12
+ * ```js
13
+ * {
14
+ * key: "my-key",
15
+ * content: {
16
+ * commonContent: "common content",
17
+ * multilingualContent: t({
18
+ * en: "english content",
19
+ * fr: "french content",
20
+ * de: "german content",
21
+ * }),
22
+ * },
23
+ * }
24
+ * ```
25
+ *
26
+ * It produces:
27
+ * ```js
28
+ * {
29
+ * common: { commonContent: "common content" },
30
+ * en: { multilingualContent: "english content" },
31
+ * fr: { multilingualContent: "french content" },
32
+ * de: { multilingualContent: "german content" },
33
+ * }
34
+ * ```
35
+ *
36
+ * @param dictionary - The input dictionary object with possible multilingual or common content.
37
+ * @returns An object mapping "common" and each locale to their corresponding content subtrees.
38
+ */
39
+ declare const getSplittedDictionaryContent: (dictionary: Dictionary) => SplittedContentOutput<Dictionary["content"]>;
40
+ //#endregion
41
+ export { getSplittedContent, getSplittedDictionaryContent };
42
+ //# sourceMappingURL=getSplittedContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSplittedContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getSplittedContent.ts"],"sourcesContent":[],"mappings":";;;KAOK,0BAA0B,eAAe,OAAO,iBAAiB;UAC5D;AAHe,CAAA;AAEM,cAuKlB,kBAvKkB,EAAA,CAAA,OAAA,EAwKpB,WAxKoB,EAAA,GAyK5B,qBAzK4B;;;;;;AAuK/B;AAoDA;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,2CACC,eACX,sBAAsB"}
@@ -5,5 +5,6 @@ import { getLocalizedContent, getPerLocaleDictionary } from "./getLocalizedConte
5
5
  import { buildMaskPlugin, getMaskContent } from "./getMaskContent.js";
6
6
  import { checkMissingLocalesPlugin, getMissingLocalesContent } from "./getMissingLocalesContent.js";
7
7
  import { getReplacedValuesContent } from "./getReplacedValuesContent.js";
8
+ import { getSplittedContent, getSplittedDictionaryContent } from "./getSplittedContent.js";
8
9
  import { insertContentInDictionary } from "./insertContentInDictionary.js";
9
- export { buildMaskPlugin, checkMissingLocalesPlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getLocalizedContent, getMaskContent, getMissingLocalesContent, getPerLocaleDictionary, getReplacedValuesContent, insertContentInDictionary };
10
+ export { buildMaskPlugin, checkMissingLocalesPlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getLocalizedContent, getMaskContent, getMissingLocalesContent, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, insertContentInDictionary };
@@ -1,7 +1,7 @@
1
- import { ContentNode, KeyPath } from "@intlayer/types";
1
+ import { ContentNode, KeyPath, Locale } from "@intlayer/types";
2
2
 
3
3
  //#region src/dictionaryManipulator/getContentNodeByKeyPath.d.ts
4
- declare const getContentNodeByKeyPath: (dictionaryContent: ContentNode, keyPath: KeyPath[]) => ContentNode;
4
+ declare const getContentNodeByKeyPath: (dictionaryContent: ContentNode, keyPath: KeyPath[], fallbackLocale?: Locale) => ContentNode;
5
5
  //#endregion
6
6
  export { getContentNodeByKeyPath };
7
7
  //# sourceMappingURL=getContentNodeByKeyPath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getContentNodeByKeyPath.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"sourcesContent":[],"mappings":";;;cAEa,6CACQ,sBACV,cACR"}
1
+ {"version":3,"file":"getContentNodeByKeyPath.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"sourcesContent":[],"mappings":";;;cAOa,6CACQ,sBACV,4BACQ,WAChB"}
@@ -1,9 +1,9 @@
1
- import * as _intlayer_types5 from "@intlayer/types";
1
+ import * as _intlayer_types8 from "@intlayer/types";
2
2
  import { IntlayerConfig, KeyPath } from "@intlayer/types";
3
3
  import { UnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
4
4
 
5
5
  //#region src/dictionaryManipulator/getUnmergedDictionaryByKeyPath.d.ts
6
- declare const getUnmergedDictionaryByKeyPath: (dictionaryKey: string, keyPath: KeyPath[], dictionariesRecord?: UnmergedDictionaries, configuration?: IntlayerConfig) => _intlayer_types5.Dictionary;
6
+ declare const getUnmergedDictionaryByKeyPath: (dictionaryKey: string, keyPath: KeyPath[], dictionariesRecord?: UnmergedDictionaries, configuration?: IntlayerConfig) => _intlayer_types8.Dictionary;
7
7
  //#endregion
8
8
  export { getUnmergedDictionaryByKeyPath };
9
9
  //# sourceMappingURL=getUnmergedDictionaryByKeyPath.d.ts.map
@@ -4,11 +4,10 @@ import { getDefaultNode } from "./getDefaultNode.js";
4
4
  import { getEmptyNode } from "./getEmptyNode.js";
5
5
  import { getNodeChildren } from "./getNodeChildren.js";
6
6
  import { getNodeType } from "./getNodeType.js";
7
- import { getUnmergedDictionaryByKeyPath } from "./getUnmergedDictionaryByKeyPath.js";
8
7
  import { mergeDictionaries } from "./mergeDictionaries.js";
9
8
  import { normalizeDictionaries, normalizeDictionary } from "./normalizeDictionary.js";
10
9
  import { orderDictionaries } from "./orderDictionaries.js";
11
10
  import { removeContentNodeByKeyPath } from "./removeContentNodeByKeyPath.js";
12
11
  import { renameContentNodeByKeyPath } from "./renameContentNodeByKeyPath.js";
13
12
  import { updateNodeChildren } from "./updateNodeChildren.js";
14
- export { editDictionaryByKeyPath, getContentNodeByKeyPath, getDefaultNode, getEmptyNode, getNodeChildren, getNodeType, getUnmergedDictionaryByKeyPath, mergeDictionaries, normalizeDictionaries, normalizeDictionary, orderDictionaries, removeContentNodeByKeyPath, renameContentNodeByKeyPath, updateNodeChildren };
13
+ export { editDictionaryByKeyPath, getContentNodeByKeyPath, getDefaultNode, getEmptyNode, getNodeChildren, getNodeType, mergeDictionaries, normalizeDictionaries, normalizeDictionary, orderDictionaries, removeContentNodeByKeyPath, renameContentNodeByKeyPath, updateNodeChildren };
@@ -1,4 +1,4 @@
1
- import * as _intlayer_types9 from "@intlayer/types";
1
+ import * as _intlayer_types8 from "@intlayer/types";
2
2
  import { Dictionary } from "@intlayer/types";
3
3
 
4
4
  //#region src/dictionaryManipulator/orderDictionaries.d.ts
@@ -10,7 +10,7 @@ import { Dictionary } from "@intlayer/types";
10
10
  * @param priorityStrategy - The priority strategy ('local_first' or 'distant_first')
11
11
  * @returns Ordered array of dictionaries
12
12
  */
13
- declare const orderDictionaries: (dictionaries: Dictionary[], configuration?: _intlayer_types9.IntlayerConfig) => Dictionary[];
13
+ declare const orderDictionaries: (dictionaries: Dictionary[], configuration?: _intlayer_types8.IntlayerConfig) => Dictionary[];
14
14
  //#endregion
15
15
  export { orderDictionaries };
16
16
  //# sourceMappingURL=orderDictionaries.d.ts.map
@@ -24,6 +24,7 @@ import { getLocalizedContent, getPerLocaleDictionary } from "./deepTransformPlug
24
24
  import { buildMaskPlugin, getMaskContent } from "./deepTransformPlugins/getMaskContent.js";
25
25
  import { checkMissingLocalesPlugin, getMissingLocalesContent } from "./deepTransformPlugins/getMissingLocalesContent.js";
26
26
  import { getReplacedValuesContent } from "./deepTransformPlugins/getReplacedValuesContent.js";
27
+ import { getSplittedContent, getSplittedDictionaryContent } from "./deepTransformPlugins/getSplittedContent.js";
27
28
  import { insertContentInDictionary } from "./deepTransformPlugins/insertContentInDictionary.js";
28
29
  import { editDictionaryByKeyPath } from "./dictionaryManipulator/editDictionaryByKeyPath.js";
29
30
  import { getContentNodeByKeyPath } from "./dictionaryManipulator/getContentNodeByKeyPath.js";
@@ -31,7 +32,6 @@ import { getDefaultNode } from "./dictionaryManipulator/getDefaultNode.js";
31
32
  import { getEmptyNode } from "./dictionaryManipulator/getEmptyNode.js";
32
33
  import { getNodeChildren } from "./dictionaryManipulator/getNodeChildren.js";
33
34
  import { getNodeType } from "./dictionaryManipulator/getNodeType.js";
34
- import { getUnmergedDictionaryByKeyPath } from "./dictionaryManipulator/getUnmergedDictionaryByKeyPath.js";
35
35
  import { mergeDictionaries } from "./dictionaryManipulator/mergeDictionaries.js";
36
36
  import { normalizeDictionaries, normalizeDictionary } from "./dictionaryManipulator/normalizeDictionary.js";
37
37
  import { orderDictionaries } from "./dictionaryManipulator/orderDictionaries.js";
@@ -64,4 +64,4 @@ import { CachedIntl, createCachedIntl } from "./utils/intl.js";
64
64
  import { isSameKeyPath } from "./utils/isSameKeyPath.js";
65
65
  import { isValidElement } from "./utils/isValidReactElement.js";
66
66
  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, getStorageAttributes, getTranslation, getUnmergedDictionaryByKeyPath, 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 };
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 };
@@ -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,SAAA;EAAI,QAAA,EAN7B,QAM6B,GAAA,MAAA;EAAjC,CALL,QAAA,CAAS,WAAA,CAKJ,EAAA,KAAA,EAAA;CAAoB,GAHxB,CAGwB,SAHd,MAGc,CAHP,WAGO,EAAA,OAAA,CAAA,GAFtB,CAEsB,SAAA,MAFN,CAEM,GADpB,oBACoB,CADC,CACD,CADG,CACH,CAAA,EADO,CACP,CAAA,GAApB,oBAAoB,CAAC,CAAD,CAAA,MAAS,CAAT,CAAA,EAAa,CAAb,CAAA,GAAA,KAAA,GAAA,KAAA;AAK5B;AACU,cADG,iBACH,EAAA,CAAA,MAAA,EAAA,aAAA,EAAA,QAAA,CAAA,EACG,aADH,EAAA,GAEP,OAFO;;;;AAgCE,KAAA,eAAe,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,GAAY,CAAZ,S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WC,SAXU;CACnB;AACA,KAYQ,kBAZR,CAAA,YAAA,OAAA,CAAA,GAYgD,cAZhD,CAaF,QAAA,CAAS,WAbP,EAcF,uBAdE,CAcsB,SAdtB,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"}
@@ -23,7 +23,7 @@ type TranslationContent<Content$1 = unknown, RecordContent extends StrictModeLoc
23
23
  * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
24
24
  */
25
25
  declare const translation: <Content = unknown, ContentRecord extends StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>>(content: ContentRecord) => TypedNodeModel<NodeType.Translation, ContentRecord, {
26
- nodeType: "translation" | NodeType.Translation;
26
+ nodeType: NodeType.Translation | "translation";
27
27
  } & {
28
28
  translation: ContentRecord;
29
29
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"translation.d.ts","names":[],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":[],"mappings":";;;KAOY,8DAGR,oBAAoB,aAAW,oBAAoB,cACnD,eAAe,QAAA,CAAS,aAAa;;AAJzC;;;;;;;;;AAIwD;;;;;;;;;;cAsBlD,WAKkB,EAAA,CAAA,UAAA,OAAA,EAAA,sBAFpB,mBAEoB,CAFA,OAEA,CAAA,GAFW,mBAEX,CAF+B,OAE/B,CAAA,CAAA,CAAA,OAAA,EAAb,aAAa,EAAA,GAAA,cAAA,CAAA,QAAA,CAAA,WAAA,EAAA,aAAA,EAAA;EAAA,QAAA,EAAA,aAAA,uBAAA"}
1
+ {"version":3,"file":"translation.d.ts","names":[],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":[],"mappings":";;;KAOY,8DAGR,oBAAoB,aAAW,oBAAoB,cACnD,eAAe,QAAA,CAAS,aAAa;;AAJzC;;;;;;;;;AAIwD;;;;;;;;;;cAsBlD,WAKkB,EAAA,CAAA,UAAA,OAAA,EAAA,sBAFpB,mBAEoB,CAFA,OAEA,CAAA,GAFW,mBAEX,CAF+B,OAE/B,CAAA,CAAA,CAAA,OAAA,EAAb,aAAa,EAAA,GAAA,cAAA,CAAA,QAAA,CAAA,WAAA,EAAA,aAAA,EAAA;EAAA,QAAA,sBAAA,GAAA,aAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "7.0.2-canary.0",
3
+ "version": "7.0.2",
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": "7.0.2-canary.0",
102
- "@intlayer/config": "7.0.2-canary.0",
103
- "@intlayer/dictionaries-entry": "7.0.2-canary.0",
104
- "@intlayer/types": "7.0.2-canary.0",
105
- "@intlayer/unmerged-dictionaries-entry": "7.0.2-canary.0",
101
+ "@intlayer/api": "7.0.2",
102
+ "@intlayer/config": "7.0.2",
103
+ "@intlayer/dictionaries-entry": "7.0.2",
104
+ "@intlayer/types": "7.0.2",
105
+ "@intlayer/unmerged-dictionaries-entry": "7.0.2",
106
106
  "deepmerge": "4.3.1"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@types/node": "24.9.1",
110
- "@utils/ts-config": "7.0.2-canary.0",
111
- "@utils/ts-config-types": "7.0.2-canary.0",
112
- "@utils/tsdown-config": "7.0.2-canary.0",
110
+ "@utils/ts-config": "7.0.2",
111
+ "@utils/ts-config-types": "7.0.2",
112
+ "@utils/tsdown-config": "7.0.2",
113
113
  "rimraf": "6.0.1",
114
114
  "tsdown": "0.15.9",
115
115
  "typescript": "5.9.3",
116
116
  "vitest": "4.0.3"
117
117
  },
118
118
  "peerDependencies": {
119
- "@intlayer/api": "7.0.2-canary.0",
120
- "@intlayer/config": "7.0.2-canary.0",
121
- "@intlayer/dictionaries-entry": "7.0.2-canary.0",
122
- "@intlayer/types": "7.0.2-canary.0",
123
- "@intlayer/unmerged-dictionaries-entry": "7.0.2-canary.0"
119
+ "@intlayer/api": "7.0.2",
120
+ "@intlayer/config": "7.0.2",
121
+ "@intlayer/dictionaries-entry": "7.0.2",
122
+ "@intlayer/types": "7.0.2",
123
+ "@intlayer/unmerged-dictionaries-entry": "7.0.2"
124
124
  },
125
125
  "engines": {
126
126
  "node": ">=14.18"