1"use strict"; 2 3Object.defineProperty(exports, "__esModule", { 4 value: true 5}); 6exports.importExpoModulesAutolinking = importExpoModulesAutolinking; 7 8// NOTE: Keep these types in-sync with expo-modules-autolinking 9 10/** 11 * Imports the `expo-modules-autolinking` package installed in the project at the given path. 12 */ 13function importExpoModulesAutolinking(projectRoot) { 14 const autolinking = tryRequireExpoModulesAutolinking(projectRoot); 15 assertAutolinkingCompatibility(autolinking); 16 return autolinking; 17} 18 19function tryRequireExpoModulesAutolinking(projectRoot) { 20 try { 21 const resolvedAutolinkingPath = require.resolve('expo-modules-autolinking/build/autolinking', { 22 paths: [projectRoot] 23 }); 24 25 return require(resolvedAutolinkingPath); 26 } catch { 27 throw new Error("Cannot find 'expo-modules-autolinking' package in your project, make sure that you have 'expo' package installed"); 28 } 29} 30 31function assertAutolinkingCompatibility(autolinking) { 32 if ('resolveSearchPathsAsync' in autolinking && 'findModulesAsync' in autolinking) { 33 return; 34 } 35 36 throw new Error("The 'expo-modules-autolinking' package has been found, but it seems to be incompatible with '@expo/prebuild-config'"); 37} 38//# sourceMappingURL=importExpoModulesAutolinking.js.map