refactor(compiler): Reintroduce ReflectorHost
and move Extractor
into @angular/compiler
This commit is contained in:

committed by
Chuck Jazdzewski

parent
3c06a5dc25
commit
2a5bd2f345
@ -36,8 +36,8 @@ const PREAMBLE = `/**
|
||||
export class CodeGenerator {
|
||||
constructor(
|
||||
private options: AngularCompilerOptions, private program: ts.Program,
|
||||
public host: ts.CompilerHost, private staticReflector: compiler.StaticReflector,
|
||||
private compiler: compiler.AotCompiler, private ngCompilerHost: CompilerHost) {}
|
||||
public host: ts.CompilerHost, private compiler: compiler.AotCompiler,
|
||||
private ngCompilerHost: CompilerHost) {}
|
||||
|
||||
// Write codegen in a directory structure matching the sources.
|
||||
private calculateEmitPath(filePath: string): string {
|
||||
@ -96,7 +96,7 @@ export class CodeGenerator {
|
||||
}
|
||||
transContent = readFileSync(transFile, 'utf8');
|
||||
}
|
||||
const {compiler: aotCompiler, reflector} = compiler.createAotCompiler(ngCompilerHost, {
|
||||
const {compiler: aotCompiler} = compiler.createAotCompiler(ngCompilerHost, {
|
||||
debug: options.debug === true,
|
||||
translations: transContent,
|
||||
i18nFormat: cliOptions.i18nFormat,
|
||||
@ -104,18 +104,10 @@ export class CodeGenerator {
|
||||
excludeFilePattern: options.generateCodeForLibraries === false ? GENERATED_OR_DTS_FILES :
|
||||
GENERATED_FILES
|
||||
});
|
||||
return new CodeGenerator(
|
||||
options, program, tsCompilerHost, reflector, aotCompiler, ngCompilerHost);
|
||||
return new CodeGenerator(options, program, tsCompilerHost, aotCompiler, ngCompilerHost);
|
||||
}
|
||||
}
|
||||
|
||||
export function extractProgramSymbols(
|
||||
program: ts.Program, staticReflector: compiler.StaticReflector, compilerHost: CompilerHost,
|
||||
options: AngularCompilerOptions): compiler.StaticSymbol[] {
|
||||
return compiler.extractProgramSymbols(
|
||||
staticReflector,
|
||||
program.getSourceFiles().map(sf => compilerHost.getCanonicalFileName(sf.fileName)), {
|
||||
excludeFilePattern: options.generateCodeForLibraries === false ? GENERATED_OR_DTS_FILES :
|
||||
GENERATED_FILES
|
||||
});
|
||||
export function excludeFilePattern(options: AngularCompilerOptions): RegExp {
|
||||
return options.generateCodeForLibraries === false ? GENERATED_OR_DTS_FILES : GENERATED_FILES;
|
||||
}
|
||||
|
Reference in New Issue
Block a user