@callstack/react-native-brownfield 3.1.0-rc.2 → 3.3.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 +44 -0
- package/ios/ExpoHostRuntime.swift +22 -7
- package/lib/commonjs/expo-config-plugin/android/index.js +1 -1
- package/lib/commonjs/expo-config-plugin/android/utils/constants.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/android/utils/gradleHelpers.js +2 -0
- package/lib/commonjs/expo-config-plugin/android/utils/gradleHelpers.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/android/utils/hermes.js +2 -0
- package/lib/commonjs/expo-config-plugin/android/utils/hermes.js.map +1 -0
- 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/android/withBrownfieldAndroid.js +1 -1
- package/lib/commonjs/expo-config-plugin/android/withBrownfieldAndroid.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/expoUtils.js +2 -0
- package/lib/commonjs/expo-config-plugin/expoUtils.js.map +1 -0
- package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js +16 -2
- 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/template/android/ReactNativeHostManager.post55.kt +32 -0
- package/lib/commonjs/expo-config-plugin/template/android/build.gradle.kts +1 -1
- package/lib/module/expo-config-plugin/android/index.js +1 -1
- package/lib/module/expo-config-plugin/android/utils/constants.js.map +1 -0
- package/lib/module/expo-config-plugin/android/utils/gradleHelpers.js +2 -0
- package/lib/module/expo-config-plugin/android/utils/gradleHelpers.js.map +1 -0
- package/lib/module/expo-config-plugin/android/utils/hermes.js +2 -0
- package/lib/module/expo-config-plugin/android/utils/hermes.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/android/withBrownfieldAndroid.js +1 -1
- package/lib/module/expo-config-plugin/android/withBrownfieldAndroid.js.map +1 -1
- package/lib/module/expo-config-plugin/expoUtils.js +2 -0
- package/lib/module/expo-config-plugin/expoUtils.js.map +1 -0
- package/lib/module/expo-config-plugin/ios/podfileHelpers.js +16 -2
- 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/template/android/ReactNativeHostManager.post55.kt +32 -0
- package/lib/module/expo-config-plugin/template/android/build.gradle.kts +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/android/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/android/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/gradleHelpers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/hermes.d.ts +6 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/utils/hermes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +5 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/expoUtils.d.ts +6 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/expoUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts +2 -1
- 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/module/src/expo-config-plugin/android/index.d.ts +1 -1
- package/lib/typescript/module/src/expo-config-plugin/android/index.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/android/utils/constants.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/android/utils/gradleHelpers.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/android/utils/hermes.d.ts +6 -0
- package/lib/typescript/module/src/expo-config-plugin/android/utils/hermes.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts +5 -1
- package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/expoUtils.d.ts +6 -0
- package/lib/typescript/module/src/expo-config-plugin/expoUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts +2 -1
- 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/package.json +7 -4
- package/src/expo-config-plugin/android/index.ts +4 -1
- package/src/expo-config-plugin/android/{gradleHelpers.ts → utils/gradleHelpers.ts} +1 -1
- package/src/expo-config-plugin/android/utils/hermes.ts +83 -0
- package/src/expo-config-plugin/android/withAndroidModuleFiles.ts +26 -3
- package/src/expo-config-plugin/android/withBrownfieldAndroid.ts +4 -1
- package/src/expo-config-plugin/expoUtils.ts +12 -0
- package/src/expo-config-plugin/ios/podfileHelpers.ts +45 -2
- package/src/expo-config-plugin/ios/withBrownfieldIos.ts +4 -5
- package/src/expo-config-plugin/template/android/ReactNativeHostManager.post55.kt +32 -0
- package/src/expo-config-plugin/template/android/build.gradle.kts +1 -1
- package/lib/commonjs/expo-config-plugin/android/constants.js.map +0 -1
- package/lib/commonjs/expo-config-plugin/android/gradleHelpers.js +0 -2
- package/lib/commonjs/expo-config-plugin/android/gradleHelpers.js.map +0 -1
- package/lib/module/expo-config-plugin/android/constants.js.map +0 -1
- package/lib/module/expo-config-plugin/android/gradleHelpers.js +0 -2
- package/lib/module/expo-config-plugin/android/gradleHelpers.js.map +0 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/android/constants.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/android/gradleHelpers.d.ts.map +0 -1
- package/lib/typescript/module/src/expo-config-plugin/android/constants.d.ts.map +0 -1
- package/lib/typescript/module/src/expo-config-plugin/android/gradleHelpers.d.ts.map +0 -1
- /package/lib/commonjs/expo-config-plugin/android/{constants.js → utils/constants.js} +0 -0
- /package/lib/commonjs/expo-config-plugin/template/android/{ReactNativeHostManager.kt → ReactNativeHostManager.pre55.kt} +0 -0
- /package/lib/module/expo-config-plugin/android/{constants.js → utils/constants.js} +0 -0
- /package/lib/module/expo-config-plugin/template/android/{ReactNativeHostManager.kt → ReactNativeHostManager.pre55.kt} +0 -0
- /package/lib/typescript/commonjs/src/expo-config-plugin/android/{constants.d.ts → utils/constants.d.ts} +0 -0
- /package/lib/typescript/commonjs/src/expo-config-plugin/android/{gradleHelpers.d.ts → utils/gradleHelpers.d.ts} +0 -0
- /package/lib/typescript/module/src/expo-config-plugin/android/{constants.d.ts → utils/constants.d.ts} +0 -0
- /package/lib/typescript/module/src/expo-config-plugin/android/{gradleHelpers.d.ts → utils/gradleHelpers.d.ts} +0 -0
- /package/src/expo-config-plugin/android/{constants.ts → utils/constants.ts} +0 -0
- /package/src/expo-config-plugin/template/android/{ReactNativeHostManager.kt → ReactNativeHostManager.pre55.kt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","_xcodeHelpers","_podfileHelpers","_withIosFrameworkFiles","_logging","withBrownfieldIos","exports","config","props","
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_xcodeHelpers","_podfileHelpers","_withIosFrameworkFiles","_logging","_expoUtils","withBrownfieldIos","exports","config","props","_getExpoInfo","getExpoInfo","isExpoPre55","expoMajor","withXcodeProject","xcodeConfig","project","modResults","modRequest","_addFrameworkTarget","addFrameworkTarget","ios","frameworkTargetUUID","targetAlreadyExists","Logger","logDebug","copyBundleReactNativePhase","sdkVersion","addExpoPre55ShellPatchScriptPhase","frameworkName","addSourceFilesBuildPhase","withPodfile","podfileConfig","contents","modifyPodfile","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,sBAAA,CAAAH,OAAA,4BAEA,IAAAI,QAAA,CAAAJ,OAAA,eACA,IAAAK,UAAA,CAAAL,OAAA,iBAYO,GAAM,CAAAM,iBAEZ,CAAAC,OAAA,CAAAD,iBAAA,CAAG,QAFS,CAAAA,iBAEZA,CAAIE,MAAM,CAAEC,KAAK,CAAK,CACrB,IAAAC,YAAA,CAAmC,GAAAC,sBAAW,EAACH,MAAM,CAAC,CAA9CI,WAAW,CAAAF,YAAA,CAAXE,WAAW,CAAEC,SAAS,CAAAH,YAAA,CAATG,SAAS,CAG9BL,MAAM,CAAG,GAAAM,+BAAgB,EAACN,MAAM,CAAE,SAACO,WAAW,CAAK,CACjD,GAAoB,CAAAC,OAAO,CAAiBD,WAAW,CAA/CE,UAAU,CAAWC,UAAU,CAAKH,WAAW,CAA1BG,UAAU,CAEvC,IAAAC,mBAAA,CAAqD,GAAAC,gCAAkB,EACrEJ,OAAO,CACPE,UAAU,CACVT,KAAK,CAACY,GACR,CAAC,CAJOC,mBAAmB,CAAAH,mBAAA,CAAnBG,mBAAmB,CAAEC,mBAAmB,CAAAJ,mBAAA,CAAnBI,mBAAmB,CAMhD,GAAIA,mBAAmB,CAAE,CACvBC,eAAM,CAACC,QAAQ,CACb,8EACF,CAAC,CAED,MAAO,CAAAV,WAAW,CACpB,CAGA,GAAAW,wCAA0B,EAACV,OAAO,CAAEM,mBAAmB,CAAC,CAGxD,GAAIV,WAAW,CAAE,CACfY,eAAM,CAACC,QAAQ,CACb,uDAAuDjB,MAAM,CAACmB,UAAU,EAC1E,CAAC,CAED,GAAAC,+CAAiC,EAACV,UAAU,CAAEF,OAAO,CAAE,CACrDa,aAAa,CAAEpB,KAAK,CAACY,GAAG,CAACQ,aAAa,CACtCP,mBAAmB,CAAEA,mBACvB,CAAC,CAAC,CACJ,CAAC,IAAM,CACLE,eAAM,CAACC,QAAQ,CACb,yDAAyDjB,MAAM,CAACmB,UAAU,EAC5E,CAAC,CACH,CAEA,GAAAG,sCAAwB,EAACd,OAAO,CAAEM,mBAAmB,CAAEb,KAAK,CAACY,GAAG,CAAC,CAEjE,MAAO,CAAAN,WAAW,CACpB,CAAC,CAAC,CAGFP,MAAM,CAAG,GAAAuB,0BAAW,EAACvB,MAAM,CAAE,SAACwB,aAAa,CAAK,CAC9C,GAAQ,CAAAH,aAAa,CAAKpB,KAAK,CAACY,GAAG,CAA3BQ,aAAa,CAErBG,aAAa,CAACf,UAAU,CAACgB,QAAQ,CAAG,GAAAC,6BAAa,EAC/CF,aAAa,CAACf,UAAU,CAACgB,QAAQ,CACjCJ,aAAa,CACbhB,SACF,CAAC,CAED,MAAO,CAAAmB,aAAa,CACtB,CAAC,CAAC,CAGFxB,MAAM,CAAG,GAAA2B,4CAAqB,EAAC3B,MAAM,CAAEC,KAAK,CAAC,CAE7C,MAAO,CAAAD,MAAM,CACf,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
package {{PACKAGE_NAME}}
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import android.content.res.Configuration
|
|
5
|
+
import com.callstack.reactnativebrownfield.OnJSBundleLoaded
|
|
6
|
+
import com.callstack.reactnativebrownfield.ReactNativeBrownfield
|
|
7
|
+
import com.facebook.react.PackageList
|
|
8
|
+
import com.facebook.react.ReactHost
|
|
9
|
+
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
|
|
10
|
+
import expo.modules.ApplicationLifecycleDispatcher
|
|
11
|
+
import expo.modules.ExpoReactHostFactory
|
|
12
|
+
|
|
13
|
+
object ReactNativeHostManager {
|
|
14
|
+
fun initialize(application: Application, onJSBundleLoaded: OnJSBundleLoaded? = null) {
|
|
15
|
+
loadReactNative(application)
|
|
16
|
+
|
|
17
|
+
ApplicationLifecycleDispatcher.onApplicationCreate(application)
|
|
18
|
+
|
|
19
|
+
val reactHost: ReactHost by lazy {
|
|
20
|
+
ExpoReactHostFactory.getDefaultReactHost(
|
|
21
|
+
context = application.applicationContext,
|
|
22
|
+
packageList = PackageList(application).packages,
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ReactNativeBrownfield.initialize(application, reactHost, onJSBundleLoaded)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fun onConfigurationChanged(application: Application, newConfig: Configuration) {
|
|
30
|
+
ApplicationLifecycleDispatcher.onConfigurationChanged(application, newConfig)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -83,7 +83,7 @@ android {
|
|
|
83
83
|
|
|
84
84
|
dependencies {
|
|
85
85
|
api("com.facebook.react:react-android:{{RN_VERSION}}")
|
|
86
|
-
api("
|
|
86
|
+
api("{{HERMES_ARTIFACT}}")
|
|
87
87
|
|
|
88
88
|
api("io.coil-kt.coil3:coil-compose:3.2.0")
|
|
89
89
|
api("io.coil-kt.coil3:coil-network-okhttp:3.2.0")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { withBrownfieldAndroid } from './withBrownfieldAndroid';
|
|
2
2
|
export { withAndroidModuleFiles, createAndroidModule, } from './withAndroidModuleFiles';
|
|
3
|
-
export { modifyRootBuildGradle, modifySettingsGradle } from './gradleHelpers';
|
|
3
|
+
export { modifyRootBuildGradle, modifySettingsGradle, } from './utils/gradleHelpers';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../src/expo-config-plugin/android/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,UAAU,CAAC;AACjD,eAAO,MAAM,gCAAgC,sEAA2F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradleHelpers.d.ts","sourceRoot":"","sources":["../../../../../../../src/expo-config-plugin/android/utils/gradleHelpers.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA+B9D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAqBR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hermes.d.ts","sourceRoot":"","sources":["../../../../../../../src/expo-config-plugin/android/utils/hermes.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM;;;;EAgFlD"}
|
|
@@ -3,7 +3,11 @@ import type { ResolvedBrownfieldPluginConfigWithAndroid } from '../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates the Android library module directory structure and files
|
|
5
5
|
*/
|
|
6
|
-
export declare function createAndroidModule({ androidDir, config, rnVersion, }: {
|
|
6
|
+
export declare function createAndroidModule({ androidDir, config, rnVersion, isExpoPre55, }: {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the Expo project is pre-55
|
|
9
|
+
*/
|
|
10
|
+
isExpoPre55: boolean;
|
|
7
11
|
/**
|
|
8
12
|
* The root Android directory path
|
|
9
13
|
*/
|
package/lib/typescript/commonjs/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAndroidModuleFiles.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/withAndroidModuleFiles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EAEV,yCAAyC,EAC1C,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"withAndroidModuleFiles.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/withAndroidModuleFiles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EAEV,yCAAyC,EAC1C,MAAM,UAAU,CAAC;AAMlB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,EACV,MAAM,EACN,SAAS,EACT,WAAW,GACZ,EAAE;IACD;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,EAAE,yCAAyC,CAAC;CACnD,GAAG,IAAI,CA0EP;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,YAAY,CAC/C,yCAAyC,CAuC1C,CAAC"}
|
package/lib/typescript/commonjs/src/expo-config-plugin/android/withBrownfieldAndroid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withBrownfieldAndroid.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/withBrownfieldAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"withBrownfieldAndroid.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/withBrownfieldAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,UAAU,CAAC;AAE1E;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAC9C,yCAAyC,CA2B1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expoUtils.d.ts","sourceRoot":"","sources":["../../../../../src/expo-config-plugin/expoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU;;;EAS7C"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Modifies the Podfile to include the Brownfield framework target
|
|
3
3
|
* @param podfile The original Podfile content
|
|
4
4
|
* @param frameworkName The name of the framework target to add
|
|
5
|
+
* @param expoMajor The major version of the Expo SDK
|
|
5
6
|
* @returns The modified Podfile content
|
|
6
7
|
*/
|
|
7
|
-
export declare function modifyPodfile(podfile: string, frameworkName: string,
|
|
8
|
+
export declare function modifyPodfile(podfile: string, frameworkName: string, expoMajor: number): string;
|
|
8
9
|
//# sourceMappingURL=podfileHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"podfileHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/podfileHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"podfileHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/podfileHelpers.ts"],"names":[],"mappings":"AA0FA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAgDR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withBrownfieldIos.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/withBrownfieldIos.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"withBrownfieldIos.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/withBrownfieldIos.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC;AAItE;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAC1C,qCAAqC,CA+DtC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { withBrownfieldAndroid } from './withBrownfieldAndroid';
|
|
2
2
|
export { withAndroidModuleFiles, createAndroidModule, } from './withAndroidModuleFiles';
|
|
3
|
-
export { modifyRootBuildGradle, modifySettingsGradle } from './gradleHelpers';
|
|
3
|
+
export { modifyRootBuildGradle, modifySettingsGradle, } from './utils/gradleHelpers';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../src/expo-config-plugin/android/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,UAAU,CAAC;AACjD,eAAO,MAAM,gCAAgC,sEAA2F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradleHelpers.d.ts","sourceRoot":"","sources":["../../../../../../../src/expo-config-plugin/android/utils/gradleHelpers.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA+B9D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAqBR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hermes.d.ts","sourceRoot":"","sources":["../../../../../../../src/expo-config-plugin/android/utils/hermes.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM;;;;EAgFlD"}
|
|
@@ -3,7 +3,11 @@ import type { ResolvedBrownfieldPluginConfigWithAndroid } from '../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates the Android library module directory structure and files
|
|
5
5
|
*/
|
|
6
|
-
export declare function createAndroidModule({ androidDir, config, rnVersion, }: {
|
|
6
|
+
export declare function createAndroidModule({ androidDir, config, rnVersion, isExpoPre55, }: {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the Expo project is pre-55
|
|
9
|
+
*/
|
|
10
|
+
isExpoPre55: boolean;
|
|
7
11
|
/**
|
|
8
12
|
* The root Android directory path
|
|
9
13
|
*/
|
package/lib/typescript/module/src/expo-config-plugin/android/withAndroidModuleFiles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAndroidModuleFiles.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/withAndroidModuleFiles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EAEV,yCAAyC,EAC1C,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"withAndroidModuleFiles.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/withAndroidModuleFiles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EAEV,yCAAyC,EAC1C,MAAM,UAAU,CAAC;AAMlB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,EACV,MAAM,EACN,SAAS,EACT,WAAW,GACZ,EAAE;IACD;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,EAAE,yCAAyC,CAAC;CACnD,GAAG,IAAI,CA0EP;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,YAAY,CAC/C,yCAAyC,CAuC1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withBrownfieldAndroid.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/withBrownfieldAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"withBrownfieldAndroid.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/android/withBrownfieldAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,UAAU,CAAC;AAE1E;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAC9C,yCAAyC,CA2B1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expoUtils.d.ts","sourceRoot":"","sources":["../../../../../src/expo-config-plugin/expoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU;;;EAS7C"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Modifies the Podfile to include the Brownfield framework target
|
|
3
3
|
* @param podfile The original Podfile content
|
|
4
4
|
* @param frameworkName The name of the framework target to add
|
|
5
|
+
* @param expoMajor The major version of the Expo SDK
|
|
5
6
|
* @returns The modified Podfile content
|
|
6
7
|
*/
|
|
7
|
-
export declare function modifyPodfile(podfile: string, frameworkName: string,
|
|
8
|
+
export declare function modifyPodfile(podfile: string, frameworkName: string, expoMajor: number): string;
|
|
8
9
|
//# sourceMappingURL=podfileHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"podfileHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/podfileHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"podfileHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/podfileHelpers.ts"],"names":[],"mappings":"AA0FA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAgDR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withBrownfieldIos.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/withBrownfieldIos.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"withBrownfieldIos.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/withBrownfieldIos.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC;AAItE;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAC1C,qCAAqC,CA+DtC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callstack/react-native-brownfield",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Michal Chudziak <mike.chudziak@callstack.com>",
|
|
6
6
|
"bin": {
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"dev": "nodemon --ext '*' --watch src --exec \"bob build\"",
|
|
51
51
|
"build:brownfield": "yarn run build",
|
|
52
52
|
"prepack": "cp ../../README.md ./README.md",
|
|
53
|
-
"postpack": "rm ./README.md"
|
|
53
|
+
"postpack": "rm ./README.md",
|
|
54
|
+
"test": "vitest run"
|
|
54
55
|
},
|
|
55
56
|
"keywords": [
|
|
56
57
|
"react-native-brownfield",
|
|
@@ -85,7 +86,7 @@
|
|
|
85
86
|
"@expo/config-plugins": "^54.0.4"
|
|
86
87
|
},
|
|
87
88
|
"dependencies": {
|
|
88
|
-
"@callstack/brownfield-cli": "^3.
|
|
89
|
+
"@callstack/brownfield-cli": "^3.3.0"
|
|
89
90
|
},
|
|
90
91
|
"devDependencies": {
|
|
91
92
|
"@babel/core": "^7.25.2",
|
|
@@ -95,6 +96,7 @@
|
|
|
95
96
|
"@react-native/babel-preset": "0.82.1",
|
|
96
97
|
"@types/jest": "^30.0.0",
|
|
97
98
|
"@types/react": "^19.1.1",
|
|
99
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
98
100
|
"eslint": "^9.28.0",
|
|
99
101
|
"globals": "^16.2.0",
|
|
100
102
|
"import": "^0.0.6",
|
|
@@ -102,7 +104,8 @@
|
|
|
102
104
|
"react": "19.1.1",
|
|
103
105
|
"react-native": "0.82.1",
|
|
104
106
|
"react-native-builder-bob": "^0.40.17",
|
|
105
|
-
"typescript": "5.9.3"
|
|
107
|
+
"typescript": "5.9.3",
|
|
108
|
+
"vitest": "^4.0.17"
|
|
106
109
|
},
|
|
107
110
|
"codegenConfig": {
|
|
108
111
|
"name": "ReactNativeBrownfield",
|
|
@@ -3,4 +3,7 @@ export {
|
|
|
3
3
|
withAndroidModuleFiles,
|
|
4
4
|
createAndroidModule,
|
|
5
5
|
} from './withAndroidModuleFiles';
|
|
6
|
-
export {
|
|
6
|
+
export {
|
|
7
|
+
modifyRootBuildGradle,
|
|
8
|
+
modifySettingsGradle,
|
|
9
|
+
} from './utils/gradleHelpers';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Logger } from '../../logging';
|
|
2
|
+
|
|
3
|
+
export function getHermesArtifact(rnVersion: string) {
|
|
4
|
+
let [rnMajorVersionString, rnMinorVersionString, rnPatchVersionString] =
|
|
5
|
+
rnVersion.split('.') as [string?, string?, string?];
|
|
6
|
+
|
|
7
|
+
const rnMajorVersion = Number(rnMajorVersionString);
|
|
8
|
+
const rnMinorVersion = Number(rnMinorVersionString);
|
|
9
|
+
|
|
10
|
+
if (
|
|
11
|
+
rnPatchVersionString?.includes('-') ||
|
|
12
|
+
rnPatchVersionString?.includes('+')
|
|
13
|
+
) {
|
|
14
|
+
rnPatchVersionString = rnPatchVersionString.split('-')[0].split('+')[0];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const rnPatchVersion = Number(rnPatchVersionString);
|
|
18
|
+
|
|
19
|
+
if (
|
|
20
|
+
Number.isNaN(rnMajorVersion) ||
|
|
21
|
+
Number.isNaN(rnMinorVersion) ||
|
|
22
|
+
Number.isNaN(rnPatchVersion)
|
|
23
|
+
) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`Failed to parse React Native version from '${rnVersion}' - resolved components are: ${rnMajorVersion}.${rnMinorVersion}.${rnPatchVersion}`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (rnMajorVersion !== 0) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`Unsupported React Native major version '${rnMajorVersion}' in '${rnVersion}'`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// below: 0.84.x
|
|
36
|
+
if (rnMinorVersion >= 84) {
|
|
37
|
+
return {
|
|
38
|
+
groupId: 'com.facebook.hermes',
|
|
39
|
+
artifactId: 'hermes-android',
|
|
40
|
+
version: '0.15.1',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// below: 0.83.x
|
|
45
|
+
if (rnMinorVersion === 83) {
|
|
46
|
+
let version: string;
|
|
47
|
+
|
|
48
|
+
switch (rnPatchVersion) {
|
|
49
|
+
// below: 0.83.0, 0.83.1
|
|
50
|
+
case 0:
|
|
51
|
+
case 1:
|
|
52
|
+
version = '0.14.0';
|
|
53
|
+
break;
|
|
54
|
+
|
|
55
|
+
// below: 0.83.2, 0.83.3, 0.83.4
|
|
56
|
+
case 2:
|
|
57
|
+
case 3:
|
|
58
|
+
case 4:
|
|
59
|
+
version = '0.14.1';
|
|
60
|
+
break;
|
|
61
|
+
|
|
62
|
+
default:
|
|
63
|
+
version = '0.14.1';
|
|
64
|
+
Logger.logWarning(
|
|
65
|
+
`This React Native patch version '${rnVersion}' (in ${rnMajorVersion}.${rnMinorVersion}.${rnPatchVersion}) has not been tested with the Brownfield plugin yet - please consider reporting this on GitHub: https://github.com/callstack/react-native-brownfield/. Using the latest version of Hermes that Brownfield has been tested with (0.14.1).`
|
|
66
|
+
);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
groupId: 'com.facebook.hermes',
|
|
72
|
+
artifactId: 'hermes-android',
|
|
73
|
+
version,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// below: 0.82.x and below
|
|
78
|
+
return {
|
|
79
|
+
groupId: 'com.facebook.react',
|
|
80
|
+
artifactId: 'hermes-android',
|
|
81
|
+
version: rnVersion,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -9,6 +9,8 @@ import type {
|
|
|
9
9
|
} from '../types';
|
|
10
10
|
import { Logger } from '../logging';
|
|
11
11
|
import { renderTemplate } from '../template/engine';
|
|
12
|
+
import { getExpoInfo } from '../expoUtils';
|
|
13
|
+
import { getHermesArtifact } from './utils/hermes';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Creates the Android library module directory structure and files
|
|
@@ -17,7 +19,13 @@ export function createAndroidModule({
|
|
|
17
19
|
androidDir,
|
|
18
20
|
config,
|
|
19
21
|
rnVersion,
|
|
22
|
+
isExpoPre55,
|
|
20
23
|
}: {
|
|
24
|
+
/**
|
|
25
|
+
* Whether the Expo project is pre-55
|
|
26
|
+
*/
|
|
27
|
+
isExpoPre55: boolean;
|
|
28
|
+
|
|
21
29
|
/**
|
|
22
30
|
* The root Android directory path
|
|
23
31
|
*/
|
|
@@ -38,6 +46,11 @@ export function createAndroidModule({
|
|
|
38
46
|
|
|
39
47
|
Logger.logDebug(`Creating Android module in: ${androidDir}`);
|
|
40
48
|
|
|
49
|
+
const hermesArtifact = getHermesArtifact(rnVersion);
|
|
50
|
+
Logger.logDebug(
|
|
51
|
+
`Resolved Hermes artifact: ${hermesArtifact.groupId}:${hermesArtifact.artifactId}:${hermesArtifact.version}`
|
|
52
|
+
);
|
|
53
|
+
|
|
41
54
|
// generate module files
|
|
42
55
|
const files: RenderedTemplateFile[] = [
|
|
43
56
|
{
|
|
@@ -50,6 +63,7 @@ export function createAndroidModule({
|
|
|
50
63
|
'{{ARTIFACT_ID}}': android.artifactId,
|
|
51
64
|
'{{ARTIFACT_VERSION}}': android.version,
|
|
52
65
|
'{{RN_VERSION}}': rnVersion,
|
|
66
|
+
'{{HERMES_ARTIFACT}}': `${hermesArtifact.groupId}:${hermesArtifact.artifactId}:${hermesArtifact.version}`,
|
|
53
67
|
}),
|
|
54
68
|
},
|
|
55
69
|
{
|
|
@@ -62,9 +76,15 @@ export function createAndroidModule({
|
|
|
62
76
|
},
|
|
63
77
|
{
|
|
64
78
|
relativePath: `src/main/java/${config.android.packageName.replace(/\./g, '/')}/ReactNativeHostManager.kt`,
|
|
65
|
-
content: renderTemplate(
|
|
66
|
-
'
|
|
67
|
-
|
|
79
|
+
content: renderTemplate(
|
|
80
|
+
'android',
|
|
81
|
+
isExpoPre55
|
|
82
|
+
? 'ReactNativeHostManager.pre55.kt'
|
|
83
|
+
: 'ReactNativeHostManager.post55.kt',
|
|
84
|
+
{
|
|
85
|
+
'{{PACKAGE_NAME}}': android.packageName,
|
|
86
|
+
}
|
|
87
|
+
),
|
|
68
88
|
},
|
|
69
89
|
{
|
|
70
90
|
relativePath: 'consumer-rules.pro',
|
|
@@ -127,10 +147,13 @@ export const withAndroidModuleFiles: ConfigPlugin<
|
|
|
127
147
|
);
|
|
128
148
|
}
|
|
129
149
|
|
|
150
|
+
const { isExpoPre55 } = getExpoInfo(config);
|
|
151
|
+
|
|
130
152
|
createAndroidModule({
|
|
131
153
|
androidDir,
|
|
132
154
|
config: props,
|
|
133
155
|
rnVersion,
|
|
156
|
+
isExpoPre55,
|
|
134
157
|
});
|
|
135
158
|
|
|
136
159
|
return dangerousConfig;
|
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
type ConfigPlugin,
|
|
5
5
|
} from '@expo/config-plugins';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
modifyRootBuildGradle,
|
|
9
|
+
modifySettingsGradle,
|
|
10
|
+
} from './utils/gradleHelpers';
|
|
8
11
|
import { withAndroidModuleFiles } from './withAndroidModuleFiles';
|
|
9
12
|
import type { ResolvedBrownfieldPluginConfigWithAndroid } from '../types';
|
|
10
13
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExpoConfig } from '@expo/config-types';
|
|
2
|
+
|
|
3
|
+
export function getExpoInfo(config: ExpoConfig) {
|
|
4
|
+
const expoMajor = config.sdkVersion
|
|
5
|
+
? parseInt(config.sdkVersion.split('.')[0], 10)
|
|
6
|
+
: -1;
|
|
7
|
+
const isExpoPre55 = expoMajor < 55;
|
|
8
|
+
return {
|
|
9
|
+
expoMajor,
|
|
10
|
+
isExpoPre55,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -6,6 +6,10 @@ const BROWNFIELD_POD_HOOK_MARKER_START =
|
|
|
6
6
|
'# >>> react-native-brownfield expo phase ordering >>>';
|
|
7
7
|
const BROWNFIELD_POD_HOOK_MARKER_END =
|
|
8
8
|
'# <<< react-native-brownfield expo phase ordering <<<';
|
|
9
|
+
const BROWNFIELD_EXPO_GTE_55_SWIFT_DEFINES_MARKER_START =
|
|
10
|
+
'# >>> react-native-brownfield Expo SDK 55+ swift defines >>>';
|
|
11
|
+
const BROWNFIELD_EXPO_GTE_55_SWIFT_DEFINES_MARKER_END =
|
|
12
|
+
'# <<< react-native-brownfield Expo SDK 55+ swift defines <<<';
|
|
9
13
|
const BROWNFIELD_POST_INTEGRATE_REQUIRE = `require File.join(File.dirname(\`node --print "require.resolve('@callstack/react-native-brownfield/package.json')"\`), "scripts/react_native_brownfield_post_integrate")`;
|
|
10
14
|
const REACT_NATIVE_PODS_REQUIRE_REGEX =
|
|
11
15
|
/^require File\.join\(File\.dirname\(`node --print "require\.resolve\('react-native\/package\.json'\)"`\), "scripts\/react_native_pods"\)\s*$/m;
|
|
@@ -49,16 +53,52 @@ ${BROWNFIELD_POD_HOOK_MARKER_END}
|
|
|
49
53
|
return modifiedPodfile;
|
|
50
54
|
}
|
|
51
55
|
|
|
56
|
+
function ensureExpoDefinesForSDK55AndAbove(podfile: string): string {
|
|
57
|
+
if (podfile.includes(BROWNFIELD_EXPO_GTE_55_SWIFT_DEFINES_MARKER_START)) {
|
|
58
|
+
return podfile;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const hook = `
|
|
62
|
+
${BROWNFIELD_EXPO_GTE_55_SWIFT_DEFINES_MARKER_START}
|
|
63
|
+
installer.pods_project.targets.each do |target|
|
|
64
|
+
if target.name == 'ReactBrownfield'
|
|
65
|
+
puts "[Brownfield] Adding definition of EXPO_SDK_GTE_55 to target: #{target.name}"
|
|
66
|
+
|
|
67
|
+
target.build_configurations.each do |config|
|
|
68
|
+
conditions = config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] || '$(inherited)'
|
|
69
|
+
conditions = conditions.to_s
|
|
70
|
+
config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = "#{conditions} EXPO_SDK_GTE_55"
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
${BROWNFIELD_EXPO_GTE_55_SWIFT_DEFINES_MARKER_END}
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
const postInstallMatch = podfile.match(
|
|
78
|
+
/(post_install\s+do\s+\|installer\|\s*\n)((?:(?!^\s*end\s*$)[\s\S])*)(^\s*end\s*$)/m
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if (postInstallMatch) {
|
|
82
|
+
const [whole, start, content, end] = postInstallMatch;
|
|
83
|
+
const updated = `${start}${content.trimEnd()}\n${hook}\n${end}`;
|
|
84
|
+
return podfile.replace(whole, updated);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// if there is no post_install, append one
|
|
88
|
+
return `${podfile.trimEnd()}\n\npost_install do |installer|\n${hook}\nend\n`;
|
|
89
|
+
}
|
|
90
|
+
|
|
52
91
|
/**
|
|
53
92
|
* Modifies the Podfile to include the Brownfield framework target
|
|
54
93
|
* @param podfile The original Podfile content
|
|
55
94
|
* @param frameworkName The name of the framework target to add
|
|
95
|
+
* @param expoMajor The major version of the Expo SDK
|
|
56
96
|
* @returns The modified Podfile content
|
|
57
97
|
*/
|
|
58
98
|
export function modifyPodfile(
|
|
59
99
|
podfile: string,
|
|
60
100
|
frameworkName: string,
|
|
61
|
-
|
|
101
|
+
expoMajor: number
|
|
62
102
|
): string {
|
|
63
103
|
// check if the framework target is already included
|
|
64
104
|
if (podfile.includes(`target '${frameworkName}'`)) {
|
|
@@ -99,8 +139,11 @@ export function modifyPodfile(
|
|
|
99
139
|
|
|
100
140
|
Logger.logDebug(`Added framework target "${frameworkName}" to Podfile`);
|
|
101
141
|
|
|
102
|
-
if (
|
|
142
|
+
if (expoMajor < 55) {
|
|
103
143
|
modifiedPodfile = ensureExpoPhaseOrderingHook(modifiedPodfile);
|
|
144
|
+
} else {
|
|
145
|
+
// Expo SDK >= 55
|
|
146
|
+
modifiedPodfile = ensureExpoDefinesForSDK55AndAbove(modifiedPodfile);
|
|
104
147
|
}
|
|
105
148
|
|
|
106
149
|
return modifiedPodfile;
|
|
@@ -14,6 +14,7 @@ import { modifyPodfile } from './podfileHelpers';
|
|
|
14
14
|
import { withIosFrameworkFiles } from './withIosFrameworkFiles';
|
|
15
15
|
import type { ResolvedBrownfieldPluginConfigWithIos } from '../types';
|
|
16
16
|
import { Logger } from '../logging';
|
|
17
|
+
import { getExpoInfo } from '../expoUtils';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* iOS Config Plugin for integration with @callstack/react-native-brownfield.
|
|
@@ -28,10 +29,8 @@ import { Logger } from '../logging';
|
|
|
28
29
|
export const withBrownfieldIos: ConfigPlugin<
|
|
29
30
|
ResolvedBrownfieldPluginConfigWithIos
|
|
30
31
|
> = (config, props) => {
|
|
31
|
-
const expoMajor = config
|
|
32
|
-
|
|
33
|
-
: -1;
|
|
34
|
-
const isExpoPre55 = expoMajor < 55;
|
|
32
|
+
const { isExpoPre55, expoMajor } = getExpoInfo(config);
|
|
33
|
+
|
|
35
34
|
// Step 1: modify the Xcode project to add framework target &
|
|
36
35
|
config = withXcodeProject(config, (xcodeConfig) => {
|
|
37
36
|
const { modResults: project, modRequest } = xcodeConfig;
|
|
@@ -81,7 +80,7 @@ export const withBrownfieldIos: ConfigPlugin<
|
|
|
81
80
|
podfileConfig.modResults.contents = modifyPodfile(
|
|
82
81
|
podfileConfig.modResults.contents,
|
|
83
82
|
frameworkName,
|
|
84
|
-
|
|
83
|
+
expoMajor
|
|
85
84
|
);
|
|
86
85
|
|
|
87
86
|
return podfileConfig;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
package {{PACKAGE_NAME}}
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import android.content.res.Configuration
|
|
5
|
+
import com.callstack.reactnativebrownfield.OnJSBundleLoaded
|
|
6
|
+
import com.callstack.reactnativebrownfield.ReactNativeBrownfield
|
|
7
|
+
import com.facebook.react.PackageList
|
|
8
|
+
import com.facebook.react.ReactHost
|
|
9
|
+
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
|
|
10
|
+
import expo.modules.ApplicationLifecycleDispatcher
|
|
11
|
+
import expo.modules.ExpoReactHostFactory
|
|
12
|
+
|
|
13
|
+
object ReactNativeHostManager {
|
|
14
|
+
fun initialize(application: Application, onJSBundleLoaded: OnJSBundleLoaded? = null) {
|
|
15
|
+
loadReactNative(application)
|
|
16
|
+
|
|
17
|
+
ApplicationLifecycleDispatcher.onApplicationCreate(application)
|
|
18
|
+
|
|
19
|
+
val reactHost: ReactHost by lazy {
|
|
20
|
+
ExpoReactHostFactory.getDefaultReactHost(
|
|
21
|
+
context = application.applicationContext,
|
|
22
|
+
packageList = PackageList(application).packages,
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ReactNativeBrownfield.initialize(application, reactHost, onJSBundleLoaded)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fun onConfigurationChanged(application: Application, newConfig: Configuration) {
|
|
30
|
+
ApplicationLifecycleDispatcher.onConfigurationChanged(application, newConfig)
|
|
31
|
+
}
|
|
32
|
+
}
|