@@ -74,37 +74,33 @@ async function main() {
74
74
async function findSpecFiles ( ) {
75
75
const baseTestFiles = glob . sync ( '**/*_spec.js' , { absolute : true , cwd : legacyOutputDir } ) ;
76
76
77
- return multimatch (
78
- baseTestFiles ,
79
- [
80
- '**/*' ,
81
- `!${ legacyOutputDir } /_testing_init/**` ,
82
- `!${ legacyOutputDir } /**/e2e_test/**` ,
83
- `!${ legacyOutputDir } /**/*node_only_spec.js` ,
84
- `!${ legacyOutputDir } /benchpress/**` ,
85
- `!${ legacyOutputDir } /compiler-cli/**` ,
86
- `!${ legacyOutputDir } /compiler-cli/src/ngtsc/**` ,
87
- `!${ legacyOutputDir } /compiler-cli/test/compliance/**` ,
88
- `!${ legacyOutputDir } /compiler-cli/test/ngtsc/**` ,
89
- `!${ legacyOutputDir } /compiler/test/aot/**` ,
90
- `!${ legacyOutputDir } /compiler/test/render3/**` ,
91
- `!${ legacyOutputDir } /core/test/bundling/**` ,
92
- `!${ legacyOutputDir } /core/schematics/test/**` ,
93
- `!${ legacyOutputDir } /core/test/render3/ivy/**` ,
94
- `!${ legacyOutputDir } /core/test/render3/jit/**` ,
95
- `!${ legacyOutputDir } /core/test/render3/perf/**` ,
96
- `!${ legacyOutputDir } /elements/schematics/**` ,
97
- `!${ legacyOutputDir } /examples/**/e2e_test/*` ,
98
- `!${ legacyOutputDir } /language-service/**` ,
99
- `!${ legacyOutputDir } /platform-server/**` ,
100
- `!${ legacyOutputDir } /localize/**/test/**` ,
101
- `!${ legacyOutputDir } /localize/schematics/**` ,
102
- `!${ legacyOutputDir } /router/**/test/**` ,
103
- `!${ legacyOutputDir } /zone.js/**/test/**` ,
104
- `!${ legacyOutputDir } /platform-browser/testing/e2e_util.js` ,
105
-
106
- ]
107
- ) ;
77
+ return multimatch ( baseTestFiles , [
78
+ '**/*' ,
79
+ `!${ legacyOutputDir } /_testing_init/**` ,
80
+ `!${ legacyOutputDir } /**/e2e_test/**` ,
81
+ `!${ legacyOutputDir } /**/*node_only_spec.js` ,
82
+ `!${ legacyOutputDir } /benchpress/**` ,
83
+ `!${ legacyOutputDir } /compiler-cli/**` ,
84
+ `!${ legacyOutputDir } /compiler-cli/src/ngtsc/**` ,
85
+ `!${ legacyOutputDir } /compiler-cli/test/compliance/**` ,
86
+ `!${ legacyOutputDir } /compiler-cli/test/ngtsc/**` ,
87
+ `!${ legacyOutputDir } /compiler/test/aot/**` ,
88
+ `!${ legacyOutputDir } /compiler/test/render3/**` ,
89
+ `!${ legacyOutputDir } /core/test/bundling/**` ,
90
+ `!${ legacyOutputDir } /core/schematics/test/**` ,
91
+ `!${ legacyOutputDir } /core/test/render3/ivy/**` ,
92
+ `!${ legacyOutputDir } /core/test/render3/jit/**` ,
93
+ `!${ legacyOutputDir } /core/test/render3/perf/**` ,
94
+ `!${ legacyOutputDir } /elements/schematics/**` ,
95
+ `!${ legacyOutputDir } /examples/**/e2e_test/*` ,
96
+ `!${ legacyOutputDir } /language-service/**` ,
97
+ `!${ legacyOutputDir } /platform-server/**` ,
98
+ `!${ legacyOutputDir } /localize/**/test/**` ,
99
+ `!${ legacyOutputDir } /localize/schematics/**` ,
100
+ `!${ legacyOutputDir } /router/**/test/**` ,
101
+ `!${ legacyOutputDir } /zone.js/**/test/**` ,
102
+ `!${ legacyOutputDir } /platform-browser/testing/e2e_util.js` ,
103
+ ] ) ;
108
104
}
109
105
110
106
/**
@@ -149,13 +145,16 @@ async function createResolveEsbuildPlugin() {
149
145
const resolveMappings = new Map ( [
150
146
[ / @ a n g u l a r \/ / , `${ legacyOutputDir } /` ] ,
151
147
[ / ^ a n g u l a r - i n - m e m o r y - w e b - a p i $ / , join ( legacyOutputDir , 'misc/angular-in-memory-web-api' ) ] ,
148
+ [ / ^ z o n e .j s \/ / , `${ legacyOutputDir } /zone.js/` ] ,
152
149
] ) ;
153
150
154
151
return {
155
- name : 'ng-resolve-esbuild' , setup : ( build ) => {
156
- build . onResolve ( { filter : / ( @ a n g u l a r \/ | a n g u l a r - i n - m e m o r y - w e b - a p i ) / } , async ( args ) => {
157
- const matchedPattern = Array . from ( resolveMappings . keys ( ) ) . find (
158
- pattern => args . path . match ( pattern ) ) ;
152
+ name : 'ng-resolve-esbuild' ,
153
+ setup : ( build ) => {
154
+ build . onResolve ( { filter : / ( @ a n g u l a r \/ | a n g u l a r - i n - m e m o r y - w e b - a p i | z o n e .j s ) / } , async ( args ) => {
155
+ const matchedPattern = Array . from ( resolveMappings . keys ( ) ) . find ( ( pattern ) =>
156
+ args . path . match ( pattern )
157
+ ) ;
159
158
160
159
if ( matchedPattern === undefined ) {
161
160
return undefined ;
@@ -177,7 +176,7 @@ async function createResolveEsbuildPlugin() {
177
176
178
177
return stats !== null ? { path : resolvedPath } : undefined ;
179
178
} ) ;
180
- }
179
+ } ,
181
180
} ;
182
181
}
183
182
@@ -210,9 +209,10 @@ async function transpileDecoratorDownlevelTransform() {
210
209
* Compiles the project using the TypeScript compiler in order to produce
211
210
* JS output of the packages and tests.
212
211
*/
213
- async function compileProjectWithTsc ( ) {
212
+ async function compileProjectWithTsc ( ) {
214
213
const { legacyCompilationDownlevelDecoratorTransform} = await import (
215
- url . pathToFileURL ( decoratorDownlevelOutFile ) ) ;
214
+ url . pathToFileURL ( decoratorDownlevelOutFile )
215
+ ) ;
216
216
const config = parseTsconfigFile ( legacyTsconfigPath , dirname ( legacyTsconfigPath ) ) ;
217
217
const program = ts . createProgram ( config . fileNames , config . options ) ;
218
218
@@ -225,15 +225,17 @@ async function transpileDecoratorDownlevelTransform() {
225
225
const diagnostics = [
226
226
...result . diagnostics ,
227
227
...program . getSyntacticDiagnostics ( ) ,
228
- ...program . getSemanticDiagnostics ( )
228
+ ...program . getSemanticDiagnostics ( ) ,
229
229
] ;
230
230
231
231
if ( diagnostics . length ) {
232
- console . error ( ts . formatDiagnosticsWithColorAndContext ( diagnostics , {
233
- getCanonicalFileName : fileName => fileName ,
234
- getCurrentDirectory : ( ) => program . getCurrentDirectory ( ) ,
235
- getNewLine : ( ) => '\n' ,
236
- } ) ) ;
232
+ console . error (
233
+ ts . formatDiagnosticsWithColorAndContext ( diagnostics , {
234
+ getCanonicalFileName : ( fileName ) => fileName ,
235
+ getCurrentDirectory : ( ) => program . getCurrentDirectory ( ) ,
236
+ getNewLine : ( ) => '\n' ,
237
+ } )
238
+ ) ;
237
239
238
240
throw new Error ( 'Compilation failed. See errors above.' ) ;
239
241
}
@@ -261,7 +263,6 @@ function parseTsconfigFile(tsconfigPath, basePath) {
261
263
return ts . parseJsonConfigFileContent ( config , parseConfigHost , basePath , { } ) ;
262
264
}
263
265
264
-
265
266
/**
266
267
* Retrieves the `fs.Stats` results for the given path gracefully.
267
268
* If the file does not exist, returns `null`.
@@ -274,7 +275,7 @@ async function statGraceful(path) {
274
275
}
275
276
}
276
277
277
- main ( ) . catch ( e => {
278
+ main ( ) . catch ( ( e ) => {
278
279
console . error ( e ) ;
279
280
process . exitCode = 1 ;
280
281
} ) ;
0 commit comments