ts2famix 1.4.1 → 2.0.1

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 (210) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +30 -61
  3. package/dist/analyze.js +4 -2
  4. package/dist/analyze_functions/process_functions.js +285 -131
  5. package/dist/famix_functions/EntityDictionary.js +864 -231
  6. package/dist/famix_functions/helpers_creation.js +61 -10
  7. package/dist/fqn.js +160 -111
  8. package/dist/lib/famix/famix_JSON_exporter.js +55 -0
  9. package/dist/lib/famix/famix_base_element.js +18 -0
  10. package/dist/lib/famix/famix_repository.js +224 -0
  11. package/dist/lib/famix/{src/index.js → index.js} +1 -0
  12. package/dist/lib/famix/model/famix/access.js +40 -0
  13. package/dist/lib/famix/model/famix/accessor.js +17 -0
  14. package/dist/lib/famix/model/famix/alias.js +33 -0
  15. package/dist/lib/famix/model/famix/arrow_function.js +17 -0
  16. package/dist/lib/famix/model/famix/behavioral_entity.js +79 -0
  17. package/dist/lib/famix/model/famix/class.js +71 -0
  18. package/dist/lib/famix/model/famix/comment.js +39 -0
  19. package/dist/lib/famix/model/famix/concretisation.js +31 -0
  20. package/dist/lib/famix/model/famix/container_entity.js +126 -0
  21. package/dist/lib/famix/model/famix/decorator.js +32 -0
  22. package/dist/lib/famix/model/famix/entity.js +17 -0
  23. package/dist/lib/famix/model/famix/enum.js +31 -0
  24. package/dist/lib/famix/model/famix/enum_value.js +25 -0
  25. package/dist/lib/famix/model/famix/function.js +17 -0
  26. package/dist/lib/famix/model/famix/import_clause.js +41 -0
  27. package/dist/lib/famix/model/famix/index.js +86 -0
  28. package/dist/lib/famix/model/famix/indexed_file_anchor.js +38 -0
  29. package/dist/lib/famix/model/famix/inheritance.js +33 -0
  30. package/dist/lib/famix/model/famix/interface.js +64 -0
  31. package/dist/lib/famix/model/famix/invocation.js +54 -0
  32. package/dist/lib/famix/model/famix/method.js +67 -0
  33. package/dist/lib/famix/model/famix/module.js +60 -0
  34. package/dist/lib/famix/model/famix/named_entity.js +78 -0
  35. package/dist/lib/famix/model/famix/parameter.js +25 -0
  36. package/dist/lib/famix/model/famix/parameter_concretisation.js +44 -0
  37. package/dist/lib/famix/model/famix/parameter_type.js +45 -0
  38. package/dist/lib/famix/model/famix/parametric_arrow_function.js +31 -0
  39. package/dist/lib/famix/model/famix/parametric_class.js +44 -0
  40. package/dist/lib/famix/model/famix/parametric_function.js +31 -0
  41. package/dist/lib/famix/model/famix/parametric_interface.js +44 -0
  42. package/dist/lib/famix/model/famix/parametric_method.js +31 -0
  43. package/dist/lib/famix/model/famix/primitive_type.js +17 -0
  44. package/dist/lib/famix/model/famix/property.js +73 -0
  45. package/dist/lib/famix/model/famix/reference.js +33 -0
  46. package/dist/lib/famix/model/famix/scoping_entity.js +36 -0
  47. package/dist/lib/famix/model/famix/script_entity.js +29 -0
  48. package/dist/lib/famix/model/famix/source_anchor.js +27 -0
  49. package/dist/lib/famix/model/famix/source_language.js +35 -0
  50. package/dist/lib/famix/model/famix/sourced_entity.js +60 -0
  51. package/dist/lib/famix/model/famix/structural_entity.js +39 -0
  52. package/dist/lib/famix/model/famix/type.js +73 -0
  53. package/dist/lib/famix/model/famix/variable.js +24 -0
  54. package/dist/lib/ts-complex/cyclomatic-service.js +3 -3
  55. package/dist/refactorer/refactor-getter-setter.js +142 -0
  56. package/dist/ts2famix-cli-wrapper.js +42 -0
  57. package/dist/ts2famix-cli.js +8 -1
  58. package/dist/ts2famix-tsconfig.js +1 -0
  59. package/doc-uml/famix-typescript-model.puml +608 -0
  60. package/doc-uml/famix-typescript-model.svg +1 -0
  61. package/jest.config.json +2 -1
  62. package/package.json +13 -12
  63. package/src/analyze.ts +24 -23
  64. package/src/analyze_functions/process_functions.ts +310 -129
  65. package/src/famix_functions/EntityDictionary.ts +949 -271
  66. package/src/famix_functions/helpers_creation.ts +64 -6
  67. package/src/fqn.ts +169 -96
  68. package/{dist/lib/famix/src/famix_JSON_exporter.js → src/lib/famix/famix_JSON_exporter.ts} +16 -14
  69. package/src/lib/famix/famix_base_element.ts +22 -0
  70. package/{dist/lib/famix/src/famix_repository.js → src/lib/famix/famix_repository.ts} +96 -75
  71. package/src/lib/famix/model/famix/access.ts +50 -0
  72. package/src/lib/famix/model/famix/alias.ts +39 -0
  73. package/src/lib/famix/{src/model/famix/implicit_variable.ts → model/famix/arrow_function.ts} +3 -3
  74. package/src/lib/famix/model/famix/behavioral_entity.ts +97 -0
  75. package/src/lib/famix/model/famix/class.ts +85 -0
  76. package/src/lib/famix/model/famix/comment.ts +47 -0
  77. package/src/lib/famix/model/famix/concretisation.ts +40 -0
  78. package/src/lib/famix/model/famix/container_entity.ts +160 -0
  79. package/src/lib/famix/model/famix/decorator.ts +37 -0
  80. package/src/lib/famix/model/famix/enum.ts +30 -0
  81. package/src/lib/famix/model/famix/enum_value.ts +28 -0
  82. package/src/lib/famix/model/famix/import_clause.ts +51 -0
  83. package/src/lib/famix/{src/model → model}/famix/index.ts +8 -7
  84. package/src/lib/famix/model/famix/indexed_file_anchor.ts +46 -0
  85. package/src/lib/famix/model/famix/inheritance.ts +40 -0
  86. package/src/lib/famix/model/famix/interface.ts +75 -0
  87. package/src/lib/famix/model/famix/invocation.ts +65 -0
  88. package/src/lib/famix/model/famix/method.ts +89 -0
  89. package/src/lib/famix/model/famix/module.ts +71 -0
  90. package/src/lib/famix/model/famix/named_entity.ts +95 -0
  91. package/src/lib/famix/{src/model → model}/famix/parameter.ts +11 -12
  92. package/src/lib/famix/model/famix/parameter_concretisation.ts +51 -0
  93. package/src/lib/famix/model/famix/parameter_type.ts +58 -0
  94. package/src/lib/famix/model/famix/parametric_arrow_function.ts +32 -0
  95. package/src/lib/famix/model/famix/parametric_class.ts +49 -0
  96. package/src/lib/famix/model/famix/parametric_function.ts +32 -0
  97. package/src/lib/famix/model/famix/parametric_interface.ts +49 -0
  98. package/src/lib/famix/model/famix/parametric_method.ts +32 -0
  99. package/src/lib/famix/model/famix/primitive_type.ts +15 -0
  100. package/src/lib/famix/model/famix/property.ts +94 -0
  101. package/src/lib/famix/model/famix/reference.ts +40 -0
  102. package/src/lib/famix/model/famix/scoping_entity.ts +35 -0
  103. package/src/lib/famix/model/famix/script_entity.ts +34 -0
  104. package/src/lib/famix/model/famix/source_anchor.ts +30 -0
  105. package/src/lib/famix/model/famix/source_language.ts +35 -0
  106. package/src/lib/famix/model/famix/sourced_entity.ts +70 -0
  107. package/src/lib/famix/model/famix/structural_entity.ts +43 -0
  108. package/src/lib/famix/model/famix/type.ts +87 -0
  109. package/src/lib/famix/model/famix/variable.ts +27 -0
  110. package/src/lib/famix/package.json +1 -1
  111. package/src/lib/ts-complex/cyclomatic-service.ts +10 -10
  112. package/src/refactorer/refactor-getter-setter.ts +140 -0
  113. package/src/ts2famix-cli-wrapper.ts +21 -0
  114. package/src/ts2famix-cli.ts +8 -2
  115. package/tsconfig.check-tests.json +14 -0
  116. package/tsconfig.json +71 -69
  117. package/dist/famix2puml.js +0 -125
  118. package/dist/lib/famix/src/famix_base_element.js +0 -17
  119. package/dist/lib/famix/src/model/famix/access.js +0 -39
  120. package/dist/lib/famix/src/model/famix/accessor.js +0 -16
  121. package/dist/lib/famix/src/model/famix/alias.js +0 -32
  122. package/dist/lib/famix/src/model/famix/association.js +0 -36
  123. package/dist/lib/famix/src/model/famix/behavioral_entity.js +0 -81
  124. package/dist/lib/famix/src/model/famix/class.js +0 -70
  125. package/dist/lib/famix/src/model/famix/comment.js +0 -38
  126. package/dist/lib/famix/src/model/famix/container_entity.js +0 -125
  127. package/dist/lib/famix/src/model/famix/decorator.js +0 -31
  128. package/dist/lib/famix/src/model/famix/entity.js +0 -16
  129. package/dist/lib/famix/src/model/famix/enum.js +0 -30
  130. package/dist/lib/famix/src/model/famix/enum_value.js +0 -24
  131. package/dist/lib/famix/src/model/famix/function.js +0 -16
  132. package/dist/lib/famix/src/model/famix/implicit_variable.js +0 -16
  133. package/dist/lib/famix/src/model/famix/import_clause.js +0 -39
  134. package/dist/lib/famix/src/model/famix/index.js +0 -83
  135. package/dist/lib/famix/src/model/famix/indexed_file_anchor.js +0 -51
  136. package/dist/lib/famix/src/model/famix/inheritance.js +0 -32
  137. package/dist/lib/famix/src/model/famix/interface.js +0 -63
  138. package/dist/lib/famix/src/model/famix/invocation.js +0 -53
  139. package/dist/lib/famix/src/model/famix/method.js +0 -66
  140. package/dist/lib/famix/src/model/famix/module.js +0 -31
  141. package/dist/lib/famix/src/model/famix/named_entity.js +0 -77
  142. package/dist/lib/famix/src/model/famix/namespace.js +0 -24
  143. package/dist/lib/famix/src/model/famix/parameter.js +0 -24
  144. package/dist/lib/famix/src/model/famix/parameter_type.js +0 -24
  145. package/dist/lib/famix/src/model/famix/parameterizable_class.js +0 -30
  146. package/dist/lib/famix/src/model/famix/parameterizable_interface.js +0 -30
  147. package/dist/lib/famix/src/model/famix/parameterized_type.js +0 -36
  148. package/dist/lib/famix/src/model/famix/primitive_type.js +0 -16
  149. package/dist/lib/famix/src/model/famix/property.js +0 -44
  150. package/dist/lib/famix/src/model/famix/reference.js +0 -32
  151. package/dist/lib/famix/src/model/famix/scoping_entity.js +0 -35
  152. package/dist/lib/famix/src/model/famix/script_entity.js +0 -30
  153. package/dist/lib/famix/src/model/famix/source_anchor.js +0 -26
  154. package/dist/lib/famix/src/model/famix/source_language.js +0 -35
  155. package/dist/lib/famix/src/model/famix/sourced_entity.js +0 -59
  156. package/dist/lib/famix/src/model/famix/structural_entity.js +0 -38
  157. package/dist/lib/famix/src/model/famix/text_anchor.js +0 -37
  158. package/dist/lib/famix/src/model/famix/type.js +0 -71
  159. package/dist/lib/famix/src/model/famix/variable.js +0 -23
  160. package/doc-uml/metamodel-full.svg +0 -1
  161. package/doc-uml/metamodel.svg +0 -1
  162. package/jest.config-old.ts +0 -199
  163. package/plantuml.jar +0 -0
  164. package/src/famix2puml.ts +0 -119
  165. package/src/lib/famix/package-lock.json +0 -301
  166. package/src/lib/famix/readme.md +0 -5
  167. package/src/lib/famix/src/famix_JSON_exporter.ts +0 -56
  168. package/src/lib/famix/src/famix_base_element.ts +0 -22
  169. package/src/lib/famix/src/famix_repository.ts +0 -243
  170. package/src/lib/famix/src/model/famix/access.ts +0 -53
  171. package/src/lib/famix/src/model/famix/alias.ts +0 -41
  172. package/src/lib/famix/src/model/famix/association.ts +0 -44
  173. package/src/lib/famix/src/model/famix/behavioral_entity.ts +0 -107
  174. package/src/lib/famix/src/model/famix/class.ts +0 -86
  175. package/src/lib/famix/src/model/famix/comment.ts +0 -50
  176. package/src/lib/famix/src/model/famix/container_entity.ts +0 -165
  177. package/src/lib/famix/src/model/famix/decorator.ts +0 -39
  178. package/src/lib/famix/src/model/famix/enum.ts +0 -31
  179. package/src/lib/famix/src/model/famix/enum_value.ts +0 -29
  180. package/src/lib/famix/src/model/famix/import_clause.ts +0 -53
  181. package/src/lib/famix/src/model/famix/indexed_file_anchor.ts +0 -71
  182. package/src/lib/famix/src/model/famix/inheritance.ts +0 -42
  183. package/src/lib/famix/src/model/famix/interface.ts +0 -75
  184. package/src/lib/famix/src/model/famix/invocation.ts +0 -68
  185. package/src/lib/famix/src/model/famix/method.ts +0 -96
  186. package/src/lib/famix/src/model/famix/module.ts +0 -31
  187. package/src/lib/famix/src/model/famix/named_entity.ts +0 -98
  188. package/src/lib/famix/src/model/famix/namespace.ts +0 -28
  189. package/src/lib/famix/src/model/famix/parameter_type.ts +0 -33
  190. package/src/lib/famix/src/model/famix/parameterizable_class.ts +0 -31
  191. package/src/lib/famix/src/model/famix/parameterizable_interface.ts +0 -31
  192. package/src/lib/famix/src/model/famix/parameterized_type.ts +0 -40
  193. package/src/lib/famix/src/model/famix/primitive_type.ts +0 -15
  194. package/src/lib/famix/src/model/famix/property.ts +0 -54
  195. package/src/lib/famix/src/model/famix/reference.ts +0 -42
  196. package/src/lib/famix/src/model/famix/scoping_entity.ts +0 -35
  197. package/src/lib/famix/src/model/famix/script_entity.ts +0 -38
  198. package/src/lib/famix/src/model/famix/source_anchor.ts +0 -31
  199. package/src/lib/famix/src/model/famix/source_language.ts +0 -37
  200. package/src/lib/famix/src/model/famix/sourced_entity.ts +0 -73
  201. package/src/lib/famix/src/model/famix/structural_entity.ts +0 -44
  202. package/src/lib/famix/src/model/famix/text_anchor.ts +0 -49
  203. package/src/lib/famix/src/model/famix/type.ts +0 -88
  204. package/src/lib/famix/src/model/famix/variable.ts +0 -28
  205. package/src/lib/famix/tsconfig.json +0 -27
  206. package/src/lib/famix/tslint.json +0 -15
  207. /package/src/lib/famix/{src/index.ts → index.ts} +0 -0
  208. /package/src/lib/famix/{src/model → model}/famix/accessor.ts +0 -0
  209. /package/src/lib/famix/{src/model → model}/famix/entity.ts +0 -0
  210. /package/src/lib/famix/{src/model → model}/famix/function.ts +0 -0
@@ -1,301 +0,0 @@
1
- {
2
- "name": "famix",
3
- "version": "1.0.0",
4
- "lockfileVersion": 1,
5
- "requires": true,
6
- "dependencies": {
7
- "@babel/code-frame": {
8
- "version": "7.5.5",
9
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
10
- "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
11
- "dev": true,
12
- "requires": {
13
- "@babel/highlight": "^7.0.0"
14
- }
15
- },
16
- "@babel/highlight": {
17
- "version": "7.5.0",
18
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz",
19
- "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==",
20
- "dev": true,
21
- "requires": {
22
- "chalk": "^2.0.0",
23
- "esutils": "^2.0.2",
24
- "js-tokens": "^4.0.0"
25
- }
26
- },
27
- "ansi-styles": {
28
- "version": "3.2.1",
29
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
30
- "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
31
- "dev": true,
32
- "requires": {
33
- "color-convert": "^1.9.0"
34
- }
35
- },
36
- "argparse": {
37
- "version": "1.0.10",
38
- "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
39
- "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
40
- "dev": true,
41
- "requires": {
42
- "sprintf-js": "~1.0.2"
43
- }
44
- },
45
- "balanced-match": {
46
- "version": "1.0.0",
47
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
48
- "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
49
- "dev": true
50
- },
51
- "brace-expansion": {
52
- "version": "1.1.11",
53
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
54
- "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
55
- "dev": true,
56
- "requires": {
57
- "balanced-match": "^1.0.0",
58
- "concat-map": "0.0.1"
59
- }
60
- },
61
- "builtin-modules": {
62
- "version": "1.1.1",
63
- "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
64
- "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
65
- "dev": true
66
- },
67
- "chalk": {
68
- "version": "2.4.2",
69
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
70
- "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
71
- "dev": true,
72
- "requires": {
73
- "ansi-styles": "^3.2.1",
74
- "escape-string-regexp": "^1.0.5",
75
- "supports-color": "^5.3.0"
76
- }
77
- },
78
- "color-convert": {
79
- "version": "1.9.3",
80
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
81
- "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
82
- "dev": true,
83
- "requires": {
84
- "color-name": "1.1.3"
85
- }
86
- },
87
- "color-name": {
88
- "version": "1.1.3",
89
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
90
- "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
91
- "dev": true
92
- },
93
- "commander": {
94
- "version": "2.20.1",
95
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.1.tgz",
96
- "integrity": "sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg==",
97
- "dev": true
98
- },
99
- "concat-map": {
100
- "version": "0.0.1",
101
- "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
102
- "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
103
- "dev": true
104
- },
105
- "diff": {
106
- "version": "4.0.1",
107
- "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz",
108
- "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==",
109
- "dev": true
110
- },
111
- "escape-string-regexp": {
112
- "version": "1.0.5",
113
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
114
- "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
115
- "dev": true
116
- },
117
- "esprima": {
118
- "version": "4.0.1",
119
- "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
120
- "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
121
- "dev": true
122
- },
123
- "esutils": {
124
- "version": "2.0.3",
125
- "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
126
- "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
127
- "dev": true
128
- },
129
- "fs.realpath": {
130
- "version": "1.0.0",
131
- "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
132
- "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
133
- "dev": true
134
- },
135
- "glob": {
136
- "version": "7.1.4",
137
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
138
- "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
139
- "dev": true,
140
- "requires": {
141
- "fs.realpath": "^1.0.0",
142
- "inflight": "^1.0.4",
143
- "inherits": "2",
144
- "minimatch": "^3.0.4",
145
- "once": "^1.3.0",
146
- "path-is-absolute": "^1.0.0"
147
- }
148
- },
149
- "has-flag": {
150
- "version": "3.0.0",
151
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
152
- "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
153
- "dev": true
154
- },
155
- "inflight": {
156
- "version": "1.0.6",
157
- "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
158
- "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
159
- "dev": true,
160
- "requires": {
161
- "once": "^1.3.0",
162
- "wrappy": "1"
163
- }
164
- },
165
- "inherits": {
166
- "version": "2.0.4",
167
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
168
- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
169
- "dev": true
170
- },
171
- "js-tokens": {
172
- "version": "4.0.0",
173
- "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
174
- "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
175
- "dev": true
176
- },
177
- "js-yaml": {
178
- "version": "3.13.1",
179
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
180
- "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
181
- "dev": true,
182
- "requires": {
183
- "argparse": "^1.0.7",
184
- "esprima": "^4.0.0"
185
- }
186
- },
187
- "minimatch": {
188
- "version": "3.0.4",
189
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
190
- "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
191
- "dev": true,
192
- "requires": {
193
- "brace-expansion": "^1.1.7"
194
- }
195
- },
196
- "minimist": {
197
- "version": "0.0.8",
198
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
199
- "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
200
- "dev": true
201
- },
202
- "once": {
203
- "version": "1.4.0",
204
- "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
205
- "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
206
- "dev": true,
207
- "requires": {
208
- "wrappy": "1"
209
- }
210
- },
211
- "path-is-absolute": {
212
- "version": "1.0.1",
213
- "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
214
- "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
215
- "dev": true
216
- },
217
- "path-parse": {
218
- "version": "1.0.6",
219
- "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
220
- "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
221
- "dev": true
222
- },
223
- "resolve": {
224
- "version": "1.12.0",
225
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
226
- "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
227
- "dev": true,
228
- "requires": {
229
- "path-parse": "^1.0.6"
230
- }
231
- },
232
- "semver": {
233
- "version": "5.7.1",
234
- "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
235
- "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
236
- "dev": true
237
- },
238
- "sprintf-js": {
239
- "version": "1.0.3",
240
- "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
241
- "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
242
- "dev": true
243
- },
244
- "supports-color": {
245
- "version": "5.5.0",
246
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
247
- "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
248
- "dev": true,
249
- "requires": {
250
- "has-flag": "^3.0.0"
251
- }
252
- },
253
- "tslib": {
254
- "version": "1.10.0",
255
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
256
- "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
257
- "dev": true
258
- },
259
- "tslint": {
260
- "version": "5.20.0",
261
- "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.0.tgz",
262
- "integrity": "sha512-2vqIvkMHbnx8acMogAERQ/IuINOq6DFqgF8/VDvhEkBqQh/x6SP0Y+OHnKth9/ZcHQSroOZwUQSN18v8KKF0/g==",
263
- "dev": true,
264
- "requires": {
265
- "@babel/code-frame": "^7.0.0",
266
- "builtin-modules": "^1.1.1",
267
- "chalk": "^2.3.0",
268
- "commander": "^2.12.1",
269
- "diff": "^4.0.1",
270
- "glob": "^7.1.1",
271
- "js-yaml": "^3.13.1",
272
- "minimatch": "^3.0.4",
273
- "resolve": "^1.3.2",
274
- "semver": "^5.3.0",
275
- "tslib": "^1.8.0",
276
- "tsutils": "^2.29.0"
277
- }
278
- },
279
- "tsutils": {
280
- "version": "2.29.0",
281
- "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
282
- "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
283
- "dev": true,
284
- "requires": {
285
- "tslib": "^1.8.1"
286
- }
287
- },
288
- "typescript": {
289
- "version": "3.6.3",
290
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.3.tgz",
291
- "integrity": "sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==",
292
- "dev": true
293
- },
294
- "wrappy": {
295
- "version": "1.0.2",
296
- "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
297
- "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
298
- "dev": true
299
- }
300
- }
301
- }
@@ -1,5 +0,0 @@
1
- # FAMIX model in typescript
2
-
3
- FAMIX is a family of metamodels to represent source code.
4
-
5
- Learn more about the MSE file format and the FAMIX model https://www.researchgate.net/publication/265428652
@@ -1,56 +0,0 @@
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 +0,0 @@
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,243 +0,0 @@
1
- import { FamixBaseElement } from "./famix_base_element";
2
- import { Class, Interface, Namespace, Variable, Method, Function as FamixFunctionEntity, Type, NamedEntity, ScriptEntity, Module, SourceLanguage } from "./model/famix";
3
- // import { ClassDeclaration, ConstructorDeclaration, FunctionDeclaration, Identifier, InterfaceDeclaration, MethodDeclaration, MethodSignature, ModuleDeclaration, PropertyDeclaration, PropertySignature, SourceFile, TypeParameterDeclaration, VariableDeclaration, ParameterDeclaration, Decorator, GetAccessorDeclaration, SetAccessorDeclaration, ImportSpecifier, CommentRange, EnumDeclaration, EnumMember, TypeAliasDeclaration, FunctionExpression, ExpressionWithTypeArguments, ImportDeclaration, ImportEqualsDeclaration } from "ts-morph";
4
- import * as Famix from "./model/famix";
5
- import { TSMorphObjectType } from "../../../famix_functions/EntityDictionary";
6
- /**
7
- * This class is used to store all Famix elements
8
- */
9
- export class FamixRepository {
10
- private elements = new Set<FamixBaseElement>(); // All Famix elements
11
- private famixClasses = new Set<Class>(); // All Famix classes
12
- private famixInterfaces = new Set<Interface>(); // All Famix interfaces
13
- private famixNamespaces = new Set<Namespace>(); // All Famix namespaces
14
- private famixMethods = new Set<Method>(); // All Famix methods
15
- private famixVariables = new Set<Variable>(); // All Famix variables
16
- private famixFunctions = new Set<FamixFunctionEntity>(); // All Famix functions
17
- private famixFiles = new Set<ScriptEntity | Module>(); // All Famix files
18
- private idCounter = 1; // Id counter
19
- private absolutePath: string = "";
20
- private fmxElementObjectMap = new Map<Famix.Entity,TSMorphObjectType>();
21
-
22
- constructor() {
23
- this.addElement(new SourceLanguage()); // add the source language entity (TypeScript)
24
- }
25
-
26
- public setFmxElementObjectMap(fmxElementObjectMap: Map<Famix.Entity,TSMorphObjectType>){
27
- this.fmxElementObjectMap = fmxElementObjectMap;
28
- }
29
-
30
- public getFmxElementObjectMap(){
31
- return this.fmxElementObjectMap;
32
- }
33
-
34
- public getAbsolutePath() : string {
35
- return this.absolutePath;
36
- }
37
-
38
- public setAbsolutePath( path: string ){
39
- this.absolutePath = path;
40
- }
41
-
42
- /**
43
- * Gets a Famix entity by id
44
- * @param id An id of a Famix entity
45
- * @returns The Famix entity corresponding to the id or undefined if it doesn't exist
46
- */
47
- public getFamixEntityById(id: number): FamixBaseElement | undefined {
48
- const entity = Array.from(this.elements.values()).find(e => e.id === id);
49
- return entity;
50
- }
51
-
52
- /**
53
- * Gets a Famix entity by fully qualified name
54
- * @param fullyQualifiedName A fully qualified name
55
- * @returns The Famix entity corresponding to the fully qualified name or undefined if it doesn't exist
56
- */
57
- public getFamixEntityByFullyQualifiedName(fullyQualifiedName: string): FamixBaseElement | undefined {
58
- const allEntities = Array.from(this.elements.values()).filter(e => e instanceof NamedEntity) as Array<NamedEntity>;
59
- const entity = allEntities.find(e => e.getFullyQualifiedName() === fullyQualifiedName);
60
- return entity;
61
- }
62
-
63
- export(arg0: { format: string; }) {
64
- if(arg0.format === "json") {
65
- return this.getJSON();
66
- } else {
67
- throw new Error("Unsupported format");
68
- }
69
- }
70
-
71
-
72
- // Only for tests
73
-
74
- /**
75
- * Gets all Famix entities
76
- * @returns All Famix entities
77
- */
78
- public _getAllEntities(): Set<FamixBaseElement> {
79
- return new Set(Array.from(this.elements.values()));
80
- }
81
-
82
- /**
83
- * Gets all Famix entities of a given type
84
- * @param theType A type of Famix entity
85
- * @returns All Famix entities of the given type
86
- */
87
- public _getAllEntitiesWithType(theType: string): Set<FamixBaseElement> {
88
- return new Set(Array.from(this.elements.values()).filter(e => (e as FamixBaseElement).constructor.name === theType));
89
- }
90
-
91
- /**
92
- * Gets a Famix class by name
93
- * @param name A class name
94
- * @returns The Famix class corresponding to the name or undefined if it doesn't exist
95
- */
96
- public _getFamixClass(fullyQualifiedName: string): Class | undefined {
97
- return Array.from(this.famixClasses.values()).find(ns => ns.getFullyQualifiedName() === fullyQualifiedName);
98
- }
99
-
100
- /**
101
- * Gets a Famix interface by name
102
- * @param name An interface name
103
- * @returns The Famix interface corresponding to the name or undefined if it doesn't exist
104
- */
105
- public _getFamixInterface(fullyQualifiedName: string): Interface | undefined {
106
- return Array.from(this.famixInterfaces.values()).find(ns => ns.getFullyQualifiedName() === fullyQualifiedName);
107
- }
108
-
109
- /**
110
- * Gets a Famix method by name
111
- * @param name A method name
112
- * @returns The Famix method corresponding to the name or undefined if it doesn't exist
113
- */
114
- public _getFamixMethod(fullyQualifiedName: string): Method | undefined {
115
- return Array.from(this.famixMethods.values()).find(ns => ns.getFullyQualifiedName() === fullyQualifiedName);
116
- }
117
-
118
- /**
119
- * Gets a Famix function by name
120
- * @param name A function name
121
- * @returns The Famix function corresponding to the name or undefined if it doesn't exist
122
- */
123
- public _getFamixFunction(fullyQualifiedName: string): FamixFunctionEntity | undefined {
124
- return Array.from(this.famixFunctions.values()).find(ns => ns.getFullyQualifiedName() === fullyQualifiedName);
125
- }
126
-
127
-
128
- /**
129
- * Gets a Famix variable by name
130
- * @param name A variable name
131
- * @returns The Famix variable corresponding to the name or undefined if it doesn't exist
132
- */
133
- public _getFamixVariable(fullyQualifiedName: string): Variable | undefined {
134
- return Array.from(this.famixVariables.values()).find(v => v.getFullyQualifiedName() === fullyQualifiedName);
135
- }
136
-
137
- /**
138
- * Gets a Famix namespace by name
139
- * @param name A namespace name
140
- * @returns The Famix namespace corresponding to the name or undefined if it doesn't exist
141
- */
142
- public _getFamixNamespace(fullyQualifiedName: string): Namespace | undefined {
143
- return Array.from(this.famixNamespaces.values()).find(ns => ns.getFullyQualifiedName() === fullyQualifiedName);
144
- }
145
-
146
- /**
147
- * Gets all Famix namespaces
148
- * @returns All Famix namespaces
149
- */
150
- public _getFamixNamespaces(): Set<Namespace> {
151
- return new Set(Array.from(this.famixNamespaces.values()));
152
- }
153
-
154
- /**
155
- * Gets a Famix file by name
156
- * @param name A file name
157
- * @returns The Famix file corresponding to the name or undefined if it doesn't exist
158
- */
159
- public _getFamixFile(fullyQualifiedName: string): ScriptEntity | Module | undefined {
160
- return Array.from(this.famixFiles.values()).find(ns => ns.getName() === fullyQualifiedName);
161
- }
162
-
163
- /**
164
- * Gets all Famix files
165
- * @returns All Famix files
166
- */
167
- public _getFamixFiles(): Set<ScriptEntity | Module> {
168
- return new Set(Array.from(this.famixFiles.values()));
169
- }
170
-
171
- /**
172
- * Gets all method names as a set from a class
173
- * @param className A class name
174
- * @returns The set of class "className" method names
175
- */
176
- public _methodNamesAsSetFromClass(className: string): Set<string> {
177
- const theClass = this._getFamixClass(className) as Class;
178
- return new Set(Array.from(theClass.getMethods()).map(m => m.getName()));
179
- }
180
-
181
- /**
182
- * Gets all method parents as a set from a class
183
- * @param className A class name
184
- * @returns The set of class "className" method parents
185
- */
186
- public _methodParentsAsSetFromClass(className: string): Set<Type> {
187
- const theClass = this._getFamixClass(className) as Class;
188
- return new Set(Array.from(theClass.getMethods()).map(m => m.getParentEntity()));
189
- }
190
-
191
- /**
192
- * Gets the map of Famix element ids and their Famix element from a JSON model
193
- * @param model A JSON model
194
- * @returns The map of Famix element ids and their Famix element from the JSON model
195
- */
196
- public _initMapFromModel(model: string): Map<number, unknown> {
197
- const parsedModel: Array<FamixBaseElement> = JSON.parse(model);
198
- const idToElementMap: Map<number, unknown> = new Map();
199
- parsedModel.forEach(element => {
200
- idToElementMap.set(element.id, element);
201
- });
202
- return idToElementMap;
203
- }
204
-
205
-
206
- /**
207
- * Adds a Famix element to the repository
208
- * @param element A Famix element
209
- */
210
- public addElement(element: FamixBaseElement): void {
211
- if (element instanceof Class) {
212
- this.famixClasses.add(element);
213
- } else if (element instanceof Interface) {
214
- this.famixInterfaces.add(element);
215
- } else if (element instanceof Namespace) {
216
- this.famixNamespaces.add(element);
217
- } else if (element instanceof Variable) {
218
- this.famixVariables.add(element);
219
- } else if (element instanceof Method) {
220
- this.famixMethods.add(element);
221
- } else if (element instanceof FamixFunctionEntity) {
222
- this.famixFunctions.add(element);
223
- } else if (element instanceof ScriptEntity || element instanceof Module) {
224
- this.famixFiles.add(element);
225
- }
226
- this.elements.add(element);
227
- element.id = this.idCounter;
228
- this.idCounter++;
229
- }
230
-
231
- /**
232
- * Gets a JSON representation of the repository
233
- * @returns A JSON representation of the repository
234
- */
235
- public getJSON(): string {
236
- let ret = "[";
237
- for (const element of Array.from(this.elements.values())) {
238
- ret = ret + element.getJSON() + ",";
239
- }
240
- ret = ret.substring(0, ret.length - 1);
241
- return ret + "]";
242
- }
243
- }
@@ -1,53 +0,0 @@
1
- import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
- import { StructuralEntity } from "./structural_entity";
3
- import { Association } from "./association";
4
- import { ContainerEntity } from "./container_entity";
5
-
6
- export class Access extends Association {
7
-
8
- private accessor: ContainerEntity;
9
-
10
- public getAccessor(): ContainerEntity {
11
- return this.accessor;
12
- }
13
-
14
- public setAccessor(accessor: ContainerEntity): void {
15
- this.accessor = accessor;
16
- accessor.addAccess(this);
17
- }
18
-
19
- private variable: StructuralEntity;
20
-
21
- public getVariable(): StructuralEntity {
22
- return this.variable;
23
- }
24
-
25
- public setVariable(variable: StructuralEntity): void {
26
- this.variable = variable;
27
- variable.addIncomingAccess(this);
28
- }
29
-
30
- private isWrite: boolean;
31
-
32
- public getIsWrite(): boolean {
33
- return this.isWrite;
34
- }
35
-
36
- public setIsWrite(isWrite: boolean): void {
37
- this.isWrite = isWrite;
38
- }
39
-
40
-
41
- public getJSON(): string {
42
- const json: FamixJSONExporter = new FamixJSONExporter("Access", this);
43
- this.addPropertiesToExporter(json);
44
- return json.getJSON();
45
- }
46
-
47
- public addPropertiesToExporter(exporter: FamixJSONExporter): void {
48
- super.addPropertiesToExporter(exporter);
49
- exporter.addProperty("accessor", this.getAccessor());
50
- exporter.addProperty("variable", this.getVariable());
51
- exporter.addProperty("isWrite", this.getIsWrite());
52
- }
53
- }