@@ -35,7 +35,7 @@ export async function buildForFederation(
3535 config : NormalizedFederationConfig ,
3636 fedOptions : FederationOptions ,
3737 externals : string [ ] ,
38- buildParams = defaultBuildParams ,
38+ buildParams = defaultBuildParams
3939) : Promise < FederationInfo > {
4040 const signal = buildParams . signal ;
4141
@@ -47,16 +47,16 @@ export async function buildForFederation(
4747 config ,
4848 fedOptions ,
4949 externals ,
50- signal ,
50+ signal
5151 ) ;
5252 logger . measure (
5353 start ,
54- '[build artifacts] - To bundle all mappings and exposed.' ,
54+ '[build artifacts] - To bundle all mappings and exposed.'
5555 ) ;
5656
5757 if ( signal ?. aborted )
5858 throw new AbortedError (
59- '[buildForFederation] After exposed-and-mappings bundle' ,
59+ '[buildForFederation] After exposed-and-mappings bundle'
6060 ) ;
6161 }
6262
@@ -67,13 +67,13 @@ export async function buildForFederation(
6767 const cacheProjectFolder = normalizePackageName ( config . name ) ;
6868 if ( cacheProjectFolder . length < 1 ) {
6969 logger . warn (
70- "Project name in 'federation.config.js' is empty, defaulting to root cache folder." ,
70+ "Project name in 'federation.config.js' is empty, defaulting to root cache folder (could collide with other projects in the workspace)."
7171 ) ;
7272 }
7373
7474 const pathToCache = getCachePath (
7575 fedOptions . workspaceRoot ,
76- normalizePackageName ( config . name ) ,
76+ cacheProjectFolder
7777 ) ;
7878
7979 if ( ! buildParams . skipShared && sharedPackageInfoCache . length > 0 ) {
@@ -92,19 +92,19 @@ export async function buildForFederation(
9292 fedOptions ,
9393 externals ,
9494 'browser' ,
95- { pathToCache, bundleName : 'browser-shared' } ,
95+ { pathToCache, bundleName : 'browser-shared' }
9696 ) ;
9797
9898 logger . measure (
9999 start ,
100- '[build artifacts] - To bundle all shared browser externals' ,
100+ '[build artifacts] - To bundle all shared browser externals'
101101 ) ;
102102
103103 sharedPackageInfoCache . push ( ...sharedPackageInfoBrowser ) ;
104104
105105 if ( signal ?. aborted )
106106 throw new AbortedError (
107- '[buildForFederation] After shared-browser bundle' ,
107+ '[buildForFederation] After shared-browser bundle'
108108 ) ;
109109 }
110110
@@ -116,11 +116,11 @@ export async function buildForFederation(
116116 fedOptions ,
117117 externals ,
118118 'node' ,
119- { pathToCache, bundleName : 'node-shared' } ,
119+ { pathToCache, bundleName : 'node-shared' }
120120 ) ;
121121 logger . measure (
122122 start ,
123- '[build artifacts] - To bundle all shared node externals' ,
123+ '[build artifacts] - To bundle all shared node externals'
124124 ) ;
125125 sharedPackageInfoCache . push ( ...sharedPackageInfoServer ) ;
126126
@@ -136,17 +136,17 @@ export async function buildForFederation(
136136 config ,
137137 fedOptions ,
138138 'browser' ,
139- pathToCache ,
139+ pathToCache
140140 ) ;
141141 logger . measure (
142142 start ,
143- '[build artifacts] - To bundle all separate browser externals' ,
143+ '[build artifacts] - To bundle all separate browser externals'
144144 ) ;
145145 sharedPackageInfoCache . push ( ...separatePackageInfoBrowser ) ;
146146
147147 if ( signal ?. aborted )
148148 throw new AbortedError (
149- '[buildForFederation] After separate-browser bundle' ,
149+ '[buildForFederation] After separate-browser bundle'
150150 ) ;
151151 }
152152
@@ -158,11 +158,11 @@ export async function buildForFederation(
158158 config ,
159159 fedOptions ,
160160 'node' ,
161- pathToCache ,
161+ pathToCache
162162 ) ;
163163 logger . measure (
164164 start ,
165- '[build artifacts] - To bundle all separate node externals' ,
165+ '[build artifacts] - To bundle all separate node externals'
166166 ) ;
167167 sharedPackageInfoCache . push ( ...separatePackageInfoServer ) ;
168168 }
@@ -214,13 +214,13 @@ async function bundleSeparate(
214214 config : NormalizedFederationConfig ,
215215 fedOptions : FederationOptions ,
216216 platform : 'node' | 'browser' ,
217- pathToCache : string ,
217+ pathToCache : string
218218) {
219219 const bundlePromises = Object . entries ( separateBrowser ) . map (
220220 async ( [ key , shared ] ) => {
221221 const packageName = inferPackageFromSecondary ( key ) ;
222222 const filteredExternals = externals . filter (
223- ( e ) => ! e . startsWith ( packageName ) ,
223+ ( e ) => ! e . startsWith ( packageName )
224224 ) ;
225225 return bundleShared (
226226 { [ key ] : shared } ,
@@ -231,17 +231,17 @@ async function bundleSeparate(
231231 {
232232 pathToCache,
233233 bundleName : `${ platform } -${ normalizePackageName ( key ) } ` ,
234- } ,
234+ }
235235 ) ;
236- } ,
236+ }
237237 ) ;
238238
239239 const buildResults = await Promise . all ( bundlePromises ) ;
240240 return buildResults . flat ( ) ;
241241}
242242
243243function splitShared (
244- shared : Record < string , NormalizedSharedConfig > ,
244+ shared : Record < string , NormalizedSharedConfig >
245245) : SplitSharedResult {
246246 const sharedServer : Record < string , NormalizedSharedConfig > = { } ;
247247 const sharedBrowser : Record < string , NormalizedSharedConfig > = { } ;
0 commit comments