expo 58.0.16 → 58.0.17
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 +26 -26
- package/package.json +16 -15
- package/scripts/spm/README.md +23 -6
- package/scripts/spm/__tests__/app-target.test.js +3 -2
- package/scripts/spm/__tests__/commands.test.js +34 -0
- package/scripts/spm/__tests__/diagnostics.test.js +2 -0
- package/scripts/spm/__tests__/flavored-frameworks.test.js +185 -0
- package/scripts/spm/__tests__/manifests.test.js +104 -0
- package/scripts/spm/__tests__/plugin.test.js +206 -1
- package/scripts/spm/__tests__/script-phases.test.js +326 -0
- package/scripts/spm/app-target.js +4 -3
- package/scripts/spm/commands.js +32 -0
- package/scripts/spm/diagnostics.js +6 -4
- package/scripts/spm/flavored-frameworks.js +78 -3
- package/scripts/spm/manifests.js +60 -7
- package/scripts/spm/plugin.js +78 -7
- package/scripts/spm/script-phases.js +54 -0
- package/src/__tests__/tsconfig-base-export.test.node.ts +23 -0
- 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.17'
|
|
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.17"
|
|
25
25
|
consumerProguardFiles("proguard-rules.pro")
|
|
26
26
|
}
|
|
27
27
|
testOptions {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@expo/dom-webview": "~58.0.2",
|
|
3
|
-
"@expo/fingerprint": "~0.21.
|
|
4
|
-
"@expo/metro-runtime": "~58.0.
|
|
3
|
+
"@expo/fingerprint": "~0.21.6",
|
|
4
|
+
"@expo/metro-runtime": "~58.0.15",
|
|
5
5
|
"@expo/vector-icons": "^15.0.2",
|
|
6
|
-
"@expo/ui": "~58.0.
|
|
6
|
+
"@expo/ui": "~58.0.22",
|
|
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,27 +16,27 @@
|
|
|
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.5.
|
|
19
|
+
"expo-app-intents": "~0.5.11",
|
|
20
20
|
"expo-app-loader-provider": "~8.0.0",
|
|
21
|
-
"expo-app-metrics": "~58.0.
|
|
21
|
+
"expo-app-metrics": "~58.0.14",
|
|
22
22
|
"expo-apple-authentication": "~58.0.2",
|
|
23
23
|
"expo-application": "~58.1.2",
|
|
24
|
-
"expo-asset": "~58.0.
|
|
25
|
-
"expo-audio": "~58.0.
|
|
26
|
-
"expo-auth-session": "~58.0.
|
|
24
|
+
"expo-asset": "~58.0.18",
|
|
25
|
+
"expo-audio": "~58.0.10",
|
|
26
|
+
"expo-auth-session": "~58.0.14",
|
|
27
27
|
"expo-background-fetch": "~58.0.11",
|
|
28
28
|
"expo-background-task": "~58.0.11",
|
|
29
29
|
"expo-battery": "~58.0.3",
|
|
30
30
|
"expo-blur": "~58.0.5",
|
|
31
31
|
"expo-brightness": "~58.0.2",
|
|
32
|
-
"expo-brownfield": "~58.0.
|
|
32
|
+
"expo-brownfield": "~58.0.16",
|
|
33
33
|
"expo-build-properties": "~58.0.11",
|
|
34
34
|
"expo-calendar": "~58.0.6",
|
|
35
|
-
"expo-camera": "~58.0.
|
|
35
|
+
"expo-camera": "~58.0.12",
|
|
36
36
|
"expo-cellular": "~58.0.3",
|
|
37
37
|
"expo-checkbox": "~58.0.2",
|
|
38
|
-
"expo-clipboard": "~58.0.
|
|
39
|
-
"expo-constants": "~58.0.
|
|
38
|
+
"expo-clipboard": "~58.0.4",
|
|
39
|
+
"expo-constants": "~58.0.13",
|
|
40
40
|
"expo-contacts": "~58.0.8",
|
|
41
41
|
"expo-crypto": "~58.0.7",
|
|
42
42
|
"expo-dev-client": "~58.0.14",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"expo-glass-effect": "~58.0.4",
|
|
50
50
|
"expo-google-app-auth": "~8.3.0",
|
|
51
51
|
"expo-haptics": "~58.0.7",
|
|
52
|
-
"expo-hinge": "~58.0.
|
|
52
|
+
"expo-hinge": "~58.0.2",
|
|
53
53
|
"expo-image": "~58.0.16",
|
|
54
54
|
"expo-image-loader": "~58.0.3",
|
|
55
55
|
"expo-image-manipulator": "~58.0.15",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"expo-insights": "~58.0.11",
|
|
59
59
|
"expo-keep-awake": "~58.0.3",
|
|
60
60
|
"expo-linear-gradient": "~58.0.3",
|
|
61
|
-
"expo-linking": "~58.0.
|
|
61
|
+
"expo-linking": "~58.0.14",
|
|
62
62
|
"expo-local-authentication": "~58.0.2",
|
|
63
63
|
"expo-localization": "~58.0.5",
|
|
64
64
|
"expo-location": "~58.0.18",
|
|
@@ -69,36 +69,36 @@
|
|
|
69
69
|
"expo-media-library": "~58.0.11",
|
|
70
70
|
"expo-mesh-gradient": "~58.0.3",
|
|
71
71
|
"expo-module-template": "~58.0.8",
|
|
72
|
-
"expo-modules-core": "~58.0.
|
|
72
|
+
"expo-modules-core": "~58.0.24",
|
|
73
73
|
"expo-navigation-bar": "~58.0.4",
|
|
74
|
-
"expo-network": "~58.0.
|
|
75
|
-
"expo-notifications": "~58.1.
|
|
76
|
-
"expo-observe": "~58.0.
|
|
74
|
+
"expo-network": "~58.0.4",
|
|
75
|
+
"expo-notifications": "~58.1.6",
|
|
76
|
+
"expo-observe": "~58.0.16",
|
|
77
77
|
"expo-print": "~58.0.7",
|
|
78
78
|
"expo-live-photo": "~58.0.6",
|
|
79
|
-
"expo-router": "~58.0.
|
|
80
|
-
"expo-screen-capture": "~58.0.
|
|
79
|
+
"expo-router": "~58.0.25",
|
|
80
|
+
"expo-screen-capture": "~58.0.6",
|
|
81
81
|
"expo-screen-orientation": "~58.0.3",
|
|
82
82
|
"expo-secure-store": "~58.0.2",
|
|
83
83
|
"expo-sensors": "~58.0.4",
|
|
84
84
|
"expo-server": "~58.0.5",
|
|
85
|
-
"expo-sharing": "~58.0.
|
|
85
|
+
"expo-sharing": "~58.0.20",
|
|
86
86
|
"expo-sms": "~58.0.2",
|
|
87
87
|
"expo-speech": "~58.0.3",
|
|
88
|
-
"expo-splash-screen": "~58.0.
|
|
88
|
+
"expo-splash-screen": "~58.0.11",
|
|
89
89
|
"expo-sqlite": "~58.0.13",
|
|
90
|
-
"expo-status-bar": "~58.0.
|
|
90
|
+
"expo-status-bar": "~58.0.4",
|
|
91
91
|
"expo-store-review": "~58.0.2",
|
|
92
92
|
"expo-symbols": "~58.0.4",
|
|
93
93
|
"expo-system-ui": "~58.0.6",
|
|
94
94
|
"expo-task-manager": "~58.0.12",
|
|
95
95
|
"expo-tracking-transparency": "~58.0.2",
|
|
96
|
-
"expo-updates": "~58.0.
|
|
96
|
+
"expo-updates": "~58.0.18",
|
|
97
97
|
"expo-video-thumbnails": "~58.0.2",
|
|
98
98
|
"expo-video": "~58.0.12",
|
|
99
99
|
"expo-web-browser": "~58.0.6",
|
|
100
|
-
"expo-widgets": "~58.0.
|
|
101
|
-
"jest-expo": "~58.0.
|
|
100
|
+
"expo-widgets": "~58.0.22",
|
|
101
|
+
"jest-expo": "~58.0.12",
|
|
102
102
|
"lottie-react-native": "~7.5.0",
|
|
103
103
|
"react": "19.3.0",
|
|
104
104
|
"react-dom": "19.3.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.17",
|
|
4
4
|
"description": "The Expo SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expo"
|
|
@@ -194,6 +194,7 @@
|
|
|
194
194
|
"./scripts/*": "./scripts/*.js",
|
|
195
195
|
"./bin/*": "./bin/*",
|
|
196
196
|
"./package.json": "./package.json",
|
|
197
|
+
"./tsconfig.base": "./tsconfig.base.json",
|
|
197
198
|
"./*.json": "./*.json",
|
|
198
199
|
"./*": {
|
|
199
200
|
"types": "./*.d.ts",
|
|
@@ -211,36 +212,36 @@
|
|
|
211
212
|
},
|
|
212
213
|
"dependencies": {
|
|
213
214
|
"@babel/runtime": "^7.20.0",
|
|
214
|
-
"@expo/cli": "^58.1.
|
|
215
|
-
"@expo/config": "~58.0.
|
|
216
|
-
"@expo/config-plugins": "~58.0.
|
|
215
|
+
"@expo/cli": "^58.1.14",
|
|
216
|
+
"@expo/config": "~58.0.7",
|
|
217
|
+
"@expo/config-plugins": "~58.0.10",
|
|
217
218
|
"@expo/devtools": "~58.0.2",
|
|
218
219
|
"@expo/dom-webview": "~58.0.2",
|
|
219
|
-
"@expo/fingerprint": "^0.21.
|
|
220
|
-
"@expo/local-build-cache-provider": "^58.0.
|
|
221
|
-
"@expo/log-box": "^58.0.
|
|
220
|
+
"@expo/fingerprint": "^0.21.6",
|
|
221
|
+
"@expo/local-build-cache-provider": "^58.0.7",
|
|
222
|
+
"@expo/log-box": "^58.0.13",
|
|
222
223
|
"@expo/log-box-utils": "^58.0.2",
|
|
223
224
|
"@expo/metro": "~58.0.0",
|
|
224
|
-
"@expo/metro-config": "~58.0.
|
|
225
|
+
"@expo/metro-config": "~58.0.16",
|
|
225
226
|
"@ungap/structured-clone": "^1.3.0",
|
|
226
|
-
"babel-preset-expo": "~58.0.
|
|
227
|
-
"expo-asset": "~58.0.
|
|
228
|
-
"expo-constants": "~58.0.
|
|
227
|
+
"babel-preset-expo": "~58.0.19",
|
|
228
|
+
"expo-asset": "~58.0.18",
|
|
229
|
+
"expo-constants": "~58.0.13",
|
|
229
230
|
"expo-file-system": "~58.0.10",
|
|
230
231
|
"expo-font": "~58.0.9",
|
|
231
232
|
"expo-keep-awake": "~58.0.3",
|
|
232
|
-
"expo-modules-autolinking": "~58.0.
|
|
233
|
+
"expo-modules-autolinking": "~58.0.14",
|
|
233
234
|
"expo-modules-cli": "~0.3.1",
|
|
234
|
-
"expo-modules-core": "~58.0.
|
|
235
|
+
"expo-modules-core": "~58.0.24",
|
|
235
236
|
"pretty-format": "^29.7.0",
|
|
236
237
|
"react-refresh": "^0.14.2",
|
|
237
238
|
"whatwg-url-minimum": "^0.2.0"
|
|
238
239
|
},
|
|
239
240
|
"devDependencies": {
|
|
240
|
-
"@expo/metro-runtime": "58.0.
|
|
241
|
+
"@expo/metro-runtime": "58.0.15",
|
|
241
242
|
"@types/node": "^22.14.0",
|
|
242
243
|
"@types/react": "~19.3.0",
|
|
243
|
-
"expo-updates": "58.0.
|
|
244
|
+
"expo-updates": "58.0.18",
|
|
244
245
|
"npm-run-all2": "^8.0.4",
|
|
245
246
|
"react": "19.3.0",
|
|
246
247
|
"react-dom": "19.3.0",
|
package/scripts/spm/README.md
CHANGED
|
@@ -36,18 +36,21 @@ returns, so `spm add` and `spm update` always receive both real paths. Expo's
|
|
|
36
36
|
prebuild command builds Debug and Release by default; do not use a single-flavor
|
|
37
37
|
prebuild for an app that consumes the SwiftPM plugin.
|
|
38
38
|
|
|
39
|
-
Lookup runs for **every** resolved pod
|
|
40
|
-
with a `spm.config.json` product is
|
|
41
|
-
moment its artifact exists — no
|
|
42
|
-
needed. Path 3 is the
|
|
39
|
+
Lookup runs for **every** resolved pod except ExpoModulesJSI (see below), not
|
|
40
|
+
just the core frameworks. Any module with a `spm.config.json` product is
|
|
41
|
+
consumed as a precompiled framework the moment its artifact exists — no
|
|
42
|
+
`Package.swift` is generated for it, and none is needed. Path 3 is the
|
|
43
|
+
published-package case: a module shipping
|
|
43
44
|
`prebuilds/output/<flavor>/xcframeworks` is picked up with no local build.
|
|
44
45
|
|
|
45
46
|
React Native normalizes the declared pairs into immutable app-local Debug and
|
|
46
47
|
Release slots. Xcode then selects, exact-links, embeds, and signs the right slot
|
|
47
48
|
for each configuration. Configurations containing `debug` or `development` use
|
|
48
49
|
Debug; all others use Release. Adding, removing, or changing a flavored Expo
|
|
49
|
-
framework requires `
|
|
50
|
-
refreshes invariant source/codegen
|
|
50
|
+
framework requires `node <path to react-native>/scripts/setup-apple-spm.js update`,
|
|
51
|
+
run from the app root; build-time `spm sync` only refreshes invariant source/codegen
|
|
52
|
+
output. The command runs React Native's script directly, because Expo apps do not use
|
|
53
|
+
`@react-native-community/cli`, the wrapper that provides `react-native spm`.
|
|
51
54
|
|
|
52
55
|
## SwiftPM graph
|
|
53
56
|
|
|
@@ -64,6 +67,20 @@ ExpoModulesCore module map itself declares `use React`, so these invariant
|
|
|
64
67
|
carriers are needed even when a module does not import React directly. The
|
|
65
68
|
plugin does not infer runtime React or Hermes products.
|
|
66
69
|
|
|
70
|
+
## ExpoModulesJSI
|
|
71
|
+
|
|
72
|
+
ExpoModulesJSI is never linked as a precompiled framework, even when a Debug and
|
|
73
|
+
Release pair exists, because it must be compiled against the app's React Native.
|
|
74
|
+
npm ships only its headers, `ExpoModulesJSIHeaders`, found with the lookup above
|
|
75
|
+
in `headers/xcframeworks`. The plugin wraps them in a generated
|
|
76
|
+
`ExpoModulesJSIHeaders` package that every Expo source package depends on, and
|
|
77
|
+
adds the app target build phase "Build ExpoModulesJSI". Before the app's sources
|
|
78
|
+
compile, the phase finds the installed `expo-modules-jsi` and runs its
|
|
79
|
+
`apple/scripts/build-swiftpm-app-phase.sh`, which builds the framework into the
|
|
80
|
+
build folder, then copies it to where the app links and embeds it. When the
|
|
81
|
+
headers carry an `expo-package.json` version stamp, sync fails if that version differs
|
|
82
|
+
from the installed `expo-modules-jsi` or from the copy the phase builds.
|
|
83
|
+
|
|
67
84
|
## Unsupported modules
|
|
68
85
|
|
|
69
86
|
A module the plugin cannot contribute aborts autolinking. Dropping it would not
|
|
@@ -5,6 +5,7 @@ const os = require('os');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
7
|
const { readPodfileProperties, resolveAppTarget } = require('../app-target');
|
|
8
|
+
const { spmUpdateCommand } = require('../commands');
|
|
8
9
|
|
|
9
10
|
// The real project of apps/minimal-swiftpm: the entitlements derivation reads an
|
|
10
11
|
// Xcode project, so mocking one out would only assert our own fixture back.
|
|
@@ -207,7 +208,7 @@ describe('the entitlements file', () => {
|
|
|
207
208
|
const appRoot = makeApp({ marker: { target: 'renamed' } });
|
|
208
209
|
expect(resolveAppTarget(appRoot).entitlementPath).toBeNull();
|
|
209
210
|
expect(warnings()).toContain('"renamed"');
|
|
210
|
-
expect(warnings()).toContain(
|
|
211
|
+
expect(warnings()).toContain(spmUpdateCommand());
|
|
211
212
|
// The project parsed fine; only the target was missing.
|
|
212
213
|
expect(warnings()).not.toContain('could not be read');
|
|
213
214
|
});
|
|
@@ -423,7 +424,7 @@ describe('the Podfile properties', () => {
|
|
|
423
424
|
expect(message.startsWith('[expo-spm-plugin] ')).toBe(true);
|
|
424
425
|
expect(message).not.toContain('WARNING');
|
|
425
426
|
expect(message).toContain('leave each gated product to its own default');
|
|
426
|
-
expect(message).toContain(
|
|
427
|
+
expect(message).toContain(spmUpdateCommand());
|
|
427
428
|
});
|
|
428
429
|
|
|
429
430
|
// An unset property leaves its gate at that gate's own default, so no fallback is
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { configureSpmUpdateCommand, spmUpdateCommand } = require('../commands');
|
|
4
|
+
|
|
5
|
+
describe('spmUpdateCommand', () => {
|
|
6
|
+
afterEach(() => configureSpmUpdateCommand());
|
|
7
|
+
|
|
8
|
+
it("runs React Native's setup script from the app's node_modules by default", () => {
|
|
9
|
+
expect(spmUpdateCommand()).toBe(
|
|
10
|
+
'node node_modules/react-native/scripts/setup-apple-spm.js update'
|
|
11
|
+
);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('runs the script of a hoisted react-native, relative to the app root', () => {
|
|
15
|
+
configureSpmUpdateCommand({
|
|
16
|
+
appRoot: '/repo/apps/mobile',
|
|
17
|
+
reactNativeRoot: '/repo/node_modules/react-native',
|
|
18
|
+
});
|
|
19
|
+
expect(spmUpdateCommand()).toBe(
|
|
20
|
+
'node ../../node_modules/react-native/scripts/setup-apple-spm.js update'
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('returns to the default when configured with nothing', () => {
|
|
25
|
+
configureSpmUpdateCommand({
|
|
26
|
+
appRoot: '/repo/apps/mobile',
|
|
27
|
+
reactNativeRoot: '/repo/node_modules/react-native',
|
|
28
|
+
});
|
|
29
|
+
configureSpmUpdateCommand();
|
|
30
|
+
expect(spmUpdateCommand()).toBe(
|
|
31
|
+
'node node_modules/react-native/scripts/setup-apple-spm.js update'
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -19,6 +19,7 @@ const {
|
|
|
19
19
|
renderPartlyProvidedPackageWarning,
|
|
20
20
|
renderExtraPodsWarning,
|
|
21
21
|
} = require('../diagnostics');
|
|
22
|
+
const { spmUpdateCommand } = require('../commands');
|
|
22
23
|
const { resolvePodIdentities, uncoveredPod } = require('../plugin');
|
|
23
24
|
const { podspecDependencies } = require('../podspec');
|
|
24
25
|
|
|
@@ -763,6 +764,7 @@ describe('a module installed twice', () => {
|
|
|
763
764
|
expect(report).toContain('/app/node_modules/some-lib/node_modules/expo-camera');
|
|
764
765
|
expect(report).toContain('npm ls expo-camera');
|
|
765
766
|
expect(report).toContain('dedupe');
|
|
767
|
+
expect(report).toContain(spmUpdateCommand());
|
|
766
768
|
expect(report).toContain("your app's JavaScript imports the second");
|
|
767
769
|
expect(report).toContain('usually surfaces at runtime');
|
|
768
770
|
expect(report).toContain('can fail the build');
|
|
@@ -7,12 +7,16 @@ const path = require('path');
|
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
9
|
FLAVORS,
|
|
10
|
+
assertHeadersMatchSources,
|
|
10
11
|
byteOrder,
|
|
12
|
+
headersXCFrameworkDirs,
|
|
11
13
|
prepareCompileInterfaces,
|
|
12
14
|
resolveFlavoredFramework,
|
|
15
|
+
resolveHeadersXCFramework,
|
|
13
16
|
stableFrameworkId,
|
|
14
17
|
validateFlavoredFramework,
|
|
15
18
|
} = require('../flavored-frameworks');
|
|
19
|
+
const { thrownBy } = require('./helpers');
|
|
16
20
|
|
|
17
21
|
// GNU tar reads the `C:` in a Windows path as a remote hostname and fails to connect.
|
|
18
22
|
const itNotWindows = process.platform === 'win32' ? it.skip : it;
|
|
@@ -348,3 +352,184 @@ describe('artifact preparation', () => {
|
|
|
348
352
|
expect(second).toEqual(first);
|
|
349
353
|
});
|
|
350
354
|
});
|
|
355
|
+
|
|
356
|
+
describe('resolveHeadersXCFramework', () => {
|
|
357
|
+
let root;
|
|
358
|
+
let oldOverride;
|
|
359
|
+
let moduleRoot;
|
|
360
|
+
|
|
361
|
+
/** `<output>/headers/xcframeworks/ExpoPairHeaders.xcframework`, the layout the prebuild writes. */
|
|
362
|
+
const headersIn = (output) =>
|
|
363
|
+
makeXcframework(path.join(output, 'headers'), 'ExpoPairHeaders', 'xcframeworks');
|
|
364
|
+
const resolve = () =>
|
|
365
|
+
resolveHeadersXCFramework({
|
|
366
|
+
packageName: 'test-package',
|
|
367
|
+
moduleRoot,
|
|
368
|
+
productName: 'ExpoPair',
|
|
369
|
+
cacheDir: path.join(root, 'cache'),
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
beforeEach(() => {
|
|
373
|
+
root = fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-headers-'));
|
|
374
|
+
moduleRoot = path.join(root, 'module');
|
|
375
|
+
oldOverride = process.env.EXPO_PRECOMPILED_MODULES_PATH;
|
|
376
|
+
process.env.EXPO_PRECOMPILED_MODULES_PATH = path.join(root, 'override');
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
afterEach(() => {
|
|
380
|
+
if (oldOverride == null) {
|
|
381
|
+
delete process.env.EXPO_PRECOMPILED_MODULES_PATH;
|
|
382
|
+
} else {
|
|
383
|
+
process.env.EXPO_PRECOMPILED_MODULES_PATH = oldOverride;
|
|
384
|
+
}
|
|
385
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it('returns null when no lookup base has the headers', () => {
|
|
389
|
+
expect(resolve()).toBeNull();
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it('names the directories it searches, in lookup order', () => {
|
|
393
|
+
expect(headersXCFrameworkDirs('test-package', moduleRoot)).toEqual([
|
|
394
|
+
path.join(root, 'override', 'test-package', 'output', 'headers', 'xcframeworks'),
|
|
395
|
+
path.resolve(
|
|
396
|
+
__dirname,
|
|
397
|
+
'..',
|
|
398
|
+
'..',
|
|
399
|
+
'..',
|
|
400
|
+
'..',
|
|
401
|
+
'precompile',
|
|
402
|
+
'.build',
|
|
403
|
+
'test-package',
|
|
404
|
+
'output',
|
|
405
|
+
'headers',
|
|
406
|
+
'xcframeworks'
|
|
407
|
+
),
|
|
408
|
+
path.join(moduleRoot, 'prebuilds', 'output', 'headers', 'xcframeworks'),
|
|
409
|
+
]);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it('finds the headers the installed package ships under prebuilds/output', () => {
|
|
413
|
+
const shipped = headersIn(path.join(moduleRoot, 'prebuilds', 'output'));
|
|
414
|
+
expect(resolve()).toBe(shipped);
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
it('prefers EXPO_PRECOMPILED_MODULES_PATH over the installed package', () => {
|
|
418
|
+
headersIn(path.join(moduleRoot, 'prebuilds', 'output'));
|
|
419
|
+
const override = headersIn(path.join(root, 'override', 'test-package', 'output'));
|
|
420
|
+
expect(resolve()).toBe(override);
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
itNotWindows('expands a bundled tarball into the cache', () => {
|
|
424
|
+
const source = path.join(root, 'source');
|
|
425
|
+
headersIn(source);
|
|
426
|
+
packTarball(
|
|
427
|
+
path.join(source, 'headers', 'xcframeworks'),
|
|
428
|
+
path.join(
|
|
429
|
+
moduleRoot,
|
|
430
|
+
'prebuilds',
|
|
431
|
+
'output',
|
|
432
|
+
'headers',
|
|
433
|
+
'xcframeworks',
|
|
434
|
+
'ExpoPairHeaders.tar.gz'
|
|
435
|
+
),
|
|
436
|
+
['ExpoPairHeaders.xcframework']
|
|
437
|
+
);
|
|
438
|
+
|
|
439
|
+
const resolved = resolve();
|
|
440
|
+
expect(resolved).toBe(
|
|
441
|
+
path.join(root, 'cache', 'expo-pair-headers', 'headers', 'ExpoPairHeaders.xcframework')
|
|
442
|
+
);
|
|
443
|
+
expect(fs.existsSync(path.join(resolved, 'Info.plist'))).toBe(true);
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
it('rejects an expanded XCFramework with no Info.plist', () => {
|
|
447
|
+
const shipped = headersIn(path.join(moduleRoot, 'prebuilds', 'output'));
|
|
448
|
+
fs.rmSync(path.join(shipped, 'Info.plist'));
|
|
449
|
+
expect(resolve).toThrow(`${shipped} has no Info.plist`);
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
describe('assertHeadersMatchSources', () => {
|
|
454
|
+
let root;
|
|
455
|
+
let headers;
|
|
456
|
+
|
|
457
|
+
const writeJson = (file, value) => {
|
|
458
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
459
|
+
fs.writeFileSync(file, JSON.stringify(value));
|
|
460
|
+
};
|
|
461
|
+
const stampHeaders = (version) =>
|
|
462
|
+
writeJson(path.join(headers, 'expo-package.json'), { name: 'test-package', version });
|
|
463
|
+
const installed = (name, version) => {
|
|
464
|
+
const dir = path.join(root, name);
|
|
465
|
+
writeJson(path.join(dir, 'package.json'), { name: 'test-package', version });
|
|
466
|
+
return dir;
|
|
467
|
+
};
|
|
468
|
+
const check = (sourceRoots) =>
|
|
469
|
+
assertHeadersMatchSources(headers, {
|
|
470
|
+
packageName: 'test-package',
|
|
471
|
+
productName: 'ExpoPair',
|
|
472
|
+
sourceRoots,
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
beforeEach(() => {
|
|
476
|
+
root = fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-headers-version-'));
|
|
477
|
+
headers = path.join(root, 'ExpoPairHeaders.xcframework');
|
|
478
|
+
fs.mkdirSync(headers);
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
afterEach(() => {
|
|
482
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
// Headers published before the stamp existed carry none.
|
|
486
|
+
it('accepts headers without a version stamp', () => {
|
|
487
|
+
expect(() => check([installed('module', '1.0.0')])).not.toThrow();
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
it('accepts headers of the same version as every source', () => {
|
|
491
|
+
stampHeaders('1.0.0');
|
|
492
|
+
expect(() => check([installed('module', '1.0.0'), installed('built', '1.0.0')])).not.toThrow();
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
it('rejects headers of another version, naming both versions, both paths, why and how', () => {
|
|
496
|
+
stampHeaders('2.0.0');
|
|
497
|
+
const moduleRoot = installed('module', '1.0.0');
|
|
498
|
+
const { message } = thrownBy(() => check([moduleRoot]));
|
|
499
|
+
for (const part of [headers, '2.0.0', moduleRoot, '1.0.0']) {
|
|
500
|
+
expect(message).toContain(part);
|
|
501
|
+
}
|
|
502
|
+
expect(message).toContain('"Build ExpoPair" phase builds the framework from the installed');
|
|
503
|
+
expect(message).toContain('et prebuild test-package');
|
|
504
|
+
expect(message).toContain('EXPO_PRECOMPILED_MODULES_PATH');
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
it('rejects headers that differ from any one source', () => {
|
|
508
|
+
stampHeaders('1.0.0');
|
|
509
|
+
const built = installed('built', '1.1.0');
|
|
510
|
+
expect(() => check([installed('module', '1.0.0'), built])).toThrow(built);
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
it('names a stamp it cannot parse instead of surfacing the JSON error', () => {
|
|
514
|
+
const stampPath = path.join(headers, 'expo-package.json');
|
|
515
|
+
fs.writeFileSync(stampPath, '{ not json');
|
|
516
|
+
const { message } = thrownBy(() => check([installed('module', '1.0.0')]));
|
|
517
|
+
expect(message).toContain(`[expo-spm-plugin] ${stampPath}`);
|
|
518
|
+
expect(message).toContain('et prebuild test-package');
|
|
519
|
+
expect(message).not.toMatch(/SyntaxError|Unexpected token/);
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
it('names a stamp without a version', () => {
|
|
523
|
+
const stampPath = path.join(headers, 'expo-package.json');
|
|
524
|
+
writeJson(stampPath, { name: 'test-package' });
|
|
525
|
+
expect(() => check([installed('module', '1.0.0')])).toThrow(`[expo-spm-plugin] ${stampPath}`);
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
it('names an installed package.json without a version', () => {
|
|
529
|
+
stampHeaders('1.0.0');
|
|
530
|
+
const moduleRoot = installed('module', undefined);
|
|
531
|
+
const { message } = thrownBy(() => check([moduleRoot]));
|
|
532
|
+
expect(message).toContain(`[expo-spm-plugin] ${path.join(moduleRoot, 'package.json')}`);
|
|
533
|
+
expect(message).not.toContain('undefined');
|
|
534
|
+
});
|
|
535
|
+
});
|
|
@@ -13,6 +13,7 @@ const {
|
|
|
13
13
|
pureSwiftManifest,
|
|
14
14
|
emitSourceManifestPackage,
|
|
15
15
|
emitPureSwiftSourcePackage,
|
|
16
|
+
emitExpoModulesJSIHeadersPackage,
|
|
16
17
|
raiseFloor,
|
|
17
18
|
spmPackageIdentity,
|
|
18
19
|
documentedPackage,
|
|
@@ -2239,3 +2240,106 @@ let package = Package(
|
|
|
2239
2240
|
});
|
|
2240
2241
|
});
|
|
2241
2242
|
});
|
|
2243
|
+
|
|
2244
|
+
describe('emitExpoModulesJSIHeadersPackage', () => {
|
|
2245
|
+
let tmp;
|
|
2246
|
+
let outDir;
|
|
2247
|
+
|
|
2248
|
+
const xcframeworkAt = (name) => {
|
|
2249
|
+
const xcframework = path.join(tmp, name, 'ExpoModulesJSIHeaders.xcframework');
|
|
2250
|
+
fs.mkdirSync(xcframework, { recursive: true });
|
|
2251
|
+
fs.writeFileSync(path.join(xcframework, 'Info.plist'), '<plist/>');
|
|
2252
|
+
return xcframework;
|
|
2253
|
+
};
|
|
2254
|
+
|
|
2255
|
+
beforeEach(() => {
|
|
2256
|
+
tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-jsi-headers-'));
|
|
2257
|
+
outDir = path.join(tmp, 'out');
|
|
2258
|
+
});
|
|
2259
|
+
|
|
2260
|
+
afterEach(() => {
|
|
2261
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
2262
|
+
});
|
|
2263
|
+
|
|
2264
|
+
it('declares the headers as a binary target beside a target that links the real framework', () => {
|
|
2265
|
+
const headers = xcframeworkAt('npm');
|
|
2266
|
+
const pkgDir = emitExpoModulesJSIHeadersPackage(headers, outDir);
|
|
2267
|
+
|
|
2268
|
+
expect(pkgDir).toBe(path.join(outDir, 'ExpoModulesJSIHeaders'));
|
|
2269
|
+
const manifest = fs.readFileSync(path.join(pkgDir, 'Package.swift'), 'utf8');
|
|
2270
|
+
expect(manifest).toContain('name: "ExpoModulesJSIHeaders"');
|
|
2271
|
+
expect(manifest).toContain(
|
|
2272
|
+
'.library(name: "ExpoModulesJSIHeaders", targets: ["ExpoModulesJSIHeaders", "ExpoModulesJSILink"])'
|
|
2273
|
+
);
|
|
2274
|
+
expect(manifest).toContain(
|
|
2275
|
+
'.binaryTarget(name: "ExpoModulesJSIHeaders", path: "ExpoModulesJSIHeaders.xcframework")'
|
|
2276
|
+
);
|
|
2277
|
+
expect(manifest).toMatch(
|
|
2278
|
+
/\.target\(\s*name: "ExpoModulesJSILink",\s*path: "ExpoModulesJSILink",\s*linkerSettings: \[\.linkedFramework\("ExpoModulesJSI"\)\]\s*\)/
|
|
2279
|
+
);
|
|
2280
|
+
expect(fs.readlinkSync(path.join(pkgDir, 'ExpoModulesJSIHeaders.xcframework'))).toBe(headers);
|
|
2281
|
+
expect(
|
|
2282
|
+
fs.readFileSync(path.join(pkgDir, 'ExpoModulesJSILink', 'ExpoModulesJSILink.swift'), 'utf8')
|
|
2283
|
+
).toBe('');
|
|
2284
|
+
});
|
|
2285
|
+
|
|
2286
|
+
it('replaces the previous emission on a re-run, leaving no stale files', () => {
|
|
2287
|
+
emitExpoModulesJSIHeadersPackage(xcframeworkAt('first'), outDir);
|
|
2288
|
+
const pkgDir = path.join(outDir, 'ExpoModulesJSIHeaders');
|
|
2289
|
+
fs.writeFileSync(path.join(pkgDir, 'stale.txt'), 'left by an older plugin');
|
|
2290
|
+
const second = xcframeworkAt('second');
|
|
2291
|
+
|
|
2292
|
+
emitExpoModulesJSIHeadersPackage(second, outDir);
|
|
2293
|
+
|
|
2294
|
+
expect(fs.readlinkSync(path.join(pkgDir, 'ExpoModulesJSIHeaders.xcframework'))).toBe(second);
|
|
2295
|
+
expect(fs.readdirSync(pkgDir).sort()).toEqual([
|
|
2296
|
+
'ExpoModulesJSIHeaders.xcframework',
|
|
2297
|
+
'ExpoModulesJSILink',
|
|
2298
|
+
'Package.swift',
|
|
2299
|
+
]);
|
|
2300
|
+
// The old symlink target is untouched: removing the link must not follow it.
|
|
2301
|
+
expect(
|
|
2302
|
+
fs.existsSync(path.join(tmp, 'first', 'ExpoModulesJSIHeaders.xcframework', 'Info.plist'))
|
|
2303
|
+
).toBe(true);
|
|
2304
|
+
});
|
|
2305
|
+
});
|
|
2306
|
+
|
|
2307
|
+
describe('the ExpoModulesJSIHeaders dependency of emitted source packages', () => {
|
|
2308
|
+
let tmp;
|
|
2309
|
+
let moduleRoot;
|
|
2310
|
+
let outDir;
|
|
2311
|
+
|
|
2312
|
+
const emitted = (emitContext) => {
|
|
2313
|
+
emitPureSwiftSourcePackage(
|
|
2314
|
+
{ moduleRoot, product: 'ExpoAsset' },
|
|
2315
|
+
{ frameworkSearchPath: '/abs/interfaces', outDir, ...emitContext }
|
|
2316
|
+
);
|
|
2317
|
+
return fs.readFileSync(path.join(outDir, 'expo-source', 'ExpoAsset', 'Package.swift'), 'utf8');
|
|
2318
|
+
};
|
|
2319
|
+
|
|
2320
|
+
beforeEach(() => {
|
|
2321
|
+
tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-jsi-dep-'));
|
|
2322
|
+
moduleRoot = path.join(tmp, 'module');
|
|
2323
|
+
outDir = path.join(tmp, 'out');
|
|
2324
|
+
fs.mkdirSync(path.join(moduleRoot, 'ios'), { recursive: true });
|
|
2325
|
+
fs.writeFileSync(path.join(moduleRoot, 'ios', 'A.swift'), '// swift\n');
|
|
2326
|
+
});
|
|
2327
|
+
|
|
2328
|
+
afterEach(() => {
|
|
2329
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
2330
|
+
});
|
|
2331
|
+
|
|
2332
|
+
it('is declared on the package and every target when the headers package exists', () => {
|
|
2333
|
+
const manifest = emitted({ jsiHeadersPkgPath: '/abs/out/ExpoModulesJSIHeaders' });
|
|
2334
|
+
expect(manifest).toContain(
|
|
2335
|
+
'.package(name: "ExpoModulesJSIHeaders", path: "/abs/out/ExpoModulesJSIHeaders")'
|
|
2336
|
+
);
|
|
2337
|
+
expect(manifest).toContain(
|
|
2338
|
+
'.product(name: "ExpoModulesJSIHeaders", package: "ExpoModulesJSIHeaders")'
|
|
2339
|
+
);
|
|
2340
|
+
});
|
|
2341
|
+
|
|
2342
|
+
it('is absent when there is no headers package', () => {
|
|
2343
|
+
expect(emitted({})).not.toContain('ExpoModulesJSIHeaders');
|
|
2344
|
+
});
|
|
2345
|
+
});
|