2016-06-17 14:09:19 -07:00
|
|
|
import {ViewEncapsulation, isDevMode} from '@angular/core';
|
2016-06-08 16:38:52 -07:00
|
|
|
|
2016-04-28 17:50:03 -07:00
|
|
|
import {unimplemented} from '../src/facade/exceptions';
|
2016-06-08 16:38:52 -07:00
|
|
|
|
2016-01-06 14:13:44 -08:00
|
|
|
import {CompileIdentifierMetadata} from './compile_metadata';
|
2016-06-08 16:38:52 -07:00
|
|
|
import {Identifiers} from './identifiers';
|
2016-01-06 14:13:44 -08:00
|
|
|
|
|
|
|
export class CompilerConfig {
|
|
|
|
public renderTypes: RenderTypes;
|
2016-04-03 08:34:44 +09:00
|
|
|
public defaultEncapsulation: ViewEncapsulation;
|
2016-06-17 14:09:19 -07:00
|
|
|
private _genDebugInfo: boolean;
|
|
|
|
private _logBindingUpdate: boolean;
|
2016-06-13 10:06:40 -07:00
|
|
|
public useJit: boolean;
|
|
|
|
public platformDirectives: any[];
|
|
|
|
public platformPipes: any[];
|
2016-04-03 08:34:44 +09:00
|
|
|
|
2016-06-08 16:38:52 -07:00
|
|
|
constructor(
|
2016-06-13 10:06:40 -07:00
|
|
|
{renderTypes = new DefaultRenderTypes(), defaultEncapsulation = ViewEncapsulation.Emulated,
|
2016-06-17 14:09:19 -07:00
|
|
|
genDebugInfo, logBindingUpdate, useJit = true, platformDirectives = [],
|
|
|
|
platformPipes = []}: {
|
2016-06-13 10:06:40 -07:00
|
|
|
renderTypes?: RenderTypes,
|
|
|
|
defaultEncapsulation?: ViewEncapsulation,
|
|
|
|
genDebugInfo?: boolean,
|
|
|
|
logBindingUpdate?: boolean,
|
|
|
|
useJit?: boolean,
|
|
|
|
platformDirectives?: any[],
|
|
|
|
platformPipes?: any[]
|
|
|
|
} = {}) {
|
2016-01-06 14:13:44 -08:00
|
|
|
this.renderTypes = renderTypes;
|
2016-04-03 08:34:44 +09:00
|
|
|
this.defaultEncapsulation = defaultEncapsulation;
|
2016-06-17 14:09:19 -07:00
|
|
|
this._genDebugInfo = genDebugInfo;
|
|
|
|
this._logBindingUpdate = logBindingUpdate;
|
2016-06-13 10:06:40 -07:00
|
|
|
this.useJit = useJit;
|
|
|
|
this.platformDirectives = platformDirectives;
|
|
|
|
this.platformPipes = platformPipes;
|
2016-01-06 14:13:44 -08:00
|
|
|
}
|
2016-06-17 14:09:19 -07:00
|
|
|
|
|
|
|
get genDebugInfo(): boolean {
|
|
|
|
return this._genDebugInfo === void 0 ? isDevMode() : this._genDebugInfo;
|
|
|
|
}
|
|
|
|
get logBindingUpdate(): boolean {
|
|
|
|
return this._logBindingUpdate === void 0 ? isDevMode() : this._logBindingUpdate;
|
|
|
|
}
|
2016-01-06 14:13:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Types used for the renderer.
|
|
|
|
* Can be replaced to specialize the generated output to a specific renderer
|
|
|
|
* to help tree shaking.
|
|
|
|
*/
|
|
|
|
export abstract class RenderTypes {
|
|
|
|
get renderer(): CompileIdentifierMetadata { return unimplemented(); }
|
|
|
|
get renderText(): CompileIdentifierMetadata { return unimplemented(); }
|
|
|
|
get renderElement(): CompileIdentifierMetadata { return unimplemented(); }
|
|
|
|
get renderComment(): CompileIdentifierMetadata { return unimplemented(); }
|
|
|
|
get renderNode(): CompileIdentifierMetadata { return unimplemented(); }
|
|
|
|
get renderEvent(): CompileIdentifierMetadata { return unimplemented(); }
|
|
|
|
}
|
|
|
|
|
|
|
|
export class DefaultRenderTypes implements RenderTypes {
|
|
|
|
renderer = Identifiers.Renderer;
|
2016-06-08 15:45:15 -07:00
|
|
|
renderText: any /** TODO #9100 */ = null;
|
|
|
|
renderElement: any /** TODO #9100 */ = null;
|
|
|
|
renderComment: any /** TODO #9100 */ = null;
|
|
|
|
renderNode: any /** TODO #9100 */ = null;
|
|
|
|
renderEvent: any /** TODO #9100 */ = null;
|
2016-01-06 14:13:44 -08:00
|
|
|
}
|