expo-modules-autolinking
Version:
Scripts that autolink Expo modules.
31 lines (28 loc) • 976 B
text/typescript
import { getLinkingImplementationForPlatform } from '../platforms';
import type { ModuleDescriptor, ModuleDescriptorIos, SupportedPlatform } from '../types';
interface GenerateModulesProviderParams {
platform: SupportedPlatform;
targetPath: string;
entitlementPath: string | null;
watchedDirectories: string[];
appRoot: string;
}
/** Generates ExpoModulesProvider file listing all packages to link (Apple-only)
*/
export async function generateModulesProviderAsync(
modules: ModuleDescriptor[],
params: GenerateModulesProviderParams
) {
const platformLinking = getLinkingImplementationForPlatform(params.platform);
if (!('generateModulesProviderAsync' in platformLinking)) {
throw new Error(
`Generating modules provider is not available for platform "${params.platform}"`
);
}
await platformLinking.generateModulesProviderAsync(
modules as ModuleDescriptorIos[],
params.targetPath,
params.entitlementPath,
params
);
}