expo 58.0.0 → 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/android/proguard-rules.pro +4 -0
- package/android/src/main/java/expo/modules/fetch/NativeResponse.kt +5 -1
- package/android/src/main/java/expo/modules/fetch/OkHttpFileUrlInterceptor.kt +5 -1
- package/build/winter/runtime.native.js +0 -2
- package/build/winter/runtime.native.js.map +1 -1
- package/bundledNativeModules.json +76 -76
- 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 +13 -13
- package/scripts/spm/README.md +0 -3
- 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__/cli.test.js +57 -1
- package/scripts/spm/__tests__/diagnostics.test.js +806 -183
- package/scripts/spm/__tests__/flavored-frameworks.test.js +9 -0
- package/scripts/spm/__tests__/helpers.js +88 -0
- package/scripts/spm/__tests__/manifests.test.js +1330 -104
- package/scripts/spm/__tests__/metadata.test.js +120 -0
- package/scripts/spm/__tests__/plugin.test.js +3304 -111
- package/scripts/spm/__tests__/podspec.test.js +27 -138
- package/scripts/spm/__tests__/spm-dependencies.test.js +344 -0
- package/scripts/spm/app-target.js +42 -1
- package/scripts/spm/autolink-gate.js +40 -0
- package/scripts/spm/classify.js +78 -79
- package/scripts/spm/cli.js +23 -9
- package/scripts/spm/diagnostics.js +605 -192
- package/scripts/spm/flavored-frameworks.js +231 -64
- package/scripts/spm/manifests.js +565 -196
- package/scripts/spm/metadata.js +152 -0
- package/scripts/spm/plugin.js +679 -205
- package/scripts/spm/podspec.js +57 -170
- package/src/winter/runtime.native.ts +0 -2
- package/template.tgz +0 -0
- package/build/winter/AbortSignal.d.ts +0 -3
- package/build/winter/AbortSignal.js +0 -96
- package/build/winter/AbortSignal.js.map +0 -1
- package/src/winter/AbortSignal.ts +0 -132
- package/src/winter/__tests__/AbortSignal.test.native.ts +0 -163
|
@@ -15,8 +15,13 @@ const { execFileSync } = require('child_process');
|
|
|
15
15
|
const fs = require('fs');
|
|
16
16
|
const path = require('path');
|
|
17
17
|
|
|
18
|
+
const { pluginError } = require('./diagnostics');
|
|
19
|
+
|
|
18
20
|
const FLAVORS = ['debug', 'release'];
|
|
19
21
|
|
|
22
|
+
/** CocoaPods' byte order: it picks which contributor wins a collision, so never locale-dependent. */
|
|
23
|
+
const byteOrder = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
24
|
+
|
|
20
25
|
function stableFrameworkId(frameworkName) {
|
|
21
26
|
const kebab = frameworkName
|
|
22
27
|
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
@@ -45,18 +50,26 @@ function existingArtifactSource(baseDir, flavor, frameworkName) {
|
|
|
45
50
|
return null;
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Lookup order: EXPO_PRECOMPILED_MODULES_PATH, monorepo prebuild output, the npm package's
|
|
55
|
+
* `prebuilds/` copy.
|
|
56
|
+
*/
|
|
57
|
+
function precompiledBaseDirs(buildPath, moduleRoot, bundledPath) {
|
|
49
58
|
const bases = [];
|
|
50
59
|
if (process.env.EXPO_PRECOMPILED_MODULES_PATH) {
|
|
51
|
-
bases.push(path.resolve(process.env.EXPO_PRECOMPILED_MODULES_PATH,
|
|
60
|
+
bases.push(path.resolve(process.env.EXPO_PRECOMPILED_MODULES_PATH, ...buildPath));
|
|
52
61
|
}
|
|
53
62
|
bases.push(
|
|
54
|
-
path.resolve(__dirname, '..', '..', '..', 'precompile', '.build',
|
|
55
|
-
path.join(moduleRoot, 'prebuilds',
|
|
63
|
+
path.resolve(__dirname, '..', '..', '..', 'precompile', '.build', ...buildPath),
|
|
64
|
+
path.join(moduleRoot, 'prebuilds', ...bundledPath)
|
|
56
65
|
);
|
|
57
66
|
return Array.from(new Set(bases));
|
|
58
67
|
}
|
|
59
68
|
|
|
69
|
+
function artifactBaseDirs(packageName, moduleRoot) {
|
|
70
|
+
return precompiledBaseDirs([packageName, 'output'], moduleRoot, ['output']);
|
|
71
|
+
}
|
|
72
|
+
|
|
60
73
|
/**
|
|
61
74
|
* A flavor tarball holds one xcframework root per product the prebuild packed:
|
|
62
75
|
* the module itself plus any SwiftPM dependency bundled with it (for example
|
|
@@ -74,35 +87,33 @@ function validateTarEntries(tarballPath, frameworkName) {
|
|
|
74
87
|
.map((entry) => entry.replace(/^\.\//, '').replace(/\/$/, ''))
|
|
75
88
|
.filter(Boolean);
|
|
76
89
|
if (entries.length === 0) {
|
|
77
|
-
throw
|
|
90
|
+
throw pluginError({ what: `${tarballPath} is empty` });
|
|
78
91
|
}
|
|
79
92
|
const roots = new Set();
|
|
80
93
|
for (const entry of entries) {
|
|
81
94
|
const parts = entry.split('/');
|
|
82
95
|
if (path.isAbsolute(entry) || parts.includes('..')) {
|
|
83
|
-
throw
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
);
|
|
96
|
+
throw pluginError({
|
|
97
|
+
what: `${tarballPath} holds the unsafe path '${entry}'.`,
|
|
98
|
+
why: 'Extracting it would write outside the plugin cache, so the archive is not a precompiled Expo artifact.',
|
|
99
|
+
how: 'Delete it and rebuild or re-download the precompiled module.',
|
|
100
|
+
});
|
|
88
101
|
}
|
|
89
102
|
if (!/.+\.xcframework$/.test(parts[0])) {
|
|
90
|
-
throw
|
|
91
|
-
`
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
);
|
|
103
|
+
throw pluginError({
|
|
104
|
+
what: `in ${tarballPath}, '${entry}' is not part of an .xcframework.`,
|
|
105
|
+
why: 'A flavor tarball holds only XCFramework directories, so this archive was packed by something other than the Expo prebuild pipeline.',
|
|
106
|
+
how: 'Delete it and rebuild or re-download the precompiled module.',
|
|
107
|
+
});
|
|
96
108
|
}
|
|
97
109
|
roots.add(parts[0]);
|
|
98
110
|
}
|
|
99
111
|
if (!roots.has(expectedRoot)) {
|
|
100
|
-
throw
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
);
|
|
112
|
+
throw pluginError({
|
|
113
|
+
what: `${tarballPath} does not contain ${expectedRoot}; it holds ${Array.from(roots).sort().join(', ')}.`,
|
|
114
|
+
why: 'The tarball belongs to a different product or the prebuild for this one did not finish.',
|
|
115
|
+
how: 'Rebuild the module with the Expo prebuild pipeline, or re-download its precompiled artifacts.',
|
|
116
|
+
});
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
119
|
|
|
@@ -127,25 +138,35 @@ function extractTarball(sourcePath, frameworkName, cacheDir, flavor) {
|
|
|
127
138
|
} catch {}
|
|
128
139
|
|
|
129
140
|
validateTarEntries(sourcePath, frameworkName);
|
|
130
|
-
|
|
131
|
-
fs.rmSync(temp, { recursive: true, force: true });
|
|
132
|
-
fs.mkdirSync(temp, { recursive: true });
|
|
133
|
-
try {
|
|
141
|
+
replaceDirectory(destination, (temp) => {
|
|
134
142
|
execFileSync('tar', ['-xzf', sourcePath, '-C', temp], { stdio: 'pipe' });
|
|
135
143
|
const extracted = path.join(temp, `${frameworkName}.xcframework`);
|
|
136
144
|
if (!fs.existsSync(path.join(extracted, 'Info.plist'))) {
|
|
137
|
-
throw
|
|
138
|
-
|
|
139
|
-
);
|
|
145
|
+
throw pluginError({
|
|
146
|
+
what: `${sourcePath} did not extract ${frameworkName}.xcframework/Info.plist`,
|
|
147
|
+
});
|
|
140
148
|
}
|
|
141
149
|
fs.writeFileSync(path.join(temp, '.source.json'), stamp, 'utf8');
|
|
150
|
+
});
|
|
151
|
+
return xcframeworkPath;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Fills a sibling temp directory with `fill(temp)` and only then swaps it in for
|
|
156
|
+
* `destination`, so a fill that throws leaves the previous contents untouched.
|
|
157
|
+
*/
|
|
158
|
+
function replaceDirectory(destination, fill) {
|
|
159
|
+
const temp = `${destination}.tmp-${process.pid}`;
|
|
160
|
+
fs.rmSync(temp, { recursive: true, force: true });
|
|
161
|
+
fs.mkdirSync(temp, { recursive: true });
|
|
162
|
+
try {
|
|
163
|
+
fill(temp);
|
|
142
164
|
fs.rmSync(destination, { recursive: true, force: true });
|
|
143
165
|
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
144
166
|
fs.renameSync(temp, destination);
|
|
145
167
|
} finally {
|
|
146
168
|
fs.rmSync(temp, { recursive: true, force: true });
|
|
147
169
|
}
|
|
148
|
-
return xcframeworkPath;
|
|
149
170
|
}
|
|
150
171
|
|
|
151
172
|
function prepareArtifactSource(source, frameworkName, cacheDir, flavor) {
|
|
@@ -167,30 +188,26 @@ function validateFlavoredFramework(framework) {
|
|
|
167
188
|
framework.flavors == null ||
|
|
168
189
|
typeof framework.flavors !== 'object'
|
|
169
190
|
) {
|
|
170
|
-
throw
|
|
171
|
-
'
|
|
172
|
-
|
|
173
|
-
);
|
|
191
|
+
throw pluginError({
|
|
192
|
+
what: 'flavored framework declarations require a stable id, frameworkName, linkage="dynamic", and debug/release paths',
|
|
193
|
+
});
|
|
174
194
|
}
|
|
175
195
|
|
|
176
196
|
const normalized = {};
|
|
177
197
|
for (const flavor of FLAVORS) {
|
|
178
198
|
const value = framework.flavors[flavor];
|
|
179
199
|
if (typeof value !== 'string' || !path.isAbsolute(value)) {
|
|
180
|
-
throw
|
|
181
|
-
`[expo-spm-plugin] ${framework.frameworkName} ${flavor} path must be absolute`
|
|
182
|
-
);
|
|
200
|
+
throw pluginError({ what: `${framework.frameworkName} ${flavor} path must be absolute` });
|
|
183
201
|
}
|
|
184
202
|
if (path.basename(value) !== `${framework.frameworkName}.xcframework`) {
|
|
185
|
-
throw
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
);
|
|
203
|
+
throw pluginError({
|
|
204
|
+
what: `${framework.frameworkName} ${flavor} path must identify ${framework.frameworkName}.xcframework: ${value}`,
|
|
205
|
+
});
|
|
189
206
|
}
|
|
190
207
|
if (!fs.existsSync(path.join(value, 'Info.plist'))) {
|
|
191
|
-
throw
|
|
192
|
-
|
|
193
|
-
);
|
|
208
|
+
throw pluginError({
|
|
209
|
+
what: `${framework.frameworkName} ${flavor} XCFramework is incomplete: ${value}`,
|
|
210
|
+
});
|
|
194
211
|
}
|
|
195
212
|
normalized[flavor] = path.resolve(value);
|
|
196
213
|
}
|
|
@@ -218,11 +235,10 @@ function resolveFlavoredFramework({ packageName, moduleRoot, frameworkName, cach
|
|
|
218
235
|
}
|
|
219
236
|
for (const flavor of FLAVORS) {
|
|
220
237
|
if (sources[flavor] == null) {
|
|
221
|
-
throw
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
);
|
|
238
|
+
throw pluginError({
|
|
239
|
+
what: `${frameworkName} has an incomplete precompiled pair in ${baseDir}: missing ${flavor}.`,
|
|
240
|
+
how: 'Run the Expo prebuild pipeline for both Debug and Release before react-native spm update.',
|
|
241
|
+
});
|
|
226
242
|
}
|
|
227
243
|
}
|
|
228
244
|
return validateFlavoredFramework({
|
|
@@ -238,6 +254,164 @@ function resolveFlavoredFramework({ packageName, moduleRoot, frameworkName, cach
|
|
|
238
254
|
return null;
|
|
239
255
|
}
|
|
240
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Candidate parents (each holding `<flavor>/<Dep>.xcframework`) for a SwiftPM
|
|
259
|
+
* package a precompiled module links. The bundled copy lives in the npm package
|
|
260
|
+
* of the module that links it.
|
|
261
|
+
*/
|
|
262
|
+
function spmDependencyBaseDirs(depName, ownerModuleRoot) {
|
|
263
|
+
return precompiledBaseDirs(['.spm-deps', depName], ownerModuleRoot, ['spm-deps', depName]);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function readXcframeworkPlist(plistPath) {
|
|
267
|
+
try {
|
|
268
|
+
return JSON.parse(
|
|
269
|
+
execFileSync('plutil', ['-convert', 'json', '-o', '-', plistPath], { encoding: 'utf8' })
|
|
270
|
+
);
|
|
271
|
+
} catch (error) {
|
|
272
|
+
throw pluginError(
|
|
273
|
+
{
|
|
274
|
+
what: `${plistPath} could not be read as a property list: ${error.message}.`,
|
|
275
|
+
why: 'An XCFramework keeps the list of what it holds there, so this one is damaged or was never an XCFramework.',
|
|
276
|
+
how: 'Delete it and rebuild the dependency with the Expo prebuild pipeline, or reinstall the package that ships it.',
|
|
277
|
+
},
|
|
278
|
+
{ cause: error }
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** Rejects a static library or misnamed framework here, where the error can name the dependency. */
|
|
284
|
+
function assertEmbeddableFramework(depName, xcframeworkPath) {
|
|
285
|
+
const plistPath = path.join(xcframeworkPath, 'Info.plist');
|
|
286
|
+
const plist = readXcframeworkPlist(plistPath);
|
|
287
|
+
if (plist.AvailableLibraries != null && !Array.isArray(plist.AvailableLibraries)) {
|
|
288
|
+
throw pluginError({
|
|
289
|
+
what: `${plistPath} lists AvailableLibraries as something other than a list of slices, so the plugin cannot tell what the XCFramework holds.`,
|
|
290
|
+
why: 'The artifact is damaged.',
|
|
291
|
+
how: 'Delete it and rebuild the dependency with the Expo prebuild pipeline, or reinstall the package that ships it.',
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
const libraries = plist.AvailableLibraries ?? [];
|
|
295
|
+
const expected = `${depName}.framework`;
|
|
296
|
+
const unusable = libraries
|
|
297
|
+
.map((library) => library?.LibraryPath)
|
|
298
|
+
.filter((libraryPath) => libraryPath !== expected);
|
|
299
|
+
if (libraries.length === 0 || unusable.length > 0) {
|
|
300
|
+
const found =
|
|
301
|
+
unusable.map((libraryPath) => libraryPath ?? 'a slice with no LibraryPath').join(', ') ||
|
|
302
|
+
'no library slices';
|
|
303
|
+
throw pluginError({
|
|
304
|
+
what: `${depName} does not ship a ${expected}: ${xcframeworkPath} holds ${found}.`,
|
|
305
|
+
why: "React Native links and embeds Expo's precompiled dependencies as dynamic frameworks named after the product, so a static library, a differently named framework and an XCFramework without slices are all unusable.",
|
|
306
|
+
how: 'Rebuild the dependency with the Expo prebuild pipeline, or exclude the Expo module that links it in your app\'s package.json: "expo": { "autolinking": { "exclude": [...] } }.',
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Only ENOENT/ENOTDIR mean absent; other errors must not look like a missing artifact. */
|
|
312
|
+
function isDirectory(candidate) {
|
|
313
|
+
try {
|
|
314
|
+
return fs.statSync(candidate).isDirectory();
|
|
315
|
+
} catch (error) {
|
|
316
|
+
if (error.code === 'ENOENT' || error.code === 'ENOTDIR') {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
throw pluginError(
|
|
320
|
+
{
|
|
321
|
+
what: `${candidate} could not be read: ${error.message}.`,
|
|
322
|
+
why: 'The plugin cannot tell whether a precompiled dependency is there, and it will not silently build an app without one.',
|
|
323
|
+
how: 'Make that path readable — or delete it and rebuild the dependency with the Expo prebuild pipeline — then run `npx react-native spm update` again.',
|
|
324
|
+
},
|
|
325
|
+
{ cause: error }
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* RN rejects the whole graph on a repeated id/name (Foo and ExpoFoo both → expo-foo).
|
|
332
|
+
* A dependency can carry a module's name, so this runs on the combined array.
|
|
333
|
+
*/
|
|
334
|
+
function assertDistinctFlavoredFrameworks(frameworks) {
|
|
335
|
+
const describe = (framework) =>
|
|
336
|
+
framework.flavors?.debug != null
|
|
337
|
+
? `${framework.frameworkName} (${framework.flavors.debug})`
|
|
338
|
+
: framework.frameworkName;
|
|
339
|
+
for (const [key, label] of [
|
|
340
|
+
['id', 'framework id'],
|
|
341
|
+
['frameworkName', 'framework name'],
|
|
342
|
+
]) {
|
|
343
|
+
const seen = new Map();
|
|
344
|
+
for (const framework of frameworks) {
|
|
345
|
+
const previous = seen.get(framework[key]);
|
|
346
|
+
if (previous != null) {
|
|
347
|
+
throw pluginError({
|
|
348
|
+
what: `${describe(previous)} and ${describe(framework)} both declare the ${label} "${framework[key]}".`,
|
|
349
|
+
why: 'React Native embeds each flavored framework once and rejects the whole autolinking graph over a collision, so no Expo module would build.',
|
|
350
|
+
how: 'Exclude the Expo module that brings in one of the two in your app\'s package.json: "expo": { "autolinking": { "exclude": [...] } }, and report the pair at https://github.com/expo/expo/issues — one of the two products has to be renamed.',
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
seen.set(framework[key], framework);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Null when no artifact exists. Each flavor walks all candidates, so a partial monorepo build
|
|
360
|
+
* cannot shadow a complete bundled copy (as precompiled_modules.rb).
|
|
361
|
+
*/
|
|
362
|
+
function resolveSpmDependencyFramework(depName, ownerModuleRoot) {
|
|
363
|
+
const bases = spmDependencyBaseDirs(depName, ownerModuleRoot);
|
|
364
|
+
const flavors = {};
|
|
365
|
+
for (const flavor of FLAVORS) {
|
|
366
|
+
const base = bases.find((dir) => isDirectory(path.join(dir, flavor, `${depName}.xcframework`)));
|
|
367
|
+
if (base != null) flavors[flavor] = path.join(base, flavor, `${depName}.xcframework`);
|
|
368
|
+
}
|
|
369
|
+
const resolved = FLAVORS.filter((flavor) => flavors[flavor] != null);
|
|
370
|
+
if (resolved.length === 0) {
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
for (const flavor of FLAVORS) {
|
|
374
|
+
if (flavors[flavor] == null) {
|
|
375
|
+
throw pluginError({
|
|
376
|
+
what: `${depName} has no ${flavor} XCFramework, although its ${resolved[0]} one resolved.`,
|
|
377
|
+
why: `Expo declares its precompiled dependencies as immutable pairs, so half a pair would link in one configuration and fail to launch in the other with dyld "Library not loaded: @rpath/${depName}.framework/${depName}".`,
|
|
378
|
+
how: `Build the dependency for both flavors with the Expo prebuild pipeline, or install a package that ships both. Searched: ${bases.join(', ')}.`,
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
const framework = validateFlavoredFramework({
|
|
383
|
+
id: stableFrameworkId(depName),
|
|
384
|
+
frameworkName: depName,
|
|
385
|
+
linkage: 'dynamic',
|
|
386
|
+
flavors,
|
|
387
|
+
});
|
|
388
|
+
for (const flavor of FLAVORS) {
|
|
389
|
+
assertEmbeddableFramework(depName, framework.flavors[flavor]);
|
|
390
|
+
}
|
|
391
|
+
return framework;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* One declaration per linked SwiftPM package; owner = first consumer pod in byte order
|
|
396
|
+
* (CocoaPods' ensure_shared_spm_deps), searched for the bundled copy.
|
|
397
|
+
* The two installers must order names identically.
|
|
398
|
+
*/
|
|
399
|
+
function resolveSpmDependencyFrameworks(consumers) {
|
|
400
|
+
const owners = new Map();
|
|
401
|
+
for (const consumer of consumers) {
|
|
402
|
+
for (const depName of consumer.spmDependencies ?? []) {
|
|
403
|
+
const owner = owners.get(depName);
|
|
404
|
+
if (owner == null || consumer.podName < owner.podName) {
|
|
405
|
+
owners.set(depName, consumer);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return [...owners.keys()]
|
|
410
|
+
.sort()
|
|
411
|
+
.map((depName) => resolveSpmDependencyFramework(depName, owners.get(depName).moduleRoot))
|
|
412
|
+
.filter((framework) => framework != null);
|
|
413
|
+
}
|
|
414
|
+
|
|
241
415
|
function copyFileIfLarger(source, destination) {
|
|
242
416
|
let shouldCopy = true;
|
|
243
417
|
try {
|
|
@@ -253,7 +427,7 @@ function mergeDirectory(source, destination) {
|
|
|
253
427
|
if (!fs.existsSync(source)) return;
|
|
254
428
|
for (const entry of fs
|
|
255
429
|
.readdirSync(source, { withFileTypes: true })
|
|
256
|
-
.sort((a, b) => a.name
|
|
430
|
+
.sort((a, b) => byteOrder(a.name, b.name))) {
|
|
257
431
|
const src = path.join(source, entry.name);
|
|
258
432
|
const dst = path.join(destination, entry.name);
|
|
259
433
|
if (entry.isDirectory()) {
|
|
@@ -271,11 +445,8 @@ function mergeDirectory(source, destination) {
|
|
|
271
445
|
* RN owns all runtime linking and embedding of the flavored binaries.
|
|
272
446
|
*/
|
|
273
447
|
function prepareCompileInterfaces(frameworks, destination) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
fs.mkdirSync(temp, { recursive: true });
|
|
277
|
-
try {
|
|
278
|
-
for (const framework of [...frameworks].sort((a, b) => a.id.localeCompare(b.id))) {
|
|
448
|
+
replaceDirectory(destination, (temp) => {
|
|
449
|
+
for (const framework of [...frameworks].sort((a, b) => byteOrder(a.id, b.id))) {
|
|
279
450
|
const source = framework.flavors.debug;
|
|
280
451
|
const sliceFrameworks = fs
|
|
281
452
|
.readdirSync(source, { withFileTypes: true })
|
|
@@ -284,9 +455,7 @@ function prepareCompileInterfaces(frameworks, destination) {
|
|
|
284
455
|
.filter((candidate) => fs.existsSync(candidate))
|
|
285
456
|
.sort();
|
|
286
457
|
if (sliceFrameworks.length === 0) {
|
|
287
|
-
throw
|
|
288
|
-
`[expo-spm-plugin] ${source} has no ${framework.frameworkName}.framework slices`
|
|
289
|
-
);
|
|
458
|
+
throw pluginError({ what: `${source} has no ${framework.frameworkName}.framework slices` });
|
|
290
459
|
}
|
|
291
460
|
const target = path.join(temp, `${framework.frameworkName}.framework`);
|
|
292
461
|
for (const slice of sliceFrameworks) {
|
|
@@ -297,20 +466,18 @@ function prepareCompileInterfaces(frameworks, destination) {
|
|
|
297
466
|
}
|
|
298
467
|
}
|
|
299
468
|
}
|
|
300
|
-
|
|
301
|
-
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
302
|
-
fs.renameSync(temp, destination);
|
|
303
|
-
} finally {
|
|
304
|
-
fs.rmSync(temp, { recursive: true, force: true });
|
|
305
|
-
}
|
|
469
|
+
});
|
|
306
470
|
return destination;
|
|
307
471
|
}
|
|
308
472
|
|
|
309
473
|
module.exports = {
|
|
310
474
|
FLAVORS,
|
|
311
475
|
artifactBaseDirs,
|
|
476
|
+
assertDistinctFlavoredFrameworks,
|
|
477
|
+
byteOrder,
|
|
312
478
|
prepareCompileInterfaces,
|
|
313
479
|
resolveFlavoredFramework,
|
|
480
|
+
resolveSpmDependencyFrameworks,
|
|
314
481
|
stableFrameworkId,
|
|
315
482
|
validateFlavoredFramework,
|
|
316
483
|
};
|