refactor(compiler): cleanup and preparation for integration

- Rename `DirectiveMetadata` into `CompileDirectiveMetadata`, merge
  with `NormalizedDirectiveMetadata` and remove `ChangeDetectionMetadata`
- Store change detector factories not as array but
  directly at the `CompiledTemplate` or the embedded template
  to make instantiation easier later on
- Already analyze variable values and map them
  to `Directive.exportAs`
- Keep the directive sort order as specified in the
  `@View()` annotation
- Allow to clear the runtime cache in `StyleCompiler`
  and `TemplateCompiler`
- Ignore `script` elements to match the semantics of the
  current compiler
- Make all components dynamically loadable and remove
  the previously introduced property `@Component#dynamicLoadable`
  for now until we find a better option to configure this
- Don’t allow to specify bindings in `@View#directives` and `@View#pipes` as this was never supported by the transformer (see below for the breaking change)

BREAKING CHANGE:
- don't support DI bindings in `@View#directives` and `@View@pipes` any more in preparation of integrating the new compiler. Use `@Directive#bindings` to reexport directives under a different token instead.

Part of #3605
Closes #4314
This commit is contained in:
Tobias Bosch
2015-09-18 10:33:23 -07:00
parent eb7839e0ec
commit cc0c30484f
37 changed files with 1480 additions and 1167 deletions

View File

@ -76,8 +76,8 @@ export interface ComponentDecorator extends TypeDecorator {
View(obj: {
templateUrl?: string,
template?: string,
directives?: Array<Type | any | any[]>,
pipes?: Array<Type | any | any[]>,
directives?: Array<Type | any[]>,
pipes?: Array<Type | any[]>,
renderer?: string,
styles?: string[],
styleUrls?: string[],
@ -96,8 +96,8 @@ export interface ViewDecorator extends TypeDecorator {
View(obj: {
templateUrl?: string,
template?: string,
directives?: Array<Type | any | any[]>,
pipes?: Array<Type | any | any[]>,
directives?: Array<Type | any[]>,
pipes?: Array<Type | any[]>,
renderer?: string,
styles?: string[],
styleUrls?: string[],
@ -218,7 +218,6 @@ export interface ComponentFactory {
properties?: string[],
events?: string[],
host?: StringMap<string, string>,
dynamicLoadable?: boolean,
bindings?: any[],
exportAs?: string,
moduleId?: string,
@ -232,7 +231,6 @@ export interface ComponentFactory {
properties?: string[],
events?: string[],
host?: StringMap<string, string>,
dynamicLoadable?: boolean,
bindings?: any[],
exportAs?: string,
moduleId?: string,
@ -290,7 +288,8 @@ export interface ViewFactory {
(obj: {
templateUrl?: string,
template?: string,
directives?: Array<Type | any | any[]>,
directives?: Array<Type | any[]>,
pipes?: Array<Type | any[]>,
encapsulation?: ViewEncapsulation,
styles?: string[],
styleUrls?: string[],
@ -298,7 +297,8 @@ export interface ViewFactory {
new (obj: {
templateUrl?: string,
template?: string,
directives?: Array<Type | any | any[]>,
directives?: Array<Type | any[]>,
pipes?: Array<Type | any[]>,
encapsulation?: ViewEncapsulation,
styles?: string[],
styleUrls?: string[],