refactor: remove old compiler options (#14891)
DEPRECATION: - `CompilerOptions.debug` has no effect any more, as the compiler always produces the same code independent of debug mode.
This commit is contained in:

committed by
Chuck Jazdzewski

parent
07122f0ad9
commit
1cff1250ba
@ -72,7 +72,6 @@ export class CodeGenerator {
|
|||||||
transContent = readFileSync(transFile, 'utf8');
|
transContent = readFileSync(transFile, 'utf8');
|
||||||
}
|
}
|
||||||
const {compiler: aotCompiler} = compiler.createAotCompiler(ngCompilerHost, {
|
const {compiler: aotCompiler} = compiler.createAotCompiler(ngCompilerHost, {
|
||||||
debug: options.debug === true,
|
|
||||||
translations: transContent,
|
translations: transContent,
|
||||||
i18nFormat: cliOptions.i18nFormat,
|
i18nFormat: cliOptions.i18nFormat,
|
||||||
locale: cliOptions.locale,
|
locale: cliOptions.locale,
|
||||||
|
@ -54,9 +54,7 @@ export function createAotCompiler(compilerHost: AotCompilerHost, options: AotCom
|
|||||||
new HtmlParser(), translations, options.i18nFormat, MissingTranslationStrategy.Warning,
|
new HtmlParser(), translations, options.i18nFormat, MissingTranslationStrategy.Warning,
|
||||||
console);
|
console);
|
||||||
const config = new CompilerConfig({
|
const config = new CompilerConfig({
|
||||||
genDebugInfo: options.debug === true,
|
|
||||||
defaultEncapsulation: ViewEncapsulation.Emulated,
|
defaultEncapsulation: ViewEncapsulation.Emulated,
|
||||||
logBindingUpdate: false,
|
|
||||||
useJit: false,
|
useJit: false,
|
||||||
enableLegacyTemplate: options.enableLegacyTemplate !== false,
|
enableLegacyTemplate: options.enableLegacyTemplate !== false,
|
||||||
});
|
});
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export interface AotCompilerOptions {
|
export interface AotCompilerOptions {
|
||||||
debug?: boolean;
|
|
||||||
locale?: string;
|
locale?: string;
|
||||||
i18nFormat?: string;
|
i18nFormat?: string;
|
||||||
translations?: string;
|
translations?: string;
|
||||||
|
@ -20,31 +20,17 @@ export class CompilerConfig {
|
|||||||
public useJit: boolean;
|
public useJit: boolean;
|
||||||
public missingTranslation: MissingTranslationStrategy;
|
public missingTranslation: MissingTranslationStrategy;
|
||||||
|
|
||||||
private _genDebugInfo: boolean;
|
|
||||||
private _logBindingUpdate: boolean;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
{defaultEncapsulation = ViewEncapsulation.Emulated, genDebugInfo, logBindingUpdate,
|
{defaultEncapsulation = ViewEncapsulation.Emulated, useJit = true, missingTranslation,
|
||||||
useJit = true, missingTranslation, enableLegacyTemplate}: {
|
enableLegacyTemplate}: {
|
||||||
defaultEncapsulation?: ViewEncapsulation,
|
defaultEncapsulation?: ViewEncapsulation,
|
||||||
genDebugInfo?: boolean,
|
|
||||||
logBindingUpdate?: boolean,
|
|
||||||
useJit?: boolean,
|
useJit?: boolean,
|
||||||
missingTranslation?: MissingTranslationStrategy,
|
missingTranslation?: MissingTranslationStrategy,
|
||||||
enableLegacyTemplate?: boolean,
|
enableLegacyTemplate?: boolean,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
this.defaultEncapsulation = defaultEncapsulation;
|
this.defaultEncapsulation = defaultEncapsulation;
|
||||||
this._genDebugInfo = genDebugInfo;
|
|
||||||
this._logBindingUpdate = logBindingUpdate;
|
|
||||||
this.useJit = useJit;
|
this.useJit = useJit;
|
||||||
this.missingTranslation = missingTranslation;
|
this.missingTranslation = missingTranslation;
|
||||||
this.enableLegacyTemplate = enableLegacyTemplate !== false;
|
this.enableLegacyTemplate = enableLegacyTemplate !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
get genDebugInfo(): boolean {
|
|
||||||
return this._genDebugInfo === void 0 ? isDevMode() : this._genDebugInfo;
|
|
||||||
}
|
|
||||||
get logBindingUpdate(): boolean {
|
|
||||||
return this._logBindingUpdate === void 0 ? isDevMode() : this._logBindingUpdate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -97,12 +97,8 @@ export class Extractor {
|
|||||||
const staticReflector = new StaticReflector(staticSymbolResolver);
|
const staticReflector = new StaticReflector(staticSymbolResolver);
|
||||||
StaticAndDynamicReflectionCapabilities.install(staticReflector);
|
StaticAndDynamicReflectionCapabilities.install(staticReflector);
|
||||||
|
|
||||||
const config = new CompilerConfig({
|
const config =
|
||||||
genDebugInfo: false,
|
new CompilerConfig({defaultEncapsulation: ViewEncapsulation.Emulated, useJit: false});
|
||||||
defaultEncapsulation: ViewEncapsulation.Emulated,
|
|
||||||
logBindingUpdate: false,
|
|
||||||
useJit: false
|
|
||||||
});
|
|
||||||
|
|
||||||
const normalizer = new DirectiveNormalizer(
|
const normalizer = new DirectiveNormalizer(
|
||||||
{get: (url: string) => host.loadResource(url)}, urlResolver, htmlParser, config);
|
{get: (url: string) => host.loadResource(url)}, urlResolver, htmlParser, config);
|
||||||
|
@ -111,16 +111,12 @@ export class JitCompilerFactory implements CompilerFactory {
|
|||||||
provide: CompilerConfig,
|
provide: CompilerConfig,
|
||||||
useFactory: () => {
|
useFactory: () => {
|
||||||
return new CompilerConfig({
|
return new CompilerConfig({
|
||||||
// let explicit values from the compiler options overwrite options
|
|
||||||
// from the app providers. E.g. important for the testing platform.
|
|
||||||
genDebugInfo: opts.useDebug,
|
|
||||||
// let explicit values from the compiler options overwrite options
|
// let explicit values from the compiler options overwrite options
|
||||||
// from the app providers
|
// from the app providers
|
||||||
useJit: opts.useJit,
|
useJit: opts.useJit,
|
||||||
// let explicit values from the compiler options overwrite options
|
// let explicit values from the compiler options overwrite options
|
||||||
// from the app providers
|
// from the app providers
|
||||||
defaultEncapsulation: opts.defaultEncapsulation,
|
defaultEncapsulation: opts.defaultEncapsulation,
|
||||||
logBindingUpdate: opts.useDebug,
|
|
||||||
missingTranslation: opts.missingTranslation,
|
missingTranslation: opts.missingTranslation,
|
||||||
enableLegacyTemplate: opts.enableLegacyTemplate,
|
enableLegacyTemplate: opts.enableLegacyTemplate,
|
||||||
});
|
});
|
||||||
@ -150,7 +146,6 @@ export const platformCoreDynamic = createPlatformFactory(platformCore, 'coreDyna
|
|||||||
|
|
||||||
function _mergeOptions(optionsArr: CompilerOptions[]): CompilerOptions {
|
function _mergeOptions(optionsArr: CompilerOptions[]): CompilerOptions {
|
||||||
return {
|
return {
|
||||||
useDebug: _lastDefined(optionsArr.map(options => options.useDebug)),
|
|
||||||
useJit: _lastDefined(optionsArr.map(options => options.useJit)),
|
useJit: _lastDefined(optionsArr.map(options => options.useJit)),
|
||||||
defaultEncapsulation: _lastDefined(optionsArr.map(options => options.defaultEncapsulation)),
|
defaultEncapsulation: _lastDefined(optionsArr.map(options => options.defaultEncapsulation)),
|
||||||
providers: _mergeArrays(optionsArr.map(options => options.providers)),
|
providers: _mergeArrays(optionsArr.map(options => options.providers)),
|
||||||
|
@ -93,6 +93,9 @@ export class Compiler {
|
|||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export type CompilerOptions = {
|
export type CompilerOptions = {
|
||||||
|
/**
|
||||||
|
* @deprecated since v4 this option has no effect anymore.
|
||||||
|
*/
|
||||||
useDebug?: boolean,
|
useDebug?: boolean,
|
||||||
useJit?: boolean,
|
useJit?: boolean,
|
||||||
defaultEncapsulation?: ViewEncapsulation,
|
defaultEncapsulation?: ViewEncapsulation,
|
||||||
|
@ -107,14 +107,9 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
|||||||
const urlResolver = createOfflineCompileUrlResolver();
|
const urlResolver = createOfflineCompileUrlResolver();
|
||||||
const htmlParser = new DummyHtmlParser();
|
const htmlParser = new DummyHtmlParser();
|
||||||
// This tracks the CompileConfig in codegen.ts. Currently these options
|
// This tracks the CompileConfig in codegen.ts. Currently these options
|
||||||
// are hard-coded except for genDebugInfo which is not applicable as we
|
// are hard-coded.
|
||||||
// never generate code.
|
const config =
|
||||||
const config = new CompilerConfig({
|
new CompilerConfig({defaultEncapsulation: ViewEncapsulation.Emulated, useJit: false});
|
||||||
genDebugInfo: false,
|
|
||||||
defaultEncapsulation: ViewEncapsulation.Emulated,
|
|
||||||
logBindingUpdate: false,
|
|
||||||
useJit: false
|
|
||||||
});
|
|
||||||
const directiveNormalizer =
|
const directiveNormalizer =
|
||||||
new DirectiveNormalizer(resourceLoader, urlResolver, htmlParser, config);
|
new DirectiveNormalizer(resourceLoader, urlResolver, htmlParser, config);
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ interface Options extends ts.CompilerOptions {
|
|||||||
// Print extra information while running the compiler
|
// Print extra information while running the compiler
|
||||||
trace?: boolean;
|
trace?: boolean;
|
||||||
|
|
||||||
// Whether to embed debug information in the compiled templates
|
/** @deprecated since v4 this option has no effect anymore. */
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
|
|
||||||
// Whether to enable support for <template> and the template attribute (true by default)
|
// Whether to enable support for <template> and the template attribute (true by default)
|
||||||
|
@ -205,7 +205,7 @@ export declare abstract class CompilerFactory {
|
|||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare type CompilerOptions = {
|
export declare type CompilerOptions = {
|
||||||
useDebug?: boolean;
|
/** @deprecated */ useDebug?: boolean;
|
||||||
useJit?: boolean;
|
useJit?: boolean;
|
||||||
defaultEncapsulation?: ViewEncapsulation;
|
defaultEncapsulation?: ViewEncapsulation;
|
||||||
providers?: any[];
|
providers?: any[];
|
||||||
|
Reference in New Issue
Block a user