expo-modules-autolinking
Version:
Scripts that autolink Expo modules.
17 lines (15 loc) • 665 B
text/typescript
import { taskAll } from '../concurrency';
import {
mockDependencyAtPath,
isNativeModuleAsync as isDependencyNativeModuleAsync,
} from '../dependencies';
import type { SupportedPlatform } from '../types';
/** Check if a path is potentially a native module */
export async function isNativeModuleAsync(maybeModulePath: string) {
const resolution = await mockDependencyAtPath(maybeModulePath);
const excludeNames = new Set<string>();
const isNativeModules = await taskAll(['android', 'apple'] as SupportedPlatform[], (platform) =>
isDependencyNativeModuleAsync(resolution, null, platform, excludeNames)
);
return isNativeModules.some((x) => !!x);
}