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
|
|
|
|
*/
|
|
|
|
|
2017-08-16 12:00:03 -04:00
|
|
|
import {CompileIdentifierMetadata} from './compile_metadata';
|
|
|
|
import {MissingTranslationStrategy, ViewEncapsulation} from './core';
|
|
|
|
import {Identifiers} from './identifiers';
|
|
|
|
import * as o from './output/output_ast';
|
2017-07-28 09:58:28 -04:00
|
|
|
import {noUndefined} from './util';
|
2017-02-02 18:01:35 -05:00
|
|
|
|
2016-01-06 17:13:44 -05:00
|
|
|
export class CompilerConfig {
|
2017-03-24 12:59:58 -04:00
|
|
|
public defaultEncapsulation: ViewEncapsulation|null;
|
2016-06-13 13:06:40 -04:00
|
|
|
public useJit: boolean;
|
2017-08-16 12:00:03 -04:00
|
|
|
public jitDevMode: boolean;
|
2017-03-24 12:59:58 -04:00
|
|
|
public missingTranslation: MissingTranslationStrategy|null;
|
2017-07-28 09:58:28 -04:00
|
|
|
public preserveWhitespaces: boolean;
|
2017-09-26 16:40:47 -04:00
|
|
|
public strictInjectionParameters: boolean;
|
2016-04-02 19:34:44 -04:00
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
constructor(
|
2017-08-16 12:00:03 -04:00
|
|
|
{defaultEncapsulation = ViewEncapsulation.Emulated, useJit = true, jitDevMode = false,
|
2018-03-14 20:27:38 -04:00
|
|
|
missingTranslation = null, preserveWhitespaces, strictInjectionParameters}: {
|
2016-06-13 13:06:40 -04:00
|
|
|
defaultEncapsulation?: ViewEncapsulation,
|
2017-01-26 02:26:49 -05:00
|
|
|
useJit?: boolean,
|
2017-08-16 12:00:03 -04:00
|
|
|
jitDevMode?: boolean,
|
2018-08-05 11:31:27 -04:00
|
|
|
missingTranslation?: MissingTranslationStrategy|null,
|
2017-09-11 18:18:19 -04:00
|
|
|
preserveWhitespaces?: boolean,
|
2017-09-26 16:40:47 -04:00
|
|
|
strictInjectionParameters?: boolean,
|
2016-06-13 13:06:40 -04:00
|
|
|
} = {}) {
|
2016-04-02 19:34:44 -04:00
|
|
|
this.defaultEncapsulation = defaultEncapsulation;
|
2017-03-24 12:59:58 -04:00
|
|
|
this.useJit = !!useJit;
|
2017-08-16 12:00:03 -04:00
|
|
|
this.jitDevMode = !!jitDevMode;
|
2017-11-03 14:08:39 -04:00
|
|
|
this.missingTranslation = missingTranslation;
|
2017-07-28 09:58:28 -04:00
|
|
|
this.preserveWhitespaces = preserveWhitespacesDefault(noUndefined(preserveWhitespaces));
|
2017-09-26 16:40:47 -04:00
|
|
|
this.strictInjectionParameters = strictInjectionParameters === true;
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
|
|
|
}
|
2017-07-28 09:58:28 -04:00
|
|
|
|
|
|
|
export function preserveWhitespacesDefault(
|
2018-02-05 18:37:05 -05:00
|
|
|
preserveWhitespacesOption: boolean | null, defaultSetting = false): boolean {
|
2017-07-28 09:58:28 -04:00
|
|
|
return preserveWhitespacesOption === null ? defaultSetting : preserveWhitespacesOption;
|
|
|
|
}
|