refactor(compiler): split compiler and core (#18683)

After this, neither @angular/compiler nor @angular/comnpiler-cli depend
on @angular/core.

This add a duplication of some interfaces and enums which is stored
in @angular/compiler/src/core.ts

BREAKING CHANGE:
- `@angular/platform-server` now additionally depends on
  `@angular/platform-browser-dynamic` as a peer dependency.


PR Close #18683
This commit is contained in:
Tobias Bosch
2017-08-16 09:00:03 -07:00
committed by Miško Hevery
parent a0ca01d580
commit 0cc77b4a69
107 changed files with 1504 additions and 1564 deletions

View File

@ -6,12 +6,11 @@
* found in the LICENSE file at https://angular.io/license
*/
import {ChangeDetectionStrategy, ComponentFactory, RendererType2, SchemaMetadata, Type, ViewEncapsulation, ɵstringify as stringify} from '@angular/core';
import {StaticSymbol} from './aot/static_symbol';
import {ChangeDetectionStrategy, SchemaMetadata, Type, ViewEncapsulation} from './core';
import {LifecycleHooks} from './lifecycle_reflector';
import {CssSelector} from './selector';
import {splitAtColon} from './util';
import {splitAtColon, stringify} from './util';
@ -294,7 +293,7 @@ export class CompileTemplateMetadata {
export interface CompileEntryComponentMetadata {
componentType: any;
componentFactory: StaticSymbol|ComponentFactory<any>;
componentFactory: StaticSymbol|object;
}
// Note: This should only use interfaces as nested data types
@ -317,8 +316,8 @@ export interface CompileDirectiveSummary extends CompileTypeSummary {
changeDetection: ChangeDetectionStrategy|null;
template: CompileTemplateSummary|null;
componentViewType: StaticSymbol|ProxyClass|null;
rendererType: StaticSymbol|RendererType2|null;
componentFactory: StaticSymbol|ComponentFactory<any>|null;
rendererType: StaticSymbol|object|null;
componentFactory: StaticSymbol|object|null;
}
/**
@ -344,8 +343,8 @@ export class CompileDirectiveMetadata {
entryComponents: CompileEntryComponentMetadata[],
template: CompileTemplateMetadata,
componentViewType: StaticSymbol|ProxyClass|null,
rendererType: StaticSymbol|RendererType2|null,
componentFactory: StaticSymbol|ComponentFactory<any>|null,
rendererType: StaticSymbol|object|null,
componentFactory: StaticSymbol|object|null,
}): CompileDirectiveMetadata {
const hostListeners: {[key: string]: string} = {};
const hostProperties: {[key: string]: string} = {};
@ -422,8 +421,8 @@ export class CompileDirectiveMetadata {
template: CompileTemplateMetadata|null;
componentViewType: StaticSymbol|ProxyClass|null;
rendererType: StaticSymbol|RendererType2|null;
componentFactory: StaticSymbol|ComponentFactory<any>|null;
rendererType: StaticSymbol|object|null;
componentFactory: StaticSymbol|object|null;
constructor({isHost, type, isComponent, selector, exportAs,
changeDetection, inputs, outputs, hostListeners, hostProperties,
@ -447,8 +446,8 @@ export class CompileDirectiveMetadata {
entryComponents: CompileEntryComponentMetadata[],
template: CompileTemplateMetadata|null,
componentViewType: StaticSymbol|ProxyClass|null,
rendererType: StaticSymbol|RendererType2|null,
componentFactory: StaticSymbol|ComponentFactory<any>|null,
rendererType: StaticSymbol|object|null,
componentFactory: StaticSymbol|object|null,
}) {
this.isHost = !!isHost;
this.type = type;
@ -534,7 +533,8 @@ export function createHostComponentMeta(
queries: [],
viewQueries: [],
componentViewType: hostViewType,
rendererType: {id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {}},
rendererType:
{id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {}} as object,
entryComponents: [],
componentFactory: null
});
@ -720,7 +720,7 @@ function _normalizeArray(obj: any[] | undefined | null): any[] {
export class ProviderMeta {
token: any;
useClass: Type<any>|null;
useClass: Type|null;
useValue: any;
useExisting: any;
useFactory: Function|null;
@ -728,7 +728,7 @@ export class ProviderMeta {
multi: boolean;
constructor(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
useClass?: Type<any>,
useClass?: Type,
useValue?: any,
useExisting?: any,
useFactory?: Function|null,