@@ -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] ;
@@ -351,15 +350,25 @@ export async function findNodeApiModulePaths(
351350 return result ;
352351}
353352
353+ /**
354+ * Default patterns to use when excluding package names from the search for Node-API modules.
355+ */
356+ export const DEFAULT_EXCLUDE_PACKAGES = [
357+ "react-native-node-api" , // The host package itself
358+ "react-native" , // React Native core
359+ ] ;
360+
354361/**
355362 * Finds all dependencies of the app package and their xcframeworks.
356363 */
357364export async function findNodeApiModulePathsByDependency ( {
358365 fromPath,
359366 includeSelf,
367+ excludePackages = DEFAULT_EXCLUDE_PACKAGES ,
360368 ...options
361369} : FindNodeApiModuleOptions & {
362370 includeSelf : boolean ;
371+ excludePackages ?: string [ ] ;
363372} ) {
364373 // Find the location of each dependency
365374 const packagePathsByName = findPackageDependencyPaths ( fromPath ) ;
@@ -372,8 +381,9 @@ export async function findNodeApiModulePathsByDependency({
372381
373382 // Find all their node api module paths
374383 const resultEntries = await Promise . all (
375- Object . entries ( packagePathsByName ) . map (
376- async ( [ dependencyName , dependencyPath ] ) => {
384+ Object . entries ( packagePathsByName )
385+ . filter ( ( [ name ] ) => ! excludePackages . includes ( name ) )
386+ . map ( async ( [ dependencyName , dependencyPath ] ) => {
377387 // Make all the xcframeworks relative to the dependency path
378388 const absoluteModulePaths = await findNodeApiModulePaths ( {
379389 fromPath : dependencyPath ,
@@ -388,8 +398,7 @@ export async function findNodeApiModulePathsByDependency({
388398 ) ,
389399 } ,
390400 ] as const ;
391- }
392- )
401+ } )
393402 ) ;
394403 // Return an object by dependency name
395404 return Object . fromEntries (
0 commit comments