2016-06-23 12:47:54 -04:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
2016-08-10 18:55:18 -04:00
|
|
|
import {BaseException, ViewEncapsulation, isDevMode} from '@angular/core';
|
2016-06-08 19:38:52 -04:00
|
|
|
|
2016-01-06 17:13:44 -05:00
|
|
|
import {CompileIdentifierMetadata} from './compile_metadata';
|
2016-06-08 19:38:52 -04:00
|
|
|
import {Identifiers} from './identifiers';
|
2016-01-06 17:13:44 -05:00
|
|
|
|
2016-08-10 18:55:18 -04:00
|
|
|
function unimplemented(): any {
|
|
|
|
throw new BaseException('unimplemented');
|
|
|
|
}
|
|
|
|
|
2016-01-06 17:13:44 -05:00
|
|
|
export class CompilerConfig {
|
|
|
|
public renderTypes: RenderTypes;
|
2016-04-02 19:34:44 -04:00
|
|
|
public defaultEncapsulation: ViewEncapsulation;
|
2016-06-17 17:09:19 -04:00
|
|
|
private _genDebugInfo: boolean;
|
|
|
|
private _logBindingUpdate: boolean;
|
2016-06-13 13:06:40 -04:00
|
|
|
public useJit: boolean;
|
2016-07-08 16:40:54 -04:00
|
|
|
/**
|
2016-07-18 06:50:31 -04:00
|
|
|
* @deprecated Providing platform directives via the {@link CompilerConfig} is deprecated. Provide
|
|
|
|
* platform directives via an {@link NgModule} instead.
|
2016-07-08 16:40:54 -04:00
|
|
|
*/
|
2016-07-18 06:50:31 -04:00
|
|
|
public platformDirectives: any[];
|
2016-07-08 16:40:54 -04:00
|
|
|
/**
|
2016-07-18 06:50:31 -04:00
|
|
|
* @deprecated Providing platform pipes via the {@link CompilerConfig} is deprecated. Provide
|
|
|
|
* platform pipes via an {@link NgModule} instead.
|
2016-07-08 16:40:54 -04:00
|
|
|
*/
|
2016-07-18 06:50:31 -04:00
|
|
|
public platformPipes: any[];
|
2016-04-02 19:34:44 -04:00
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
constructor(
|
2016-06-13 13:06:40 -04:00
|
|
|
{renderTypes = new DefaultRenderTypes(), defaultEncapsulation = ViewEncapsulation.Emulated,
|
2016-07-08 16:40:54 -04:00
|
|
|
genDebugInfo, logBindingUpdate, useJit = true, deprecatedPlatformDirectives = [],
|
|
|
|
deprecatedPlatformPipes = []}: {
|
2016-06-13 13:06:40 -04:00
|
|
|
renderTypes?: RenderTypes,
|
|
|
|
defaultEncapsulation?: ViewEncapsulation,
|
|
|
|
genDebugInfo?: boolean,
|
|
|
|
logBindingUpdate?: boolean,
|
|
|
|
useJit?: boolean,
|
2016-07-08 16:40:54 -04:00
|
|
|
deprecatedPlatformDirectives?: any[],
|
|
|
|
deprecatedPlatformPipes?: any[]
|
2016-06-13 13:06:40 -04:00
|
|
|
} = {}) {
|
2016-01-06 17:13:44 -05:00
|
|
|
this.renderTypes = renderTypes;
|
2016-04-02 19:34:44 -04:00
|
|
|
this.defaultEncapsulation = defaultEncapsulation;
|
2016-06-17 17:09:19 -04:00
|
|
|
this._genDebugInfo = genDebugInfo;
|
|
|
|
this._logBindingUpdate = logBindingUpdate;
|
2016-06-13 13:06:40 -04:00
|
|
|
this.useJit = useJit;
|
2016-07-18 06:50:31 -04:00
|
|
|
this.platformDirectives = deprecatedPlatformDirectives;
|
|
|
|
this.platformPipes = deprecatedPlatformPipes;
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
2016-06-17 17:09:19 -04: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 17:13:44 -05: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-28 14:35:59 -04:00
|
|
|
renderText: any = null;
|
|
|
|
renderElement: any = null;
|
|
|
|
renderComment: any = null;
|
|
|
|
renderNode: any = null;
|
|
|
|
renderEvent: any = null;
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|