Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): correct wrap ES2022 classes with …
Browse files Browse the repository at this point in the history
…static properties

Prior to this commit, we only wrapped classes with static properties that were marked with `/*@__PURE__*/` comment due to a bug in the `adjust-static-class-members` Babel plugin were we did not call the `Identifier` name text to the `canWrapProperty` function.
  • Loading branch information
alan-agius4 authored and angular-robot[bot] committed Mar 10, 2023
1 parent 6190bce commit 4d82e0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -271,7 +271,7 @@ export default function (): PluginObj {
if (
elementKey.isIdentifier() &&
(!elementValue.isExpression() ||
canWrapProperty(elementKey.get('name'), elementValue))
canWrapProperty(elementKey.node.name, elementValue))
) {
shouldWrap = true;
} else {
Expand Down
Expand Up @@ -783,9 +783,9 @@ describe('adjust-static-class-members Babel plugin', () => {
class CommonModule {
static ɵfac = function CommonModule_Factory(t) { return new (t || CommonModule)(); };
static ɵmod = /*@__PURE__*/ ɵngcc0.ɵɵdefineNgModule({ type: CommonModule });
static ɵinj = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjector({ providers: [
{ provide: NgLocalization, useClass: NgLocaleLocalization },
] });
static ɵinj = ɵngcc0.ɵɵdefineInjector({ providers: [
{ provide: NgLocalization, useClass: NgLocaleLocalization },
] });
}
`,
expected: `
Expand All @@ -797,7 +797,7 @@ describe('adjust-static-class-members Babel plugin', () => {
static ɵmod = /*@__PURE__*/ ɵngcc0.ɵɵdefineNgModule({
type: CommonModule,
});
static ɵinj = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjector({
static ɵinj = ɵngcc0.ɵɵdefineInjector({
providers: [
{
provide: NgLocalization,
Expand Down

0 comments on commit 4d82e0d

Please sign in to comment.