expo-targets 0.1.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 (231) hide show
  1. package/.eslintrc.js +2 -0
  2. package/README.md +244 -0
  3. package/android/build.gradle +22 -0
  4. package/android/src/main/java/expo/modules/targets/ExpoTargetsLogger.kt +98 -0
  5. package/android/src/main/java/expo/modules/targets/ExpoTargetsReceiver.kt +136 -0
  6. package/android/src/main/java/expo/modules/targets/ExpoTargetsRemoteViewsProvider.kt +72 -0
  7. package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetProvider.kt +47 -0
  8. package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetSync.kt +78 -0
  9. package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetUpdateReceiver.kt +30 -0
  10. package/android/src/main/java/expo/modules/targets/extension/ExpoTargetsExtensionModule.kt +27 -0
  11. package/android/src/main/java/expo/modules/targets/messages/ExpoTargetsMessagesModule.kt +40 -0
  12. package/android/src/main/java/expo/modules/targets/storage/ExpoTargetsStorageModule.kt +119 -0
  13. package/app.plugin.js +1 -0
  14. package/build/metro/src/index.d.ts +2 -0
  15. package/build/metro/src/index.d.ts.map +1 -0
  16. package/build/metro/src/index.js +6 -0
  17. package/build/metro/src/index.js.map +1 -0
  18. package/build/metro/src/withTargetsMetro.d.ts +6 -0
  19. package/build/metro/src/withTargetsMetro.d.ts.map +1 -0
  20. package/build/metro/src/withTargetsMetro.js +171 -0
  21. package/build/metro/src/withTargetsMetro.js.map +1 -0
  22. package/build/plugin/src/android/config-plugins/withAndroidColors.d.ts +7 -0
  23. package/build/plugin/src/android/config-plugins/withAndroidColors.d.ts.map +1 -0
  24. package/build/plugin/src/android/config-plugins/withAndroidColors.js +56 -0
  25. package/build/plugin/src/android/config-plugins/withAndroidColors.js.map +1 -0
  26. package/build/plugin/src/android/config-plugins/withAndroidManifest.d.ts +7 -0
  27. package/build/plugin/src/android/config-plugins/withAndroidManifest.d.ts.map +1 -0
  28. package/build/plugin/src/android/config-plugins/withAndroidManifest.js +70 -0
  29. package/build/plugin/src/android/config-plugins/withAndroidManifest.js.map +1 -0
  30. package/build/plugin/src/android/config-plugins/withAndroidModule.d.ts +7 -0
  31. package/build/plugin/src/android/config-plugins/withAndroidModule.d.ts.map +1 -0
  32. package/build/plugin/src/android/config-plugins/withAndroidModule.js +41 -0
  33. package/build/plugin/src/android/config-plugins/withAndroidModule.js.map +1 -0
  34. package/build/plugin/src/android/config-plugins/withAndroidResources.d.ts +7 -0
  35. package/build/plugin/src/android/config-plugins/withAndroidResources.d.ts.map +1 -0
  36. package/build/plugin/src/android/config-plugins/withAndroidResources.js +75 -0
  37. package/build/plugin/src/android/config-plugins/withAndroidResources.js.map +1 -0
  38. package/build/plugin/src/android/config-plugins/withAndroidTarget.d.ts +28 -0
  39. package/build/plugin/src/android/config-plugins/withAndroidTarget.d.ts.map +1 -0
  40. package/build/plugin/src/android/config-plugins/withAndroidTarget.js +28 -0
  41. package/build/plugin/src/android/config-plugins/withAndroidTarget.js.map +1 -0
  42. package/build/plugin/src/android/config-plugins/withGradleModule.d.ts +7 -0
  43. package/build/plugin/src/android/config-plugins/withGradleModule.d.ts.map +1 -0
  44. package/build/plugin/src/android/config-plugins/withGradleModule.js +86 -0
  45. package/build/plugin/src/android/config-plugins/withGradleModule.js.map +1 -0
  46. package/build/plugin/src/android/config-plugins/withGradleSettings.d.ts +7 -0
  47. package/build/plugin/src/android/config-plugins/withGradleSettings.d.ts.map +1 -0
  48. package/build/plugin/src/android/config-plugins/withGradleSettings.js +23 -0
  49. package/build/plugin/src/android/config-plugins/withGradleSettings.js.map +1 -0
  50. package/build/plugin/src/android/withAndroidAppBuildGradle.d.ts +7 -0
  51. package/build/plugin/src/android/withAndroidAppBuildGradle.d.ts.map +1 -0
  52. package/build/plugin/src/android/withAndroidAppBuildGradle.js +31 -0
  53. package/build/plugin/src/android/withAndroidAppBuildGradle.js.map +1 -0
  54. package/build/plugin/src/android/withAndroidKotlinGradleProperty.d.ts +3 -0
  55. package/build/plugin/src/android/withAndroidKotlinGradleProperty.d.ts.map +1 -0
  56. package/build/plugin/src/android/withAndroidKotlinGradleProperty.js +24 -0
  57. package/build/plugin/src/android/withAndroidKotlinGradleProperty.js.map +1 -0
  58. package/build/plugin/src/android/withAndroidProjectKotlinVersion.d.ts +3 -0
  59. package/build/plugin/src/android/withAndroidProjectKotlinVersion.d.ts.map +1 -0
  60. package/build/plugin/src/android/withAndroidProjectKotlinVersion.js +27 -0
  61. package/build/plugin/src/android/withAndroidProjectKotlinVersion.js.map +1 -0
  62. package/build/plugin/src/android/withAndroidTarget.d.ts +10 -0
  63. package/build/plugin/src/android/withAndroidTarget.d.ts.map +1 -0
  64. package/build/plugin/src/android/withAndroidTarget.js +22 -0
  65. package/build/plugin/src/android/withAndroidTarget.js.map +1 -0
  66. package/build/plugin/src/android/withAndroidWidget.d.ts +13 -0
  67. package/build/plugin/src/android/withAndroidWidget.d.ts.map +1 -0
  68. package/build/plugin/src/android/withAndroidWidget.js +564 -0
  69. package/build/plugin/src/android/withAndroidWidget.js.map +1 -0
  70. package/build/plugin/src/config.d.ts +141 -0
  71. package/build/plugin/src/config.d.ts.map +1 -0
  72. package/build/plugin/src/config.js +54 -0
  73. package/build/plugin/src/config.js.map +1 -0
  74. package/build/plugin/src/index.d.ts +9 -0
  75. package/build/plugin/src/index.d.ts.map +1 -0
  76. package/build/plugin/src/index.js +11 -0
  77. package/build/plugin/src/index.js.map +1 -0
  78. package/build/plugin/src/ios/config-plugins/withEntitlements.d.ts +11 -0
  79. package/build/plugin/src/ios/config-plugins/withEntitlements.d.ts.map +1 -0
  80. package/build/plugin/src/ios/config-plugins/withEntitlements.js +49 -0
  81. package/build/plugin/src/ios/config-plugins/withEntitlements.js.map +1 -0
  82. package/build/plugin/src/ios/config-plugins/withIOSTarget.d.ts +17 -0
  83. package/build/plugin/src/ios/config-plugins/withIOSTarget.d.ts.map +1 -0
  84. package/build/plugin/src/ios/config-plugins/withIOSTarget.js +152 -0
  85. package/build/plugin/src/ios/config-plugins/withIOSTarget.js.map +1 -0
  86. package/build/plugin/src/ios/config-plugins/withIosColorset.d.ts +8 -0
  87. package/build/plugin/src/ios/config-plugins/withIosColorset.d.ts.map +1 -0
  88. package/build/plugin/src/ios/config-plugins/withIosColorset.js +25 -0
  89. package/build/plugin/src/ios/config-plugins/withIosColorset.js.map +1 -0
  90. package/build/plugin/src/ios/config-plugins/withIosStickerPack.d.ts +8 -0
  91. package/build/plugin/src/ios/config-plugins/withIosStickerPack.d.ts.map +1 -0
  92. package/build/plugin/src/ios/config-plugins/withIosStickerPack.js +52 -0
  93. package/build/plugin/src/ios/config-plugins/withIosStickerPack.js.map +1 -0
  94. package/build/plugin/src/ios/config-plugins/withPodfile.d.ts +12 -0
  95. package/build/plugin/src/ios/config-plugins/withPodfile.d.ts.map +1 -0
  96. package/build/plugin/src/ios/config-plugins/withPodfile.js +162 -0
  97. package/build/plugin/src/ios/config-plugins/withPodfile.js.map +1 -0
  98. package/build/plugin/src/ios/config-plugins/withXcodeChanges.d.ts +15 -0
  99. package/build/plugin/src/ios/config-plugins/withXcodeChanges.d.ts.map +1 -0
  100. package/build/plugin/src/ios/config-plugins/withXcodeChanges.js +646 -0
  101. package/build/plugin/src/ios/config-plugins/withXcodeChanges.js.map +1 -0
  102. package/build/plugin/src/ios/target.d.ts +41 -0
  103. package/build/plugin/src/ios/target.d.ts.map +1 -0
  104. package/build/plugin/src/ios/target.js +574 -0
  105. package/build/plugin/src/ios/target.js.map +1 -0
  106. package/build/plugin/src/ios/utils/asset.d.ts +60 -0
  107. package/build/plugin/src/ios/utils/asset.d.ts.map +1 -0
  108. package/build/plugin/src/ios/utils/asset.js +375 -0
  109. package/build/plugin/src/ios/utils/asset.js.map +1 -0
  110. package/build/plugin/src/ios/utils/file.d.ts +33 -0
  111. package/build/plugin/src/ios/utils/file.d.ts.map +1 -0
  112. package/build/plugin/src/ios/utils/file.js +88 -0
  113. package/build/plugin/src/ios/utils/file.js.map +1 -0
  114. package/build/plugin/src/ios/utils/index.d.ts +12 -0
  115. package/build/plugin/src/ios/utils/index.d.ts.map +1 -0
  116. package/build/plugin/src/ios/utils/index.js +38 -0
  117. package/build/plugin/src/ios/utils/index.js.map +1 -0
  118. package/build/plugin/src/ios/utils/paths.d.ts +128 -0
  119. package/build/plugin/src/ios/utils/paths.d.ts.map +1 -0
  120. package/build/plugin/src/ios/utils/paths.js +141 -0
  121. package/build/plugin/src/ios/utils/paths.js.map +1 -0
  122. package/build/plugin/src/ios/utils/plist.d.ts +29 -0
  123. package/build/plugin/src/ios/utils/plist.d.ts.map +1 -0
  124. package/build/plugin/src/ios/utils/plist.js +114 -0
  125. package/build/plugin/src/ios/utils/plist.js.map +1 -0
  126. package/build/plugin/src/ios/utils/podfile.d.ts +82 -0
  127. package/build/plugin/src/ios/utils/podfile.d.ts.map +1 -0
  128. package/build/plugin/src/ios/utils/podfile.js +408 -0
  129. package/build/plugin/src/ios/utils/podfile.js.map +1 -0
  130. package/build/plugin/src/ios/utils/reactNativeSwift.d.ts +11 -0
  131. package/build/plugin/src/ios/utils/reactNativeSwift.d.ts.map +1 -0
  132. package/build/plugin/src/ios/utils/reactNativeSwift.js +263 -0
  133. package/build/plugin/src/ios/utils/reactNativeSwift.js.map +1 -0
  134. package/build/plugin/src/ios/utils/xcode.d.ts +185 -0
  135. package/build/plugin/src/ios/utils/xcode.d.ts.map +1 -0
  136. package/build/plugin/src/ios/utils/xcode.js +706 -0
  137. package/build/plugin/src/ios/utils/xcode.js.map +1 -0
  138. package/build/plugin/src/logger.d.ts +10 -0
  139. package/build/plugin/src/logger.d.ts.map +1 -0
  140. package/build/plugin/src/logger.js +62 -0
  141. package/build/plugin/src/logger.js.map +1 -0
  142. package/build/plugin/src/parseTargetConfig.d.ts +3 -0
  143. package/build/plugin/src/parseTargetConfig.d.ts.map +1 -0
  144. package/build/plugin/src/parseTargetConfig.js +113 -0
  145. package/build/plugin/src/parseTargetConfig.js.map +1 -0
  146. package/build/plugin/src/withTargetsDir.d.ts +6 -0
  147. package/build/plugin/src/withTargetsDir.d.ts.map +1 -0
  148. package/build/plugin/src/withTargetsDir.js +90 -0
  149. package/build/plugin/src/withTargetsDir.js.map +1 -0
  150. package/build/src/Target.d.ts +43 -0
  151. package/build/src/Target.d.ts.map +1 -0
  152. package/build/src/Target.js +128 -0
  153. package/build/src/Target.js.map +1 -0
  154. package/build/src/index.d.ts +9 -0
  155. package/build/src/index.d.ts.map +1 -0
  156. package/build/src/index.js +27 -0
  157. package/build/src/index.js.map +1 -0
  158. package/build/src/modules/extension/index.d.ts +18 -0
  159. package/build/src/modules/extension/index.d.ts.map +1 -0
  160. package/build/src/modules/extension/index.js +44 -0
  161. package/build/src/modules/extension/index.js.map +1 -0
  162. package/build/src/modules/messages/index.d.ts +40 -0
  163. package/build/src/modules/messages/index.d.ts.map +1 -0
  164. package/build/src/modules/messages/index.js +94 -0
  165. package/build/src/modules/messages/index.js.map +1 -0
  166. package/build/src/modules/storage/index.d.ts +16 -0
  167. package/build/src/modules/storage/index.d.ts.map +1 -0
  168. package/build/src/modules/storage/index.js +122 -0
  169. package/build/src/modules/storage/index.js.map +1 -0
  170. package/expo-module.config.json +17 -0
  171. package/ios/ExpoTargetsExtension.podspec +23 -0
  172. package/ios/ExpoTargetsExtensionModule.swift +181 -0
  173. package/ios/ExpoTargetsMessages.podspec +23 -0
  174. package/ios/ExpoTargetsMessagesModule.swift +267 -0
  175. package/ios/ExpoTargetsStorage.podspec +23 -0
  176. package/ios/ExpoTargetsStorageModule.swift +91 -0
  177. package/ios/Tests/.swiftlint.yml +52 -0
  178. package/ios/Tests/Helpers/MockExtensionContext.swift +58 -0
  179. package/ios/Tests/Helpers/MockUserDefaults.swift +70 -0
  180. package/ios/Tests/Helpers/MockWidgetCenter.swift +71 -0
  181. package/ios/Tests/Helpers/TestHelpers.swift +90 -0
  182. package/ios/Tests/Integration/TargetIntegrationTests.swift +478 -0
  183. package/ios/Tests/Main/AllTests.swift +80 -0
  184. package/ios/Tests/Package.swift +66 -0
  185. package/ios/Tests/Performance/StoragePerformanceTests.swift +461 -0
  186. package/ios/Tests/Unit/Extension/ExpoTargetsExtensionModuleTests.swift +501 -0
  187. package/ios/Tests/Unit/Storage/ExpoTargetsStorageModuleTests.swift +578 -0
  188. package/ios/Tests/Unit/Template/ShareExtensionTemplateTests.swift +421 -0
  189. package/ios/Tests/XCTestPlan.xctestplan +87 -0
  190. package/metro/src/index.ts +1 -0
  191. package/metro/src/withTargetsMetro.ts +247 -0
  192. package/metro/tsconfig.build.json +9 -0
  193. package/package.json +74 -0
  194. package/plugin/src/android/withAndroidAppBuildGradle.ts +34 -0
  195. package/plugin/src/android/withAndroidTarget.ts +26 -0
  196. package/plugin/src/android/withAndroidWidget.ts +778 -0
  197. package/plugin/src/config.ts +255 -0
  198. package/plugin/src/index.ts +19 -0
  199. package/plugin/src/ios/config-plugins/withEntitlements.ts +69 -0
  200. package/plugin/src/ios/config-plugins/withIOSTarget.ts +179 -0
  201. package/plugin/src/ios/config-plugins/withIosColorset.ts +29 -0
  202. package/plugin/src/ios/config-plugins/withIosStickerPack.ts +65 -0
  203. package/plugin/src/ios/config-plugins/withPodfile.ts +238 -0
  204. package/plugin/src/ios/config-plugins/withXcodeChanges.ts +891 -0
  205. package/plugin/src/ios/target.ts +668 -0
  206. package/plugin/src/ios/templates/MessagesViewController.swift +120 -0
  207. package/plugin/src/ios/templates/ReactNativeViewController.swift +240 -0
  208. package/plugin/src/ios/templates/action-extension-data.swift +106 -0
  209. package/plugin/src/ios/templates/clip-extension-data.swift +28 -0
  210. package/plugin/src/ios/templates/messages-extension-data.swift +28 -0
  211. package/plugin/src/ios/templates/share-extension-data.swift +113 -0
  212. package/plugin/src/ios/utils/asset.ts +490 -0
  213. package/plugin/src/ios/utils/file.ts +80 -0
  214. package/plugin/src/ios/utils/index.ts +12 -0
  215. package/plugin/src/ios/utils/paths.ts +253 -0
  216. package/plugin/src/ios/utils/plist.ts +101 -0
  217. package/plugin/src/ios/utils/podfile.ts +534 -0
  218. package/plugin/src/ios/utils/reactNativeSwift.ts +283 -0
  219. package/plugin/src/ios/utils/xcode.ts +989 -0
  220. package/plugin/src/logger.ts +63 -0
  221. package/plugin/src/parseTargetConfig.ts +115 -0
  222. package/plugin/src/types/normalize-colors.d.ts +3 -0
  223. package/plugin/src/withTargetsDir.ts +120 -0
  224. package/plugin/tsconfig.build.json +9 -0
  225. package/plugin/tsconfig.json +9 -0
  226. package/src/Target.ts +239 -0
  227. package/src/index.ts +52 -0
  228. package/src/modules/extension/index.ts +54 -0
  229. package/src/modules/messages/index.ts +124 -0
  230. package/src/modules/storage/index.ts +126 -0
  231. package/tsconfig.json +8 -0
@@ -0,0 +1,238 @@
1
+ import {
2
+ ConfigPlugin,
3
+ withDangerousMod,
4
+ IOSConfig,
5
+ } from '@expo/config-plugins';
6
+ import path from 'path';
7
+
8
+ import { type ExtensionType } from '../../config';
9
+ import { Logger } from '../../logger';
10
+ import { Podfile, File } from '../utils';
11
+
12
+ const { getProjectName } = IOSConfig.XcodeUtils;
13
+
14
+ export const withTargetPodfile: ConfigPlugin<{
15
+ targetName: string;
16
+ deploymentTarget: string;
17
+ extensionType: ExtensionType;
18
+ excludedPackages?: string[];
19
+ standalone?: boolean;
20
+ logger: Logger;
21
+ }> = (config, props) => {
22
+ return withDangerousMod(config, [
23
+ 'ios',
24
+ async (config) => {
25
+ const podfilePath = path.join(
26
+ config.modRequest.platformProjectRoot,
27
+ 'Podfile'
28
+ );
29
+ let podfile = File.readFileIfExists(podfilePath);
30
+
31
+ if (!podfile) {
32
+ throw new Error(`Podfile not found at ${podfilePath}`);
33
+ }
34
+
35
+ // Remove existing target block if present (ensures correct placement on rebuild)
36
+ if (Podfile.hasTargetBlock(podfile, props.targetName)) {
37
+ props.logger.log(
38
+ `Removing existing '${props.targetName}' target to ensure correct placement`
39
+ );
40
+ podfile = Podfile.removeTargetBlock(podfile, props.targetName);
41
+ }
42
+
43
+ const projectRoot = config.modRequest.projectRoot;
44
+ const mainTargetName = getProjectName(projectRoot);
45
+
46
+ // Only React Native extensions need main app to use_frameworks! (they inherit pods)
47
+ // Standalone extensions are siblings and don't inherit, so they don't need this
48
+ if (!props.standalone) {
49
+ podfile = Podfile.ensureMainTargetUsesFrameworks(
50
+ podfile,
51
+ mainTargetName
52
+ );
53
+ }
54
+
55
+ // For standalone targets, detect main app's use_frameworks! setting
56
+ // CocoaPods requires host app and extensions to have matching use_frameworks! settings
57
+ const mainUsesFrameworks = props.standalone
58
+ ? Podfile.mainTargetUsesFrameworks(podfile, mainTargetName)
59
+ : undefined;
60
+
61
+ // Generate appropriate target block based on type
62
+ // React Native targets are nested inside main target to inherit dependencies
63
+ const targetBlock = props.standalone
64
+ ? Podfile.generateStandaloneTargetBlock({
65
+ targetName: props.targetName,
66
+ deploymentTarget: props.deploymentTarget,
67
+ useFrameworks: mainUsesFrameworks,
68
+ })
69
+ : Podfile.generateReactNativeTargetBlock({
70
+ targetName: props.targetName,
71
+ deploymentTarget: props.deploymentTarget,
72
+ extensionType: props.extensionType,
73
+ });
74
+
75
+ props.logger.log(
76
+ `Updated Podfile for ${props.standalone ? 'standalone' : 'React Native'} target: ${props.targetName}`
77
+ );
78
+
79
+ // Insert target block into Podfile
80
+ // Standalone: sibling to avoid Expo autolinking, RN: nested to inherit
81
+ podfile = Podfile.insertTargetBlock(
82
+ podfile,
83
+ targetBlock,
84
+ props.standalone,
85
+ props.logger
86
+ );
87
+
88
+ // For React Native targets, ensure framework search paths are configured
89
+ // inherit! :search_paths needs additional framework search paths for Swift imports
90
+ if (!props.standalone) {
91
+ // Find all React Native extension targets nested inside main target
92
+ // These targets use inherit! :search_paths to avoid inheriting incompatible pods like Expo
93
+ const reactNativeTargets: {
94
+ targetName: string;
95
+ deploymentTarget: string;
96
+ }[] = [];
97
+
98
+ // Find the main target block and extract nested targets from within it
99
+ const mainTargetStart = podfile.indexOf(
100
+ `target '${mainTargetName}' do`
101
+ );
102
+ if (mainTargetStart >= 0) {
103
+ // Find the closing 'end' of the main target (before post_install)
104
+ const postInstallStart = podfile.indexOf(
105
+ 'post_install do',
106
+ mainTargetStart
107
+ );
108
+ const mainTargetBlock =
109
+ postInstallStart >= 0
110
+ ? podfile.substring(mainTargetStart, postInstallStart)
111
+ : podfile.substring(mainTargetStart);
112
+
113
+ // Match nested target blocks within main target that have inherit! :complete
114
+ // Look for lines that match: target 'Name' do ... inherit! :complete ... end
115
+ // We need to match complete target blocks, so we'll look for the pattern
116
+ // and verify it's a nested target (not the main target itself)
117
+ const lines = mainTargetBlock.split('\n');
118
+ let inNestedTarget = false;
119
+ let currentTargetName = '';
120
+ let currentTargetLines: string[] = [];
121
+ let nestedTargetDepth = 0;
122
+
123
+ for (let i = 0; i < lines.length; i++) {
124
+ const line = lines[i];
125
+
126
+ // Check if this line starts a nested target
127
+ const targetMatch = line.match(/^\s+target\s+'([^']+)'\s+do/);
128
+ if (targetMatch && targetMatch[1] !== mainTargetName) {
129
+ inNestedTarget = true;
130
+ currentTargetName = targetMatch[1];
131
+ currentTargetLines = [line];
132
+ nestedTargetDepth = 1;
133
+ continue;
134
+ }
135
+
136
+ // If we're in a nested target, collect lines until we find the closing 'end'
137
+ if (inNestedTarget) {
138
+ currentTargetLines.push(line);
139
+
140
+ // Count nested blocks (do/end pairs)
141
+ if (line.match(/\bdo\b/)) {
142
+ nestedTargetDepth++;
143
+ }
144
+ if (line.match(/\bend\b/)) {
145
+ nestedTargetDepth--;
146
+
147
+ // If depth is 0, we've closed the target block
148
+ if (nestedTargetDepth === 0) {
149
+ const targetBlock = currentTargetLines.join('\n');
150
+
151
+ // Check if this target has inherit! :search_paths (React Native extensions)
152
+ if (targetBlock.includes('inherit! :search_paths')) {
153
+ // Extract deployment target
154
+ const platformMatch = targetBlock.match(
155
+ /platform\s+:ios,\s+'([^']+)'/
156
+ );
157
+ const version = platformMatch
158
+ ? platformMatch[1]
159
+ : props.deploymentTarget;
160
+
161
+ reactNativeTargets.push({
162
+ targetName: currentTargetName,
163
+ deploymentTarget: version,
164
+ });
165
+ }
166
+
167
+ // Reset for next target
168
+ inNestedTarget = false;
169
+ currentTargetName = '';
170
+ currentTargetLines = [];
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+
177
+ if (reactNativeTargets.length > 0) {
178
+ // Inject framework search paths configuration into post_install hook
179
+ podfile = Podfile.ensureReactNativeExtensionFrameworkPaths(
180
+ podfile,
181
+ reactNativeTargets,
182
+ mainTargetName
183
+ );
184
+ }
185
+ }
186
+
187
+ // For standalone targets, inject deployment target fixes into post_install hook
188
+ // Must be done in Podfile because xcconfig files are generated by CocoaPods
189
+ if (props.standalone) {
190
+ const extensionTargets: {
191
+ targetName: string;
192
+ deploymentTarget: string;
193
+ }[] = [];
194
+ const targetPattern =
195
+ /target\s+'([^']+)'\s+do\s+platform\s+:ios,\s+'([^']+)'/g;
196
+ let match;
197
+
198
+ // Find all standalone extension targets in the Podfile (including the one we just inserted)
199
+ while ((match = targetPattern.exec(podfile)) !== null) {
200
+ const [, name, version] = match;
201
+ if (name !== mainTargetName) {
202
+ extensionTargets.push({
203
+ targetName: name,
204
+ deploymentTarget: version,
205
+ });
206
+ }
207
+ }
208
+
209
+ // Find the highest deployment target among all standalone extensions
210
+ if (extensionTargets.length > 0) {
211
+ const highestDeploymentTarget = extensionTargets.reduce(
212
+ (highest, ext) => {
213
+ const extVersion = parseFloat(ext.deploymentTarget);
214
+ const highestVersion = parseFloat(highest.deploymentTarget);
215
+ return extVersion > highestVersion ? ext : highest;
216
+ }
217
+ ).deploymentTarget;
218
+
219
+ // Update Podfile platform line to match the highest extension deployment target
220
+ // This ensures consistency and prevents linker errors
221
+ podfile = Podfile.updatePodfilePlatform(
222
+ podfile,
223
+ highestDeploymentTarget
224
+ );
225
+
226
+ // Inject into post_install hook to fix after react_native_post_install runs
227
+ podfile = Podfile.ensureExtensionDeploymentTargets(
228
+ podfile,
229
+ extensionTargets
230
+ );
231
+ }
232
+ }
233
+
234
+ File.writeFileSafe(podfilePath, podfile);
235
+ return config;
236
+ },
237
+ ]);
238
+ };