@callstack/react-native-brownfield 5.2.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/android/build.gradle +1 -0
- package/android/consumer-rules.pro +6 -0
- package/android/src/main/java/com/callstack/reactnativebrownfield/BrownfieldPerformance.kt +384 -0
- package/android/src/main/java/com/callstack/reactnativebrownfield/BrownfieldPerformanceModule.kt +15 -0
- package/android/src/main/java/com/callstack/reactnativebrownfield/ReactDelegateWrapper.kt +8 -5
- package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfield.kt +78 -23
- package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfieldPackage.kt +1 -0
- package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeFragment.kt +89 -3
- package/android/src/main/java/com/callstack/reactnativebrownfield/constants/ReactNativeFragmentArgNames.kt +2 -0
- package/android/src/test/java/com/callstack/reactnativebrownfield/PerformanceMetricsTest.kt +54 -0
- package/gradle-plugin/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/RNSourceSets.kt +59 -15
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/plugin/AgpCompatibilityMatrixTest.kt +6 -8
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/plugin/LegacyConsumerConfigurationTest.kt +6 -4
- package/gradle-plugin/brownfield/src/test/kotlin/com/callstack/react/brownfield/plugin/RNBundleTaskStubs.kt +27 -0
- package/ios/BrownfieldDisplayMetrics.swift +265 -0
- package/ios/BrownfieldPerformanceBridge.h +8 -0
- package/ios/BrownfieldPerformanceBridge.mm +103 -0
- package/ios/Expo/ExpoHostRuntime.swift +58 -14
- package/ios/Expo/ExpoUpdatesStartup.swift +49 -0
- package/ios/JSBundleLoadObserver.swift +56 -19
- package/ios/JSBundleTimingObserver.h +26 -0
- package/ios/JSBundleTimingObserver.m +140 -0
- package/ios/ReactHostPreloading.swift +7 -3
- package/ios/ReactNativeBrownfield.swift +82 -14
- package/ios/ReactNativeBrownfield.xcodeproj/project.pbxproj +16 -0
- package/ios/Vanilla/ReactNativeHostRuntime.swift +1 -1
- package/ios/Views/ReactNativeView.swift +21 -3
- package/ios/Views/ReactNativeViewController.swift +44 -42
- package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js +1 -1
- package/lib/commonjs/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js +1 -1
- package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js +1 -1
- package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/ios/withIosFrameworkFiles.js +1 -1
- package/lib/commonjs/expo-config-plugin/ios/withIosFrameworkFiles.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js +2 -2
- package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/template/android/ReactNativeHostManager.vanilla.kt +35 -0
- package/lib/commonjs/expo-config-plugin/template/android/consumer-rules.pro +7 -0
- package/lib/commonjs/expo-config-plugin/template/ios/FrameworkInterface.vanilla.swift +12 -0
- package/lib/commonjs/expo-config-plugin/template/ios/PodfileTargetBlock.vanilla.rb +5 -0
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/scaffold/index.js +2 -0
- package/lib/commonjs/scaffold/index.js.map +1 -0
- package/lib/commonjs/scaffold/projectFiles.js +2 -0
- package/lib/commonjs/scaffold/projectFiles.js.map +1 -0
- package/lib/commonjs/scaffold/xcode.d.js +2 -0
- package/lib/commonjs/scaffold/xcode.d.js.map +1 -0
- package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js +1 -1
- package/lib/module/expo-config-plugin/android/withAndroidModuleFiles.js.map +1 -1
- package/lib/module/expo-config-plugin/ios/podfileHelpers.js +1 -1
- package/lib/module/expo-config-plugin/ios/podfileHelpers.js.map +1 -1
- package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js +1 -1
- package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -1
- package/lib/module/expo-config-plugin/ios/withIosFrameworkFiles.js +1 -1
- package/lib/module/expo-config-plugin/ios/withIosFrameworkFiles.js.map +1 -1
- package/lib/module/expo-config-plugin/ios/xcodeHelpers.js +2 -2
- package/lib/module/expo-config-plugin/ios/xcodeHelpers.js.map +1 -1
- package/lib/module/expo-config-plugin/template/android/ReactNativeHostManager.vanilla.kt +35 -0
- package/lib/module/expo-config-plugin/template/android/consumer-rules.pro +7 -0
- package/lib/module/expo-config-plugin/template/ios/FrameworkInterface.vanilla.swift +12 -0
- package/lib/module/expo-config-plugin/template/ios/PodfileTargetBlock.vanilla.rb +5 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/scaffold/index.js +2 -0
- package/lib/module/scaffold/index.js.map +1 -0
- package/lib/module/scaffold/projectFiles.js +2 -0
- package/lib/module/scaffold/projectFiles.js.map +1 -0
- package/lib/module/scaffold/xcode.d.js +2 -0
- package/lib/module/scaffold/xcode.d.js.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +10 -2
- package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts +4 -2
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts +11 -2
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts +6 -2
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +7 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/scaffold/index.d.ts +23 -0
- package/lib/typescript/commonjs/src/scaffold/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/scaffold/projectFiles.d.ts +63 -0
- package/lib/typescript/commonjs/src/scaffold/projectFiles.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +10 -2
- package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts +4 -2
- package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts +11 -2
- package/lib/typescript/module/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts +6 -2
- package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +7 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/scaffold/index.d.ts +23 -0
- package/lib/typescript/module/src/scaffold/index.d.ts.map +1 -0
- package/lib/typescript/module/src/scaffold/projectFiles.d.ts +63 -0
- package/lib/typescript/module/src/scaffold/projectFiles.d.ts.map +1 -0
- package/package.json +16 -2
- package/src/expo-config-plugin/android/withAndroidModuleFiles.ts +33 -5
- package/src/expo-config-plugin/ios/podfileHelpers.ts +24 -6
- package/src/expo-config-plugin/ios/withBrownfieldIos.ts +5 -2
- package/src/expo-config-plugin/ios/withIosFrameworkFiles.ts +21 -6
- package/src/expo-config-plugin/ios/xcodeHelpers.ts +77 -5
- package/src/expo-config-plugin/template/android/ReactNativeHostManager.vanilla.kt +35 -0
- package/src/expo-config-plugin/template/android/consumer-rules.pro +7 -0
- package/src/expo-config-plugin/template/ios/FrameworkInterface.vanilla.swift +12 -0
- package/src/expo-config-plugin/template/ios/PodfileTargetBlock.vanilla.rb +5 -0
- package/src/index.ts +20 -1
- package/src/scaffold/index.ts +395 -0
- package/src/scaffold/projectFiles.ts +243 -0
- package/src/scaffold/xcode.d.ts +4 -0
|
@@ -4,6 +4,35 @@ import UIKit
|
|
|
4
4
|
internal import Expo
|
|
5
5
|
#endif
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* JS bundle timings from React Native's performance logger.
|
|
9
|
+
*
|
|
10
|
+
* - `jsBundleLoadTime` is `RCTPLScriptDownload` (Metro HTTP in Debug, file read in Release).
|
|
11
|
+
* - `jsBundleEvaluationTime` is `RCTPLScriptExecution`.
|
|
12
|
+
*
|
|
13
|
+
* A tag field is `nil` when the tag never completed (failed load, logger missing, or
|
|
14
|
+
* bridgeless React Native below 0.87).
|
|
15
|
+
*/
|
|
16
|
+
@objc public class JSBundleTimings: NSObject {
|
|
17
|
+
@objc public let jsBundleLoadTime: NSNumber?
|
|
18
|
+
@objc public let jsBundleEvaluationTime: NSNumber?
|
|
19
|
+
@objc public let timeline: [[String: Any]]
|
|
20
|
+
|
|
21
|
+
@objc public init(jsBundleLoadTime: NSNumber?, jsBundleEvaluationTime: NSNumber?) {
|
|
22
|
+
self.timeline = []
|
|
23
|
+
self.jsBundleLoadTime = jsBundleLoadTime
|
|
24
|
+
self.jsBundleEvaluationTime = jsBundleEvaluationTime
|
|
25
|
+
super.init()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@objc public init(jsBundleLoadTime: NSNumber?, jsBundleEvaluationTime: NSNumber?, timeline: [[String: Any]]) {
|
|
29
|
+
self.jsBundleLoadTime = jsBundleLoadTime
|
|
30
|
+
self.jsBundleEvaluationTime = jsBundleEvaluationTime
|
|
31
|
+
self.timeline = timeline
|
|
32
|
+
super.init()
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
7
36
|
@objc public class ReactNativeBrownfield: NSObject {
|
|
8
37
|
public static let shared = ReactNativeBrownfield()
|
|
9
38
|
|
|
@@ -100,6 +129,7 @@ internal import Expo
|
|
|
100
129
|
* Stops React Native.
|
|
101
130
|
*/
|
|
102
131
|
@objc public func stopReactNative() {
|
|
132
|
+
NotificationCenter.default.post(name: Notification.Name("BrownfieldPerformanceStop"), object: nil)
|
|
103
133
|
#if canImport(Expo)
|
|
104
134
|
ExpoHostRuntime.shared.stopReactNative()
|
|
105
135
|
#else
|
|
@@ -112,19 +142,57 @@ internal import Expo
|
|
|
112
142
|
initialProps: [AnyHashable: Any]?,
|
|
113
143
|
launchOptions: [AnyHashable: Any]? = nil
|
|
114
144
|
) -> UIView? {
|
|
145
|
+
makeView(moduleName: moduleName, initialProps: initialProps, launchOptions: launchOptions,
|
|
146
|
+
session: nil, isHostVisible: nil)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/// Creates a measured presentation. The completion receives one immutable snapshot on main.
|
|
150
|
+
/// Opt in to wait for JS `markFullyDisplayed(brownfieldPresentationID)`.
|
|
151
|
+
/// Thread sampling requires both collectThreadMetrics and an onMetrics callback.
|
|
152
|
+
@objc public func view(
|
|
153
|
+
moduleName: String,
|
|
154
|
+
initialProps: [AnyHashable: Any]?,
|
|
155
|
+
launchOptions: [AnyHashable: Any]? = nil,
|
|
156
|
+
waitForFullDisplay: Bool = false,
|
|
157
|
+
collectThreadMetrics: Bool = false,
|
|
158
|
+
onMetrics: ((BrownfieldDisplayMetrics) -> Void)?
|
|
159
|
+
) -> UIView? {
|
|
160
|
+
let session = BrownfieldDisplaySession(moduleName: moduleName,
|
|
161
|
+
waitForFullDisplay: waitForFullDisplay, collectThreadMetrics: collectThreadMetrics,
|
|
162
|
+
callback: onMetrics)
|
|
163
|
+
return makeView(moduleName: moduleName, initialProps: initialProps,
|
|
164
|
+
launchOptions: launchOptions, session: session, isHostVisible: nil)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/// Only measured presentations get a session. Without one, `initialProps` pass through as is.
|
|
168
|
+
/// `isHostVisible` is set by `ReactNativeViewController`, which reports appearance itself.
|
|
169
|
+
internal func makeView(moduleName: String, initialProps: [AnyHashable: Any]?,
|
|
170
|
+
launchOptions: [AnyHashable: Any]?, session: BrownfieldDisplaySession?,
|
|
171
|
+
isHostVisible: (() -> Bool)?) -> UIView? {
|
|
172
|
+
var props = initialProps
|
|
173
|
+
if let session {
|
|
174
|
+
props = (props ?? [:]).merging(["brownfieldPresentationID": session.id]) { $1 }
|
|
175
|
+
}
|
|
176
|
+
// The probe goes into the React Native root, not into a placeholder, so initial display
|
|
177
|
+
// can't complete before the root exists.
|
|
178
|
+
let attachProbe: (UIView?) -> Void = { rootView in
|
|
179
|
+
guard let session else { return }
|
|
180
|
+
guard let rootView else { session.cancel(); return }
|
|
181
|
+
let probe = BrownfieldAppearanceProbe(session: session)
|
|
182
|
+
probe.isHostVisible = isHostVisible
|
|
183
|
+
session.hasRootView = true
|
|
184
|
+
rootView.addSubview(probe)
|
|
185
|
+
}
|
|
115
186
|
#if canImport(Expo)
|
|
116
|
-
ExpoHostRuntime.shared.view(
|
|
117
|
-
|
|
118
|
-
initialProps: initialProps,
|
|
119
|
-
launchOptions: launchOptions
|
|
120
|
-
)
|
|
187
|
+
let view = ExpoHostRuntime.shared.view(moduleName: moduleName, initialProps: props,
|
|
188
|
+
launchOptions: launchOptions, onRootView: attachProbe)
|
|
121
189
|
#else
|
|
122
|
-
ReactNativeHostRuntime.shared.view(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
launchOptions: launchOptions
|
|
126
|
-
)
|
|
190
|
+
let view = ReactNativeHostRuntime.shared.view(moduleName: moduleName, initialProps: props,
|
|
191
|
+
launchOptions: launchOptions)
|
|
192
|
+
attachProbe(view)
|
|
127
193
|
#endif
|
|
194
|
+
if view == nil { session?.cancel() }
|
|
195
|
+
return view
|
|
128
196
|
}
|
|
129
197
|
|
|
130
198
|
/**
|
|
@@ -193,10 +261,10 @@ internal import Expo
|
|
|
193
261
|
* Starts React Native with optional callback when bundle is loaded.
|
|
194
262
|
*
|
|
195
263
|
* @param onBundleLoaded Optional callback invoked on the main thread after the JS bundle is
|
|
196
|
-
* fully loaded. It runs in the next turn of the main run loop
|
|
197
|
-
* loaded. A new callback replaces the callback that waits.
|
|
264
|
+
* fully loaded. It receives `JSBundleTimings`. It runs in the next turn of the main run loop
|
|
265
|
+
* when the bundle is already loaded. A new callback replaces the callback that waits.
|
|
198
266
|
*/
|
|
199
|
-
@objc public func startReactNative(onBundleLoaded: (() -> Void)?) {
|
|
267
|
+
@objc public func startReactNative(onBundleLoaded: ((JSBundleTimings) -> Void)?) {
|
|
200
268
|
#if canImport(Expo)
|
|
201
269
|
ExpoHostRuntime.shared.startReactNative(onBundleLoaded: onBundleLoaded)
|
|
202
270
|
#else
|
|
@@ -220,7 +288,7 @@ internal import Expo
|
|
|
220
288
|
@objc public func startReactNative(
|
|
221
289
|
launchOptions: [AnyHashable: Any]?,
|
|
222
290
|
preloadBundle: Bool,
|
|
223
|
-
onBundleLoaded: (() -> Void)?
|
|
291
|
+
onBundleLoaded: ((JSBundleTimings) -> Void)?
|
|
224
292
|
) {
|
|
225
293
|
#if canImport(Expo)
|
|
226
294
|
ExpoHostRuntime.shared.startReactNative(
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
79FEE77E2FB499E400E407DE /* ReactNativeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FEE77C2FB499E400E407DE /* ReactNativeViewController.swift */; };
|
|
18
18
|
79FEE7802FB499EC00E407DE /* ReactNativeHostRuntime.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FEE77F2FB499EC00E407DE /* ReactNativeHostRuntime.swift */; };
|
|
19
19
|
79FEE7822FB499F300E407DE /* ExpoHostRuntime.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FEE7812FB499F300E407DE /* ExpoHostRuntime.swift */; };
|
|
20
|
+
79FEE7852FB500A100E407DE /* JSBundleTimingObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 79FEE7842FB500A100E407DE /* JSBundleTimingObserver.m */; };
|
|
21
|
+
BEAF10000000000000000000 /* BrownfieldDisplayMetrics.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEAF00000000000000000000 /* BrownfieldDisplayMetrics.swift */; };
|
|
22
|
+
BEAF10000000000000000002 /* BrownfieldPerformanceBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = BEAF00000000000000000002 /* BrownfieldPerformanceBridge.mm */; };
|
|
20
23
|
/* End PBXBuildFile section */
|
|
21
24
|
|
|
22
25
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -44,6 +47,11 @@
|
|
|
44
47
|
79FEE77C2FB499E400E407DE /* ReactNativeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactNativeViewController.swift; sourceTree = "<group>"; };
|
|
45
48
|
79FEE77F2FB499EC00E407DE /* ReactNativeHostRuntime.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactNativeHostRuntime.swift; sourceTree = "<group>"; };
|
|
46
49
|
79FEE7812FB499F300E407DE /* ExpoHostRuntime.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpoHostRuntime.swift; sourceTree = "<group>"; };
|
|
50
|
+
79FEE7832FB500A100E407DE /* JSBundleTimingObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSBundleTimingObserver.h; sourceTree = "<group>"; };
|
|
51
|
+
79FEE7842FB500A100E407DE /* JSBundleTimingObserver.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JSBundleTimingObserver.m; sourceTree = "<group>"; };
|
|
52
|
+
BEAF00000000000000000000 /* BrownfieldDisplayMetrics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrownfieldDisplayMetrics.swift; sourceTree = "<group>"; };
|
|
53
|
+
BEAF00000000000000000001 /* BrownfieldPerformanceBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BrownfieldPerformanceBridge.h; sourceTree = "<group>"; };
|
|
54
|
+
BEAF00000000000000000002 /* BrownfieldPerformanceBridge.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = BrownfieldPerformanceBridge.mm; sourceTree = "<group>"; };
|
|
47
55
|
/* End PBXFileReference section */
|
|
48
56
|
|
|
49
57
|
/* Begin PBXFrameworksBuildPhase section */
|
|
@@ -65,7 +73,12 @@
|
|
|
65
73
|
79FEE7692FB4997100E407DE /* Expo */,
|
|
66
74
|
696CB22A230EF910000207AF /* Products */,
|
|
67
75
|
79FEE76D2FB499C700E407DE /* BrownfieldBundlePathResolver.swift */,
|
|
76
|
+
BEAF00000000000000000000 /* BrownfieldDisplayMetrics.swift */,
|
|
77
|
+
BEAF00000000000000000001 /* BrownfieldPerformanceBridge.h */,
|
|
78
|
+
BEAF00000000000000000002 /* BrownfieldPerformanceBridge.mm */,
|
|
68
79
|
79FEE76E2FB499C700E407DE /* JSBundleLoadObserver.swift */,
|
|
80
|
+
79FEE7832FB500A100E407DE /* JSBundleTimingObserver.h */,
|
|
81
|
+
79FEE7842FB500A100E407DE /* JSBundleTimingObserver.m */,
|
|
69
82
|
79FEE76F2FB499C700E407DE /* Notification+Brownfield.swift */,
|
|
70
83
|
79FEE7702FB499C700E407DE /* ReactNativeBrownfield.swift */,
|
|
71
84
|
79FEE7712FB499C700E407DE /* ReactNativeBrownfieldModule.h */,
|
|
@@ -170,7 +183,10 @@
|
|
|
170
183
|
79FEE7762FB499C700E407DE /* Notification+Brownfield.swift in Sources */,
|
|
171
184
|
79FEE7822FB499F300E407DE /* ExpoHostRuntime.swift in Sources */,
|
|
172
185
|
79FEE7772FB499C700E407DE /* ReactNativeBrownfieldModule.swift in Sources */,
|
|
186
|
+
BEAF10000000000000000000 /* BrownfieldDisplayMetrics.swift in Sources */,
|
|
187
|
+
BEAF10000000000000000002 /* BrownfieldPerformanceBridge.mm in Sources */,
|
|
173
188
|
79FEE7782FB499C700E407DE /* JSBundleLoadObserver.swift in Sources */,
|
|
189
|
+
79FEE7852FB500A100E407DE /* JSBundleTimingObserver.m in Sources */,
|
|
174
190
|
79FEE7792FB499C700E407DE /* ReactNativeBrownfield.swift in Sources */,
|
|
175
191
|
79FEE77D2FB499E400E407DE /* ReactNativeView.swift in Sources */,
|
|
176
192
|
79FEE77E2FB499E400E407DE /* ReactNativeViewController.swift in Sources */,
|
|
@@ -191,7 +191,7 @@ final class ReactNativeHostRuntime {
|
|
|
191
191
|
*
|
|
192
192
|
* @param onBundleLoaded Optional callback invoked on the main thread after JS bundle is fully loaded.
|
|
193
193
|
*/
|
|
194
|
-
public func startReactNative(onBundleLoaded: (() -> Void)?) {
|
|
194
|
+
public func startReactNative(onBundleLoaded: ((JSBundleTimings) -> Void)?) {
|
|
195
195
|
// The callback registration is outside of the guard below. An earlier `startReactNative` call
|
|
196
196
|
// can already have made the factory, and the callback must still run.
|
|
197
197
|
if let onBundleLoaded {
|
|
@@ -17,11 +17,17 @@ struct ReactNativeViewRepresentable: UIViewControllerRepresentable {
|
|
|
17
17
|
var moduleName: String
|
|
18
18
|
var initialProperties: [String: Any] = [:]
|
|
19
19
|
var host: BrownfieldSurfaceHost
|
|
20
|
+
var waitForFullDisplay = false
|
|
21
|
+
var collectThreadMetrics = false
|
|
22
|
+
var onMetrics: ((BrownfieldDisplayMetrics) -> Void)?
|
|
20
23
|
|
|
21
24
|
func makeUIViewController(context: Context) -> UIViewController {
|
|
22
25
|
let controller = ReactNativeViewController(
|
|
23
26
|
moduleName: moduleName,
|
|
24
|
-
initialProperties: initialProperties
|
|
27
|
+
initialProperties: initialProperties,
|
|
28
|
+
waitForFullDisplay: waitForFullDisplay,
|
|
29
|
+
collectThreadMetrics: collectThreadMetrics,
|
|
30
|
+
onMetrics: onMetrics
|
|
25
31
|
)
|
|
26
32
|
controller.isHostedBySwiftUI = true
|
|
27
33
|
host.controller = controller
|
|
@@ -45,17 +51,29 @@ public struct ReactNativeView: View {
|
|
|
45
51
|
@State private var host = BrownfieldSurfaceHost()
|
|
46
52
|
var moduleName: String
|
|
47
53
|
var initialProperties: [String: Any] = [:]
|
|
54
|
+
var waitForFullDisplay = false
|
|
55
|
+
var collectThreadMetrics = false
|
|
56
|
+
var onMetrics: ((BrownfieldDisplayMetrics) -> Void)?
|
|
48
57
|
|
|
49
|
-
public init(moduleName: String, initialProperties: [String : Any] = [:]
|
|
58
|
+
public init(moduleName: String, initialProperties: [String : Any] = [:],
|
|
59
|
+
waitForFullDisplay: Bool = false,
|
|
60
|
+
collectThreadMetrics: Bool = false,
|
|
61
|
+
onMetrics: ((BrownfieldDisplayMetrics) -> Void)? = nil) {
|
|
50
62
|
self.moduleName = moduleName
|
|
51
63
|
self.initialProperties = initialProperties
|
|
64
|
+
self.waitForFullDisplay = waitForFullDisplay
|
|
65
|
+
self.collectThreadMetrics = collectThreadMetrics
|
|
66
|
+
self.onMetrics = onMetrics
|
|
52
67
|
}
|
|
53
68
|
|
|
54
69
|
public var body: some View {
|
|
55
70
|
ReactNativeViewRepresentable(
|
|
56
71
|
moduleName: moduleName,
|
|
57
72
|
initialProperties: initialProperties,
|
|
58
|
-
host: host
|
|
73
|
+
host: host,
|
|
74
|
+
waitForFullDisplay: waitForFullDisplay,
|
|
75
|
+
collectThreadMetrics: collectThreadMetrics,
|
|
76
|
+
onMetrics: onMetrics
|
|
59
77
|
)
|
|
60
78
|
.ignoresSafeArea(.all)
|
|
61
79
|
// `.popToNative` is public API and may be posted from any thread, while
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import UIKit
|
|
2
2
|
internal import React
|
|
3
|
-
#if canImport(EXUpdates)
|
|
4
|
-
internal import EXUpdates
|
|
5
|
-
#endif
|
|
6
3
|
|
|
7
4
|
@objc public class ReactNativeViewController: UIViewController {
|
|
8
5
|
private var moduleName: String
|
|
@@ -26,38 +23,46 @@ internal import EXUpdates
|
|
|
26
23
|
guard let surfaceID else { return false }
|
|
27
24
|
return BrownfieldSurfaceRegistry.shared.isPopTarget(surfaceID)
|
|
28
25
|
}
|
|
26
|
+
private var waitForFullDisplay = false
|
|
27
|
+
private var collectThreadMetrics = false
|
|
28
|
+
private var onMetrics: ((BrownfieldDisplayMetrics) -> Void)?
|
|
29
|
+
private var isMeasured = false
|
|
30
|
+
private var displaySession: BrownfieldDisplaySession?
|
|
31
|
+
private var isVisible = false
|
|
29
32
|
|
|
30
|
-
#if canImport(EXUpdates)
|
|
31
|
-
private let expoUpdatesDelegate = ReactNativeExpoUpdatesDelegate()
|
|
32
|
-
#endif
|
|
33
|
-
|
|
34
33
|
|
|
35
34
|
@objc public init(moduleName: String, initialProperties: [String: Any]? = nil) {
|
|
36
35
|
self.moduleName = moduleName
|
|
37
36
|
self.initialProperties = initialProperties
|
|
38
|
-
#if canImport(EXUpdates)
|
|
39
|
-
AppController.sharedInstance.delegate = expoUpdatesDelegate
|
|
40
|
-
AppController.sharedInstance.start()
|
|
41
|
-
#endif
|
|
42
37
|
super.init(nibName: nil, bundle: nil)
|
|
43
38
|
}
|
|
44
39
|
|
|
40
|
+
@objc public convenience init(moduleName: String, initialProperties: [String: Any]? = nil,
|
|
41
|
+
waitForFullDisplay: Bool = false,
|
|
42
|
+
collectThreadMetrics: Bool = false,
|
|
43
|
+
onMetrics: ((BrownfieldDisplayMetrics) -> Void)?) {
|
|
44
|
+
self.init(moduleName: moduleName, initialProperties: initialProperties)
|
|
45
|
+
self.waitForFullDisplay = waitForFullDisplay
|
|
46
|
+
self.collectThreadMetrics = collectThreadMetrics
|
|
47
|
+
self.onMetrics = onMetrics
|
|
48
|
+
self.isMeasured = true
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
required init?(coder: NSCoder) {
|
|
46
52
|
fatalError("init(coder:) has not been implemented")
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
public override func viewDidLoad() {
|
|
50
56
|
super.viewDidLoad()
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
if isMeasured {
|
|
58
|
+
displaySession = BrownfieldDisplaySession(moduleName: moduleName,
|
|
59
|
+
waitForFullDisplay: waitForFullDisplay, collectThreadMetrics: collectThreadMetrics,
|
|
60
|
+
callback: onMetrics)
|
|
54
61
|
}
|
|
55
|
-
|
|
62
|
+
onMetrics = nil
|
|
56
63
|
|
|
57
64
|
if !moduleName.isEmpty {
|
|
58
|
-
#if !canImport(EXUpdates)
|
|
59
65
|
renderReactNativeView()
|
|
60
|
-
#endif
|
|
61
66
|
|
|
62
67
|
// Visibility is resolved live: SwiftUI recreates hosted controllers, so a
|
|
63
68
|
// cached lifecycle flag is stale when the notification arrives.
|
|
@@ -100,7 +105,23 @@ internal import EXUpdates
|
|
|
100
105
|
isDisappearing = true
|
|
101
106
|
}
|
|
102
107
|
|
|
108
|
+
public override func viewDidAppear(_ animated: Bool) {
|
|
109
|
+
super.viewDidAppear(animated)
|
|
110
|
+
isVisible = true
|
|
111
|
+
// Expo Updates may not have created the RN root yet. The probe reports it when it arrives.
|
|
112
|
+
if displaySession?.hasRootView == true {
|
|
113
|
+
displaySession?.appeared()
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public override func viewDidDisappear(_ animated: Bool) {
|
|
118
|
+
super.viewDidDisappear(animated)
|
|
119
|
+
isVisible = false
|
|
120
|
+
displaySession?.cancel()
|
|
121
|
+
}
|
|
122
|
+
|
|
103
123
|
deinit {
|
|
124
|
+
displaySession?.cancel()
|
|
104
125
|
NotificationCenter.default.removeObserver(self)
|
|
105
126
|
|
|
106
127
|
if let surfaceID {
|
|
@@ -202,35 +223,16 @@ internal import EXUpdates
|
|
|
202
223
|
|
|
203
224
|
DispatchQueue.main.async { [weak self] in
|
|
204
225
|
guard let self else { return }
|
|
205
|
-
|
|
226
|
+
let session = self.displaySession
|
|
227
|
+
guard let reactView = ReactNativeBrownfield.shared.makeView(
|
|
206
228
|
moduleName: self.moduleName,
|
|
207
229
|
initialProps: self.initialProperties,
|
|
208
|
-
launchOptions: nil
|
|
230
|
+
launchOptions: nil,
|
|
231
|
+
session: session,
|
|
232
|
+
isHostVisible: { [weak self] in self?.isVisible == true }
|
|
209
233
|
) else { return }
|
|
210
234
|
self.view = reactView
|
|
235
|
+
if self.isVisible, session?.hasRootView == true { session?.appeared() }
|
|
211
236
|
}
|
|
212
237
|
}
|
|
213
238
|
}
|
|
214
|
-
|
|
215
|
-
#if canImport(EXUpdates)
|
|
216
|
-
private final class ReactNativeExpoUpdatesDelegate: NSObject, AppControllerDelegate {
|
|
217
|
-
private var didStartSuccessfully = false
|
|
218
|
-
var onDidStart: (() -> Void)? {
|
|
219
|
-
didSet {
|
|
220
|
-
if didStartSuccessfully {
|
|
221
|
-
onDidStart?()
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
func appController(_ appController: any EXUpdates.AppControllerInterface, didStartWithSuccess success: Bool) {
|
|
227
|
-
guard success else {
|
|
228
|
-
NSLog("%@", "Expo Updates failed to start React Native.")
|
|
229
|
-
return
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
didStartSuccessfully = true
|
|
233
|
-
onDidStart?()
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
#endif
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR=void 0;exports.createAndroidModule=createAndroidModule;exports.renderTargetSdkBlock=renderTargetSdkBlock;exports.resolveCompileSdkVersionExpression=resolveCompileSdkVersionExpression;exports.resolveTargetSdkVersionExpression=resolveTargetSdkVersionExpression;exports.syncAndroidModuleExpoUpdatesFromAppFiles=syncAndroidModuleExpoUpdatesFromAppFiles;exports.syncAndroidModuleManifest=syncAndroidModuleManifest;exports.syncAndroidModuleStringResources=syncAndroidModuleStringResources;exports.withAndroidModuleFiles=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var fs=_interopRequireWildcard(require("node:fs"));var path=_interopRequireWildcard(require("node:path"));var _configPlugins=require("@expo/config-plugins");var _logging=require("../logging");var _engine=require("../template/engine");var _expoUtils=require("../expoUtils");var _androidManifest=require("./utils/androidManifest");var _expoUpdates=require("./utils/expo-updates");var _hermes=require("./utils/hermes");var _formatHelpers=require("./utils/formatHelpers");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t in e)"default"!==_t&&{}.hasOwnProperty.call(e,_t)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t))&&(i.get||i.set)?o(f,_t,i):f[_t]=e[_t]);return f;})(e,t);}var EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR=exports.EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR=58;function renderMissingDimensionStrategyBlock(missingDimensionStrategies){if(missingDimensionStrategies.length<2){return'';}var args=(0,_formatHelpers.formatMissingDimensionStrategies)(missingDimensionStrategies);return` missingDimensionStrategy(${args})`;}function resolveCompileSdkVersionExpression(config){if(config.android.compileSdkVersion!=null){return config.android.compileSdkVersion.toString();}return'resolveRootProjectInt("compileSdkVersion")';}function resolveTargetSdkVersionExpression(config){if(config.android.targetSdkVersion!=null){return config.android.targetSdkVersion.toString();}return'resolveRootProjectInt("targetSdkVersion")';}function renderTargetSdkBlock(config,expoMajor){if(expoMajor!==undefined&&expoMajor>=EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR){return'';}return`\n targetSdk = ${resolveTargetSdkVersionExpression(config)}`;}function createAndroidModule(_ref){var _minifyEnabled,_extraProguardRules;var androidDir=_ref.androidDir,config=_ref.config,rnVersion=_ref.rnVersion,projectRoot=_ref.projectRoot,expoMajor=_ref.expoMajor;var android=config.android;var moduleDir=path.join(androidDir,android.moduleName);_logging.Logger.logDebug(`Creating Android module in: ${androidDir}`);var hermesArtifact=(0,_hermes.getHermesArtifact)(rnVersion,projectRoot);var compileSdkVersionExpression=resolveCompileSdkVersionExpression(config);var targetSdkBlock=renderTargetSdkBlock(config,expoMajor);var minifyEnabled=(_minifyEnabled=android.minifyEnabled)!=null?_minifyEnabled:false;var extraProguardRules=(_extraProguardRules=android.extraProguardRules)!=null?_extraProguardRules:[];var extraProguardRulesText=extraProguardRules.join('\n');_logging.Logger.logDebug(`Resolved Hermes artifact: ${hermesArtifact.groupId}:${hermesArtifact.artifactId}:${hermesArtifact.version}`);var missingDimensionStrategiesList=(0,_formatHelpers.formatMissingDimensionStrategies)(android.missingDimensionStrategies);var missingDimensionStrategyBlock=renderMissingDimensionStrategyBlock(android.missingDimensionStrategies);var files=[{relativePath:'build.gradle.kts',content:(0,_engine.renderTemplate)('android','build.gradle.kts',{'{{PACKAGE_NAME}}':android.packageName,'{{MIN_SDK_VERSION}}':android.minSdkVersion.toString(),'{{TARGET_SDK_BLOCK}}':targetSdkBlock,'{{COMPILE_SDK_VERSION}}':compileSdkVersionExpression,'{{GROUP_ID}}':android.groupId,'{{ARTIFACT_ID}}':android.artifactId,'{{ARTIFACT_VERSION}}':android.version,'{{RN_VERSION}}':rnVersion,'{{HERMES_ARTIFACT}}':`${hermesArtifact.groupId}:${hermesArtifact.artifactId}:${hermesArtifact.version}`,'{{IS_MINIFY_ENABLED}}':minifyEnabled.toString(),'{{MISSING_DIMENSION_STRATEGIES}}':missingDimensionStrategiesList,'{{MISSING_DIMENSION_STRATEGY_BLOCK}}':missingDimensionStrategyBlock})},{relativePath:'gradle.properties',content:(0,_engine.renderTemplate)('android','gradle.properties',{})},{relativePath:`src/main/java/${config.android.packageName.replace(/\./g,'/')}/ReactNativeHostManager.kt`,content:(0,_engine.renderTemplate)('android','ReactNativeHostManager.post55.kt',{'{{PACKAGE_NAME}}':android.packageName})},{relativePath:'consumer-rules.pro',content:(0,_engine.renderTemplate)('android','consumer-rules.pro',{})},{relativePath:'proguard-rules.pro',content:(0,_engine.renderTemplate)('android','proguard-rules.pro',{'{{PACKAGE_NAME}}':android.packageName,'{{EXTRA_PROGUARD_RULES}}':extraProguardRulesText})}];for(var file of files){var filePath=path.join(moduleDir,file.relativePath);var fileDir=path.dirname(filePath);if(!fs.existsSync(fileDir)){fs.mkdirSync(fileDir,{recursive:true});}fs.writeFileSync(filePath,file.content,'utf8');_logging.Logger.logDebug(`Created file: ${filePath}`);}syncAndroidModuleExpoUpdatesFromAppFiles({androidDir:androidDir,config:config});_logging.Logger.logDebug(`Android module "${android.moduleName}" created at ${moduleDir}`);}function syncAndroidModuleManifest(_ref2){var androidDir=_ref2.androidDir,config=_ref2.config,expoUpdatesMetaData=_ref2.expoUpdatesMetaData;writeAndroidModuleFile(path.join(androidDir,config.android.moduleName),'src/main/AndroidManifest.xml',(0,_engine.renderTemplate)('android','AndroidManifest.xml',{'{{APPLICATION_BLOCK}}':(0,_androidManifest.renderLibraryManifestApplication)(expoUpdatesMetaData)}));}function syncAndroidModuleStringResources(_ref3){var androidDir=_ref3.androidDir,config=_ref3.config,expoUpdatesStringResources=_ref3.expoUpdatesStringResources;writeAndroidModuleFile(path.join(androidDir,config.android.moduleName),'src/main/res/values/strings.xml',(0,_engine.renderTemplate)('android','strings.xml',{'{{STRING_RESOURCES}}':(0,_androidManifest.renderLibraryStringResources)(expoUpdatesStringResources)}));}function writeAndroidModuleFile(moduleDir,relativePath,content){var filePath=path.join(moduleDir,relativePath);var fileDir=path.dirname(filePath);if(!fs.existsSync(fileDir)){fs.mkdirSync(fileDir,{recursive:true});}fs.writeFileSync(filePath,content,'utf8');_logging.Logger.logDebug(`Created file: ${filePath}`);}function syncAndroidModuleExpoUpdatesFromAppFiles(_ref4){var androidDir=_ref4.androidDir,config=_ref4.config;var appModuleName='app';var expoUpdatesMetaData=(0,_expoUpdates.readExpoUpdatesApplicationMetaData)(androidDir,appModuleName);var expoUpdatesStringResources=(0,_expoUpdates.readExpoUpdatesStringResources)(androidDir,appModuleName,expoUpdatesMetaData);syncAndroidModuleManifest({androidDir:androidDir,config:config,expoUpdatesMetaData:expoUpdatesMetaData});syncAndroidModuleStringResources({androidDir:androidDir,config:config,expoUpdatesStringResources:expoUpdatesStringResources});}var withAndroidModuleFiles=exports.withAndroidModuleFiles=function withAndroidModuleFiles(config,props){return(0,_configPlugins.withDangerousMod)(config,['android',(function(){var _ref5=(0,_asyncToGenerator2.default)(function*(dangerousConfig){var androidDir=path.join(dangerousConfig.modRequest.projectRoot,'android');var rnVersion;try{var rnPkgPath=require.resolve('react-native/package.json',{paths:[dangerousConfig.modRequest.projectRoot]});var rnPkg=require(rnPkgPath);rnVersion=rnPkg.version;_logging.Logger.logDebug(`Resolved react-native version: ${rnVersion}`);}catch(_unused){throw new Error('Could not resolve react-native package version. Please ensure you have installed dependencies.');}createAndroidModule({androidDir:androidDir,config:props,rnVersion:rnVersion,projectRoot:dangerousConfig.modRequest.projectRoot,expoMajor:(0,_expoUtils.getExpoInfo)(dangerousConfig).expoMajor});return dangerousConfig;});return function(_x){return _ref5.apply(this,arguments);};}())]);};
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR=void 0;exports.createAndroidModule=createAndroidModule;exports.renderTargetSdkBlock=renderTargetSdkBlock;exports.resolveCompileSdkVersionExpression=resolveCompileSdkVersionExpression;exports.resolveTargetSdkVersionExpression=resolveTargetSdkVersionExpression;exports.syncAndroidModuleExpoUpdatesFromAppFiles=syncAndroidModuleExpoUpdatesFromAppFiles;exports.syncAndroidModuleManifest=syncAndroidModuleManifest;exports.syncAndroidModuleStringResources=syncAndroidModuleStringResources;exports.withAndroidModuleFiles=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var fs=_interopRequireWildcard(require("node:fs"));var path=_interopRequireWildcard(require("node:path"));var _configPlugins=require("@expo/config-plugins");var _logging=require("../logging");var _engine=require("../template/engine");var _expoUtils=require("../expoUtils");var _androidManifest=require("./utils/androidManifest");var _expoUpdates=require("./utils/expo-updates");var _hermes=require("./utils/hermes");var _formatHelpers=require("./utils/formatHelpers");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t in e)"default"!==_t&&{}.hasOwnProperty.call(e,_t)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t))&&(i.get||i.set)?o(f,_t,i):f[_t]=e[_t]);return f;})(e,t);}var EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR=exports.EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR=58;function renderMissingDimensionStrategyBlock(missingDimensionStrategies){if(missingDimensionStrategies.length<2){return'';}var args=(0,_formatHelpers.formatMissingDimensionStrategies)(missingDimensionStrategies);return` missingDimensionStrategy(${args})`;}function resolveCompileSdkVersionExpression(config){if(config.android.compileSdkVersion!=null){return config.android.compileSdkVersion.toString();}return'resolveRootProjectInt("compileSdkVersion")';}function resolveTargetSdkVersionExpression(config){if(config.android.targetSdkVersion!=null){return config.android.targetSdkVersion.toString();}return'resolveRootProjectInt("targetSdkVersion")';}function renderTargetSdkBlock(config,expoMajor){var templateVariant=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'expo';if(templateVariant==='vanilla'){return'';}if(expoMajor!==undefined&&expoMajor>=EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR){return'';}return`\n targetSdk = ${resolveTargetSdkVersionExpression(config)}`;}function createAndroidModule(_ref){var _minifyEnabled,_extraProguardRules;var androidDir=_ref.androidDir,config=_ref.config,rnVersion=_ref.rnVersion,projectRoot=_ref.projectRoot,expoMajor=_ref.expoMajor,_ref$templateVariant=_ref.templateVariant,templateVariant=_ref$templateVariant===void 0?'expo':_ref$templateVariant;var android=config.android;var moduleDir=path.join(androidDir,android.moduleName);_logging.Logger.logDebug(`Creating Android module in: ${androidDir}`);var hermesArtifact=(0,_hermes.getHermesArtifact)(rnVersion,projectRoot);var compileSdkVersionExpression=resolveCompileSdkVersionExpression(config);var targetSdkBlock=renderTargetSdkBlock(config,expoMajor,templateVariant);var minifyEnabled=(_minifyEnabled=android.minifyEnabled)!=null?_minifyEnabled:false;var extraProguardRules=(_extraProguardRules=android.extraProguardRules)!=null?_extraProguardRules:[];var extraProguardRulesText=extraProguardRules.join('\n');_logging.Logger.logDebug(`Resolved Hermes artifact: ${hermesArtifact.groupId}:${hermesArtifact.artifactId}:${hermesArtifact.version}`);var missingDimensionStrategiesList=(0,_formatHelpers.formatMissingDimensionStrategies)(android.missingDimensionStrategies);var missingDimensionStrategyBlock=renderMissingDimensionStrategyBlock(android.missingDimensionStrategies);var files=[{relativePath:'build.gradle.kts',content:(0,_engine.renderTemplate)('android','build.gradle.kts',{'{{PACKAGE_NAME}}':android.packageName,'{{MIN_SDK_VERSION}}':android.minSdkVersion.toString(),'{{TARGET_SDK_BLOCK}}':targetSdkBlock,'{{COMPILE_SDK_VERSION}}':compileSdkVersionExpression,'{{GROUP_ID}}':android.groupId,'{{ARTIFACT_ID}}':android.artifactId,'{{ARTIFACT_VERSION}}':android.version,'{{RN_VERSION}}':rnVersion,'{{HERMES_ARTIFACT}}':`${hermesArtifact.groupId}:${hermesArtifact.artifactId}:${hermesArtifact.version}`,'{{IS_MINIFY_ENABLED}}':minifyEnabled.toString(),'{{MISSING_DIMENSION_STRATEGIES}}':missingDimensionStrategiesList,'{{MISSING_DIMENSION_STRATEGY_BLOCK}}':missingDimensionStrategyBlock})},{relativePath:'gradle.properties',content:(0,_engine.renderTemplate)('android','gradle.properties',{})},{relativePath:`src/main/java/${config.android.packageName.replace(/\./g,'/')}/ReactNativeHostManager.kt`,content:(0,_engine.renderTemplate)('android',templateVariant==='vanilla'?'ReactNativeHostManager.vanilla.kt':'ReactNativeHostManager.post55.kt',{'{{PACKAGE_NAME}}':android.packageName})},{relativePath:'consumer-rules.pro',content:(0,_engine.renderTemplate)('android','consumer-rules.pro',{})},{relativePath:'proguard-rules.pro',content:(0,_engine.renderTemplate)('android','proguard-rules.pro',{'{{PACKAGE_NAME}}':android.packageName,'{{EXTRA_PROGUARD_RULES}}':extraProguardRulesText})}];for(var file of files){var filePath=path.join(moduleDir,file.relativePath);var fileDir=path.dirname(filePath);if(!fs.existsSync(fileDir)){fs.mkdirSync(fileDir,{recursive:true});}fs.writeFileSync(filePath,file.content,'utf8');_logging.Logger.logDebug(`Created file: ${filePath}`);}syncAndroidModuleExpoUpdatesFromAppFiles({androidDir:androidDir,config:config});_logging.Logger.logDebug(`Android module "${android.moduleName}" created at ${moduleDir}`);}function syncAndroidModuleManifest(_ref2){var androidDir=_ref2.androidDir,config=_ref2.config,expoUpdatesMetaData=_ref2.expoUpdatesMetaData;writeAndroidModuleFile(path.join(androidDir,config.android.moduleName),'src/main/AndroidManifest.xml',(0,_engine.renderTemplate)('android','AndroidManifest.xml',{'{{APPLICATION_BLOCK}}':(0,_androidManifest.renderLibraryManifestApplication)(expoUpdatesMetaData)}));}function syncAndroidModuleStringResources(_ref3){var androidDir=_ref3.androidDir,config=_ref3.config,expoUpdatesStringResources=_ref3.expoUpdatesStringResources;writeAndroidModuleFile(path.join(androidDir,config.android.moduleName),'src/main/res/values/strings.xml',(0,_engine.renderTemplate)('android','strings.xml',{'{{STRING_RESOURCES}}':(0,_androidManifest.renderLibraryStringResources)(expoUpdatesStringResources)}));}function writeAndroidModuleFile(moduleDir,relativePath,content){var filePath=path.join(moduleDir,relativePath);var fileDir=path.dirname(filePath);if(!fs.existsSync(fileDir)){fs.mkdirSync(fileDir,{recursive:true});}fs.writeFileSync(filePath,content,'utf8');_logging.Logger.logDebug(`Created file: ${filePath}`);}function syncAndroidModuleExpoUpdatesFromAppFiles(_ref4){var androidDir=_ref4.androidDir,config=_ref4.config;var appModuleName='app';var expoUpdatesMetaData=(0,_expoUpdates.readExpoUpdatesApplicationMetaData)(androidDir,appModuleName);var expoUpdatesStringResources=(0,_expoUpdates.readExpoUpdatesStringResources)(androidDir,appModuleName,expoUpdatesMetaData);syncAndroidModuleManifest({androidDir:androidDir,config:config,expoUpdatesMetaData:expoUpdatesMetaData});syncAndroidModuleStringResources({androidDir:androidDir,config:config,expoUpdatesStringResources:expoUpdatesStringResources});}var withAndroidModuleFiles=exports.withAndroidModuleFiles=function withAndroidModuleFiles(config,props){return(0,_configPlugins.withDangerousMod)(config,['android',(function(){var _ref5=(0,_asyncToGenerator2.default)(function*(dangerousConfig){var androidDir=path.join(dangerousConfig.modRequest.projectRoot,'android');var rnVersion;try{var rnPkgPath=require.resolve('react-native/package.json',{paths:[dangerousConfig.modRequest.projectRoot]});var rnPkg=require(rnPkgPath);rnVersion=rnPkg.version;_logging.Logger.logDebug(`Resolved react-native version: ${rnVersion}`);}catch(_unused){throw new Error('Could not resolve react-native package version. Please ensure you have installed dependencies.');}createAndroidModule({androidDir:androidDir,config:props,rnVersion:rnVersion,projectRoot:dangerousConfig.modRequest.projectRoot,expoMajor:(0,_expoUtils.getExpoInfo)(dangerousConfig).expoMajor});return dangerousConfig;});return function(_x){return _ref5.apply(this,arguments);};}())]);};
|
|
2
2
|
//# sourceMappingURL=withAndroidModuleFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fs","_interopRequireWildcard","require","path","_configPlugins","_logging","_engine","_expoUtils","_androidManifest","_expoUpdates","_hermes","_formatHelpers","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR","exports","renderMissingDimensionStrategyBlock","missingDimensionStrategies","length","args","formatMissingDimensionStrategies","resolveCompileSdkVersionExpression","config","android","compileSdkVersion","toString","resolveTargetSdkVersionExpression","targetSdkVersion","renderTargetSdkBlock","expoMajor","undefined","createAndroidModule","_ref","_minifyEnabled","_extraProguardRules","androidDir","rnVersion","projectRoot","moduleDir","join","moduleName","Logger","logDebug","hermesArtifact","getHermesArtifact","compileSdkVersionExpression","targetSdkBlock","minifyEnabled","extraProguardRules","extraProguardRulesText","groupId","artifactId","version","missingDimensionStrategiesList","missingDimensionStrategyBlock","files","relativePath","content","renderTemplate","packageName","minSdkVersion","replace","file","filePath","fileDir","dirname","existsSync","mkdirSync","recursive","writeFileSync","syncAndroidModuleExpoUpdatesFromAppFiles","syncAndroidModuleManifest","_ref2","expoUpdatesMetaData","writeAndroidModuleFile","renderLibraryManifestApplication","syncAndroidModuleStringResources","_ref3","expoUpdatesStringResources","renderLibraryStringResources","_ref4","appModuleName","readExpoUpdatesApplicationMetaData","readExpoUpdatesStringResources","withAndroidModuleFiles","props","withDangerousMod","_ref5","_asyncToGenerator2","dangerousConfig","modRequest","rnPkgPath","resolve","paths","rnPkg","_unused","Error","getExpoInfo","_x","apply"
|
|
1
|
+
{"version":3,"names":["fs","_interopRequireWildcard","require","path","_configPlugins","_logging","_engine","_expoUtils","_androidManifest","_expoUpdates","_hermes","_formatHelpers","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","EXPO_SDK_OMIT_TARGET_SDK_FROM_MAJOR","exports","renderMissingDimensionStrategyBlock","missingDimensionStrategies","length","args","formatMissingDimensionStrategies","resolveCompileSdkVersionExpression","config","android","compileSdkVersion","toString","resolveTargetSdkVersionExpression","targetSdkVersion","renderTargetSdkBlock","expoMajor","templateVariant","arguments","undefined","createAndroidModule","_ref","_minifyEnabled","_extraProguardRules","androidDir","rnVersion","projectRoot","_ref$templateVariant","moduleDir","join","moduleName","Logger","logDebug","hermesArtifact","getHermesArtifact","compileSdkVersionExpression","targetSdkBlock","minifyEnabled","extraProguardRules","extraProguardRulesText","groupId","artifactId","version","missingDimensionStrategiesList","missingDimensionStrategyBlock","files","relativePath","content","renderTemplate","packageName","minSdkVersion","replace","file","filePath","fileDir","dirname","existsSync","mkdirSync","recursive","writeFileSync","syncAndroidModuleExpoUpdatesFromAppFiles","syncAndroidModuleManifest","_ref2","expoUpdatesMetaData","writeAndroidModuleFile","renderLibraryManifestApplication","syncAndroidModuleStringResources","_ref3","expoUpdatesStringResources","renderLibraryStringResources","_ref4","appModuleName","readExpoUpdatesApplicationMetaData","readExpoUpdatesStringResources","withAndroidModuleFiles","props","withDangerousMod","_ref5","_asyncToGenerator2","dangerousConfig","modRequest","rnPkgPath","resolve","paths","rnPkg","_unused","Error","getExpoInfo","_x","apply"],"sourceRoot":"../../../../src","sources":["expo-config-plugin/android/withAndroidModuleFiles.ts"],"mappings":"myBAAA,IAAAA,EAAA,CAAAC,uBAAA,CAAAC,OAAA,aACA,IAAAC,IAAA,CAAAF,uBAAA,CAAAC,OAAA,eAEA,IAAAE,cAAA,CAAAF,OAAA,yBAMA,IAAAG,QAAA,CAAAH,OAAA,eACA,IAAAI,OAAA,CAAAJ,OAAA,uBACA,IAAAK,UAAA,CAAAL,OAAA,iBACA,IAAAM,gBAAA,CAAAN,OAAA,4BAMA,IAAAO,YAAA,CAAAP,OAAA,yBAIA,IAAAQ,OAAA,CAAAR,OAAA,mBACA,IAAAS,cAAA,CAAAT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AAO,CAAA+D,eAAe,CACxB,CAAC,kBAAAS,EAAA,SAAAX,KAAA,CAAAY,KAAA,MAAAvE,SAAA,SACF,CAAC,CACJ,CAAC","ignoreList":[]}
|
|
@@ -14,5 +14,5 @@ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
${BROWNFIELD_EXPO_GTE_55_SWIFT_DEFINES_MARKER_END}
|
|
17
|
-
`;var postInstallMatch=podfile.match(/(post_install\s+do\s+\|installer\|\s*\n)((?:(?!^\s*end\s*$)[\s\S])*)(^\s*end\s*$)/m);if(postInstallMatch){var _postInstallMatch=(0,_slicedToArray2.default)(postInstallMatch,4),whole=_postInstallMatch[0],start=_postInstallMatch[1],content=_postInstallMatch[2],end=_postInstallMatch[3];var updated=`${start}${content.trimEnd()}\n${hook}\n${end}`;return podfile.replace(whole,updated);}return`${podfile.trimEnd()}\n\npost_install do |installer|\n${hook}\nend\n`;}function modifyPodfile(podfile,frameworkName,expoMajor){if(podfile.includes(`target '${frameworkName}'`)){_logging.Logger.logDebug(`Framework target "${frameworkName}" already in Podfile, skipping modification`);return podfile;}_logging.Logger.logDebug(`Modifying Podfile for framework: ${frameworkName}`);var frameworkTargetBlock=(0,_engine.renderTemplate)('ios','PodfileTargetBlock.rb',{'{{FRAMEWORK_NAME}}':frameworkName});var mainTargetMatch=podfile.match(/(target\s+['"][^'"]+['"]\s+do\s*\n)([\s\S]*?)(^end\s*$)/m);if(!mainTargetMatch){throw new _SourceModificationError.SourceModificationError('Could not find main target in Podfile. Please manually add the framework target.');}var _mainTargetMatch=(0,_slicedToArray2.default)(mainTargetMatch,3),targetStart=_mainTargetMatch[1],targetContent=_mainTargetMatch[2];var insertIndex=podfile.indexOf(mainTargetMatch[0])+targetStart.length+targetContent.length;var modifiedPodfile=podfile.slice(0,insertIndex)+frameworkTargetBlock+podfile.slice(insertIndex);_logging.Logger.logDebug(`Added framework target "${frameworkName}" to Podfile`);if(expoMajor<MIN_SUPPORTED_EXPO_SDK_MAJOR_VERSION){var versionLabel=expoMajor<0?'unknown':expoMajor
|
|
17
|
+
`;var postInstallMatch=podfile.match(/(post_install\s+do\s+\|installer\|\s*\n)((?:(?!^\s*end\s*$)[\s\S])*)(^\s*end\s*$)/m);if(postInstallMatch){var _postInstallMatch=(0,_slicedToArray2.default)(postInstallMatch,4),whole=_postInstallMatch[0],start=_postInstallMatch[1],content=_postInstallMatch[2],end=_postInstallMatch[3];var updated=`${start}${content.trimEnd()}\n${hook}\n${end}`;return podfile.replace(whole,updated);}return`${podfile.trimEnd()}\n\npost_install do |installer|\n${hook}\nend\n`;}function modifyPodfile(podfile,frameworkName,expoMajor){if(podfile.includes(`target '${frameworkName}'`)){_logging.Logger.logDebug(`Framework target "${frameworkName}" already in Podfile, skipping modification`);return podfile;}_logging.Logger.logDebug(`Modifying Podfile for framework: ${frameworkName}`);var frameworkTargetBlock=(0,_engine.renderTemplate)('ios',typeof expoMajor==='number'?'PodfileTargetBlock.rb':'PodfileTargetBlock.vanilla.rb',{'{{FRAMEWORK_NAME}}':frameworkName});var mainTargetMatch=podfile.match(/(target\s+['"][^'"]+['"]\s+do\s*\n)([\s\S]*?)(^end\s*$)/m);if(!mainTargetMatch){throw new _SourceModificationError.SourceModificationError('Could not find main target in Podfile. Please manually add the framework target.');}var _mainTargetMatch=(0,_slicedToArray2.default)(mainTargetMatch,3),targetStart=_mainTargetMatch[1],targetContent=_mainTargetMatch[2];var insertIndex=podfile.indexOf(mainTargetMatch[0])+targetStart.length+targetContent.length;var modifiedPodfile=podfile.slice(0,insertIndex)+frameworkTargetBlock+podfile.slice(insertIndex);_logging.Logger.logDebug(`Added framework target "${frameworkName}" to Podfile`);if(typeof expoMajor!=='number'){return modifiedPodfile;}if(expoMajor<MIN_SUPPORTED_EXPO_SDK_MAJOR_VERSION){var versionLabel=expoMajor<0?'unknown':String(expoMajor);throw new _SourceModificationError.SourceModificationError(`Expo SDK ${versionLabel} is not supported. Please use Expo SDK ${MIN_SUPPORTED_EXPO_SDK_MAJOR_VERSION} or newer. For older versions, please see the matrix of supported versions: https://oss.callstack.com/react-native-brownfield/docs/getting-started/introduction#expo-version-compatibility`);}modifiedPodfile=ensureExpoDefinesForSDK55AndAbove(modifiedPodfile,expoMajor);return modifiedPodfile;}
|
|
18
18
|
//# sourceMappingURL=podfileHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_SourceModificationError","require","_logging","_engine","MIN_SUPPORTED_EXPO_SDK_MAJOR_VERSION","BROWNFIELD_EXPO_GTE_55_SWIFT_DEFINES_MARKER_START","BROWNFIELD_EXPO_GTE_55_SWIFT_DEFINES_MARKER_END","ensureExpoDefinesForSDK55AndAbove","podfile","expoMajor","includes","defaultDeploymentTarget","hook","postInstallMatch","match","_postInstallMatch","_slicedToArray2","default","whole","start","content","end","updated","trimEnd","replace","modifyPodfile","frameworkName","Logger","logDebug","frameworkTargetBlock","renderTemplate","mainTargetMatch","SourceModificationError","_mainTargetMatch","targetStart","targetContent","insertIndex","indexOf","length","modifiedPodfile","slice","versionLabel","
|
|
1
|
+
{"version":3,"names":["_SourceModificationError","require","_logging","_engine","MIN_SUPPORTED_EXPO_SDK_MAJOR_VERSION","BROWNFIELD_EXPO_GTE_55_SWIFT_DEFINES_MARKER_START","BROWNFIELD_EXPO_GTE_55_SWIFT_DEFINES_MARKER_END","ensureExpoDefinesForSDK55AndAbove","podfile","expoMajor","includes","defaultDeploymentTarget","hook","postInstallMatch","match","_postInstallMatch","_slicedToArray2","default","whole","start","content","end","updated","trimEnd","replace","modifyPodfile","frameworkName","Logger","logDebug","frameworkTargetBlock","renderTemplate","mainTargetMatch","SourceModificationError","_mainTargetMatch","targetStart","targetContent","insertIndex","indexOf","length","modifiedPodfile","slice","versionLabel","String"],"sourceRoot":"../../../../src","sources":["expo-config-plugin/ios/podfileHelpers.ts"],"mappings":"4QAAA,IAAAA,wBAAA,CAAAC,OAAA,sCACA,IAAAC,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,gDAAuB,CAC/B,YAAYS,YAAY,0CAA0CrC,oCAAoC,4LACxG,CAAC,CACH,CAEAmC,eAAe,CAAGhC,iCAAiC,CACjDgC,eAAe,CACf9B,SACF,CAAC,CAED,MAAO,CAAA8B,eAAe,CACxB","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.withBrownfieldIos=void 0;var _configPlugins=require("@expo/config-plugins");var _xcodeHelpers=require("./xcodeHelpers");var _podfileHelpers=require("./podfileHelpers");var _withFmtFix=require("./withFmtFix");var _expoUpdates=require("./utils/expo-updates");var _withIosFrameworkFiles=require("./withIosFrameworkFiles");var _logging=require("../logging");var _expoUtils=require("../expoUtils");var withBrownfieldIos=exports.withBrownfieldIos=function withBrownfieldIos(config,props){var _getExpoInfo=(0,_expoUtils.getExpoInfo)(config),expoMajor=_getExpoInfo.expoMajor;config=(0,_configPlugins.withXcodeProject)(config,function(xcodeConfig){var project=xcodeConfig.modResults,modRequest=xcodeConfig.modRequest;var hasExpoUpdates=(0,_expoUtils.hasExpoUpdatesInstalled)(modRequest.projectRoot);var iosProps=Object.assign({},props.ios,{deploymentTarget:(0,_xcodeHelpers.resolveFrameworkDeploymentTarget)(project,modRequest,{fallbackDeploymentTarget:props.ios.deploymentTarget})});var _addFrameworkTarget=(0,_xcodeHelpers.addFrameworkTarget)(project,modRequest,iosProps),frameworkTargetUUID=_addFrameworkTarget.frameworkTargetUUID,targetAlreadyExists=_addFrameworkTarget.targetAlreadyExists;if(hasExpoUpdates){(0,_expoUpdates.ensureFrameworkHasExpoPlistResource)(project,frameworkTargetUUID);}else{_logging.Logger.logDebug('Skipping Expo.plist framework resource wiring because expo-updates is not installed');}if(targetAlreadyExists){_logging.Logger.logDebug(`Framework target already present, syncing Brownfield build phases`);(0,_xcodeHelpers.copyBundleReactNativePhase)(project,frameworkTargetUUID);return xcodeConfig;}(0,_xcodeHelpers.copyBundleReactNativePhase)(project,frameworkTargetUUID);(0,_xcodeHelpers.addSourceFilesBuildPhase)(project,frameworkTargetUUID,iosProps);return xcodeConfig;});config=(0,_configPlugins.withPodfile)(config,function(podfileConfig){var frameworkName=props.ios.frameworkName;var modifiedPodfile=(0,_podfileHelpers.modifyPodfile)(podfileConfig.modResults.contents,frameworkName,expoMajor);podfileConfig.modResults.contents=(0,_withFmtFix.injectFmtFixIntoPodfile)(modifiedPodfile);return podfileConfig;});config=(0,_withIosFrameworkFiles.withIosFrameworkFiles)(config,props);return config;};
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.withBrownfieldIos=void 0;var _configPlugins=require("@expo/config-plugins");var _xcodeHelpers=require("./xcodeHelpers");var _podfileHelpers=require("./podfileHelpers");var _withFmtFix=require("./withFmtFix");var _expoUpdates=require("./utils/expo-updates");var _withIosFrameworkFiles=require("./withIosFrameworkFiles");var _logging=require("../logging");var _expoUtils=require("../expoUtils");var withBrownfieldIos=exports.withBrownfieldIos=function withBrownfieldIos(config,props){var _getExpoInfo=(0,_expoUtils.getExpoInfo)(config),expoMajor=_getExpoInfo.expoMajor;config=(0,_configPlugins.withXcodeProject)(config,function(xcodeConfig){var project=xcodeConfig.modResults,modRequest=xcodeConfig.modRequest;var hasExpoUpdates=(0,_expoUtils.hasExpoUpdatesInstalled)(modRequest.projectRoot);var iosProps=Object.assign({},props.ios,{deploymentTarget:(0,_xcodeHelpers.resolveFrameworkDeploymentTarget)(project,modRequest,{fallbackDeploymentTarget:props.ios.deploymentTarget})});var _addFrameworkTarget=(0,_xcodeHelpers.addFrameworkTarget)(project,modRequest,iosProps,{useExpoHost:true}),frameworkTargetUUID=_addFrameworkTarget.frameworkTargetUUID,targetAlreadyExists=_addFrameworkTarget.targetAlreadyExists;if(hasExpoUpdates){(0,_expoUpdates.ensureFrameworkHasExpoPlistResource)(project,frameworkTargetUUID);}else{_logging.Logger.logDebug('Skipping Expo.plist framework resource wiring because expo-updates is not installed');}if(targetAlreadyExists){_logging.Logger.logDebug(`Framework target already present, syncing Brownfield build phases`);(0,_xcodeHelpers.copyBundleReactNativePhase)(project,frameworkTargetUUID);return xcodeConfig;}(0,_xcodeHelpers.copyBundleReactNativePhase)(project,frameworkTargetUUID);(0,_xcodeHelpers.addSourceFilesBuildPhase)(project,frameworkTargetUUID,iosProps,{useExpoHost:true});return xcodeConfig;});config=(0,_configPlugins.withPodfile)(config,function(podfileConfig){var frameworkName=props.ios.frameworkName;var modifiedPodfile=(0,_podfileHelpers.modifyPodfile)(podfileConfig.modResults.contents,frameworkName,expoMajor);podfileConfig.modResults.contents=(0,_withFmtFix.injectFmtFixIntoPodfile)(modifiedPodfile);return podfileConfig;});config=(0,_withIosFrameworkFiles.withIosFrameworkFiles)(config,props);return config;};
|
|
2
2
|
//# sourceMappingURL=withBrownfieldIos.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","_xcodeHelpers","_podfileHelpers","_withFmtFix","_expoUpdates","_withIosFrameworkFiles","_logging","_expoUtils","withBrownfieldIos","exports","config","props","_getExpoInfo","getExpoInfo","expoMajor","withXcodeProject","xcodeConfig","project","modResults","modRequest","hasExpoUpdates","hasExpoUpdatesInstalled","projectRoot","iosProps","Object","assign","ios","deploymentTarget","resolveFrameworkDeploymentTarget","fallbackDeploymentTarget","_addFrameworkTarget","addFrameworkTarget","frameworkTargetUUID","targetAlreadyExists","ensureFrameworkHasExpoPlistResource","Logger","logDebug","copyBundleReactNativePhase","addSourceFilesBuildPhase","withPodfile","podfileConfig","frameworkName","modifiedPodfile","modifyPodfile","contents","injectFmtFixIntoPodfile","withIosFrameworkFiles"],"sourceRoot":"../../../../src","sources":["expo-config-plugin/ios/withBrownfieldIos.ts"],"mappings":"0FAAA,IAAAA,cAAA,CAAAC,OAAA,yBAMA,IAAAC,aAAA,CAAAD,OAAA,mBAMA,IAAAE,eAAA,CAAAF,OAAA,qBACA,IAAAG,WAAA,CAAAH,OAAA,iBACA,IAAAI,YAAA,CAAAJ,OAAA,yBACA,IAAAK,sBAAA,CAAAL,OAAA,4BAEA,IAAAM,QAAA,CAAAN,OAAA,eACA,IAAAO,UAAA,CAAAP,OAAA,iBAYO,GAAM,CAAAQ,iBAEZ,CAAAC,OAAA,CAAAD,iBAAA,CAAG,QAFS,CAAAA,iBAEZA,CAAIE,MAAM,CAAEC,KAAK,CAAK,CACrB,IAAAC,YAAA,CAAsB,GAAAC,sBAAW,EAACH,MAAM,CAAC,CAAjCI,SAAS,CAAAF,YAAA,CAATE,SAAS,CAGjBJ,MAAM,CAAG,GAAAK,+BAAgB,EAACL,MAAM,CAAE,SAACM,WAAW,CAAK,CACjD,GAAoB,CAAAC,OAAO,CAAiBD,WAAW,CAA/CE,UAAU,CAAWC,UAAU,CAAKH,WAAW,CAA1BG,UAAU,CACvC,GAAM,CAAAC,cAAc,CAAG,GAAAC,kCAAuB,EAACF,UAAU,CAACG,WAAW,CAAC,CACtE,GAAM,CAAAC,QAAQ,CAAAC,MAAA,CAAAC,MAAA,IACTd,KAAK,CAACe,GAAG,EACZC,gBAAgB,CAAE,GAAAC,8CAAgC,EAACX,OAAO,CAAEE,UAAU,CAAE,CACtEU,wBAAwB,CAAElB,KAAK,CAACe,GAAG,CAACC,gBACtC,CAAC,CAAC,EACH,CAED,IAAAG,mBAAA,CAAqD,GAAAC,gCAAkB,EACrEd,OAAO,CACPE,UAAU,CACVI,
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_xcodeHelpers","_podfileHelpers","_withFmtFix","_expoUpdates","_withIosFrameworkFiles","_logging","_expoUtils","withBrownfieldIos","exports","config","props","_getExpoInfo","getExpoInfo","expoMajor","withXcodeProject","xcodeConfig","project","modResults","modRequest","hasExpoUpdates","hasExpoUpdatesInstalled","projectRoot","iosProps","Object","assign","ios","deploymentTarget","resolveFrameworkDeploymentTarget","fallbackDeploymentTarget","_addFrameworkTarget","addFrameworkTarget","useExpoHost","frameworkTargetUUID","targetAlreadyExists","ensureFrameworkHasExpoPlistResource","Logger","logDebug","copyBundleReactNativePhase","addSourceFilesBuildPhase","withPodfile","podfileConfig","frameworkName","modifiedPodfile","modifyPodfile","contents","injectFmtFixIntoPodfile","withIosFrameworkFiles"],"sourceRoot":"../../../../src","sources":["expo-config-plugin/ios/withBrownfieldIos.ts"],"mappings":"0FAAA,IAAAA,cAAA,CAAAC,OAAA,yBAMA,IAAAC,aAAA,CAAAD,OAAA,mBAMA,IAAAE,eAAA,CAAAF,OAAA,qBACA,IAAAG,WAAA,CAAAH,OAAA,iBACA,IAAAI,YAAA,CAAAJ,OAAA,yBACA,IAAAK,sBAAA,CAAAL,OAAA,4BAEA,IAAAM,QAAA,CAAAN,OAAA,eACA,IAAAO,UAAA,CAAAP,OAAA,iBAYO,GAAM,CAAAQ,iBAEZ,CAAAC,OAAA,CAAAD,iBAAA,CAAG,QAFS,CAAAA,iBAEZA,CAAIE,MAAM,CAAEC,KAAK,CAAK,CACrB,IAAAC,YAAA,CAAsB,GAAAC,sBAAW,EAACH,MAAM,CAAC,CAAjCI,SAAS,CAAAF,YAAA,CAATE,SAAS,CAGjBJ,MAAM,CAAG,GAAAK,+BAAgB,EAACL,MAAM,CAAE,SAACM,WAAW,CAAK,CACjD,GAAoB,CAAAC,OAAO,CAAiBD,WAAW,CAA/CE,UAAU,CAAWC,UAAU,CAAKH,WAAW,CAA1BG,UAAU,CACvC,GAAM,CAAAC,cAAc,CAAG,GAAAC,kCAAuB,EAACF,UAAU,CAACG,WAAW,CAAC,CACtE,GAAM,CAAAC,QAAQ,CAAAC,MAAA,CAAAC,MAAA,IACTd,KAAK,CAACe,GAAG,EACZC,gBAAgB,CAAE,GAAAC,8CAAgC,EAACX,OAAO,CAAEE,UAAU,CAAE,CACtEU,wBAAwB,CAAElB,KAAK,CAACe,GAAG,CAACC,gBACtC,CAAC,CAAC,EACH,CAED,IAAAG,mBAAA,CAAqD,GAAAC,gCAAkB,EACrEd,OAAO,CACPE,UAAU,CACVI,QAAQ,CACR,CAAES,WAAW,CAAE,IAAK,CACtB,CAAC,CALOC,mBAAmB,CAAAH,mBAAA,CAAnBG,mBAAmB,CAAEC,mBAAmB,CAAAJ,mBAAA,CAAnBI,mBAAmB,CAShD,GAAId,cAAc,CAAE,CAClB,GAAAe,gDAAmC,EAAClB,OAAO,CAAEgB,mBAAmB,CAAC,CACnE,CAAC,IAAM,CACLG,eAAM,CAACC,QAAQ,CACb,qFACF,CAAC,CACH,CAEA,GAAIH,mBAAmB,CAAE,CACvBE,eAAM,CAACC,QAAQ,CACb,mEACF,CAAC,CAED,GAAAC,wCAA0B,EAACrB,OAAO,CAAEgB,mBAAmB,CAAC,CAExD,MAAO,CAAAjB,WAAW,CACpB,CAGA,GAAAsB,wCAA0B,EAACrB,OAAO,CAAEgB,mBAAmB,CAAC,CAExD,GAAAM,sCAAwB,EAACtB,OAAO,CAAEgB,mBAAmB,CAAEV,QAAQ,CAAE,CAC/DS,WAAW,CAAE,IACf,CAAC,CAAC,CAEF,MAAO,CAAAhB,WAAW,CACpB,CAAC,CAAC,CAGFN,MAAM,CAAG,GAAA8B,0BAAW,EAAC9B,MAAM,CAAE,SAAC+B,aAAa,CAAK,CAC9C,GAAQ,CAAAC,aAAa,CAAK/B,KAAK,CAACe,GAAG,CAA3BgB,aAAa,CAErB,GAAM,CAAAC,eAAe,CAAG,GAAAC,6BAAa,EACnCH,aAAa,CAACvB,UAAU,CAAC2B,QAAQ,CACjCH,aAAa,CACb5B,SACF,CAAC,CACD2B,aAAa,CAACvB,UAAU,CAAC2B,QAAQ,CAC/B,GAAAC,mCAAuB,EAACH,eAAe,CAAC,CAE1C,MAAO,CAAAF,aAAa,CACtB,CAAC,CAAC,CAGF/B,MAAM,CAAG,GAAAqC,4CAAqB,EAACrC,MAAM,CAAEC,KAAK,CAAC,CAE7C,MAAO,CAAAD,MAAM,CACf,CAAC","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.createIosFramework=createIosFramework;exports.getFrameworkSourceFiles=getFrameworkSourceFiles;exports.withIosFrameworkFiles=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var fs=_interopRequireWildcard(require("node:fs"));var path=_interopRequireWildcard(require("node:path"));var _configPlugins=require("@expo/config-plugins");var _logging=require("../logging");var _engine=require("../template/engine");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t in e)"default"!==_t&&{}.hasOwnProperty.call(e,_t)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t))&&(i.get||i.set)?o(f,_t,i):f[_t]=e[_t]);return f;})(e,t);}function getFrameworkSourceFiles(ios){return[{relativePath:`${ios.frameworkName}.swift`,content:(0,_engine.renderTemplate)('ios','FrameworkInterface.swift',{'{{BUNDLE_IDENTIFIER}}':ios.bundleIdentifier})},{relativePath:'Info.plist',content:(0,_engine.renderTemplate)('ios','Info.plist',{'{{BUNDLE_IDENTIFIER}}':ios.bundleIdentifier})}];}function createIosFramework(iosDir,config){var ios=config.ios;var frameworkDir=path.join(iosDir,ios.frameworkName);var frameworkDirExists=fs.existsSync(frameworkDir);_logging.Logger.logDebug(frameworkDirExists?`Updating iOS framework files in: ${frameworkDir}`:`Creating iOS framework in: ${frameworkDir}`);if(!frameworkDirExists){fs.mkdirSync(frameworkDir,{recursive:true});_logging.Logger.logDebug(`Created directory: ${frameworkDir}`);}for(var file of getFrameworkSourceFiles(ios)){var filePath=path.join(frameworkDir,file.relativePath);fs.writeFileSync(filePath,file.content,'utf8');}_logging.Logger.logDebug(`iOS framework "${ios.frameworkName}" files created at ${frameworkDir}`);}var withIosFrameworkFiles=exports.withIosFrameworkFiles=function withIosFrameworkFiles(config,props){return(0,_configPlugins.withDangerousMod)(config,['ios',(function(){var _ref=(0,_asyncToGenerator2.default)(function*(dangerousConfig){var iosDir=path.join(dangerousConfig.modRequest.projectRoot,'ios');createIosFramework(iosDir,props);return dangerousConfig;});return function(_x){return _ref.apply(this,arguments);};}())]);};
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.createIosFramework=createIosFramework;exports.getFrameworkSourceFiles=getFrameworkSourceFiles;exports.withIosFrameworkFiles=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var fs=_interopRequireWildcard(require("node:fs"));var path=_interopRequireWildcard(require("node:path"));var _configPlugins=require("@expo/config-plugins");var _logging=require("../logging");var _engine=require("../template/engine");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t in e)"default"!==_t&&{}.hasOwnProperty.call(e,_t)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t))&&(i.get||i.set)?o(f,_t,i):f[_t]=e[_t]);return f;})(e,t);}function getFrameworkSourceFiles(ios,options){var _options$useExpoHost;var useExpoHost=(_options$useExpoHost=options==null?void 0:options.useExpoHost)!=null?_options$useExpoHost:true;return[{relativePath:`${ios.frameworkName}.swift`,content:useExpoHost?(0,_engine.renderTemplate)('ios','FrameworkInterface.swift',{'{{BUNDLE_IDENTIFIER}}':ios.bundleIdentifier}):(0,_engine.renderTemplate)('ios','FrameworkInterface.vanilla.swift',{})},{relativePath:'Info.plist',content:(0,_engine.renderTemplate)('ios','Info.plist',{'{{BUNDLE_IDENTIFIER}}':ios.bundleIdentifier})}];}function createIosFramework(iosDir,config,options){var ios=config.ios;var frameworkDir=path.join(iosDir,ios.frameworkName);var frameworkDirExists=fs.existsSync(frameworkDir);_logging.Logger.logDebug(frameworkDirExists?`Updating iOS framework files in: ${frameworkDir}`:`Creating iOS framework in: ${frameworkDir}`);if(!frameworkDirExists){fs.mkdirSync(frameworkDir,{recursive:true});_logging.Logger.logDebug(`Created directory: ${frameworkDir}`);}for(var file of getFrameworkSourceFiles(ios,options)){var filePath=path.join(frameworkDir,file.relativePath);fs.writeFileSync(filePath,file.content,'utf8');}_logging.Logger.logDebug(`iOS framework "${ios.frameworkName}" files created at ${frameworkDir}`);}var withIosFrameworkFiles=exports.withIosFrameworkFiles=function withIosFrameworkFiles(config,props){return(0,_configPlugins.withDangerousMod)(config,['ios',(function(){var _ref=(0,_asyncToGenerator2.default)(function*(dangerousConfig){var iosDir=path.join(dangerousConfig.modRequest.projectRoot,'ios');createIosFramework(iosDir,props);return dangerousConfig;});return function(_x){return _ref.apply(this,arguments);};}())]);};
|
|
2
2
|
//# sourceMappingURL=withIosFrameworkFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fs","_interopRequireWildcard","require","path","_configPlugins","_logging","_engine","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getFrameworkSourceFiles","ios","relativePath","frameworkName","content","renderTemplate","bundleIdentifier","createIosFramework","iosDir","config","frameworkDir","join","frameworkDirExists","existsSync","Logger","logDebug","mkdirSync","recursive","file","filePath","writeFileSync","withIosFrameworkFiles","exports","props","withDangerousMod","_ref","_asyncToGenerator2","dangerousConfig","modRequest","projectRoot","_x","apply","arguments"],"sourceRoot":"../../../../src","sources":["expo-config-plugin/ios/withIosFrameworkFiles.ts"],"mappings":"yXAAA,IAAAA,EAAA,CAAAC,uBAAA,CAAAC,OAAA,aACA,IAAAC,IAAA,CAAAF,uBAAA,CAAAC,OAAA,eAEA,IAAAE,cAAA,CAAAF,OAAA,yBAMA,IAAAG,QAAA,CAAAH,OAAA,eACA,IAAAI,OAAA,CAAAJ,OAAA,uBAAoD,SAAAD,wBAAAM,CAAA,CAAAC,CAAA,wBAAAC,OAAA,KAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAR,uBAAA,UAAAA,wBAAAM,CAAA,CAAAC,CAAA,MAAAA,CAAA,EAAAD,CAAA,EAAAA,CAAA,CAAAK,UAAA,QAAAL,CAAA,KAAAM,CAAA,CAAAC,CAAA,CAAAC,CAAA,EAAAC,SAAA,MAAAC,OAAA,CAAAV,CAAA,YAAAA,CAAA,mBAAAA,CAAA,qBAAAA,CAAA,QAAAQ,CAAA,IAAAF,CAAA,CAAAL,CAAA,CAAAG,CAAA,CAAAD,CAAA,KAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,SAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,CAAAM,CAAA,EAAAO,GAAA,CAAAb,CAAA,CAAAQ,CAAA,WAAAM,EAAA,IAAAd,CAAA,aAAAc,EAAA,KAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,CAAAc,EAAA,KAAAP,CAAA,EAAAD,CAAA,CAAAW,MAAA,CAAAC,cAAA,GAAAD,MAAA,CAAAE,wBAAA,CAAAnB,CAAA,CAAAc,EAAA,KAAAP,CAAA,CAAAK,GAAA,EAAAL,CAAA,CAAAM,GAAA,EAAAP,CAAA,CAAAE,CAAA,CAAAM,EAAA,CAAAP,CAAA,EAAAC,CAAA,CAAAM,EAAA,EAAAd,CAAA,CAAAc,EAAA,UAAAN,CAAA,IAAAR,CAAA,CAAAC,CAAA,GAO7C,QAAS,CAAAmB,uBAAuBA,CACrCC,GAAiD,
|
|
1
|
+
{"version":3,"names":["fs","_interopRequireWildcard","require","path","_configPlugins","_logging","_engine","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getFrameworkSourceFiles","ios","options","_options$useExpoHost","useExpoHost","relativePath","frameworkName","content","renderTemplate","bundleIdentifier","createIosFramework","iosDir","config","frameworkDir","join","frameworkDirExists","existsSync","Logger","logDebug","mkdirSync","recursive","file","filePath","writeFileSync","withIosFrameworkFiles","exports","props","withDangerousMod","_ref","_asyncToGenerator2","dangerousConfig","modRequest","projectRoot","_x","apply","arguments"],"sourceRoot":"../../../../src","sources":["expo-config-plugin/ios/withIosFrameworkFiles.ts"],"mappings":"yXAAA,IAAAA,EAAA,CAAAC,uBAAA,CAAAC,OAAA,aACA,IAAAC,IAAA,CAAAF,uBAAA,CAAAC,OAAA,eAEA,IAAAE,cAAA,CAAAF,OAAA,yBAMA,IAAAG,QAAA,CAAAH,OAAA,eACA,IAAAI,OAAA,CAAAJ,OAAA,uBAAoD,SAAAD,wBAAAM,CAAA,CAAAC,CAAA,wBAAAC,OAAA,KAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAR,uBAAA,UAAAA,wBAAAM,CAAA,CAAAC,CAAA,MAAAA,CAAA,EAAAD,CAAA,EAAAA,CAAA,CAAAK,UAAA,QAAAL,CAAA,KAAAM,CAAA,CAAAC,CAAA,CAAAC,CAAA,EAAAC,SAAA,MAAAC,OAAA,CAAAV,CAAA,YAAAA,CAAA,mBAAAA,CAAA,qBAAAA,CAAA,QAAAQ,CAAA,IAAAF,CAAA,CAAAL,CAAA,CAAAG,CAAA,CAAAD,CAAA,KAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,SAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,CAAAM,CAAA,EAAAO,GAAA,CAAAb,CAAA,CAAAQ,CAAA,WAAAM,EAAA,IAAAd,CAAA,aAAAc,EAAA,KAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,CAAAc,EAAA,KAAAP,CAAA,EAAAD,CAAA,CAAAW,MAAA,CAAAC,cAAA,GAAA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