@expo/config-plugins 7.9.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/build/android/AllowBackup.js +4 -6
  2. package/build/android/AllowBackup.js.map +1 -1
  3. package/build/android/BuildProperties.js +4 -8
  4. package/build/android/BuildProperties.js.map +1 -1
  5. package/build/android/Colors.js +3 -6
  6. package/build/android/Colors.js.map +1 -1
  7. package/build/android/EasBuild.js +2 -2
  8. package/build/android/EasBuild.js.map +1 -1
  9. package/build/android/EasBuildGradleScript.js +1 -2
  10. package/build/android/EasBuildGradleScript.js.map +1 -1
  11. package/build/android/GoogleMapsApiKey.js +2 -4
  12. package/build/android/GoogleMapsApiKey.js.map +1 -1
  13. package/build/android/GoogleServices.js +1 -2
  14. package/build/android/GoogleServices.js.map +1 -1
  15. package/build/android/IntentFilters.js +6 -12
  16. package/build/android/IntentFilters.js.map +1 -1
  17. package/build/android/Manifest.d.ts +1 -0
  18. package/build/android/Manifest.js +13 -22
  19. package/build/android/Manifest.js.map +1 -1
  20. package/build/android/Name.js +2 -4
  21. package/build/android/Name.js.map +1 -1
  22. package/build/android/Orientation.js +2 -4
  23. package/build/android/Orientation.js.map +1 -1
  24. package/build/android/Package.js +2 -4
  25. package/build/android/Package.js.map +1 -1
  26. package/build/android/Paths.js +2 -2
  27. package/build/android/Paths.js.map +1 -1
  28. package/build/android/Permissions.js +4 -8
  29. package/build/android/Permissions.js.map +1 -1
  30. package/build/android/PrimaryColor.js +1 -2
  31. package/build/android/PrimaryColor.js.map +1 -1
  32. package/build/android/Resources.js +8 -6
  33. package/build/android/Resources.js.map +1 -1
  34. package/build/android/Scheme.js +17 -40
  35. package/build/android/Scheme.js.map +1 -1
  36. package/build/android/StatusBar.js +3 -6
  37. package/build/android/StatusBar.js.map +1 -1
  38. package/build/android/Strings.js +2 -4
  39. package/build/android/Strings.js.map +1 -1
  40. package/build/android/Styles.js +3 -4
  41. package/build/android/Styles.js.map +1 -1
  42. package/build/android/Updates.d.ts +0 -8
  43. package/build/android/Updates.js +6 -91
  44. package/build/android/Updates.js.map +1 -1
  45. package/build/android/Version.js +3 -6
  46. package/build/android/Version.js.map +1 -1
  47. package/build/android/WindowSoftInputMode.js +2 -3
  48. package/build/android/WindowSoftInputMode.js.map +1 -1
  49. package/build/android/index.js +2 -2
  50. package/build/android/index.js.map +1 -1
  51. package/build/index.js +3 -4
  52. package/build/index.js.map +1 -1
  53. package/build/ios/Bitcode.js +1 -2
  54. package/build/ios/Bitcode.js.map +1 -1
  55. package/build/ios/BuildProperties.js +4 -8
  56. package/build/ios/BuildProperties.js.map +1 -1
  57. package/build/ios/BuildScheme.js +7 -12
  58. package/build/ios/BuildScheme.js.map +1 -1
  59. package/build/ios/BundleIdentifier.js +3 -5
  60. package/build/ios/BundleIdentifier.js.map +1 -1
  61. package/build/ios/DeviceFamily.js +5 -8
  62. package/build/ios/DeviceFamily.js.map +1 -1
  63. package/build/ios/Entitlements.js +3 -6
  64. package/build/ios/Entitlements.js.map +1 -1
  65. package/build/ios/Google.js +2 -4
  66. package/build/ios/Google.js.map +1 -1
  67. package/build/ios/IosConfig.types.d.ts +3 -1
  68. package/build/ios/IosConfig.types.js.map +1 -1
  69. package/build/ios/Locales.js +3 -4
  70. package/build/ios/Locales.js.map +1 -1
  71. package/build/ios/Maps.js +2 -4
  72. package/build/ios/Maps.js.map +1 -1
  73. package/build/ios/Name.js +3 -6
  74. package/build/ios/Name.js.map +1 -1
  75. package/build/ios/Orientation.js +4 -8
  76. package/build/ios/Orientation.js.map +1 -1
  77. package/build/ios/Paths.js +2 -2
  78. package/build/ios/Paths.js.map +1 -1
  79. package/build/ios/PrivacyInfo.js +7 -11
  80. package/build/ios/PrivacyInfo.js.map +1 -1
  81. package/build/ios/RequiresFullScreen.js +2 -4
  82. package/build/ios/RequiresFullScreen.js.map +1 -1
  83. package/build/ios/Scheme.js +6 -9
  84. package/build/ios/Scheme.js.map +1 -1
  85. package/build/ios/Swift.js +2 -2
  86. package/build/ios/Swift.js.map +1 -1
  87. package/build/ios/Target.js +4 -5
  88. package/build/ios/Target.js.map +1 -1
  89. package/build/ios/Updates.d.ts +0 -16
  90. package/build/ios/Updates.js +6 -95
  91. package/build/ios/Updates.js.map +1 -1
  92. package/build/ios/UsesNonExemptEncryption.js +2 -4
  93. package/build/ios/UsesNonExemptEncryption.js.map +1 -1
  94. package/build/ios/Version.js +3 -6
  95. package/build/ios/Version.js.map +1 -1
  96. package/build/ios/codeMod.js +1 -2
  97. package/build/ios/codeMod.js.map +1 -1
  98. package/build/ios/index.js +2 -2
  99. package/build/ios/index.js.map +1 -1
  100. package/build/ios/utils/Xcodeproj.js +15 -21
  101. package/build/ios/utils/Xcodeproj.js.map +1 -1
  102. package/build/ios/utils/getInfoPlistPath.js +1 -2
  103. package/build/ios/utils/getInfoPlistPath.js.map +1 -1
  104. package/build/plugins/createBaseMod.js +3 -4
  105. package/build/plugins/createBaseMod.js.map +1 -1
  106. package/build/plugins/ios-plugins.js +1 -2
  107. package/build/plugins/ios-plugins.js.map +1 -1
  108. package/build/plugins/mod-compiler.js +6 -10
  109. package/build/plugins/mod-compiler.js.map +1 -1
  110. package/build/plugins/withAndroidBaseMods.js +4 -6
  111. package/build/plugins/withAndroidBaseMods.js.map +1 -1
  112. package/build/plugins/withIosBaseMods.js +4 -5
  113. package/build/plugins/withIosBaseMods.js.map +1 -1
  114. package/build/plugins/withMod.js +2 -4
  115. package/build/plugins/withMod.js.map +1 -1
  116. package/build/plugins/withStaticPlugin.js +2 -4
  117. package/build/plugins/withStaticPlugin.js.map +1 -1
  118. package/build/utils/Updates.d.ts +5 -0
  119. package/build/utils/Updates.js +34 -37
  120. package/build/utils/Updates.js.map +1 -1
  121. package/build/utils/XML.js +4 -8
  122. package/build/utils/XML.js.map +1 -1
  123. package/build/utils/generateCode.js +2 -2
  124. package/build/utils/generateCode.js.map +1 -1
  125. package/build/utils/history.js +1 -2
  126. package/build/utils/history.js.map +1 -1
  127. package/build/utils/modules.js +2 -4
  128. package/build/utils/modules.js.map +1 -1
  129. package/build/utils/plugin-resolver.js +5 -7
  130. package/build/utils/plugin-resolver.js.map +1 -1
  131. package/package.json +4 -6
@@ -1 +1 @@
1
- {"version":3,"file":"Maps.js","names":["_fs","data","_interopRequireDefault","require","_path","_resolveFrom","_iosPlugins","_withDangerousMod","_generateCode","obj","__esModule","default","debug","MATCH_INIT","exports","withGoogleMapsKey","createInfoPlistPlugin","setGoogleMapsApiKey","withMaps","config","apiKey","getGoogleMapsApiKey","withMapsCocoaPods","useGoogleMaps","withGoogleMapsAppDelegate","_config$ios$config$go","_config$ios","_config$ios$config","ios","googleMapsApiKey","GMSApiKey","infoPlist","addGoogleMapsAppDelegateImport","src","newSrc","push","mergeContents","tag","join","anchor","offset","comment","removeGoogleMapsAppDelegateImport","removeContents","addGoogleMapsAppDelegateInit","removeGoogleMapsAppDelegateInit","addMapsCocoaPods","removeMapsCocoaPods","isReactNativeMapsInstalled","projectRoot","resolved","resolveFrom","silent","path","dirname","isReactNativeMapsAutolinked","withDangerousMod","filePath","modRequest","platformProjectRoot","contents","fs","promises","readFile","results","googleMapsPath","isLinked","error","code","Error","didMerge","didClear","writeFile","withAppDelegate","includes","modResults","language"],"sources":["../../src/ios/Maps.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { ConfigPlugin, InfoPlist } from '../Plugin.types';\nimport { createInfoPlistPlugin, withAppDelegate } from '../plugins/ios-plugins';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { mergeContents, MergeResults, removeContents } from '../utils/generateCode';\n\nconst debug = require('debug')('expo:config-plugins:ios:maps') as typeof console.log;\n\nexport const MATCH_INIT =\n /-\\s*\\(BOOL\\)\\s*application:\\s*\\(UIApplication\\s*\\*\\s*\\)\\s*\\w+\\s+didFinishLaunchingWithOptions:/g;\n\nconst withGoogleMapsKey = createInfoPlistPlugin(setGoogleMapsApiKey, 'withGoogleMapsKey');\n\nexport const withMaps: ConfigPlugin = (config) => {\n config = withGoogleMapsKey(config);\n\n const apiKey = getGoogleMapsApiKey(config);\n // Technically adds react-native-maps (Apple maps) and google maps.\n\n debug('Google Maps API Key:', apiKey);\n config = withMapsCocoaPods(config, { useGoogleMaps: !!apiKey });\n\n // Adds/Removes AppDelegate setup for Google Maps API on iOS\n config = withGoogleMapsAppDelegate(config, { apiKey });\n\n return config;\n};\n\nexport function getGoogleMapsApiKey(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.config?.googleMapsApiKey ?? null;\n}\n\nexport function setGoogleMapsApiKey(\n config: Pick<ExpoConfig, 'ios'>,\n { GMSApiKey, ...infoPlist }: InfoPlist\n): InfoPlist {\n const apiKey = getGoogleMapsApiKey(config);\n\n if (apiKey === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n GMSApiKey: apiKey,\n };\n}\n\nexport function addGoogleMapsAppDelegateImport(src: string): MergeResults {\n const newSrc = [];\n newSrc.push(\n '#if __has_include(<GoogleMaps/GoogleMaps.h>)',\n '#import <GoogleMaps/GoogleMaps.h>',\n '#endif'\n );\n\n return mergeContents({\n tag: 'react-native-maps-import',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: /#import \"AppDelegate\\.h\"/,\n offset: 1,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateImport(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-import',\n src,\n });\n}\n\nexport function addGoogleMapsAppDelegateInit(src: string, apiKey: string): MergeResults {\n const newSrc = [];\n newSrc.push(\n '#if __has_include(<GoogleMaps/GoogleMaps.h>)',\n ` [GMSServices provideAPIKey:@\"${apiKey}\"];`,\n '#endif'\n );\n\n return mergeContents({\n tag: 'react-native-maps-init',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: MATCH_INIT,\n offset: 2,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateInit(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-init',\n src,\n });\n}\n\n/**\n * @param src The contents of the Podfile.\n * @returns Podfile with Google Maps added.\n */\nexport function addMapsCocoaPods(src: string): MergeResults {\n return mergeContents({\n tag: 'react-native-maps',\n src,\n newSrc: ` pod 'react-native-google-maps', path: File.dirname(\\`node --print \"require.resolve('react-native-maps/package.json')\"\\`)`,\n anchor: /use_native_modules/,\n offset: 0,\n comment: '#',\n });\n}\n\nexport function removeMapsCocoaPods(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps',\n src,\n });\n}\n\nfunction isReactNativeMapsInstalled(projectRoot: string): string | null {\n const resolved = resolveFrom.silent(projectRoot, 'react-native-maps/package.json');\n return resolved ? path.dirname(resolved) : null;\n}\n\nfunction isReactNativeMapsAutolinked(config: Pick<ExpoConfig, '_internal'>): boolean {\n // Only add the native code changes if we know that the package is going to be linked natively.\n // This is specifically for monorepo support where one app might have react-native-maps (adding it to the node_modules)\n // but another app will not have it installed in the package.json, causing it to not be linked natively.\n // This workaround only exists because react-native-maps doesn't have a config plugin vendored in the package.\n\n // TODO: `react-native-maps` doesn't use Expo autolinking so we cannot safely disable the module.\n return true;\n\n // return (\n // !config._internal?.autolinkedModules ||\n // config._internal.autolinkedModules.includes('react-native-maps')\n // );\n}\n\nconst withMapsCocoaPods: ConfigPlugin<{ useGoogleMaps: boolean }> = (config, { useGoogleMaps }) => {\n return withDangerousMod(config, [\n 'ios',\n async (config) => {\n const filePath = path.join(config.modRequest.platformProjectRoot, 'Podfile');\n const contents = await fs.promises.readFile(filePath, 'utf-8');\n let results: MergeResults;\n // Only add the block if react-native-maps is installed in the project (best effort).\n // Generally prebuild runs after a yarn install so this should always work as expected.\n const googleMapsPath = isReactNativeMapsInstalled(config.modRequest.projectRoot);\n const isLinked = isReactNativeMapsAutolinked(config);\n debug('Is Expo Autolinked:', isLinked);\n debug('react-native-maps path:', googleMapsPath);\n if (isLinked && googleMapsPath && useGoogleMaps) {\n try {\n results = addMapsCocoaPods(contents);\n } catch (error: any) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add react-native-maps to the project's ios/Podfile because it's malformed. Please report this with a copy of your project Podfile.`\n );\n }\n throw error;\n }\n } else {\n // If the package is no longer installed, then remove the block.\n results = removeMapsCocoaPods(contents);\n }\n if (results.didMerge || results.didClear) {\n await fs.promises.writeFile(filePath, results.contents);\n }\n return config;\n },\n ]);\n};\n\nconst withGoogleMapsAppDelegate: ConfigPlugin<{ apiKey: string | null }> = (config, { apiKey }) => {\n return withAppDelegate(config, (config) => {\n if (['objc', 'objcpp'].includes(config.modResults.language)) {\n if (\n apiKey &&\n isReactNativeMapsAutolinked(config) &&\n isReactNativeMapsInstalled(config.modRequest.projectRoot)\n ) {\n try {\n config.modResults.contents = addGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = addGoogleMapsAppDelegateInit(\n config.modResults.contents,\n apiKey\n ).contents;\n } catch (error: any) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add Google Maps to the project's AppDelegate because it's malformed. Please report this with a copy of your project AppDelegate.`\n );\n }\n throw error;\n }\n } else {\n config.modResults.contents = removeGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = removeGoogleMapsAppDelegateInit(\n config.modResults.contents\n ).contents;\n }\n } else {\n throw new Error(\n `Cannot setup Google Maps because the project AppDelegate is not a supported language: ${config.modResults.language}`\n );\n }\n return config;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OA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Ae,EAACtD,MAAM,EAAGA,MAAM,IAAK;IACzC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAACuD,QAAQ,CAACvD,MAAM,CAACwD,UAAU,CAACC,QAAQ,CAAC,EAAE;MAC3D,IACExD,MAAM,IACNmC,2BAA2B,CAACpC,MAAM,CAAC,IACnC6B,0BAA0B,CAAC7B,MAAM,CAACuC,UAAU,CAACT,WAAW,CAAC,EACzD;QACA,IAAI;UACF9B,MAAM,CAACwD,UAAU,CAACf,QAAQ,GAAG5B,8BAA8B,CACzDb,MAAM,CAACwD,UAAU,CAACf,QACpB,CAAC,CAACA,QAAQ;UACVzC,MAAM,CAACwD,UAAU,CAACf,QAAQ,GAAGhB,4BAA4B,CACvDzB,MAAM,CAACwD,UAAU,CAACf,QAAQ,EAC1BxC,MACF,CAAC,CAACwC,QAAQ;QACZ,CAAC,CAAC,OAAOO,KAAU,EAAE;UACnB,IAAIA,KAAK,CAACC,IAAI,KAAK,cAAc,EAAE;YACjC,MAAM,IAAIC,KAAK,CACZ,yIACH,CAAC;UACH;UACA,MAAMF,KAAK;QACb;MACF,CAAC,MAAM;QACLhD,MAAM,CAACwD,UAAU,CAACf,QAAQ,GAAGlB,iCAAiC,CAC5DvB,MAAM,CAACwD,UAAU,CAACf,QACpB,CAAC,CAACA,QAAQ;QACVzC,MAAM,CAACwD,UAAU,CAACf,QAAQ,GAAGf,+BAA+B,CAC1D1B,MAAM,CAACwD,UAAU,CAACf,QACpB,CAAC,CAACA,QAAQ;MACZ;IACF,CAAC,MAAM;MACL,MAAM,IAAIS,KAAK,CACZ,yFAAwFlD,MAAM,CAACwD,UAAU,CAACC,QAAS,EACtH,CAAC;IACH;IACA,OAAOzD,MAAM;EACf,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"Maps.js","names":["_fs","data","_interopRequireDefault","require","_path","_resolveFrom","_iosPlugins","_withDangerousMod","_generateCode","obj","__esModule","default","debug","MATCH_INIT","exports","withGoogleMapsKey","createInfoPlistPlugin","setGoogleMapsApiKey","withMaps","config","apiKey","getGoogleMapsApiKey","withMapsCocoaPods","useGoogleMaps","withGoogleMapsAppDelegate","ios","googleMapsApiKey","GMSApiKey","infoPlist","addGoogleMapsAppDelegateImport","src","newSrc","push","mergeContents","tag","join","anchor","offset","comment","removeGoogleMapsAppDelegateImport","removeContents","addGoogleMapsAppDelegateInit","removeGoogleMapsAppDelegateInit","addMapsCocoaPods","removeMapsCocoaPods","isReactNativeMapsInstalled","projectRoot","resolved","resolveFrom","silent","path","dirname","isReactNativeMapsAutolinked","withDangerousMod","filePath","modRequest","platformProjectRoot","contents","fs","promises","readFile","results","googleMapsPath","isLinked","error","code","Error","didMerge","didClear","writeFile","withAppDelegate","includes","modResults","language"],"sources":["../../src/ios/Maps.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { ConfigPlugin, InfoPlist } from '../Plugin.types';\nimport { createInfoPlistPlugin, withAppDelegate } from '../plugins/ios-plugins';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { mergeContents, MergeResults, removeContents } from '../utils/generateCode';\n\nconst debug = require('debug')('expo:config-plugins:ios:maps') as typeof console.log;\n\nexport const MATCH_INIT =\n /-\\s*\\(BOOL\\)\\s*application:\\s*\\(UIApplication\\s*\\*\\s*\\)\\s*\\w+\\s+didFinishLaunchingWithOptions:/g;\n\nconst withGoogleMapsKey = createInfoPlistPlugin(setGoogleMapsApiKey, 'withGoogleMapsKey');\n\nexport const withMaps: ConfigPlugin = (config) => {\n config = withGoogleMapsKey(config);\n\n const apiKey = getGoogleMapsApiKey(config);\n // Technically adds react-native-maps (Apple maps) and google maps.\n\n debug('Google Maps API Key:', apiKey);\n config = withMapsCocoaPods(config, { useGoogleMaps: !!apiKey });\n\n // Adds/Removes AppDelegate setup for Google Maps API on iOS\n config = withGoogleMapsAppDelegate(config, { apiKey });\n\n return config;\n};\n\nexport function getGoogleMapsApiKey(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.config?.googleMapsApiKey ?? null;\n}\n\nexport function setGoogleMapsApiKey(\n config: Pick<ExpoConfig, 'ios'>,\n { GMSApiKey, ...infoPlist }: InfoPlist\n): InfoPlist {\n const apiKey = getGoogleMapsApiKey(config);\n\n if (apiKey === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n GMSApiKey: apiKey,\n };\n}\n\nexport function addGoogleMapsAppDelegateImport(src: string): MergeResults {\n const newSrc = [];\n newSrc.push(\n '#if __has_include(<GoogleMaps/GoogleMaps.h>)',\n '#import <GoogleMaps/GoogleMaps.h>',\n '#endif'\n );\n\n return mergeContents({\n tag: 'react-native-maps-import',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: /#import \"AppDelegate\\.h\"/,\n offset: 1,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateImport(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-import',\n src,\n });\n}\n\nexport function addGoogleMapsAppDelegateInit(src: string, apiKey: string): MergeResults {\n const newSrc = [];\n newSrc.push(\n '#if __has_include(<GoogleMaps/GoogleMaps.h>)',\n ` [GMSServices provideAPIKey:@\"${apiKey}\"];`,\n '#endif'\n );\n\n return mergeContents({\n tag: 'react-native-maps-init',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: MATCH_INIT,\n offset: 2,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateInit(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-init',\n src,\n });\n}\n\n/**\n * @param src The contents of the Podfile.\n * @returns Podfile with Google Maps added.\n */\nexport function addMapsCocoaPods(src: string): MergeResults {\n return mergeContents({\n tag: 'react-native-maps',\n src,\n newSrc: ` pod 'react-native-google-maps', path: File.dirname(\\`node --print \"require.resolve('react-native-maps/package.json')\"\\`)`,\n anchor: /use_native_modules/,\n offset: 0,\n comment: '#',\n });\n}\n\nexport function removeMapsCocoaPods(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps',\n src,\n });\n}\n\nfunction isReactNativeMapsInstalled(projectRoot: string): string | null {\n const resolved = resolveFrom.silent(projectRoot, 'react-native-maps/package.json');\n return resolved ? path.dirname(resolved) : null;\n}\n\nfunction isReactNativeMapsAutolinked(config: Pick<ExpoConfig, '_internal'>): boolean {\n // Only add the native code changes if we know that the package is going to be linked natively.\n // This is specifically for monorepo support where one app might have react-native-maps (adding it to the node_modules)\n // but another app will not have it installed in the package.json, causing it to not be linked natively.\n // This workaround only exists because react-native-maps doesn't have a config plugin vendored in the package.\n\n // TODO: `react-native-maps` doesn't use Expo autolinking so we cannot safely disable the module.\n return true;\n\n // return (\n // !config._internal?.autolinkedModules ||\n // config._internal.autolinkedModules.includes('react-native-maps')\n // );\n}\n\nconst withMapsCocoaPods: ConfigPlugin<{ useGoogleMaps: boolean }> = (config, { useGoogleMaps }) => {\n return withDangerousMod(config, [\n 'ios',\n async (config) => {\n const filePath = path.join(config.modRequest.platformProjectRoot, 'Podfile');\n const contents = await fs.promises.readFile(filePath, 'utf-8');\n let results: MergeResults;\n // Only add the block if react-native-maps is installed in the project (best effort).\n // Generally prebuild runs after a yarn install so this should always work as expected.\n const googleMapsPath = isReactNativeMapsInstalled(config.modRequest.projectRoot);\n const isLinked = isReactNativeMapsAutolinked(config);\n debug('Is Expo Autolinked:', isLinked);\n debug('react-native-maps path:', googleMapsPath);\n if (isLinked && googleMapsPath && useGoogleMaps) {\n try {\n results = addMapsCocoaPods(contents);\n } catch (error: any) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add react-native-maps to the project's ios/Podfile because it's malformed. Please report this with a copy of your project Podfile.`\n );\n }\n throw error;\n }\n } else {\n // If the package is no longer installed, then remove the block.\n results = removeMapsCocoaPods(contents);\n }\n if (results.didMerge || results.didClear) {\n await fs.promises.writeFile(filePath, results.contents);\n }\n return config;\n },\n ]);\n};\n\nconst withGoogleMapsAppDelegate: ConfigPlugin<{ apiKey: string | null }> = (config, { apiKey }) => {\n return withAppDelegate(config, (config) => {\n if (['objc', 'objcpp'].includes(config.modResults.language)) {\n if (\n apiKey &&\n isReactNativeMapsAutolinked(config) &&\n isReactNativeMapsInstalled(config.modRequest.projectRoot)\n ) {\n try {\n config.modResults.contents = addGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = addGoogleMapsAppDelegateInit(\n config.modResults.contents,\n apiKey\n ).contents;\n } catch (error: any) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add Google Maps to the project's AppDelegate because it's malformed. Please report this with a copy of your project AppDelegate.`\n );\n }\n throw error;\n }\n } else {\n config.modResults.contents = removeGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = removeGoogleMapsAppDelegateInit(\n config.modResults.contents\n ).contents;\n }\n } else {\n throw new Error(\n `Cannot setup Google Maps because the project AppDelegate is not a supported language: ${config.modResults.language}`\n );\n }\n return config;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,kBAAA;EAAA,MAAAN,I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qC,QAAQ;QACZ,CAAC,CAAC,OAAOO,KAAU,EAAE;UACnB,IAAIA,KAAK,CAACC,IAAI,KAAK,cAAc,EAAE;YACjC,MAAM,IAAIC,KAAK,CACZ,yIACH,CAAC;UACH;UACA,MAAMF,KAAK;QACb;MACF,CAAC,MAAM;QACL7C,MAAM,CAACqD,UAAU,CAACf,QAAQ,GAAGlB,iCAAiC,CAC5DpB,MAAM,CAACqD,UAAU,CAACf,QACpB,CAAC,CAACA,QAAQ;QACVtC,MAAM,CAACqD,UAAU,CAACf,QAAQ,GAAGf,+BAA+B,CAC1DvB,MAAM,CAACqD,UAAU,CAACf,QACpB,CAAC,CAACA,QAAQ;MACZ;IACF,CAAC,MAAM;MACL,MAAM,IAAIS,KAAK,CACZ,yFAAwF/C,MAAM,CAACqD,UAAU,CAACC,QAAS,EACtH,CAAC;IACH;IACA,OAAOtD,MAAM;EACf,CAAC,CAAC;AACJ,CAAC"}
package/build/ios/Name.js CHANGED
@@ -29,18 +29,16 @@ function _iosPlugins() {
29
29
  };
30
30
  return data;
31
31
  }
32
- const withDisplayName = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setDisplayName, {
32
+ const withDisplayName = exports.withDisplayName = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setDisplayName, {
33
33
  infoPlistProperty: 'CFBundleDisplayName',
34
34
  expoConfigProperty: 'name'
35
35
  }, 'withDisplayName');
36
- exports.withDisplayName = withDisplayName;
37
- const withName = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setName, {
36
+ const withName = exports.withName = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setName, {
38
37
  infoPlistProperty: 'CFBundleName',
39
38
  expoConfigProperty: 'name'
40
39
  }, 'withName');
41
40
 
42
41
  /** Set the PRODUCT_NAME variable in the xcproj file based on the app.json name property. */
43
- exports.withName = withName;
44
42
  const withProductName = config => {
45
43
  return (0, _iosPlugins().withXcodeProject)(config, config => {
46
44
  config.modResults = setProductName(config, config.modResults);
@@ -93,8 +91,7 @@ function setName(config, {
93
91
  };
94
92
  }
95
93
  function setProductName(config, project) {
96
- var _getName;
97
- const name = (0, _Xcodeproj().sanitizedName)((_getName = getName(config)) !== null && _getName !== void 0 ? _getName : '');
94
+ const name = (0, _Xcodeproj().sanitizedName)(getName(config) ?? '');
98
95
  if (!name) {
99
96
  return project;
100
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Name.js","names":["_Target","data","require","_Xcodeproj","_iosPlugins","withDisplayName","createInfoPlistPluginWithPropertyGuard","setDisplayName","infoPlistProperty","expoConfigProperty","exports","withName","setName","withProductName","config","withXcodeProject","modResults","setProductName","getName","name","configOrName","CFBundleDisplayName","infoPlist","CFBundleName","project","_getName","sanitizedName","quotedName","ensureQuotes","nativeTarget","findFirstNativeTarget","getBuildConfigurationsForListId","buildConfigurationList","forEach","item","buildSettings","PRODUCT_NAME","value","match"],"sources":["../../src/ios/Name.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { XcodeProject } from 'xcode';\n\nimport { InfoPlist } from './IosConfig.types';\nimport { findFirstNativeTarget } from './Target';\nimport {\n ConfigurationSectionEntry,\n getBuildConfigurationsForListId,\n sanitizedName,\n} from './utils/Xcodeproj';\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createInfoPlistPluginWithPropertyGuard, withXcodeProject } from '../plugins/ios-plugins';\n\nexport const withDisplayName = createInfoPlistPluginWithPropertyGuard(\n setDisplayName,\n {\n infoPlistProperty: 'CFBundleDisplayName',\n expoConfigProperty: 'name',\n },\n 'withDisplayName'\n);\n\nexport const withName = createInfoPlistPluginWithPropertyGuard(\n setName,\n {\n infoPlistProperty: 'CFBundleName',\n expoConfigProperty: 'name',\n },\n 'withName'\n);\n\n/** Set the PRODUCT_NAME variable in the xcproj file based on the app.json name property. */\nexport const withProductName: ConfigPlugin = (config) => {\n return withXcodeProject(config, (config) => {\n config.modResults = setProductName(config, config.modResults);\n return config;\n });\n};\n\nexport function getName(config: Pick<ExpoConfig, 'name'>) {\n return typeof config.name === 'string' ? config.name : null;\n}\n\n/**\n * CFBundleDisplayName is used for most things: the name on the home screen, in\n * notifications, and others.\n */\nexport function setDisplayName(\n configOrName: Pick<ExpoConfig, 'name'> | string,\n { CFBundleDisplayName, ...infoPlist }: InfoPlist\n): InfoPlist {\n let name: string | null = null;\n if (typeof configOrName === 'string') {\n name = configOrName;\n } else {\n name = getName(configOrName);\n }\n\n if (!name) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleDisplayName: name,\n };\n}\n\n/**\n * CFBundleName is recommended to be 16 chars or less and is used in lists, eg:\n * sometimes on the App Store\n */\nexport function setName(\n config: Pick<ExpoConfig, 'name'>,\n { CFBundleName, ...infoPlist }: InfoPlist\n): InfoPlist {\n const name = getName(config);\n\n if (!name) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleName: name,\n };\n}\n\nexport function setProductName(\n config: Pick<ExpoConfig, 'name'>,\n project: XcodeProject\n): XcodeProject {\n const name = sanitizedName(getName(config) ?? '');\n\n if (!name) {\n return project;\n }\n const quotedName = ensureQuotes(name);\n\n const [, nativeTarget] = findFirstNativeTarget(project);\n\n getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList).forEach(\n ([, item]: ConfigurationSectionEntry) => {\n item.buildSettings.PRODUCT_NAME = quotedName;\n }\n );\n\n return project;\n}\n\nconst ensureQuotes = (value: string) => {\n if (!value.match(/^['\"]/)) {\n return `\"${value}\"`;\n }\n return value;\n};\n"],"mappings":";;;;;;;;;;AAIA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAG,YAAA;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AGA,SAAS;IACZD,mBAAmB,EAAEF;EACvB,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACO,SAASP,OAAOA,CACrBE,MAAgC,EAChC;EAAES,YAAY;EAAE,GAAGD;AAAqB,CAAC,EAC9B;EACX,MAAMH,IAAI,GAAGD,OAAO,CAACJ,MAAM,CAAC;EAE5B,IAAI,CAACK,IAAI,EAAE;IACT,OAAOG,SAAS;EAClB;EAEA,OAAO;IACL,GAAGA,SAAS;IACZC,YAAY,EAAEJ;EAChB,CAAC;AACH;AAEO,SAASF,cAAcA,CAC5BH,MAAgC,EAChCU,OAAqB,EACP;EAAA,IAAAC,QAAA;EACd,MAAMN,IAAI,GAAG,IAAAO,0BAAa,GAAAD,QAAA,GAACP,OAAO,CAACJ,MAAM,CAAC,cAAAW,QAAA,cAAAA,QAAA,GAAI,EAAE,CAAC;EAEjD,IAAI,CAACN,IAAI,EAAE;IACT,OAAOK,OAAO;EAChB;EACA,MAAMG,UAAU,GAAGC,YAAY,CAACT,IAAI,CAAC;EAErC,MAAM,GAAGU,YAAY,CAAC,GAAG,IAAAC,+BAAqB,EAACN,OAAO,CAAC;EAEvD,IAAAO,4CAA+B,EAACP,OAAO,EAAEK,YAAY,CAACG,sBAAsB,CAAC,CAACC,OAAO,CACnF,CAAC,GAAGC,IAAI,CAA4B,KAAK;IACvCA,IAAI,CAACC,aAAa,CAACC,YAAY,GAAGT,UAAU;EAC9C,CACF,CAAC;EAED,OAAOH,OAAO;AAChB;AAEA,MAAMI,YAAY,GAAIS,KAAa,IAAK;EACtC,IAAI,CAACA,KAAK,CAACC,KAAK,CAAC,OAAO,CAAC,EAAE;IACzB,OAAQ,IAAGD,KAAM,GAAE;EACrB;EACA,OAAOA,KAAK;AACd,CAAC"}
1
+ {"version":3,"file":"Name.js","names":["_Target","data","require","_Xcodeproj","_iosPlugins","withDisplayName","exports","createInfoPlistPluginWithPropertyGuard","setDisplayName","infoPlistProperty","expoConfigProperty","withName","setName","withProductName","config","withXcodeProject","modResults","setProductName","getName","name","configOrName","CFBundleDisplayName","infoPlist","CFBundleName","project","sanitizedName","quotedName","ensureQuotes","nativeTarget","findFirstNativeTarget","getBuildConfigurationsForListId","buildConfigurationList","forEach","item","buildSettings","PRODUCT_NAME","value","match"],"sources":["../../src/ios/Name.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { XcodeProject } from 'xcode';\n\nimport { InfoPlist } from './IosConfig.types';\nimport { findFirstNativeTarget } from './Target';\nimport {\n ConfigurationSectionEntry,\n getBuildConfigurationsForListId,\n sanitizedName,\n} from './utils/Xcodeproj';\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createInfoPlistPluginWithPropertyGuard, withXcodeProject } from '../plugins/ios-plugins';\n\nexport const withDisplayName = createInfoPlistPluginWithPropertyGuard(\n setDisplayName,\n {\n infoPlistProperty: 'CFBundleDisplayName',\n expoConfigProperty: 'name',\n },\n 'withDisplayName'\n);\n\nexport const withName = createInfoPlistPluginWithPropertyGuard(\n setName,\n {\n infoPlistProperty: 'CFBundleName',\n expoConfigProperty: 'name',\n },\n 'withName'\n);\n\n/** Set the PRODUCT_NAME variable in the xcproj file based on the app.json name property. */\nexport const withProductName: ConfigPlugin = (config) => {\n return withXcodeProject(config, (config) => {\n config.modResults = setProductName(config, config.modResults);\n return config;\n });\n};\n\nexport function getName(config: Pick<ExpoConfig, 'name'>) {\n return typeof config.name === 'string' ? config.name : null;\n}\n\n/**\n * CFBundleDisplayName is used for most things: the name on the home screen, in\n * notifications, and others.\n */\nexport function setDisplayName(\n configOrName: Pick<ExpoConfig, 'name'> | string,\n { CFBundleDisplayName, ...infoPlist }: InfoPlist\n): InfoPlist {\n let name: string | null = null;\n if (typeof configOrName === 'string') {\n name = configOrName;\n } else {\n name = getName(configOrName);\n }\n\n if (!name) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleDisplayName: name,\n };\n}\n\n/**\n * CFBundleName is recommended to be 16 chars or less and is used in lists, eg:\n * sometimes on the App Store\n */\nexport function setName(\n config: Pick<ExpoConfig, 'name'>,\n { CFBundleName, ...infoPlist }: InfoPlist\n): InfoPlist {\n const name = getName(config);\n\n if (!name) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleName: name,\n };\n}\n\nexport function setProductName(\n config: Pick<ExpoConfig, 'name'>,\n project: XcodeProject\n): XcodeProject {\n const name = sanitizedName(getName(config) ?? '');\n\n if (!name) {\n return project;\n }\n const quotedName = ensureQuotes(name);\n\n const [, nativeTarget] = findFirstNativeTarget(project);\n\n getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList).forEach(\n ([, item]: ConfigurationSectionEntry) => {\n item.buildSettings.PRODUCT_NAME = quotedName;\n }\n );\n\n return project;\n}\n\nconst ensureQuotes = (value: string) => {\n if (!value.match(/^['\"]/)) {\n return `\"${value}\"`;\n }\n return value;\n};\n"],"mappings":";;;;;;;;;;AAIA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMI,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,oDAAsC,EACnEC,cAAc,EACd;EACEC,iBAAiB,EAAE,qBAAqB;EACxCC,kBAAkB,EAAE;AACtB,CAAC,EACD,iBACF,CAAC;AAEM,MAAMC,QAAQ,GAAAL,OAAA,CAAAK,QAAA,GAAG,IAAAJ,oDAAsC,EAC5DK,OAAO,EACP;EACEH,iBAAiB,EAAE,cAAc;EACjCC,kB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AAO,CAACJ,MAAM,CAAC,IAAI,EAAE,CAAC;EAEjD,IAAI,CAACK,IAAI,EAAE;IACT,OAAOK,OAAO;EAChB;EACA,MAAME,UAAU,GAAGC,YAAY,CAACR,IAAI,CAAC;EAErC,MAAM,GAAGS,YAAY,CAAC,GAAG,IAAAC,+BAAqB,EAACL,OAAO,CAAC;EAEvD,IAAAM,4CAA+B,EAACN,OAAO,EAAEI,YAAY,CAACG,sBAAsB,CAAC,CAACC,OAAO,CACnF,CAAC,GAAGC,IAAI,CAA4B,KAAK;IACvCA,IAAI,CAACC,aAAa,CAACC,YAAY,GAAGT,UAAU;EAC9C,CACF,CAAC;EAED,OAAOF,OAAO;AAChB;AAEA,MAAMG,YAAY,GAAIS,KAAa,IAAK;EACtC,IAAI,CAACA,KAAK,CAACC,KAAK,CAAC,OAAO,CAAC,EAAE;IACzB,OAAQ,IAAGD,KAAM,GAAE;EACrB;EACA,OAAOA,KAAK;AACd,CAAC"}
@@ -14,19 +14,15 @@ function _iosPlugins() {
14
14
  };
15
15
  return data;
16
16
  }
17
- const withOrientation = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setOrientation, {
17
+ const withOrientation = exports.withOrientation = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setOrientation, {
18
18
  infoPlistProperty: 'UISupportedInterfaceOrientations',
19
19
  expoConfigProperty: 'orientation'
20
20
  }, 'withOrientation');
21
- exports.withOrientation = withOrientation;
22
21
  function getOrientation(config) {
23
- var _config$orientation;
24
- return (_config$orientation = config.orientation) !== null && _config$orientation !== void 0 ? _config$orientation : null;
22
+ return config.orientation ?? null;
25
23
  }
26
- const PORTRAIT_ORIENTATIONS = ['UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown'];
27
- exports.PORTRAIT_ORIENTATIONS = PORTRAIT_ORIENTATIONS;
28
- const LANDSCAPE_ORIENTATIONS = ['UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight'];
29
- exports.LANDSCAPE_ORIENTATIONS = LANDSCAPE_ORIENTATIONS;
24
+ const PORTRAIT_ORIENTATIONS = exports.PORTRAIT_ORIENTATIONS = ['UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown'];
25
+ const LANDSCAPE_ORIENTATIONS = exports.LANDSCAPE_ORIENTATIONS = ['UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight'];
30
26
  function getUISupportedInterfaceOrientations(orientation) {
31
27
  if (orientation === 'portrait') {
32
28
  return PORTRAIT_ORIENTATIONS;
@@ -1 +1 @@
1
- {"version":3,"file":"Orientation.js","names":["_iosPlugins","data","require","withOrientation","createInfoPlistPluginWithPropertyGuard","setOrientation","infoPlistProperty","expoConfigProperty","exports","getOrientation","config","_config$orientation","orientation","PORTRAIT_ORIENTATIONS","LANDSCAPE_ORIENTATIONS","getUISupportedInterfaceOrientations","infoPlist","UISupportedInterfaceOrientations"],"sources":["../../src/ios/Orientation.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist, InterfaceOrientation } from './IosConfig.types';\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\n\nexport const withOrientation = createInfoPlistPluginWithPropertyGuard(\n setOrientation,\n {\n infoPlistProperty: 'UISupportedInterfaceOrientations',\n expoConfigProperty: 'orientation',\n },\n 'withOrientation'\n);\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return config.orientation ?? null;\n}\n\nexport const PORTRAIT_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n];\n\nexport const LANDSCAPE_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction getUISupportedInterfaceOrientations(orientation: string | null): InterfaceOrientation[] {\n if (orientation === 'portrait') {\n return PORTRAIT_ORIENTATIONS;\n } else if (orientation === 'landscape') {\n return LANDSCAPE_ORIENTATIONS;\n } else {\n return [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS];\n }\n}\n\nexport function setOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const orientation = getOrientation(config);\n\n return {\n ...infoPlist,\n UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation),\n };\n}\n"],"mappings":";;;;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,eAAe,GAAG,IAAAC,oDAAsC,EACnEC,cAAc,EACd;EACEC,iBAAiB,EAAE,kCAAkC;EACrDC,kBAAkB,EAAE;AACtB,CAAC,EACD,iBACF,CAAC;AAACC,OAAA,CAAAL,eAAA,GAAAA,eAAA;AAEK,SAASM,cAAcA,CAACC,MAAuC,EAAE;EAAA,IAAAC,mBAAA;EACtE,QAAAA,mBAAA,GAAOD,MAAM,CAACE,WAAW,cAAAD,mBAAA,cAAAA,mBAAA,GAAI,IAAI;AACnC;AAEO,MAAME,qBAA6C,GAAG,CAC3D,gCAAgC,EAChC,0CAA0C,CAC3C;AAACL,OAAA,CAAAK,qBAAA,GAAAA,qBAAA;AAEK,MAAMC,sBAA8C,GAAG,CAC5D,qCAAqC,EACrC,sCAAsC,CACvC;AAACN,OAAA,CAAAM,sBAAA,GAAAA,sBAAA;AAEF,SAASC,mCAAmCA,CAACH,WAA0B,EAA0B;EAC/F,IAAIA,WAAW,KAAK,UAAU,EAAE;IAC9B,OAAOC,qBAAqB;EAC9B,CAAC,MAAM,IAAID,WAAW,KAAK,WAAW,EAAE;IACtC,OAAOE,sBAAsB;EAC/B,CAAC,MAAM;IACL,OAAO,CAAC,GAAGD,qBAAqB,EAAE,GAAGC,sBAAsB,CAAC;EAC9D;AACF;AAEO,SAAST,cAAcA,CAC5BK,MAAuC,EACvCM,SAAoB,EACT;EACX,MAAMJ,WAAW,GAAGH,cAAc,CAACC,MAAM,CAAC;EAE1C,OAAO;IACL,GAAGM,SAAS;IACZC,gCAAgC,EAAEF,mCAAmC,CAACH,WAAW;EACnF,CAAC;AACH"}
1
+ {"version":3,"file":"Orientation.js","names":["_iosPlugins","data","require","withOrientation","exports","createInfoPlistPluginWithPropertyGuard","setOrientation","infoPlistProperty","expoConfigProperty","getOrientation","config","orientation","PORTRAIT_ORIENTATIONS","LANDSCAPE_ORIENTATIONS","getUISupportedInterfaceOrientations","infoPlist","UISupportedInterfaceOrientations"],"sources":["../../src/ios/Orientation.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist, InterfaceOrientation } from './IosConfig.types';\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\n\nexport const withOrientation = createInfoPlistPluginWithPropertyGuard(\n setOrientation,\n {\n infoPlistProperty: 'UISupportedInterfaceOrientations',\n expoConfigProperty: 'orientation',\n },\n 'withOrientation'\n);\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return config.orientation ?? null;\n}\n\nexport const PORTRAIT_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n];\n\nexport const LANDSCAPE_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction getUISupportedInterfaceOrientations(orientation: string | null): InterfaceOrientation[] {\n if (orientation === 'portrait') {\n return PORTRAIT_ORIENTATIONS;\n } else if (orientation === 'landscape') {\n return LANDSCAPE_ORIENTATIONS;\n } else {\n return [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS];\n }\n}\n\nexport function setOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const orientation = getOrientation(config);\n\n return {\n ...infoPlist,\n UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation),\n };\n}\n"],"mappings":";;;;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,oDAAsC,EACnEC,cAAc,EACd;EACEC,iBAAiB,EAAE,kCAAkC;EACrDC,kBAAkB,EAAE;AACtB,CAAC,EACD,iBACF,CAAC;AAEM,SAASC,cAAcA,CAACC,MAAuC,EAAE;EACtE,OAAOA,MAAM,CAACC,WAAW,IAAI,IAAI;AACnC;AAEO,MAAMC,qBAA6C,GAAAR,OAAA,CAAAQ,qBAAA,GAAG,CAC3D,gCAAgC,EAChC,0CAA0C,CAC3C;AAEM,MAAMC,sBAA8C,GAAAT,OAAA,CAAAS,sBAAA,GAAG,CAC5D,qCAAqC,EACrC,sCAAsC,CACvC;AAED,SAASC,mCAAmCA,CAACH,WAA0B,EAA0B;EAC/F,IAAIA,WAAW,KAAK,UAAU,EAAE;IAC9B,OAAOC,qBAAqB;EAC9B,CAAC,MAAM,IAAID,WAAW,KAAK,WAAW,EAAE;IACtC,OAAOE,sBAAsB;EAC/B,CAAC,MAAM;IACL,OAAO,CAAC,GAAGD,qBAAqB,EAAE,GAAGC,sBAAsB,CAAC;EAC9D;AACF;AAEO,SAASP,cAAcA,CAC5BI,MAAuC,EACvCK,SAAoB,EACT;EACX,MAAMJ,WAAW,GAAGF,cAAc,CAACC,MAAM,CAAC;EAE1C,OAAO;IACL,GAAGK,SAAS;IACZC,gCAAgC,EAAEF,mCAAmC,CAACH,WAAW;EACnF,CAAC;AACH"}
@@ -63,8 +63,8 @@ function _warnings() {
63
63
  };
64
64
  return data;
65
65
  }
66
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
67
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
66
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
67
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
68
68
  const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
69
69
  function getAppDelegateHeaderFilePath(projectRoot) {
70
70
  const [using, ...extra] = (0, _glob().sync)('ios/*/AppDelegate.h', {
@@ -1 +1 @@
1
- {"version":3,"file":"Paths.js","names":["_fs","data","require","_glob","path","_interopRequireWildcard","Entitlements","_errors","_warnings","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ignoredPaths","getAppDelegateHeaderFilePath","projectRoot","using","extra","globSync","absolute","cwd","ignore","UnexpectedError","length","warnMultipleFiles","tag","fileName","getAppDelegateFilePath","getAppDelegateObjcHeaderFilePath","getLanguage","filePath","extension","extname","getFileInfo","normalize","contents","readFileSync","language","getAppDelegate","getSourceRoot","appDelegate","dirname","findSchemePaths","findSchemeNames","schemePaths","map","schemePath","parse","name","getAllXcodeProjectPaths","iosFolder","pbxprojPaths","filter","project","test","sort","a","b","isAInIos","isBInIos","value","join","getXcodeProjectPath","getAllPBXProjectPaths","projectPaths","paths","existsSync","getPBXProjectPath","getAllInfoPlistPaths","getInfoPlistPath","getAllEntitlementsPaths","getEntitlementsPath","getSupportingPath","resolve","basename","getExpoPlistPath","supportingPath","usingPath","relative","extraPaths","v","addWarningIOS","JSON","stringify"],"sources":["../../src/ios/Paths.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'fs';\nimport { sync as globSync } from 'glob';\nimport * as path from 'path';\n\nimport * as Entitlements from './Entitlements';\nimport { UnexpectedError } from '../utils/errors';\nimport { addWarningIOS } from '../utils/warnings';\n\nconst ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];\n\ninterface ProjectFile<L extends string = string> {\n path: string;\n language: L;\n contents: string;\n}\n\ntype AppleLanguage = 'objc' | 'objcpp' | 'swift';\n\nexport type AppDelegateProjectFile = ProjectFile<AppleLanguage>;\n\nexport function getAppDelegateHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(\n `Could not locate a valid AppDelegate header at root: \"${projectRoot}\"`\n );\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-header',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.@(m|mm|swift)', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateObjcHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate.h at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-objc-header',\n fileName: 'AppDelegate.h',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nfunction getLanguage(filePath: string): AppleLanguage {\n const extension = path.extname(filePath);\n switch (extension) {\n case '.mm':\n return 'objcpp';\n case '.m':\n case '.h':\n return 'objc';\n case '.swift':\n return 'swift';\n default:\n throw new UnexpectedError(`Unexpected iOS file extension: ${extension}`);\n }\n}\n\nexport function getFileInfo(filePath: string) {\n return {\n path: path.normalize(filePath),\n contents: readFileSync(filePath, 'utf8'),\n language: getLanguage(filePath),\n };\n}\n\nexport function getAppDelegate(projectRoot: string): AppDelegateProjectFile {\n const filePath = getAppDelegateFilePath(projectRoot);\n return getFileInfo(filePath);\n}\n\nexport function getSourceRoot(projectRoot: string): string {\n const appDelegate = getAppDelegate(projectRoot);\n return path.dirname(appDelegate.path);\n}\n\nexport function findSchemePaths(projectRoot: string): string[] {\n return globSync('ios/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n}\n\nexport function findSchemeNames(projectRoot: string): string[] {\n const schemePaths = findSchemePaths(projectRoot);\n return schemePaths.map((schemePath) => path.parse(schemePath).name);\n}\n\nexport function getAllXcodeProjectPaths(projectRoot: string): string[] {\n const iosFolder = 'ios';\n const pbxprojPaths = globSync('ios/**/*.xcodeproj', { cwd: projectRoot, ignore: ignoredPaths })\n .filter(\n (project) => !/test|example|sample/i.test(project) || path.dirname(project) === iosFolder\n )\n // sort alphabetically to ensure this works the same across different devices (Fail in CI (linux) without this)\n .sort()\n .sort((a, b) => {\n const isAInIos = path.dirname(a) === iosFolder;\n const isBInIos = path.dirname(b) === iosFolder;\n // preserve previous sort order\n if ((isAInIos && isBInIos) || (!isAInIos && !isBInIos)) {\n return 0;\n }\n return isAInIos ? -1 : 1;\n });\n\n if (!pbxprojPaths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj files relative to path \"${projectRoot}\".`\n );\n }\n return pbxprojPaths.map((value) => path.join(projectRoot, value));\n}\n\n/**\n * Get the pbxproj for the given path\n */\nexport function getXcodeProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllXcodeProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'xcodeproj',\n fileName: '*.xcodeproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllPBXProjectPaths(projectRoot: string): string[] {\n const projectPaths = getAllXcodeProjectPaths(projectRoot);\n const paths = projectPaths\n .map((value) => path.join(value, 'project.pbxproj'))\n .filter((value) => existsSync(value));\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj/project.pbxproj files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getPBXProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllPBXProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'project-pbxproj',\n fileName: 'project.pbxproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllInfoPlistPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/Info.plist', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n }).sort(\n // longer name means more suffixes, we want the shortest possible one to be first.\n (a, b) => a.length - b.length\n );\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate Info.plist files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getInfoPlistPath(projectRoot: string): string {\n const [using, ...extra] = getAllInfoPlistPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'info-plist',\n fileName: 'Info.plist',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllEntitlementsPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/*.entitlements', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n return paths;\n}\n\n/**\n * @deprecated: use Entitlements.getEntitlementsPath instead\n */\nexport function getEntitlementsPath(projectRoot: string): string | null {\n return Entitlements.getEntitlementsPath(projectRoot);\n}\n\nexport function getSupportingPath(projectRoot: string): string {\n return path.resolve(projectRoot, 'ios', path.basename(getSourceRoot(projectRoot)), 'Supporting');\n}\n\nexport function getExpoPlistPath(projectRoot: string): string {\n const supportingPath = getSupportingPath(projectRoot);\n return path.join(supportingPath, 'Expo.plist');\n}\n\nfunction warnMultipleFiles({\n tag,\n fileName,\n projectRoot,\n using,\n extra,\n}: {\n tag: string;\n fileName: string;\n projectRoot?: string;\n using: string;\n extra: string[];\n}) {\n const usingPath = projectRoot ? path.relative(projectRoot, using) : using;\n const extraPaths = projectRoot ? extra.map((v) => path.relative(projectRoot, v)) : extra;\n addWarningIOS(\n `paths-${tag}`,\n `Found multiple ${fileName} file paths, using \"${usingPath}\". Ignored paths: ${JSON.stringify(\n extraPaths\n )}`\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAA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AAEC,KAAK,CAAC,GAAGA,KAAK;EACzE,MAAM+D,UAAU,GAAGhE,WAAW,GAAGE,KAAK,CAAC4B,GAAG,CAAEmC,CAAC,IAAK9F,IAAI,CAAD,CAAC,CAAC4F,QAAQ,CAAC/D,WAAW,EAAEiE,CAAC,CAAC,CAAC,GAAG/D,KAAK;EACxF,IAAAgE,yBAAa,EACV,SAAQxD,GAAI,EAAC,EACb,kBAAiBC,QAAS,uBAAsBmD,SAAU,qBAAoBK,IAAI,CAACC,SAAS,CAC3FJ,UACF,CAAE,EACJ,CAAC;AACH"}
1
+ {"version":3,"file":"Paths.js","names":["_fs","data","require","_glob","path","_interopRequireWildcard","Entitlements","_errors","_warnings","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ignoredPaths","getAppDelegateHeaderFilePath","projectRoot","using","extra","globSync","absolute","cwd","ignore","UnexpectedError","length","warnMultipleFiles","tag","fileName","getAppDelegateFilePath","getAppDelegateObjcHeaderFilePath","getLanguage","filePath","extension","extname","getFileInfo","normalize","contents","readFileSync","language","getAppDelegate","getSourceRoot","appDelegate","dirname","findSchemePaths","findSchemeNames","schemePaths","map","schemePath","parse","name","getAllXcodeProjectPaths","iosFolder","pbxprojPaths","filter","project","test","sort","b","isAInIos","isBInIos","value","join","getXcodeProjectPath","getAllPBXProjectPaths","projectPaths","paths","existsSync","getPBXProjectPath","getAllInfoPlistPaths","getInfoPlistPath","getAllEntitlementsPaths","getEntitlementsPath","getSupportingPath","resolve","basename","getExpoPlistPath","supportingPath","usingPath","relative","extraPaths","v","addWarningIOS","JSON","stringify"],"sources":["../../src/ios/Paths.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'fs';\nimport { sync as globSync } from 'glob';\nimport * as path from 'path';\n\nimport * as Entitlements from './Entitlements';\nimport { UnexpectedError } from '../utils/errors';\nimport { addWarningIOS } from '../utils/warnings';\n\nconst ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];\n\ninterface ProjectFile<L extends string = string> {\n path: string;\n language: L;\n contents: string;\n}\n\ntype AppleLanguage = 'objc' | 'objcpp' | 'swift';\n\nexport type AppDelegateProjectFile = ProjectFile<AppleLanguage>;\n\nexport function getAppDelegateHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(\n `Could not locate a valid AppDelegate header at root: \"${projectRoot}\"`\n );\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-header',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.@(m|mm|swift)', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateObjcHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate.h at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-objc-header',\n fileName: 'AppDelegate.h',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nfunction getLanguage(filePath: string): AppleLanguage {\n const extension = path.extname(filePath);\n switch (extension) {\n case '.mm':\n return 'objcpp';\n case '.m':\n case '.h':\n return 'objc';\n case '.swift':\n return 'swift';\n default:\n throw new UnexpectedError(`Unexpected iOS file extension: ${extension}`);\n }\n}\n\nexport function getFileInfo(filePath: string) {\n return {\n path: path.normalize(filePath),\n contents: readFileSync(filePath, 'utf8'),\n language: getLanguage(filePath),\n };\n}\n\nexport function getAppDelegate(projectRoot: string): AppDelegateProjectFile {\n const filePath = getAppDelegateFilePath(projectRoot);\n return getFileInfo(filePath);\n}\n\nexport function getSourceRoot(projectRoot: string): string {\n const appDelegate = getAppDelegate(projectRoot);\n return path.dirname(appDelegate.path);\n}\n\nexport function findSchemePaths(projectRoot: string): string[] {\n return globSync('ios/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n}\n\nexport function findSchemeNames(projectRoot: string): string[] {\n const schemePaths = findSchemePaths(projectRoot);\n return schemePaths.map((schemePath) => path.parse(schemePath).name);\n}\n\nexport function getAllXcodeProjectPaths(projectRoot: string): string[] {\n const iosFolder = 'ios';\n const pbxprojPaths = globSync('ios/**/*.xcodeproj', { cwd: projectRoot, ignore: ignoredPaths })\n .filter(\n (project) => !/test|example|sample/i.test(project) || path.dirname(project) === iosFolder\n )\n // sort alphabetically to ensure this works the same across different devices (Fail in CI (linux) without this)\n .sort()\n .sort((a, b) => {\n const isAInIos = path.dirname(a) === iosFolder;\n const isBInIos = path.dirname(b) === iosFolder;\n // preserve previous sort order\n if ((isAInIos && isBInIos) || (!isAInIos && !isBInIos)) {\n return 0;\n }\n return isAInIos ? -1 : 1;\n });\n\n if (!pbxprojPaths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj files relative to path \"${projectRoot}\".`\n );\n }\n return pbxprojPaths.map((value) => path.join(projectRoot, value));\n}\n\n/**\n * Get the pbxproj for the given path\n */\nexport function getXcodeProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllXcodeProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'xcodeproj',\n fileName: '*.xcodeproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllPBXProjectPaths(projectRoot: string): string[] {\n const projectPaths = getAllXcodeProjectPaths(projectRoot);\n const paths = projectPaths\n .map((value) => path.join(value, 'project.pbxproj'))\n .filter((value) => existsSync(value));\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj/project.pbxproj files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getPBXProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllPBXProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'project-pbxproj',\n fileName: 'project.pbxproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllInfoPlistPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/Info.plist', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n }).sort(\n // longer name means more suffixes, we want the shortest possible one to be first.\n (a, b) => a.length - b.length\n );\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate Info.plist files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getInfoPlistPath(projectRoot: string): string {\n const [using, ...extra] = getAllInfoPlistPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'info-plist',\n fileName: 'Info.plist',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllEntitlementsPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/*.entitlements', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n return paths;\n}\n\n/**\n * @deprecated: use Entitlements.getEntitlementsPath instead\n */\nexport function getEntitlementsPath(projectRoot: string): string | null {\n return Entitlements.getEntitlementsPath(projectRoot);\n}\n\nexport function getSupportingPath(projectRoot: string): string {\n return path.resolve(projectRoot, 'ios', path.basename(getSourceRoot(projectRoot)), 'Supporting');\n}\n\nexport function getExpoPlistPath(projectRoot: string): string {\n const supportingPath = getSupportingPath(projectRoot);\n return path.join(supportingPath, 'Expo.plist');\n}\n\nfunction warnMultipleFiles({\n tag,\n fileName,\n projectRoot,\n using,\n extra,\n}: {\n tag: string;\n fileName: string;\n projectRoot?: string;\n using: string;\n extra: string[];\n}) {\n const usingPath = projectRoot ? path.relative(projectRoot, using) : using;\n const extraPaths = projectRoot ? extra.map((v) => path.relative(projectRoot, v)) : extra;\n addWarningIOS(\n `paths-${tag}`,\n `Found multiple ${fileName} file paths, using \"${usingPath}\". Ignored paths: ${JSON.stringify(\n extraPaths\n )}`\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAH,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAI,uBAAA,CAAAH,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,UAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,SAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkD,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CA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AAY,CAAC;AAClG;AAEO,SAAS2D,gBAAgBA,CAAC3D,WAAmB,EAAU;EAC5D,MAAM4D,cAAc,GAAGJ,iBAAiB,CAACxD,WAAW,CAAC;EACrD,OAAO5B,IAAI,CAAD,CAAC,CAACyE,IAAI,CAACe,cAAc,EAAE,YAAY,CAAC;AAChD;AAEA,SAASnD,iBAAiBA,CAAC;EACzBC,GAAG;EACHC,QAAQ;EACRX,WAAW;EACXC,KAAK;EACLC;AAOF,CAAC,EAAE;EACD,MAAM2D,SAAS,GAAG7D,WAAW,GAAG5B,IAAI,CAAD,CAAC,CAAC0F,QAAQ,CAAC9D,WAAW,EAAEC,KAAK,CAAC,GAAGA,KAAK;EACzE,MAAM8D,UAAU,GAAG/D,WAAW,GAAGE,KAAK,CAAC4B,GAAG,CAAEkC,CAAC,IAAK5F,IAAI,CAAD,CAAC,CAAC0F,QAAQ,CAAC9D,WAAW,EAAEgE,CAAC,CAAC,CAAC,GAAG9D,KAAK;EACxF,IAAA+D,yBAAa,EACV,SAAQvD,GAAI,EAAC,EACb,kBAAiBC,QAAS,uBAAsBkD,SAAU,qBAAoBK,IAAI,CAACC,SAAS,CAC3FJ,UACF,CAAE,EACJ,CAAC;AACH"}
@@ -43,8 +43,7 @@ function _() {
43
43
  }
44
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
45
  function withPrivacyInfo(config) {
46
- var _config$ios;
47
- const privacyManifests = (_config$ios = config.ios) === null || _config$ios === void 0 ? void 0 : _config$ios.privacyManifests;
46
+ const privacyManifests = config.ios?.privacyManifests;
48
47
  if (!privacyManifests) {
49
48
  return config;
50
49
  }
@@ -92,7 +91,6 @@ function ensureFileExists(filePath, contents) {
92
91
  _fs().default.writeFileSync(filePath, contents);
93
92
  }
94
93
  function mergePrivacyInfo(existing, privacyManifests) {
95
- var _ref, _privacyManifests$NSP, _privacyManifests$NSP2, _privacyManifests$NSP3, _privacyManifests$NSP4;
96
94
  let {
97
95
  NSPrivacyAccessedAPITypes = [],
98
96
  NSPrivacyCollectedDataTypes = [],
@@ -100,29 +98,27 @@ function mergePrivacyInfo(existing, privacyManifests) {
100
98
  NSPrivacyTrackingDomains = []
101
99
  } = structuredClone(existing);
102
100
  // tracking is a boolean, so we can just overwrite it
103
- NSPrivacyTracking = (_ref = (_privacyManifests$NSP = privacyManifests.NSPrivacyTracking) !== null && _privacyManifests$NSP !== void 0 ? _privacyManifests$NSP : existing.NSPrivacyTracking) !== null && _ref !== void 0 ? _ref : false;
101
+ NSPrivacyTracking = privacyManifests.NSPrivacyTracking ?? existing.NSPrivacyTracking ?? false;
104
102
  // merge the api types – for each type ensure the key is in the array, and if it is add the reason if it's not there
105
- (_privacyManifests$NSP2 = privacyManifests.NSPrivacyAccessedAPITypes) === null || _privacyManifests$NSP2 === void 0 ? void 0 : _privacyManifests$NSP2.forEach(newType => {
103
+ privacyManifests.NSPrivacyAccessedAPITypes?.forEach(newType => {
106
104
  const existingType = NSPrivacyAccessedAPITypes.find(t => t.NSPrivacyAccessedAPIType === newType.NSPrivacyAccessedAPIType);
107
105
  if (!existingType) {
108
106
  NSPrivacyAccessedAPITypes.push(newType);
109
107
  } else {
110
- var _existingType$NSPriva;
111
- existingType.NSPrivacyAccessedAPITypeReasons = [...new Set(existingType === null || existingType === void 0 ? void 0 : (_existingType$NSPriva = existingType.NSPrivacyAccessedAPITypeReasons) === null || _existingType$NSPriva === void 0 ? void 0 : _existingType$NSPriva.concat(...newType.NSPrivacyAccessedAPITypeReasons))];
108
+ existingType.NSPrivacyAccessedAPITypeReasons = [...new Set(existingType?.NSPrivacyAccessedAPITypeReasons?.concat(...newType.NSPrivacyAccessedAPITypeReasons))];
112
109
  }
113
110
  });
114
111
  // merge the collected data types – for each type ensure the key is in the array, and if it is add the purposes if it's not there
115
- (_privacyManifests$NSP3 = privacyManifests.NSPrivacyCollectedDataTypes) === null || _privacyManifests$NSP3 === void 0 ? void 0 : _privacyManifests$NSP3.forEach(newType => {
112
+ privacyManifests.NSPrivacyCollectedDataTypes?.forEach(newType => {
116
113
  const existingType = NSPrivacyCollectedDataTypes.find(t => t.NSPrivacyCollectedDataType === newType.NSPrivacyCollectedDataType);
117
114
  if (!existingType) {
118
115
  NSPrivacyCollectedDataTypes.push(newType);
119
116
  } else {
120
- var _existingType$NSPriva2;
121
- existingType.NSPrivacyCollectedDataTypePurposes = [...new Set(existingType === null || existingType === void 0 ? void 0 : (_existingType$NSPriva2 = existingType.NSPrivacyCollectedDataTypePurposes) === null || _existingType$NSPriva2 === void 0 ? void 0 : _existingType$NSPriva2.concat(...newType.NSPrivacyCollectedDataTypePurposes))];
117
+ existingType.NSPrivacyCollectedDataTypePurposes = [...new Set(existingType?.NSPrivacyCollectedDataTypePurposes?.concat(...newType.NSPrivacyCollectedDataTypePurposes))];
122
118
  }
123
119
  });
124
120
  // merge the tracking domains
125
- NSPrivacyTrackingDomains = [...new Set(NSPrivacyTrackingDomains.concat((_privacyManifests$NSP4 = privacyManifests.NSPrivacyTrackingDomains) !== null && _privacyManifests$NSP4 !== void 0 ? _privacyManifests$NSP4 : []))];
121
+ NSPrivacyTrackingDomains = [...new Set(NSPrivacyTrackingDomains.concat(privacyManifests.NSPrivacyTrackingDomains ?? []))];
126
122
  return {
127
123
  NSPrivacyAccessedAPITypes,
128
124
  NSPrivacyCollectedDataTypes,
@@ -1 +1 @@
1
- {"version":3,"file":"PrivacyInfo.js","names":["_plist","data","_interopRequireDefault","require","_fs","_path","_Xcodeproj","_","obj","__esModule","default","withPrivacyInfo","config","_config$ios","privacyManifests","ios","withXcodeProject","projectConfig","setPrivacyInfo","projectRoot","platformProjectRoot","modRequest","projectName","getProjectName","privacyFilePath","path","join","existingFileContent","getFileContents","parsedContent","plist","parse","mergedContent","mergePrivacyInfo","contents","build","ensureFileExists","modResults","hasFile","addResourceFileToGroup","filepath","groupName","project","isBuildFile","verbose","filePath","fs","existsSync","readFileSync","encoding","dirname","mkdirSync","recursive","writeFileSync","existing","_ref","_privacyManifests$NSP","_privacyManifests$NSP2","_privacyManifests$NSP3","_privacyManifests$NSP4","NSPrivacyAccessedAPITypes","NSPrivacyCollectedDataTypes","NSPrivacyTracking","NSPrivacyTrackingDomains","structuredClone","forEach","newType","existingType","find","t","NSPrivacyAccessedAPIType","push","_existingType$NSPriva","NSPrivacyAccessedAPITypeReasons","Set","concat","NSPrivacyCollectedDataType","_existingType$NSPriva2","NSPrivacyCollectedDataTypePurposes"],"sources":["../../src/ios/PrivacyInfo.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport plist from '@expo/plist';\nimport fs from 'fs';\nimport path from 'path';\nimport type { XcodeProject } from 'xcode';\n\nimport { addResourceFileToGroup, getProjectName } from './utils/Xcodeproj';\nimport { ExportedConfigWithProps, withXcodeProject } from '..';\n\nexport type PrivacyInfo = {\n NSPrivacyAccessedAPITypes: {\n NSPrivacyAccessedAPIType: string;\n NSPrivacyAccessedAPITypeReasons: string[];\n }[];\n NSPrivacyCollectedDataTypes: {\n NSPrivacyCollectedDataType: string;\n NSPrivacyCollectedDataTypeLinked: boolean;\n NSPrivacyCollectedDataTypeTracking: boolean;\n NSPrivacyCollectedDataTypePurposes: string[];\n }[];\n NSPrivacyTracking: boolean;\n NSPrivacyTrackingDomains: string[];\n};\n\nexport function withPrivacyInfo(config: ExpoConfig): ExpoConfig {\n const privacyManifests = config.ios?.privacyManifests;\n if (!privacyManifests) {\n return config;\n }\n\n return withXcodeProject(config, (projectConfig: ExportedConfigWithProps<XcodeProject>) => {\n return setPrivacyInfo(projectConfig, privacyManifests);\n });\n}\n\nexport function setPrivacyInfo(\n projectConfig: ExportedConfigWithProps<XcodeProject>,\n privacyManifests: Partial<PrivacyInfo>\n) {\n const { projectRoot, platformProjectRoot } = projectConfig.modRequest;\n\n const projectName = getProjectName(projectRoot);\n\n const privacyFilePath = path.join(platformProjectRoot, projectName, 'PrivacyInfo.xcprivacy');\n\n const existingFileContent = getFileContents(privacyFilePath);\n\n const parsedContent = existingFileContent ? plist.parse(existingFileContent) : {};\n const mergedContent = mergePrivacyInfo(parsedContent, privacyManifests);\n const contents = plist.build(mergedContent);\n\n ensureFileExists(privacyFilePath, contents);\n\n if (!projectConfig.modResults.hasFile(privacyFilePath)) {\n projectConfig.modResults = addResourceFileToGroup({\n filepath: privacyFilePath,\n groupName: projectName,\n project: projectConfig.modResults,\n isBuildFile: true,\n verbose: true,\n });\n }\n\n return projectConfig;\n}\n\nfunction getFileContents(filePath: string): string | null {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n return fs.readFileSync(filePath, { encoding: 'utf8' });\n}\n\nfunction ensureFileExists(filePath: string, contents: string) {\n if (!fs.existsSync(path.dirname(filePath))) {\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n }\n fs.writeFileSync(filePath, contents);\n}\n\nexport function mergePrivacyInfo(\n existing: Partial<PrivacyInfo>,\n privacyManifests: Partial<PrivacyInfo>\n): PrivacyInfo {\n let {\n NSPrivacyAccessedAPITypes = [],\n NSPrivacyCollectedDataTypes = [],\n NSPrivacyTracking = false,\n NSPrivacyTrackingDomains = [],\n } = structuredClone(existing);\n // tracking is a boolean, so we can just overwrite it\n NSPrivacyTracking = privacyManifests.NSPrivacyTracking ?? existing.NSPrivacyTracking ?? false;\n // merge the api types – for each type ensure the key is in the array, and if it is add the reason if it's not there\n privacyManifests.NSPrivacyAccessedAPITypes?.forEach((newType) => {\n const existingType = NSPrivacyAccessedAPITypes.find(\n (t) => t.NSPrivacyAccessedAPIType === newType.NSPrivacyAccessedAPIType\n );\n if (!existingType) {\n NSPrivacyAccessedAPITypes.push(newType);\n } else {\n existingType.NSPrivacyAccessedAPITypeReasons = [\n ...new Set(\n existingType?.NSPrivacyAccessedAPITypeReasons?.concat(\n ...newType.NSPrivacyAccessedAPITypeReasons\n )\n ),\n ];\n }\n });\n // merge the collected data types – for each type ensure the key is in the array, and if it is add the purposes if it's not there\n privacyManifests.NSPrivacyCollectedDataTypes?.forEach((newType) => {\n const existingType = NSPrivacyCollectedDataTypes.find(\n (t) => t.NSPrivacyCollectedDataType === newType.NSPrivacyCollectedDataType\n );\n if (!existingType) {\n NSPrivacyCollectedDataTypes.push(newType);\n } else {\n existingType.NSPrivacyCollectedDataTypePurposes = [\n ...new Set(\n existingType?.NSPrivacyCollectedDataTypePurposes?.concat(\n ...newType.NSPrivacyCollectedDataTypePurposes\n )\n ),\n ];\n }\n });\n // merge the tracking domains\n NSPrivacyTrackingDomains = [\n ...new Set(NSPrivacyTrackingDomains.concat(privacyManifests.NSPrivacyTrackingDomains ?? [])),\n ];\n\n return {\n NSPrivacyAccessedAPITypes,\n NSPrivacyCollectedDataTypes,\n NSPrivacyTracking,\n NSPrivacyTrackingDomains,\n };\n}\n"],"mappings":";;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,EAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,CAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA+D,SAAAC,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OA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,cAAAJ,sBAAA,cAAAA,sBAAA,GAAI,EAAE,CAAC,CAAC,CAC7F;EAED,OAAO;IACLC,yBAAyB;IACzBC,2BAA2B;IAC3BC,iBAAiB;IACjBC;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"PrivacyInfo.js","names":["_plist","data","_interopRequireDefault","require","_fs","_path","_Xcodeproj","_","obj","__esModule","default","withPrivacyInfo","config","privacyManifests","ios","withXcodeProject","projectConfig","setPrivacyInfo","projectRoot","platformProjectRoot","modRequest","projectName","getProjectName","privacyFilePath","path","join","existingFileContent","getFileContents","parsedContent","plist","parse","mergedContent","mergePrivacyInfo","contents","build","ensureFileExists","modResults","hasFile","addResourceFileToGroup","filepath","groupName","project","isBuildFile","verbose","filePath","fs","existsSync","readFileSync","encoding","dirname","mkdirSync","recursive","writeFileSync","existing","NSPrivacyAccessedAPITypes","NSPrivacyCollectedDataTypes","NSPrivacyTracking","NSPrivacyTrackingDomains","structuredClone","forEach","newType","existingType","find","t","NSPrivacyAccessedAPIType","push","NSPrivacyAccessedAPITypeReasons","Set","concat","NSPrivacyCollectedDataType","NSPrivacyCollectedDataTypePurposes"],"sources":["../../src/ios/PrivacyInfo.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport plist from '@expo/plist';\nimport fs from 'fs';\nimport path from 'path';\nimport type { XcodeProject } from 'xcode';\n\nimport { addResourceFileToGroup, getProjectName } from './utils/Xcodeproj';\nimport { ExportedConfigWithProps, withXcodeProject } from '..';\n\nexport type PrivacyInfo = {\n NSPrivacyAccessedAPITypes: {\n NSPrivacyAccessedAPIType: string;\n NSPrivacyAccessedAPITypeReasons: string[];\n }[];\n NSPrivacyCollectedDataTypes: {\n NSPrivacyCollectedDataType: string;\n NSPrivacyCollectedDataTypeLinked: boolean;\n NSPrivacyCollectedDataTypeTracking: boolean;\n NSPrivacyCollectedDataTypePurposes: string[];\n }[];\n NSPrivacyTracking: boolean;\n NSPrivacyTrackingDomains: string[];\n};\n\nexport function withPrivacyInfo(config: ExpoConfig): ExpoConfig {\n const privacyManifests = config.ios?.privacyManifests;\n if (!privacyManifests) {\n return config;\n }\n\n return withXcodeProject(config, (projectConfig: ExportedConfigWithProps<XcodeProject>) => {\n return setPrivacyInfo(projectConfig, privacyManifests);\n });\n}\n\nexport function setPrivacyInfo(\n projectConfig: ExportedConfigWithProps<XcodeProject>,\n privacyManifests: Partial<PrivacyInfo>\n) {\n const { projectRoot, platformProjectRoot } = projectConfig.modRequest;\n\n const projectName = getProjectName(projectRoot);\n\n const privacyFilePath = path.join(platformProjectRoot, projectName, 'PrivacyInfo.xcprivacy');\n\n const existingFileContent = getFileContents(privacyFilePath);\n\n const parsedContent = existingFileContent ? plist.parse(existingFileContent) : {};\n const mergedContent = mergePrivacyInfo(parsedContent, privacyManifests);\n const contents = plist.build(mergedContent);\n\n ensureFileExists(privacyFilePath, contents);\n\n if (!projectConfig.modResults.hasFile(privacyFilePath)) {\n projectConfig.modResults = addResourceFileToGroup({\n filepath: privacyFilePath,\n groupName: projectName,\n project: projectConfig.modResults,\n isBuildFile: true,\n verbose: true,\n });\n }\n\n return projectConfig;\n}\n\nfunction getFileContents(filePath: string): string | null {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n return fs.readFileSync(filePath, { encoding: 'utf8' });\n}\n\nfunction ensureFileExists(filePath: string, contents: string) {\n if (!fs.existsSync(path.dirname(filePath))) {\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n }\n fs.writeFileSync(filePath, contents);\n}\n\nexport function mergePrivacyInfo(\n existing: Partial<PrivacyInfo>,\n privacyManifests: Partial<PrivacyInfo>\n): PrivacyInfo {\n let {\n NSPrivacyAccessedAPITypes = [],\n NSPrivacyCollectedDataTypes = [],\n NSPrivacyTracking = false,\n NSPrivacyTrackingDomains = [],\n } = structuredClone(existing);\n // tracking is a boolean, so we can just overwrite it\n NSPrivacyTracking = privacyManifests.NSPrivacyTracking ?? existing.NSPrivacyTracking ?? false;\n // merge the api types – for each type ensure the key is in the array, and if it is add the reason if it's not there\n privacyManifests.NSPrivacyAccessedAPITypes?.forEach((newType) => {\n const existingType = NSPrivacyAccessedAPITypes.find(\n (t) => t.NSPrivacyAccessedAPIType === newType.NSPrivacyAccessedAPIType\n );\n if (!existingType) {\n NSPrivacyAccessedAPITypes.push(newType);\n } else {\n existingType.NSPrivacyAccessedAPITypeReasons = [\n ...new Set(\n existingType?.NSPrivacyAccessedAPITypeReasons?.concat(\n ...newType.NSPrivacyAccessedAPITypeReasons\n )\n ),\n ];\n }\n });\n // merge the collected data types – for each type ensure the key is in the array, and if it is add the purposes if it's not there\n privacyManifests.NSPrivacyCollectedDataTypes?.forEach((newType) => {\n const existingType = NSPrivacyCollectedDataTypes.find(\n (t) => t.NSPrivacyCollectedDataType === newType.NSPrivacyCollectedDataType\n );\n if (!existingType) {\n NSPrivacyCollectedDataTypes.push(newType);\n } else {\n existingType.NSPrivacyCollectedDataTypePurposes = [\n ...new Set(\n existingType?.NSPrivacyCollectedDataTypePurposes?.concat(\n ...newType.NSPrivacyCollectedDataTypePurposes\n )\n ),\n ];\n }\n });\n // merge the tracking domains\n NSPrivacyTrackingDomains = [\n ...new Set(NSPrivacyTrackingDomains.concat(privacyManifests.NSPrivacyTrackingDomains ?? [])),\n ];\n\n return {\n NSPrivacyAccessedAPITypes,\n NSPrivacyCollectedDataTypes,\n NSPrivacyTracking,\n NSPrivacyTrackingDomains,\n };\n}\n"],"mappings":";;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,C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AAC;AACH"}
@@ -27,16 +27,14 @@ function _warnings() {
27
27
  };
28
28
  return data;
29
29
  }
30
- const withRequiresFullScreen = (0, _iosPlugins().createInfoPlistPlugin)(setRequiresFullScreen, 'withRequiresFullScreen');
30
+ const withRequiresFullScreen = exports.withRequiresFullScreen = (0, _iosPlugins().createInfoPlistPlugin)(setRequiresFullScreen, 'withRequiresFullScreen');
31
31
 
32
32
  // NOTES: This is defaulted to `true` for now to match the behavior prior to SDK
33
33
  // 34, but will change to `false` in SDK +43.
34
- exports.withRequiresFullScreen = withRequiresFullScreen;
35
34
  function getRequiresFullScreen(config) {
36
- var _config$ios;
37
35
  // Yes, the property is called ios.requireFullScreen, without the s - not "requires"
38
36
  // This is confusing indeed because the actual property name does have the s
39
- if ((_config$ios = config.ios) !== null && _config$ios !== void 0 && _config$ios.hasOwnProperty('requireFullScreen')) {
37
+ if (config.ios?.hasOwnProperty('requireFullScreen')) {
40
38
  return !!config.ios.requireFullScreen;
41
39
  } else {
42
40
  // In SDK 43, the `requireFullScreen` default has been changed to false.
@@ -1 +1 @@
1
- {"version":3,"file":"RequiresFullScreen.js","names":["_iosPlugins","data","require","_versions","_warnings","withRequiresFullScreen","createInfoPlistPlugin","setRequiresFullScreen","exports","getRequiresFullScreen","config","_config$ios","ios","hasOwnProperty","requireFullScreen","gteSdkVersion","iPadInterfaceKey","requiredIPadInterface","isStringArray","value","Array","isArray","every","hasMinimumOrientations","masks","mask","includes","resolveExistingIpadInterfaceOrientations","interfaceOrientations","length","existingList","join","addWarningIOS","infoPlist","requiresFullScreen","existing","Set","concat","UIRequiresFullScreen"],"sources":["../../src/ios/RequiresFullScreen.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist } from './IosConfig.types';\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { gteSdkVersion } from '../utils/versions';\nimport { addWarningIOS } from '../utils/warnings';\n\nexport const withRequiresFullScreen = createInfoPlistPlugin(\n setRequiresFullScreen,\n 'withRequiresFullScreen'\n);\n\n// NOTES: This is defaulted to `true` for now to match the behavior prior to SDK\n// 34, but will change to `false` in SDK +43.\nexport function getRequiresFullScreen(config: Pick<ExpoConfig, 'ios' | 'sdkVersion'>) {\n // Yes, the property is called ios.requireFullScreen, without the s - not \"requires\"\n // This is confusing indeed because the actual property name does have the s\n if (config.ios?.hasOwnProperty('requireFullScreen')) {\n return !!config.ios.requireFullScreen;\n } else {\n // In SDK 43, the `requireFullScreen` default has been changed to false.\n if (\n gteSdkVersion(config, '43.0.0')\n // TODO: Uncomment after SDK 43 is released.\n // || !config.sdkVersion\n ) {\n return false;\n }\n return true;\n }\n}\n\nconst iPadInterfaceKey = 'UISupportedInterfaceOrientations~ipad';\n\nconst requiredIPadInterface = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction isStringArray(value: any): value is string[] {\n return Array.isArray(value) && value.every((value) => typeof value === 'string');\n}\n\nfunction hasMinimumOrientations(masks: string[]): boolean {\n return requiredIPadInterface.every((mask) => masks.includes(mask));\n}\n\n/**\n * Require full screen being disabled requires all ipad interfaces to to be added,\n * otherwise submissions to the iOS App Store will fail.\n *\n * ERROR ITMS-90474: \"Invalid Bundle. iPad Multitasking support requires these orientations: 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'. Found 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown' in bundle 'com.bacon.app'.\"\n *\n * @param interfaceOrientations\n * @returns\n */\nfunction resolveExistingIpadInterfaceOrientations(interfaceOrientations: any): string[] {\n if (\n // Ensure type.\n isStringArray(interfaceOrientations) &&\n // Don't warn if it's an empty array, this is invalid regardless.\n interfaceOrientations.length &&\n // Check if the minimum requirements are met.\n !hasMinimumOrientations(interfaceOrientations)\n ) {\n const existingList = interfaceOrientations!.join(', ');\n addWarningIOS(\n 'ios.requireFullScreen',\n `iPad multitasking requires all \\`${iPadInterfaceKey}\\` orientations to be defined in the Info.plist. The Info.plist currently defines values that are incompatible with multitasking, these will be overwritten to prevent submission failure. Existing: ${existingList}`\n );\n return interfaceOrientations;\n }\n return [];\n}\n\n// Whether requires full screen on iPad\nexport function setRequiresFullScreen(\n config: Pick<ExpoConfig, 'ios'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const requiresFullScreen = getRequiresFullScreen(config);\n if (!requiresFullScreen) {\n const existing = resolveExistingIpadInterfaceOrientations(infoPlist[iPadInterfaceKey]);\n\n // There currently exists no mechanism to safely undo this feature besides `npx expo prebuild --clear`,\n // this seems ok though because anyone using `UISupportedInterfaceOrientations~ipad` probably\n // wants them to be defined to this value anyways. This is also the default value used in the Xcode iOS template.\n\n // Merge any previous interfaces with the required interfaces.\n infoPlist[iPadInterfaceKey] = [...new Set(existing.concat(requiredIPadInterface))];\n }\n\n return {\n ...infoPlist,\n UIRequiresFullScreen: requiresFullScreen,\n };\n}\n"],"mappings":";;;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMI,sBAAsB,GAAG,IAAAC,mCAAqB,EACzDC,qBAAqB,EACrB,wBACF,CAAC;;AAED;AACA;AAAAC,OAAA,CAAAH,sBAAA,GAAAA,sBAAA;AACO,SAASI,qBAAqBA,CAACC,MAA8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qBA,CACnCG,MAA+B,EAC/BuB,SAAoB,EACT;EACX,MAAMC,kBAAkB,GAAGzB,qBAAqB,CAACC,MAAM,CAAC;EACxD,IAAI,CAACwB,kBAAkB,EAAE;IACvB,MAAMC,QAAQ,GAAGR,wCAAwC,CAACM,SAAS,CAACjB,gBAAgB,CAAC,CAAC;;IAEtF;IACA;IACA;;IAEA;IACAiB,SAAS,CAACjB,gBAAgB,CAAC,GAAG,CAAC,GAAG,IAAIoB,GAAG,CAACD,QAAQ,CAACE,MAAM,CAACpB,qBAAqB,CAAC,CAAC,CAAC;EACpF;EAEA,OAAO;IACL,GAAGgB,SAAS;IACZK,oBAAoB,EAAEJ;EACxB,CAAC;AACH"}
1
+ {"version":3,"file":"RequiresFullScreen.js","names":["_iosPlugins","data","require","_versions","_warnings","withRequiresFullScreen","exports","createInfoPlistPlugin","setRequiresFullScreen","getRequiresFullScreen","config","ios","hasOwnProperty","requireFullScreen","gteSdkVersion","iPadInterfaceKey","requiredIPadInterface","isStringArray","value","Array","isArray","every","hasMinimumOrientations","masks","mask","includes","resolveExistingIpadInterfaceOrientations","interfaceOrientations","length","existingList","join","addWarningIOS","infoPlist","requiresFullScreen","existing","Set","concat","UIRequiresFullScreen"],"sources":["../../src/ios/RequiresFullScreen.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist } from './IosConfig.types';\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { gteSdkVersion } from '../utils/versions';\nimport { addWarningIOS } from '../utils/warnings';\n\nexport const withRequiresFullScreen = createInfoPlistPlugin(\n setRequiresFullScreen,\n 'withRequiresFullScreen'\n);\n\n// NOTES: This is defaulted to `true` for now to match the behavior prior to SDK\n// 34, but will change to `false` in SDK +43.\nexport function getRequiresFullScreen(config: Pick<ExpoConfig, 'ios' | 'sdkVersion'>) {\n // Yes, the property is called ios.requireFullScreen, without the s - not \"requires\"\n // This is confusing indeed because the actual property name does have the s\n if (config.ios?.hasOwnProperty('requireFullScreen')) {\n return !!config.ios.requireFullScreen;\n } else {\n // In SDK 43, the `requireFullScreen` default has been changed to false.\n if (\n gteSdkVersion(config, '43.0.0')\n // TODO: Uncomment after SDK 43 is released.\n // || !config.sdkVersion\n ) {\n return false;\n }\n return true;\n }\n}\n\nconst iPadInterfaceKey = 'UISupportedInterfaceOrientations~ipad';\n\nconst requiredIPadInterface = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction isStringArray(value: any): value is string[] {\n return Array.isArray(value) && value.every((value) => typeof value === 'string');\n}\n\nfunction hasMinimumOrientations(masks: string[]): boolean {\n return requiredIPadInterface.every((mask) => masks.includes(mask));\n}\n\n/**\n * Require full screen being disabled requires all ipad interfaces to to be added,\n * otherwise submissions to the iOS App Store will fail.\n *\n * ERROR ITMS-90474: \"Invalid Bundle. iPad Multitasking support requires these orientations: 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'. Found 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown' in bundle 'com.bacon.app'.\"\n *\n * @param interfaceOrientations\n * @returns\n */\nfunction resolveExistingIpadInterfaceOrientations(interfaceOrientations: any): string[] {\n if (\n // Ensure type.\n isStringArray(interfaceOrientations) &&\n // Don't warn if it's an empty array, this is invalid regardless.\n interfaceOrientations.length &&\n // Check if the minimum requirements are met.\n !hasMinimumOrientations(interfaceOrientations)\n ) {\n const existingList = interfaceOrientations!.join(', ');\n addWarningIOS(\n 'ios.requireFullScreen',\n `iPad multitasking requires all \\`${iPadInterfaceKey}\\` orientations to be defined in the Info.plist. The Info.plist currently defines values that are incompatible with multitasking, these will be overwritten to prevent submission failure. Existing: ${existingList}`\n );\n return interfaceOrientations;\n }\n return [];\n}\n\n// Whether requires full screen on iPad\nexport function setRequiresFullScreen(\n config: Pick<ExpoConfig, 'ios'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const requiresFullScreen = getRequiresFullScreen(config);\n if (!requiresFullScreen) {\n const existing = resolveExistingIpadInterfaceOrientations(infoPlist[iPadInterfaceKey]);\n\n // There currently exists no mechanism to safely undo this feature besides `npx expo prebuild --clear`,\n // this seems ok though because anyone using `UISupportedInterfaceOrientations~ipad` probably\n // wants them to be defined to this value anyways. This is also the default value used in the Xcode iOS template.\n\n // Merge any previous interfaces with the required interfaces.\n infoPlist[iPadInterfaceKey] = [...new Set(existing.concat(requiredIPadInterface))];\n }\n\n return {\n ...infoPlist,\n UIRequiresFullScreen: requiresFullScreen,\n };\n}\n"],"mappings":";;;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMI,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,IAAAE,mCAAqB,EACzDC,qBAAqB,EACrB,wBACF,CAAC;;AAED;AACA;AACO,SAASC,qBAAqBA,CAACC,MAA8C,EAAE;EACpF;EACA;EACA,IAAIA,MAAM,CAACC,GAAG,EAAEC,cAAc,CAAC,mBAAmB,CAAC,EAAE;IACnD,OAAO,CAAC,CAACF,MAAM,CAACC,GAAG,CAACE,iBAAiB;EACvC,CAAC,MAAM;IACL;IACA,IACE,IAAAC,yBAAa,EAACJ,MAAM,EAAE,QAAQ;IAC9B;IACA;IAAA,EACA;MACA,OA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AAQ,CAACE,MAAM,CAACpB,qBAAqB,CAAC,CAAC,CAAC;EACpF;EAEA,OAAO;IACL,GAAGgB,SAAS;IACZK,oBAAoB,EAAEJ;EACxB,CAAC;AACH"}
@@ -17,11 +17,10 @@ function _iosPlugins() {
17
17
  };
18
18
  return data;
19
19
  }
20
- const withScheme = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setScheme, {
20
+ const withScheme = exports.withScheme = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setScheme, {
21
21
  infoPlistProperty: 'CFBundleURLTypes',
22
22
  expoConfigProperty: 'scheme'
23
23
  }, 'withScheme');
24
- exports.withScheme = withScheme;
25
24
  function getScheme(config) {
26
25
  if (Array.isArray(config.scheme)) {
27
26
  const validate = value => {
@@ -34,12 +33,11 @@ function getScheme(config) {
34
33
  return [];
35
34
  }
36
35
  function setScheme(config, infoPlist) {
37
- var _config$ios, _config$ios2;
38
36
  const scheme = [...getScheme(config),
39
37
  // @ts-ignore: TODO: ios.scheme is an unreleased -- harder to add to turtle v1.
40
- ...getScheme((_config$ios = config.ios) !== null && _config$ios !== void 0 ? _config$ios : {})];
38
+ ...getScheme(config.ios ?? {})];
41
39
  // Add the bundle identifier to the list of schemes for easier Google auth and parity with Turtle v1.
42
- if ((_config$ios2 = config.ios) !== null && _config$ios2 !== void 0 && _config$ios2.bundleIdentifier) {
40
+ if (config.ios?.bundleIdentifier) {
43
41
  scheme.push(config.ios.bundleIdentifier);
44
42
  }
45
43
  if (scheme.length === 0) {
@@ -53,12 +51,11 @@ function setScheme(config, infoPlist) {
53
51
  };
54
52
  }
55
53
  function appendScheme(scheme, infoPlist) {
56
- var _infoPlist$CFBundleUR;
57
54
  if (!scheme) {
58
55
  return infoPlist;
59
56
  }
60
- const existingSchemes = (_infoPlist$CFBundleUR = infoPlist.CFBundleURLTypes) !== null && _infoPlist$CFBundleUR !== void 0 ? _infoPlist$CFBundleUR : [];
61
- if (existingSchemes !== null && existingSchemes !== void 0 && existingSchemes.some(({
57
+ const existingSchemes = infoPlist.CFBundleURLTypes ?? [];
58
+ if (existingSchemes?.some(({
62
59
  CFBundleURLSchemes
63
60
  }) => CFBundleURLSchemes.includes(scheme))) {
64
61
  return infoPlist;
@@ -94,7 +91,7 @@ function removeScheme(scheme, infoPlist) {
94
91
  function hasScheme(scheme, infoPlist) {
95
92
  const existingSchemes = infoPlist.CFBundleURLTypes;
96
93
  if (!Array.isArray(existingSchemes)) return false;
97
- return existingSchemes === null || existingSchemes === void 0 ? void 0 : existingSchemes.some(({
94
+ return existingSchemes?.some(({
98
95
  CFBundleURLSchemes: schemes
99
96
  }) => Array.isArray(schemes) ? schemes.includes(scheme) : false);
100
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Scheme.js","names":["_iosPlugins","data","require","withScheme","createInfoPlistPluginWithPropertyGuard","setScheme","infoPlistProperty","expoConfigProperty","exports","getScheme","config","Array","isArray","scheme","validate","value","filter","infoPlist","_config$ios","_config$ios2","ios","bundleIdentifier","push","length","CFBundleURLTypes","CFBundleURLSchemes","appendScheme","_infoPlist$CFBundleUR","existingSchemes","some","includes","removeScheme","map","bundleUrlType","index","indexOf","splice","undefined","Boolean","hasScheme","schemes","getSchemesFromPlist","reduce"],"sources":["../../src/ios/Scheme.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist, URLScheme } from './IosConfig.types';\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\n\nexport const withScheme = createInfoPlistPluginWithPropertyGuard(\n setScheme,\n {\n infoPlistProperty: 'CFBundleURLTypes',\n expoConfigProperty: 'scheme',\n },\n 'withScheme'\n);\n\nexport function getScheme(config: { scheme?: string | string[] }): string[] {\n if (Array.isArray(config.scheme)) {\n const validate = (value: any): value is string => {\n return typeof value === 'string';\n };\n return config.scheme.filter<string>(validate);\n } else if (typeof config.scheme === 'string') {\n return [config.scheme];\n }\n return [];\n}\n\nexport function setScheme(\n config: Partial<Pick<ExpoConfig, 'scheme' | 'ios'>>,\n infoPlist: InfoPlist\n): InfoPlist {\n const scheme = [\n ...getScheme(config),\n // @ts-ignore: TODO: ios.scheme is an unreleased -- harder to add to turtle v1.\n ...getScheme(config.ios ?? {}),\n ];\n // Add the bundle identifier to the list of schemes for easier Google auth and parity with Turtle v1.\n if (config.ios?.bundleIdentifier) {\n scheme.push(config.ios.bundleIdentifier);\n }\n if (scheme.length === 0) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleURLTypes: [{ CFBundleURLSchemes: scheme }],\n };\n}\n\nexport function appendScheme(scheme: string | null, infoPlist: InfoPlist): InfoPlist {\n if (!scheme) {\n return infoPlist;\n }\n\n const existingSchemes = infoPlist.CFBundleURLTypes ?? [];\n if (existingSchemes?.some(({ CFBundleURLSchemes }) => CFBundleURLSchemes.includes(scheme))) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleURLTypes: [\n ...existingSchemes,\n {\n CFBundleURLSchemes: [scheme],\n },\n ],\n };\n}\n\nexport function removeScheme(scheme: string | null, infoPlist: InfoPlist): InfoPlist {\n if (!scheme) {\n return infoPlist;\n }\n\n // No need to remove if we don't have any\n if (!infoPlist.CFBundleURLTypes) {\n return infoPlist;\n }\n\n infoPlist.CFBundleURLTypes = infoPlist.CFBundleURLTypes.map((bundleUrlType) => {\n const index = bundleUrlType.CFBundleURLSchemes.indexOf(scheme);\n if (index > -1) {\n bundleUrlType.CFBundleURLSchemes.splice(index, 1);\n if (bundleUrlType.CFBundleURLSchemes.length === 0) {\n return undefined;\n }\n }\n return bundleUrlType;\n }).filter(Boolean) as URLScheme[];\n\n return infoPlist;\n}\n\nexport function hasScheme(scheme: string, infoPlist: InfoPlist): boolean {\n const existingSchemes = infoPlist.CFBundleURLTypes;\n\n if (!Array.isArray(existingSchemes)) return false;\n\n return existingSchemes?.some(({ CFBundleURLSchemes: schemes }: any) =>\n Array.isArray(schemes) ? schemes.includes(scheme) : false\n );\n}\n\nexport function getSchemesFromPlist(infoPlist: InfoPlist): string[] {\n if (Array.isArray(infoPlist.CFBundleURLTypes)) {\n return infoPlist.CFBundleURLTypes.reduce<string[]>((schemes, { CFBundleURLSchemes }) => {\n if (Array.isArray(CFBundleURLSchemes)) {\n return [...schemes, ...CFBundleURLSchemes];\n }\n return schemes;\n }, []);\n }\n return [];\n}\n"],"mappings":";;;;;;;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,UAAU,GAAG,IAAAC,oDAAsC,EAC9DC,SAAS,EACT;EACEC,iBAAiB,EAAE,kBAAkB;EACrCC,kBAAkB,EAAE;AACtB,CAAC,EACD,YACF,CAAC;AAACC,OAAA,CAAAL,UAAA,GAAAA,UAAA;AAEK,SAASM,SAASA,CAACC,MAAsC,EAAY;EAC1E,IAAIC,KAAK,CAACC,OAAO,CAACF,MAAM,CAACG,MAAM,CAAC,EAAE;IAChC,MAAMC,QAAQ,GAAIC,KAAU,IAAsB;MAChD,OAAO,OAAOA,KAAK,KAAK,QAAQ;IAClC,CAAC;IACD,OAAOL,MAAM,CAACG,MAAM,CAACG,MAAM,CAASF,QAAQ,CAAC;EAC/C,CAAC,MAAM,IAAI,OAAOJ,MAAM,CAACG,MAAM,KAAK,QAAQ,EAAE;IAC5C,OAAO,CAACH,MAAM,CAACG,MAAM,CAAC;EACxB;EACA,OAAO,EAAE;AACX;AAEO,SAASR,SAASA,CACvBK,MAAmD,EACnDO,SAAoB,EACT;EAAA,IAAAC,WAAA,EAAAC,YAAA;EACX,MAAMN,MAAM,GAAG,CACb,GAAGJ,SAAS,CAACC,MAAM,CAAC;EACpB;EACA,GAAGD,SAAS,EAAAS,WAAA,GAACR,MAAM,CAACU,GAAG,cAAAF,WAAA,cAAAA,WAAA,GAAI,CAAC,CAAC,CAAC,CAC/B;EACD;EACA,KAAAC,YAAA,GAAIT,M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9D,IAAIqB,KAAK,GAAG,CAAC,CAAC,EAAE;MACdD,aAAa,CAACR,kBAAkB,CAACW,MAAM,CAACF,KAAK,EAAE,CAAC,CAAC;MACjD,IAAID,aAAa,CAACR,kBAAkB,CAACF,MAAM,KAAK,CAAC,EAAE;QACjD,OAAOc,SAAS;MAClB;IACF;IACA,OAAOJ,aAAa;EACtB,CAAC,CAAC,CAACjB,MAAM,CAACsB,OAAO,CAAgB;EAEjC,OAAOrB,SAAS;AAClB;AAEO,SAASsB,SAASA,CAAC1B,MAAc,EAAEI,SAAoB,EAAW;EACvE,MAAMW,eAAe,GAAGX,SAAS,CAACO,gBAAgB;EAElD,IAAI,CAACb,KAAK,CAACC,OAAO,CAACgB,eAAe,CAAC,EAAE,OAAO,KAAK;EAEjD,OAAOA,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAEC,IAAI,CAAC,CAAC;IAAEJ,kBAAkB,EAAEe;EAAa,CAAC,KAChE7B,KAAK,CAACC,OAAO,CAAC4B,OAAO,CAAC,GAAGA,OAAO,CAACV,QAAQ,CAACjB,MAAM,CAAC,GAAG,KACtD,CAAC;AACH;AAEO,SAAS4B,mBAAmBA,CAACxB,SAAoB,EAAY;EAClE,IAAIN,KAAK,CAACC,OAAO,CAACK,SAAS,CAACO,gBAAgB,CAAC,EAAE;IAC7C,OAAOP,SAAS,CAACO,gBAAgB,CAACkB,MAAM,CAAW,CAACF,OAAO,EAAE;MAAEf;IAAmB,CAAC,KAAK;MACtF,IAAId,KAAK,CAACC,OAAO,CAACa,kBAAkB,CAAC,EAAE;QACrC,OAAO,CAAC,GAAGe,OAAO,EAAE,GAAGf,kBAAkB,CAAC;MAC5C;MACA,OAAOe,OAAO;IAChB,CAAC,EAAE,EAAE,CAAC;EACR;EACA,OAAO,EAAE;AACX"}
1
+ {"version":3,"file":"Scheme.js","names":["_iosPlugins","data","require","withScheme","exports","createInfoPlistPluginWithPropertyGuard","setScheme","infoPlistProperty","expoConfigProperty","getScheme","config","Array","isArray","scheme","validate","value","filter","infoPlist","ios","bundleIdentifier","push","length","CFBundleURLTypes","CFBundleURLSchemes","appendScheme","existingSchemes","some","includes","removeScheme","map","bundleUrlType","index","indexOf","splice","undefined","Boolean","hasScheme","schemes","getSchemesFromPlist","reduce"],"sources":["../../src/ios/Scheme.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist, URLScheme } from './IosConfig.types';\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\n\nexport const withScheme = createInfoPlistPluginWithPropertyGuard(\n setScheme,\n {\n infoPlistProperty: 'CFBundleURLTypes',\n expoConfigProperty: 'scheme',\n },\n 'withScheme'\n);\n\nexport function getScheme(config: { scheme?: string | string[] }): string[] {\n if (Array.isArray(config.scheme)) {\n const validate = (value: any): value is string => {\n return typeof value === 'string';\n };\n return config.scheme.filter<string>(validate);\n } else if (typeof config.scheme === 'string') {\n return [config.scheme];\n }\n return [];\n}\n\nexport function setScheme(\n config: Partial<Pick<ExpoConfig, 'scheme' | 'ios'>>,\n infoPlist: InfoPlist\n): InfoPlist {\n const scheme = [\n ...getScheme(config),\n // @ts-ignore: TODO: ios.scheme is an unreleased -- harder to add to turtle v1.\n ...getScheme(config.ios ?? {}),\n ];\n // Add the bundle identifier to the list of schemes for easier Google auth and parity with Turtle v1.\n if (config.ios?.bundleIdentifier) {\n scheme.push(config.ios.bundleIdentifier);\n }\n if (scheme.length === 0) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleURLTypes: [{ CFBundleURLSchemes: scheme }],\n };\n}\n\nexport function appendScheme(scheme: string | null, infoPlist: InfoPlist): InfoPlist {\n if (!scheme) {\n return infoPlist;\n }\n\n const existingSchemes = infoPlist.CFBundleURLTypes ?? [];\n if (existingSchemes?.some(({ CFBundleURLSchemes }) => CFBundleURLSchemes.includes(scheme))) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleURLTypes: [\n ...existingSchemes,\n {\n CFBundleURLSchemes: [scheme],\n },\n ],\n };\n}\n\nexport function removeScheme(scheme: string | null, infoPlist: InfoPlist): InfoPlist {\n if (!scheme) {\n return infoPlist;\n }\n\n // No need to remove if we don't have any\n if (!infoPlist.CFBundleURLTypes) {\n return infoPlist;\n }\n\n infoPlist.CFBundleURLTypes = infoPlist.CFBundleURLTypes.map((bundleUrlType) => {\n const index = bundleUrlType.CFBundleURLSchemes.indexOf(scheme);\n if (index > -1) {\n bundleUrlType.CFBundleURLSchemes.splice(index, 1);\n if (bundleUrlType.CFBundleURLSchemes.length === 0) {\n return undefined;\n }\n }\n return bundleUrlType;\n }).filter(Boolean) as URLScheme[];\n\n return infoPlist;\n}\n\nexport function hasScheme(scheme: string, infoPlist: InfoPlist): boolean {\n const existingSchemes = infoPlist.CFBundleURLTypes;\n\n if (!Array.isArray(existingSchemes)) return false;\n\n return existingSchemes?.some(({ CFBundleURLSchemes: schemes }: any) =>\n Array.isArray(schemes) ? schemes.includes(scheme) : false\n );\n}\n\nexport function getSchemesFromPlist(infoPlist: InfoPlist): string[] {\n if (Array.isArray(infoPlist.CFBundleURLTypes)) {\n return infoPlist.CFBundleURLTypes.reduce<string[]>((schemes, { CFBundleURLSchemes }) => {\n if (Array.isArray(CFBundleURLSchemes)) {\n return [...schemes, ...CFBundleURLSchemes];\n }\n return schemes;\n }, []);\n }\n return [];\n}\n"],"mappings":";;;;;;;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,IAAAE,oDAAsC,EAC9DC,SAAS,EACT;EACEC,iBAAiB,EAAE,kBAAkB;EACrCC,kBAAkB,EAAE;AACtB,CAAC,EACD,YACF,CAAC;AAEM,SAASC,SAASA,CAACC,MAAsC,EAAY;EAC1E,IAAIC,KAAK,CAACC,OAAO,CAACF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AgB,CAACiB,MAAM,CAAW,CAACF,OAAO,EAAE;MAAEd;IAAmB,CAAC,KAAK;MACtF,IAAIZ,KAAK,CAACC,OAAO,CAACW,kBAAkB,CAAC,EAAE;QACrC,OAAO,CAAC,GAAGc,OAAO,EAAE,GAAGd,kBAAkB,CAAC;MAC5C;MACA,OAAOc,OAAO;IAChB,CAAC,EAAE,EAAE,CAAC;EACR;EACA,OAAO,EAAE;AACX"}
@@ -127,7 +127,7 @@ function getDesignatedSwiftBridgingHeaderFileReference({
127
127
  } of Object.values(configurations || {})) {
128
128
  // Guessing that this is the best way to emulate Xcode.
129
129
  // Using `project.addToBuildSettings` modifies too many targets.
130
- if (typeof (buildSettings === null || buildSettings === void 0 ? void 0 : buildSettings.PRODUCT_NAME) !== 'undefined') {
130
+ if (typeof buildSettings?.PRODUCT_NAME !== 'undefined') {
131
131
  if (typeof buildSettings.SWIFT_OBJC_BRIDGING_HEADER === 'string' && buildSettings.SWIFT_OBJC_BRIDGING_HEADER) {
132
132
  return buildSettings.SWIFT_OBJC_BRIDGING_HEADER;
133
133
  }
@@ -152,7 +152,7 @@ function linkBridgingHeaderFile({
152
152
  } of Object.values(configurations || {})) {
153
153
  // Guessing that this is the best way to emulate Xcode.
154
154
  // Using `project.addToBuildSettings` modifies too many targets.
155
- if (typeof (buildSettings === null || buildSettings === void 0 ? void 0 : buildSettings.PRODUCT_NAME) !== 'undefined') {
155
+ if (typeof buildSettings?.PRODUCT_NAME !== 'undefined') {
156
156
  buildSettings.SWIFT_OBJC_BRIDGING_HEADER = bridgingHeader;
157
157
  }
158
158
  }