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
@@ -1,283 +0,0 @@
1
- import * as fs from 'fs';
2
- import * as path from 'path';
3
-
4
- import type { ExtensionType } from '../../config';
5
-
6
- const TEMPLATES_DIR = path.join(__dirname, '..', 'templates');
7
-
8
- export interface ReactNativeViewControllerOptions {
9
- type: ExtensionType;
10
- moduleName: string;
11
- targetName: string;
12
- preprocessingFile?: string;
13
- entry?: string;
14
- }
15
-
16
- function readTemplate(filename: string): string {
17
- const templatePath = path.join(TEMPLATES_DIR, filename);
18
- return fs.readFileSync(templatePath, 'utf-8');
19
- }
20
-
21
- function getExtensionDataForType(
22
- type: ExtensionType,
23
- preprocessingFile?: string
24
- ): {
25
- properties: string;
26
- loadMethod: string;
27
- propsMethod: string;
28
- } {
29
- switch (type) {
30
- case 'share': {
31
- const dataTemplate = readTemplate('share-extension-data.swift');
32
-
33
- // Handle preprocessing file
34
- let preprocessingLoad = '';
35
- if (preprocessingFile) {
36
- preprocessingLoad = `
37
- // Load preprocessed web data
38
- if let jsDict = extensionItem.userInfo?[NSExtensionJavaScriptPreprocessingResultsKey] as? [String: Any] {
39
- self.preprocessedWebData = jsDict
40
- }`;
41
- }
42
-
43
- const modifiedTemplate = dataTemplate.replace(
44
- '{{PREPROCESSING_DATA_LOAD}}',
45
- preprocessingLoad
46
- );
47
-
48
- // Split template into sections
49
- const lines = modifiedTemplate.split('\n');
50
- const properties: string[] = [];
51
- const loadMethodLines: string[] = [];
52
- const propsMethodLines: string[] = [];
53
-
54
- let currentSection: 'properties' | 'load' | 'props' | null = null;
55
-
56
- for (const line of lines) {
57
- if (line.includes('private var ')) {
58
- currentSection = 'properties';
59
- properties.push(line);
60
- } else if (line.includes('private func loadSharedContent()')) {
61
- currentSection = 'load';
62
- loadMethodLines.push(line);
63
- } else if (line.includes('private func getSharedDataProps()')) {
64
- currentSection = 'props';
65
- propsMethodLines.push(line);
66
- } else if (
67
- currentSection === 'properties' &&
68
- line.trim().startsWith('private')
69
- ) {
70
- properties.push(line);
71
- } else if (currentSection === 'load') {
72
- loadMethodLines.push(line);
73
- } else if (currentSection === 'props') {
74
- propsMethodLines.push(line);
75
- }
76
- }
77
-
78
- return {
79
- properties: properties.join('\n '),
80
- loadMethod: `// Load shared content before creating React Native view
81
- Task {
82
- await loadSharedContent()
83
- // Create React Native view with loaded content
84
- await MainActor.run {
85
- let sharedData = getSharedDataProps()
86
- setupReactNativeView(with: sharedData)
87
- }
88
- }`,
89
- propsMethod:
90
- loadMethodLines.join('\n') + '\n\n' + propsMethodLines.join('\n'),
91
- };
92
- }
93
-
94
- case 'action': {
95
- const dataTemplate = readTemplate('action-extension-data.swift');
96
- const lines = dataTemplate.split('\n');
97
- const properties: string[] = [];
98
- const loadMethodLines: string[] = [];
99
- const propsMethodLines: string[] = [];
100
-
101
- let currentSection: 'properties' | 'load' | 'props' | null = null;
102
-
103
- for (const line of lines) {
104
- if (line.includes('private var ')) {
105
- currentSection = 'properties';
106
- properties.push(line);
107
- } else if (line.includes('private func loadActionContent()')) {
108
- currentSection = 'load';
109
- loadMethodLines.push(line);
110
- } else if (line.includes('private func getActionDataProps()')) {
111
- currentSection = 'props';
112
- propsMethodLines.push(line);
113
- } else if (
114
- currentSection === 'properties' &&
115
- line.trim().startsWith('private')
116
- ) {
117
- properties.push(line);
118
- } else if (currentSection === 'load') {
119
- loadMethodLines.push(line);
120
- } else if (currentSection === 'props') {
121
- propsMethodLines.push(line);
122
- }
123
- }
124
-
125
- return {
126
- properties: properties.join('\n '),
127
- loadMethod: `// Load action content before creating React Native view
128
- Task {
129
- await loadActionContent()
130
- // Create React Native view with loaded content
131
- await MainActor.run {
132
- let actionData = getActionDataProps()
133
- setupReactNativeView(with: actionData)
134
- }
135
- }`,
136
- propsMethod:
137
- loadMethodLines.join('\n') + '\n\n' + propsMethodLines.join('\n'),
138
- };
139
- }
140
-
141
- case 'clip': {
142
- const dataTemplate = readTemplate('clip-extension-data.swift');
143
- const lines = dataTemplate.split('\n');
144
- const properties: string[] = [];
145
- const loadMethodLines: string[] = [];
146
- const propsMethodLines: string[] = [];
147
-
148
- let currentSection: 'properties' | 'load' | 'props' | null = null;
149
-
150
- for (const line of lines) {
151
- if (line.includes('private var ')) {
152
- currentSection = 'properties';
153
- properties.push(line);
154
- } else if (line.includes('private func loadClipContent()')) {
155
- currentSection = 'load';
156
- loadMethodLines.push(line);
157
- } else if (line.includes('private func getClipDataProps()')) {
158
- currentSection = 'props';
159
- propsMethodLines.push(line);
160
- } else if (
161
- currentSection === 'properties' &&
162
- line.trim().startsWith('private')
163
- ) {
164
- properties.push(line);
165
- } else if (currentSection === 'load') {
166
- loadMethodLines.push(line);
167
- } else if (currentSection === 'props') {
168
- propsMethodLines.push(line);
169
- }
170
- }
171
-
172
- return {
173
- properties: properties.join('\n '),
174
- loadMethod: `loadClipContent()
175
- let clipData = getClipDataProps()
176
- setupReactNativeView(with: clipData)`,
177
- propsMethod:
178
- loadMethodLines.join('\n') + '\n\n' + propsMethodLines.join('\n'),
179
- };
180
- }
181
-
182
- case 'messages': {
183
- const dataTemplate = readTemplate('messages-extension-data.swift');
184
- const lines = dataTemplate.split('\n');
185
- const properties: string[] = [];
186
- const loadMethodLines: string[] = [];
187
- const propsMethodLines: string[] = [];
188
-
189
- let currentSection: 'properties' | 'load' | 'props' | null = null;
190
-
191
- for (const line of lines) {
192
- if (line.includes('private var ')) {
193
- currentSection = 'properties';
194
- properties.push(line);
195
- } else if (line.includes('private func loadMessagesContent()')) {
196
- currentSection = 'load';
197
- loadMethodLines.push(line);
198
- } else if (line.includes('private func getMessagesDataProps()')) {
199
- currentSection = 'props';
200
- propsMethodLines.push(line);
201
- } else if (
202
- currentSection === 'properties' &&
203
- line.trim().startsWith('private')
204
- ) {
205
- properties.push(line);
206
- } else if (currentSection === 'load') {
207
- loadMethodLines.push(line);
208
- } else if (currentSection === 'props') {
209
- propsMethodLines.push(line);
210
- }
211
- }
212
-
213
- return {
214
- properties: properties.join('\n '),
215
- loadMethod: `loadMessagesContent()
216
- let messagesData = getMessagesDataProps()
217
- setupReactNativeView(with: messagesData)`,
218
- propsMethod:
219
- loadMethodLines.join('\n') + '\n\n' + propsMethodLines.join('\n'),
220
- };
221
- }
222
-
223
- default:
224
- // For other types, no extension-specific data
225
- return {
226
- properties: '',
227
- loadMethod: 'setupReactNativeView(with: nil)',
228
- propsMethod: '',
229
- };
230
- }
231
- }
232
-
233
- export function generateMessagesViewController(): string {
234
- return readTemplate('MessagesViewController.swift');
235
- }
236
-
237
- export function generateReactNativeViewController(
238
- options: ReactNativeViewControllerOptions
239
- ): string {
240
- let baseTemplate = readTemplate('ReactNativeViewController.swift');
241
- const extensionData = getExtensionDataForType(
242
- options.type,
243
- options.preprocessingFile
244
- );
245
-
246
- // Add Messages import for messages type
247
- if (options.type === 'messages') {
248
- baseTemplate = baseTemplate.replace(
249
- 'import ReactAppDependencyProvider',
250
- 'import ReactAppDependencyProvider\nimport Messages'
251
- );
252
- }
253
-
254
- // Convert entry path to bundle root for Metro
255
- // e.g., "./targets/rn-share/index.tsx" -> "targets/rn-share/index"
256
- let bundleRoot = '.expo/.virtual-metro-entry';
257
- if (options.entry) {
258
- bundleRoot = options.entry
259
- .replace(/^\.\//, '') // Remove leading ./
260
- .replace(/\.(tsx?|jsx?)$/, ''); // Remove file extension
261
- }
262
-
263
- // Replace placeholders (use replaceAll to catch multiple occurrences)
264
- let result = baseTemplate
265
- .replace(/{{MODULE_NAME}}/g, options.moduleName)
266
- .replace(/{{TARGET_NAME}}/g, options.targetName)
267
- .replace(/{{BUNDLE_ROOT}}/g, bundleRoot)
268
- .replace('{{EXTENSION_DATA_PROPERTIES}}', extensionData.properties)
269
- .replace('{{LOAD_EXTENSION_DATA}}', extensionData.loadMethod);
270
-
271
- // Add extension data methods if needed
272
- if (extensionData.propsMethod) {
273
- const closingBraceIndex = result.lastIndexOf('}');
274
- result =
275
- result.slice(0, closingBraceIndex) +
276
- '\n // MARK: - Extension Data\n \n' +
277
- extensionData.propsMethod +
278
- '\n' +
279
- result.slice(closingBraceIndex);
280
- }
281
-
282
- return result;
283
- }