expo-dev-launcher 0.8.2 → 0.8.3
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
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.8.3 — 2021-10-15
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Fix config plugin compatibility with expo-screen-orientation. ([#14752](https://github.com/expo/expo/pull/14752) by [@esamelson](https://github.com/esamelson))
|
|
18
|
+
|
|
13
19
|
## 0.8.2 — 2021-10-15
|
|
14
20
|
|
|
15
21
|
### 🐛 Bug fixes
|
package/android/build.gradle
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-dev-launcher",
|
|
3
3
|
"title": "Expo Development Launcher",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.3",
|
|
5
5
|
"description": "Pre-release version of the Expo development launcher package for testing.",
|
|
6
6
|
"main": "build/DevLauncher.js",
|
|
7
7
|
"types": "build/DevLauncher.d.ts",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"react": "17.0.1",
|
|
39
39
|
"react-native": "0.64.2"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "7adf260ab3de492530d4bf250a24b132b5c4ba41"
|
|
42
42
|
}
|
|
@@ -9,6 +9,9 @@ const semver_1 = __importDefault(require("semver"));
|
|
|
9
9
|
const constants_1 = require("./constants");
|
|
10
10
|
const resolveExpoUpdatesVersion_1 = require("./resolveExpoUpdatesVersion");
|
|
11
11
|
const utils_1 = require("./utils");
|
|
12
|
+
function escapeRegExpCharacters(string) {
|
|
13
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
14
|
+
}
|
|
12
15
|
const INITIALIZE_REACT_NATIVE_APP_FUNCTION = `- (RCTBridge *)initializeReactNativeApp`;
|
|
13
16
|
const NEW_INITIALIZE_REACT_NATIVE_APP_FUNCTION = `- (RCTBridge *)initializeReactNativeApp:(NSDictionary *)launchOptions`;
|
|
14
17
|
const DEV_LAUNCHER_APP_DELEGATE_SOURCE_FOR_URL = ` #if defined(EX_DEV_LAUNCHER_ENABLED)
|
|
@@ -79,7 +82,7 @@ const DEV_MENU_IOS_INIT = `
|
|
|
79
82
|
#if defined(EX_DEV_MENU_ENABLED)
|
|
80
83
|
[DevMenuManager configureWithBridge:bridge];
|
|
81
84
|
#endif`;
|
|
82
|
-
const DEV_LAUNCHER_INIT_TO_REMOVE = `RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
85
|
+
const DEV_LAUNCHER_INIT_TO_REMOVE = new RegExp(escapeRegExpCharacters(`RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
83
86
|
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
|
|
84
87
|
id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
|
|
85
88
|
if (rootViewBackgroundColor != nil) {
|
|
@@ -89,10 +92,12 @@ const DEV_LAUNCHER_INIT_TO_REMOVE = `RCTBridge *bridge = [[RCTBridge alloc] init
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
92
|
-
UIViewController *rootViewController =
|
|
95
|
+
UIViewController *rootViewController = `) +
|
|
96
|
+
`([^;]+)` +
|
|
97
|
+
escapeRegExpCharacters(`;
|
|
93
98
|
rootViewController.view = rootView;
|
|
94
99
|
self.window.rootViewController = rootViewController;
|
|
95
|
-
[self.window makeKeyAndVisible]
|
|
100
|
+
[self.window makeKeyAndVisible];`), 'm');
|
|
96
101
|
const DEV_LAUNCHER_NEW_INIT = `self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
97
102
|
#if defined(EX_DEV_LAUNCHER_ENABLED)
|
|
98
103
|
EXDevLauncherController *controller = [EXDevLauncherController sharedInstance];
|
|
@@ -100,7 +105,29 @@ const DEV_LAUNCHER_NEW_INIT = `self.window = [[UIWindow alloc] initWithFrame:[UI
|
|
|
100
105
|
#else
|
|
101
106
|
[self initializeReactNativeApp:launchOptions];
|
|
102
107
|
#endif`;
|
|
103
|
-
const
|
|
108
|
+
const DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION_REGEX = new RegExp(escapeRegExpCharacters(`
|
|
109
|
+
- (RCTBridge *)initializeReactNativeApp:(NSDictionary *)launchOptions
|
|
110
|
+
{
|
|
111
|
+
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
112
|
+
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
|
|
113
|
+
id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
|
|
114
|
+
if (rootViewBackgroundColor != nil) {
|
|
115
|
+
rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
|
|
116
|
+
} else {
|
|
117
|
+
rootView.backgroundColor = [UIColor whiteColor];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
UIViewController *rootViewController = `) +
|
|
121
|
+
`[^;]+` +
|
|
122
|
+
escapeRegExpCharacters(`;
|
|
123
|
+
rootViewController.view = rootView;
|
|
124
|
+
self.window.rootViewController = rootViewController;
|
|
125
|
+
[self.window makeKeyAndVisible];
|
|
126
|
+
|
|
127
|
+
return bridge;
|
|
128
|
+
}
|
|
129
|
+
`), 'm');
|
|
130
|
+
const DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION = (viewControllerInit) => `
|
|
104
131
|
- (RCTBridge *)initializeReactNativeApp:(NSDictionary *)launchOptions
|
|
105
132
|
{
|
|
106
133
|
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
@@ -112,7 +139,7 @@ const DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION = `
|
|
|
112
139
|
rootView.backgroundColor = [UIColor whiteColor];
|
|
113
140
|
}
|
|
114
141
|
|
|
115
|
-
UIViewController *rootViewController = [UIViewController new];
|
|
142
|
+
UIViewController *rootViewController = ${viewControllerInit !== null && viewControllerInit !== void 0 ? viewControllerInit : '[UIViewController new]'};
|
|
116
143
|
rootViewController.view = rootView;
|
|
117
144
|
self.window.rootViewController = rootViewController;
|
|
118
145
|
[self.window makeKeyAndVisible];
|
|
@@ -175,11 +202,17 @@ function modifyLegacyAppDelegate(appDelegate, expoUpdatesVersion = null) {
|
|
|
175
202
|
exports.modifyLegacyAppDelegate = modifyLegacyAppDelegate;
|
|
176
203
|
function modifyAppDelegate(appDelegate, expoUpdatesVersion = null) {
|
|
177
204
|
const shouldAddUpdatesIntegration = expoUpdatesVersion != null && semver_1.default.gt(expoUpdatesVersion, '0.6.0');
|
|
178
|
-
if (!
|
|
179
|
-
if (
|
|
180
|
-
|
|
205
|
+
if (!DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION_REGEX.test(appDelegate)) {
|
|
206
|
+
if (DEV_LAUNCHER_INIT_TO_REMOVE.test(appDelegate)) {
|
|
207
|
+
// UIViewController can be initialized differently depending on whether expo-screen-orientation is installed,
|
|
208
|
+
// so we need to preserve whatever is there already.
|
|
209
|
+
let viewControllerInit;
|
|
210
|
+
appDelegate = appDelegate.replace(DEV_LAUNCHER_INIT_TO_REMOVE, (match, p1) => {
|
|
211
|
+
viewControllerInit = p1;
|
|
212
|
+
return DEV_LAUNCHER_NEW_INIT;
|
|
213
|
+
});
|
|
181
214
|
appDelegate = utils_1.addLines(appDelegate, '@implementation AppDelegate', 1, [
|
|
182
|
-
DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION,
|
|
215
|
+
DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION(viewControllerInit),
|
|
183
216
|
]);
|
|
184
217
|
}
|
|
185
218
|
else {
|
|
@@ -5,6 +5,10 @@ import { InstallationPage } from './constants';
|
|
|
5
5
|
import { resolveExpoUpdatesVersion } from './resolveExpoUpdatesVersion';
|
|
6
6
|
import { addLines } from './utils';
|
|
7
7
|
|
|
8
|
+
function escapeRegExpCharacters(string: string) {
|
|
9
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
const INITIALIZE_REACT_NATIVE_APP_FUNCTION = `- (RCTBridge *)initializeReactNativeApp`;
|
|
9
13
|
const NEW_INITIALIZE_REACT_NATIVE_APP_FUNCTION = `- (RCTBridge *)initializeReactNativeApp:(NSDictionary *)launchOptions`;
|
|
10
14
|
|
|
@@ -81,7 +85,8 @@ const DEV_MENU_IOS_INIT = `
|
|
|
81
85
|
[DevMenuManager configureWithBridge:bridge];
|
|
82
86
|
#endif`;
|
|
83
87
|
|
|
84
|
-
const DEV_LAUNCHER_INIT_TO_REMOVE =
|
|
88
|
+
const DEV_LAUNCHER_INIT_TO_REMOVE = new RegExp(
|
|
89
|
+
escapeRegExpCharacters(`RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
85
90
|
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
|
|
86
91
|
id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
|
|
87
92
|
if (rootViewBackgroundColor != nil) {
|
|
@@ -91,10 +96,14 @@ const DEV_LAUNCHER_INIT_TO_REMOVE = `RCTBridge *bridge = [[RCTBridge alloc] init
|
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
94
|
-
UIViewController *rootViewController =
|
|
99
|
+
UIViewController *rootViewController = `) +
|
|
100
|
+
`([^;]+)` +
|
|
101
|
+
escapeRegExpCharacters(`;
|
|
95
102
|
rootViewController.view = rootView;
|
|
96
103
|
self.window.rootViewController = rootViewController;
|
|
97
|
-
[self.window makeKeyAndVisible]
|
|
104
|
+
[self.window makeKeyAndVisible];`),
|
|
105
|
+
'm'
|
|
106
|
+
);
|
|
98
107
|
|
|
99
108
|
const DEV_LAUNCHER_NEW_INIT = `self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
100
109
|
#if defined(EX_DEV_LAUNCHER_ENABLED)
|
|
@@ -104,7 +113,35 @@ const DEV_LAUNCHER_NEW_INIT = `self.window = [[UIWindow alloc] initWithFrame:[UI
|
|
|
104
113
|
[self initializeReactNativeApp:launchOptions];
|
|
105
114
|
#endif`;
|
|
106
115
|
|
|
107
|
-
const
|
|
116
|
+
const DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION_REGEX = new RegExp(
|
|
117
|
+
escapeRegExpCharacters(`
|
|
118
|
+
- (RCTBridge *)initializeReactNativeApp:(NSDictionary *)launchOptions
|
|
119
|
+
{
|
|
120
|
+
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
121
|
+
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
|
|
122
|
+
id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
|
|
123
|
+
if (rootViewBackgroundColor != nil) {
|
|
124
|
+
rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
|
|
125
|
+
} else {
|
|
126
|
+
rootView.backgroundColor = [UIColor whiteColor];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
UIViewController *rootViewController = `) +
|
|
130
|
+
`[^;]+` +
|
|
131
|
+
escapeRegExpCharacters(`;
|
|
132
|
+
rootViewController.view = rootView;
|
|
133
|
+
self.window.rootViewController = rootViewController;
|
|
134
|
+
[self.window makeKeyAndVisible];
|
|
135
|
+
|
|
136
|
+
return bridge;
|
|
137
|
+
}
|
|
138
|
+
`),
|
|
139
|
+
'm'
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION = (
|
|
143
|
+
viewControllerInit: string | undefined
|
|
144
|
+
) => `
|
|
108
145
|
- (RCTBridge *)initializeReactNativeApp:(NSDictionary *)launchOptions
|
|
109
146
|
{
|
|
110
147
|
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
@@ -116,7 +153,7 @@ const DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION = `
|
|
|
116
153
|
rootView.backgroundColor = [UIColor whiteColor];
|
|
117
154
|
}
|
|
118
155
|
|
|
119
|
-
UIViewController *rootViewController = [UIViewController new];
|
|
156
|
+
UIViewController *rootViewController = ${viewControllerInit ?? '[UIViewController new]'};
|
|
120
157
|
rootViewController.view = rootView;
|
|
121
158
|
self.window.rootViewController = rootViewController;
|
|
122
159
|
[self.window makeKeyAndVisible];
|
|
@@ -222,11 +259,17 @@ export function modifyAppDelegate(appDelegate: string, expoUpdatesVersion: strin
|
|
|
222
259
|
const shouldAddUpdatesIntegration =
|
|
223
260
|
expoUpdatesVersion != null && semver.gt(expoUpdatesVersion, '0.6.0');
|
|
224
261
|
|
|
225
|
-
if (!
|
|
226
|
-
if (
|
|
227
|
-
|
|
262
|
+
if (!DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION_REGEX.test(appDelegate)) {
|
|
263
|
+
if (DEV_LAUNCHER_INIT_TO_REMOVE.test(appDelegate)) {
|
|
264
|
+
// UIViewController can be initialized differently depending on whether expo-screen-orientation is installed,
|
|
265
|
+
// so we need to preserve whatever is there already.
|
|
266
|
+
let viewControllerInit;
|
|
267
|
+
appDelegate = appDelegate.replace(DEV_LAUNCHER_INIT_TO_REMOVE, (match, p1) => {
|
|
268
|
+
viewControllerInit = p1;
|
|
269
|
+
return DEV_LAUNCHER_NEW_INIT;
|
|
270
|
+
});
|
|
228
271
|
appDelegate = addLines(appDelegate, '@implementation AppDelegate', 1, [
|
|
229
|
-
DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION,
|
|
272
|
+
DEV_LAUNCHER_INITIALIZE_REACT_NATIVE_APP_FUNCTION_DEFINITION(viewControllerInit),
|
|
230
273
|
]);
|
|
231
274
|
} else {
|
|
232
275
|
WarningAggregator.addWarningIOS(
|