ts2famix 1.0.11 → 1.0.12
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/.eslintrc.json +24 -24
- package/LICENSE +23 -23
- package/README.md +109 -109
- package/jest.config-old.ts +199 -199
- package/package.json +47 -47
- package/src/analyze.ts +94 -94
- package/src/analyze_functions/processAccesses.ts +57 -57
- package/src/analyze_functions/processFiles.ts +669 -661
- package/src/analyze_functions/processImportClauses.ts +77 -77
- package/src/analyze_functions/processInheritances.ts +84 -84
- package/src/analyze_functions/processInvocations.ts +51 -51
- package/src/famix2puml.ts +119 -119
- package/src/famix_functions/famix_functions.ts +559 -555
- package/src/famix_functions/famix_functions_associations.ts +215 -215
- package/src/famix_functions/famix_functions_index.ts +44 -44
- package/src/famix_functions/famix_functions_types.ts +105 -100
- package/src/generate_uml.sh +16 -16
- package/src/lib/famix/License.md +22 -22
- package/src/lib/famix/package-lock.json +301 -301
- package/src/lib/famix/package.json +27 -27
- package/src/lib/famix/readme.md +4 -4
- package/src/lib/famix/src/famix_JSON_exporter.ts +56 -56
- package/src/lib/famix/src/famix_base_element.ts +18 -18
- package/src/lib/famix/src/famix_repository.ts +199 -199
- package/src/lib/famix/src/index.ts +8 -8
- package/src/lib/famix/src/model/famix/access.ts +53 -53
- package/src/lib/famix/src/model/famix/accessor.ts +15 -15
- package/src/lib/famix/src/model/famix/alias.ts +41 -41
- package/src/lib/famix/src/model/famix/association.ts +44 -44
- package/src/lib/famix/src/model/famix/behavioral_entity.ts +107 -107
- package/src/lib/famix/src/model/famix/c_source_language.ts +15 -15
- package/src/lib/famix/src/model/famix/class.ts +86 -86
- package/src/lib/famix/src/model/famix/comment.ts +50 -50
- package/src/lib/famix/src/model/famix/container_entity.ts +165 -165
- package/src/lib/famix/src/model/famix/custom_source_language.ts +27 -27
- package/src/lib/famix/src/model/famix/decorator.ts +39 -39
- package/src/lib/famix/src/model/famix/entity.ts +15 -15
- package/src/lib/famix/src/model/famix/enum.ts +31 -31
- package/src/lib/famix/src/model/famix/enum_value.ts +29 -29
- package/src/lib/famix/src/model/famix/function.ts +15 -15
- package/src/lib/famix/src/model/famix/implicit_variable.ts +15 -15
- package/src/lib/famix/src/model/famix/import_clause.ts +53 -53
- package/src/lib/famix/src/model/famix/index.ts +42 -42
- package/src/lib/famix/src/model/famix/indexed_file_anchor.ts +49 -49
- package/src/lib/famix/src/model/famix/inheritance.ts +42 -42
- package/src/lib/famix/src/model/famix/interface.ts +75 -75
- package/src/lib/famix/src/model/famix/invocation.ts +68 -68
- package/src/lib/famix/src/model/famix/method.ts +96 -96
- package/src/lib/famix/src/model/famix/module.ts +31 -31
- package/src/lib/famix/src/model/famix/named_entity.ts +98 -98
- package/src/lib/famix/src/model/famix/namespace.ts +28 -28
- package/src/lib/famix/src/model/famix/parameter.ts +29 -29
- package/src/lib/famix/src/model/famix/parameterizable_class.ts +31 -31
- package/src/lib/famix/src/model/famix/parameterizable_interface.ts +31 -31
- package/src/lib/famix/src/model/famix/parameterized_type.ts +40 -40
- package/src/lib/famix/src/model/famix/primitive_type.ts +15 -15
- package/src/lib/famix/src/model/famix/property.ts +54 -54
- package/src/lib/famix/src/model/famix/reference.ts +42 -42
- package/src/lib/famix/src/model/famix/scoping_entity.ts +31 -31
- package/src/lib/famix/src/model/famix/script_entity.ts +38 -38
- package/src/lib/famix/src/model/famix/source_anchor.ts +31 -31
- package/src/lib/famix/src/model/famix/source_language.ts +31 -31
- package/src/lib/famix/src/model/famix/sourced_entity.ts +70 -70
- package/src/lib/famix/src/model/famix/structural_entity.ts +44 -44
- package/src/lib/famix/src/model/famix/text_anchor.ts +49 -49
- package/src/lib/famix/src/model/famix/type.ts +88 -88
- package/src/lib/famix/src/model/famix/type_parameter.ts +33 -33
- package/src/lib/famix/src/model/famix/variable.ts +28 -28
- package/src/lib/famix/tsconfig.json +26 -26
- package/src/lib/famix/tslint.json +14 -14
- package/src/lib/ts-complex/cyclomatic-service.ts +85 -85
- package/src/ts2famix-cli.ts +39 -39
- package/tsconfig.json +69 -69
- package/dist/analyze.js +0 -102
- package/dist/analyze_functions/processAccesses.js +0 -47
- package/dist/analyze_functions/processFiles.js +0 -540
- package/dist/analyze_functions/processImportClauses.js +0 -70
- package/dist/analyze_functions/processInheritances.js +0 -73
- package/dist/analyze_functions/processInvocations.js +0 -49
- package/dist/famix2puml.js +0 -125
- package/dist/famix_functions/famix_functions.js +0 -513
- package/dist/famix_functions/famix_functions_associations.js +0 -205
- package/dist/famix_functions/famix_functions_index.js +0 -62
- package/dist/famix_functions/famix_functions_types.js +0 -110
- package/dist/fqn.js +0 -126
- package/dist/fqp_implementation.js +0 -73
- package/dist/lib/famix/src/famix_JSON_exporter.js +0 -54
- package/dist/lib/famix/src/famix_base_element.js +0 -13
- package/dist/lib/famix/src/famix_repository.js +0 -187
- package/dist/lib/famix/src/index.js +0 -30
- package/dist/lib/famix/src/model/famix/access.js +0 -39
- package/dist/lib/famix/src/model/famix/accessor.js +0 -16
- package/dist/lib/famix/src/model/famix/alias.js +0 -32
- package/dist/lib/famix/src/model/famix/association.js +0 -36
- package/dist/lib/famix/src/model/famix/behavioral_entity.js +0 -81
- package/dist/lib/famix/src/model/famix/c_source_language.js +0 -16
- package/dist/lib/famix/src/model/famix/class.js +0 -70
- package/dist/lib/famix/src/model/famix/comment.js +0 -38
- package/dist/lib/famix/src/model/famix/container_entity.js +0 -125
- package/dist/lib/famix/src/model/famix/custom_source_language.js +0 -23
- package/dist/lib/famix/src/model/famix/decorator.js +0 -31
- package/dist/lib/famix/src/model/famix/entity.js +0 -16
- package/dist/lib/famix/src/model/famix/enum.js +0 -30
- package/dist/lib/famix/src/model/famix/enum_value.js +0 -24
- package/dist/lib/famix/src/model/famix/function.js +0 -16
- package/dist/lib/famix/src/model/famix/implicit_variable.js +0 -16
- package/dist/lib/famix/src/model/famix/import_clause.js +0 -39
- package/dist/lib/famix/src/model/famix/index.js +0 -87
- package/dist/lib/famix/src/model/famix/indexed_file_anchor.js +0 -37
- package/dist/lib/famix/src/model/famix/inheritance.js +0 -32
- package/dist/lib/famix/src/model/famix/interface.js +0 -63
- package/dist/lib/famix/src/model/famix/invocation.js +0 -53
- package/dist/lib/famix/src/model/famix/method.js +0 -66
- package/dist/lib/famix/src/model/famix/module.js +0 -30
- package/dist/lib/famix/src/model/famix/named_entity.js +0 -77
- package/dist/lib/famix/src/model/famix/namespace.js +0 -24
- package/dist/lib/famix/src/model/famix/parameter.js +0 -24
- package/dist/lib/famix/src/model/famix/parameterizable_class.js +0 -30
- package/dist/lib/famix/src/model/famix/parameterizable_interface.js +0 -30
- package/dist/lib/famix/src/model/famix/parameterized_type.js +0 -36
- package/dist/lib/famix/src/model/famix/primitive_type.js +0 -16
- package/dist/lib/famix/src/model/famix/property.js +0 -44
- package/dist/lib/famix/src/model/famix/reference.js +0 -32
- package/dist/lib/famix/src/model/famix/scoping_entity.js +0 -30
- package/dist/lib/famix/src/model/famix/script_entity.js +0 -30
- package/dist/lib/famix/src/model/famix/source_anchor.js +0 -26
- package/dist/lib/famix/src/model/famix/source_language.js +0 -30
- package/dist/lib/famix/src/model/famix/sourced_entity.js +0 -55
- package/dist/lib/famix/src/model/famix/structural_entity.js +0 -38
- package/dist/lib/famix/src/model/famix/text_anchor.js +0 -37
- package/dist/lib/famix/src/model/famix/type.js +0 -71
- package/dist/lib/famix/src/model/famix/type_parameter.js +0 -24
- package/dist/lib/famix/src/model/famix/variable.js +0 -23
- package/dist/lib/ts-complex/cyclomatic-service.js +0 -83
- package/dist/ts2famix-cli.js +0 -63
- package/dist/ts2famix-tsconfig.js +0 -53
- package/metrics.ts +0 -23
- package/output.debug.txt +0 -1351
- package/src/fqp_implementation.ts +0 -66
package/src/ts2famix-cli.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import * as fs from "fs";
|
|
3
|
-
import yargs from "yargs";
|
|
4
|
-
import { Importer } from './analyze';
|
|
5
|
-
import { FamixRepository } from "./lib/famix/src/famix_repository";
|
|
6
|
-
import { Project } from "ts-morph";
|
|
7
|
-
|
|
8
|
-
const argv = yargs
|
|
9
|
-
.example(`ts2famix -i "path/to/project/**/*.ts" -o JSONModels/projectName.json`, 'Creates a JSON-format Famix model of typescript files.')
|
|
10
|
-
.example(`ts2famix -i path/to/tsconfig.json -o JSONModels/projectName.json`, 'Creates a JSON-format model of a typescript project.')
|
|
11
|
-
.alias('i', 'input')
|
|
12
|
-
.nargs('i', 1)
|
|
13
|
-
.alias('o', 'output')
|
|
14
|
-
.nargs('o', 1)
|
|
15
|
-
.demandOption('input').demandOption('output').parseSync();
|
|
16
|
-
|
|
17
|
-
const importer = new Importer();
|
|
18
|
-
let famixRep: FamixRepository;
|
|
19
|
-
|
|
20
|
-
if ((argv.input as string).endsWith('tsconfig.json')) {
|
|
21
|
-
const tsConfigFilePath = argv.input as string;
|
|
22
|
-
const project = new Project({
|
|
23
|
-
tsConfigFilePath
|
|
24
|
-
});
|
|
25
|
-
famixRep = importer.famixRepFromProject(project);
|
|
26
|
-
} else {
|
|
27
|
-
const paths = new Array<string>();
|
|
28
|
-
paths.push(argv.input as string);
|
|
29
|
-
famixRep = importer.famixRepFromPaths(paths);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const jsonOutput = famixRep.getJSON();
|
|
33
|
-
const jsonFilePath = argv.output as string;
|
|
34
|
-
|
|
35
|
-
fs.writeFile(jsonFilePath, jsonOutput, (err) => {
|
|
36
|
-
if (err) { throw err; }
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
console.info(`Created: ${jsonFilePath}`);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import yargs from "yargs";
|
|
4
|
+
import { Importer } from './analyze';
|
|
5
|
+
import { FamixRepository } from "./lib/famix/src/famix_repository";
|
|
6
|
+
import { Project } from "ts-morph";
|
|
7
|
+
|
|
8
|
+
const argv = yargs
|
|
9
|
+
.example(`ts2famix -i "path/to/project/**/*.ts" -o JSONModels/projectName.json`, 'Creates a JSON-format Famix model of typescript files.')
|
|
10
|
+
.example(`ts2famix -i path/to/tsconfig.json -o JSONModels/projectName.json`, 'Creates a JSON-format model of a typescript project.')
|
|
11
|
+
.alias('i', 'input')
|
|
12
|
+
.nargs('i', 1)
|
|
13
|
+
.alias('o', 'output')
|
|
14
|
+
.nargs('o', 1)
|
|
15
|
+
.demandOption('input').demandOption('output').parseSync();
|
|
16
|
+
|
|
17
|
+
const importer = new Importer();
|
|
18
|
+
let famixRep: FamixRepository;
|
|
19
|
+
|
|
20
|
+
if ((argv.input as string).endsWith('tsconfig.json')) {
|
|
21
|
+
const tsConfigFilePath = argv.input as string;
|
|
22
|
+
const project = new Project({
|
|
23
|
+
tsConfigFilePath
|
|
24
|
+
});
|
|
25
|
+
famixRep = importer.famixRepFromProject(project);
|
|
26
|
+
} else {
|
|
27
|
+
const paths = new Array<string>();
|
|
28
|
+
paths.push(argv.input as string);
|
|
29
|
+
famixRep = importer.famixRepFromPaths(paths);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const jsonOutput = famixRep.getJSON();
|
|
33
|
+
const jsonFilePath = argv.output as string;
|
|
34
|
+
|
|
35
|
+
fs.writeFile(jsonFilePath, jsonOutput, (err) => {
|
|
36
|
+
if (err) { throw err; }
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
console.info(`Created: ${jsonFilePath}`);
|
package/tsconfig.json
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Basic Options */
|
|
4
|
-
"target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
|
5
|
-
"module": "CommonJS", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
6
|
-
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
7
|
-
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
8
|
-
// "checkJs": true, /* Report errors in .js files. */
|
|
9
|
-
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
10
|
-
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
11
|
-
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
12
|
-
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
13
|
-
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
14
|
-
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
15
|
-
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
16
|
-
// "composite": true, /* Enable project compilation */
|
|
17
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
18
|
-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
19
|
-
// "removeComments": true, /* Do not emit comments to output. */
|
|
20
|
-
// "noEmit": true, /* Do not emit outputs. */
|
|
21
|
-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
22
|
-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
23
|
-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
24
|
-
|
|
25
|
-
/* Strict Type-Checking Options */
|
|
26
|
-
"strict": false, /* Enable all strict type-checking options. */
|
|
27
|
-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
28
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
29
|
-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
30
|
-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
31
|
-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
32
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
33
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
34
|
-
|
|
35
|
-
/* Additional Checks */
|
|
36
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
37
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
38
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
39
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
40
|
-
|
|
41
|
-
/* Module Resolution Options */
|
|
42
|
-
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
43
|
-
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
44
|
-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
45
|
-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
46
|
-
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
47
|
-
// "types": [], /* Type declaration files to be included in compilation. */
|
|
48
|
-
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
49
|
-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
50
|
-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
51
|
-
|
|
52
|
-
/* Source Map Options */
|
|
53
|
-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
54
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
55
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
56
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
57
|
-
|
|
58
|
-
/* Experimental Options */
|
|
59
|
-
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
60
|
-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
61
|
-
},
|
|
62
|
-
"include": ["src"],
|
|
63
|
-
"exclude": ["node_modules", "**/*.spec.ts"],
|
|
64
|
-
"typedocOptions": {
|
|
65
|
-
"entryPoints": ["src/*"],
|
|
66
|
-
"entryPointStrategy": "expand",
|
|
67
|
-
"out": "docs",
|
|
68
|
-
"githubPages": false
|
|
69
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Basic Options */
|
|
4
|
+
"target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
|
5
|
+
"module": "CommonJS", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
6
|
+
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
7
|
+
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
8
|
+
// "checkJs": true, /* Report errors in .js files. */
|
|
9
|
+
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
10
|
+
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
11
|
+
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
12
|
+
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
13
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
14
|
+
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
15
|
+
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
16
|
+
// "composite": true, /* Enable project compilation */
|
|
17
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
18
|
+
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
19
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
|
20
|
+
// "noEmit": true, /* Do not emit outputs. */
|
|
21
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
22
|
+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
23
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
24
|
+
|
|
25
|
+
/* Strict Type-Checking Options */
|
|
26
|
+
"strict": false, /* Enable all strict type-checking options. */
|
|
27
|
+
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
28
|
+
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
29
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
30
|
+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
31
|
+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
32
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
33
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
34
|
+
|
|
35
|
+
/* Additional Checks */
|
|
36
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
37
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
38
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
39
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
40
|
+
|
|
41
|
+
/* Module Resolution Options */
|
|
42
|
+
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
43
|
+
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
44
|
+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
45
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
46
|
+
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
47
|
+
// "types": [], /* Type declaration files to be included in compilation. */
|
|
48
|
+
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
49
|
+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
50
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
51
|
+
|
|
52
|
+
/* Source Map Options */
|
|
53
|
+
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
54
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
55
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
56
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
57
|
+
|
|
58
|
+
/* Experimental Options */
|
|
59
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
60
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
61
|
+
},
|
|
62
|
+
"include": ["src"],
|
|
63
|
+
"exclude": ["node_modules", "**/*.spec.ts"],
|
|
64
|
+
"typedocOptions": {
|
|
65
|
+
"entryPoints": ["src/*"],
|
|
66
|
+
"entryPointStrategy": "expand",
|
|
67
|
+
"out": "docs",
|
|
68
|
+
"githubPages": false
|
|
69
|
+
}
|
|
70
70
|
}
|
package/dist/analyze.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Importer = void 0;
|
|
27
|
-
const ts_morph_1 = require("ts-morph");
|
|
28
|
-
const fs = __importStar(require("fs"));
|
|
29
|
-
const famix_functions_1 = require("./famix_functions/famix_functions");
|
|
30
|
-
const processFiles_1 = require("./analyze_functions/processFiles");
|
|
31
|
-
const processAccesses_1 = require("./analyze_functions/processAccesses");
|
|
32
|
-
const processInvocations_1 = require("./analyze_functions/processInvocations");
|
|
33
|
-
const processInheritances_1 = require("./analyze_functions/processInheritances");
|
|
34
|
-
const processImportClauses_1 = require("./analyze_functions/processImportClauses");
|
|
35
|
-
/**
|
|
36
|
-
* This class is used to build a Famix model from a TypeScript source code
|
|
37
|
-
*/
|
|
38
|
-
class Importer {
|
|
39
|
-
constructor() {
|
|
40
|
-
this.project = new ts_morph_1.Project(); // The project containing the source files to analyze
|
|
41
|
-
this.famixFunctions = new famix_functions_1.FamixFunctions(); // FamixFunctions object, it contains all the functions needed to create Famix entities
|
|
42
|
-
this.processFiles = new processFiles_1.ProcessFiles(this.famixFunctions); // ProcessFiles object, it contains all the functions needed to process the source files
|
|
43
|
-
this.processAccesses = new processAccesses_1.ProcessAccesses(this.famixFunctions); // ProcessAccesses object, it contains all the functions needed to process the accesses
|
|
44
|
-
this.processInvocations = new processInvocations_1.ProcessInvocations(this.famixFunctions); // ProcessInvocations object, it contains all the functions needed to process the invocations
|
|
45
|
-
this.processInheritances = new processInheritances_1.ProcessInheritances(this.famixFunctions); // ProcessInheritances object, it contains all the functions needed to process the inheritances
|
|
46
|
-
this.processImportClauses = new processImportClauses_1.ProcessImportClauses(this.famixFunctions); // ProcessImportClauses object, it contains all the functions needed to process the import clauses
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Main method
|
|
50
|
-
* @param paths An array of paths to the source files to analyze
|
|
51
|
-
* @returns The Famix repository containing the Famix model
|
|
52
|
-
*/
|
|
53
|
-
famixRepFromPaths(paths) {
|
|
54
|
-
let famixRep;
|
|
55
|
-
try {
|
|
56
|
-
console.info(`famixRepFromPaths: paths: ${paths}`);
|
|
57
|
-
const sourceFiles = this.project.addSourceFilesAtPaths(paths);
|
|
58
|
-
this.processFiles.processFiles(sourceFiles);
|
|
59
|
-
const accesses = this.processFiles.getAccesses();
|
|
60
|
-
const methodsAndFunctionsWithId = this.processFiles.getMethodsAndFunctionsWithId();
|
|
61
|
-
const classes = this.processFiles.getClasses();
|
|
62
|
-
const interfaces = this.processFiles.getInterfaces();
|
|
63
|
-
const modules = this.processFiles.getModules();
|
|
64
|
-
const exports = this.processFiles.getExports();
|
|
65
|
-
this.processImportClauses.processImportClauses(modules, exports);
|
|
66
|
-
this.processAccesses.processAccesses(accesses);
|
|
67
|
-
this.processInvocations.processInvocations(methodsAndFunctionsWithId);
|
|
68
|
-
this.processInheritances.processInheritances(classes, interfaces);
|
|
69
|
-
famixRep = this.famixFunctions.getFamixRepository();
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
console.error(`> ERROR: got exception ${error}. Exiting...`);
|
|
73
|
-
console.error(error.message);
|
|
74
|
-
console.error(error.stack);
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
return famixRep;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Main method for tests
|
|
81
|
-
* @param filename The name of the file to analyze
|
|
82
|
-
* @param source A TypeScript source code
|
|
83
|
-
* @returns The Famix repository containing the Famix model
|
|
84
|
-
*/
|
|
85
|
-
famixRepFromSource(filename, source) {
|
|
86
|
-
const filePath = `./test_src/${filename}.ts`;
|
|
87
|
-
fs.writeFileSync(filePath, source, 'utf-8');
|
|
88
|
-
const famixRep = this.famixRepFromPaths([filePath]);
|
|
89
|
-
return famixRep;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Main method for a ts-morph project
|
|
93
|
-
* @param project A ts-morph project
|
|
94
|
-
* @returns The Famix repository containing the Famix model
|
|
95
|
-
*/
|
|
96
|
-
famixRepFromProject(project) {
|
|
97
|
-
const sourceFileNames = project.getSourceFiles().map(f => f.getFilePath());
|
|
98
|
-
const famixRep = this.famixRepFromPaths(sourceFileNames);
|
|
99
|
-
return famixRep;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
exports.Importer = Importer;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProcessAccesses = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* This class is used to build a Famix model for the accesses
|
|
6
|
-
*/
|
|
7
|
-
class ProcessAccesses {
|
|
8
|
-
/**
|
|
9
|
-
* Initializes the ProcessAccesses object
|
|
10
|
-
* @param famixFunctions FamixFunctions object, it contains all the functions needed to create Famix entities
|
|
11
|
-
*/
|
|
12
|
-
constructor(famixFunctions) {
|
|
13
|
-
this.famixFunctions = famixFunctions;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Builds a Famix model for the accesses on the parameters, variables, properties and enum members of the source files
|
|
17
|
-
* @param accesses A map of parameters, variables, properties and enum members with their id
|
|
18
|
-
*/
|
|
19
|
-
processAccesses(accesses) {
|
|
20
|
-
console.info(`processAccesses: Creating accesses:`);
|
|
21
|
-
accesses.forEach((v, id) => {
|
|
22
|
-
console.info(`processAccesses: Accesses to ${v.getName()}`);
|
|
23
|
-
try {
|
|
24
|
-
const temp_nodes = v.findReferencesAsNodes();
|
|
25
|
-
temp_nodes.forEach(node => this.processNodeForAccesses(node, id));
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
console.error(`> WARNING: got exception ${error}. Continuing...`);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Builds a Famix model for an access on a parameter, variable, property or enum member
|
|
34
|
-
* @param n A node
|
|
35
|
-
* @param id An id of a parameter, a variable, a property or an enum member
|
|
36
|
-
*/
|
|
37
|
-
processNodeForAccesses(n, id) {
|
|
38
|
-
try {
|
|
39
|
-
this.famixFunctions.createFamixAccess(n, id);
|
|
40
|
-
console.info(`processNodeForAccesses: node: node, (${n.getType().getText()})`);
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
console.error(`> WARNING: got exception ${error}. ScopeDeclaration invalid for ${n.getSymbol().getFullyQualifiedName()}. Continuing...`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.ProcessAccesses = ProcessAccesses;
|