1 | import { ts } from 'ts-morph';
|
2 |
|
3 | import { ClassHelper } from './angular/deps/helpers/class-helper';
|
4 | import { ComponentHelper } from './angular/deps/helpers/component-helper';
|
5 |
|
6 | import { compilerHost } from '../../utils';
|
7 |
|
8 | export class FrameworkDependencies {
|
9 | public files: string[];
|
10 | public program: ts.Program;
|
11 | public typeChecker: ts.TypeChecker;
|
12 | public classHelper: ClassHelper;
|
13 | public componentHelper: ComponentHelper;
|
14 | public routerParser;
|
15 |
|
16 | constructor(files: string[], options: any) {
|
17 | this.files = files;
|
18 |
|
19 | const transpileOptions = {
|
20 | target: ts.ScriptTarget.ES5,
|
21 | module: ts.ModuleKind.CommonJS,
|
22 | tsconfigDirectory: options.tsconfigDirectory,
|
23 | allowJs: true
|
24 | };
|
25 | this.program = ts.createProgram(
|
26 | this.files,
|
27 | transpileOptions,
|
28 | compilerHost(transpileOptions)
|
29 | );
|
30 | this.typeChecker = this.program.getTypeChecker();
|
31 | this.classHelper = new ClassHelper(this.typeChecker);
|
32 | this.componentHelper = new ComponentHelper(this.classHelper);
|
33 | }
|
34 | }
|