@@ -101,15 +101,15 @@ export function extractFunctionEntries(
101101 * @param root the root of the dependency tree
102102 * @param rootDeps array of top level root dependencies to whitelist
103103 */
104- export const flatDep = ( root : DependencyMap , rootDepsFilter : string [ ] ) : string [ ] => {
104+ export const flatDep = ( root : DependencyMap , rootDepsFilter : string [ ] , excludes : "*" | string [ ] ) : string [ ] => {
105105 const flattenedDependencies = new Set < string > ( ) ;
106106
107107 /**
108108 *
109109 * @param deps the current tree
110110 * @param filter the dependencies to get from this tree
111111 */
112- const recursiveFind = ( deps : DependencyMap | undefined , filter ?: string [ ] ) => {
112+ const recursiveFind = ( deps : DependencyMap | undefined , filter ?: string [ ] , excludes ?: "*" | string [ ] ) => {
113113 if ( ! deps ) return ;
114114
115115 Object . entries ( deps ) . forEach ( ( [ depName , details ] ) => {
@@ -120,7 +120,7 @@ export const flatDep = (root: DependencyMap, rootDepsFilter: string[]): string[]
120120
121121 if ( details . isRootDep || filter ) {
122122 // We already have this root dep and it's dependencies - skip this iteration
123- if ( flattenedDependencies . has ( depName ) ) {
123+ if ( flattenedDependencies . has ( depName ) || ( excludes && excludes != "*" && excludes . includes ( depName ) ) ) {
124124 return ;
125125 }
126126
@@ -139,7 +139,7 @@ export const flatDep = (root: DependencyMap, rootDepsFilter: string[]): string[]
139139 } ) ;
140140 } ;
141141
142- recursiveFind ( root , rootDepsFilter ) ;
142+ recursiveFind ( root , rootDepsFilter , excludes ) ;
143143
144144 return Array . from ( flattenedDependencies ) ;
145145} ;
0 commit comments