ts2famix 2.1.0-beta.1 → 3.0.0

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 (193) hide show
  1. package/.eslintrc.json +24 -24
  2. package/LICENSE +24 -24
  3. package/README.md +78 -78
  4. package/dist/analyze.js +20 -10
  5. package/dist/analyze_functions/process_functions.js +109 -69
  6. package/dist/famix_functions/EntityDictionary.js +691 -606
  7. package/dist/famix_functions/helpers_creation.js +35 -19
  8. package/dist/fqn.js +351 -18
  9. package/dist/lib/famix/famix_JSON_exporter.js +1 -1
  10. package/dist/lib/famix/famix_base_element.js +1 -1
  11. package/dist/lib/famix/famix_repository.js +31 -12
  12. package/dist/lib/famix/index.js +18 -8
  13. package/dist/lib/famix/model/famix/access.js +1 -1
  14. package/dist/lib/famix/model/famix/accessor.js +1 -1
  15. package/dist/lib/famix/model/famix/alias.js +1 -1
  16. package/dist/lib/famix/model/famix/arrow_function.js +1 -1
  17. package/dist/lib/famix/model/famix/behavioral_entity.js +1 -1
  18. package/dist/lib/famix/model/famix/class.js +1 -1
  19. package/dist/lib/famix/model/famix/comment.js +1 -1
  20. package/dist/lib/famix/model/famix/concretisation.js +1 -1
  21. package/dist/lib/famix/model/famix/container_entity.js +1 -1
  22. package/dist/lib/famix/model/famix/decorator.js +1 -1
  23. package/dist/lib/famix/model/famix/entity.js +1 -1
  24. package/dist/lib/famix/model/famix/enum.js +1 -1
  25. package/dist/lib/famix/model/famix/enum_value.js +1 -1
  26. package/dist/lib/famix/model/famix/function.js +1 -1
  27. package/dist/lib/famix/model/famix/import_clause.js +1 -1
  28. package/dist/lib/famix/model/famix/index.js +1 -1
  29. package/dist/lib/famix/model/famix/indexed_file_anchor.js +1 -1
  30. package/dist/lib/famix/model/famix/inheritance.js +1 -1
  31. package/dist/lib/famix/model/famix/interface.js +1 -1
  32. package/dist/lib/famix/model/famix/invocation.js +1 -1
  33. package/dist/lib/famix/model/famix/method.js +1 -1
  34. package/dist/lib/famix/model/famix/module.js +2 -2
  35. package/dist/lib/famix/model/famix/named_entity.js +1 -1
  36. package/dist/lib/famix/model/famix/parameter.js +1 -1
  37. package/dist/lib/famix/model/famix/parameter_concretisation.js +1 -1
  38. package/dist/lib/famix/model/famix/parameter_type.js +1 -1
  39. package/dist/lib/famix/model/famix/parametric_arrow_function.js +1 -1
  40. package/dist/lib/famix/model/famix/parametric_class.js +1 -1
  41. package/dist/lib/famix/model/famix/parametric_function.js +1 -1
  42. package/dist/lib/famix/model/famix/parametric_interface.js +1 -1
  43. package/dist/lib/famix/model/famix/parametric_method.js +1 -1
  44. package/dist/lib/famix/model/famix/primitive_type.js +1 -1
  45. package/dist/lib/famix/model/famix/property.js +1 -1
  46. package/dist/lib/famix/model/famix/reference.js +1 -1
  47. package/dist/lib/famix/model/famix/scoping_entity.js +1 -1
  48. package/dist/lib/famix/model/famix/script_entity.js +1 -1
  49. package/dist/lib/famix/model/famix/source_anchor.js +1 -1
  50. package/dist/lib/famix/model/famix/source_language.js +1 -1
  51. package/dist/lib/famix/model/famix/sourced_entity.js +1 -1
  52. package/dist/lib/famix/model/famix/structural_entity.js +1 -1
  53. package/dist/lib/famix/model/famix/type.js +1 -1
  54. package/dist/lib/famix/model/famix/variable.js +1 -1
  55. package/dist/lib/ts-complex/cyclomatic-service.js +1 -1
  56. package/dist/refactorer/refactor-getter-setter.js +18 -8
  57. package/dist/ts2famix-cli-wrapper.js +18 -8
  58. package/dist/ts2famix-cli.js +18 -8
  59. package/dist/ts2famix-tsconfig.js +18 -8
  60. package/doc-uml/famix-typescript-model.puml +619 -607
  61. package/doc-uml/famix-typescript-model.svg +1 -1
  62. package/eslint.config.mjs +28 -28
  63. package/jest.config.json +1 -1
  64. package/package.json +70 -70
  65. package/src/analyze.ts +120 -120
  66. package/src/analyze_functions/process_functions.ts +1069 -1040
  67. package/src/famix_functions/EntityDictionary.ts +2061 -2016
  68. package/src/famix_functions/helpers_creation.ts +143 -135
  69. package/src/fqn.ts +416 -50
  70. package/src/generate_uml.sh +20 -20
  71. package/src/lib/famix/License.md +22 -22
  72. package/src/lib/famix/famix_JSON_exporter.ts +56 -56
  73. package/src/lib/famix/famix_base_element.ts +22 -22
  74. package/src/lib/famix/famix_repository.ts +288 -278
  75. package/src/lib/famix/index.ts +8 -8
  76. package/src/lib/famix/model/famix/access.ts +50 -50
  77. package/src/lib/famix/model/famix/accessor.ts +15 -15
  78. package/src/lib/famix/model/famix/alias.ts +39 -39
  79. package/src/lib/famix/model/famix/arrow_function.ts +15 -15
  80. package/src/lib/famix/model/famix/behavioral_entity.ts +97 -97
  81. package/src/lib/famix/model/famix/class.ts +85 -85
  82. package/src/lib/famix/model/famix/comment.ts +47 -47
  83. package/src/lib/famix/model/famix/concretisation.ts +40 -40
  84. package/src/lib/famix/model/famix/container_entity.ts +160 -160
  85. package/src/lib/famix/model/famix/decorator.ts +37 -37
  86. package/src/lib/famix/model/famix/entity.ts +15 -15
  87. package/src/lib/famix/model/famix/enum.ts +30 -30
  88. package/src/lib/famix/model/famix/enum_value.ts +28 -28
  89. package/src/lib/famix/model/famix/function.ts +15 -15
  90. package/src/lib/famix/model/famix/import_clause.ts +51 -51
  91. package/src/lib/famix/model/famix/index.ts +41 -41
  92. package/src/lib/famix/model/famix/indexed_file_anchor.ts +46 -46
  93. package/src/lib/famix/model/famix/inheritance.ts +40 -40
  94. package/src/lib/famix/model/famix/interface.ts +75 -75
  95. package/src/lib/famix/model/famix/invocation.ts +65 -65
  96. package/src/lib/famix/model/famix/method.ts +89 -89
  97. package/src/lib/famix/model/famix/module.ts +71 -71
  98. package/src/lib/famix/model/famix/named_entity.ts +95 -95
  99. package/src/lib/famix/model/famix/parameter.ts +28 -28
  100. package/src/lib/famix/model/famix/parameter_concretisation.ts +51 -51
  101. package/src/lib/famix/model/famix/parameter_type.ts +58 -58
  102. package/src/lib/famix/model/famix/parametric_arrow_function.ts +32 -32
  103. package/src/lib/famix/model/famix/parametric_class.ts +49 -49
  104. package/src/lib/famix/model/famix/parametric_function.ts +32 -32
  105. package/src/lib/famix/model/famix/parametric_interface.ts +49 -49
  106. package/src/lib/famix/model/famix/parametric_method.ts +32 -32
  107. package/src/lib/famix/model/famix/primitive_type.ts +15 -15
  108. package/src/lib/famix/model/famix/property.ts +94 -94
  109. package/src/lib/famix/model/famix/reference.ts +40 -40
  110. package/src/lib/famix/model/famix/scoping_entity.ts +35 -35
  111. package/src/lib/famix/model/famix/script_entity.ts +34 -34
  112. package/src/lib/famix/model/famix/source_anchor.ts +30 -30
  113. package/src/lib/famix/model/famix/source_language.ts +35 -35
  114. package/src/lib/famix/model/famix/sourced_entity.ts +70 -70
  115. package/src/lib/famix/model/famix/structural_entity.ts +43 -43
  116. package/src/lib/famix/model/famix/type.ts +87 -87
  117. package/src/lib/famix/model/famix/variable.ts +27 -27
  118. package/src/lib/famix/package.json +28 -28
  119. package/src/lib/ts-complex/cyclomatic-service.ts +83 -83
  120. package/src/refactorer/refactor-getter-setter.ts +140 -140
  121. package/src/ts2famix-cli-wrapper.ts +21 -21
  122. package/src/ts2famix-cli.ts +60 -60
  123. package/tsconfig.check-tests.json +14 -14
  124. package/tsconfig.json +73 -72
  125. package/.vscode/settings.json +0 -4
  126. package/TODO +0 -1
  127. package/arwea-fix.json +0 -1
  128. package/bogus.ts +0 -3
  129. package/class-diagram.puml +0 -792
  130. package/debug.txt +0 -13332
  131. package/debuglog.txt +0 -12073
  132. package/dist/famix2puml.js +0 -126
  133. package/dist/getClasses-arrow-body.js +0 -43
  134. package/dist/lib/famix/src/famix_JSON_exporter.js +0 -55
  135. package/dist/lib/famix/src/famix_base_element.js +0 -18
  136. package/dist/lib/famix/src/famix_repository.js +0 -224
  137. package/dist/lib/famix/src/index.js +0 -31
  138. package/dist/lib/famix/src/model/famix/access.js +0 -40
  139. package/dist/lib/famix/src/model/famix/accessor.js +0 -17
  140. package/dist/lib/famix/src/model/famix/alias.js +0 -33
  141. package/dist/lib/famix/src/model/famix/arrowFunction.js +0 -17
  142. package/dist/lib/famix/src/model/famix/arrow_function.js +0 -17
  143. package/dist/lib/famix/src/model/famix/behavioral_entity.js +0 -79
  144. package/dist/lib/famix/src/model/famix/class.js +0 -71
  145. package/dist/lib/famix/src/model/famix/comment.js +0 -39
  146. package/dist/lib/famix/src/model/famix/concretisation.js +0 -31
  147. package/dist/lib/famix/src/model/famix/container_entity.js +0 -126
  148. package/dist/lib/famix/src/model/famix/decorator.js +0 -32
  149. package/dist/lib/famix/src/model/famix/entity.js +0 -17
  150. package/dist/lib/famix/src/model/famix/enum.js +0 -31
  151. package/dist/lib/famix/src/model/famix/enum_value.js +0 -25
  152. package/dist/lib/famix/src/model/famix/function.js +0 -17
  153. package/dist/lib/famix/src/model/famix/implicit_variable.js +0 -17
  154. package/dist/lib/famix/src/model/famix/import_clause.js +0 -41
  155. package/dist/lib/famix/src/model/famix/index.js +0 -86
  156. package/dist/lib/famix/src/model/famix/indexed_file_anchor.js +0 -38
  157. package/dist/lib/famix/src/model/famix/inheritance.js +0 -33
  158. package/dist/lib/famix/src/model/famix/interface.js +0 -64
  159. package/dist/lib/famix/src/model/famix/invocation.js +0 -54
  160. package/dist/lib/famix/src/model/famix/method.js +0 -67
  161. package/dist/lib/famix/src/model/famix/module.js +0 -60
  162. package/dist/lib/famix/src/model/famix/named_entity.js +0 -78
  163. package/dist/lib/famix/src/model/famix/parameter.js +0 -25
  164. package/dist/lib/famix/src/model/famix/parameterConcretisation.js +0 -44
  165. package/dist/lib/famix/src/model/famix/parameter_concretisation.js +0 -44
  166. package/dist/lib/famix/src/model/famix/parameter_type.js +0 -45
  167. package/dist/lib/famix/src/model/famix/parametricArrowFunction.js +0 -29
  168. package/dist/lib/famix/src/model/famix/parametric_arrow_function.js +0 -31
  169. package/dist/lib/famix/src/model/famix/parametric_class.js +0 -44
  170. package/dist/lib/famix/src/model/famix/parametric_function.js +0 -31
  171. package/dist/lib/famix/src/model/famix/parametric_interface.js +0 -44
  172. package/dist/lib/famix/src/model/famix/parametric_method.js +0 -31
  173. package/dist/lib/famix/src/model/famix/primitive_type.js +0 -17
  174. package/dist/lib/famix/src/model/famix/property.js +0 -73
  175. package/dist/lib/famix/src/model/famix/reference.js +0 -33
  176. package/dist/lib/famix/src/model/famix/scoping_entity.js +0 -36
  177. package/dist/lib/famix/src/model/famix/script_entity.js +0 -29
  178. package/dist/lib/famix/src/model/famix/source_anchor.js +0 -27
  179. package/dist/lib/famix/src/model/famix/source_language.js +0 -35
  180. package/dist/lib/famix/src/model/famix/sourced_entity.js +0 -60
  181. package/dist/lib/famix/src/model/famix/structural_entity.js +0 -39
  182. package/dist/lib/famix/src/model/famix/text_anchor.js +0 -38
  183. package/dist/lib/famix/src/model/famix/type.js +0 -73
  184. package/dist/lib/famix/src/model/famix/variable.js +0 -24
  185. package/fqn-model.json +0 -1
  186. package/iterateGenericTypes.ts +0 -69
  187. package/out/class-diagram/class-diagram.svg +0 -1
  188. package/sample.json +0 -1
  189. package/sample.ts +0 -1
  190. package/stats.txt +0 -3091
  191. package/tabby-debug-output.txt +0 -19433
  192. package/ts2famix.log +0 -22656
  193. package/validate-references.js +0 -103
@@ -1,56 +1,56 @@
1
- import { FamixBaseElement } from "./famix_base_element";
2
-
3
- /**
4
- * This class is used to export Famix elements to JSON
5
- */
6
- export class FamixJSONExporter {
7
-
8
- private element: FamixBaseElement; // A Famix element to export
9
- private bufferArray: any = {}; // A buffer to store the properties of the Famix element
10
- private FamixPrefix = "FamixTypeScript"; // Prefix of the Famix element
11
-
12
- /**
13
- * Constructor of the FamixJSONExporter class
14
- * @param packageClass Name of a Famix class
15
- * @param element A Famix element to export, this element is an instance of the class named "packageClass"
16
- */
17
- constructor(packageClass: string, element: FamixBaseElement) {
18
- this.element = element;
19
- this.bufferArray["FM3"] = this.FamixPrefix + "." + packageClass;
20
- this.bufferArray["id"] = this.element.id;
21
- }
22
-
23
- /**
24
- * Adds a property to the Famix element
25
- * @param name Name of the property
26
- * @param prop A property
27
- */
28
- public addProperty(name: string, prop: unknown): void {
29
- if (prop instanceof Set) {
30
- const valueArray: Array<unknown> = [];
31
- for (const value of Array.from(prop.values())) {
32
- if (value instanceof FamixBaseElement) {
33
- valueArray.push({ "ref": value.id });
34
- }
35
- else {
36
- valueArray.push(value);
37
- }
38
- }
39
- this.bufferArray[name] = valueArray;
40
- }
41
- else if (prop instanceof FamixBaseElement) {
42
- this.bufferArray[name] = { "ref": prop.id };
43
- }
44
- else if (prop !== undefined && !(prop instanceof Set)) {
45
- this.bufferArray[name] = prop;
46
- }
47
- }
48
-
49
- /**
50
- * Gets a JSON representation of the Famix element
51
- * @returns A JSON representation of the Famix element
52
- */
53
- public getJSON(): string {
54
- return JSON.stringify(this.bufferArray);
55
- }
56
- }
1
+ import { FamixBaseElement } from "./famix_base_element";
2
+
3
+ /**
4
+ * This class is used to export Famix elements to JSON
5
+ */
6
+ export class FamixJSONExporter {
7
+
8
+ private element: FamixBaseElement; // A Famix element to export
9
+ private bufferArray: any = {}; // A buffer to store the properties of the Famix element
10
+ private FamixPrefix = "FamixTypeScript"; // Prefix of the Famix element
11
+
12
+ /**
13
+ * Constructor of the FamixJSONExporter class
14
+ * @param packageClass Name of a Famix class
15
+ * @param element A Famix element to export, this element is an instance of the class named "packageClass"
16
+ */
17
+ constructor(packageClass: string, element: FamixBaseElement) {
18
+ this.element = element;
19
+ this.bufferArray["FM3"] = this.FamixPrefix + "." + packageClass;
20
+ this.bufferArray["id"] = this.element.id;
21
+ }
22
+
23
+ /**
24
+ * Adds a property to the Famix element
25
+ * @param name Name of the property
26
+ * @param prop A property
27
+ */
28
+ public addProperty(name: string, prop: unknown): void {
29
+ if (prop instanceof Set) {
30
+ const valueArray: Array<unknown> = [];
31
+ for (const value of Array.from(prop.values())) {
32
+ if (value instanceof FamixBaseElement) {
33
+ valueArray.push({ "ref": value.id });
34
+ }
35
+ else {
36
+ valueArray.push(value);
37
+ }
38
+ }
39
+ this.bufferArray[name] = valueArray;
40
+ }
41
+ else if (prop instanceof FamixBaseElement) {
42
+ this.bufferArray[name] = { "ref": prop.id };
43
+ }
44
+ else if (prop !== undefined && !(prop instanceof Set)) {
45
+ this.bufferArray[name] = prop;
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Gets a JSON representation of the Famix element
51
+ * @returns A JSON representation of the Famix element
52
+ */
53
+ public getJSON(): string {
54
+ return JSON.stringify(this.bufferArray);
55
+ }
56
+ }
@@ -1,22 +1,22 @@
1
- import { logger } from "../../analyze";
2
- import { FamixJSONExporter } from "./famix_JSON_exporter";
3
- // import { FamixRepository } from "./famix_repository";
4
-
5
- export abstract class FamixBaseElement {
6
-
7
- public id!: number;
8
-
9
- // constructor(repo: FamixRepository) {
10
- // repo.addElement(this);
11
- // }
12
-
13
- constructor() {
14
- }
15
-
16
- public abstract getJSON(): string;
17
-
18
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
19
- public addPropertiesToExporter(exporter: FamixJSONExporter): void {
20
- logger.debug("addPropertiesToExporter not implemented for " + this.constructor.name + `(${exporter})`);
21
- }
22
- }
1
+ import { logger } from "../../analyze";
2
+ import { FamixJSONExporter } from "./famix_JSON_exporter";
3
+ // import { FamixRepository } from "./famix_repository";
4
+
5
+ export abstract class FamixBaseElement {
6
+
7
+ public id!: number;
8
+
9
+ // constructor(repo: FamixRepository) {
10
+ // repo.addElement(this);
11
+ // }
12
+
13
+ constructor() {
14
+ }
15
+
16
+ public abstract getJSON(): string;
17
+
18
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
19
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
20
+ logger.debug("addPropertiesToExporter not implemented for " + this.constructor.name + `(${exporter})`);
21
+ }
22
+ }