@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.
- package/lib/commonjs/expo-config-plugin/android/constants.js +2 -0
- package/lib/commonjs/expo-config-plugin/android/constants.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/android/gradleHelpers.js +2 -0
- package/lib/commonjs/expo-config-plugin/android/gradleHelpers.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/android/index.js +2 -0
- package/lib/commonjs/expo-config-plugin/android/index.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js +2 -0
- package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/android/withBrownfieldAndroid.js +2 -0
- package/lib/commonjs/expo-config-plugin/android/withBrownfieldAndroid.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/app.plugin.js +2 -0
- package/lib/commonjs/expo-config-plugin/app.plugin.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/errors/SourceModificationError.js +2 -0
- package/lib/commonjs/expo-config-plugin/errors/SourceModificationError.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/index.js +2 -0
- package/lib/commonjs/expo-config-plugin/index.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/ios/index.js +2 -0
- package/lib/commonjs/expo-config-plugin/ios/index.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js +31 -0
- package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js +2 -0
- package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/ios/withIosFrameworkFiles.js +2 -0
- package/lib/commonjs/expo-config-plugin/ios/withIosFrameworkFiles.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js +2 -0
- package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/logging.js +2 -0
- package/lib/commonjs/expo-config-plugin/logging.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/template/android/AndroidManifest.xml +4 -0
- package/lib/commonjs/expo-config-plugin/template/android/ReactNativeHostManager.kt +54 -0
- package/lib/commonjs/expo-config-plugin/template/android/build.gradle.kts +90 -0
- package/lib/commonjs/expo-config-plugin/template/android/consumer-rules.pro +0 -0
- package/lib/commonjs/expo-config-plugin/template/android/gradle.properties +8 -0
- package/lib/commonjs/expo-config-plugin/template/android/proguard-rules.pro +21 -0
- package/lib/commonjs/expo-config-plugin/template/engine.js +2 -0
- package/lib/commonjs/expo-config-plugin/template/engine.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/template/ios/FrameworkInterface.swift +8 -0
- package/lib/commonjs/expo-config-plugin/template/ios/Info.plist +22 -0
- package/lib/commonjs/expo-config-plugin/template/ios/PodfileTargetBlock.rb +4 -0
- package/lib/commonjs/expo-config-plugin/template/ios/ReactNativeHostManager.swift +63 -0
- package/lib/commonjs/expo-config-plugin/template/ios/patchExpoPre55.sh +20 -0
- package/lib/commonjs/expo-config-plugin/types/BrownfieldPluginConfig.js +2 -0
- package/lib/commonjs/expo-config-plugin/types/BrownfieldPluginConfig.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/types/RenderedTemplateFile.js +2 -0
- package/lib/commonjs/expo-config-plugin/types/RenderedTemplateFile.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.js +2 -0
- package/lib/commonjs/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/types/index.js +2 -0
- package/lib/commonjs/expo-config-plugin/types/index.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.js +2 -0
- package/lib/commonjs/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/withBrownfield.js +2 -0
- package/lib/commonjs/expo-config-plugin/withBrownfield.js.map +1 -0
- package/lib/module/expo-config-plugin/android/constants.js +2 -0
- package/lib/module/expo-config-plugin/android/constants.js.map +1 -0
- package/lib/module/expo-config-plugin/android/gradleHelpers.js +2 -0
- package/lib/module/expo-config-plugin/android/gradleHelpers.js.map +1 -0
- package/lib/module/expo-config-plugin/android/index.js +2 -0
- package/lib/module/expo-config-plugin/android/index.js.map +1 -0
- package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js +2 -0
- package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -0
- package/lib/module/expo-config-plugin/android/withBrownfieldAndroid.js +2 -0
- package/lib/module/expo-config-plugin/android/withBrownfieldAndroid.js.map +1 -0
- package/lib/module/expo-config-plugin/app.plugin.js +2 -0
- package/lib/module/expo-config-plugin/app.plugin.js.map +1 -0
- package/lib/module/expo-config-plugin/errors/SourceModificationError.js +2 -0
- package/lib/module/expo-config-plugin/errors/SourceModificationError.js.map +1 -0
- package/lib/module/expo-config-plugin/index.js +2 -0
- package/lib/module/expo-config-plugin/index.js.map +1 -0
- package/lib/module/expo-config-plugin/ios/index.js +2 -0
- package/lib/module/expo-config-plugin/ios/index.js.map +1 -0
- package/lib/module/expo-config-plugin/ios/podfileHelpers.js +31 -0
- package/lib/module/expo-config-plugin/ios/podfileHelpers.js.map +1 -0
- package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js +2 -0
- package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -0
- package/lib/module/expo-config-plugin/ios/withIosFrameworkFiles.js +2 -0
- package/lib/module/expo-config-plugin/ios/withIosFrameworkFiles.js.map +1 -0
- package/lib/module/expo-config-plugin/ios/xcodeHelpers.js +2 -0
- package/lib/module/expo-config-plugin/ios/xcodeHelpers.js.map +1 -0
- package/lib/module/expo-config-plugin/logging.js +2 -0
- package/lib/module/expo-config-plugin/logging.js.map +1 -0
- package/lib/module/expo-config-plugin/template/android/AndroidManifest.xml +4 -0
- package/lib/module/expo-config-plugin/template/android/ReactNativeHostManager.kt +54 -0
- package/lib/module/expo-config-plugin/template/android/build.gradle.kts +90 -0
- package/lib/module/expo-config-plugin/template/android/consumer-rules.pro +0 -0
- package/lib/module/expo-config-plugin/template/android/gradle.properties +8 -0
- package/lib/module/expo-config-plugin/template/android/proguard-rules.pro +21 -0
- package/lib/module/expo-config-plugin/template/engine.js +2 -0
- package/lib/module/expo-config-plugin/template/engine.js.map +1 -0
- package/lib/module/expo-config-plugin/template/ios/FrameworkInterface.swift +8 -0
- package/lib/module/expo-config-plugin/template/ios/Info.plist +22 -0
- package/lib/module/expo-config-plugin/template/ios/PodfileTargetBlock.rb +4 -0
- package/lib/module/expo-config-plugin/template/ios/ReactNativeHostManager.swift +63 -0
- package/lib/module/expo-config-plugin/template/ios/patchExpoPre55.sh +20 -0
- package/lib/module/expo-config-plugin/types/BrownfieldPluginConfig.js +2 -0
- package/lib/module/expo-config-plugin/types/BrownfieldPluginConfig.js.map +1 -0
- package/lib/module/expo-config-plugin/types/RenderedTemplateFile.js +2 -0
- package/lib/module/expo-config-plugin/types/RenderedTemplateFile.js.map +1 -0
- package/lib/module/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.js +2 -0
- package/lib/module/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.js.map +1 -0
- package/lib/module/expo-config-plugin/types/index.js +2 -0
- package/lib/module/expo-config-plugin/types/index.js.map +1 -0
- package/lib/module/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.js +2 -0
- package/lib/module/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.js.map +1 -0
- package/lib/module/expo-config-plugin/withBrownfield.js +2 -0
- package/lib/module/expo-config-plugin/withBrownfield.js.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/constants.d.ts +3 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/gradleHelpers.d.ts +14 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/gradleHelpers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +24 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts +13 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/app.plugin.d.ts +9 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/app.plugin.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/errors/SourceModificationError.d.ts +3 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/errors/SourceModificationError.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/index.d.ts +7 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/index.d.ts +5 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts +8 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/withBrownfieldIos.d.ts +14 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts +19 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts +33 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/logging.d.ts +9 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/logging.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/template/engine.d.ts +9 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/template/engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/BrownfieldPluginConfig.d.ts +53 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/BrownfieldPluginConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/RenderedTemplateFile.d.ts +5 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/RenderedTemplateFile.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts +50 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/index.d.ts +5 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts +36 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/withBrownfield.d.ts +5 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/withBrownfield.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/android/constants.d.ts +3 -0
- package/lib/typescript/module/src/expo-config-plugin/android/constants.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/android/gradleHelpers.d.ts +14 -0
- package/lib/typescript/module/src/expo-config-plugin/android/gradleHelpers.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/android/index.d.ts +4 -0
- package/lib/typescript/module/src/expo-config-plugin/android/index.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +24 -0
- package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts +13 -0
- package/lib/typescript/module/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/app.plugin.d.ts +9 -0
- package/lib/typescript/module/src/expo-config-plugin/app.plugin.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/errors/SourceModificationError.d.ts +3 -0
- package/lib/typescript/module/src/expo-config-plugin/errors/SourceModificationError.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/index.d.ts +7 -0
- package/lib/typescript/module/src/expo-config-plugin/index.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/index.d.ts +5 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/index.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts +8 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/withBrownfieldIos.d.ts +14 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts +19 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts +33 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/logging.d.ts +9 -0
- package/lib/typescript/module/src/expo-config-plugin/logging.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/template/engine.d.ts +9 -0
- package/lib/typescript/module/src/expo-config-plugin/template/engine.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/types/BrownfieldPluginConfig.d.ts +53 -0
- package/lib/typescript/module/src/expo-config-plugin/types/BrownfieldPluginConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/types/RenderedTemplateFile.d.ts +5 -0
- package/lib/typescript/module/src/expo-config-plugin/types/RenderedTemplateFile.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts +50 -0
- package/lib/typescript/module/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/types/index.d.ts +5 -0
- package/lib/typescript/module/src/expo-config-plugin/types/index.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts +36 -0
- package/lib/typescript/module/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/withBrownfield.d.ts +5 -0
- package/lib/typescript/module/src/expo-config-plugin/withBrownfield.d.ts.map +1 -0
- package/package.json +15 -3
- package/src/expo-config-plugin/android/constants.ts +2 -0
- package/src/expo-config-plugin/android/gradleHelpers.ts +72 -0
- package/src/expo-config-plugin/android/index.ts +6 -0
- package/src/expo-config-plugin/android/withAndroidModuleFiles.ts +139 -0
- package/src/expo-config-plugin/android/withBrownfieldAndroid.ts +48 -0
- package/src/expo-config-plugin/app.plugin.ts +10 -0
- package/src/expo-config-plugin/errors/SourceModificationError.ts +1 -0
- package/src/expo-config-plugin/index.ts +8 -0
- package/src/expo-config-plugin/ios/index.ts +7 -0
- package/src/expo-config-plugin/ios/podfileHelpers.ts +104 -0
- package/src/expo-config-plugin/ios/withBrownfieldIos.ts +95 -0
- package/src/expo-config-plugin/ios/withIosFrameworkFiles.ts +95 -0
- package/src/expo-config-plugin/ios/xcodeHelpers.ts +359 -0
- package/src/expo-config-plugin/logging.ts +29 -0
- package/src/expo-config-plugin/template/android/AndroidManifest.xml +4 -0
- package/src/expo-config-plugin/template/android/ReactNativeHostManager.kt +54 -0
- package/src/expo-config-plugin/template/android/build.gradle.kts +90 -0
- package/src/expo-config-plugin/template/android/consumer-rules.pro +0 -0
- package/src/expo-config-plugin/template/android/gradle.properties +8 -0
- package/src/expo-config-plugin/template/android/proguard-rules.pro +21 -0
- package/src/expo-config-plugin/template/engine.ts +26 -0
- package/src/expo-config-plugin/template/ios/FrameworkInterface.swift +8 -0
- package/src/expo-config-plugin/template/ios/Info.plist +22 -0
- package/src/expo-config-plugin/template/ios/PodfileTargetBlock.rb +4 -0
- package/src/expo-config-plugin/template/ios/ReactNativeHostManager.swift +63 -0
- package/src/expo-config-plugin/template/ios/patchExpoPre55.sh +20 -0
- package/src/expo-config-plugin/types/BrownfieldPluginConfig.ts +67 -0
- package/src/expo-config-plugin/types/RenderedTemplateFile.ts +4 -0
- package/src/expo-config-plugin/types/android/BrownfieldPluginAndroidConfig.ts +58 -0
- package/src/expo-config-plugin/types/index.ts +6 -0
- package/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.ts +41 -0
- 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,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,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
|
+
);
|