@@ -3,6 +3,7 @@ import {spawn} from 'child_process';
3
3
import { readFileSync , writeFileSync } from 'fs' ;
4
4
import { sync as glob } from 'glob' ;
5
5
import { join } from 'path' ;
6
+ import { main as ngc } from '@angular/tsc-wrapped' ;
6
7
import { PackageBundler } from './build-bundles' ;
7
8
import { buildConfig } from './build-config' ;
8
9
import { getSecondaryEntryPointsForPackage } from './secondary-entry-points' ;
@@ -82,7 +83,7 @@ export class BuildPackage {
82
83
83
84
/** Compiles the TypeScript test source files for the package. */
84
85
async compileTests ( ) {
85
- await this . _compileEntryPoint ( testsTsconfigName ) ;
86
+ await this . _compileTestEntryPoint ( testsTsconfigName ) ;
86
87
}
87
88
88
89
/** Creates all bundles for the package and all associated entry points. */
@@ -108,6 +109,15 @@ export class BuildPackage {
108
109
. then ( ( ) => this . renamePrivateReExportsToBeUnique ( secondaryEntryPoint ) ) ;
109
110
}
110
111
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
+
111
121
/** Renames `ɵa`-style re-exports generated by Angular to be unique across compilation units. */
112
122
private renamePrivateReExportsToBeUnique ( secondaryEntryPoint = '' ) {
113
123
// When we compiled the typescript sources with ngc, we do entry-point individually.
0 commit comments