@@ -3,6 +3,7 @@ import {spawn} from 'child_process';
33import { readFileSync , writeFileSync } from 'fs' ;
44import { sync as glob } from 'glob' ;
55import { join } from 'path' ;
6+ import { main as ngc } from '@angular/tsc-wrapped' ;
67import { PackageBundler } from './build-bundles' ;
78import { buildConfig } from './build-config' ;
89import { getSecondaryEntryPointsForPackage } from './secondary-entry-points' ;
@@ -82,7 +83,7 @@ export class BuildPackage {
8283
8384 /** Compiles the TypeScript test source files for the package. */
8485 async compileTests ( ) {
85- await this . _compileEntryPoint ( testsTsconfigName ) ;
86+ await this . _compileTestEntryPoint ( testsTsconfigName ) ;
8687 }
8788
8889 /** Creates all bundles for the package and all associated entry points. */
@@ -108,6 +109,15 @@ export class BuildPackage {
108109 . then ( ( ) => this . renamePrivateReExportsToBeUnique ( secondaryEntryPoint ) ) ;
109110 }
110111
112+ /** Compiles the TypeScript sources of a primary or secondary entry point. */
113+ private async _compileTestEntryPoint ( tsconfigName : string , secondaryEntryPoint = '' ) {
114+ const entryPointPath = join ( this . sourceDir , secondaryEntryPoint ) ;
115+ const entryPointTsconfigPath = join ( entryPointPath , tsconfigName ) ;
116+
117+ await ngc ( entryPointTsconfigPath , { basePath : entryPointPath } ) ;
118+ this . renamePrivateReExportsToBeUnique ( secondaryEntryPoint ) ;
119+ }
120+
111121 /** Renames `ɵa`-style re-exports generated by Angular to be unique across compilation units. */
112122 private renamePrivateReExportsToBeUnique ( secondaryEntryPoint = '' ) {
113123 // When we compiled the typescript sources with ngc, we do entry-point individually.
0 commit comments