@@ -10,10 +10,7 @@ import babel from '@babel/core';
1010import { createEs2015LinkerPlugin } from '@angular/compiler-cli/linker/babel' ;
1111import { ConsoleLogger , NodeJSFileSystem , LogLevel } from '@angular/compiler-cli' ;
1212import { 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' ;
1714import fs from 'fs' ;
1815
1916/** Babel plugin running the Angular linker. */
@@ -35,17 +32,17 @@ const esbuildBabelOptimizePlugin = {
3532 const content = await fs . promises . readFile ( filePath , 'utf8' ) ;
3633 const plugins = [
3734 linkerBabelPlugin ,
38- adjustStaticClassMembersPlugin ,
39- elideAngularMetadataPlugin ,
40- adjustTypeScriptEnumsPlugin ,
35+ ngBuild . adjustStaticMembers ,
36+ ngBuild . elideAngularMetadata ,
37+ ngBuild . adjustTypeScriptEnums ,
4138 ] ;
4239
4340 // All files except for the auto-generated module entry-point are considered side-effect
4441 // free. For these we can add the pure-top level Babel plugin. This matches conceptually
4542 // with what is done in the Angular CLI compilation pipeline, with respect to everything
4643 // in this repo being an official side-effect free APF package.
4744 if ( ! args . path . includes ( 'autogenerated_module_index.mjs' ) ) {
48- plugins . push ( pureToplevelFunctionsPlugin ) ;
45+ plugins . push ( ngBuild . markTopLevelPure ) ;
4946 }
5047
5148 const { code} = await babel . transformAsync ( content , {
0 commit comments