react-native-ota-hot-update 2.1.11 → 2.1.13

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/app.plugin.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./plugin/withHotupdate');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ota-hot-update",
3
- "version": "2.1.11",
3
+ "version": "2.1.13",
4
4
  "description": "Hot update for react native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -25,7 +25,9 @@
25
25
  "cpp",
26
26
  "*.podspec",
27
27
  "react-native.config.js",
28
+ "app.plugin.js",
28
29
  "!ios/build",
30
+ "plugin/withHotupdate.js",
29
31
  "!android/build",
30
32
  "!android/gradle",
31
33
  "!android/gradlew",
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+
4
+ const config_plugins_1 = require('expo/config-plugins');
5
+
6
+ const withAndroidAction = (config) => {
7
+ return (0, config_plugins_1.withMainApplication)(config, (config) => {
8
+ config.modResults.contents = config.modResults.contents.replace(
9
+ /override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED/g,
10
+ `
11
+ override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
12
+
13
+ override fun getJSBundleFile(): String = OtaHotUpdate.bundleJS`
14
+ );
15
+ config.modResults.contents = config.modResults.contents.replace(
16
+ /import expo.modules.ReactNativeHostWrapper/g,
17
+ `
18
+ import expo.modules.ReactNativeHostWrapper
19
+ import com.otahotupdate.OtaHotUpdate`
20
+ );
21
+ return config;
22
+ });
23
+ };
24
+
25
+ const withIosAction = (config) => {
26
+ return (0, config_plugins_1.withAppDelegate)(config, (config) => {
27
+ config.modResults.contents = config.modResults.contents.replace(
28
+ /#import "AppDelegate.h"/g,
29
+ `#import "AppDelegate.h"
30
+ #import "OtaHotUpdate.h"`
31
+ );
32
+ config.modResults.contents = config.modResults.contents.replace(
33
+ /\[\[NSBundle mainBundle\] URLForResource:@\"main\" withExtension:@\"jsbundle\"\]/,
34
+ `[OtaHotUpdate getBundle]`
35
+ );
36
+ return config;
37
+ });
38
+ };
39
+
40
+ const withUpdatePlugin = (config) => {
41
+ config = withAndroidAction(config);
42
+ config = withIosAction(config);
43
+ return config;
44
+ };
45
+
46
+ exports.default = withUpdatePlugin;