@@ -10,10 +10,7 @@ import babel from '@babel/core';
10
10
import { createEs2015LinkerPlugin } from '@angular/compiler-cli/linker/babel' ;
11
11
import { ConsoleLogger , NodeJSFileSystem , LogLevel } from '@angular/compiler-cli' ;
12
12
import { GLOBAL_DEFS_FOR_TERSER_WITH_AOT } from '@angular/compiler-cli/private/tooling' ;
13
- import adjustStaticClassMembersPlugin from '@angular-devkit/build-angular/src/babel/plugins/adjust-static-class-members.js' ;
14
- import elideAngularMetadataPlugin from '@angular-devkit/build-angular/src/babel/plugins/elide-angular-metadata.js' ;
15
- import adjustTypeScriptEnumsPlugin from '@angular-devkit/build-angular/src/babel/plugins/adjust-typescript-enums.js' ;
16
- import pureToplevelFunctionsPlugin from '@angular-devkit/build-angular/src/babel/plugins/pure-toplevel-functions.js' ;
13
+ import ngBuild from '@angular/build/private' ;
17
14
import fs from 'fs' ;
18
15
19
16
/** Babel plugin running the Angular linker. */
@@ -35,17 +32,17 @@ const esbuildBabelOptimizePlugin = {
35
32
const content = await fs . promises . readFile ( filePath , 'utf8' ) ;
36
33
const plugins = [
37
34
linkerBabelPlugin ,
38
- adjustStaticClassMembersPlugin ,
39
- elideAngularMetadataPlugin ,
40
- adjustTypeScriptEnumsPlugin ,
35
+ ngBuild . adjustStaticMembers ,
36
+ ngBuild . elideAngularMetadata ,
37
+ ngBuild . adjustTypeScriptEnums ,
41
38
] ;
42
39
43
40
// All files except for the auto-generated module entry-point are considered side-effect
44
41
// free. For these we can add the pure-top level Babel plugin. This matches conceptually
45
42
// with what is done in the Angular CLI compilation pipeline, with respect to everything
46
43
// in this repo being an official side-effect free APF package.
47
44
if ( ! args . path . includes ( 'autogenerated_module_index.mjs' ) ) {
48
- plugins . push ( pureToplevelFunctionsPlugin ) ;
45
+ plugins . push ( ngBuild . markTopLevelPure ) ;
49
46
}
50
47
51
48
const { code} = await babel . transformAsync ( content , {
0 commit comments