@intlayer/core 5.3.10 → 5.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs +14 -13
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs +14 -13
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs.map +1 -1
- package/dist/esm/interpreter/getContent/getContent.mjs +4 -4
- package/dist/esm/interpreter/getContent/getContent.mjs.map +1 -1
- package/dist/types/dictionaryManipulator/getDefaultNode.d.ts.map +1 -1
- package/dist/types/interpreter/getContent/getContent.d.ts +1 -1
- package/dist/types/interpreter/getContent/getContent.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -23,6 +23,7 @@ __export(getDefaultNode_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(getDefaultNode_exports);
|
|
24
24
|
var import_types = require('../types/index.cjs');
|
|
25
25
|
const getDefaultNode = (nodeType, locales, content) => {
|
|
26
|
+
const clonedContent = structuredClone(content);
|
|
26
27
|
switch (nodeType) {
|
|
27
28
|
case import_types.NodeType.Translation:
|
|
28
29
|
return {
|
|
@@ -30,7 +31,7 @@ const getDefaultNode = (nodeType, locales, content) => {
|
|
|
30
31
|
[import_types.NodeType.Translation]: Object.assign(
|
|
31
32
|
{},
|
|
32
33
|
...locales.map((locale) => ({
|
|
33
|
-
[locale]:
|
|
34
|
+
[locale]: structuredClone(clonedContent) ?? ""
|
|
34
35
|
}))
|
|
35
36
|
)
|
|
36
37
|
};
|
|
@@ -38,22 +39,22 @@ const getDefaultNode = (nodeType, locales, content) => {
|
|
|
38
39
|
return {
|
|
39
40
|
nodeType: import_types.NodeType.Enumeration,
|
|
40
41
|
[import_types.NodeType.Enumeration]: {
|
|
41
|
-
"1":
|
|
42
|
+
"1": clonedContent ?? ""
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
case import_types.NodeType.Condition:
|
|
45
46
|
return {
|
|
46
47
|
nodeType: import_types.NodeType.Condition,
|
|
47
48
|
[import_types.NodeType.Condition]: {
|
|
48
|
-
true:
|
|
49
|
-
false:
|
|
49
|
+
true: clonedContent ?? "",
|
|
50
|
+
false: clonedContent ?? ""
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
case import_types.NodeType.Insertion:
|
|
53
54
|
return {
|
|
54
55
|
nodeType: import_types.NodeType.Insertion,
|
|
55
56
|
[import_types.NodeType.Insertion]: {
|
|
56
|
-
insertion:
|
|
57
|
+
insertion: clonedContent ?? ""
|
|
57
58
|
}
|
|
58
59
|
};
|
|
59
60
|
case import_types.NodeType.Nested:
|
|
@@ -66,27 +67,27 @@ const getDefaultNode = (nodeType, locales, content) => {
|
|
|
66
67
|
case import_types.NodeType.Markdown:
|
|
67
68
|
return {
|
|
68
69
|
nodeType: import_types.NodeType.Markdown,
|
|
69
|
-
[import_types.NodeType.Markdown]:
|
|
70
|
+
[import_types.NodeType.Markdown]: clonedContent ?? ""
|
|
70
71
|
};
|
|
71
72
|
case import_types.NodeType.File:
|
|
72
73
|
return {
|
|
73
74
|
nodeType: import_types.NodeType.File,
|
|
74
|
-
[import_types.NodeType.File]:
|
|
75
|
+
[import_types.NodeType.File]: clonedContent ?? ""
|
|
75
76
|
};
|
|
76
77
|
case import_types.NodeType.Object:
|
|
77
78
|
return {
|
|
78
|
-
newKey:
|
|
79
|
+
newKey: clonedContent ?? ""
|
|
79
80
|
};
|
|
80
81
|
case import_types.NodeType.Array:
|
|
81
|
-
return [
|
|
82
|
+
return [clonedContent ?? ""];
|
|
82
83
|
case import_types.NodeType.Text:
|
|
83
|
-
return
|
|
84
|
+
return clonedContent ?? "";
|
|
84
85
|
case import_types.NodeType.Number:
|
|
85
|
-
return
|
|
86
|
+
return clonedContent ?? 0;
|
|
86
87
|
case import_types.NodeType.Boolean:
|
|
87
|
-
return
|
|
88
|
+
return clonedContent ?? true;
|
|
88
89
|
default:
|
|
89
|
-
return
|
|
90
|
+
return clonedContent ?? "";
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
93
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/dictionaryManipulator/getDefaultNode.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { type ContentNode, NodeType } from '../types';\n\nexport const getDefaultNode = (\n nodeType: NodeType,\n locales: LocalesValues[],\n content?: ContentNode\n): ContentNode => {\n switch (nodeType) {\n case NodeType.Translation:\n return {\n nodeType: NodeType.Translation,\n [NodeType.Translation]: Object.assign(\n {},\n ...locales.map((locale) => ({\n [locale]:
|
|
1
|
+
{"version":3,"sources":["../../../src/dictionaryManipulator/getDefaultNode.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { type ContentNode, NodeType } from '../types';\n\nexport const getDefaultNode = (\n nodeType: NodeType,\n locales: LocalesValues[],\n content?: ContentNode\n): ContentNode => {\n const clonedContent = structuredClone(content);\n switch (nodeType) {\n case NodeType.Translation:\n return {\n nodeType: NodeType.Translation,\n [NodeType.Translation]: Object.assign(\n {},\n ...locales.map((locale) => ({\n [locale]: structuredClone(clonedContent) ?? '',\n }))\n ),\n } as ContentNode;\n\n case NodeType.Enumeration:\n return {\n nodeType: NodeType.Enumeration,\n [NodeType.Enumeration]: {\n '1': clonedContent ?? '',\n },\n } as ContentNode;\n\n case NodeType.Condition:\n return {\n nodeType: NodeType.Condition,\n [NodeType.Condition]: {\n true: clonedContent ?? '',\n false: clonedContent ?? '',\n },\n } as ContentNode;\n\n case NodeType.Insertion:\n return {\n nodeType: NodeType.Insertion,\n [NodeType.Insertion]: {\n insertion: clonedContent ?? '',\n },\n } as unknown as ContentNode;\n\n case NodeType.Nested:\n return {\n nodeType: NodeType.Nested,\n [NodeType.Nested]: {\n dictionaryKey: '',\n },\n } as ContentNode;\n\n case NodeType.Markdown:\n return {\n nodeType: NodeType.Markdown,\n [NodeType.Markdown]: clonedContent ?? '',\n } as ContentNode;\n\n case NodeType.File:\n return {\n nodeType: NodeType.File,\n [NodeType.File]: clonedContent ?? '',\n } as ContentNode;\n\n case NodeType.Object:\n return {\n newKey: clonedContent ?? '',\n } as unknown as ContentNode;\n\n case NodeType.Array:\n return [clonedContent ?? ''] as unknown as ContentNode;\n\n case NodeType.Text:\n return clonedContent ?? '';\n\n case NodeType.Number:\n return clonedContent ?? 0;\n\n case NodeType.Boolean:\n return clonedContent ?? true;\n\n default:\n return clonedContent ?? '';\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA2C;AAEpC,MAAM,iBAAiB,CAC5B,UACA,SACA,YACgB;AAChB,QAAM,gBAAgB,gBAAgB,OAAO;AAC7C,UAAQ,UAAU;AAAA,IAChB,KAAK,sBAAS;AACZ,aAAO;AAAA,QACL,UAAU,sBAAS;AAAA,QACnB,CAAC,sBAAS,WAAW,GAAG,OAAO;AAAA,UAC7B,CAAC;AAAA,UACD,GAAG,QAAQ,IAAI,CAAC,YAAY;AAAA,YAC1B,CAAC,MAAM,GAAG,gBAAgB,aAAa,KAAK;AAAA,UAC9C,EAAE;AAAA,QACJ;AAAA,MACF;AAAA,IAEF,KAAK,sBAAS;AACZ,aAAO;AAAA,QACL,UAAU,sBAAS;AAAA,QACnB,CAAC,sBAAS,WAAW,GAAG;AAAA,UACtB,KAAK,iBAAiB;AAAA,QACxB;AAAA,MACF;AAAA,IAEF,KAAK,sBAAS;AACZ,aAAO;AAAA,QACL,UAAU,sBAAS;AAAA,QACnB,CAAC,sBAAS,SAAS,GAAG;AAAA,UACpB,MAAM,iBAAiB;AAAA,UACvB,OAAO,iBAAiB;AAAA,QAC1B;AAAA,MACF;AAAA,IAEF,KAAK,sBAAS;AACZ,aAAO;AAAA,QACL,UAAU,sBAAS;AAAA,QACnB,CAAC,sBAAS,SAAS,GAAG;AAAA,UACpB,WAAW,iBAAiB;AAAA,QAC9B;AAAA,MACF;AAAA,IAEF,KAAK,sBAAS;AACZ,aAAO;AAAA,QACL,UAAU,sBAAS;AAAA,QACnB,CAAC,sBAAS,MAAM,GAAG;AAAA,UACjB,eAAe;AAAA,QACjB;AAAA,MACF;AAAA,IAEF,KAAK,sBAAS;AACZ,aAAO;AAAA,QACL,UAAU,sBAAS;AAAA,QACnB,CAAC,sBAAS,QAAQ,GAAG,iBAAiB;AAAA,MACxC;AAAA,IAEF,KAAK,sBAAS;AACZ,aAAO;AAAA,QACL,UAAU,sBAAS;AAAA,QACnB,CAAC,sBAAS,IAAI,GAAG,iBAAiB;AAAA,MACpC;AAAA,IAEF,KAAK,sBAAS;AACZ,aAAO;AAAA,QACL,QAAQ,iBAAiB;AAAA,MAC3B;AAAA,IAEF,KAAK,sBAAS;AACZ,aAAO,CAAC,iBAAiB,EAAE;AAAA,IAE7B,KAAK,sBAAS;AACZ,aAAO,iBAAiB;AAAA,IAE1B,KAAK,sBAAS;AACZ,aAAO,iBAAiB;AAAA,IAE1B,KAAK,sBAAS;AACZ,aAAO,iBAAiB;AAAA,IAE1B;AACE,aAAO,iBAAiB;AAAA,EAC5B;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n conditionPlugin,\n enumerationPlugin,\n filePlugin,\n insertionPlugin,\n nestedPlugin,\n translationPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\n} from './plugins';\n\n/**\n * Transforms a node in a single pass, applying each plugin as needed.\n *\n * @param node The node to transform.\n * @param locale The locale to use if your transformers need it (e.g. for translations).\n */\nexport const getContent = <\n T extends ContentNode,\n L extends LocalesValues = Locales,\n>(\n node: T,\n nodeProps: NodeProps,\n locale: L = configuration.internationalization.defaultLocale as L\n) => {\n const plugins: Plugins[] = [\n insertionPlugin,\n translationPlugin(locale),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin,\n filePlugin,\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAG1B,2BAAkC;AAClC,qBAUO;AAQA,MAAM,aAAa,CAIxB,MACA,WACA,SAAY,aAAAA,QAAc,qBAAqB,kBAC5C;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,QACA,kCAAkB,MAAM;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,aAAO,wCAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":["configuration"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NodeType } from "../types/index.mjs";
|
|
2
2
|
const getDefaultNode = (nodeType, locales, content) => {
|
|
3
|
+
const clonedContent = structuredClone(content);
|
|
3
4
|
switch (nodeType) {
|
|
4
5
|
case NodeType.Translation:
|
|
5
6
|
return {
|
|
@@ -7,7 +8,7 @@ const getDefaultNode = (nodeType, locales, content) => {
|
|
|
7
8
|
[NodeType.Translation]: Object.assign(
|
|
8
9
|
{},
|
|
9
10
|
...locales.map((locale) => ({
|
|
10
|
-
[locale]:
|
|
11
|
+
[locale]: structuredClone(clonedContent) ?? ""
|
|
11
12
|
}))
|
|
12
13
|
)
|
|
13
14
|
};
|
|
@@ -15,22 +16,22 @@ const getDefaultNode = (nodeType, locales, content) => {
|
|
|
15
16
|
return {
|
|
16
17
|
nodeType: NodeType.Enumeration,
|
|
17
18
|
[NodeType.Enumeration]: {
|
|
18
|
-
"1":
|
|
19
|
+
"1": clonedContent ?? ""
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
case NodeType.Condition:
|
|
22
23
|
return {
|
|
23
24
|
nodeType: NodeType.Condition,
|
|
24
25
|
[NodeType.Condition]: {
|
|
25
|
-
true:
|
|
26
|
-
false:
|
|
26
|
+
true: clonedContent ?? "",
|
|
27
|
+
false: clonedContent ?? ""
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
30
|
case NodeType.Insertion:
|
|
30
31
|
return {
|
|
31
32
|
nodeType: NodeType.Insertion,
|
|
32
33
|
[NodeType.Insertion]: {
|
|
33
|
-
insertion:
|
|
34
|
+
insertion: clonedContent ?? ""
|
|
34
35
|
}
|
|
35
36
|
};
|
|
36
37
|
case NodeType.Nested:
|
|
@@ -43,27 +44,27 @@ const getDefaultNode = (nodeType, locales, content) => {
|
|
|
43
44
|
case NodeType.Markdown:
|
|
44
45
|
return {
|
|
45
46
|
nodeType: NodeType.Markdown,
|
|
46
|
-
[NodeType.Markdown]:
|
|
47
|
+
[NodeType.Markdown]: clonedContent ?? ""
|
|
47
48
|
};
|
|
48
49
|
case NodeType.File:
|
|
49
50
|
return {
|
|
50
51
|
nodeType: NodeType.File,
|
|
51
|
-
[NodeType.File]:
|
|
52
|
+
[NodeType.File]: clonedContent ?? ""
|
|
52
53
|
};
|
|
53
54
|
case NodeType.Object:
|
|
54
55
|
return {
|
|
55
|
-
newKey:
|
|
56
|
+
newKey: clonedContent ?? ""
|
|
56
57
|
};
|
|
57
58
|
case NodeType.Array:
|
|
58
|
-
return [
|
|
59
|
+
return [clonedContent ?? ""];
|
|
59
60
|
case NodeType.Text:
|
|
60
|
-
return
|
|
61
|
+
return clonedContent ?? "";
|
|
61
62
|
case NodeType.Number:
|
|
62
|
-
return
|
|
63
|
+
return clonedContent ?? 0;
|
|
63
64
|
case NodeType.Boolean:
|
|
64
|
-
return
|
|
65
|
+
return clonedContent ?? true;
|
|
65
66
|
default:
|
|
66
|
-
return
|
|
67
|
+
return clonedContent ?? "";
|
|
67
68
|
}
|
|
68
69
|
};
|
|
69
70
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/dictionaryManipulator/getDefaultNode.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { type ContentNode, NodeType } from '../types';\n\nexport const getDefaultNode = (\n nodeType: NodeType,\n locales: LocalesValues[],\n content?: ContentNode\n): ContentNode => {\n switch (nodeType) {\n case NodeType.Translation:\n return {\n nodeType: NodeType.Translation,\n [NodeType.Translation]: Object.assign(\n {},\n ...locales.map((locale) => ({\n [locale]:
|
|
1
|
+
{"version":3,"sources":["../../../src/dictionaryManipulator/getDefaultNode.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { type ContentNode, NodeType } from '../types';\n\nexport const getDefaultNode = (\n nodeType: NodeType,\n locales: LocalesValues[],\n content?: ContentNode\n): ContentNode => {\n const clonedContent = structuredClone(content);\n switch (nodeType) {\n case NodeType.Translation:\n return {\n nodeType: NodeType.Translation,\n [NodeType.Translation]: Object.assign(\n {},\n ...locales.map((locale) => ({\n [locale]: structuredClone(clonedContent) ?? '',\n }))\n ),\n } as ContentNode;\n\n case NodeType.Enumeration:\n return {\n nodeType: NodeType.Enumeration,\n [NodeType.Enumeration]: {\n '1': clonedContent ?? '',\n },\n } as ContentNode;\n\n case NodeType.Condition:\n return {\n nodeType: NodeType.Condition,\n [NodeType.Condition]: {\n true: clonedContent ?? '',\n false: clonedContent ?? '',\n },\n } as ContentNode;\n\n case NodeType.Insertion:\n return {\n nodeType: NodeType.Insertion,\n [NodeType.Insertion]: {\n insertion: clonedContent ?? '',\n },\n } as unknown as ContentNode;\n\n case NodeType.Nested:\n return {\n nodeType: NodeType.Nested,\n [NodeType.Nested]: {\n dictionaryKey: '',\n },\n } as ContentNode;\n\n case NodeType.Markdown:\n return {\n nodeType: NodeType.Markdown,\n [NodeType.Markdown]: clonedContent ?? '',\n } as ContentNode;\n\n case NodeType.File:\n return {\n nodeType: NodeType.File,\n [NodeType.File]: clonedContent ?? '',\n } as ContentNode;\n\n case NodeType.Object:\n return {\n newKey: clonedContent ?? '',\n } as unknown as ContentNode;\n\n case NodeType.Array:\n return [clonedContent ?? ''] as unknown as ContentNode;\n\n case NodeType.Text:\n return clonedContent ?? '';\n\n case NodeType.Number:\n return clonedContent ?? 0;\n\n case NodeType.Boolean:\n return clonedContent ?? true;\n\n default:\n return clonedContent ?? '';\n }\n};\n"],"mappings":"AACA,SAA2B,gBAAgB;AAEpC,MAAM,iBAAiB,CAC5B,UACA,SACA,YACgB;AAChB,QAAM,gBAAgB,gBAAgB,OAAO;AAC7C,UAAQ,UAAU;AAAA,IAChB,KAAK,SAAS;AACZ,aAAO;AAAA,QACL,UAAU,SAAS;AAAA,QACnB,CAAC,SAAS,WAAW,GAAG,OAAO;AAAA,UAC7B,CAAC;AAAA,UACD,GAAG,QAAQ,IAAI,CAAC,YAAY;AAAA,YAC1B,CAAC,MAAM,GAAG,gBAAgB,aAAa,KAAK;AAAA,UAC9C,EAAE;AAAA,QACJ;AAAA,MACF;AAAA,IAEF,KAAK,SAAS;AACZ,aAAO;AAAA,QACL,UAAU,SAAS;AAAA,QACnB,CAAC,SAAS,WAAW,GAAG;AAAA,UACtB,KAAK,iBAAiB;AAAA,QACxB;AAAA,MACF;AAAA,IAEF,KAAK,SAAS;AACZ,aAAO;AAAA,QACL,UAAU,SAAS;AAAA,QACnB,CAAC,SAAS,SAAS,GAAG;AAAA,UACpB,MAAM,iBAAiB;AAAA,UACvB,OAAO,iBAAiB;AAAA,QAC1B;AAAA,MACF;AAAA,IAEF,KAAK,SAAS;AACZ,aAAO;AAAA,QACL,UAAU,SAAS;AAAA,QACnB,CAAC,SAAS,SAAS,GAAG;AAAA,UACpB,WAAW,iBAAiB;AAAA,QAC9B;AAAA,MACF;AAAA,IAEF,KAAK,SAAS;AACZ,aAAO;AAAA,QACL,UAAU,SAAS;AAAA,QACnB,CAAC,SAAS,MAAM,GAAG;AAAA,UACjB,eAAe;AAAA,QACjB;AAAA,MACF;AAAA,IAEF,KAAK,SAAS;AACZ,aAAO;AAAA,QACL,UAAU,SAAS;AAAA,QACnB,CAAC,SAAS,QAAQ,GAAG,iBAAiB;AAAA,MACxC;AAAA,IAEF,KAAK,SAAS;AACZ,aAAO;AAAA,QACL,UAAU,SAAS;AAAA,QACnB,CAAC,SAAS,IAAI,GAAG,iBAAiB;AAAA,MACpC;AAAA,IAEF,KAAK,SAAS;AACZ,aAAO;AAAA,QACL,QAAQ,iBAAiB;AAAA,MAC3B;AAAA,IAEF,KAAK,SAAS;AACZ,aAAO,CAAC,iBAAiB,EAAE;AAAA,IAE7B,KAAK,SAAS;AACZ,aAAO,iBAAiB;AAAA,IAE1B,KAAK,SAAS;AACZ,aAAO,iBAAiB;AAAA,IAE1B,KAAK,SAAS;AACZ,aAAO,iBAAiB;AAAA,IAE1B;AACE,aAAO,iBAAiB;AAAA,EAC5B;AACF;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import configuration from "@intlayer/config/built";
|
|
2
2
|
import { deepTransformNode } from "./deepTransform.mjs";
|
|
3
3
|
import {
|
|
4
|
-
translationPlugin,
|
|
5
|
-
enumerationPlugin,
|
|
6
4
|
conditionPlugin,
|
|
7
|
-
|
|
5
|
+
enumerationPlugin,
|
|
6
|
+
filePlugin,
|
|
8
7
|
insertionPlugin,
|
|
9
|
-
|
|
8
|
+
nestedPlugin,
|
|
9
|
+
translationPlugin
|
|
10
10
|
} from "./plugins.mjs";
|
|
11
11
|
const getContent = (node, nodeProps, locale = configuration.internationalization.defaultLocale) => {
|
|
12
12
|
const plugins = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n conditionPlugin,\n enumerationPlugin,\n filePlugin,\n insertionPlugin,\n nestedPlugin,\n translationPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\n} from './plugins';\n\n/**\n * Transforms a node in a single pass, applying each plugin as needed.\n *\n * @param node The node to transform.\n * @param locale The locale to use if your transformers need it (e.g. for translations).\n */\nexport const getContent = <\n T extends ContentNode,\n L extends LocalesValues = Locales,\n>(\n node: T,\n nodeProps: NodeProps,\n locale: L = configuration.internationalization.defaultLocale as L\n) => {\n const plugins: Plugins[] = [\n insertionPlugin,\n translationPlugin(locale),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin,\n filePlugin,\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAG1B,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAQA,MAAM,aAAa,CAIxB,MACA,WACA,SAAY,cAAc,qBAAqB,kBAC5C;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA,kBAAkB,MAAM;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,SAAO,kBAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDefaultNode.d.ts","sourceRoot":"","sources":["../../../src/dictionaryManipulator/getDefaultNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,KAAK,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEtD,eAAO,MAAM,cAAc,GACzB,UAAU,QAAQ,EAClB,SAAS,aAAa,EAAE,EACxB,UAAU,WAAW,KACpB,
|
|
1
|
+
{"version":3,"file":"getDefaultNode.d.ts","sourceRoot":"","sources":["../../../src/dictionaryManipulator/getDefaultNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,KAAK,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEtD,eAAO,MAAM,cAAc,GACzB,UAAU,QAAQ,EAClB,SAAS,aAAa,EAAE,EACxB,UAAU,WAAW,KACpB,WA+EF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Locales, LocalesValues } from '@intlayer/config/client';
|
|
2
2
|
import type { ContentNode } from '../../types';
|
|
3
3
|
import { type DeepTransformContent, type NodeProps } from './plugins';
|
|
4
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContent.d.ts","sourceRoot":"","sources":["../../../../src/interpreter/getContent/getContent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getContent.d.ts","sourceRoot":"","sources":["../../../../src/interpreter/getContent/getContent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAOL,KAAK,oBAAoB,EACzB,KAAK,SAAS,EAEf,MAAM,WAAW,CAAC;AAEnB;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GACrB,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,aAAa,GAAG,OAAO,EAEjC,MAAM,CAAC,EACP,WAAW,SAAS,EACpB,SAAQ,CAAyD,KAe3D,oBAAoB,CAAC,CAAC,CAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
],
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"negotiator": "^1.0.0",
|
|
78
|
-
"@intlayer/
|
|
79
|
-
"@intlayer/
|
|
80
|
-
"@intlayer/dictionaries-entry": "5.3.
|
|
78
|
+
"@intlayer/config": "5.3.11",
|
|
79
|
+
"@intlayer/api": "5.3.11",
|
|
80
|
+
"@intlayer/dictionaries-entry": "5.3.11"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@types/negotiator": "^0.6.3",
|
|
@@ -91,15 +91,15 @@
|
|
|
91
91
|
"tsup": "^8.4.0",
|
|
92
92
|
"typescript": "^5.8.2",
|
|
93
93
|
"@utils/eslint-config": "1.0.4",
|
|
94
|
-
"@utils/ts-config-types": "1.0.4",
|
|
95
94
|
"@utils/ts-config": "1.0.4",
|
|
95
|
+
"@utils/ts-config-types": "1.0.4",
|
|
96
96
|
"@utils/tsup-config": "1.0.4"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@intlayer/
|
|
100
|
-
"intlayer": "5.3.
|
|
101
|
-
"
|
|
102
|
-
"@intlayer/dictionaries-entry": "5.3.
|
|
99
|
+
"@intlayer/api": "5.3.11",
|
|
100
|
+
"@intlayer/config": "5.3.11",
|
|
101
|
+
"intlayer": "5.3.11",
|
|
102
|
+
"@intlayer/dictionaries-entry": "5.3.11"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": ">=14.18"
|