1"use strict"; 2 3Object.defineProperty(exports, "__esModule", { 4 value: true 5}); 6exports.createBuildPodfilePropsConfigPlugin = createBuildPodfilePropsConfigPlugin; 7exports.updateIosBuildPropertiesFromConfig = updateIosBuildPropertiesFromConfig; 8exports.updateIosBuildProperty = updateIosBuildProperty; 9exports.withJsEnginePodfileProps = void 0; 10 11function _iosPlugins() { 12 const data = require("../plugins/ios-plugins"); 13 14 _iosPlugins = function () { 15 return data; 16 }; 17 18 return data; 19} 20 21/** 22 * Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules. 23 * 24 * The factory supports two modes from generic type inference 25 * ```ts 26 * // config-plugin without `props`, it will implicitly use the expo config as source config. 27 * createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>; 28 * 29 * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config. 30 * createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>; 31 * ``` 32 * 33 * @param configToPropertyRules config to property mapping rules 34 * @param name the config plugin name 35 */ 36function createBuildPodfilePropsConfigPlugin(configToPropertyRules, name) { 37 const withUnknown = (config, sourceConfig) => (0, _iosPlugins().withPodfileProperties)(config, config => { 38 config.modResults = updateIosBuildPropertiesFromConfig(sourceConfig !== null && sourceConfig !== void 0 ? sourceConfig : config, config.modResults, configToPropertyRules); 39 return config; 40 }); 41 42 if (name) { 43 Object.defineProperty(withUnknown, 'name', { 44 value: name 45 }); 46 } 47 48 return withUnknown; 49} 50/** 51 * A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config 52 */ 53 54 55const withJsEnginePodfileProps = createBuildPodfilePropsConfigPlugin([{ 56 propName: 'expo.jsEngine', 57 propValueGetter: config => { 58 var _ref, _config$ios$jsEngine, _config$ios; 59 60 return (_ref = (_config$ios$jsEngine = (_config$ios = config.ios) === null || _config$ios === void 0 ? void 0 : _config$ios.jsEngine) !== null && _config$ios$jsEngine !== void 0 ? _config$ios$jsEngine : config.jsEngine) !== null && _ref !== void 0 ? _ref : 'jsc'; 61 } 62}], 'withJsEnginePodfileProps'); 63exports.withJsEnginePodfileProps = withJsEnginePodfileProps; 64 65function updateIosBuildPropertiesFromConfig(config, podfileProperties, configToPropertyRules) { 66 for (const configToProperty of configToPropertyRules) { 67 const value = configToProperty.propValueGetter(config); 68 updateIosBuildProperty(podfileProperties, configToProperty.propName, value); 69 } 70 71 return podfileProperties; 72} 73 74function updateIosBuildProperty(podfileProperties, name, value, options) { 75 if (value) { 76 podfileProperties[name] = value; 77 } else if (options !== null && options !== void 0 && options.removePropWhenValueIsNull) { 78 delete podfileProperties[name]; 79 } 80 81 return podfileProperties; 82} 83//# sourceMappingURL=BuildProperties.js.map