1"use strict"; 2 3Object.defineProperty(exports, "__esModule", { 4 value: true 5}); 6exports.getPrebuildConfigAsync = getPrebuildConfigAsync; 7function _config() { 8 const data = require("@expo/config"); 9 _config = function () { 10 return data; 11 }; 12 return data; 13} 14function _getAutolinkedPackages() { 15 const data = require("./getAutolinkedPackages"); 16 _getAutolinkedPackages = function () { 17 return data; 18 }; 19 return data; 20} 21function _withDefaultPlugins() { 22 const data = require("./plugins/withDefaultPlugins"); 23 _withDefaultPlugins = function () { 24 return data; 25 }; 26 return data; 27} 28async function getPrebuildConfigAsync(projectRoot, props) { 29 const autolinkedModules = await (0, _getAutolinkedPackages().getAutolinkedPackagesAsync)(projectRoot, props.platforms); 30 return getPrebuildConfig(projectRoot, { 31 ...props, 32 autolinkedModules 33 }); 34} 35function getPrebuildConfig(projectRoot, { 36 platforms, 37 bundleIdentifier, 38 packageName, 39 autolinkedModules, 40 expoUsername 41}) { 42 // let config: ExpoConfig; 43 let { 44 exp: config, 45 ...rest 46 } = (0, _config().getConfig)(projectRoot, { 47 skipSDKVersionRequirement: true, 48 isModdedConfig: true 49 }); 50 if (autolinkedModules) { 51 if (!config._internal) { 52 config._internal = {}; 53 } 54 config._internal.autolinkedModules = autolinkedModules; 55 } 56 const resolvedExpoUsername = typeof expoUsername === 'function' ? expoUsername(config) : // If the user didn't pass a username then fallback on the static cached username. 57 expoUsername !== null && expoUsername !== void 0 ? expoUsername : (0, _config().getAccountUsername)(config); 58 59 // Add all built-in plugins first because they should take 60 // priority over the unversioned plugins. 61 config = (0, _withDefaultPlugins().withVersionedExpoSDKPlugins)(config, { 62 expoUsername: resolvedExpoUsername 63 }); 64 config = (0, _withDefaultPlugins().withLegacyExpoPlugins)(config); 65 if (platforms.includes('ios')) { 66 var _ref; 67 if (!config.ios) config.ios = {}; 68 config.ios.bundleIdentifier = (_ref = bundleIdentifier !== null && bundleIdentifier !== void 0 ? bundleIdentifier : config.ios.bundleIdentifier) !== null && _ref !== void 0 ? _ref : `com.placeholder.appid`; 69 70 // Add all built-in plugins 71 config = (0, _withDefaultPlugins().withIosExpoPlugins)(config, { 72 bundleIdentifier: config.ios.bundleIdentifier 73 }); 74 } 75 if (platforms.includes('android')) { 76 var _ref2; 77 if (!config.android) config.android = {}; 78 config.android.package = (_ref2 = packageName !== null && packageName !== void 0 ? packageName : config.android.package) !== null && _ref2 !== void 0 ? _ref2 : `com.placeholder.appid`; 79 80 // Add all built-in plugins 81 config = (0, _withDefaultPlugins().withAndroidExpoPlugins)(config, { 82 package: config.android.package 83 }); 84 } 85 return { 86 exp: config, 87 ...rest 88 }; 89} 90//# sourceMappingURL=getPrebuildConfig.js.map