Skip to content

Commit

Permalink
fix(@angular-devkit/build-optimizer): don't remove ɵɵsetNgModuleScope…
Browse files Browse the repository at this point in the history
… calls

These will be automatically removed after angular/angular#33671 lands because they are in a side-effect free IIFE.
  • Loading branch information
filipesilva authored and vikerman committed Nov 21, 2019
1 parent ed4bf6e commit 77b3981
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export function testScrubFile(content: string) {
'propDecorators',
'ctorParameters',
'ɵsetClassMetadata',
'ɵɵsetNgModuleScope',
];

return markers.some((marker) => content.indexOf(marker) !== -1);
Expand Down Expand Up @@ -313,8 +312,7 @@ function isIvyPrivateCallExpression(exprStmt: ts.ExpressionStatement) {
return false;
}

if (propAccExpr.name.text != 'ɵsetClassMetadata'
&& propAccExpr.name.text != 'ɵɵsetNgModuleScope') {
if (propAccExpr.name.text != 'ɵsetClassMetadata') {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,20 +735,5 @@ describe('scrub-file', () => {
expect(testScrubFile(input)).toBeTruthy();
expect(tags.oneLine`${transform(input)}`).toEqual(tags.oneLine`${output}`);
});

it('removes ɵɵsetNgModuleScope call', () => {
const output = tags.stripIndent`
import { CommonModule } from '@angular/common';
import * as i0 from "@angular/core";
${clazz}
`;
const input = tags.stripIndent`
${output}
/*@__PURE__*/ i0.ɵɵsetNgModuleScope(Clazz, { declarations: [], imports: [CommonModule] });
`;

expect(testScrubFile(input)).toBeTruthy();
expect(tags.oneLine`${transform(input)}`).toEqual(tags.oneLine`${output}`);
});
});
});

0 comments on commit 77b3981

Please sign in to comment.