expo 58.0.1 → 58.0.2
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/android/build.gradle +2 -2
- package/bundledNativeModules.json +71 -71
- package/ios/Expo/ExpoReactNativeFactory.swift +2 -2
- package/ios/ExpoObjC/AppDelegates/EXReactRootViewFactory.mm +16 -2
- package/ios/ExpoObjC/include/Expo/EXReactRootViewFactory.h +2 -1
- package/package.json +11 -11
- package/scripts/spm/__tests__/app-target.test.js +105 -1
- package/scripts/spm/__tests__/autolink-gate.test.js +188 -0
- package/scripts/spm/__tests__/classify.test.js +17 -19
- package/scripts/spm/__tests__/diagnostics.test.js +705 -132
- package/scripts/spm/__tests__/manifests.test.js +1086 -75
- package/scripts/spm/__tests__/metadata.test.js +120 -0
- package/scripts/spm/__tests__/plugin.test.js +2549 -346
- package/scripts/spm/app-target.js +42 -1
- package/scripts/spm/autolink-gate.js +40 -0
- package/scripts/spm/classify.js +54 -77
- package/scripts/spm/diagnostics.js +540 -147
- package/scripts/spm/flavored-frameworks.js +80 -125
- package/scripts/spm/manifests.js +523 -205
- package/scripts/spm/metadata.js +152 -0
- package/scripts/spm/plugin.js +592 -277
- package/scripts/spm/podspec.js +56 -19
- package/template.tgz +0 -0
package/android/build.gradle
CHANGED
|
@@ -10,7 +10,7 @@ buildscript {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
group = 'host.exp.exponent'
|
|
13
|
-
version = '58.0.
|
|
13
|
+
version = '58.0.2'
|
|
14
14
|
|
|
15
15
|
expoModule {
|
|
16
16
|
// We can't prebuild the module because it depends on the generated files.
|
|
@@ -21,7 +21,7 @@ android {
|
|
|
21
21
|
namespace "expo.core"
|
|
22
22
|
defaultConfig {
|
|
23
23
|
versionCode 1
|
|
24
|
-
versionName "58.0.
|
|
24
|
+
versionName "58.0.2"
|
|
25
25
|
consumerProguardFiles("proguard-rules.pro")
|
|
26
26
|
}
|
|
27
27
|
testOptions {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"@expo/fingerprint": "~0.21.2",
|
|
4
4
|
"@expo/metro-runtime": "~58.0.10",
|
|
5
5
|
"@expo/vector-icons": "^15.0.2",
|
|
6
|
-
"@expo/ui": "~58.0.
|
|
6
|
+
"@expo/ui": "~58.0.11",
|
|
7
7
|
"@react-native-async-storage/async-storage": "2.2.0",
|
|
8
8
|
"@react-native-community/datetimepicker": "9.2.1",
|
|
9
9
|
"@react-native-masked-view/masked-view": "0.3.2",
|
|
@@ -16,88 +16,88 @@
|
|
|
16
16
|
"eslint-config-expo": "~58.0.4",
|
|
17
17
|
"expo-analytics-amplitude": "~11.3.0",
|
|
18
18
|
"expo-app-auth": "~11.1.0",
|
|
19
|
-
"expo-app-intents": "~0.
|
|
19
|
+
"expo-app-intents": "~0.5.0",
|
|
20
20
|
"expo-app-loader-provider": "~8.0.0",
|
|
21
|
-
"expo-app-metrics": "~58.0.
|
|
21
|
+
"expo-app-metrics": "~58.0.11",
|
|
22
22
|
"expo-apple-authentication": "~58.0.2",
|
|
23
|
-
"expo-application": "~58.0.
|
|
24
|
-
"expo-asset": "~58.0.
|
|
25
|
-
"expo-audio": "~58.0.
|
|
26
|
-
"expo-auth-session": "~58.0.
|
|
27
|
-
"expo-background-fetch": "~58.0.
|
|
28
|
-
"expo-background-task": "~58.0.
|
|
29
|
-
"expo-battery": "~58.0.
|
|
30
|
-
"expo-blur": "~58.0.
|
|
31
|
-
"expo-brightness": "~58.0.
|
|
32
|
-
"expo-brownfield": "~58.0.
|
|
23
|
+
"expo-application": "~58.0.3",
|
|
24
|
+
"expo-asset": "~58.0.10",
|
|
25
|
+
"expo-audio": "~58.0.4",
|
|
26
|
+
"expo-auth-session": "~58.0.7",
|
|
27
|
+
"expo-background-fetch": "~58.0.10",
|
|
28
|
+
"expo-background-task": "~58.0.10",
|
|
29
|
+
"expo-battery": "~58.0.3",
|
|
30
|
+
"expo-blur": "~58.0.3",
|
|
31
|
+
"expo-brightness": "~58.0.2",
|
|
32
|
+
"expo-brownfield": "~58.0.10",
|
|
33
33
|
"expo-build-properties": "~58.0.9",
|
|
34
|
-
"expo-calendar": "~58.0.
|
|
35
|
-
"expo-camera": "~58.0.
|
|
36
|
-
"expo-cellular": "~58.0.
|
|
34
|
+
"expo-calendar": "~58.0.6",
|
|
35
|
+
"expo-camera": "~58.0.7",
|
|
36
|
+
"expo-cellular": "~58.0.2",
|
|
37
37
|
"expo-checkbox": "~58.0.2",
|
|
38
|
-
"expo-clipboard": "~58.0.
|
|
38
|
+
"expo-clipboard": "~58.0.3",
|
|
39
39
|
"expo-constants": "~58.0.9",
|
|
40
|
-
"expo-contacts": "~58.0.
|
|
41
|
-
"expo-crypto": "~58.0.
|
|
42
|
-
"expo-dev-client": "~58.0.
|
|
43
|
-
"expo-device": "~58.0.
|
|
44
|
-
"expo-document-picker": "~58.0.
|
|
40
|
+
"expo-contacts": "~58.0.4",
|
|
41
|
+
"expo-crypto": "~58.0.4",
|
|
42
|
+
"expo-dev-client": "~58.0.10",
|
|
43
|
+
"expo-device": "~58.0.5",
|
|
44
|
+
"expo-document-picker": "~58.0.4",
|
|
45
45
|
"expo-eas-client": "~58.0.2",
|
|
46
|
-
"expo-file-system": "~58.0.
|
|
47
|
-
"expo-font": "~58.0.
|
|
48
|
-
"expo-gl": "~58.0.
|
|
46
|
+
"expo-file-system": "~58.0.5",
|
|
47
|
+
"expo-font": "~58.0.5",
|
|
48
|
+
"expo-gl": "~58.0.3",
|
|
49
49
|
"expo-glass-effect": "~58.0.3",
|
|
50
50
|
"expo-google-app-auth": "~8.3.0",
|
|
51
|
-
"expo-haptics": "~58.0.
|
|
52
|
-
"expo-image": "~58.0.
|
|
53
|
-
"expo-image-loader": "~58.0.
|
|
54
|
-
"expo-image-manipulator": "~58.0.
|
|
55
|
-
"expo-image-picker": "~58.0.
|
|
56
|
-
"expo-intent-launcher": "~58.0.
|
|
57
|
-
"expo-insights": "~58.0.
|
|
58
|
-
"expo-keep-awake": "~58.0.
|
|
59
|
-
"expo-linear-gradient": "~58.0.
|
|
60
|
-
"expo-linking": "~58.0.
|
|
61
|
-
"expo-local-authentication": "~58.0.
|
|
62
|
-
"expo-localization": "~58.0.
|
|
63
|
-
"expo-location": "~58.0.
|
|
64
|
-
"expo-mail-composer": "~58.0.
|
|
51
|
+
"expo-haptics": "~58.0.4",
|
|
52
|
+
"expo-image": "~58.0.10",
|
|
53
|
+
"expo-image-loader": "~58.0.3",
|
|
54
|
+
"expo-image-manipulator": "~58.0.11",
|
|
55
|
+
"expo-image-picker": "~58.0.10",
|
|
56
|
+
"expo-intent-launcher": "~58.0.3",
|
|
57
|
+
"expo-insights": "~58.0.11",
|
|
58
|
+
"expo-keep-awake": "~58.0.3",
|
|
59
|
+
"expo-linear-gradient": "~58.0.3",
|
|
60
|
+
"expo-linking": "~58.0.10",
|
|
61
|
+
"expo-local-authentication": "~58.0.2",
|
|
62
|
+
"expo-localization": "~58.0.3",
|
|
63
|
+
"expo-location": "~58.0.10",
|
|
64
|
+
"expo-mail-composer": "~58.0.3",
|
|
65
65
|
"expo-manifests": "~58.0.1",
|
|
66
|
-
"expo-maps": "~58.0.
|
|
66
|
+
"expo-maps": "~58.0.4",
|
|
67
67
|
"expo-mcp": "~0.2.1",
|
|
68
|
-
"expo-media-library": "~58.0.
|
|
69
|
-
"expo-mesh-gradient": "~58.0.
|
|
68
|
+
"expo-media-library": "~58.0.5",
|
|
69
|
+
"expo-mesh-gradient": "~58.0.3",
|
|
70
70
|
"expo-module-template": "~58.0.5",
|
|
71
|
-
"expo-modules-core": "~58.0.
|
|
72
|
-
"expo-navigation-bar": "~58.0.
|
|
73
|
-
"expo-network": "~58.0.
|
|
74
|
-
"expo-notifications": "~58.0.
|
|
75
|
-
"expo-observe": "~58.0.
|
|
76
|
-
"expo-print": "~58.0.
|
|
77
|
-
"expo-live-photo": "~58.0.
|
|
78
|
-
"expo-router": "~58.0.
|
|
79
|
-
"expo-screen-capture": "~58.0.
|
|
80
|
-
"expo-screen-orientation": "~58.0.
|
|
81
|
-
"expo-secure-store": "~58.0.
|
|
82
|
-
"expo-sensors": "~58.0.
|
|
71
|
+
"expo-modules-core": "~58.0.11",
|
|
72
|
+
"expo-navigation-bar": "~58.0.4",
|
|
73
|
+
"expo-network": "~58.0.3",
|
|
74
|
+
"expo-notifications": "~58.0.11",
|
|
75
|
+
"expo-observe": "~58.0.13",
|
|
76
|
+
"expo-print": "~58.0.4",
|
|
77
|
+
"expo-live-photo": "~58.0.3",
|
|
78
|
+
"expo-router": "~58.0.12",
|
|
79
|
+
"expo-screen-capture": "~58.0.5",
|
|
80
|
+
"expo-screen-orientation": "~58.0.2",
|
|
81
|
+
"expo-secure-store": "~58.0.2",
|
|
82
|
+
"expo-sensors": "~58.0.2",
|
|
83
83
|
"expo-server": "~58.0.2",
|
|
84
|
-
"expo-sharing": "~58.0.
|
|
85
|
-
"expo-sms": "~58.0.
|
|
86
|
-
"expo-speech": "~58.0.
|
|
87
|
-
"expo-splash-screen": "~58.0.
|
|
88
|
-
"expo-sqlite": "~58.0.
|
|
89
|
-
"expo-status-bar": "~58.0.
|
|
90
|
-
"expo-store-review": "~58.0.
|
|
84
|
+
"expo-sharing": "~58.0.13",
|
|
85
|
+
"expo-sms": "~58.0.2",
|
|
86
|
+
"expo-speech": "~58.0.3",
|
|
87
|
+
"expo-splash-screen": "~58.0.4",
|
|
88
|
+
"expo-sqlite": "~58.0.8",
|
|
89
|
+
"expo-status-bar": "~58.0.3",
|
|
90
|
+
"expo-store-review": "~58.0.2",
|
|
91
91
|
"expo-symbols": "~58.0.3",
|
|
92
|
-
"expo-system-ui": "~58.0.
|
|
93
|
-
"expo-task-manager": "~58.0.
|
|
94
|
-
"expo-tracking-transparency": "~58.0.
|
|
95
|
-
"expo-updates": "~58.0.
|
|
96
|
-
"expo-video-thumbnails": "~58.0.
|
|
97
|
-
"expo-video": "~58.0.
|
|
98
|
-
"expo-web-browser": "~58.0.
|
|
99
|
-
"expo-widgets": "~58.0.
|
|
100
|
-
"jest-expo": "~58.0.
|
|
92
|
+
"expo-system-ui": "~58.0.5",
|
|
93
|
+
"expo-task-manager": "~58.0.11",
|
|
94
|
+
"expo-tracking-transparency": "~58.0.2",
|
|
95
|
+
"expo-updates": "~58.0.13",
|
|
96
|
+
"expo-video-thumbnails": "~58.0.2",
|
|
97
|
+
"expo-video": "~58.0.6",
|
|
98
|
+
"expo-web-browser": "~58.0.4",
|
|
99
|
+
"expo-widgets": "~58.0.11",
|
|
100
|
+
"jest-expo": "~58.0.6",
|
|
101
101
|
"lottie-react-native": "~7.5.0",
|
|
102
102
|
"react": "19.3.0",
|
|
103
103
|
"react-dom": "19.3.0",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"react-native-webview": "14.0.1",
|
|
117
117
|
"react-server-dom-webpack": "~19.3.0",
|
|
118
118
|
"sentry-expo": "~7.0.0",
|
|
119
|
-
"unimodules-app-loader": "~58.0.
|
|
119
|
+
"unimodules-app-loader": "~58.0.2",
|
|
120
120
|
"unimodules-image-loader-interface": "~6.1.0",
|
|
121
121
|
"@shopify/react-native-skia": "2.13.1",
|
|
122
122
|
"@shopify/flash-list": "2.3.2",
|
|
@@ -127,7 +127,6 @@ public class ExpoReactNativeFactory: ExpoReactNativeFactoryObjC, ExpoReactNative
|
|
|
127
127
|
|
|
128
128
|
let rootView: UIView
|
|
129
129
|
if let factory = self.rootViewFactory as? ExpoReactRootViewFactory {
|
|
130
|
-
// RCTDevMenuConfiguration is only available in react-native 0.83+
|
|
131
130
|
// bundleConfiguration is only accepted in react-native 0.84+
|
|
132
131
|
#if os(iOS) || os(tvOS)
|
|
133
132
|
let bundleConfiguration = ExpoBundleConfiguration.configuration(
|
|
@@ -146,7 +145,8 @@ public class ExpoReactNativeFactory: ExpoReactNativeFactoryObjC, ExpoReactNative
|
|
|
146
145
|
rootView = factory.superView(
|
|
147
146
|
withModuleName: moduleName ?? defaultModuleName,
|
|
148
147
|
initialProperties: initialProps,
|
|
149
|
-
launchOptions: launchOptions ?? [:]
|
|
148
|
+
launchOptions: launchOptions ?? [:],
|
|
149
|
+
devMenuConfiguration: self.devMenuConfiguration
|
|
150
150
|
)
|
|
151
151
|
#endif
|
|
152
152
|
} else {
|
|
@@ -60,21 +60,35 @@
|
|
|
60
60
|
devMenuConfiguration:devMenuConfiguration];
|
|
61
61
|
}
|
|
62
62
|
#else
|
|
63
|
+
// react-native-macos routes every `viewWithModuleName:` variant, including the one called by
|
|
64
|
+
// `RCTReactNativeFactory`, through this one.
|
|
63
65
|
- (UIView *)viewWithModuleName:(NSString *)moduleName
|
|
64
66
|
initialProperties:(nullable NSDictionary *)initialProperties
|
|
65
67
|
launchOptions:(nullable NSDictionary *)launchOptions
|
|
68
|
+
devMenuConfiguration:(nullable RCTDevMenuConfiguration *)devMenuConfiguration
|
|
66
69
|
{
|
|
67
70
|
if (self.reactDelegate != nil) {
|
|
68
71
|
return [((id<EXReactDelegateProtocol>)self.reactDelegate) createReactRootViewWithModuleName:moduleName initialProperties:initialProperties launchOptions:launchOptions];
|
|
69
72
|
}
|
|
70
|
-
return [super viewWithModuleName:moduleName
|
|
73
|
+
return [super viewWithModuleName:moduleName
|
|
74
|
+
initialProperties:initialProperties
|
|
75
|
+
launchOptions:launchOptions
|
|
76
|
+
devMenuConfiguration:devMenuConfiguration];
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
- (UIView *)superViewWithModuleName:(NSString *)moduleName
|
|
74
80
|
initialProperties:(nullable NSDictionary *)initialProperties
|
|
75
81
|
launchOptions:(nullable NSDictionary *)launchOptions
|
|
82
|
+
devMenuConfiguration:(nullable RCTDevMenuConfiguration *)devMenuConfiguration
|
|
76
83
|
{
|
|
77
|
-
|
|
84
|
+
if (devMenuConfiguration == nil) {
|
|
85
|
+
devMenuConfiguration = [RCTDevMenuConfiguration defaultConfiguration];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return [super viewWithModuleName:moduleName
|
|
89
|
+
initialProperties:initialProperties
|
|
90
|
+
launchOptions:launchOptions
|
|
91
|
+
devMenuConfiguration:devMenuConfiguration];
|
|
78
92
|
}
|
|
79
93
|
#endif
|
|
80
94
|
|
|
@@ -33,7 +33,8 @@ NS_SWIFT_NAME(ExpoReactRootViewFactory)
|
|
|
33
33
|
#else
|
|
34
34
|
- (UIView *)superViewWithModuleName:(NSString *)moduleName
|
|
35
35
|
initialProperties:(nullable NSDictionary *)initialProperties
|
|
36
|
-
launchOptions:(nullable NSDictionary *)launchOptions
|
|
36
|
+
launchOptions:(nullable NSDictionary *)launchOptions
|
|
37
|
+
devMenuConfiguration:(nullable RCTDevMenuConfiguration *)devMenuConfiguration;
|
|
37
38
|
#endif
|
|
38
39
|
|
|
39
40
|
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.2",
|
|
4
4
|
"description": "The Expo SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expo"
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
},
|
|
202
202
|
"dependencies": {
|
|
203
203
|
"@babel/runtime": "^7.20.0",
|
|
204
|
-
"@expo/cli": "^58.1.
|
|
204
|
+
"@expo/cli": "^58.1.1",
|
|
205
205
|
"@expo/config": "~58.0.1",
|
|
206
206
|
"@expo/config-plugins": "~58.0.4",
|
|
207
207
|
"@expo/devtools": "~58.0.2",
|
|
@@ -211,16 +211,16 @@
|
|
|
211
211
|
"@expo/log-box": "^58.0.8",
|
|
212
212
|
"@expo/log-box-utils": "^58.0.1",
|
|
213
213
|
"@expo/metro": "~58.0.0-rc.0",
|
|
214
|
-
"@expo/metro-config": "~58.0.
|
|
214
|
+
"@expo/metro-config": "~58.0.7",
|
|
215
215
|
"@ungap/structured-clone": "^1.3.0",
|
|
216
|
-
"babel-preset-expo": "~58.0.
|
|
217
|
-
"expo-asset": "~58.0.
|
|
216
|
+
"babel-preset-expo": "~58.0.8",
|
|
217
|
+
"expo-asset": "~58.0.10",
|
|
218
218
|
"expo-constants": "~58.0.9",
|
|
219
|
-
"expo-file-system": "~58.0.
|
|
220
|
-
"expo-font": "~58.0.
|
|
221
|
-
"expo-keep-awake": "~58.0.
|
|
222
|
-
"expo-modules-autolinking": "~58.0.
|
|
223
|
-
"expo-modules-core": "~58.0.
|
|
219
|
+
"expo-file-system": "~58.0.5",
|
|
220
|
+
"expo-font": "~58.0.5",
|
|
221
|
+
"expo-keep-awake": "~58.0.3",
|
|
222
|
+
"expo-modules-autolinking": "~58.0.7",
|
|
223
|
+
"expo-modules-core": "~58.0.11",
|
|
224
224
|
"pretty-format": "^29.7.0",
|
|
225
225
|
"react-refresh": "^0.14.2",
|
|
226
226
|
"whatwg-url-minimum": "^0.2.0"
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
"@expo/metro-runtime": "58.0.10",
|
|
231
231
|
"@types/node": "^22.14.0",
|
|
232
232
|
"@types/react": "~19.3.0",
|
|
233
|
-
"expo-updates": "58.0.
|
|
233
|
+
"expo-updates": "58.0.13",
|
|
234
234
|
"npm-run-all2": "^8.0.4",
|
|
235
235
|
"react": "19.3.0",
|
|
236
236
|
"react-dom": "19.3.0",
|
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const os = require('os');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
|
-
const { resolveAppTarget } = require('../app-target');
|
|
7
|
+
const { readPodfileProperties, resolveAppTarget } = require('../app-target');
|
|
8
8
|
|
|
9
9
|
// The real project of apps/minimal-swiftpm: the entitlements derivation reads an
|
|
10
10
|
// Xcode project, so mocking one out would only assert our own fixture back.
|
|
@@ -368,3 +368,107 @@ describe('the Podfile properties file', () => {
|
|
|
368
368
|
expect(resolveAppTarget(makeApp()).podfilePropertiesPath).toBeNull();
|
|
369
369
|
});
|
|
370
370
|
});
|
|
371
|
+
|
|
372
|
+
describe('the Podfile properties', () => {
|
|
373
|
+
let tmp;
|
|
374
|
+
beforeAll(() => {
|
|
375
|
+
tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-podfile-properties-'));
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
/** Writes a Podfile.properties.json with `contents` and returns its path. */
|
|
379
|
+
const propertiesFile = (name, contents) => {
|
|
380
|
+
const file = path.join(tmp, name, 'Podfile.properties.json');
|
|
381
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
382
|
+
fs.writeFileSync(file, contents);
|
|
383
|
+
return file;
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
const thrownBy = (file) => {
|
|
387
|
+
try {
|
|
388
|
+
readPodfileProperties(file);
|
|
389
|
+
} catch (error) {
|
|
390
|
+
return error;
|
|
391
|
+
}
|
|
392
|
+
throw new Error(`${file} was read as properties instead of being refused`);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
it('are the properties the file declares', () => {
|
|
396
|
+
const file = propertiesFile(
|
|
397
|
+
'app',
|
|
398
|
+
JSON.stringify({ 'expo.jsEngine': 'hermes', 'expo.camera.barcode-scanner-enabled': 'false' })
|
|
399
|
+
);
|
|
400
|
+
expect(readPodfileProperties(file)).toEqual({
|
|
401
|
+
'expo.jsEngine': 'hermes',
|
|
402
|
+
'expo.camera.barcode-scanner-enabled': 'false',
|
|
403
|
+
});
|
|
404
|
+
expect(warn).not.toHaveBeenCalled();
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
// A file that vanished between `resolveAppTarget` finding it and this read is the
|
|
408
|
+
// same situation as an app that never ran CocoaPods, not a broken file.
|
|
409
|
+
it('are empty and silent when there is no file to read', () => {
|
|
410
|
+
const vanished = path.join(tmp, 'vanished', 'Podfile.properties.json');
|
|
411
|
+
fs.mkdirSync(path.dirname(vanished), { recursive: true });
|
|
412
|
+
const absent = path.join(tmp, 'absent', 'Podfile.properties.json');
|
|
413
|
+
for (const input of [undefined, null, '', {}, [], absent, vanished]) {
|
|
414
|
+
expect(readPodfileProperties(input)).toEqual({});
|
|
415
|
+
}
|
|
416
|
+
expect(warn).not.toHaveBeenCalled();
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// The namespace is what makes a failed sync attributable to this plugin, and a
|
|
420
|
+
// stop is not one of this file's warnings however it is worded.
|
|
421
|
+
it('fail the sync with a namespaced error rather than a warning', () => {
|
|
422
|
+
const { message } = thrownBy(propertiesFile('namespaced', 'null'));
|
|
423
|
+
expect(message.startsWith('[expo-spm-plugin] ')).toBe(true);
|
|
424
|
+
expect(message).not.toContain('WARNING');
|
|
425
|
+
expect(message).toContain('leave each gated product to its own default');
|
|
426
|
+
expect(message).toContain('npx react-native spm update');
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
// An unset property leaves its gate at that gate's own default, so no fallback is
|
|
430
|
+
// neutral: a clobbered file read as no properties links or drops products against
|
|
431
|
+
// the app's configuration, silently.
|
|
432
|
+
it('fail the sync when the file is not valid JSON', () => {
|
|
433
|
+
const file = propertiesFile('malformed', '{ "expo.jsEngine": ');
|
|
434
|
+
const error = thrownBy(file);
|
|
435
|
+
expect(error.message).toContain(`${file} could not be read as Podfile properties`);
|
|
436
|
+
expect(error.message).toContain(error.cause.message);
|
|
437
|
+
expect(error.cause).toBeInstanceOf(Error);
|
|
438
|
+
expect(warn).not.toHaveBeenCalled();
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it('fail the sync when the file cannot be read', () => {
|
|
442
|
+
const directory = path.join(tmp, 'unreadable', 'Podfile.properties.json');
|
|
443
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
444
|
+
const error = thrownBy(directory);
|
|
445
|
+
expect(error.message).toContain(directory);
|
|
446
|
+
expect(error.message).toContain(error.cause.message);
|
|
447
|
+
expect(error.cause.code).toBe('EISDIR');
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
// CocoaPods writes an object; anything else is a file some other tool clobbered.
|
|
451
|
+
it.each([
|
|
452
|
+
['[]', 'an array'],
|
|
453
|
+
['"hermes"', 'a string'],
|
|
454
|
+
['17', 'a number'],
|
|
455
|
+
['null', 'null'],
|
|
456
|
+
['true', 'a boolean'],
|
|
457
|
+
])('fail the sync when the file holds %s instead of an object', (contents, held) => {
|
|
458
|
+
const file = propertiesFile(`not-an-object-${encodeURIComponent(contents)}`, contents);
|
|
459
|
+
const error = thrownBy(file);
|
|
460
|
+
expect(error.message).toContain(`${file} could not be read as Podfile properties`);
|
|
461
|
+
expect(error.message).toContain(`it holds ${held}, not an object`);
|
|
462
|
+
expect(error.cause).toBeUndefined();
|
|
463
|
+
expect(warn).not.toHaveBeenCalled();
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// The error describes the payload's type and never renders the payload: a
|
|
467
|
+
// structure this deep parses fine and then overflows the stack in
|
|
468
|
+
// `JSON.stringify`, which would replace the diagnostic with a stack overflow.
|
|
469
|
+
it('fail the sync for a payload no one can print', () => {
|
|
470
|
+
const depth = 50_000;
|
|
471
|
+
const file = propertiesFile('too-deep', '['.repeat(depth) + ']'.repeat(depth));
|
|
472
|
+
expect(thrownBy(file).message).toContain('it holds an array, not an object');
|
|
473
|
+
});
|
|
474
|
+
});
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
autolinkConditionKey,
|
|
5
|
+
autolinkConditionLabel,
|
|
6
|
+
autolinkConditionMet,
|
|
7
|
+
} = require('../autolink-gate');
|
|
8
|
+
|
|
9
|
+
/** expo-camera's barcode scanner, the only gated product shipping today. */
|
|
10
|
+
const BARCODE_SCANNER = {
|
|
11
|
+
podfileProperty: 'expo.camera.barcode-scanner-enabled',
|
|
12
|
+
disabledValue: 'false',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const met = (condition, options) => autolinkConditionMet(condition, options);
|
|
16
|
+
|
|
17
|
+
describe('a condition on a sibling pod', () => {
|
|
18
|
+
const condition = { podName: 'ExpoCamera' };
|
|
19
|
+
|
|
20
|
+
it('is met when the install declares that pod', () => {
|
|
21
|
+
expect(met(condition, { declaredPodNames: new Set(['ExpoModulesCore', 'ExpoCamera']) })).toBe(
|
|
22
|
+
true
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('is not met when nothing declares it', () => {
|
|
27
|
+
expect(met(condition, { declaredPodNames: new Set(['ExpoModulesCore']) })).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Declared, not linked: a pod the install declares but cannot build still
|
|
31
|
+
// decides the gate, exactly as CocoaPods' registry of declared products does.
|
|
32
|
+
// Reading a set of already-linked pods instead would make the answer depend on
|
|
33
|
+
// how far the emit loop had got.
|
|
34
|
+
it('is not met when the caller passes no declared pods', () => {
|
|
35
|
+
expect(met(condition)).toBe(false);
|
|
36
|
+
expect(met(condition, {})).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('a condition on an npm package', () => {
|
|
41
|
+
const condition = { npmPackage: 'expo-camera' };
|
|
42
|
+
|
|
43
|
+
it('is met when the app autolinks that package', () => {
|
|
44
|
+
expect(met(condition, { autolinkedPackages: new Set(['expo', 'expo-camera']) })).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('is not met when it does not', () => {
|
|
48
|
+
expect(met(condition, { autolinkedPackages: new Set(['expo']) })).toBe(false);
|
|
49
|
+
expect(met(condition)).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('a condition on a Podfile property', () => {
|
|
54
|
+
// Opt-out, not opt-in: the product links unless the app turned it off. Reading
|
|
55
|
+
// this the other way round drops a module from every app that never set it.
|
|
56
|
+
it('is met when the app declares no such property', () => {
|
|
57
|
+
expect(met(BARCODE_SCANNER, { podfileProperties: { 'expo.jsEngine': 'hermes' } })).toBe(true);
|
|
58
|
+
expect(met(BARCODE_SCANNER, { podfileProperties: {} })).toBe(true);
|
|
59
|
+
expect(met(BARCODE_SCANNER)).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('is not met when the property holds the disabled value', () => {
|
|
63
|
+
expect(
|
|
64
|
+
met(BARCODE_SCANNER, {
|
|
65
|
+
podfileProperties: { 'expo.camera.barcode-scanner-enabled': 'false' },
|
|
66
|
+
})
|
|
67
|
+
).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('is met when the property holds any other value', () => {
|
|
71
|
+
for (const value of ['true', 'FALSE', '', 'no']) {
|
|
72
|
+
expect(
|
|
73
|
+
met(BARCODE_SCANNER, {
|
|
74
|
+
podfileProperties: { 'expo.camera.barcode-scanner-enabled': value },
|
|
75
|
+
})
|
|
76
|
+
).toBe(true);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Nothing can equal the value the product never declared, so only a property
|
|
81
|
+
// that is actually set can satisfy such a condition.
|
|
82
|
+
it('declaring no disabled value is met only while the property is set', () => {
|
|
83
|
+
const condition = { podfileProperty: 'expo.camera.barcode-scanner-enabled' };
|
|
84
|
+
expect(met(condition, { podfileProperties: {} })).toBe(false);
|
|
85
|
+
expect(
|
|
86
|
+
met(condition, { podfileProperties: { 'expo.camera.barcode-scanner-enabled': 'false' } })
|
|
87
|
+
).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Ruby reads an unset property and an absent value as the same nil, so a
|
|
91
|
+
// product disabled by null is disabled by default there. Comparing undefined
|
|
92
|
+
// against null instead would link it here and withhold it under CocoaPods.
|
|
93
|
+
it('declaring null as its disabled value reads the same as declaring none', () => {
|
|
94
|
+
const condition = {
|
|
95
|
+
podfileProperty: 'expo.camera.barcode-scanner-enabled',
|
|
96
|
+
disabledValue: null,
|
|
97
|
+
};
|
|
98
|
+
expect(met(condition, { podfileProperties: {} })).toBe(false);
|
|
99
|
+
expect(met(condition)).toBe(false);
|
|
100
|
+
expect(
|
|
101
|
+
met(condition, { podfileProperties: { 'expo.camera.barcode-scanner-enabled': 'false' } })
|
|
102
|
+
).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('is not met when the property itself is set to null and nothing is disabled', () => {
|
|
106
|
+
expect(
|
|
107
|
+
met(
|
|
108
|
+
{ podfileProperty: 'expo.camera.barcode-scanner-enabled' },
|
|
109
|
+
{ podfileProperties: { 'expo.camera.barcode-scanner-enabled': null } }
|
|
110
|
+
)
|
|
111
|
+
).toBe(false);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('a condition declaring several keys', () => {
|
|
116
|
+
const condition = {
|
|
117
|
+
podName: 'ExpoCamera',
|
|
118
|
+
npmPackage: 'expo-camera',
|
|
119
|
+
podfileProperty: 'expo.camera.barcode-scanner-enabled',
|
|
120
|
+
disabledValue: 'false',
|
|
121
|
+
};
|
|
122
|
+
const options = {
|
|
123
|
+
autolinkedPackages: new Set(['expo-camera']),
|
|
124
|
+
podfileProperties: {},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
it('is decided by its pod name alone', () => {
|
|
128
|
+
expect(met(condition, { ...options, declaredPodNames: new Set(['ExpoCamera']) })).toBe(true);
|
|
129
|
+
expect(met(condition, { ...options, declaredPodNames: new Set() })).toBe(false);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('falls through to its npm package only when it names no pod', () => {
|
|
133
|
+
const withoutPodName = { npmPackage: condition.npmPackage, ...BARCODE_SCANNER };
|
|
134
|
+
expect(met(withoutPodName, { ...options, declaredPodNames: new Set() })).toBe(true);
|
|
135
|
+
expect(met(withoutPodName, { ...options, autolinkedPackages: new Set() })).toBe(false);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('reaches its Podfile property only when it names neither', () => {
|
|
139
|
+
expect(met(BARCODE_SCANNER, { ...options, declaredPodNames: new Set() })).toBe(true);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
describe('a condition naming nothing to gate on', () => {
|
|
144
|
+
it.each([[undefined], [null], [{}], [{ disabledValue: 'false' }], ['expo-camera'], [42]])(
|
|
145
|
+
'is not met (%p)',
|
|
146
|
+
(condition) => {
|
|
147
|
+
expect(
|
|
148
|
+
met(condition, {
|
|
149
|
+
declaredPodNames: new Set(['ExpoCamera']),
|
|
150
|
+
autolinkedPackages: new Set(['expo-camera']),
|
|
151
|
+
podfileProperties: { 'expo.camera.barcode-scanner-enabled': 'true' },
|
|
152
|
+
})
|
|
153
|
+
).toBe(false);
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
describe('the label of a condition', () => {
|
|
159
|
+
it('is whichever key decides it', () => {
|
|
160
|
+
expect(autolinkConditionLabel({ podName: 'ExpoCamera', npmPackage: 'expo-camera' })).toBe(
|
|
161
|
+
'ExpoCamera'
|
|
162
|
+
);
|
|
163
|
+
expect(autolinkConditionLabel({ npmPackage: 'expo-camera', ...BARCODE_SCANNER })).toBe(
|
|
164
|
+
'expo-camera'
|
|
165
|
+
);
|
|
166
|
+
expect(autolinkConditionLabel(BARCODE_SCANNER)).toBe('expo.camera.barcode-scanner-enabled');
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('is null when it names nothing', () => {
|
|
170
|
+
expect(autolinkConditionLabel({})).toBeNull();
|
|
171
|
+
expect(autolinkConditionLabel(undefined)).toBeNull();
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
describe('the key that decides a condition', () => {
|
|
176
|
+
it('is the first one it declares', () => {
|
|
177
|
+
expect(autolinkConditionKey({ podName: 'ExpoCamera', ...BARCODE_SCANNER })).toBe('podName');
|
|
178
|
+
expect(autolinkConditionKey({ npmPackage: 'expo-camera', ...BARCODE_SCANNER })).toBe(
|
|
179
|
+
'npmPackage'
|
|
180
|
+
);
|
|
181
|
+
expect(autolinkConditionKey(BARCODE_SCANNER)).toBe('podfileProperty');
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('is null when it names nothing', () => {
|
|
185
|
+
expect(autolinkConditionKey({ disabledValue: 'false' })).toBeNull();
|
|
186
|
+
expect(autolinkConditionKey(undefined)).toBeNull();
|
|
187
|
+
});
|
|
188
|
+
});
|