From 662b8b73f66e12abfe8c46e8ec8432e1092cc1f5 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sat, 4 Sep 2021 11:32:30 +0200 Subject: [PATCH 1/2] fix(core): emit pure annotations to static property initializers Currently the pure annotations comments are not emitted because unless the entire expression is wrapped in braces. See the below TypeScript playgrounds https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=8&ssc=1&pln=1&pc=1#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQA9ACpoAAQD6+gAryASgFFD0LRuipMAdziIUGbPgIAKAJQBuKhTUlMB4qBB4IJgAdCB4AOaegu6EUbBKin5UQA ```js "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Injector = void 0; class NullInjector { } class Injector { } exports.Injector = Injector; Injector.NULL = new NullInjector(); console.log(Injector.NULL); ``` https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=4&ssc=18&pln=4&pc=33#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQAFAHoAVNAACAfUMAFeQCUAoseg6t0VJgDucRCgzZ8BDQEofAbioKakpgPFQIPBBMADoQPABzDUFPQhjYJUUAqiA ```js "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Injector = void 0; class NullInjector { } class Injector { }a exports.Injector = Injector; Injector.NULL = ( /* @__PURE__ */new NullInjector()); console.log(Injector.NULL); ``` --- packages/core/src/di/injector.ts | 2 +- packages/core/src/di/reflective_injector.ts | 2 +- packages/core/src/linker/component_factory_resolver.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/di/injector.ts b/packages/core/src/di/injector.ts index 39db0b63ca32f..726483d5060bd 100644 --- a/packages/core/src/di/injector.ts +++ b/packages/core/src/di/injector.ts @@ -59,7 +59,7 @@ export const INJECTOR_IMPL = INJECTOR_IMPL__PRE_R3__; */ export abstract class Injector { static THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND; - static NULL: Injector = /* @__PURE__ */ new NullInjector(); + static NULL: Injector = (/* @__PURE__ */ new NullInjector()); /** * Retrieves an instance from the injector based on the provided token. diff --git a/packages/core/src/di/reflective_injector.ts b/packages/core/src/di/reflective_injector.ts index 171a92a16c2c2..d897d68180eb6 100644 --- a/packages/core/src/di/reflective_injector.ts +++ b/packages/core/src/di/reflective_injector.ts @@ -270,7 +270,7 @@ export abstract class ReflectiveInjector implements Injector { } export class ReflectiveInjector_ implements ReflectiveInjector { - private static INJECTOR_KEY = /* @__PURE__ */ ReflectiveKey.get(Injector); + private static INJECTOR_KEY = (/* @__PURE__ */ ReflectiveKey.get(Injector)); /** @internal */ _constructionCounter: number = 0; /** @internal */ diff --git a/packages/core/src/linker/component_factory_resolver.ts b/packages/core/src/linker/component_factory_resolver.ts index dc449395a55e7..5b880238c83f9 100644 --- a/packages/core/src/linker/component_factory_resolver.ts +++ b/packages/core/src/linker/component_factory_resolver.ts @@ -46,7 +46,7 @@ of the code in this cookbook * @publicApi */ export abstract class ComponentFactoryResolver { - static NULL: ComponentFactoryResolver = /* @__PURE__ */ new _NullComponentFactoryResolver(); + static NULL: ComponentFactoryResolver = (/* @__PURE__ */ new _NullComponentFactoryResolver()); /** * Retrieves the factory object that creates a component of the given type. * @param component The component type. From a65b332d25b440bc0a89c036fcba7f228fe394b2 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sat, 4 Sep 2021 11:35:38 +0200 Subject: [PATCH 2/2] fix(animations): emit pure annotations to static property initializers Currently the pure annotations comments are not emitted because unless the entire expression is wrapped in braces. See the below TypeScript playgrounds https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=8&ssc=1&pln=1&pc=1#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQA9ACpoAAQD6+gAryASgFFD0LRuipMAdziIUGbPgIAKAJQBuKhTUlMB4qBB4IJgAdCB4AOaegu6EUbBKin5UQA ```js "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Injector = void 0; class NullInjector { } class Injector { } exports.Injector = Injector; Injector.NULL = new NullInjector(); console.log(Injector.NULL); ``` https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=4&ssc=18&pln=4&pc=33#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQAFAHoAVNAACAfUMAFeQCUAoseg6t0VJgDucRCgzZ8BDQEofAbioKakpgPFQIPBBMADoQPABzDUFPQhjYJUUAqiA ```js "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Injector = void 0; class NullInjector { } class Injector { } exports.Injector = Injector; Injector.NULL = ( /* @__PURE__ */new NullInjector()); console.log(Injector.NULL); ``` --- packages/animations/browser/src/render/animation_driver.ts | 2 +- packages/animations/browser/src/render/special_cased_styles.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/animations/browser/src/render/animation_driver.ts b/packages/animations/browser/src/render/animation_driver.ts index 0dc61bd889959..f33c3c7ef0c4f 100644 --- a/packages/animations/browser/src/render/animation_driver.ts +++ b/packages/animations/browser/src/render/animation_driver.ts @@ -47,7 +47,7 @@ export class NoopAnimationDriver implements AnimationDriver { * @publicApi */ export abstract class AnimationDriver { - static NOOP: AnimationDriver = /* @__PURE__ */ new NoopAnimationDriver(); + static NOOP: AnimationDriver = (/* @__PURE__ */ new NoopAnimationDriver()); abstract validateStyleProperty(prop: string): boolean; diff --git a/packages/animations/browser/src/render/special_cased_styles.ts b/packages/animations/browser/src/render/special_cased_styles.ts index c01076e85f097..00d87b0a7a55a 100644 --- a/packages/animations/browser/src/render/special_cased_styles.ts +++ b/packages/animations/browser/src/render/special_cased_styles.ts @@ -44,7 +44,7 @@ export function packageNonAnimatableStyles( * `destroy()` is called then all styles will be removed. */ export class SpecialCasedStyles { - static initialStylesByElement = /* @__PURE__ */ new WeakMap(); + static initialStylesByElement = (/* @__PURE__ */ new WeakMap()); private _state = SpecialCasedStylesState.Pending; private _initialStyles!: {[key: string]: any};