This repository was archived by the owner on Apr 4, 2025. It is now read-only.
File tree 2 files changed +3
-35
lines changed
packages/angular_devkit/build_optimizer/src/build-optimizer
2 files changed +3
-35
lines changed Original file line number Diff line number Diff line change @@ -37,30 +37,16 @@ const whitelistedAngularModules = [
37
37
/ [ \\ / ] n o d e _ m o d u l e s [ \\ / ] @ a n g u l a r [ \\ / ] c d k [ \\ / ] / ,
38
38
] ;
39
39
40
- // TODO: this code is very fragile and should be reworked.
41
- // See: https://github.com/angular/devkit/issues/523
42
- const es5AngularModules = [
43
- // Angular 4 packaging format has .es5.js as the extension.
44
- / \. e s 5 \. j s $ / , // Angular 4
45
- // Angular 5 has esm5 folders.
46
- // Angular 6 has fesm5 folders.
47
- / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] @ a n g u l a r [ \\ / ] [ ^ \\ / ] + [ \\ / ] f ? e s m 5 [ \\ / ] / ,
48
- // All Angular versions have UMD with es5.
49
- / \. u m d \. j s $ / ,
50
- ] ;
51
-
52
- // Factories created by AOT are known to have no side effects and contain es5 code.
40
+ // Factories created by AOT are known to have no side effects.
53
41
// In Angular 2/4 the file path for factories can be `.ts`, but in Angular 5 it is `.js`.
54
42
const ngFactories = [
55
43
/ \. n g f a c t o r y \. [ j t ] s / ,
56
44
/ \. n g s t y l e \. [ j t ] s / ,
57
45
] ;
58
46
59
47
function isKnownSideEffectFree ( filePath : string ) {
60
- return ngFactories . some ( ( re ) => re . test ( filePath ) ) || (
61
- whitelistedAngularModules . some ( ( re ) => re . test ( filePath ) )
62
- && es5AngularModules . some ( ( re ) => re . test ( filePath ) )
63
- ) ;
48
+ return ngFactories . some ( ( re ) => re . test ( filePath ) ) ||
49
+ whitelistedAngularModules . some ( ( re ) => re . test ( filePath ) ) ;
64
50
}
65
51
66
52
export interface BuildOptimizerOptions {
Original file line number Diff line number Diff line change @@ -89,24 +89,6 @@ describe('build-optimizer', () => {
89
89
} ) ;
90
90
} ) ;
91
91
92
- it ( 'supports es2015 modules' , ( ) => {
93
- // prefix-functions would add PURE_IMPORTS_START and PURE to the super call.
94
- // This test ensures it isn't applied to es2015 modules.
95
- const output = tags . oneLine `
96
- import { Injectable } from '@angular/core';
97
- class Clazz extends BaseClazz { constructor(e) { super(e); } }
98
- ` ;
99
- const input = tags . stripIndent `
100
- ${ output }
101
- Clazz.ctorParameters = () => [ { type: Injectable } ];
102
- ` ;
103
-
104
- const inputFilePath = '/node_modules/@angular/core/@angular/core.js' ;
105
- const boOutput = buildOptimizer ( { content : input , inputFilePath } ) ;
106
- expect ( tags . oneLine `${ boOutput . content } ` ) . toEqual ( output ) ;
107
- expect ( boOutput . emitSkipped ) . toEqual ( false ) ;
108
- } ) ;
109
-
110
92
it ( 'supports flagging module as side-effect free' , ( ) => {
111
93
const output = tags . oneLine `
112
94
/** PURE_IMPORTS_START PURE_IMPORTS_END */
You can’t perform that action at this time.
0 commit comments