@@ -166,7 +166,7 @@ class DTSManager {
166166 logger . success ( 'Federated types created correctly' ) ;
167167 } catch ( error ) {
168168 if ( this . options . remote ?. abortOnError === false ) {
169- logger . error ( `Unable to compile federated types, ${ error } ` ) ;
169+ logger . error ( `Unable to compile federated types${ error } ` ) ;
170170 } else {
171171 throw error ;
172172 }
@@ -263,10 +263,11 @@ class DTSManager {
263263 const filePath = path . join ( destinationPath , REMOTE_API_TYPES_FILE_NAME ) ;
264264 fs . writeFileSync ( filePath , apiTypeFile ) ;
265265 this . loadedRemoteAPIAlias . add ( remoteInfo . alias ) ;
266+ fileLog ( `success` , 'downloadAPITypes' , 'info' ) ;
266267 } catch ( err ) {
267268 fileLog (
268269 `Unable to download "${ remoteInfo . name } " api types, ${ err } ` ,
269- 'consumeTargetRemotes ' ,
270+ 'downloadAPITypes ' ,
270271 'error' ,
271272 ) ;
272273 }
@@ -420,17 +421,17 @@ class DTSManager {
420421
421422 async updateTypes ( options : UpdateTypesOptions ) : Promise < void > {
422423 try {
423- // can use remoteTarPath directly in the future
424424 const {
425425 remoteName,
426426 updateMode,
427+ remoteTarPath,
427428 remoteInfo : updatedRemoteInfo ,
428429 once,
429430 } = options ;
430431 const hostName = this . options ?. host ?. moduleFederationConfig ?. name ;
431432 fileLog (
432- `updateTypes options:, ${ JSON . stringify ( options , null , 2 ) } ` ,
433- 'consumeTypes ' ,
433+ `options: ${ JSON . stringify ( options , null , 2 ) } ;\nhostName: ${ hostName } ` ,
434+ 'updateTypes ' ,
434435 'info' ,
435436 ) ;
436437 if ( updateMode === UpdateMode . POSITIVE && remoteName === hostName ) {
@@ -454,19 +455,39 @@ class DTSManager {
454455 const consumeTypes = async (
455456 requiredRemoteInfo : Required < RemoteInfo > ,
456457 ) => {
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+ }
457464 const [ _alias , destinationPath ] = await this . consumeTargetRemotes (
458465 hostOptions ,
459- requiredRemoteInfo ,
466+ {
467+ ...requiredRemoteInfo ,
468+ // use remoteTarPath first
469+ zipUrl : remoteTarPath || requiredRemoteInfo . zipUrl ,
470+ } ,
460471 ) ;
461472 await this . downloadAPITypes ( requiredRemoteInfo , destinationPath ) ;
473+ fileLog ( `consumeTypes end` , 'updateTypes' , 'info' ) ;
462474 } ;
463-
475+ fileLog (
476+ `loadedRemoteInfo: ${ JSON . stringify ( loadedRemoteInfo , null , 2 ) } ` ,
477+ 'updateTypes' ,
478+ 'info' ,
479+ ) ;
464480 if ( ! loadedRemoteInfo ) {
465481 const remoteInfo = Object . values ( mapRemotesToDownload ) . find (
466482 ( item ) => {
467483 return item . name === remoteName ;
468484 } ,
469485 ) ;
486+ fileLog (
487+ `remoteInfo: ${ JSON . stringify ( remoteInfo , null , 2 ) } ` ,
488+ 'updateTypes' ,
489+ 'info' ,
490+ ) ;
470491 if ( remoteInfo ) {
471492 if ( ! this . remoteAliasMap [ remoteInfo . alias ] ) {
472493 const requiredRemoteInfo =
@@ -496,7 +517,7 @@ class DTSManager {
496517 null ,
497518 2 ,
498519 ) } `,
499- 'consumeTypes ' ,
520+ 'updateTypes ' ,
500521 'info' ,
501522 ) ;
502523 await consumeDynamicRemoteTypes ( ) ;
0 commit comments