From 77b39819cb19eacaf5cdbac853262d4950bd9e33 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Tue, 19 Nov 2019 10:52:01 +0000 Subject: [PATCH] =?UTF-8?q?fix(@angular-devkit/build-optimizer):=20don't?= =?UTF-8?q?=20remove=20=C9=B5=C9=B5setNgModuleScope=20calls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These will be automatically removed after https://github.com/angular/angular/pull/33671 lands because they are in a side-effect free IIFE. --- .../build_optimizer/src/transforms/scrub-file.ts | 4 +--- .../src/transforms/scrub-file_spec.ts | 15 --------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/packages/angular_devkit/build_optimizer/src/transforms/scrub-file.ts b/packages/angular_devkit/build_optimizer/src/transforms/scrub-file.ts index 9bf57689d111..4dac89e1b332 100644 --- a/packages/angular_devkit/build_optimizer/src/transforms/scrub-file.ts +++ b/packages/angular_devkit/build_optimizer/src/transforms/scrub-file.ts @@ -18,7 +18,6 @@ export function testScrubFile(content: string) { 'propDecorators', 'ctorParameters', 'ɵsetClassMetadata', - 'ɵɵsetNgModuleScope', ]; return markers.some((marker) => content.indexOf(marker) !== -1); @@ -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; } diff --git a/packages/angular_devkit/build_optimizer/src/transforms/scrub-file_spec.ts b/packages/angular_devkit/build_optimizer/src/transforms/scrub-file_spec.ts index 1ef06dc0c2f8..d1d07b811201 100644 --- a/packages/angular_devkit/build_optimizer/src/transforms/scrub-file_spec.ts +++ b/packages/angular_devkit/build_optimizer/src/transforms/scrub-file_spec.ts @@ -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}`); - }); }); });