refactor(ivy): ngcc - move decorator analysis types into their own file (#31544)

PR Close #31544
This commit is contained in:
Pete Bacon Darwin
2019-07-18 21:05:32 +01:00
committed by Misko Hevery
parent c038992fae
commit d39a2beae1
11 changed files with 54 additions and 40 deletions

View File

@ -7,7 +7,6 @@
*/
import {ConstantPool} from '@angular/compiler';
import * as ts from 'typescript';
import {BaseDefDecoratorHandler, ComponentDecoratorHandler, DirectiveDecoratorHandler, InjectableDecoratorHandler, NgModuleDecoratorHandler, PipeDecoratorHandler, ReferencesRegistry, ResourceLoader} from '../../../src/ngtsc/annotations';
import {CycleAnalyzer, ImportGraph} from '../../../src/ngtsc/cycles';
import {FileSystem, LogicalFileSystem, absoluteFrom, dirname, resolve} from '../../../src/ngtsc/file_system';
@ -20,36 +19,7 @@ import {CompileResult, DecoratorHandler, DetectResult, HandlerPrecedence} from '
import {NgccReflectionHost} from '../host/ngcc_host';
import {EntryPointBundle} from '../packages/entry_point_bundle';
import {isDefined} from '../utils';
import {isWithinPackage} from './util';
export interface AnalyzedFile {
sourceFile: ts.SourceFile;
analyzedClasses: AnalyzedClass[];
}
export interface AnalyzedClass {
name: string;
decorators: Decorator[]|null;
declaration: ClassDeclaration;
diagnostics?: ts.Diagnostic[];
matches: {handler: DecoratorHandler<any, any>; analysis: any;}[];
}
export interface CompiledClass extends AnalyzedClass { compilation: CompileResult[]; }
export interface CompiledFile {
compiledClasses: CompiledClass[];
sourceFile: ts.SourceFile;
constantPool: ConstantPool;
}
export type DecorationAnalyses = Map<ts.SourceFile, CompiledFile>;
export const DecorationAnalyses = Map;
export interface MatchingHandler<A, M> {
handler: DecoratorHandler<A, M>;
detected: M;
}
import {AnalyzedClass, AnalyzedFile, CompiledClass, CompiledFile, DecorationAnalyses, MatchingHandler} from './types';
/**
* Simple class that resolves and loads files directly from the filesystem.

View File

@ -0,0 +1,40 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ConstantPool} from '@angular/compiler';
import * as ts from 'typescript';
import {ClassDeclaration, Decorator} from '../../../src/ngtsc/reflection';
import {CompileResult, DecoratorHandler} from '../../../src/ngtsc/transform';
export interface AnalyzedFile {
sourceFile: ts.SourceFile;
analyzedClasses: AnalyzedClass[];
}
export interface AnalyzedClass {
name: string;
decorators: Decorator[]|null;
declaration: ClassDeclaration;
diagnostics?: ts.Diagnostic[];
matches: {handler: DecoratorHandler<any, any>; analysis: any;}[];
}
export interface CompiledClass extends AnalyzedClass { compilation: CompileResult[]; }
export interface CompiledFile {
compiledClasses: CompiledClass[];
sourceFile: ts.SourceFile;
constantPool: ConstantPool;
}
export type DecorationAnalyses = Map<ts.SourceFile, CompiledFile>;
export const DecorationAnalyses = Map;
export interface MatchingHandler<A, M> {
handler: DecoratorHandler<A, M>;
detected: M;
}