@devexpress/analytics-core-cli 23.1.3 → 23.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devexpress/analytics-core-cli",
3
- "version": "23.1.3",
3
+ "version": "23.1.4",
4
4
  "homepage": "https://www.devexpress.com/",
5
5
  "bugs": "https://www.devexpress.com/support/",
6
6
  "author": "Developer Express Inc.",
@@ -16,7 +16,7 @@
16
16
  "inquirer": "^8.0.0"
17
17
  },
18
18
  "peerDependencies": {
19
- "@devexpress/analytics-core": "23.1.3"
19
+ "@devexpress/analytics-core": "23.1.4"
20
20
  },
21
21
  "peerDependenciesMeta": {
22
22
  "@devexpress/analytics-core": {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * DevExpress Analytics CLI (utils\_processBindings.js)
3
- * Version: 23.1.3
4
- * Build date: Jun 7, 2023
3
+ * Version: 23.1.4
4
+ * Build date: Jul 18, 2023
5
5
  * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
6
6
  * License: https://www.devexpress.com/Support/EULAs/universal.xml
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * DevExpress Analytics CLI (utils\processBindings.js)
3
- * Version: 23.1.3
4
- * Build date: Jun 7, 2023
3
+ * Version: 23.1.4
4
+ * Build date: Jul 18, 2023
5
5
  * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
6
6
  * License: https://www.devexpress.com/Support/EULAs/universal.xml
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * DevExpress Analytics CLI (utils\theme-builder.js)
3
- * Version: 23.1.3
4
- * Build date: Jun 7, 2023
3
+ * Version: 23.1.4
4
+ * Build date: Jul 18, 2023
5
5
  * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
6
6
  * License: https://www.devexpress.com/Support/EULAs/universal.xml
7
7
  */
@@ -0,0 +1,85 @@
1
+ /**
2
+ * DevExpress Analytics CLI (utils\typeResolver.js)
3
+ * Version: 23.1.4
4
+ * Build date: Jul 18, 2023
5
+ * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
6
+ * License: https://www.devexpress.com/Support/EULAs/universal.xml
7
+ */
8
+ const ts = require('typescript');
9
+ const fs = require('fs');
10
+
11
+
12
+ function resolveTypingsInFile(filePath) {
13
+ const compilerOptions = {};
14
+ const compilerHost = ts.createCompilerHost(compilerOptions);
15
+ const program = ts.createProgram([filePath], compilerOptions, compilerHost);
16
+
17
+ const sourceFile = program.getSourceFile(filePath);
18
+ const renameAllAddIdentifiersToRenamedAdd = (context) => (rootNode) => {
19
+ const visit = (node) => {
20
+ let newNode = null;
21
+ if(ts.isModuleDeclaration(node)) {
22
+ const imports = {};
23
+ fillImports(node, imports);
24
+ newNode = replaceTypes(node, imports, context);
25
+ } else {
26
+ newNode = ts.visitEachChild(node, visit, context);
27
+ }
28
+ return newNode;
29
+ };
30
+ return ts.visitNode(rootNode, visit);
31
+ };
32
+
33
+ const transformationResult = ts.transform(sourceFile, [
34
+ renameAllAddIdentifiersToRenamedAdd,
35
+ ]);
36
+ const updatedSourceFile = transformationResult.transformed[0];
37
+ const printer = ts.createPrinter();
38
+ const updatedCode = printer.printFile(updatedSourceFile);
39
+
40
+ fs.writeFileSync(filePath, updatedCode, 'utf-8');
41
+ }
42
+
43
+ function fillImports(node, imports) {
44
+ if(ts.isImportEqualsDeclaration(node)) {
45
+ let name = node.name.escapedText;
46
+ name && ts.forEachChild(node, node => {
47
+ if(ts.isQualifiedName(node)) {
48
+ let fullName = getFullTypeName(node);
49
+ imports[name] = fullName;
50
+ }
51
+ });
52
+ } else {
53
+ ts.forEachChild(node, (node) => fillImports(node, imports))
54
+ }
55
+ }
56
+
57
+ function replaceTypes(node, imports, context) {
58
+ if(ts.isTypeReferenceNode(node)) {
59
+ const typeName = node.typeName?.text;
60
+ const updatedTypeName = imports[typeName];
61
+ if(updatedTypeName) {
62
+ return ts.factory.createTypeReferenceNode(updatedTypeName, node.typeArguments);
63
+ }
64
+ } else if(ts.isTypeQueryNode(node)) {
65
+ const typeName = node.exprName?.escapedText;
66
+ const updatedTypeName = imports[typeName];
67
+ if(updatedTypeName) {
68
+ const exprName = ts.factory.createIdentifier(updatedTypeName);
69
+ return ts.factory.createTypeQueryNode(exprName);
70
+ }
71
+ }
72
+ return ts.visitEachChild(node, (node) => replaceTypes(node, imports, context), context);
73
+ }
74
+
75
+ function getFullTypeName(node) {
76
+ if(node.kind === ts.SyntaxKind.Identifier) {
77
+ return node.escapedText
78
+ } else {
79
+ return getFullTypeName(node.left) + '.' + node.right.escapedText;
80
+ }
81
+ }
82
+
83
+ module.exports = {
84
+ resolveTypingsInFile: resolveTypingsInFile
85
+ }