1{"version":3,"file":"BuildProperties.js","names":["createBuildPodfilePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","withPodfileProperties","modResults","updateIosBuildPropertiesFromConfig","Object","defineProperty","value","withJsEnginePodfileProps","propName","propValueGetter","ios","jsEngine","podfileProperties","configToProperty","updateIosBuildProperty","options","removePropWhenValueIsNull"],"sources":["../../src/ios/BuildProperties.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withPodfileProperties } from '../plugins/ios-plugins';\nimport { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';\n\n/**\n * Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules.\n *\n * The factory supports two modes from generic type inference\n * ```ts\n * // config-plugin without `props`, it will implicitly use the expo config as source config.\n * createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;\n *\n * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.\n * createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;\n * ```\n *\n * @param configToPropertyRules config to property mapping rules\n * @param name the config plugin name\n */\nexport function createBuildPodfilePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[],\n name?: string\n) {\n const withUnknown: ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType> = (\n config,\n sourceConfig\n ) =>\n withPodfileProperties(config, (config) => {\n config.modResults = updateIosBuildPropertiesFromConfig(\n (sourceConfig ?? config) as SourceConfigType,\n config.modResults,\n configToPropertyRules\n );\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config\n */\nexport const withJsEnginePodfileProps = createBuildPodfilePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'expo.jsEngine',\n propValueGetter: (config) => config.ios?.jsEngine ?? config.jsEngine ?? 'jsc',\n },\n ],\n 'withJsEnginePodfileProps'\n);\n\nexport function updateIosBuildPropertiesFromConfig<SourceConfigType extends BuildPropertiesConfig>(\n config: SourceConfigType,\n podfileProperties: Record<string, string>,\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]\n) {\n for (const configToProperty of configToPropertyRules) {\n const value = configToProperty.propValueGetter(config);\n updateIosBuildProperty(podfileProperties, configToProperty.propName, value);\n }\n return podfileProperties;\n}\n\nexport function updateIosBuildProperty(\n podfileProperties: Record<string, string>,\n name: string,\n value: string | null | undefined,\n options?: { removePropWhenValueIsNull?: boolean }\n) {\n if (value) {\n podfileProperties[name] = value;\n } else if (options?.removePropWhenValueIsNull) {\n delete podfileProperties[name];\n }\n return podfileProperties;\n}\n"],"mappings":";;;;;;;;;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mCAAT,CACLC,qBADK,EAELC,IAFK,EAGL;EACA,MAAMC,WAAwF,GAAG,CAC/FC,MAD+F,EAE/FC,YAF+F,KAI/F,IAAAC,mCAAA,EAAsBF,MAAtB,EAA+BA,MAAD,IAAY;IACxCA,MAAM,CAACG,UAAP,GAAoBC,kCAAkC,CACnDH,YADmD,aACnDA,YADmD,cACnDA,YADmD,GACnCD,MADmC,EAEpDA,MAAM,CAACG,UAF6C,EAGpDN,qBAHoD,CAAtD;IAKA,OAAOG,MAAP;EACD,CAPD,CAJF;;EAYA,IAAIF,IAAJ,EAAU;IACRO,MAAM,CAACC,cAAP,CAAsBP,WAAtB,EAAmC,MAAnC,EAA2C;MACzCQ,KAAK,EAAET;IADkC,CAA3C;EAGD;;EACD,OAAOC,WAAP;AACD;AAED;AACA;AACA;;;AACO,MAAMS,wBAAwB,GAAGZ,mCAAmC,CACzE,CACE;EACEa,QAAQ,EA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