Skip to content

Commit 8d6c887

Browse files
committed
Exclude specific packages
1 parent 58105ac commit 8d6c887

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
];
@@ -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
*/
357364
export 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

Comments
 (0)