@@ -5,7 +5,6 @@ import { SharedConfig } from './federation-config';
55import {
66 DEFAULT_SKIP_LIST ,
77 isInSkipList ,
8- PREPARED_DEFAULT_SKIP_LIST ,
98 PreparedSkipList ,
109 prepareSkipList ,
1110 SkipList ,
@@ -17,7 +16,6 @@ import {
1716} from '../utils/package-info' ;
1817import { getConfigContext } from './configuration-context' ;
1918import { logger } from '../utils/logger' ;
20- import { resolveGlobSync } from '../utils/resolve-glob' ;
2119
2220import {
2321 KeyValuePair ,
@@ -26,7 +24,7 @@ import {
2624
2725let inferVersion = false ;
2826
29- export const DEFAULT_SECONARIES_SKIP_LIST = [
27+ export const DEFAULT_SECONDARIES_SKIP_LIST = [
3028 '@angular/router/upgrade' ,
3129 '@angular/common/upgrade' ,
3230] ;
@@ -110,7 +108,8 @@ function _findSecondaries(
110108 libPath : string ,
111109 excludes : string [ ] ,
112110 shareObject : SharedConfig ,
113- acc : Record < string , SharedConfig >
111+ acc : Record < string , SharedConfig > ,
112+ preparedSkipList : PreparedSkipList
114113) : void {
115114 const files = fs . readdirSync ( libPath ) ;
116115
@@ -129,34 +128,36 @@ function _findSecondaries(
129128 continue ;
130129 }
131130
132- if ( isInSkipList ( secondaryLibName , PREPARED_DEFAULT_SKIP_LIST ) ) {
131+ if ( isInSkipList ( secondaryLibName , preparedSkipList ) ) {
133132 continue ;
134133 }
135134
136135 acc [ secondaryLibName ] = { ...shareObject } ;
137136 }
138137
139- _findSecondaries ( s , excludes , shareObject , acc ) ;
138+ _findSecondaries ( s , excludes , shareObject , acc , preparedSkipList ) ;
140139 }
141140}
142141
143142function findSecondaries (
144143 libPath : string ,
145144 excludes : string [ ] ,
146- shareObject : SharedConfig
145+ shareObject : SharedConfig ,
146+ preparedSkipList : PreparedSkipList
147147) : Record < string , SharedConfig > {
148148 const acc = { } as Record < string , SharedConfig > ;
149- _findSecondaries ( libPath , excludes , shareObject , acc ) ;
149+ _findSecondaries ( libPath , excludes , shareObject , acc , preparedSkipList ) ;
150150 return acc ;
151151}
152152
153153function getSecondaries (
154154 includeSecondaries : IncludeSecondariesOptions ,
155155 libPath : string ,
156156 key : string ,
157- shareObject : SharedConfig
157+ shareObject : SharedConfig ,
158+ preparedSkipList : PreparedSkipList
158159) : Record < string , SharedConfig > | null {
159- let exclude = [ ...DEFAULT_SECONARIES_SKIP_LIST ] ;
160+ let exclude = [ ...DEFAULT_SECONDARIES_SKIP_LIST ] ;
160161
161162 if ( typeof includeSecondaries === 'object' ) {
162163 if ( Array . isArray ( includeSecondaries . skip ) ) {
@@ -176,22 +177,29 @@ function getSecondaries(
176177 key ,
177178 libPath ,
178179 exclude ,
179- shareObject
180+ shareObject ,
181+ preparedSkipList
180182 ) ;
181183 if ( configured ) {
182184 return configured ;
183185 }
184186
185187 // Fallback: Search folders
186- const secondaries = findSecondaries ( libPath , exclude , shareObject ) ;
188+ const secondaries = findSecondaries (
189+ libPath ,
190+ exclude ,
191+ shareObject ,
192+ preparedSkipList
193+ ) ;
187194 return secondaries ;
188195}
189196
190197function readConfiguredSecondaries (
191198 parent : string ,
192199 libPath : string ,
193200 exclude : string [ ] ,
194- shareObject : SharedConfig
201+ shareObject : SharedConfig ,
202+ preparedSkipList : PreparedSkipList
195203) : Record < string , SharedConfig > | null {
196204 const libPackageJson = path . join ( libPath , 'package.json' ) ;
197205
@@ -232,7 +240,7 @@ function readConfiguredSecondaries(
232240 continue ;
233241 }
234242
235- if ( isInSkipList ( secondaryName , PREPARED_DEFAULT_SKIP_LIST ) ) {
243+ if ( isInSkipList ( secondaryName , preparedSkipList ) ) {
236244 continue ;
237245 }
238246
@@ -350,10 +358,9 @@ export function shareAll(
350358
351359 const versionMaps = getVersionMaps ( projectPath , projectPath ) ;
352360 const share : Record < string , unknown > = { } ;
361+ const preparedSkipList = prepareSkipList ( skip ) ;
353362
354363 for ( const versions of versionMaps ) {
355- const preparedSkipList = prepareSkipList ( skip ) ;
356-
357364 for ( const key in versions ) {
358365 if ( isInSkipList ( key , preparedSkipList ) ) {
359366 continue ;
@@ -561,7 +568,8 @@ export function share(
561568 includeSecondaries ,
562569 libPath ,
563570 key ,
564- shareObject
571+ shareObject ,
572+ preparedSkipList
565573 ) ;
566574 if ( secondaries ) {
567575 addSecondaries ( secondaries , result ) ;
0 commit comments