@intlayer/core 5.1.3 → 5.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getEmptyNode_exports = {};
20
+ __export(getEmptyNode_exports, {
21
+ getEmptyNode: () => getEmptyNode
22
+ });
23
+ module.exports = __toCommonJS(getEmptyNode_exports);
24
+ var import_types = require('../types/index.cjs');
25
+ const getEmptyNode = (section) => {
26
+ if (typeof section === "string") {
27
+ return "";
28
+ }
29
+ if (typeof section === "number") {
30
+ return 0;
31
+ }
32
+ if (typeof section === "boolean") {
33
+ return true;
34
+ }
35
+ if (typeof section?.nodeType === "string") {
36
+ const typedNode = section;
37
+ const content = typedNode[typedNode.nodeType];
38
+ if (typedNode.nodeType === import_types.NodeType.Translation || typedNode.nodeType === import_types.NodeType.Enumeration || typedNode.nodeType === import_types.NodeType.Condition) {
39
+ return getEmptyNode(content);
40
+ }
41
+ if (typedNode.nodeType === import_types.NodeType.Nested) {
42
+ return typedNode;
43
+ }
44
+ if (typedNode.nodeType === import_types.NodeType.Markdown) {
45
+ return getEmptyNode(typedNode);
46
+ }
47
+ return content;
48
+ }
49
+ if (!section || typeof section !== "object") {
50
+ return section;
51
+ }
52
+ if (Array.isArray(section)) {
53
+ return section.map(
54
+ getEmptyNode
55
+ );
56
+ }
57
+ const mappedSectionObject = Object.entries(section).map(([key, value]) => [
58
+ key,
59
+ getEmptyNode(value)
60
+ ]);
61
+ const mappedSectionArray = Object.fromEntries(mappedSectionObject);
62
+ return mappedSectionArray;
63
+ };
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ getEmptyNode
67
+ });
68
+ //# sourceMappingURL=getEmptyNode.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/dictionaryManipulator/getEmptyNode.ts"],"sourcesContent":["import { type ContentNode, type TypedNode, NodeType } from '../types';\n\nexport const getEmptyNode = (section: ContentNode): ContentNode => {\n if (typeof section === 'string') {\n return '';\n }\n if (typeof section === 'number') {\n return 0;\n }\n if (typeof section === 'boolean') {\n return true;\n }\n if (typeof (section as TypedNode)?.nodeType === 'string') {\n const typedNode = section as TypedNode;\n const content = typedNode[typedNode.nodeType as keyof TypedNode];\n\n if (\n typedNode.nodeType === NodeType.Translation ||\n typedNode.nodeType === NodeType.Enumeration ||\n typedNode.nodeType === NodeType.Condition\n ) {\n return getEmptyNode(content as ContentNode);\n }\n\n if (typedNode.nodeType === NodeType.Nested) {\n return typedNode;\n }\n\n if (typedNode.nodeType === NodeType.Markdown) {\n return getEmptyNode(typedNode);\n }\n\n return content;\n }\n\n if (!section || typeof section !== 'object') {\n return section;\n }\n\n if (Array.isArray(section)) {\n return (section as ContentNode[]).map(\n getEmptyNode\n ) as unknown as ContentNode;\n }\n\n const mappedSectionObject = Object.entries(section).map(([key, value]) => [\n key,\n getEmptyNode(value),\n ]);\n\n const mappedSectionArray = Object.fromEntries(mappedSectionObject);\n\n return mappedSectionArray;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2D;AAEpD,MAAM,eAAe,CAAC,YAAsC;AACjE,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AACA,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AACA,MAAI,OAAO,YAAY,WAAW;AAChC,WAAO;AAAA,EACT;AACA,MAAI,OAAQ,SAAuB,aAAa,UAAU;AACxD,UAAM,YAAY;AAClB,UAAM,UAAU,UAAU,UAAU,QAA2B;AAE/D,QACE,UAAU,aAAa,sBAAS,eAChC,UAAU,aAAa,sBAAS,eAChC,UAAU,aAAa,sBAAS,WAChC;AACA,aAAO,aAAa,OAAsB;AAAA,IAC5C;AAEA,QAAI,UAAU,aAAa,sBAAS,QAAQ;AAC1C,aAAO;AAAA,IACT;AAEA,QAAI,UAAU,aAAa,sBAAS,UAAU;AAC5C,aAAO,aAAa,SAAS;AAAA,IAC/B;AAEA,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,WAAW,OAAO,YAAY,UAAU;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,WAAQ,QAA0B;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AAEA,QAAM,sBAAsB,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,IACxE;AAAA,IACA,aAAa,KAAK;AAAA,EACpB,CAAC;AAED,QAAM,qBAAqB,OAAO,YAAY,mBAAmB;AAEjE,SAAO;AACT;","names":[]}
@@ -23,6 +23,7 @@ __reExport(dictionaryManipulator_exports, require('./renameContentNodeByKeyPath.
23
23
  __reExport(dictionaryManipulator_exports, require('./getNodeType.cjs'), module.exports);
24
24
  __reExport(dictionaryManipulator_exports, require('./updateNodeChildren.cjs'), module.exports);
25
25
  __reExport(dictionaryManipulator_exports, require('./getDefaultNode.cjs'), module.exports);
26
+ __reExport(dictionaryManipulator_exports, require('./getEmptyNode.cjs'), module.exports);
26
27
  // Annotate the CommonJS export names for ESM import in node:
27
28
  0 && (module.exports = {
28
29
  ...require('./editDictionaryByKeyPath.cjs'),
@@ -32,6 +33,7 @@ __reExport(dictionaryManipulator_exports, require('./getDefaultNode.cjs'), modul
32
33
  ...require('./renameContentNodeByKeyPath.cjs'),
33
34
  ...require('./getNodeType.cjs'),
34
35
  ...require('./updateNodeChildren.cjs'),
35
- ...require('./getDefaultNode.cjs')
36
+ ...require('./getDefaultNode.cjs'),
37
+ ...require('./getEmptyNode.cjs')
36
38
  });
37
39
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/dictionaryManipulator/index.ts"],"sourcesContent":["export * from './editDictionaryByKeyPath';\nexport * from './getContentNodeByKeyPath';\nexport * from './getNodeChildren';\nexport * from './removeContentNodeByKeyPath';\nexport * from './renameContentNodeByKeyPath';\nexport * from './getNodeType';\nexport * from './updateNodeChildren';\nexport * from './getDefaultNode';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0CAAc,sCAAd;AACA,0CAAc,sCADd;AAEA,0CAAc,8BAFd;AAGA,0CAAc,yCAHd;AAIA,0CAAc,yCAJd;AAKA,0CAAc,0BALd;AAMA,0CAAc,iCANd;AAOA,0CAAc,6BAPd;","names":[]}
1
+ {"version":3,"sources":["../../../src/dictionaryManipulator/index.ts"],"sourcesContent":["export * from './editDictionaryByKeyPath';\nexport * from './getContentNodeByKeyPath';\nexport * from './getNodeChildren';\nexport * from './removeContentNodeByKeyPath';\nexport * from './renameContentNodeByKeyPath';\nexport * from './getNodeType';\nexport * from './updateNodeChildren';\nexport * from './getDefaultNode';\nexport * from './getEmptyNode';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0CAAc,sCAAd;AACA,0CAAc,sCADd;AAEA,0CAAc,8BAFd;AAGA,0CAAc,yCAHd;AAIA,0CAAc,yCAJd;AAKA,0CAAc,0BALd;AAMA,0CAAc,iCANd;AAOA,0CAAc,6BAPd;AAQA,0CAAc,2BARd;","names":[]}
@@ -0,0 +1,44 @@
1
+ import { NodeType } from "../types/index.mjs";
2
+ const getEmptyNode = (section) => {
3
+ if (typeof section === "string") {
4
+ return "";
5
+ }
6
+ if (typeof section === "number") {
7
+ return 0;
8
+ }
9
+ if (typeof section === "boolean") {
10
+ return true;
11
+ }
12
+ if (typeof section?.nodeType === "string") {
13
+ const typedNode = section;
14
+ const content = typedNode[typedNode.nodeType];
15
+ if (typedNode.nodeType === NodeType.Translation || typedNode.nodeType === NodeType.Enumeration || typedNode.nodeType === NodeType.Condition) {
16
+ return getEmptyNode(content);
17
+ }
18
+ if (typedNode.nodeType === NodeType.Nested) {
19
+ return typedNode;
20
+ }
21
+ if (typedNode.nodeType === NodeType.Markdown) {
22
+ return getEmptyNode(typedNode);
23
+ }
24
+ return content;
25
+ }
26
+ if (!section || typeof section !== "object") {
27
+ return section;
28
+ }
29
+ if (Array.isArray(section)) {
30
+ return section.map(
31
+ getEmptyNode
32
+ );
33
+ }
34
+ const mappedSectionObject = Object.entries(section).map(([key, value]) => [
35
+ key,
36
+ getEmptyNode(value)
37
+ ]);
38
+ const mappedSectionArray = Object.fromEntries(mappedSectionObject);
39
+ return mappedSectionArray;
40
+ };
41
+ export {
42
+ getEmptyNode
43
+ };
44
+ //# sourceMappingURL=getEmptyNode.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/dictionaryManipulator/getEmptyNode.ts"],"sourcesContent":["import { type ContentNode, type TypedNode, NodeType } from '../types';\n\nexport const getEmptyNode = (section: ContentNode): ContentNode => {\n if (typeof section === 'string') {\n return '';\n }\n if (typeof section === 'number') {\n return 0;\n }\n if (typeof section === 'boolean') {\n return true;\n }\n if (typeof (section as TypedNode)?.nodeType === 'string') {\n const typedNode = section as TypedNode;\n const content = typedNode[typedNode.nodeType as keyof TypedNode];\n\n if (\n typedNode.nodeType === NodeType.Translation ||\n typedNode.nodeType === NodeType.Enumeration ||\n typedNode.nodeType === NodeType.Condition\n ) {\n return getEmptyNode(content as ContentNode);\n }\n\n if (typedNode.nodeType === NodeType.Nested) {\n return typedNode;\n }\n\n if (typedNode.nodeType === NodeType.Markdown) {\n return getEmptyNode(typedNode);\n }\n\n return content;\n }\n\n if (!section || typeof section !== 'object') {\n return section;\n }\n\n if (Array.isArray(section)) {\n return (section as ContentNode[]).map(\n getEmptyNode\n ) as unknown as ContentNode;\n }\n\n const mappedSectionObject = Object.entries(section).map(([key, value]) => [\n key,\n getEmptyNode(value),\n ]);\n\n const mappedSectionArray = Object.fromEntries(mappedSectionObject);\n\n return mappedSectionArray;\n};\n"],"mappings":"AAAA,SAA2C,gBAAgB;AAEpD,MAAM,eAAe,CAAC,YAAsC;AACjE,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AACA,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AACA,MAAI,OAAO,YAAY,WAAW;AAChC,WAAO;AAAA,EACT;AACA,MAAI,OAAQ,SAAuB,aAAa,UAAU;AACxD,UAAM,YAAY;AAClB,UAAM,UAAU,UAAU,UAAU,QAA2B;AAE/D,QACE,UAAU,aAAa,SAAS,eAChC,UAAU,aAAa,SAAS,eAChC,UAAU,aAAa,SAAS,WAChC;AACA,aAAO,aAAa,OAAsB;AAAA,IAC5C;AAEA,QAAI,UAAU,aAAa,SAAS,QAAQ;AAC1C,aAAO;AAAA,IACT;AAEA,QAAI,UAAU,aAAa,SAAS,UAAU;AAC5C,aAAO,aAAa,SAAS;AAAA,IAC/B;AAEA,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,WAAW,OAAO,YAAY,UAAU;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,WAAQ,QAA0B;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AAEA,QAAM,sBAAsB,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,IACxE;AAAA,IACA,aAAa,KAAK;AAAA,EACpB,CAAC;AAED,QAAM,qBAAqB,OAAO,YAAY,mBAAmB;AAEjE,SAAO;AACT;","names":[]}
@@ -6,4 +6,5 @@ export * from "./renameContentNodeByKeyPath.mjs";
6
6
  export * from "./getNodeType.mjs";
7
7
  export * from "./updateNodeChildren.mjs";
8
8
  export * from "./getDefaultNode.mjs";
9
+ export * from "./getEmptyNode.mjs";
9
10
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/dictionaryManipulator/index.ts"],"sourcesContent":["export * from './editDictionaryByKeyPath';\nexport * from './getContentNodeByKeyPath';\nexport * from './getNodeChildren';\nexport * from './removeContentNodeByKeyPath';\nexport * from './renameContentNodeByKeyPath';\nexport * from './getNodeType';\nexport * from './updateNodeChildren';\nexport * from './getDefaultNode';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/dictionaryManipulator/index.ts"],"sourcesContent":["export * from './editDictionaryByKeyPath';\nexport * from './getContentNodeByKeyPath';\nexport * from './getNodeChildren';\nexport * from './removeContentNodeByKeyPath';\nexport * from './renameContentNodeByKeyPath';\nexport * from './getNodeType';\nexport * from './updateNodeChildren';\nexport * from './getDefaultNode';\nexport * from './getEmptyNode';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,3 @@
1
+ import { type ContentNode } from '../types';
2
+ export declare const getEmptyNode: (section: ContentNode) => ContentNode;
3
+ //# sourceMappingURL=getEmptyNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getEmptyNode.d.ts","sourceRoot":"","sources":["../../../src/dictionaryManipulator/getEmptyNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAA4B,MAAM,UAAU,CAAC;AAEtE,eAAO,MAAM,YAAY,YAAa,WAAW,KAAG,WAmDnD,CAAC"}
@@ -6,4 +6,5 @@ export * from './renameContentNodeByKeyPath';
6
6
  export * from './getNodeType';
7
7
  export * from './updateNodeChildren';
8
8
  export * from './getDefaultNode';
9
+ export * from './getEmptyNode';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dictionaryManipulator/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dictionaryManipulator/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "5.1.3",
3
+ "version": "5.1.5",
4
4
  "private": false,
5
5
  "description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
6
6
  "keywords": [
@@ -60,9 +60,9 @@
60
60
  "dependencies": {
61
61
  "@formatjs/intl-localematcher": "^0.5.10",
62
62
  "negotiator": "^1.0.0",
63
- "@intlayer/dictionaries-entry": "5.1.3",
64
- "@intlayer/api": "5.1.3",
65
- "@intlayer/config": "5.1.3"
63
+ "@intlayer/api": "5.1.5",
64
+ "@intlayer/dictionaries-entry": "5.1.5",
65
+ "@intlayer/config": "5.1.5"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/negotiator": "^0.6.3",
@@ -76,15 +76,15 @@
76
76
  "tsup": "^8.3.5",
77
77
  "typescript": "^5.7.3",
78
78
  "@utils/eslint-config": "1.0.4",
79
- "@utils/ts-config": "1.0.4",
80
79
  "@utils/ts-config-types": "1.0.4",
81
- "@utils/tsup-config": "1.0.4"
80
+ "@utils/tsup-config": "1.0.4",
81
+ "@utils/ts-config": "1.0.4"
82
82
  },
83
83
  "peerDependencies": {
84
- "@intlayer/api": "5.1.3",
85
- "@intlayer/config": "5.1.3",
86
- "@intlayer/dictionaries-entry": "5.1.3",
87
- "intlayer": "5.1.3"
84
+ "@intlayer/api": "5.1.5",
85
+ "@intlayer/config": "5.1.5",
86
+ "@intlayer/dictionaries-entry": "5.1.5",
87
+ "intlayer": "5.1.5"
88
88
  },
89
89
  "engines": {
90
90
  "node": ">=14.18"