angular-docs-cn/goldens/public-api/compiler-cli/compiler_options.d.ts

46 lines
1.2 KiB
TypeScript
Raw Normal View History

export interface BazelAndG3Options {
annotateForClosureCompiler?: boolean;
generateDeepReexports?: boolean;
}
export interface I18nOptions {
enableI18nLegacyMessageIdFormat?: boolean;
i18nInLocale?: string;
fix(compiler): normalize line endings in ICU expansions (#36741) The html parser already normalizes line endings (converting `\r\n` to `\n`) for most text in templates but it was missing the expressions of ICU expansions. In ViewEngine backticked literal strings, used to define inline templates, were already normalized by the TypeScript parser. In Ivy we are parsing the raw text of the source file directly so the line endings need to be manually normalized. This change ensures that inline templates have the line endings of ICU expression normalized correctly, which matches the ViewEngine. In ViewEngine external templates, defined in HTML files, the behavior was different, since TypeScript was not normalizing the line endings. Specifically, ICU expansion "expressions" are not being normalized. This is a problem because it means that i18n message ids can be different on different machines that are setup with different line ending handling, or if the developer moves a template from inline to external or vice versa. The goal is always to normalize line endings, whether inline or external. But this would be a breaking change since it would change i18n message ids that have been previously computed. Therefore this commit aligns the ivy template parsing to have the same "buggy" behavior for external templates. There is now a compiler option `i18nNormalizeLineEndingsInICUs`, which if set to `true` will ensure the correct non-buggy behavior. For the time being this option defaults to `false` to ensure backward compatibility while allowing opt-in to the desired behavior. This option's default will be flipped in a future breaking change release. Further, when this option is set to `false`, any ICU expression tokens, which have not been normalized, are added to the `ParseResult` from the `HtmlParser.parse()` method. In the future, this collection of tokens could be used to diagnose and encourage developers to migrate their i18n message ids. See FW-2106. Closes #36725 PR Close #36741
2020-04-26 13:15:43 -04:00
i18nNormalizeLineEndingsInICUs?: boolean;
i18nUseExternalIds?: boolean;
}
export interface LegacyNgcOptions {
allowEmptyCodegenFiles?: boolean;
flatModuleId?: string;
flatModuleOutFile?: string;
fullTemplateTypeCheck?: boolean;
preserveWhitespaces?: boolean;
strictInjectionParameters?: boolean;
}
export interface MiscOptions {
compileNonExportedClasses?: boolean;
disableTypeScriptVersionCheck?: boolean;
}
export interface NgcCompatibilityOptions {
enableIvy?: boolean | 'ngtsc';
generateNgFactoryShims?: boolean;
generateNgSummaryShims?: boolean;
}
export interface StrictTemplateOptions {
strictAttributeTypes?: boolean;
strictContextGenerics?: boolean;
strictDomEventTypes?: boolean;
strictDomLocalRefTypes?: boolean;
strictInputAccessModifiers?: boolean;
strictInputTypes?: boolean;
strictLiteralTypes?: boolean;
strictNullInputTypes?: boolean;
strictOutputEventTypes?: boolean;
strictSafeNavigationTypes?: boolean;
strictTemplates?: boolean;
}