expo 58.0.17 → 58.0.19
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 +15 -15
- package/package.json +11 -11
- package/scripts/spm/README.md +43 -3
- package/scripts/spm/__tests__/cli.test.js +17 -2
- package/scripts/spm/__tests__/commands.test.js +61 -0
- package/scripts/spm/__tests__/diagnostics.test.js +210 -9
- package/scripts/spm/__tests__/direct.test.js +387 -0
- package/scripts/spm/__tests__/flavored-frameworks.test.js +127 -0
- package/scripts/spm/__tests__/helpers.js +9 -0
- package/scripts/spm/__tests__/manifests.test.js +38 -50
- package/scripts/spm/__tests__/plugin.test.js +1238 -53
- package/scripts/spm/__tests__/precompiled-sources.test.js +139 -0
- package/scripts/spm/classify.js +8 -6
- package/scripts/spm/cli.js +11 -4
- package/scripts/spm/commands.js +18 -1
- package/scripts/spm/diagnostics.js +112 -8
- package/scripts/spm/direct.js +215 -0
- package/scripts/spm/flavored-frameworks.js +125 -40
- package/scripts/spm/manifests.js +4 -3
- package/scripts/spm/plugin.js +432 -82
- 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.19'
|
|
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.19"
|
|
25
25
|
consumerProguardFiles("proguard-rules.pro")
|
|
26
26
|
}
|
|
27
27
|
testOptions {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"@expo/fingerprint": "~0.21.6",
|
|
4
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.23",
|
|
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,7 +16,7 @@
|
|
|
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.12",
|
|
20
20
|
"expo-app-loader-provider": "~8.0.0",
|
|
21
21
|
"expo-app-metrics": "~58.0.14",
|
|
22
22
|
"expo-apple-authentication": "~58.0.2",
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"expo-checkbox": "~58.0.2",
|
|
38
38
|
"expo-clipboard": "~58.0.4",
|
|
39
39
|
"expo-constants": "~58.0.13",
|
|
40
|
-
"expo-contacts": "~58.0.
|
|
40
|
+
"expo-contacts": "~58.0.9",
|
|
41
41
|
"expo-crypto": "~58.0.7",
|
|
42
|
-
"expo-dev-client": "~58.0.
|
|
42
|
+
"expo-dev-client": "~58.0.15",
|
|
43
43
|
"expo-device": "~58.0.5",
|
|
44
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.
|
|
46
|
+
"expo-file-system": "~58.0.11",
|
|
47
|
+
"expo-font": "~58.0.10",
|
|
48
48
|
"expo-gl": "~58.0.3",
|
|
49
|
-
"expo-glass-effect": "~58.0.
|
|
49
|
+
"expo-glass-effect": "~58.0.5",
|
|
50
50
|
"expo-google-app-auth": "~8.3.0",
|
|
51
51
|
"expo-haptics": "~58.0.7",
|
|
52
52
|
"expo-hinge": "~58.0.2",
|
|
53
|
-
"expo-image": "~58.0.
|
|
53
|
+
"expo-image": "~58.0.17",
|
|
54
54
|
"expo-image-loader": "~58.0.3",
|
|
55
55
|
"expo-image-manipulator": "~58.0.15",
|
|
56
56
|
"expo-image-picker": "~58.0.10",
|
|
@@ -61,32 +61,32 @@
|
|
|
61
61
|
"expo-linking": "~58.0.14",
|
|
62
62
|
"expo-local-authentication": "~58.0.2",
|
|
63
63
|
"expo-localization": "~58.0.5",
|
|
64
|
-
"expo-location": "~58.0.
|
|
64
|
+
"expo-location": "~58.0.19",
|
|
65
65
|
"expo-mail-composer": "~58.0.3",
|
|
66
66
|
"expo-manifests": "~58.0.1",
|
|
67
67
|
"expo-maps": "~58.0.10",
|
|
68
68
|
"expo-mcp": "~0.2.1",
|
|
69
|
-
"expo-media-library": "~58.0.
|
|
69
|
+
"expo-media-library": "~58.0.12",
|
|
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.26",
|
|
73
73
|
"expo-navigation-bar": "~58.0.4",
|
|
74
74
|
"expo-network": "~58.0.4",
|
|
75
75
|
"expo-notifications": "~58.1.6",
|
|
76
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.
|
|
79
|
+
"expo-router": "~58.0.26",
|
|
80
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
|
-
"expo-server": "~58.0.
|
|
84
|
+
"expo-server": "~58.0.6",
|
|
85
85
|
"expo-sharing": "~58.0.20",
|
|
86
86
|
"expo-sms": "~58.0.2",
|
|
87
87
|
"expo-speech": "~58.0.3",
|
|
88
88
|
"expo-splash-screen": "~58.0.11",
|
|
89
|
-
"expo-sqlite": "~58.0.
|
|
89
|
+
"expo-sqlite": "~58.0.14",
|
|
90
90
|
"expo-status-bar": "~58.0.4",
|
|
91
91
|
"expo-store-review": "~58.0.2",
|
|
92
92
|
"expo-symbols": "~58.0.4",
|
|
@@ -97,7 +97,7 @@
|
|
|
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.
|
|
100
|
+
"expo-widgets": "~58.0.23",
|
|
101
101
|
"jest-expo": "~58.0.12",
|
|
102
102
|
"lottie-react-native": "~7.5.0",
|
|
103
103
|
"react": "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.19",
|
|
4
4
|
"description": "The Expo SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expo"
|
|
@@ -212,27 +212,27 @@
|
|
|
212
212
|
},
|
|
213
213
|
"dependencies": {
|
|
214
214
|
"@babel/runtime": "^7.20.0",
|
|
215
|
-
"@expo/cli": "^58.1.
|
|
216
|
-
"@expo/config": "~58.0.
|
|
215
|
+
"@expo/cli": "^58.1.15",
|
|
216
|
+
"@expo/config": "~58.0.8",
|
|
217
217
|
"@expo/config-plugins": "~58.0.10",
|
|
218
218
|
"@expo/devtools": "~58.0.2",
|
|
219
219
|
"@expo/dom-webview": "~58.0.2",
|
|
220
220
|
"@expo/fingerprint": "^0.21.6",
|
|
221
|
-
"@expo/local-build-cache-provider": "^58.0.
|
|
221
|
+
"@expo/local-build-cache-provider": "^58.0.8",
|
|
222
222
|
"@expo/log-box": "^58.0.13",
|
|
223
223
|
"@expo/log-box-utils": "^58.0.2",
|
|
224
224
|
"@expo/metro": "~58.0.0",
|
|
225
|
-
"@expo/metro-config": "~58.0.
|
|
225
|
+
"@expo/metro-config": "~58.0.17",
|
|
226
226
|
"@ungap/structured-clone": "^1.3.0",
|
|
227
|
-
"babel-preset-expo": "~58.0.
|
|
227
|
+
"babel-preset-expo": "~58.0.20",
|
|
228
228
|
"expo-asset": "~58.0.18",
|
|
229
229
|
"expo-constants": "~58.0.13",
|
|
230
|
-
"expo-file-system": "~58.0.
|
|
231
|
-
"expo-font": "~58.0.
|
|
230
|
+
"expo-file-system": "~58.0.11",
|
|
231
|
+
"expo-font": "~58.0.10",
|
|
232
232
|
"expo-keep-awake": "~58.0.3",
|
|
233
|
-
"expo-modules-autolinking": "~58.0.
|
|
234
|
-
"expo-modules-cli": "~0.3.
|
|
235
|
-
"expo-modules-core": "~58.0.
|
|
233
|
+
"expo-modules-autolinking": "~58.0.15",
|
|
234
|
+
"expo-modules-cli": "~0.3.2",
|
|
235
|
+
"expo-modules-core": "~58.0.26",
|
|
236
236
|
"pretty-format": "^29.7.0",
|
|
237
237
|
"react-refresh": "^0.14.2",
|
|
238
238
|
"whatwg-url-minimum": "^0.2.0"
|
package/scripts/spm/README.md
CHANGED
|
@@ -39,7 +39,9 @@ prebuild for an app that consumes the SwiftPM plugin.
|
|
|
39
39
|
Lookup runs for **every** resolved pod except ExpoModulesJSI (see below), not
|
|
40
40
|
just the core frameworks. Any module with a `spm.config.json` product is
|
|
41
41
|
consumed as a precompiled framework the moment its artifact exists — no
|
|
42
|
-
`Package.swift` is generated for it, and none is needed.
|
|
42
|
+
`Package.swift` is generated for it, and none is needed. The exception is a
|
|
43
|
+
module the app lists in its `buildFromSource` autolinking option (see below).
|
|
44
|
+
Path 3 is the
|
|
43
45
|
published-package case: a module shipping
|
|
44
46
|
`prebuilds/output/<flavor>/xcframeworks` is picked up with no local build.
|
|
45
47
|
|
|
@@ -81,6 +83,43 @@ build folder, then copies it to where the app links and embeds it. When the
|
|
|
81
83
|
headers carry an `expo-package.json` version stamp, sync fails if that version differs
|
|
82
84
|
from the installed `expo-modules-jsi` or from the copy the phase builds.
|
|
83
85
|
|
|
86
|
+
## Modules built from their checked-in Package.swift
|
|
87
|
+
|
|
88
|
+
The plugin decides each module in this order:
|
|
89
|
+
|
|
90
|
+
1. When a precompiled artifact exists, the module is linked precompiled, unless
|
|
91
|
+
the app lists it in `buildFromSource`.
|
|
92
|
+
2. Otherwise, when its `Package.swift` depends on the `ExpoModulesCoreHeaders`
|
|
93
|
+
product, the plugin builds it from that manifest as it stands. The manifest
|
|
94
|
+
compiles against the `ExpoModulesCoreHeaders` and `ExpoModulesJSIHeaders`
|
|
95
|
+
xcframeworks.
|
|
96
|
+
3. Otherwise its `Package.swift` is mirrored into a generated package, or a
|
|
97
|
+
pure-Swift module gets a generated package over its sources.
|
|
98
|
+
|
|
99
|
+
A manifest built as it stands is linked at `<outDir>/direct/<npm package name>`,
|
|
100
|
+
a symlink to the module root, next to the `ExpoModulesCoreHeaders` package the
|
|
101
|
+
plugin emits in `direct/`. Link names are not flattened, so a scoped package
|
|
102
|
+
lands at `direct/@scope/pkg`. SwiftPM resolves the manifest's relative paths
|
|
103
|
+
from the link, not from the module's real directory, so the path to the headers
|
|
104
|
+
package depends on that depth: `../ExpoModulesCoreHeaders` for an unscoped
|
|
105
|
+
package, `../../ExpoModulesCoreHeaders` for a scoped one.
|
|
106
|
+
|
|
107
|
+
`buildFromSource` is the option CocoaPods reads, from
|
|
108
|
+
`"expo": { "autolinking": { "buildFromSource": [...] } }` or its `"ios"`
|
|
109
|
+
section in the app's package.json. Each entry is a regular expression that must
|
|
110
|
+
match the whole pod name or npm package name. Under SwiftPM the entries are
|
|
111
|
+
JavaScript regular expressions, so Ruby-only syntax differs: `(?i)` fails the
|
|
112
|
+
sync with an error that names the invalid entry, and `\A` matches a literal `A`.
|
|
113
|
+
An entry that is a
|
|
114
|
+
module's pod name or npm package name, character for character, names it
|
|
115
|
+
exactly; any other entry is a pattern. An exact entry for ExpoModulesCore fails
|
|
116
|
+
the sync, because every module built from source compiles against the
|
|
117
|
+
precompiled ExpoModulesCore. A module named exactly that has an artifact but no
|
|
118
|
+
way to be built from source is reported with the reason, and the report asks to
|
|
119
|
+
remove the entry so the artifact is used. A module that only a pattern matches,
|
|
120
|
+
ExpoModulesCore included, is linked precompiled in that case, and one warning
|
|
121
|
+
names each such module and its entry.
|
|
122
|
+
|
|
84
123
|
## Unsupported modules
|
|
85
124
|
|
|
86
125
|
A module the plugin cannot contribute aborts autolinking. Dropping it would not
|
|
@@ -90,8 +129,9 @@ surfaces as a build error, naming the fix:
|
|
|
90
129
|
|
|
91
130
|
- **A prebuildable product with no built artifact** — the module declares a
|
|
92
131
|
product in its `spm.config.json`, so it needs no `Package.swift`; the artifact
|
|
93
|
-
is simply missing.
|
|
94
|
-
|
|
132
|
+
is simply missing. From the Expo repository root,
|
|
133
|
+
`node tools/bin/expotools.js prebuild <package>` (both flavors, so omit
|
|
134
|
+
`--flavor`) fixes it. This is the preferred route for a mixed-language module: the prebuild
|
|
95
135
|
pipeline compiles Swift, Objective-C, and C++ targets into one XCFramework, so
|
|
96
136
|
no source split is required.
|
|
97
137
|
- **Mixed Swift and Objective-C/C++ sources with neither manifest** — SwiftPM
|
|
@@ -116,22 +116,37 @@ describe('resolveExpoModules', () => {
|
|
|
116
116
|
expect(resolve({ modules, extraDependencies, coreFeatures: [] })).toEqual({
|
|
117
117
|
modules,
|
|
118
118
|
extraDependencies,
|
|
119
|
+
buildFromSource: [],
|
|
119
120
|
});
|
|
120
121
|
});
|
|
121
122
|
|
|
122
123
|
// Every caller reads `extraDependencies.length`, so it is an array in every shape
|
|
123
124
|
// the CLI answers with.
|
|
124
125
|
it('reports no extra pods when the app declares none', () => {
|
|
125
|
-
expect(resolve({ modules: [] })).toEqual({
|
|
126
|
+
expect(resolve({ modules: [] })).toEqual({
|
|
127
|
+
modules: [],
|
|
128
|
+
extraDependencies: [],
|
|
129
|
+
buildFromSource: [],
|
|
130
|
+
});
|
|
126
131
|
expect(resolve({ modules: [], extraDependencies: null })).toEqual({
|
|
127
132
|
modules: [],
|
|
128
133
|
extraDependencies: [],
|
|
134
|
+
buildFromSource: [],
|
|
129
135
|
});
|
|
130
136
|
});
|
|
131
137
|
|
|
138
|
+
// The same option CocoaPods reads from this output, in autolinking_manager.rb.
|
|
139
|
+
it("returns the app's buildFromSource patterns", () => {
|
|
140
|
+
const configuration = { buildFromSource: ['expo-haptics', 'ExpoCamera.*'] };
|
|
141
|
+
expect(resolve({ modules: [], configuration }).buildFromSource).toEqual([
|
|
142
|
+
'expo-haptics',
|
|
143
|
+
'ExpoCamera.*',
|
|
144
|
+
]);
|
|
145
|
+
});
|
|
146
|
+
|
|
132
147
|
it('reads the legacy top-level array as modules alone', () => {
|
|
133
148
|
const modules = [{ packageName: 'expo-camera', pods: [] }];
|
|
134
149
|
|
|
135
|
-
expect(resolve(modules)).toEqual({ modules, extraDependencies: [] });
|
|
150
|
+
expect(resolve(modules)).toEqual({ modules, extraDependencies: [], buildFromSource: [] });
|
|
136
151
|
});
|
|
137
152
|
});
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
3
7
|
const { configureSpmUpdateCommand, spmUpdateCommand } = require('../commands');
|
|
4
8
|
|
|
5
9
|
describe('spmUpdateCommand', () => {
|
|
@@ -21,6 +25,48 @@ describe('spmUpdateCommand', () => {
|
|
|
21
25
|
);
|
|
22
26
|
});
|
|
23
27
|
|
|
28
|
+
it('runs the script of a hoisted react-native when the app root is reached through a symlink', () => {
|
|
29
|
+
const root = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-commands-')));
|
|
30
|
+
try {
|
|
31
|
+
const reactNativeRoot = path.join(root, 'deep', 'repo', 'node_modules', 'react-native');
|
|
32
|
+
fs.mkdirSync(reactNativeRoot, { recursive: true });
|
|
33
|
+
fs.mkdirSync(path.join(root, 'deep', 'repo', 'apps', 'mobile'), { recursive: true });
|
|
34
|
+
fs.symlinkSync(path.join(root, 'deep', 'repo'), path.join(root, 'link'));
|
|
35
|
+
|
|
36
|
+
configureSpmUpdateCommand({
|
|
37
|
+
appRoot: path.join(root, 'link', 'apps', 'mobile'),
|
|
38
|
+
reactNativeRoot,
|
|
39
|
+
});
|
|
40
|
+
expect(spmUpdateCommand()).toBe(
|
|
41
|
+
'node ../../node_modules/react-native/scripts/setup-apple-spm.js update'
|
|
42
|
+
);
|
|
43
|
+
} finally {
|
|
44
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('keeps the name of a react-native that is itself a symlink, as pnpm installs it', () => {
|
|
49
|
+
const root = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-commands-')));
|
|
50
|
+
try {
|
|
51
|
+
const store = path.join(root, 'node_modules', '.pnpm', 'react-native@0.88.0', 'node_modules');
|
|
52
|
+
fs.mkdirSync(path.join(store, 'react-native'), { recursive: true });
|
|
53
|
+
fs.symlinkSync(
|
|
54
|
+
path.join(store, 'react-native'),
|
|
55
|
+
path.join(root, 'node_modules', 'react-native')
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
configureSpmUpdateCommand({
|
|
59
|
+
appRoot: root,
|
|
60
|
+
reactNativeRoot: path.join(root, 'node_modules', 'react-native'),
|
|
61
|
+
});
|
|
62
|
+
expect(spmUpdateCommand()).toBe(
|
|
63
|
+
'node node_modules/react-native/scripts/setup-apple-spm.js update'
|
|
64
|
+
);
|
|
65
|
+
} finally {
|
|
66
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
24
70
|
it('returns to the default when configured with nothing', () => {
|
|
25
71
|
configureSpmUpdateCommand({
|
|
26
72
|
appRoot: '/repo/apps/mobile',
|
|
@@ -32,3 +78,18 @@ describe('spmUpdateCommand', () => {
|
|
|
32
78
|
);
|
|
33
79
|
});
|
|
34
80
|
});
|
|
81
|
+
|
|
82
|
+
describe('rerunSpmUpdate', () => {
|
|
83
|
+
afterEach(() => configureSpmUpdateCommand());
|
|
84
|
+
|
|
85
|
+
it('names the command of the react-native configured after it was loaded', () => {
|
|
86
|
+
const { rerunSpmUpdate } = require('../diagnostics');
|
|
87
|
+
configureSpmUpdateCommand({
|
|
88
|
+
appRoot: '/repo/apps/mobile',
|
|
89
|
+
reactNativeRoot: '/repo/node_modules/react-native',
|
|
90
|
+
});
|
|
91
|
+
expect(rerunSpmUpdate()).toBe(
|
|
92
|
+
'Then run `node ../../node_modules/react-native/scripts/setup-apple-spm.js update` from your app directory again.'
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -18,6 +18,7 @@ const {
|
|
|
18
18
|
renderRootConflictWarning,
|
|
19
19
|
renderPartlyProvidedPackageWarning,
|
|
20
20
|
renderExtraPodsWarning,
|
|
21
|
+
renderBuildFromSourceFallbackWarning,
|
|
21
22
|
} = require('../diagnostics');
|
|
22
23
|
const { spmUpdateCommand } = require('../commands');
|
|
23
24
|
const { resolvePodIdentities, uncoveredPod } = require('../plugin');
|
|
@@ -165,6 +166,198 @@ describe('diagnostic priority order', () => {
|
|
|
165
166
|
});
|
|
166
167
|
});
|
|
167
168
|
|
|
169
|
+
describe('a pod buildFromSource names that cannot be built from source', () => {
|
|
170
|
+
const subject = { podName: 'ExpoBad', packageName: 'expo-bad', moduleRoot: '/m/expo-bad' };
|
|
171
|
+
const forced = (refusal, hasSources = true) => ({
|
|
172
|
+
...pendingPod({
|
|
173
|
+
...subject,
|
|
174
|
+
hasSources,
|
|
175
|
+
prebuildProduct: { name: 'ExpoBad', sourceOnly: false },
|
|
176
|
+
refusal,
|
|
177
|
+
}),
|
|
178
|
+
buildFromSourceEntry: 'expo-b.*',
|
|
179
|
+
});
|
|
180
|
+
const classify = (pod) => classifyUnsupported({ pending: [pod], coreAvailable: true });
|
|
181
|
+
const podspecLinkage = {
|
|
182
|
+
reason: 'needs-manifest-for-linkage',
|
|
183
|
+
file: '/m/expo-bad/ios/ExpoBad.podspec',
|
|
184
|
+
line: 19,
|
|
185
|
+
snippet: "s.frameworks = 'Photos'",
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
it('is refused for buildFromSource, with what blocks the source build as the cause', () => {
|
|
189
|
+
expect(classify(forced(null))).toEqual([
|
|
190
|
+
{
|
|
191
|
+
...subject,
|
|
192
|
+
reason: 'build-from-source-unsupported',
|
|
193
|
+
buildFromSourceEntry: 'expo-b.*',
|
|
194
|
+
cause: { reason: 'mixed-no-manifest', productName: 'ExpoBad' },
|
|
195
|
+
},
|
|
196
|
+
]);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('takes the most specific cause', () => {
|
|
200
|
+
expect(classify(forced(podspecLinkage))[0].cause).toEqual(podspecLinkage);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
const report = (refusal, hasSources) =>
|
|
204
|
+
renderUnsupportedReport(classify(forced(refusal, hasSources)));
|
|
205
|
+
|
|
206
|
+
it('says what failed, and how to use the precompiled XCFramework instead', () => {
|
|
207
|
+
const text = report(null);
|
|
208
|
+
expect(text).toContain(
|
|
209
|
+
'error: Expo module "expo-bad" (pod ExpoBad) is listed in buildFromSource, but Swift Package Manager cannot build it from source.'
|
|
210
|
+
);
|
|
211
|
+
expect(text).toContain(
|
|
212
|
+
`Remove "expo-b.*" from \`"expo": { "autolinking": { "buildFromSource": [...] } }\` (or its \`"ios"\` section) in your package.json, or narrow it so it no longer matches ExpoBad or expo-bad. The module's precompiled XCFramework is then used. Then run \`${spmUpdateCommand()}\` from your app directory again.`
|
|
213
|
+
);
|
|
214
|
+
expect(text).toContain('Module path: /m/expo-bad');
|
|
215
|
+
expect(text).not.toContain('prebuild');
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it.each([
|
|
219
|
+
[
|
|
220
|
+
'mixed sources and no manifest',
|
|
221
|
+
null,
|
|
222
|
+
true,
|
|
223
|
+
'It mixes Swift and Objective-C/C++ sources and ships no Package.swift, and Swift Package Manager can build such a module only from a manifest that splits the two languages into separate targets.',
|
|
224
|
+
],
|
|
225
|
+
[
|
|
226
|
+
'no sources',
|
|
227
|
+
null,
|
|
228
|
+
false,
|
|
229
|
+
'It has no `ios` or `apple` source directory for Swift Package Manager to compile.',
|
|
230
|
+
],
|
|
231
|
+
[
|
|
232
|
+
'linkage in its podspec',
|
|
233
|
+
podspecLinkage,
|
|
234
|
+
true,
|
|
235
|
+
'Its podspec declares native linkage at /m/expo-bad/ios/ExpoBad.podspec:19, and it ships no Package.swift stating that linkage, so a package built from its sources would link less than CocoaPods does.',
|
|
236
|
+
],
|
|
237
|
+
[
|
|
238
|
+
'a manifest target dependency',
|
|
239
|
+
{
|
|
240
|
+
reason: 'unsupported-target-dependency',
|
|
241
|
+
dependencies: [{ target: 'ExpoBad', dependsOn: 'VendoredKit', kind: 'binary' }],
|
|
242
|
+
},
|
|
243
|
+
true,
|
|
244
|
+
'Its Package.swift has targets depending on "VendoredKit", which the package generated from it cannot declare.',
|
|
245
|
+
],
|
|
246
|
+
[
|
|
247
|
+
'a manifest package dependency',
|
|
248
|
+
{ reason: 'unsupported-package-dependency', dependencies: [] },
|
|
249
|
+
true,
|
|
250
|
+
'Its Package.swift declares Swift packages the package generated from it cannot declare.',
|
|
251
|
+
],
|
|
252
|
+
[
|
|
253
|
+
'manifest targets without sources',
|
|
254
|
+
{ reason: 'unresolvable-target-path', targetNames: ['Main', 'Extras'] },
|
|
255
|
+
true,
|
|
256
|
+
'Its Package.swift names targets with no sources on disk: "Main", "Extras".',
|
|
257
|
+
],
|
|
258
|
+
[
|
|
259
|
+
'a manifest that does not export the product',
|
|
260
|
+
{ reason: 'not-exported-by-manifest', productName: 'ExpoBad', exportedProducts: [] },
|
|
261
|
+
true,
|
|
262
|
+
'Its Package.swift exports no "ExpoBad" library product.',
|
|
263
|
+
],
|
|
264
|
+
[
|
|
265
|
+
'precompiled sibling pods',
|
|
266
|
+
{
|
|
267
|
+
reason: 'partially-precompiled',
|
|
268
|
+
precompiledSiblings: ['ExpoGood'],
|
|
269
|
+
precompiledProducts: ['ExpoGood'],
|
|
270
|
+
artifactDirs: [],
|
|
271
|
+
},
|
|
272
|
+
true,
|
|
273
|
+
'Other pods of the module are linked precompiled (ExpoGood), and building the module from source would link them a second time.',
|
|
274
|
+
],
|
|
275
|
+
])('names the cause: %s', (_, refusal, hasSources, why) => {
|
|
276
|
+
expect(report(refusal, hasSources)).toContain(why);
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
it('gives a cause it has no description for a generic line, naming the reason', () => {
|
|
280
|
+
const text = renderUnsupportedReport([
|
|
281
|
+
{
|
|
282
|
+
...subject,
|
|
283
|
+
reason: 'build-from-source-unsupported',
|
|
284
|
+
buildFromSourceEntry: 'ExpoBad',
|
|
285
|
+
cause: { reason: 'some-future-reason' },
|
|
286
|
+
},
|
|
287
|
+
]);
|
|
288
|
+
expect(text).toContain(
|
|
289
|
+
'The plugin found no way to build it from source with Swift Package Manager (reason: some-future-reason).'
|
|
290
|
+
);
|
|
291
|
+
expect(text).toContain('Remove "ExpoBad" from');
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
describe('when a pattern links it precompiled and its XCFramework is incomplete', () => {
|
|
295
|
+
const incomplete = { ...forced(null), precompiledIncomplete: true };
|
|
296
|
+
|
|
297
|
+
it('is refused naming the entry, with what blocks the source build as the cause', () => {
|
|
298
|
+
expect(classify(incomplete)).toEqual([
|
|
299
|
+
{
|
|
300
|
+
...subject,
|
|
301
|
+
reason: 'build-from-source-fallback-incomplete',
|
|
302
|
+
buildFromSourceEntry: 'expo-b.*',
|
|
303
|
+
cause: { reason: 'mixed-no-manifest', productName: 'ExpoBad' },
|
|
304
|
+
},
|
|
305
|
+
]);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
it('says what failed, why, and how to complete the XCFramework', () => {
|
|
309
|
+
expect(renderUnsupportedReport(classify(incomplete))).toBe(
|
|
310
|
+
[
|
|
311
|
+
'error: The buildFromSource entry "expo-b.*" matches Expo module "expo-bad" (pod ExpoBad), which Swift Package Manager cannot build from source, and its precompiled XCFramework is incomplete, so it cannot be linked precompiled either.',
|
|
312
|
+
' It mixes Swift and Objective-C/C++ sources and ships no Package.swift, and Swift Package Manager can build such a module only from a manifest that splits the two languages into separate targets.',
|
|
313
|
+
' A buildFromSource pattern links a module precompiled when Swift Package Manager cannot build it from source, and the plugin links a precompiled XCFramework only when both its Debug and Release flavors are present.',
|
|
314
|
+
` Reinstall expo-bad so it ships both flavors, or, in the Expo repository, from its root, build both with \`node tools/bin/expotools.js prebuild expo-bad\`. Then run \`${spmUpdateCommand()}\` from your app directory again.`,
|
|
315
|
+
' Module path: /m/expo-bad',
|
|
316
|
+
].join('\n')
|
|
317
|
+
);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it('counts the pod once', () => {
|
|
322
|
+
expect(new UnsupportedModulesError(classify(forced(null))).message).toMatch(
|
|
323
|
+
/^1 Expo native module /
|
|
324
|
+
);
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
describe('modules a buildFromSource pattern matches that are linked precompiled instead', () => {
|
|
329
|
+
const option =
|
|
330
|
+
'`"expo": { "autolinking": { "buildFromSource": [...] } }` (or its `"ios"` section) in your package.json';
|
|
331
|
+
const core = { podName: 'ExpoModulesCore', packageName: 'expo-modules-core', entry: '.*' };
|
|
332
|
+
|
|
333
|
+
it('renders nothing when no module fell back', () => {
|
|
334
|
+
expect(renderBuildFromSourceFallbackWarning([])).toBe('');
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it('names the module and the entry that matched it', () => {
|
|
338
|
+
expect(renderBuildFromSourceFallbackWarning([core])).toBe(
|
|
339
|
+
'warning: buildFromSource matches 1 Expo module that Swift Package Manager cannot build from source, so it is linked precompiled instead: ExpoModulesCore (expo-modules-core, matched by ".*"). ' +
|
|
340
|
+
'A buildFromSource pattern links a module precompiled when Swift Package Manager cannot build that module from source; an entry that names a module exactly fails the sync instead. ' +
|
|
341
|
+
`To see what blocks a module's source build, list it by its exact pod or npm package name in ${option}: the sync then fails and names the cause. ` +
|
|
342
|
+
`To keep it precompiled without this warning, narrow ".*" so that no entry matches this module. Then run \`${spmUpdateCommand()}\` from your app directory again.`
|
|
343
|
+
);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it('names every module, and each entry once', () => {
|
|
347
|
+
const text = renderBuildFromSourceFallbackWarning([
|
|
348
|
+
core,
|
|
349
|
+
{ podName: 'ExpoMixed', packageName: 'expo-mixed', entry: 'expo-.*' },
|
|
350
|
+
{ podName: 'ExpoOther', packageName: 'expo-other', entry: 'expo-.*' },
|
|
351
|
+
]);
|
|
352
|
+
expect(text).toContain(
|
|
353
|
+
'buildFromSource matches 3 Expo modules that Swift Package Manager cannot build from source, so they are linked precompiled instead: ExpoModulesCore (expo-modules-core, matched by ".*"), ExpoMixed (expo-mixed, matched by "expo-.*"), ExpoOther (expo-other, matched by "expo-.*").'
|
|
354
|
+
);
|
|
355
|
+
expect(text).toContain(
|
|
356
|
+
'To keep them precompiled without this warning, narrow ".*", "expo-.*" so that no entry matches these modules.'
|
|
357
|
+
);
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
|
|
168
361
|
describe('linkage declared in a podspec', () => {
|
|
169
362
|
const podspecLinkage = {
|
|
170
363
|
file: '/m/expo-bad/ios/ExpoBad.podspec',
|
|
@@ -306,7 +499,7 @@ describe('renderUnsupportedReport', () => {
|
|
|
306
499
|
expect(text.split('\n').filter((l) => l.startsWith('error: '))).toHaveLength(2);
|
|
307
500
|
});
|
|
308
501
|
|
|
309
|
-
it('tells a prebuildable module to run
|
|
502
|
+
it('tells a prebuildable module to run the prebuild command, not to write a manifest', () => {
|
|
310
503
|
const text = renderUnsupportedReport([
|
|
311
504
|
{
|
|
312
505
|
reason: 'prebuild-available',
|
|
@@ -317,14 +510,15 @@ describe('renderUnsupportedReport', () => {
|
|
|
317
510
|
},
|
|
318
511
|
]);
|
|
319
512
|
expect(text).toContain('error: ');
|
|
320
|
-
//
|
|
513
|
+
// The prebuild command builds both flavors when --flavor is omitted, and the plugin
|
|
321
514
|
// requires a complete pair — so the message must not suggest a single flavor.
|
|
322
|
-
expect(text).toContain('
|
|
515
|
+
expect(text).toContain('node tools/bin/expotools.js prebuild expo-audio');
|
|
516
|
+
expect(text).toMatch(/in the Expo repository, from its root/i);
|
|
323
517
|
expect(text).not.toContain('-f Debug');
|
|
324
518
|
expect(text).not.toContain('patch-package');
|
|
325
519
|
});
|
|
326
520
|
|
|
327
|
-
it('names the scoped package verbatim, which
|
|
521
|
+
it('names the scoped package verbatim, which the prebuild command accepts', () => {
|
|
328
522
|
const text = renderUnsupportedReport([
|
|
329
523
|
{
|
|
330
524
|
reason: 'prebuild-available',
|
|
@@ -334,7 +528,7 @@ describe('renderUnsupportedReport', () => {
|
|
|
334
528
|
productName: 'ExpoUI',
|
|
335
529
|
},
|
|
336
530
|
]);
|
|
337
|
-
expect(text).toContain('
|
|
531
|
+
expect(text).toContain('node tools/bin/expotools.js prebuild @expo/ui');
|
|
338
532
|
});
|
|
339
533
|
|
|
340
534
|
it('offers spm.config.json as a route for a module that has none', () => {
|
|
@@ -350,7 +544,13 @@ describe('renderUnsupportedReport', () => {
|
|
|
350
544
|
]);
|
|
351
545
|
expect(text).toContain('error: ');
|
|
352
546
|
expect(text).toContain('ExpoModulesCore');
|
|
353
|
-
expect(text).toContain(
|
|
547
|
+
expect(text).toContain(
|
|
548
|
+
'node tools/bin/expotools.js prebuild -f Debug expo-modules-core expo-modules-jsi'
|
|
549
|
+
);
|
|
550
|
+
expect(text).toContain(
|
|
551
|
+
'node tools/bin/expotools.js prebuild -f Release expo-modules-core expo-modules-jsi'
|
|
552
|
+
);
|
|
553
|
+
expect(text).toMatch(/in the Expo repository, from its root/i);
|
|
354
554
|
expect(text).not.toContain('patch-package');
|
|
355
555
|
});
|
|
356
556
|
|
|
@@ -1211,7 +1411,8 @@ describe('a module with only some pods precompiled', () => {
|
|
|
1211
1411
|
expect(report).toMatch(/^error: Expo module "expo-dual" \(pod ExpoDualExtras\)/);
|
|
1212
1412
|
expect(report).toContain('ExpoDual ');
|
|
1213
1413
|
expect(report).toContain('twice');
|
|
1214
|
-
expect(report).toContain('
|
|
1414
|
+
expect(report).toContain('node tools/bin/expotools.js prebuild expo-dual');
|
|
1415
|
+
expect(report).toMatch(/in the Expo repository, from its root/i);
|
|
1215
1416
|
expect(report).toContain('spm.config.json');
|
|
1216
1417
|
expect(report).toContain('"exclude": ["expo-dual"]');
|
|
1217
1418
|
expect(report).toContain('Module path: /node_modules/expo-dual');
|
|
@@ -1250,7 +1451,7 @@ describe('a module with only some pods precompiled', () => {
|
|
|
1250
1451
|
entries({ prebuildProduct: { name: 'ExpoDualExtras', sourceOnly: false } })
|
|
1251
1452
|
);
|
|
1252
1453
|
expect(report).toContain('already declares "ExpoDualExtras"');
|
|
1253
|
-
expect(report).toContain('
|
|
1454
|
+
expect(report).toContain('node tools/bin/expotools.js prebuild expo-dual');
|
|
1254
1455
|
});
|
|
1255
1456
|
|
|
1256
1457
|
it('does not promise an XCFramework for a source-only product', () => {
|
|
@@ -1258,7 +1459,7 @@ describe('a module with only some pods precompiled', () => {
|
|
|
1258
1459
|
entries({ prebuildProduct: { name: 'ExpoDualExtras', sourceOnly: true } })
|
|
1259
1460
|
);
|
|
1260
1461
|
expect(report).toContain('sourceOnly');
|
|
1261
|
-
expect(report).not.toContain('
|
|
1462
|
+
expect(report).not.toContain('expotools.js prebuild');
|
|
1262
1463
|
expect(report).toMatch(/^ {2}1\. To build it from source instead/m);
|
|
1263
1464
|
});
|
|
1264
1465
|
});
|