@@ -4,18 +4,21 @@ import * as fs from 'node:fs/promises';
4
4
import * as path from 'node:path' ;
5
5
6
6
import {
7
+ FederationInfo ,
8
+ ImportMap ,
9
+ InitFederationOptions ,
10
+ mergeImportMaps ,
7
11
processHostInfo ,
8
12
processRemoteInfos ,
9
- FederationInfo ,
10
13
} from '@softarc/native-federation-runtime' ;
11
- import { ImportMap , mergeImportMaps } from '@softarc/native-federation-runtime' ;
12
14
import { IMPORT_MAP_FILE_NAME } from '../utils/import-map-loader' ;
13
15
import { resolver } from '../utils/loader-as-data-url' ;
14
16
15
17
export type InitNodeFederationOptions = {
16
18
remotesOrManifestUrl : Record < string , string > | string ;
17
19
relBundlePath : string ;
18
20
throwIfRemoteNotFound : boolean ;
21
+ cacheTag ?: string ;
19
22
} ;
20
23
21
24
const defaultOptions : InitNodeFederationOptions = {
@@ -53,6 +56,7 @@ async function createNodeImportMap(
53
56
const hostImportMap = await processHostInfo ( hostInfo , relBundlePath ) ;
54
57
const remotesImportMap = await processRemoteInfos ( remotes , {
55
58
throwIfRemoteNotFound : options . throwIfRemoteNotFound ,
59
+ cacheTag : options . cacheTag ,
56
60
} ) ;
57
61
58
62
const importMap = mergeImportMaps ( hostImportMap , remotesImportMap ) ;
@@ -69,9 +73,13 @@ async function loadFsManifest(
69
73
}
70
74
71
75
async function loadFsFederationInfo (
72
- relBundlePath : string
76
+ relBundlePath : string ,
77
+ options ?: InitFederationOptions
73
78
) : Promise < FederationInfo > {
74
- const manifestPath = path . join ( relBundlePath , 'remoteEntry.json' ) ;
79
+ const manifestPath = path . join (
80
+ relBundlePath ,
81
+ 'remoteEntry.json' + options ?. cacheTag ? `?t=${ options . cacheTag } ` : ''
82
+ ) ;
75
83
const content = await fs . readFile ( manifestPath , 'utf-8' ) ;
76
84
const manifest = JSON . parse ( content ) as FederationInfo ;
77
85
return manifest ;
0 commit comments