@@ -279,7 +279,6 @@ export const MAGIC_FILENAME = "react-native-node-api-module";
279279 * Default patterns to use when excluding paths from the search for Node-API modules.
280280 */
281281export const DEFAULT_EXCLUDE_PATTERNS = [
282- / ( ^ | \/ ) r e a c t - n a t i v e - n o d e - a p i \/ / ,
283282 / ( ^ | \/ ) n o d e _ m o d u l e s \/ / ,
284283 / ( ^ | \/ ) .g i t \/ / ,
285284] ;
@@ -359,15 +358,25 @@ export async function findNodeApiModulePaths(
359358 return result ;
360359}
361360
361+ /**
362+ * Default package names to use when excluding packages from the search for Node-API modules.
363+ */
364+ export const DEFAULT_EXCLUDE_PACKAGES = [
365+ "react-native-node-api" , // The host package itself
366+ "react-native" , // React Native core
367+ ] ;
368+
362369/**
363370 * Finds all dependencies of the app package and their xcframeworks.
364371 */
365372export async function findNodeApiModulePathsByDependency ( {
366373 fromPath,
367374 includeSelf,
375+ excludePackages = DEFAULT_EXCLUDE_PACKAGES ,
368376 ...options
369377} : FindNodeApiModuleOptions & {
370378 includeSelf : boolean ;
379+ excludePackages ?: string [ ] ;
371380} ) {
372381 // Find the location of each dependency
373382 const packagePathsByName = findPackageDependencyPaths ( fromPath ) ;
@@ -380,8 +389,9 @@ export async function findNodeApiModulePathsByDependency({
380389
381390 // Find all their node api module paths
382391 const resultEntries = await Promise . all (
383- Object . entries ( packagePathsByName ) . map (
384- async ( [ dependencyName , dependencyPath ] ) => {
392+ Object . entries ( packagePathsByName )
393+ . filter ( ( [ name ] ) => ! excludePackages . includes ( name ) )
394+ . map ( async ( [ dependencyName , dependencyPath ] ) => {
385395 // Make all the xcframeworks relative to the dependency path
386396 const absoluteModulePaths = await findNodeApiModulePaths ( {
387397 fromPath : dependencyPath ,
@@ -396,8 +406,7 @@ export async function findNodeApiModulePathsByDependency({
396406 ) ,
397407 } ,
398408 ] as const ;
399- }
400- )
409+ } )
401410 ) ;
402411 // Return an object by dependency name
403412 return Object . fromEntries (
0 commit comments