Skip to content

Commit 606bb9f

Browse files
committed
Exclude specific packages
1 parent bdfbe0f commit 606bb9f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

packages/host/src/node/path-utils.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*/
281281
export const DEFAULT_EXCLUDE_PATTERNS = [
282-
/(^|\/)react-native-node-api\//,
283282
/(^|\/)node_modules\//,
284283
/(^|\/).git\//,
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
*/
365372
export 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

Comments
 (0)