@@ -166,7 +166,7 @@ class DTSManager {
166
166
logger . success ( 'Federated types created correctly' ) ;
167
167
} catch ( error ) {
168
168
if ( this . options . remote ?. abortOnError === false ) {
169
- logger . error ( `Unable to compile federated types, ${ error } ` ) ;
169
+ logger . error ( `Unable to compile federated types${ error } ` ) ;
170
170
} else {
171
171
throw error ;
172
172
}
@@ -263,10 +263,11 @@ class DTSManager {
263
263
const filePath = path . join ( destinationPath , REMOTE_API_TYPES_FILE_NAME ) ;
264
264
fs . writeFileSync ( filePath , apiTypeFile ) ;
265
265
this . loadedRemoteAPIAlias . add ( remoteInfo . alias ) ;
266
+ fileLog ( `success` , 'downloadAPITypes' , 'info' ) ;
266
267
} catch ( err ) {
267
268
fileLog (
268
269
`Unable to download "${ remoteInfo . name } " api types, ${ err } ` ,
269
- 'consumeTargetRemotes ' ,
270
+ 'downloadAPITypes ' ,
270
271
'error' ,
271
272
) ;
272
273
}
@@ -420,17 +421,17 @@ class DTSManager {
420
421
421
422
async updateTypes ( options : UpdateTypesOptions ) : Promise < void > {
422
423
try {
423
- // can use remoteTarPath directly in the future
424
424
const {
425
425
remoteName,
426
426
updateMode,
427
+ remoteTarPath,
427
428
remoteInfo : updatedRemoteInfo ,
428
429
once,
429
430
} = options ;
430
431
const hostName = this . options ?. host ?. moduleFederationConfig ?. name ;
431
432
fileLog (
432
- `updateTypes options:, ${ JSON . stringify ( options , null , 2 ) } ` ,
433
- 'consumeTypes ' ,
433
+ `options: ${ JSON . stringify ( options , null , 2 ) } ;\nhostName: ${ hostName } ` ,
434
+ 'updateTypes ' ,
434
435
'info' ,
435
436
) ;
436
437
if ( updateMode === UpdateMode . POSITIVE && remoteName === hostName ) {
@@ -454,19 +455,39 @@ class DTSManager {
454
455
const consumeTypes = async (
455
456
requiredRemoteInfo : Required < RemoteInfo > ,
456
457
) => {
458
+ fileLog ( `consumeTypes start` , 'updateTypes' , 'info' ) ;
459
+ if ( ! requiredRemoteInfo . zipUrl ) {
460
+ throw new Error (
461
+ `Can not get ${ requiredRemoteInfo . name } 's types archive url!` ,
462
+ ) ;
463
+ }
457
464
const [ _alias , destinationPath ] = await this . consumeTargetRemotes (
458
465
hostOptions ,
459
- requiredRemoteInfo ,
466
+ {
467
+ ...requiredRemoteInfo ,
468
+ // use remoteTarPath first
469
+ zipUrl : remoteTarPath || requiredRemoteInfo . zipUrl ,
470
+ } ,
460
471
) ;
461
472
await this . downloadAPITypes ( requiredRemoteInfo , destinationPath ) ;
473
+ fileLog ( `consumeTypes end` , 'updateTypes' , 'info' ) ;
462
474
} ;
463
-
475
+ fileLog (
476
+ `loadedRemoteInfo: ${ JSON . stringify ( loadedRemoteInfo , null , 2 ) } ` ,
477
+ 'updateTypes' ,
478
+ 'info' ,
479
+ ) ;
464
480
if ( ! loadedRemoteInfo ) {
465
481
const remoteInfo = Object . values ( mapRemotesToDownload ) . find (
466
482
( item ) => {
467
483
return item . name === remoteName ;
468
484
} ,
469
485
) ;
486
+ fileLog (
487
+ `remoteInfo: ${ JSON . stringify ( remoteInfo , null , 2 ) } ` ,
488
+ 'updateTypes' ,
489
+ 'info' ,
490
+ ) ;
470
491
if ( remoteInfo ) {
471
492
if ( ! this . remoteAliasMap [ remoteInfo . alias ] ) {
472
493
const requiredRemoteInfo =
@@ -496,7 +517,7 @@ class DTSManager {
496
517
null ,
497
518
2 ,
498
519
) } `,
499
- 'consumeTypes ' ,
520
+ 'updateTypes ' ,
500
521
'info' ,
501
522
) ;
502
523
await consumeDynamicRemoteTypes ( ) ;
0 commit comments