expo-targets 0.2.0 → 0.2.2

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 (194) hide show
  1. package/build/metro/src/withTargetsMetro.d.ts +0 -1
  2. package/build/metro/src/withTargetsMetro.d.ts.map +1 -1
  3. package/build/metro/src/withTargetsMetro.js +21 -114
  4. package/build/metro/src/withTargetsMetro.js.map +1 -1
  5. package/build/plugin/src/config.d.ts +23 -1
  6. package/build/plugin/src/config.d.ts.map +1 -1
  7. package/build/plugin/src/config.js +3 -1
  8. package/build/plugin/src/config.js.map +1 -1
  9. package/build/plugin/src/ios/config-plugins/withIOSTarget.d.ts.map +1 -1
  10. package/build/plugin/src/ios/config-plugins/withIOSTarget.js +17 -5
  11. package/build/plugin/src/ios/config-plugins/withIOSTarget.js.map +1 -1
  12. package/build/plugin/src/ios/config-plugins/withPodfile.d.ts.map +1 -1
  13. package/build/plugin/src/ios/config-plugins/withPodfile.js +3 -5
  14. package/build/plugin/src/ios/config-plugins/withPodfile.js.map +1 -1
  15. package/build/plugin/src/ios/config-plugins/withXcodeChanges.d.ts.map +1 -1
  16. package/build/plugin/src/ios/config-plugins/withXcodeChanges.js +63 -2
  17. package/build/plugin/src/ios/config-plugins/withXcodeChanges.js.map +1 -1
  18. package/build/plugin/src/ios/target.d.ts.map +1 -1
  19. package/build/plugin/src/ios/target.js +71 -11
  20. package/build/plugin/src/ios/target.js.map +1 -1
  21. package/build/plugin/src/ios/utils/index.d.ts +1 -0
  22. package/build/plugin/src/ios/utils/index.d.ts.map +1 -1
  23. package/build/plugin/src/ios/utils/index.js +2 -1
  24. package/build/plugin/src/ios/utils/index.js.map +1 -1
  25. package/build/plugin/src/ios/utils/plist.d.ts.map +1 -1
  26. package/build/plugin/src/ios/utils/plist.js +1 -0
  27. package/build/plugin/src/ios/utils/plist.js.map +1 -1
  28. package/build/plugin/src/ios/utils/podfile.d.ts.map +1 -1
  29. package/build/plugin/src/ios/utils/podfile.js +55 -22
  30. package/build/plugin/src/ios/utils/podfile.js.map +1 -1
  31. package/build/plugin/src/ios/utils/safari.d.ts +69 -0
  32. package/build/plugin/src/ios/utils/safari.d.ts.map +1 -0
  33. package/build/plugin/src/ios/utils/safari.js +359 -0
  34. package/build/plugin/src/ios/utils/safari.js.map +1 -0
  35. package/build/plugin/src/withTargetsDir.d.ts.map +1 -1
  36. package/build/plugin/src/withTargetsDir.js +34 -0
  37. package/build/plugin/src/withTargetsDir.js.map +1 -1
  38. package/build/src/Target.d.ts +8 -1
  39. package/build/src/Target.d.ts.map +1 -1
  40. package/build/src/Target.js +136 -26
  41. package/build/src/Target.js.map +1 -1
  42. package/build/src/index.d.ts +3 -1
  43. package/build/src/index.d.ts.map +1 -1
  44. package/build/src/index.js +14 -1
  45. package/build/src/index.js.map +1 -1
  46. package/build/src/modules/safari/index.d.ts +109 -0
  47. package/build/src/modules/safari/index.d.ts.map +1 -0
  48. package/build/src/modules/safari/index.js +288 -0
  49. package/build/src/modules/safari/index.js.map +1 -0
  50. package/metro/{src/index.ts → build/index.d.ts} +1 -0
  51. package/metro/build/index.d.ts.map +1 -0
  52. package/metro/build/index.js +6 -0
  53. package/metro/build/index.js.map +1 -0
  54. package/metro/build/withTargetsMetro.d.ts +5 -0
  55. package/metro/build/withTargetsMetro.d.ts.map +1 -0
  56. package/metro/build/withTargetsMetro.js +78 -0
  57. package/metro/build/withTargetsMetro.js.map +1 -0
  58. package/package.json +11 -1
  59. package/plugin/build/android/withAndroidAppBuildGradle.d.ts +7 -0
  60. package/plugin/build/android/withAndroidAppBuildGradle.d.ts.map +1 -0
  61. package/plugin/build/android/withAndroidAppBuildGradle.js +31 -0
  62. package/plugin/build/android/withAndroidAppBuildGradle.js.map +1 -0
  63. package/plugin/build/android/withAndroidTarget.d.ts +10 -0
  64. package/plugin/build/android/withAndroidTarget.d.ts.map +1 -0
  65. package/plugin/build/android/withAndroidTarget.js +22 -0
  66. package/plugin/build/android/withAndroidTarget.js.map +1 -0
  67. package/plugin/build/android/withAndroidWidget.d.ts +13 -0
  68. package/plugin/build/android/withAndroidWidget.d.ts.map +1 -0
  69. package/plugin/build/android/withAndroidWidget.js +564 -0
  70. package/plugin/build/android/withAndroidWidget.js.map +1 -0
  71. package/plugin/build/config.d.ts +163 -0
  72. package/plugin/build/config.d.ts.map +1 -0
  73. package/plugin/build/config.js +56 -0
  74. package/plugin/build/config.js.map +1 -0
  75. package/plugin/build/index.d.ts +9 -0
  76. package/plugin/build/index.d.ts.map +1 -0
  77. package/plugin/build/index.js +11 -0
  78. package/plugin/build/index.js.map +1 -0
  79. package/plugin/build/ios/config-plugins/withEntitlements.d.ts +11 -0
  80. package/plugin/build/ios/config-plugins/withEntitlements.d.ts.map +1 -0
  81. package/plugin/build/ios/config-plugins/withEntitlements.js +49 -0
  82. package/plugin/build/ios/config-plugins/withEntitlements.js.map +1 -0
  83. package/plugin/build/ios/config-plugins/withIOSTarget.d.ts +17 -0
  84. package/plugin/build/ios/config-plugins/withIOSTarget.d.ts.map +1 -0
  85. package/plugin/build/ios/config-plugins/withIOSTarget.js +164 -0
  86. package/plugin/build/ios/config-plugins/withIOSTarget.js.map +1 -0
  87. package/plugin/build/ios/config-plugins/withIosColorset.d.ts +8 -0
  88. package/plugin/build/ios/config-plugins/withIosColorset.d.ts.map +1 -0
  89. package/plugin/build/ios/config-plugins/withIosColorset.js +25 -0
  90. package/plugin/build/ios/config-plugins/withIosColorset.js.map +1 -0
  91. package/plugin/build/ios/config-plugins/withIosStickerPack.d.ts +8 -0
  92. package/plugin/build/ios/config-plugins/withIosStickerPack.d.ts.map +1 -0
  93. package/plugin/build/ios/config-plugins/withIosStickerPack.js +52 -0
  94. package/plugin/build/ios/config-plugins/withIosStickerPack.js.map +1 -0
  95. package/plugin/build/ios/config-plugins/withPodfile.d.ts +12 -0
  96. package/plugin/build/ios/config-plugins/withPodfile.d.ts.map +1 -0
  97. package/plugin/build/ios/config-plugins/withPodfile.js +160 -0
  98. package/plugin/build/ios/config-plugins/withPodfile.js.map +1 -0
  99. package/plugin/build/ios/config-plugins/withXcodeChanges.d.ts +15 -0
  100. package/plugin/build/ios/config-plugins/withXcodeChanges.d.ts.map +1 -0
  101. package/plugin/build/ios/config-plugins/withXcodeChanges.js +707 -0
  102. package/plugin/build/ios/config-plugins/withXcodeChanges.js.map +1 -0
  103. package/plugin/build/ios/target.d.ts +41 -0
  104. package/plugin/build/ios/target.d.ts.map +1 -0
  105. package/plugin/build/ios/target.js +634 -0
  106. package/plugin/build/ios/target.js.map +1 -0
  107. package/plugin/build/ios/utils/asset.d.ts +60 -0
  108. package/plugin/build/ios/utils/asset.d.ts.map +1 -0
  109. package/plugin/build/ios/utils/asset.js +375 -0
  110. package/plugin/build/ios/utils/asset.js.map +1 -0
  111. package/plugin/build/ios/utils/file.d.ts +33 -0
  112. package/plugin/build/ios/utils/file.d.ts.map +1 -0
  113. package/plugin/build/ios/utils/file.js +88 -0
  114. package/plugin/build/ios/utils/file.js.map +1 -0
  115. package/plugin/{src/ios/utils/index.ts → build/ios/utils/index.d.ts} +2 -1
  116. package/plugin/build/ios/utils/index.d.ts.map +1 -0
  117. package/plugin/build/ios/utils/index.js +39 -0
  118. package/plugin/build/ios/utils/index.js.map +1 -0
  119. package/plugin/build/ios/utils/paths.d.ts +128 -0
  120. package/plugin/build/ios/utils/paths.d.ts.map +1 -0
  121. package/plugin/build/ios/utils/paths.js +141 -0
  122. package/plugin/build/ios/utils/paths.js.map +1 -0
  123. package/plugin/build/ios/utils/plist.d.ts +29 -0
  124. package/plugin/build/ios/utils/plist.d.ts.map +1 -0
  125. package/plugin/build/ios/utils/plist.js +115 -0
  126. package/plugin/build/ios/utils/plist.js.map +1 -0
  127. package/plugin/build/ios/utils/podfile.d.ts +82 -0
  128. package/plugin/build/ios/utils/podfile.d.ts.map +1 -0
  129. package/plugin/build/ios/utils/podfile.js +441 -0
  130. package/plugin/build/ios/utils/podfile.js.map +1 -0
  131. package/plugin/build/ios/utils/reactNativeSwift.d.ts +11 -0
  132. package/plugin/build/ios/utils/reactNativeSwift.d.ts.map +1 -0
  133. package/plugin/build/ios/utils/reactNativeSwift.js +263 -0
  134. package/plugin/build/ios/utils/reactNativeSwift.js.map +1 -0
  135. package/plugin/build/ios/utils/safari.d.ts +69 -0
  136. package/plugin/build/ios/utils/safari.d.ts.map +1 -0
  137. package/plugin/build/ios/utils/safari.js +359 -0
  138. package/plugin/build/ios/utils/safari.js.map +1 -0
  139. package/plugin/build/ios/utils/xcode.d.ts +185 -0
  140. package/plugin/build/ios/utils/xcode.d.ts.map +1 -0
  141. package/plugin/build/ios/utils/xcode.js +706 -0
  142. package/plugin/build/ios/utils/xcode.js.map +1 -0
  143. package/plugin/build/logger.d.ts +10 -0
  144. package/plugin/build/logger.d.ts.map +1 -0
  145. package/plugin/build/logger.js +62 -0
  146. package/plugin/build/logger.js.map +1 -0
  147. package/plugin/build/parseTargetConfig.d.ts +3 -0
  148. package/plugin/build/parseTargetConfig.d.ts.map +1 -0
  149. package/plugin/build/parseTargetConfig.js +113 -0
  150. package/plugin/build/parseTargetConfig.js.map +1 -0
  151. package/plugin/build/withTargetsDir.d.ts +6 -0
  152. package/plugin/build/withTargetsDir.d.ts.map +1 -0
  153. package/plugin/build/withTargetsDir.js +124 -0
  154. package/plugin/build/withTargetsDir.js.map +1 -0
  155. package/.eslintrc.js +0 -2
  156. package/metro/src/withTargetsMetro.ts +0 -247
  157. package/metro/tsconfig.build.json +0 -9
  158. package/plugin/src/android/withAndroidAppBuildGradle.ts +0 -34
  159. package/plugin/src/android/withAndroidTarget.ts +0 -26
  160. package/plugin/src/android/withAndroidWidget.ts +0 -778
  161. package/plugin/src/config.ts +0 -255
  162. package/plugin/src/index.ts +0 -19
  163. package/plugin/src/ios/config-plugins/withEntitlements.ts +0 -69
  164. package/plugin/src/ios/config-plugins/withIOSTarget.ts +0 -179
  165. package/plugin/src/ios/config-plugins/withIosColorset.ts +0 -29
  166. package/plugin/src/ios/config-plugins/withIosStickerPack.ts +0 -65
  167. package/plugin/src/ios/config-plugins/withPodfile.ts +0 -238
  168. package/plugin/src/ios/config-plugins/withXcodeChanges.ts +0 -891
  169. package/plugin/src/ios/target.ts +0 -668
  170. package/plugin/src/ios/utils/asset.ts +0 -490
  171. package/plugin/src/ios/utils/file.ts +0 -80
  172. package/plugin/src/ios/utils/paths.ts +0 -253
  173. package/plugin/src/ios/utils/plist.ts +0 -101
  174. package/plugin/src/ios/utils/podfile.ts +0 -534
  175. package/plugin/src/ios/utils/reactNativeSwift.ts +0 -283
  176. package/plugin/src/ios/utils/xcode.ts +0 -989
  177. package/plugin/src/logger.ts +0 -63
  178. package/plugin/src/parseTargetConfig.ts +0 -115
  179. package/plugin/src/types/normalize-colors.d.ts +0 -3
  180. package/plugin/src/withTargetsDir.ts +0 -120
  181. package/plugin/tsconfig.build.json +0 -9
  182. package/plugin/tsconfig.json +0 -9
  183. package/src/Target.ts +0 -239
  184. package/src/index.ts +0 -52
  185. package/src/modules/extension/index.ts +0 -54
  186. package/src/modules/messages/index.ts +0 -124
  187. package/src/modules/storage/index.ts +0 -126
  188. package/tsconfig.json +0 -8
  189. /package/plugin/{src → build}/ios/templates/MessagesViewController.swift +0 -0
  190. /package/plugin/{src → build}/ios/templates/ReactNativeViewController.swift +0 -0
  191. /package/plugin/{src → build}/ios/templates/action-extension-data.swift +0 -0
  192. /package/plugin/{src → build}/ios/templates/clip-extension-data.swift +0 -0
  193. /package/plugin/{src → build}/ios/templates/messages-extension-data.swift +0 -0
  194. /package/plugin/{src → build}/ios/templates/share-extension-data.swift +0 -0
@@ -0,0 +1,707 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.withXcodeChanges = void 0;
7
+ const config_plugins_1 = require("@expo/config-plugins");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const glob_1 = require("glob");
10
+ const path_1 = __importDefault(require("path"));
11
+ const config_1 = require("../../config");
12
+ const target_1 = require("../target");
13
+ const utils_1 = require("../utils");
14
+ const withXcodeChanges = (config, props) => {
15
+ return (0, config_plugins_1.withXcodeProject)(config, async (config) => {
16
+ const projectRoot = config.modRequest.projectRoot;
17
+ const platformProjectRoot = config.modRequest.platformProjectRoot;
18
+ const targetName = props.displayName || props.name;
19
+ const targetProductName = utils_1.Paths.sanitizeTargetName(targetName);
20
+ const typeConfig = target_1.TYPE_CHARACTERISTICS[props.type];
21
+ props.logger.log(`Adding Xcode target: ${targetName} (${props.type})`);
22
+ const mainBundleId = config.ios?.bundleIdentifier;
23
+ if (!mainBundleId) {
24
+ throw new Error('iOS bundle identifier not found in app.json');
25
+ }
26
+ // Use type-specific suffix, falling back to sanitized target name if not in map
27
+ const bundleIdentifierSuffix = config_1.TYPE_BUNDLE_IDENTIFIER_SUFFIXES[props.type] ||
28
+ utils_1.Paths.sanitizeTargetName(props.name);
29
+ const bundleIdentifier = props.bundleIdentifier || `${mainBundleId}.${bundleIdentifierSuffix}`;
30
+ const deploymentTarget = props.deploymentTarget || '18.0';
31
+ const productType = (0, target_1.productTypeForType)(props.type);
32
+ const frameworks = [
33
+ ...((0, target_1.getFrameworksForType)(props.type) || []),
34
+ ...(props.frameworks || []),
35
+ ];
36
+ // NEW APPROACH: Reference files in place, generate metadata in targets/*/ios/build/
37
+ // Ensure build directory exists in targets/
38
+ const targetBuildPath = utils_1.Paths.getTargetBuildPath({
39
+ projectRoot,
40
+ targetDirectory: props.directory,
41
+ });
42
+ utils_1.File.ensureDirectoryExists(targetBuildPath);
43
+ props.logger.log(`Build directory: ${path_1.default.relative(projectRoot, targetBuildPath)}`);
44
+ // Generate Info.plist in targets/*/ios/build/
45
+ const infoPlistPath = utils_1.Paths.getTargetInfoPlistPath({
46
+ projectRoot,
47
+ targetDirectory: props.directory,
48
+ });
49
+ // Extract URL schemes from expo config for auto-injection into extensions
50
+ const mainAppSchemes = [];
51
+ if (config.scheme) {
52
+ if (typeof config.scheme === 'string') {
53
+ mainAppSchemes.push(config.scheme);
54
+ }
55
+ else if (Array.isArray(config.scheme)) {
56
+ mainAppSchemes.push(...config.scheme);
57
+ }
58
+ }
59
+ // Also include the bundle ID as a URL scheme
60
+ // Expo automatically registers it, and openHostApp() uses it
61
+ if (config.ios?.bundleIdentifier) {
62
+ mainAppSchemes.push(config.ios.bundleIdentifier);
63
+ }
64
+ // Extract targets config to embed in Info.plist for runtime access
65
+ const targetsConfig = config.extra?.targets;
66
+ props.logger.log(`Generating Info.plist for ${targetName}...`);
67
+ if (mainAppSchemes.length > 0) {
68
+ props.logger.log(`Extracted ${mainAppSchemes.length} URL scheme(s) from main app config`);
69
+ props.logger.log(`Auto-injecting LSApplicationQueriesSchemes: ${mainAppSchemes.join(', ')}`);
70
+ }
71
+ if (targetsConfig && targetsConfig.length > 0) {
72
+ props.logger.log(`Embedding ${targetsConfig.length} target(s) config in ${targetName} Info.plist`);
73
+ }
74
+ const hasActivationRules = Array.isArray(props.activationRules) && props.activationRules.length > 0;
75
+ const hasPreprocessingFile = !!props.preprocessingFile;
76
+ const infoPlistContent = (0, target_1.getTargetInfoPlistForType)(props.type, props.infoPlist, hasActivationRules || hasPreprocessingFile
77
+ ? {
78
+ activationRules: props.activationRules,
79
+ preprocessingFile: props.preprocessingFile,
80
+ }
81
+ : undefined, props.entry, mainAppSchemes.length > 0 ? mainAppSchemes : undefined, targetsConfig, props.targetIcon);
82
+ utils_1.File.writeFileSafe(infoPlistPath, infoPlistContent);
83
+ props.logger.log(`Generated Info.plist at ${path_1.default.relative(projectRoot, infoPlistPath)}`);
84
+ // Create iMessage App Icon for sticker pack targets
85
+ if (props.type === 'stickers') {
86
+ const assetsPath = utils_1.Paths.getTargetAssetsPath({
87
+ projectRoot,
88
+ targetDirectory: props.directory,
89
+ isStickers: true,
90
+ });
91
+ // Create root Contents.json for Stickers.xcassets
92
+ utils_1.Asset.createAssetsXcassetsRoot(assetsPath);
93
+ const iconsetPath = path_1.default.join(assetsPath, 'iMessage App Icon.stickersiconset');
94
+ // Resolve source icon path if provided
95
+ const sourceIconPath = props.targetIcon
96
+ ? path_1.default.isAbsolute(props.targetIcon)
97
+ ? props.targetIcon
98
+ : path_1.default.join(projectRoot, props.targetIcon)
99
+ : undefined;
100
+ utils_1.Asset.createIMessageAppIcon({
101
+ iconsetPath,
102
+ sourceIconPath,
103
+ });
104
+ props.logger.log(`Created iMessage App Icon set for ${targetName}`);
105
+ // Create sticker packs
106
+ if (props.stickerPacks && props.stickerPacks.length > 0) {
107
+ props.stickerPacks.forEach((stickerPack) => {
108
+ const stickerPackPath = utils_1.Paths.getStickerPackPath({
109
+ platformProjectRoot,
110
+ targetName,
111
+ stickerPackName: stickerPack.name,
112
+ });
113
+ utils_1.Asset.createStickerPack({
114
+ stickerPackPath,
115
+ name: stickerPack.name,
116
+ assets: stickerPack.assets,
117
+ });
118
+ // Copy sticker assets to the pack
119
+ stickerPack.assets.forEach((assetPath) => {
120
+ const absoluteAssetPath = path_1.default.isAbsolute(assetPath)
121
+ ? assetPath
122
+ : path_1.default.join(projectRoot, props.directory, assetPath);
123
+ if (fs_1.default.existsSync(absoluteAssetPath)) {
124
+ const filename = path_1.default.basename(assetPath);
125
+ const baseName = path_1.default.basename(assetPath, path_1.default.extname(assetPath));
126
+ const stickerDirPath = path_1.default.join(stickerPackPath, `${baseName}.sticker`);
127
+ // Create .sticker directory with Contents.json
128
+ utils_1.Asset.createSticker({
129
+ stickerPath: stickerDirPath,
130
+ filename,
131
+ });
132
+ // Copy image into .sticker directory
133
+ const destPath = path_1.default.join(stickerDirPath, filename);
134
+ fs_1.default.copyFileSync(absoluteAssetPath, destPath);
135
+ }
136
+ else {
137
+ props.logger.warn(`Sticker asset not found: ${absoluteAssetPath}`);
138
+ }
139
+ });
140
+ props.logger.log(`Created sticker pack "${stickerPack.name}" with ${stickerPack.assets.length} sticker(s)`);
141
+ });
142
+ }
143
+ }
144
+ // Generate Safari web extension resources (RN Web mode only)
145
+ if (props.type === 'safari' && props.entry) {
146
+ const resourcesPath = path_1.default.join(targetBuildPath, 'Resources');
147
+ // Check if user has provided custom Resources folder
148
+ if (utils_1.Safari.hasCustomSafariResources(props.directory)) {
149
+ props.logger.log(`Using custom Safari Resources from ${path_1.default.relative(projectRoot, path_1.default.join(props.directory, 'ios', 'Resources'))}`);
150
+ // Copy user's Resources to build directory
151
+ const userResourcesPath = path_1.default.join(props.directory, 'ios', 'Resources');
152
+ utils_1.File.copyDirectorySafe(userResourcesPath, resourcesPath);
153
+ }
154
+ else {
155
+ // Generate default Safari resources for React Native Web
156
+ props.logger.log(`Generating Safari web extension resources...`);
157
+ // Extract manifest config from props if provided
158
+ const manifestConfig = props.manifest;
159
+ utils_1.Safari.generateSafariResources(resourcesPath, {
160
+ name: props.name,
161
+ displayName: props.displayName,
162
+ manifest: manifestConfig,
163
+ });
164
+ props.logger.log(`Generated Safari Resources at ${path_1.default.relative(projectRoot, resourcesPath)}`);
165
+ props.logger.log(` - popup.html (React Native Web container)`);
166
+ props.logger.log(` - manifest.json`);
167
+ props.logger.log(` - background.js`);
168
+ props.logger.log(` - popup.js (placeholder - bundle via 'npx expo export --platform web')`);
169
+ }
170
+ }
171
+ const pbxProject = config.modResults;
172
+ const xcodeProject = pbxProject;
173
+ // Get main app target
174
+ const projectName = utils_1.Xcode.getProjectName(projectRoot);
175
+ const mainTarget = utils_1.Xcode.getApplicationNativeTarget({
176
+ project: xcodeProject,
177
+ projectName,
178
+ });
179
+ // Remove any duplicate targets with the same product name
180
+ utils_1.Xcode.removeDuplicateTargets({
181
+ project: xcodeProject,
182
+ productName: targetProductName,
183
+ });
184
+ // Check if target already exists
185
+ const existingTargetUuid = utils_1.Xcode.findTargetByProductName({
186
+ project: xcodeProject,
187
+ productName: targetProductName,
188
+ });
189
+ let target;
190
+ if (existingTargetUuid) {
191
+ props.logger.log(`Target ${targetProductName} already exists, reusing`);
192
+ target = {
193
+ uuid: existingTargetUuid,
194
+ target: xcodeProject.hash.project.objects.PBXNativeTarget[existingTargetUuid],
195
+ };
196
+ }
197
+ else {
198
+ props.logger.log(`Created native target: ${targetProductName}`);
199
+ const targetType = typeConfig.targetType;
200
+ target = xcodeProject.addTarget(targetProductName, targetType, targetProductName, bundleIdentifier);
201
+ if (!target) {
202
+ throw new Error(`Failed to create target for ${targetName}`);
203
+ }
204
+ if (!target.uuid) {
205
+ throw new Error(`Target created but has no UUID: ${targetName}`);
206
+ }
207
+ }
208
+ // Always set product type for precision (all types have specific product types)
209
+ utils_1.Xcode.setProductType({ target, productType });
210
+ props.logger.log(`Set product type to ${productType} for ${props.type}`);
211
+ // Remove auto-created build phases for asset-only targets
212
+ if (!typeConfig.requiresCode && !existingTargetUuid) {
213
+ props.logger.log(`Removing auto-created code build phases from asset-only target`);
214
+ utils_1.Xcode.removeBuildPhases({
215
+ project: xcodeProject,
216
+ targetUuid: target.uuid,
217
+ phaseType: 'PBXSourcesBuildPhase',
218
+ });
219
+ utils_1.Xcode.removeBuildPhases({
220
+ project: xcodeProject,
221
+ targetUuid: target.uuid,
222
+ phaseType: 'PBXFrameworksBuildPhase',
223
+ });
224
+ }
225
+ // Get main app's build settings to inherit from
226
+ const mainBuildSettings = utils_1.Xcode.getMainAppBuildSettings({
227
+ project: xcodeProject,
228
+ mainTarget,
229
+ });
230
+ props.logger.log(`Main app SWIFT_VERSION: ${mainBuildSettings.SWIFT_VERSION || 'NOT SET'}`);
231
+ // Build settings that should be target-specific
232
+ const targetSpecificSettings = {
233
+ PRODUCT_NAME: `"${targetProductName}"`,
234
+ PRODUCT_BUNDLE_IDENTIFIER: `"${bundleIdentifier}"`,
235
+ // INFOPLIST_FILE will be set later to point to targets/*/ios/build/Info.plist
236
+ };
237
+ // Set display name from config if provided (allows user-friendly names with spaces)
238
+ // This overrides the CFBundleDisplayName from Info.plist which uses $(PRODUCT_NAME)
239
+ if (props.displayName) {
240
+ targetSpecificSettings.INFOPLIST_KEY_CFBundleDisplayName = `"${props.displayName}"`;
241
+ props.logger.log(`Set display name: ${props.displayName}`);
242
+ }
243
+ // Only code-based targets need entitlements - generate in build directory
244
+ if (typeConfig.requiresEntitlements) {
245
+ const entitlementsPath = utils_1.Paths.getTargetEntitlementsPath({
246
+ projectRoot,
247
+ targetDirectory: props.directory,
248
+ });
249
+ const relativeEntitlementsPath = path_1.default.relative(platformProjectRoot, entitlementsPath);
250
+ targetSpecificSettings.CODE_SIGN_ENTITLEMENTS = `"${relativeEntitlementsPath}"`;
251
+ }
252
+ // Inherit essential build settings from main app if not already set
253
+ const essentialSettings = [
254
+ 'CLANG_ENABLE_MODULES',
255
+ 'TARGETED_DEVICE_FAMILY',
256
+ 'CURRENT_PROJECT_VERSION',
257
+ ];
258
+ essentialSettings.forEach((setting) => {
259
+ if (mainBuildSettings[setting]) {
260
+ targetSpecificSettings[setting] = mainBuildSettings[setting];
261
+ props.logger.log(`Inherited ${setting}: ${mainBuildSettings[setting]}`);
262
+ }
263
+ });
264
+ // Set MARKETING_VERSION from Expo config to match main app's Info.plist value
265
+ // Expo prebuild may truncate version in build settings but keeps full version in Info.plist
266
+ if (config.version) {
267
+ targetSpecificSettings.MARKETING_VERSION = config.version;
268
+ props.logger.log(`Set MARKETING_VERSION from config: ${config.version}`);
269
+ }
270
+ else if (mainBuildSettings.MARKETING_VERSION) {
271
+ targetSpecificSettings.MARKETING_VERSION =
272
+ mainBuildSettings.MARKETING_VERSION;
273
+ props.logger.log(`Inherited MARKETING_VERSION: ${mainBuildSettings.MARKETING_VERSION}`);
274
+ }
275
+ // Build final settings: target-specific + inherited + deployment target + custom overrides
276
+ const buildSettings = {
277
+ ...targetSpecificSettings,
278
+ };
279
+ // SWIFT_VERSION required even for asset-only targets
280
+ if (props.swiftVersion !== undefined) {
281
+ buildSettings.SWIFT_VERSION = String(props.swiftVersion);
282
+ props.logger.log(`Using custom SWIFT_VERSION: ${props.swiftVersion}`);
283
+ }
284
+ else if (mainBuildSettings.SWIFT_VERSION) {
285
+ buildSettings.SWIFT_VERSION = mainBuildSettings.SWIFT_VERSION;
286
+ props.logger.log(`Inherited SWIFT_VERSION: ${mainBuildSettings.SWIFT_VERSION}`);
287
+ }
288
+ else {
289
+ buildSettings.SWIFT_VERSION = '5.0';
290
+ props.logger.log(`Using fallback SWIFT_VERSION: 5.0`);
291
+ }
292
+ // Code-based targets need additional build settings
293
+ if (typeConfig.requiresCode) {
294
+ const buildSettingsMap = {
295
+ targetedDeviceFamily: {
296
+ prop: 'targetedDeviceFamily',
297
+ xcodeKey: 'TARGETED_DEVICE_FAMILY',
298
+ },
299
+ clangEnableModules: {
300
+ prop: 'clangEnableModules',
301
+ xcodeKey: 'CLANG_ENABLE_MODULES',
302
+ },
303
+ swiftEmitLocStrings: {
304
+ prop: 'swiftEmitLocStrings',
305
+ xcodeKey: 'SWIFT_EMIT_LOC_STRINGS',
306
+ },
307
+ };
308
+ Object.entries(buildSettingsMap).forEach(([key, { prop, xcodeKey }]) => {
309
+ if (props[prop] !== undefined) {
310
+ buildSettings[xcodeKey] = String(props[prop]);
311
+ props.logger.log(`Using custom ${xcodeKey}: ${props[prop]}`);
312
+ }
313
+ else if (mainBuildSettings[xcodeKey]) {
314
+ buildSettings[xcodeKey] = mainBuildSettings[xcodeKey];
315
+ props.logger.log(`Inherited ${xcodeKey}: ${mainBuildSettings[xcodeKey]}`);
316
+ }
317
+ });
318
+ }
319
+ else {
320
+ props.logger.log(`Skipping code-related build settings for asset-only target`);
321
+ // Sticker packs need asset catalog compiler settings
322
+ if (props.type === 'stickers') {
323
+ buildSettings.ASSETCATALOG_COMPILER_APPICON_NAME =
324
+ '"iMessage App Icon"';
325
+ props.logger.log(`Set ASSETCATALOG_COMPILER_APPICON_NAME for sticker pack`);
326
+ }
327
+ }
328
+ // Apply deployment target if specified
329
+ if (deploymentTarget) {
330
+ buildSettings.IPHONEOS_DEPLOYMENT_TARGET = deploymentTarget;
331
+ }
332
+ // App Clips are standalone - override search paths to prevent Pods contamination
333
+ if (props.type === 'clip') {
334
+ buildSettings.ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = 'YES';
335
+ // Set explicit clean paths (not blank, as blank gets overridden with defaults)
336
+ // These paths avoid Pods while still allowing Swift/system frameworks
337
+ // For multi-value settings, pass as arrays (xcode package formats correctly)
338
+ buildSettings.LIBRARY_SEARCH_PATHS = [
339
+ '"$(SDKROOT)/usr/lib/swift"',
340
+ '"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)"',
341
+ ];
342
+ buildSettings.FRAMEWORK_SEARCH_PATHS =
343
+ '"$(PLATFORM_DIR)/Developer/Library/Frameworks"';
344
+ buildSettings.LD_RUNPATH_SEARCH_PATHS = [
345
+ '"@executable_path/Frameworks"',
346
+ '"@loader_path/Frameworks"',
347
+ ];
348
+ // Don't set OTHER_SWIFT_FLAGS - let it use defaults to avoid duplication
349
+ // SwiftUI-specific settings (required for proper SwiftUI framework linking)
350
+ buildSettings.GENERATE_INFOPLIST_FILE = 'YES';
351
+ buildSettings.INFOPLIST_KEY_UIApplicationSceneManifest_Generation = 'YES';
352
+ buildSettings.INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents =
353
+ 'YES';
354
+ buildSettings.INFOPLIST_KEY_UILaunchScreen_Generation = 'YES';
355
+ buildSettings.ENABLE_PREVIEWS = 'YES';
356
+ }
357
+ props.logger.log(`Final SWIFT_VERSION for ${targetProductName}: ${buildSettings.SWIFT_VERSION}`);
358
+ // Apply build settings to target
359
+ utils_1.Xcode.applyBuildSettings({
360
+ project: xcodeProject,
361
+ target,
362
+ buildSettings,
363
+ verbose: true,
364
+ logger: props.logger,
365
+ });
366
+ // Standalone apps should not have SKIP_INSTALL
367
+ utils_1.Xcode.removeBuildSetting({
368
+ project: xcodeProject,
369
+ target,
370
+ settingKey: 'SKIP_INSTALL',
371
+ verbose: true,
372
+ logger: props.logger,
373
+ });
374
+ props.logger.log(`Configured build settings for ${targetProductName}`);
375
+ // Only code-based targets need Sources and Frameworks build phases
376
+ if (typeConfig.requiresCode) {
377
+ // Ensure the target has a Sources build phase (skip if already exists)
378
+ if (!utils_1.Xcode.hasBuildPhase({
379
+ project: xcodeProject,
380
+ targetUuid: target.uuid,
381
+ phaseType: 'PBXSourcesBuildPhase',
382
+ })) {
383
+ const sourcesBuildPhase = xcodeProject.addBuildPhase([], 'PBXSourcesBuildPhase', 'Sources', target.uuid);
384
+ props.logger.log(`Created Sources build phase for ${targetProductName}`);
385
+ }
386
+ else {
387
+ props.logger.log(`Sources build phase already exists for ${targetProductName}`);
388
+ }
389
+ // Ensure the target has a Frameworks build phase (skip if already exists)
390
+ if (!utils_1.Xcode.hasBuildPhase({
391
+ project: xcodeProject,
392
+ targetUuid: target.uuid,
393
+ phaseType: 'PBXFrameworksBuildPhase',
394
+ })) {
395
+ const frameworksBuildPhase = xcodeProject.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', target.uuid);
396
+ props.logger.log(`Created Frameworks build phase for ${targetProductName}`);
397
+ }
398
+ else {
399
+ props.logger.log(`Frameworks build phase already exists for ${targetProductName}`);
400
+ }
401
+ }
402
+ else {
403
+ props.logger.log(`Skipping Sources and Frameworks build phases for asset-only target`);
404
+ }
405
+ // Ensure the target has a Resources build phase (skip if already exists)
406
+ if (!utils_1.Xcode.hasBuildPhase({
407
+ project: xcodeProject,
408
+ targetUuid: target.uuid,
409
+ phaseType: 'PBXResourcesBuildPhase',
410
+ })) {
411
+ const resourcesBuildPhase = xcodeProject.addBuildPhase([], 'PBXResourcesBuildPhase', 'Resources', target.uuid);
412
+ props.logger.log(`Created Resources build phase for ${targetProductName}`);
413
+ }
414
+ else {
415
+ props.logger.log(`Resources build phase already exists for ${targetProductName}`);
416
+ }
417
+ // Copy Swift files from user's target directory (skip for asset-only targets)
418
+ const targetDirectory = utils_1.Paths.getTargetDirectory({
419
+ projectRoot,
420
+ targetDirectory: props.directory,
421
+ });
422
+ let swiftFiles = typeConfig.requiresCode
423
+ ? (0, glob_1.globSync)('**/*.swift', {
424
+ cwd: targetDirectory,
425
+ absolute: false,
426
+ ignore: [
427
+ '**/Tests/**',
428
+ '**/*.test.swift',
429
+ '**/*Tests.swift',
430
+ '**/build/**', // Exclude build directory - those are generated files
431
+ ],
432
+ }).filter((file) => !file.includes('Tests/') &&
433
+ !file.includes('/Tests') &&
434
+ !file.endsWith('.test.swift') &&
435
+ !file.endsWith('Tests.swift') &&
436
+ !file.startsWith('build/') // Also filter out build/ files that might slip through
437
+ )
438
+ : [];
439
+ // Safari extensions use web rendering (not native RN), so they need different handling
440
+ // They only need SafariWebExtensionHandler.swift, not ReactNativeViewController.swift
441
+ if (props.type === 'safari') {
442
+ const hasSafariHandler = swiftFiles.some((f) => f === 'SafariWebExtensionHandler.swift' ||
443
+ f.endsWith('/SafariWebExtensionHandler.swift'));
444
+ if (!hasSafariHandler) {
445
+ swiftFiles.push('SafariWebExtensionHandler.swift');
446
+ props.logger.log(`Will generate SafariWebExtensionHandler.swift`);
447
+ }
448
+ }
449
+ // Auto-generate ReactNativeViewController.swift for native RN extensions (not Safari)
450
+ else if (props.entry && swiftFiles.length === 0) {
451
+ props.logger.log(`No Swift files found - generating view controllers for React Native`);
452
+ const moduleName = targetProductName;
453
+ // ReactNativeViewController will be generated in the build directory
454
+ // when processing Swift files below
455
+ if (props.type === 'messages') {
456
+ // Messages extensions need BOTH MessagesViewController (MSMessagesAppViewController)
457
+ // and ReactNativeViewController (child)
458
+ swiftFiles = [
459
+ 'MessagesViewController.swift',
460
+ 'ReactNativeViewController.swift',
461
+ ];
462
+ props.logger.log(`Will generate MessagesViewController.swift and ReactNativeViewController.swift for ${moduleName}`);
463
+ }
464
+ else {
465
+ swiftFiles = ['ReactNativeViewController.swift'];
466
+ props.logger.log(`Will generate ReactNativeViewController.swift for ${moduleName}`);
467
+ }
468
+ }
469
+ else if (props.entry && swiftFiles.length > 0) {
470
+ props.logger.log(`Using user-provided Swift files with React Native entry point`);
471
+ }
472
+ props.logger.log(`Found ${swiftFiles.length} Swift file(s) in ${props.directory}/ios`);
473
+ // Create virtual expo:targets group structure in Xcode
474
+ const virtualGroupUuid = utils_1.Xcode.ensureExpoTargetsGroup({
475
+ project: xcodeProject,
476
+ });
477
+ const targetGroupUuid = utils_1.Xcode.addTargetToVirtualGroup({
478
+ project: xcodeProject,
479
+ targetName,
480
+ virtualGroupUuid,
481
+ });
482
+ props.logger.log(`Created virtual group: expo:targets/${targetName}`);
483
+ // Reference Swift files in place (no copying)
484
+ swiftFiles.forEach((file) => {
485
+ let sourceFilePath;
486
+ // Check if this is ReactNativeViewController.swift (could be in build/ or root)
487
+ const isReactNativeViewController = file === 'ReactNativeViewController.swift' ||
488
+ file.endsWith('/ReactNativeViewController.swift') ||
489
+ file.endsWith('\\ReactNativeViewController.swift');
490
+ // Check if this is MessagesViewController.swift
491
+ const isMessagesViewController = file === 'MessagesViewController.swift' ||
492
+ file.endsWith('/MessagesViewController.swift') ||
493
+ file.endsWith('\\MessagesViewController.swift');
494
+ // Check if this is SafariWebExtensionHandler.swift
495
+ const isSafariHandler = file === 'SafariWebExtensionHandler.swift' ||
496
+ file.endsWith('/SafariWebExtensionHandler.swift') ||
497
+ file.endsWith('\\SafariWebExtensionHandler.swift');
498
+ if (props.entry &&
499
+ props.type === 'messages' &&
500
+ isMessagesViewController) {
501
+ // Generate MessagesViewController for messages extensions
502
+ const userFilePath = path_1.default.join(projectRoot, props.directory, 'ios', 'MessagesViewController.swift');
503
+ if (fs_1.default.existsSync(userFilePath)) {
504
+ sourceFilePath = userFilePath;
505
+ props.logger.log(` Using user-provided: MessagesViewController.swift`);
506
+ }
507
+ else {
508
+ sourceFilePath = path_1.default.join(targetBuildPath, 'MessagesViewController.swift');
509
+ const template = utils_1.ReactNativeSwift.generateMessagesViewController();
510
+ utils_1.File.writeFileSafe(sourceFilePath, template);
511
+ props.logger.log(` Generated: MessagesViewController.swift in build directory`);
512
+ }
513
+ }
514
+ else if (props.entry && isReactNativeViewController) {
515
+ // Generated file - always regenerate on every prebuild (no caching)
516
+ // Check if user has their own file in ios/ (not build/)
517
+ const userFilePath = path_1.default.join(projectRoot, props.directory, 'ios', 'ReactNativeViewController.swift');
518
+ if (fs_1.default.existsSync(userFilePath)) {
519
+ // User provided their own - reference it in place
520
+ sourceFilePath = userFilePath;
521
+ props.logger.log(` Using user-provided: ReactNativeViewController.swift`);
522
+ }
523
+ else {
524
+ // Generate fresh template file - always regenerate
525
+ sourceFilePath = path_1.default.join(targetBuildPath, 'ReactNativeViewController.swift');
526
+ const moduleName = targetProductName.replace('Target', '');
527
+ const template = utils_1.ReactNativeSwift.generateReactNativeViewController({
528
+ type: props.type,
529
+ moduleName,
530
+ targetName: props.name,
531
+ preprocessingFile: props.preprocessingFile,
532
+ entry: props.entry,
533
+ });
534
+ utils_1.File.writeFileSafe(sourceFilePath, template);
535
+ props.logger.log(` Generated: ReactNativeViewController.swift in build directory (regenerated)`);
536
+ }
537
+ }
538
+ else if (props.type === 'safari' && isSafariHandler) {
539
+ // Safari handler - check if user provided, otherwise generate
540
+ const userFilePath = path_1.default.join(projectRoot, props.directory, 'ios', 'SafariWebExtensionHandler.swift');
541
+ if (fs_1.default.existsSync(userFilePath)) {
542
+ sourceFilePath = userFilePath;
543
+ props.logger.log(` Using user-provided: SafariWebExtensionHandler.swift`);
544
+ }
545
+ else {
546
+ sourceFilePath = path_1.default.join(targetBuildPath, 'SafariWebExtensionHandler.swift');
547
+ const template = utils_1.Safari.generateSafariSwiftHandler(props.displayName || props.name);
548
+ utils_1.File.writeFileSafe(sourceFilePath, template);
549
+ props.logger.log(` Generated: SafariWebExtensionHandler.swift in build directory`);
550
+ }
551
+ }
552
+ else {
553
+ // User file - reference in place
554
+ sourceFilePath = path_1.default.join(projectRoot, props.directory, 'ios', file);
555
+ if (!fs_1.default.existsSync(sourceFilePath)) {
556
+ throw new Error(`Swift file not found: ${sourceFilePath}\n` +
557
+ `Expected at: ${path_1.default.relative(projectRoot, sourceFilePath)}`);
558
+ }
559
+ // Validate that file is within the target directory (security check)
560
+ const targetDirPath = path_1.default.join(projectRoot, props.directory, 'ios');
561
+ const normalizedFilePath = path_1.default.normalize(sourceFilePath);
562
+ const normalizedTargetDir = path_1.default.normalize(targetDirPath);
563
+ if (!normalizedFilePath.startsWith(normalizedTargetDir)) {
564
+ throw new Error(`Swift file is outside target directory: ${file}\n` +
565
+ `Expected in: ${path_1.default.relative(projectRoot, targetDirPath)}`);
566
+ }
567
+ // Skip test files even if they weren't caught by glob ignore
568
+ if (file.includes('Tests/') ||
569
+ file.includes('/Tests') ||
570
+ file.endsWith('.test.swift') ||
571
+ file.endsWith('Tests.swift')) {
572
+ props.logger.log(` Skipping test file: ${file}`);
573
+ return;
574
+ }
575
+ }
576
+ // Add file reference (not copy)
577
+ const relativePath = path_1.default.relative(platformProjectRoot, sourceFilePath);
578
+ const fileRefUuid = utils_1.Xcode.addExternalFileReference({
579
+ project: xcodeProject,
580
+ groupUuid: targetGroupUuid,
581
+ filePath: relativePath,
582
+ fileName: file,
583
+ });
584
+ // Add to Sources build phase
585
+ utils_1.Xcode.addFileToBuildPhase({
586
+ project: xcodeProject,
587
+ targetUuid: target.uuid,
588
+ fileRefUuid,
589
+ phaseType: 'PBXSourcesBuildPhase',
590
+ });
591
+ props.logger.log(` Referenced: ${file}`);
592
+ });
593
+ // Handle Assets.xcassets - copy user assets to build directory, then reference
594
+ const userAssetsPath = path_1.default.join(projectRoot, props.directory, 'ios', props.type === 'stickers' ? 'Stickers.xcassets' : 'Assets.xcassets');
595
+ const buildAssetsPath = utils_1.Paths.getTargetAssetsPath({
596
+ projectRoot,
597
+ targetDirectory: props.directory,
598
+ isStickers: props.type === 'stickers',
599
+ });
600
+ // Copy user assets to build directory if they exist
601
+ if (utils_1.File.isDirectory(userAssetsPath)) {
602
+ utils_1.File.copyDirectorySafe(userAssetsPath, buildAssetsPath);
603
+ props.logger.log(`Copied user assets to build directory`);
604
+ }
605
+ else {
606
+ // Create empty assets directory
607
+ utils_1.File.ensureDirectoryExists(buildAssetsPath);
608
+ utils_1.Asset.createAssetsXcassetsRoot(buildAssetsPath);
609
+ }
610
+ // Generate colors in build assets if specified
611
+ if (props.colors && Object.keys(props.colors).length > 0) {
612
+ Object.entries(props.colors).forEach(([colorName, colorValue]) => {
613
+ const colorsetPath = utils_1.Paths.getTargetColorsetPath({
614
+ projectRoot,
615
+ targetDirectory: props.directory,
616
+ colorName,
617
+ });
618
+ if (typeof colorValue === 'string') {
619
+ utils_1.Asset.createColorset({
620
+ colorsetPath,
621
+ color: colorValue,
622
+ });
623
+ }
624
+ else {
625
+ const lightColor = colorValue.light || colorValue.color;
626
+ const darkColor = colorValue.dark || colorValue.darkColor;
627
+ utils_1.Asset.createColorset({
628
+ colorsetPath,
629
+ color: lightColor,
630
+ darkColor,
631
+ });
632
+ }
633
+ });
634
+ props.logger.log(`Generated ${Object.keys(props.colors).length} color assets`);
635
+ }
636
+ // Reference assets from build directory
637
+ if (utils_1.File.isDirectory(buildAssetsPath)) {
638
+ const relativeAssetsPath = path_1.default.relative(platformProjectRoot, buildAssetsPath);
639
+ const assetsFileRefUuid = utils_1.Xcode.addExternalFileReference({
640
+ project: xcodeProject,
641
+ groupUuid: targetGroupUuid,
642
+ filePath: relativeAssetsPath,
643
+ fileName: path_1.default.basename(buildAssetsPath),
644
+ fileType: 'folder.assetcatalog',
645
+ });
646
+ utils_1.Xcode.addFileToBuildPhase({
647
+ project: xcodeProject,
648
+ targetUuid: target.uuid,
649
+ fileRefUuid: assetsFileRefUuid,
650
+ phaseType: 'PBXResourcesBuildPhase',
651
+ });
652
+ props.logger.log(`Referenced assets from build directory`);
653
+ }
654
+ // Update INFOPLIST_FILE build setting to point to targets/
655
+ const relativeInfoPlistPath = path_1.default.relative(platformProjectRoot, infoPlistPath);
656
+ utils_1.Xcode.applyBuildSettings({
657
+ project: xcodeProject,
658
+ target,
659
+ buildSettings: {
660
+ INFOPLIST_FILE: `"${relativeInfoPlistPath}"`,
661
+ },
662
+ });
663
+ props.logger.log(`Info.plist referenced from: ${relativeInfoPlistPath}`);
664
+ // Link frameworks (skip for asset-only targets)
665
+ if (typeConfig.requiresCode && frameworks.length > 0) {
666
+ frameworks.forEach((framework) => {
667
+ props.logger.log(` Linking framework: ${framework}`);
668
+ xcodeProject.addFramework(`${framework}.framework`, {
669
+ target: target.uuid,
670
+ link: true,
671
+ });
672
+ });
673
+ }
674
+ else if (!typeConfig.requiresCode) {
675
+ props.logger.log(`Skipping framework linking for asset-only target`);
676
+ }
677
+ // Add target dependency for app extensions and clips
678
+ props.logger.log(`Adding target dependency to main app`);
679
+ utils_1.Xcode.addTargetDependency({
680
+ project: xcodeProject,
681
+ mainTargetUuid: mainTarget.uuid,
682
+ dependentTargetUuid: target.uuid,
683
+ });
684
+ // Configure embedding based on extension embed type
685
+ if (typeConfig.embedType === 'foundation-extension') {
686
+ props.logger.log(`Configuring "Embed Foundation Extensions" build phase`);
687
+ utils_1.Xcode.configureAppExtensionEmbed({
688
+ project: xcodeProject,
689
+ targetProductName,
690
+ });
691
+ }
692
+ else if (typeConfig.embedType === 'app-clip') {
693
+ props.logger.log(`Creating "Embed App Clips" build phase`);
694
+ utils_1.Xcode.configureAppClipEmbed({
695
+ project: xcodeProject,
696
+ mainTargetUuid: mainTarget.uuid,
697
+ target,
698
+ targetProductName,
699
+ });
700
+ }
701
+ // 'none' embedType = no embedding configuration needed (e.g., watch apps)
702
+ props.logger.logSparse(true, `Configured target`, targetName);
703
+ return config;
704
+ });
705
+ };
706
+ exports.withXcodeChanges = withXcodeChanges;
707
+ //# sourceMappingURL=withXcodeChanges.js.map