feat(core): manually annotate de-sugarred core tree-shakable providers with @pureOrBreakMyCode (#41096)

This is necessary for closure compiler in order to support cross chunk code motion.

I'm intentionally not annotating these call sites with @__PURE__ at the moment because
build-optimizer does it within the Angular CLI build. In the future we might want to consider
having both annotations here in case we change how build-optimizer works.

PR Close #41096
This commit is contained in:
Igor Minar 2021-03-05 18:20:04 -08:00 committed by Andrew Kushnir
parent 9c210281d4
commit 03d47d5701
5 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,7 @@ export abstract class ViewportScroller {
// De-sugared tree-shakable injection
// See #23917
/** @nocollapse */
static ɵprov = ɵɵdefineInjectable({
static ɵprov = /** @pureOrBreakMyCode */ ɵɵdefineInjectable({
token: ViewportScroller,
providedIn: 'root',
factory: () => new BrowserViewportScroller(ɵɵinject(DOCUMENT), window)

View File

@ -145,7 +145,7 @@ export function defaultIterableDiffersFactory() {
*/
export class IterableDiffers {
/** @nocollapse */
static ɵprov = ɵɵdefineInjectable(
static ɵprov = /** @pureOrBreakMyCode */ ɵɵdefineInjectable(
{token: IterableDiffers, providedIn: 'root', factory: defaultIterableDiffersFactory});
/**

View File

@ -122,7 +122,7 @@ export function defaultKeyValueDiffersFactory() {
*/
export class KeyValueDiffers {
/** @nocollapse */
static ɵprov = ɵɵdefineInjectable(
static ɵprov = /** @pureOrBreakMyCode */ ɵɵdefineInjectable(
{token: KeyValueDiffers, providedIn: 'root', factory: defaultKeyValueDiffersFactory});
/**

View File

@ -105,7 +105,7 @@ export abstract class Injector {
}
/** @nocollapse */
static ɵprov = ɵɵdefineInjectable({
static ɵprov = /** @pureOrBreakMyCode */ ɵɵdefineInjectable({
token: Injector,
providedIn: 'any' as any,
factory: () => ɵɵinject(INJECTOR),

View File

@ -17,7 +17,7 @@ import {SecurityContext} from './security';
export abstract class Sanitizer {
abstract sanitize(context: SecurityContext, value: {}|string|null): string|null;
/** @nocollapse */
static ɵprov = ɵɵdefineInjectable({
static ɵprov = /** @pureOrBreakMyCode */ ɵɵdefineInjectable({
token: Sanitizer,
providedIn: 'root',
factory: () => null,