@callstack/react-native-brownfield 2.2.0 → 3.0.0-rc.1

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 (223) hide show
  1. package/lib/commonjs/expo-config-plugin/android/constants.js +2 -0
  2. package/lib/commonjs/expo-config-plugin/android/constants.js.map +1 -0
  3. package/lib/commonjs/expo-config-plugin/android/gradleHelpers.js +2 -0
  4. package/lib/commonjs/expo-config-plugin/android/gradleHelpers.js.map +1 -0
  5. package/lib/commonjs/expo-config-plugin/android/index.js +2 -0
  6. package/lib/commonjs/expo-config-plugin/android/index.js.map +1 -0
  7. package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js +2 -0
  8. package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -0
  9. package/lib/commonjs/expo-config-plugin/android/withBrownfieldAndroid.js +2 -0
  10. package/lib/commonjs/expo-config-plugin/android/withBrownfieldAndroid.js.map +1 -0
  11. package/lib/commonjs/expo-config-plugin/app.plugin.js +2 -0
  12. package/lib/commonjs/expo-config-plugin/app.plugin.js.map +1 -0
  13. package/lib/commonjs/expo-config-plugin/errors/SourceModificationError.js +2 -0
  14. package/lib/commonjs/expo-config-plugin/errors/SourceModificationError.js.map +1 -0
  15. package/lib/commonjs/expo-config-plugin/index.js +2 -0
  16. package/lib/commonjs/expo-config-plugin/index.js.map +1 -0
  17. package/lib/commonjs/expo-config-plugin/ios/index.js +2 -0
  18. package/lib/commonjs/expo-config-plugin/ios/index.js.map +1 -0
  19. package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js +31 -0
  20. package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js.map +1 -0
  21. package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js +2 -0
  22. package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -0
  23. package/lib/commonjs/expo-config-plugin/ios/withIosFrameworkFiles.js +2 -0
  24. package/lib/commonjs/expo-config-plugin/ios/withIosFrameworkFiles.js.map +1 -0
  25. package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js +2 -0
  26. package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js.map +1 -0
  27. package/lib/commonjs/expo-config-plugin/logging.js +2 -0
  28. package/lib/commonjs/expo-config-plugin/logging.js.map +1 -0
  29. package/lib/commonjs/expo-config-plugin/template/android/AndroidManifest.xml +4 -0
  30. package/lib/commonjs/expo-config-plugin/template/android/ReactNativeHostManager.kt +54 -0
  31. package/lib/commonjs/expo-config-plugin/template/android/build.gradle.kts +90 -0
  32. package/lib/commonjs/expo-config-plugin/template/android/consumer-rules.pro +0 -0
  33. package/lib/commonjs/expo-config-plugin/template/android/gradle.properties +8 -0
  34. package/lib/commonjs/expo-config-plugin/template/android/proguard-rules.pro +21 -0
  35. package/lib/commonjs/expo-config-plugin/template/engine.js +2 -0
  36. package/lib/commonjs/expo-config-plugin/template/engine.js.map +1 -0
  37. package/lib/commonjs/expo-config-plugin/template/ios/FrameworkInterface.swift +8 -0
  38. package/lib/commonjs/expo-config-plugin/template/ios/Info.plist +22 -0
  39. package/lib/commonjs/expo-config-plugin/template/ios/PodfileTargetBlock.rb +4 -0
  40. package/lib/commonjs/expo-config-plugin/template/ios/ReactNativeHostManager.swift +63 -0
  41. package/lib/commonjs/expo-config-plugin/template/ios/patchExpoPre55.sh +20 -0
  42. package/lib/commonjs/expo-config-plugin/types/BrownfieldPluginConfig.js +2 -0
  43. package/lib/commonjs/expo-config-plugin/types/BrownfieldPluginConfig.js.map +1 -0
  44. package/lib/commonjs/expo-config-plugin/types/RenderedTemplateFile.js +2 -0
  45. package/lib/commonjs/expo-config-plugin/types/RenderedTemplateFile.js.map +1 -0
  46. package/lib/commonjs/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.js +2 -0
  47. package/lib/commonjs/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.js.map +1 -0
  48. package/lib/commonjs/expo-config-plugin/types/index.js +2 -0
  49. package/lib/commonjs/expo-config-plugin/types/index.js.map +1 -0
  50. package/lib/commonjs/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.js +2 -0
  51. package/lib/commonjs/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.js.map +1 -0
  52. package/lib/commonjs/expo-config-plugin/withBrownfield.js +2 -0
  53. package/lib/commonjs/expo-config-plugin/withBrownfield.js.map +1 -0
  54. package/lib/module/expo-config-plugin/android/constants.js +2 -0
  55. package/lib/module/expo-config-plugin/android/constants.js.map +1 -0
  56. package/lib/module/expo-config-plugin/android/gradleHelpers.js +2 -0
  57. package/lib/module/expo-config-plugin/android/gradleHelpers.js.map +1 -0
  58. package/lib/module/expo-config-plugin/android/index.js +2 -0
  59. package/lib/module/expo-config-plugin/android/index.js.map +1 -0
  60. package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js +2 -0
  61. package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -0
  62. package/lib/module/expo-config-plugin/android/withBrownfieldAndroid.js +2 -0
  63. package/lib/module/expo-config-plugin/android/withBrownfieldAndroid.js.map +1 -0
  64. package/lib/module/expo-config-plugin/app.plugin.js +2 -0
  65. package/lib/module/expo-config-plugin/app.plugin.js.map +1 -0
  66. package/lib/module/expo-config-plugin/errors/SourceModificationError.js +2 -0
  67. package/lib/module/expo-config-plugin/errors/SourceModificationError.js.map +1 -0
  68. package/lib/module/expo-config-plugin/index.js +2 -0
  69. package/lib/module/expo-config-plugin/index.js.map +1 -0
  70. package/lib/module/expo-config-plugin/ios/index.js +2 -0
  71. package/lib/module/expo-config-plugin/ios/index.js.map +1 -0
  72. package/lib/module/expo-config-plugin/ios/podfileHelpers.js +31 -0
  73. package/lib/module/expo-config-plugin/ios/podfileHelpers.js.map +1 -0
  74. package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js +2 -0
  75. package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -0
  76. package/lib/module/expo-config-plugin/ios/withIosFrameworkFiles.js +2 -0
  77. package/lib/module/expo-config-plugin/ios/withIosFrameworkFiles.js.map +1 -0
  78. package/lib/module/expo-config-plugin/ios/xcodeHelpers.js +2 -0
  79. package/lib/module/expo-config-plugin/ios/xcodeHelpers.js.map +1 -0
  80. package/lib/module/expo-config-plugin/logging.js +2 -0
  81. package/lib/module/expo-config-plugin/logging.js.map +1 -0
  82. package/lib/module/expo-config-plugin/template/android/AndroidManifest.xml +4 -0
  83. package/lib/module/expo-config-plugin/template/android/ReactNativeHostManager.kt +54 -0
  84. package/lib/module/expo-config-plugin/template/android/build.gradle.kts +90 -0
  85. package/lib/module/expo-config-plugin/template/android/consumer-rules.pro +0 -0
  86. package/lib/module/expo-config-plugin/template/android/gradle.properties +8 -0
  87. package/lib/module/expo-config-plugin/template/android/proguard-rules.pro +21 -0
  88. package/lib/module/expo-config-plugin/template/engine.js +2 -0
  89. package/lib/module/expo-config-plugin/template/engine.js.map +1 -0
  90. package/lib/module/expo-config-plugin/template/ios/FrameworkInterface.swift +8 -0
  91. package/lib/module/expo-config-plugin/template/ios/Info.plist +22 -0
  92. package/lib/module/expo-config-plugin/template/ios/PodfileTargetBlock.rb +4 -0
  93. package/lib/module/expo-config-plugin/template/ios/ReactNativeHostManager.swift +63 -0
  94. package/lib/module/expo-config-plugin/template/ios/patchExpoPre55.sh +20 -0
  95. package/lib/module/expo-config-plugin/types/BrownfieldPluginConfig.js +2 -0
  96. package/lib/module/expo-config-plugin/types/BrownfieldPluginConfig.js.map +1 -0
  97. package/lib/module/expo-config-plugin/types/RenderedTemplateFile.js +2 -0
  98. package/lib/module/expo-config-plugin/types/RenderedTemplateFile.js.map +1 -0
  99. package/lib/module/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.js +2 -0
  100. package/lib/module/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.js.map +1 -0
  101. package/lib/module/expo-config-plugin/types/index.js +2 -0
  102. package/lib/module/expo-config-plugin/types/index.js.map +1 -0
  103. package/lib/module/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.js +2 -0
  104. package/lib/module/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.js.map +1 -0
  105. package/lib/module/expo-config-plugin/withBrownfield.js +2 -0
  106. package/lib/module/expo-config-plugin/withBrownfield.js.map +1 -0
  107. package/lib/typescript/commonjs/src/expo-config-plugin/android/constants.d.ts +3 -0
  108. package/lib/typescript/commonjs/src/expo-config-plugin/android/constants.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/src/expo-config-plugin/android/gradleHelpers.d.ts +14 -0
  110. package/lib/typescript/commonjs/src/expo-config-plugin/android/gradleHelpers.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/src/expo-config-plugin/android/index.d.ts +4 -0
  112. package/lib/typescript/commonjs/src/expo-config-plugin/android/index.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +24 -0
  114. package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts +13 -0
  116. package/lib/typescript/commonjs/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/src/expo-config-plugin/app.plugin.d.ts +9 -0
  118. package/lib/typescript/commonjs/src/expo-config-plugin/app.plugin.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/src/expo-config-plugin/errors/SourceModificationError.d.ts +3 -0
  120. package/lib/typescript/commonjs/src/expo-config-plugin/errors/SourceModificationError.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/src/expo-config-plugin/index.d.ts +7 -0
  122. package/lib/typescript/commonjs/src/expo-config-plugin/index.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/src/expo-config-plugin/ios/index.d.ts +5 -0
  124. package/lib/typescript/commonjs/src/expo-config-plugin/ios/index.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts +8 -0
  126. package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withBrownfieldIos.d.ts +14 -0
  128. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -0
  129. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts +19 -0
  130. package/lib/typescript/commonjs/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts +33 -0
  132. package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/src/expo-config-plugin/logging.d.ts +9 -0
  134. package/lib/typescript/commonjs/src/expo-config-plugin/logging.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/src/expo-config-plugin/template/engine.d.ts +9 -0
  136. package/lib/typescript/commonjs/src/expo-config-plugin/template/engine.d.ts.map +1 -0
  137. package/lib/typescript/commonjs/src/expo-config-plugin/types/BrownfieldPluginConfig.d.ts +53 -0
  138. package/lib/typescript/commonjs/src/expo-config-plugin/types/BrownfieldPluginConfig.d.ts.map +1 -0
  139. package/lib/typescript/commonjs/src/expo-config-plugin/types/RenderedTemplateFile.d.ts +5 -0
  140. package/lib/typescript/commonjs/src/expo-config-plugin/types/RenderedTemplateFile.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts +50 -0
  142. package/lib/typescript/commonjs/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/src/expo-config-plugin/types/index.d.ts +5 -0
  144. package/lib/typescript/commonjs/src/expo-config-plugin/types/index.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts +36 -0
  146. package/lib/typescript/commonjs/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/src/expo-config-plugin/withBrownfield.d.ts +5 -0
  148. package/lib/typescript/commonjs/src/expo-config-plugin/withBrownfield.d.ts.map +1 -0
  149. package/lib/typescript/module/src/expo-config-plugin/android/constants.d.ts +3 -0
  150. package/lib/typescript/module/src/expo-config-plugin/android/constants.d.ts.map +1 -0
  151. package/lib/typescript/module/src/expo-config-plugin/android/gradleHelpers.d.ts +14 -0
  152. package/lib/typescript/module/src/expo-config-plugin/android/gradleHelpers.d.ts.map +1 -0
  153. package/lib/typescript/module/src/expo-config-plugin/android/index.d.ts +4 -0
  154. package/lib/typescript/module/src/expo-config-plugin/android/index.d.ts.map +1 -0
  155. package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +24 -0
  156. package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -0
  157. package/lib/typescript/module/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts +13 -0
  158. package/lib/typescript/module/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts.map +1 -0
  159. package/lib/typescript/module/src/expo-config-plugin/app.plugin.d.ts +9 -0
  160. package/lib/typescript/module/src/expo-config-plugin/app.plugin.d.ts.map +1 -0
  161. package/lib/typescript/module/src/expo-config-plugin/errors/SourceModificationError.d.ts +3 -0
  162. package/lib/typescript/module/src/expo-config-plugin/errors/SourceModificationError.d.ts.map +1 -0
  163. package/lib/typescript/module/src/expo-config-plugin/index.d.ts +7 -0
  164. package/lib/typescript/module/src/expo-config-plugin/index.d.ts.map +1 -0
  165. package/lib/typescript/module/src/expo-config-plugin/ios/index.d.ts +5 -0
  166. package/lib/typescript/module/src/expo-config-plugin/ios/index.d.ts.map +1 -0
  167. package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts +8 -0
  168. package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -0
  169. package/lib/typescript/module/src/expo-config-plugin/ios/withBrownfieldIos.d.ts +14 -0
  170. package/lib/typescript/module/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -0
  171. package/lib/typescript/module/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts +19 -0
  172. package/lib/typescript/module/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts.map +1 -0
  173. package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts +33 -0
  174. package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -0
  175. package/lib/typescript/module/src/expo-config-plugin/logging.d.ts +9 -0
  176. package/lib/typescript/module/src/expo-config-plugin/logging.d.ts.map +1 -0
  177. package/lib/typescript/module/src/expo-config-plugin/template/engine.d.ts +9 -0
  178. package/lib/typescript/module/src/expo-config-plugin/template/engine.d.ts.map +1 -0
  179. package/lib/typescript/module/src/expo-config-plugin/types/BrownfieldPluginConfig.d.ts +53 -0
  180. package/lib/typescript/module/src/expo-config-plugin/types/BrownfieldPluginConfig.d.ts.map +1 -0
  181. package/lib/typescript/module/src/expo-config-plugin/types/RenderedTemplateFile.d.ts +5 -0
  182. package/lib/typescript/module/src/expo-config-plugin/types/RenderedTemplateFile.d.ts.map +1 -0
  183. package/lib/typescript/module/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts +50 -0
  184. package/lib/typescript/module/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts.map +1 -0
  185. package/lib/typescript/module/src/expo-config-plugin/types/index.d.ts +5 -0
  186. package/lib/typescript/module/src/expo-config-plugin/types/index.d.ts.map +1 -0
  187. package/lib/typescript/module/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts +36 -0
  188. package/lib/typescript/module/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts.map +1 -0
  189. package/lib/typescript/module/src/expo-config-plugin/withBrownfield.d.ts +5 -0
  190. package/lib/typescript/module/src/expo-config-plugin/withBrownfield.d.ts.map +1 -0
  191. package/package.json +15 -3
  192. package/src/expo-config-plugin/android/constants.ts +2 -0
  193. package/src/expo-config-plugin/android/gradleHelpers.ts +72 -0
  194. package/src/expo-config-plugin/android/index.ts +6 -0
  195. package/src/expo-config-plugin/android/withAndroidModuleFiles.ts +139 -0
  196. package/src/expo-config-plugin/android/withBrownfieldAndroid.ts +48 -0
  197. package/src/expo-config-plugin/app.plugin.ts +10 -0
  198. package/src/expo-config-plugin/errors/SourceModificationError.ts +1 -0
  199. package/src/expo-config-plugin/index.ts +8 -0
  200. package/src/expo-config-plugin/ios/index.ts +7 -0
  201. package/src/expo-config-plugin/ios/podfileHelpers.ts +104 -0
  202. package/src/expo-config-plugin/ios/withBrownfieldIos.ts +95 -0
  203. package/src/expo-config-plugin/ios/withIosFrameworkFiles.ts +95 -0
  204. package/src/expo-config-plugin/ios/xcodeHelpers.ts +359 -0
  205. package/src/expo-config-plugin/logging.ts +29 -0
  206. package/src/expo-config-plugin/template/android/AndroidManifest.xml +4 -0
  207. package/src/expo-config-plugin/template/android/ReactNativeHostManager.kt +54 -0
  208. package/src/expo-config-plugin/template/android/build.gradle.kts +90 -0
  209. package/src/expo-config-plugin/template/android/consumer-rules.pro +0 -0
  210. package/src/expo-config-plugin/template/android/gradle.properties +8 -0
  211. package/src/expo-config-plugin/template/android/proguard-rules.pro +21 -0
  212. package/src/expo-config-plugin/template/engine.ts +26 -0
  213. package/src/expo-config-plugin/template/ios/FrameworkInterface.swift +8 -0
  214. package/src/expo-config-plugin/template/ios/Info.plist +22 -0
  215. package/src/expo-config-plugin/template/ios/PodfileTargetBlock.rb +4 -0
  216. package/src/expo-config-plugin/template/ios/ReactNativeHostManager.swift +63 -0
  217. package/src/expo-config-plugin/template/ios/patchExpoPre55.sh +20 -0
  218. package/src/expo-config-plugin/types/BrownfieldPluginConfig.ts +67 -0
  219. package/src/expo-config-plugin/types/RenderedTemplateFile.ts +4 -0
  220. package/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.ts +58 -0
  221. package/src/expo-config-plugin/types/index.ts +6 -0
  222. package/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.ts +41 -0
  223. package/src/expo-config-plugin/withBrownfield.ts +112 -0
@@ -0,0 +1,63 @@
1
+ internal import Expo
2
+ internal import React
3
+ internal import ReactAppDependencyProvider
4
+ internal import React_RCTAppDelegate
5
+ import UIKit
6
+
7
+ public class ReactNativeHostManager {
8
+ public static let shared = ReactNativeHostManager()
9
+
10
+ private var reactNativeDelegate: ExpoReactNativeFactoryDelegate?
11
+ private var reactNativeFactory: RCTReactNativeFactory?
12
+ private var expoDelegate: ExpoAppDelegate?
13
+
14
+ public func initialize() {
15
+ let delegate = ReactNativeDelegate()
16
+ let factory = ExpoReactNativeFactory(delegate: delegate)
17
+ delegate.dependencyProvider = RCTAppDependencyProvider()
18
+
19
+ reactNativeDelegate = delegate
20
+ reactNativeFactory = factory
21
+
22
+ expoDelegate = ExpoAppDelegate()
23
+ expoDelegate?.bindReactNativeFactory(factory)
24
+
25
+ // required to avoid this being file be stripped by the swift compiler
26
+ let _ = ExpoModulesProvider()
27
+ }
28
+
29
+ // propagate delegate methods to ExpoAppDelegate
30
+ public func application(
31
+ _ application: UIApplication,
32
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
33
+ ) -> Bool {
34
+ ((expoDelegate?.application(application, didFinishLaunchingWithOptions: launchOptions)) != nil)
35
+ }
36
+
37
+ // load & present RN UI
38
+ public func loadView(
39
+ moduleName: String, initialProps: [AnyHashable: Any]?,
40
+ launchOptions: [AnyHashable: Any]?
41
+ ) -> UIView {
42
+ let bundleURL = reactNativeDelegate?.bundleURL()
43
+ return (expoDelegate?.recreateRootView(
44
+ withBundleURL: bundleURL, moduleName: moduleName, initialProps: initialProps,
45
+ launchOptions: launchOptions))!
46
+ }
47
+ }
48
+
49
+ class ReactNativeDelegate: ExpoReactNativeFactoryDelegate {
50
+ override func sourceURL(for bridge: RCTBridge) -> URL? {
51
+ // needed to return the correct URL for expo-dev-client.
52
+ bridge.bundleURL ?? bundleURL()
53
+ }
54
+
55
+ override func bundleURL() -> URL? {
56
+ #if DEBUG
57
+ return RCTBundleURLProvider.sharedSettings().jsBundleURL(
58
+ forBundleRoot: ".expo/.virtual-metro-entry")
59
+ #else
60
+ return ReactNativeBundle.url(forResource: "main", withExtension: "jsbundle")
61
+ #endif
62
+ }
63
+ }
@@ -0,0 +1,20 @@
1
+ # Patch by @hurali97, source: https://github.com/callstackincubator/rock/issues/492#issuecomment-3225109837
2
+ # Applicable only to Expo SDK versions prior to 55, which made ExpoModulesProvider internal by default: https://github.com/expo/expo/pull/42317
3
+ # Path to ExpoModulesProvider.swift
4
+ FILE="${SRCROOT}/Pods/Target Support Files/Pods-ExpoApp-{{FRAMEWORK_NAME}}/ExpoModulesProvider.swift"
5
+
6
+ if [ -f "$FILE" ]; then
7
+ echo "Patching $FILE to hide Expo from public interface"
8
+
9
+ # 1. Replace imports with internal imports
10
+ sed -i '' 's/^import EX/internal import EX/' "$FILE"
11
+
12
+ sed -i '' 's/^import Ex/internal import Ex/' "$FILE"
13
+
14
+ # 2. Replace class visibility
15
+ sed -i '' 's/public class ExpoModulesProvider/internal class ExpoModulesProvider/' "$FILE"
16
+
17
+ echo "Patched $FILE to hide Expo from public interface"
18
+ echo "Contents of $FILE:"
19
+ cat "$FILE"
20
+ fi
@@ -0,0 +1,67 @@
1
+ import type {
2
+ BrownfieldPluginAndroidConfig,
3
+ ResolvedBrownfieldPluginAndroidConfig,
4
+ } from './android/BrownfieldPluginAndroidConfig';
5
+ import type {
6
+ BrownfieldPluginIosConfig,
7
+ ResolvedBrownfieldPluginIosConfig,
8
+ } from './ios/BrownfieldPluginIosConfig';
9
+
10
+ /**
11
+ * Main configuration for the Brownfield Expo config plugin
12
+ */
13
+ export interface BrownfieldPluginConfig {
14
+ /**
15
+ * iOS-specific configuration
16
+ */
17
+ ios?: BrownfieldPluginIosConfig;
18
+
19
+ /**
20
+ * Android-specific configuration
21
+ */
22
+ android?: BrownfieldPluginAndroidConfig;
23
+
24
+ /**
25
+ * Whether to enable debug logging during plugin execution
26
+ * @default false
27
+ */
28
+ debug?: boolean;
29
+ }
30
+
31
+ /**
32
+ * Internal configuration with resolved defaults
33
+ * Note that the platform-specific configs can be null if the platform is not configured
34
+ */
35
+ export interface ResolvedBrownfieldPluginConfig extends Required<
36
+ Omit<BrownfieldPluginConfig, 'ios' | 'android'>
37
+ > {
38
+ /**
39
+ * iOS-specific configuration
40
+ */
41
+ ios: ResolvedBrownfieldPluginIosConfig | null;
42
+
43
+ /**
44
+ * Android-specific configuration
45
+ */
46
+ android: ResolvedBrownfieldPluginAndroidConfig | null;
47
+ }
48
+
49
+ /**
50
+ * Resolved Brownfield configuration including Android config
51
+ */
52
+ export interface ResolvedBrownfieldPluginConfigWithAndroid extends ResolvedBrownfieldPluginConfig {
53
+ /**
54
+ * Android-specific configuration
55
+ */
56
+ android: ResolvedBrownfieldPluginAndroidConfig;
57
+ }
58
+
59
+ /**
60
+ * Resolved Brownfield configuration including iOS config
61
+ */
62
+ export interface ResolvedBrownfieldPluginConfigWithIos extends ResolvedBrownfieldPluginConfig {
63
+ /**
64
+ * iOS-specific configuration
65
+ */
66
+ ios: ResolvedBrownfieldPluginIosConfig;
67
+ }
@@ -0,0 +1,4 @@
1
+ export interface RenderedTemplateFile {
2
+ relativePath: string;
3
+ content: string;
4
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Android-specific configuration for Brownfield config plugin
3
+ */
4
+ export interface BrownfieldPluginAndroidConfig {
5
+ /**
6
+ * The name of the Android library module to create
7
+ * @default "brownfieldlib"
8
+ */
9
+ moduleName?: string;
10
+
11
+ /**
12
+ * The package name for the Android library module
13
+ * @default app's package name
14
+ */
15
+ packageName?: string;
16
+
17
+ /**
18
+ * Minimum SDK version for the Android library
19
+ * @default 24
20
+ */
21
+ minSdkVersion?: number;
22
+
23
+ /**
24
+ * Target SDK version for the Android library
25
+ * @default 35
26
+ */
27
+ targetSdkVersion?: number;
28
+
29
+ /**
30
+ * Compile SDK version for the Android library
31
+ * @default 35
32
+ */
33
+ compileSdkVersion?: number;
34
+
35
+ /**
36
+ * Group ID for Maven publishing
37
+ * @default package name
38
+ */
39
+ groupId?: string;
40
+
41
+ /**
42
+ * Artifact ID for Maven publishing
43
+ * @default module name
44
+ */
45
+ artifactId?: string;
46
+
47
+ /**
48
+ * Version string for Maven publishing
49
+ * @default "0.0.1-SNAPSHOT"
50
+ */
51
+ version?: string;
52
+ }
53
+
54
+ /**
55
+ * Android configuration with resolved defaults (all fields required)
56
+ */
57
+ export type ResolvedBrownfieldPluginAndroidConfig =
58
+ Required<BrownfieldPluginAndroidConfig>;
@@ -0,0 +1,6 @@
1
+ export type * from './android/BrownfieldPluginAndroidConfig';
2
+ export type * from './ios/BrownfieldPluginIosConfig';
3
+
4
+ export type * from './BrownfieldPluginConfig';
5
+
6
+ export type * from './RenderedTemplateFile';
@@ -0,0 +1,41 @@
1
+ /**
2
+ * iOS-specific configuration for Brownfield config plugin
3
+ */
4
+ export interface BrownfieldPluginIosConfig {
5
+ /**
6
+ * The name of the framework to create
7
+ * This will be used as the XCFramework name
8
+ * @default "BrownfieldLib"
9
+ */
10
+ frameworkName?: string;
11
+
12
+ /**
13
+ * The bundle identifier for the framework
14
+ * @default app's bundle identifier with ".brownfield" suffix
15
+ */
16
+ bundleIdentifier?: string;
17
+
18
+ /**
19
+ * Custom build settings to apply to the framework build
20
+ */
21
+ buildSettings?: Record<string, string | boolean | number>;
22
+
23
+ /**
24
+ * Minimum iOS deployment target
25
+ * @default "15.0"
26
+ */
27
+ deploymentTarget?: string;
28
+
29
+ /**
30
+ * The version of the framework, must be an integer or floating point (e.g. 1, or 2.1)
31
+ * @default 1
32
+ * @see https://developer.apple.com/documentation/xcode/build-settings-reference#Current-Project-Version
33
+ */
34
+ frameworkVersion?: string;
35
+ }
36
+
37
+ /**
38
+ * iOS configuration with resolved defaults (all fields required)
39
+ */
40
+ export type ResolvedBrownfieldPluginIosConfig =
41
+ Required<BrownfieldPluginIosConfig>;
@@ -0,0 +1,112 @@
1
+ import {
2
+ createRunOncePlugin,
3
+ withPlugins,
4
+ type ConfigPlugin,
5
+ type StaticPlugin,
6
+ } from '@expo/config-plugins';
7
+ import type { ExpoConfig } from '@expo/config-types';
8
+
9
+ import { withBrownfieldIos } from './ios/withBrownfieldIos';
10
+ import { withBrownfieldAndroid } from './android/withBrownfieldAndroid';
11
+ import type {
12
+ BrownfieldPluginConfig,
13
+ ResolvedBrownfieldPluginConfig,
14
+ } from './types';
15
+
16
+ import { Logger } from './logging';
17
+
18
+ /**
19
+ * Resolves the plugin configuration using provided config and config defaults.
20
+ * @param config The user-provided Brownfield configuration.
21
+ * @param expoConfig The Expo configuration object.
22
+ * @returns The resolved Brownfield configuration.
23
+ */
24
+ function resolveConfig(
25
+ config: BrownfieldPluginConfig = {},
26
+ expoConfig: ExpoConfig
27
+ ): ResolvedBrownfieldPluginConfig {
28
+ Logger.setIsDebug(config.debug ?? false);
29
+
30
+ const androidPackage = expoConfig.android?.package;
31
+ const androidModuleName = config.android?.moduleName ?? 'brownfieldlib';
32
+
33
+ return {
34
+ ios: expoConfig.ios
35
+ ? {
36
+ frameworkName: config.ios?.frameworkName ?? 'BrownfieldLib',
37
+ bundleIdentifier:
38
+ config.ios?.bundleIdentifier ??
39
+ `${expoConfig.ios.bundleIdentifier}.brownfield`,
40
+ buildSettings: config.ios?.buildSettings ?? {},
41
+ deploymentTarget: config.ios?.deploymentTarget ?? '15.0',
42
+ frameworkVersion: config.ios?.frameworkVersion ?? '1',
43
+ }
44
+ : null,
45
+ android: androidPackage
46
+ ? {
47
+ moduleName: androidModuleName,
48
+ packageName: config.android?.packageName ?? androidPackage,
49
+ minSdkVersion: config.android?.minSdkVersion ?? 24,
50
+ targetSdkVersion: config.android?.targetSdkVersion ?? 35,
51
+ compileSdkVersion: config.android?.compileSdkVersion ?? 35,
52
+ groupId: config.android?.groupId ?? androidPackage,
53
+ artifactId: config.android?.artifactId ?? androidModuleName,
54
+ version: config.android?.version ?? '0.0.1-SNAPSHOT',
55
+ }
56
+ : null,
57
+ debug: config.debug ?? false,
58
+ };
59
+ }
60
+
61
+ /**
62
+ * React Native Brownfield - Expo Config Plugin.
63
+ *
64
+ * This plugin configures your Expo project to be packaged as:
65
+ * - iOS: XCFramework that can be integrated into native iOS apps
66
+ * - Android: AAR that can be integrated into native Android apps
67
+ *
68
+ * The plugin modifies the native project files during expo prebuild.
69
+ *
70
+ * @example
71
+ * ```json
72
+ * // app.json
73
+ * {
74
+ * "expo": {
75
+ * "plugins": [
76
+ * ["@callstack/react-native-brownfield", {
77
+ * "ios": {
78
+ * "frameworkName": "MyReactNativeApp"
79
+ * },
80
+ * "android": {
81
+ * "moduleName": "myreactnativeapp"
82
+ * }
83
+ * }]
84
+ * ]
85
+ * }
86
+ * }
87
+ * ```
88
+ */
89
+ const withBrownfield: ConfigPlugin<BrownfieldPluginConfig | void> = (
90
+ config,
91
+ props = {}
92
+ ) => {
93
+ const resolvedConfig = resolveConfig(props ?? {}, config);
94
+
95
+ const plugins: (ConfigPlugin | StaticPlugin)[] = [];
96
+
97
+ if (resolvedConfig.ios) {
98
+ plugins.push([withBrownfieldIos, resolvedConfig]);
99
+ }
100
+
101
+ if (resolvedConfig.android) {
102
+ plugins.push([withBrownfieldAndroid, resolvedConfig]);
103
+ }
104
+
105
+ return withPlugins(config, plugins);
106
+ };
107
+
108
+ export default createRunOncePlugin(
109
+ withBrownfield,
110
+ process.env.npm_package_name as string,
111
+ process.env.npm_package_version as string
112
+ );