2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
* @license
|
2020-05-19 12:08:49 -07:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2016-06-23 09:47:54 -07:00
|
|
|
*
|
|
|
|
* 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 09:00:03 -07:00
|
|
|
import {MissingTranslationStrategy, ViewEncapsulation} from './core';
|
2017-07-28 15:58:28 +02:00
|
|
|
import {noUndefined} from './util';
|
2017-02-02 15:01:35 -08:00
|
|
|
|
2016-01-06 14:13:44 -08:00
|
|
|
export class CompilerConfig {
|
2017-03-24 09:59:58 -07:00
|
|
|
public defaultEncapsulation: ViewEncapsulation|null;
|
2016-06-13 10:06:40 -07:00
|
|
|
public useJit: boolean;
|
2017-08-16 09:00:03 -07:00
|
|
|
public jitDevMode: boolean;
|
2017-03-24 09:59:58 -07:00
|
|
|
public missingTranslation: MissingTranslationStrategy|null;
|
2017-07-28 15:58:28 +02:00
|
|
|
public preserveWhitespaces: boolean;
|
2017-09-26 13:40:47 -07:00
|
|
|
public strictInjectionParameters: boolean;
|
2016-04-03 08:34:44 +09:00
|
|
|
|
2020-04-08 10:14:18 -07:00
|
|
|
constructor({
|
|
|
|
defaultEncapsulation = ViewEncapsulation.Emulated,
|
|
|
|
useJit = true,
|
|
|
|
jitDevMode = false,
|
|
|
|
missingTranslation = null,
|
|
|
|
preserveWhitespaces,
|
|
|
|
strictInjectionParameters
|
|
|
|
}: {
|
|
|
|
defaultEncapsulation?: ViewEncapsulation,
|
|
|
|
useJit?: boolean,
|
|
|
|
jitDevMode?: boolean,
|
|
|
|
missingTranslation?: MissingTranslationStrategy|null,
|
|
|
|
preserveWhitespaces?: boolean,
|
|
|
|
strictInjectionParameters?: boolean,
|
|
|
|
} = {}) {
|
2016-04-03 08:34:44 +09:00
|
|
|
this.defaultEncapsulation = defaultEncapsulation;
|
2017-03-24 09:59:58 -07:00
|
|
|
this.useJit = !!useJit;
|
2017-08-16 09:00:03 -07:00
|
|
|
this.jitDevMode = !!jitDevMode;
|
2017-11-03 19:08:39 +01:00
|
|
|
this.missingTranslation = missingTranslation;
|
2017-07-28 15:58:28 +02:00
|
|
|
this.preserveWhitespaces = preserveWhitespacesDefault(noUndefined(preserveWhitespaces));
|
2017-09-26 13:40:47 -07:00
|
|
|
this.strictInjectionParameters = strictInjectionParameters === true;
|
2016-01-06 14:13:44 -08:00
|
|
|
}
|
|
|
|
}
|
2017-07-28 15:58:28 +02:00
|
|
|
|
|
|
|
export function preserveWhitespacesDefault(
|
2020-04-08 10:14:18 -07:00
|
|
|
preserveWhitespacesOption: boolean|null, defaultSetting = false): boolean {
|
2017-07-28 15:58:28 +02:00
|
|
|
return preserveWhitespacesOption === null ? defaultSetting : preserveWhitespacesOption;
|
|
|
|
}
|