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
|
@@ -8,16 +8,23 @@ const {
|
|
|
8
8
|
UnsupportedModulesError,
|
|
9
9
|
UNMAPPED_POD_ALLOWLIST,
|
|
10
10
|
classifyUnsupported,
|
|
11
|
-
podspecDependencies,
|
|
12
11
|
unmappedPodDependencies,
|
|
13
12
|
renderUnsupportedReport,
|
|
14
13
|
reportUnsupported,
|
|
15
14
|
renderUnmappedDependencyWarning,
|
|
15
|
+
renderLeftOutCompanionWarning,
|
|
16
|
+
collectDuplicatePods,
|
|
16
17
|
collectRootConflicts,
|
|
17
18
|
renderRootConflictWarning,
|
|
19
|
+
renderPartlyProvidedPackageWarning,
|
|
18
20
|
renderExtraPodsWarning,
|
|
19
21
|
} = require('../diagnostics');
|
|
20
|
-
const { resolvePodIdentities } = require('../plugin');
|
|
22
|
+
const { resolvePodIdentities, uncoveredPod } = require('../plugin');
|
|
23
|
+
const { podspecDependencies } = require('../podspec');
|
|
24
|
+
|
|
25
|
+
/** An uncovered pod, from the facts the plugin gathers and the refusal pass 2 recorded. */
|
|
26
|
+
const pendingPod = ({ hasSources = true, prebuildProduct = null, refusal = null, ...subject }) =>
|
|
27
|
+
uncoveredPod({ ...subject, prebuildProduct, sources: { hasSources } }, refusal);
|
|
21
28
|
|
|
22
29
|
describe('classifyUnsupported', () => {
|
|
23
30
|
it('reports a missing interface tree once, not per module', () => {
|
|
@@ -34,13 +41,12 @@ describe('classifyUnsupported', () => {
|
|
|
34
41
|
it('classifies a mixed-language module with no checked-in manifest', () => {
|
|
35
42
|
const [entry] = classifyUnsupported({
|
|
36
43
|
pending: [
|
|
37
|
-
{
|
|
44
|
+
pendingPod({
|
|
38
45
|
podName: 'ExpoAudio',
|
|
39
46
|
packageName: 'expo-audio',
|
|
40
47
|
moduleRoot: '/m/expo-audio',
|
|
41
|
-
pureSwift: false,
|
|
42
48
|
hasSources: true,
|
|
43
|
-
},
|
|
49
|
+
}),
|
|
44
50
|
],
|
|
45
51
|
coreAvailable: true,
|
|
46
52
|
});
|
|
@@ -50,14 +56,13 @@ describe('classifyUnsupported', () => {
|
|
|
50
56
|
it('prefers the prebuild route when the module declares a prebuildable product', () => {
|
|
51
57
|
const [entry] = classifyUnsupported({
|
|
52
58
|
pending: [
|
|
53
|
-
{
|
|
59
|
+
pendingPod({
|
|
54
60
|
podName: 'ExpoAudio',
|
|
55
61
|
packageName: 'expo-audio',
|
|
56
62
|
moduleRoot: '/m/expo-audio',
|
|
57
|
-
pureSwift: false,
|
|
58
63
|
hasSources: true,
|
|
59
64
|
prebuildProduct: { name: 'ExpoAudio', sourceOnly: false },
|
|
60
|
-
},
|
|
65
|
+
}),
|
|
61
66
|
],
|
|
62
67
|
coreAvailable: true,
|
|
63
68
|
});
|
|
@@ -67,14 +72,13 @@ describe('classifyUnsupported', () => {
|
|
|
67
72
|
it('does not offer the prebuild route for a source-only product', () => {
|
|
68
73
|
const [entry] = classifyUnsupported({
|
|
69
74
|
pending: [
|
|
70
|
-
{
|
|
75
|
+
pendingPod({
|
|
71
76
|
podName: 'ExpoModulesWorkletsAdapter',
|
|
72
77
|
packageName: 'expo-modules-core',
|
|
73
78
|
moduleRoot: '/m/expo-modules-core',
|
|
74
|
-
pureSwift: false,
|
|
75
79
|
hasSources: true,
|
|
76
80
|
prebuildProduct: { name: 'ExpoModulesWorkletsAdapter', sourceOnly: true },
|
|
77
|
-
},
|
|
81
|
+
}),
|
|
78
82
|
],
|
|
79
83
|
coreAvailable: true,
|
|
80
84
|
});
|
|
@@ -84,13 +88,12 @@ describe('classifyUnsupported', () => {
|
|
|
84
88
|
it('classifies a module whose apple sources could not be located', () => {
|
|
85
89
|
const [entry] = classifyUnsupported({
|
|
86
90
|
pending: [
|
|
87
|
-
{
|
|
91
|
+
pendingPod({
|
|
88
92
|
podName: 'ExpoWeird',
|
|
89
93
|
packageName: 'expo-weird',
|
|
90
94
|
moduleRoot: '/m/expo-weird',
|
|
91
|
-
pureSwift: true,
|
|
92
95
|
hasSources: false,
|
|
93
|
-
},
|
|
96
|
+
}),
|
|
94
97
|
],
|
|
95
98
|
coreAvailable: true,
|
|
96
99
|
});
|
|
@@ -103,18 +106,19 @@ describe('diagnostic priority', () => {
|
|
|
103
106
|
expect(
|
|
104
107
|
classifyUnsupported({
|
|
105
108
|
pending: [
|
|
106
|
-
{
|
|
109
|
+
pendingPod({
|
|
107
110
|
podName: 'ExpoBad',
|
|
108
111
|
packageName: 'expo-bad',
|
|
109
112
|
moduleRoot: '/m/expo-bad',
|
|
110
113
|
hasSources: true,
|
|
111
114
|
prebuildProduct: { name: 'ExpoBad', sourceOnly: false },
|
|
112
|
-
|
|
115
|
+
refusal: {
|
|
116
|
+
reason: 'needs-manifest-for-linkage',
|
|
113
117
|
file: '/m/expo-bad/ios/ExpoBad.podspec',
|
|
114
118
|
line: 19,
|
|
115
119
|
snippet: "s.frameworks = 'Photos'",
|
|
116
120
|
},
|
|
117
|
-
},
|
|
121
|
+
}),
|
|
118
122
|
],
|
|
119
123
|
coreAvailable: true,
|
|
120
124
|
})
|
|
@@ -131,33 +135,31 @@ describe('diagnostic priority', () => {
|
|
|
131
135
|
});
|
|
132
136
|
|
|
133
137
|
describe('diagnostic priority order', () => {
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
packageName: 'expo-bad',
|
|
137
|
-
moduleRoot: '/m/expo-bad',
|
|
138
|
-
hasSources: true,
|
|
139
|
-
...extra,
|
|
140
|
-
});
|
|
141
|
-
const reasonFor = (extra) =>
|
|
142
|
-
classifyUnsupported({ pending: [pending(extra)], coreAvailable: true })[0].reason;
|
|
138
|
+
const subject = { podName: 'ExpoBad', packageName: 'expo-bad', moduleRoot: '/m/expo-bad' };
|
|
139
|
+
const reasonFor = (pod) => classifyUnsupported({ pending: [pod], coreAvailable: true })[0].reason;
|
|
143
140
|
const podspecLinkage = {
|
|
141
|
+
reason: 'needs-manifest-for-linkage',
|
|
144
142
|
file: '/m/expo-bad/ios/ExpoBad.podspec',
|
|
145
143
|
line: 19,
|
|
146
144
|
snippet: "s.frameworks = 'Photos'",
|
|
147
145
|
};
|
|
146
|
+
const unresolvedTargets = { reason: 'unresolvable-target-path', targetNames: ['Main'] };
|
|
148
147
|
|
|
149
148
|
it('reports the linkage before targets whose sources it could not find', () => {
|
|
150
|
-
expect(reasonFor({
|
|
149
|
+
expect(reasonFor({ ...subject, refusals: [unresolvedTargets, podspecLinkage] })).toBe(
|
|
151
150
|
'needs-manifest-for-linkage'
|
|
152
151
|
);
|
|
153
152
|
});
|
|
154
153
|
|
|
155
154
|
it('asks for the prebuild before reporting targets it could not resolve', () => {
|
|
156
155
|
expect(
|
|
157
|
-
reasonFor(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
reasonFor(
|
|
157
|
+
pendingPod({
|
|
158
|
+
...subject,
|
|
159
|
+
refusal: unresolvedTargets,
|
|
160
|
+
prebuildProduct: { name: 'ExpoBad', sourceOnly: false },
|
|
161
|
+
})
|
|
162
|
+
)
|
|
161
163
|
).toBe('prebuild-available');
|
|
162
164
|
});
|
|
163
165
|
});
|
|
@@ -171,7 +173,12 @@ describe('linkage declared in a podspec', () => {
|
|
|
171
173
|
const entries = () =>
|
|
172
174
|
classifyUnsupported({
|
|
173
175
|
pending: [
|
|
174
|
-
{
|
|
176
|
+
pendingPod({
|
|
177
|
+
podName: 'ExpoBad',
|
|
178
|
+
packageName: 'expo-bad',
|
|
179
|
+
moduleRoot: '/m/expo-bad',
|
|
180
|
+
refusal: { reason: 'needs-manifest-for-linkage', ...podspecLinkage },
|
|
181
|
+
}),
|
|
175
182
|
],
|
|
176
183
|
coreAvailable: true,
|
|
177
184
|
});
|
|
@@ -359,6 +366,112 @@ describe('renderUnsupportedReport', () => {
|
|
|
359
366
|
expect(text).toContain('expo-weird');
|
|
360
367
|
expect(text).toMatch(/ios|apple/);
|
|
361
368
|
});
|
|
369
|
+
|
|
370
|
+
describe('a gated companion product its module would leave out', () => {
|
|
371
|
+
const companion = (autolinkWhen) =>
|
|
372
|
+
renderUnsupportedReport([
|
|
373
|
+
{
|
|
374
|
+
reason: 'unchecked-autolink-condition',
|
|
375
|
+
podName: 'ExpoCameraBarcodeScanning',
|
|
376
|
+
productName: 'ExpoCameraBarcodeScanning',
|
|
377
|
+
packageName: 'expo-camera',
|
|
378
|
+
moduleRoot: '/m/expo-camera',
|
|
379
|
+
precompiled: true,
|
|
380
|
+
linkedThrough: 'ExpoCamera',
|
|
381
|
+
autolinkWhen,
|
|
382
|
+
},
|
|
383
|
+
]);
|
|
384
|
+
|
|
385
|
+
const scannerProperty = 'expo.camera.barcode-scanner-enabled';
|
|
386
|
+
const gates = {
|
|
387
|
+
podfileProperty: {
|
|
388
|
+
gate: 'a Podfile property',
|
|
389
|
+
autolinkWhen: { podfileProperty: scannerProperty, disabledValue: 'false' },
|
|
390
|
+
because: `the Podfile property "${scannerProperty}" is not "false"`,
|
|
391
|
+
turnOff: `set "${scannerProperty}" to "false" in ios/Podfile.properties.json`,
|
|
392
|
+
},
|
|
393
|
+
podfilePropertyWithoutValue: {
|
|
394
|
+
gate: 'a Podfile property with no disabled value',
|
|
395
|
+
autolinkWhen: { podfileProperty: scannerProperty },
|
|
396
|
+
because: `the Podfile property "${scannerProperty}" is set`,
|
|
397
|
+
turnOff: `remove "${scannerProperty}" from ios/Podfile.properties.json`,
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
it.each(Object.values(gates))(
|
|
402
|
+
'says why CocoaPods links it and where to report it, for $gate',
|
|
403
|
+
({ autolinkWhen, because }) => {
|
|
404
|
+
const text = companion(autolinkWhen);
|
|
405
|
+
|
|
406
|
+
expect(text).toContain(`CocoaPods links "ExpoCameraBarcodeScanning" because ${because}.`);
|
|
407
|
+
expect(text).toContain('Swift Package Manager cannot link "ExpoCameraBarcodeScanning" yet');
|
|
408
|
+
expect(text).toContain('https://github.com/expo/expo/issues');
|
|
409
|
+
expect(text).not.toContain('Package.swift');
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
// `npx expo prebuild` rewrites Podfile.properties.json from config plugins.
|
|
414
|
+
it.each(Object.values(gates))(
|
|
415
|
+
'tells the app how to turn it off, by hand or through prebuild, for $gate',
|
|
416
|
+
({ autolinkWhen, turnOff }) => {
|
|
417
|
+
expect(companion(autolinkWhen)).toContain(
|
|
418
|
+
`If the app does not need "ExpoCameraBarcodeScanning", ${turnOff}. If ios/ is generated by npx expo prebuild, set the matching option in the module's config plugin instead.`
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
);
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
describe('a gated companion product its checked-in manifest does not export', () => {
|
|
425
|
+
const scannerGate = {
|
|
426
|
+
podfileProperty: 'expo.camera.barcode-scanner-enabled',
|
|
427
|
+
disabledValue: 'false',
|
|
428
|
+
};
|
|
429
|
+
const render = (autolinkWhen = scannerGate) =>
|
|
430
|
+
renderUnsupportedReport([
|
|
431
|
+
{
|
|
432
|
+
reason: 'companion-not-exported-by-manifest',
|
|
433
|
+
podName: 'ExpoCameraBarcodeScanning',
|
|
434
|
+
productName: 'ExpoCameraBarcodeScanning',
|
|
435
|
+
packageName: 'expo-camera',
|
|
436
|
+
moduleRoot: '/m/expo-camera',
|
|
437
|
+
autolinkWhen,
|
|
438
|
+
},
|
|
439
|
+
]);
|
|
440
|
+
|
|
441
|
+
it('says which product the manifest leaves out, and why its condition is met', () => {
|
|
442
|
+
expect(render()).toContain(
|
|
443
|
+
'error: Expo module "expo-camera" does not export its companion product "ExpoCameraBarcodeScanning" in its Package.swift, although the product\'s autolinkWhen condition is met: the Podfile property "expo.camera.barcode-scanner-enabled" is not "false".'
|
|
444
|
+
);
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
it('says the feature would be missing at runtime', () => {
|
|
448
|
+
const text = render();
|
|
449
|
+
expect(text).toContain('CocoaPods links "ExpoCameraBarcodeScanning" for this app');
|
|
450
|
+
expect(text).toContain('missing at runtime');
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
it('tells the module to export the product, not the app to remove a pod', () => {
|
|
454
|
+
const text = render();
|
|
455
|
+
expect(text).toContain(
|
|
456
|
+
'Add a `.library(name: "ExpoCameraBarcodeScanning", …)` product to /m/expo-camera/Package.swift'
|
|
457
|
+
);
|
|
458
|
+
expect(text).not.toContain('remove the pod');
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
it('tells the app how to turn it off, for a Podfile property gate', () => {
|
|
462
|
+
expect(render()).toContain(
|
|
463
|
+
'If the app does not need "ExpoCameraBarcodeScanning", set "expo.camera.barcode-scanner-enabled" to "false" in ios/Podfile.properties.json. If ios/ is generated by npx expo prebuild, set the matching option in the module\'s config plugin instead.'
|
|
464
|
+
);
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
it('offers no switch for a gate the app cannot turn off', () => {
|
|
468
|
+
const text = render({ npmPackage: 'react-native-worklets' });
|
|
469
|
+
|
|
470
|
+
expect(text).toContain('the app depends on react-native-worklets');
|
|
471
|
+
expect(text).not.toContain('If the app does not need');
|
|
472
|
+
expect(text).not.toContain('Podfile.properties.json');
|
|
473
|
+
});
|
|
474
|
+
});
|
|
362
475
|
});
|
|
363
476
|
|
|
364
477
|
describe('renderUnmappedDependencyWarning', () => {
|
|
@@ -381,6 +494,74 @@ describe('renderUnmappedDependencyWarning', () => {
|
|
|
381
494
|
});
|
|
382
495
|
});
|
|
383
496
|
|
|
497
|
+
describe('renderLeftOutCompanionWarning', () => {
|
|
498
|
+
const adapter = (autolinkWhen, precompiled = true) => ({
|
|
499
|
+
podName: 'ExpoModulesWorkletsAdapter',
|
|
500
|
+
productName: 'ExpoModulesWorkletsAdapter',
|
|
501
|
+
packageName: 'expo-modules-core',
|
|
502
|
+
moduleRoot: '/m/expo-modules-core',
|
|
503
|
+
precompiled,
|
|
504
|
+
linkedThrough: 'ExpoModulesCore',
|
|
505
|
+
autolinkWhen,
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
it.each([
|
|
509
|
+
{
|
|
510
|
+
gate: 'a pod',
|
|
511
|
+
autolinkWhen: { podName: 'RNWorklets' },
|
|
512
|
+
because: 'the app has the RNWorklets pod',
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
gate: 'an npm package',
|
|
516
|
+
autolinkWhen: { npmPackage: 'react-native-worklets' },
|
|
517
|
+
because: 'the app depends on react-native-worklets',
|
|
518
|
+
},
|
|
519
|
+
])(
|
|
520
|
+
'says which product is left out although CocoaPods links it, for $gate',
|
|
521
|
+
({ autolinkWhen, because }) => {
|
|
522
|
+
const text = renderLeftOutCompanionWarning([adapter(autolinkWhen)]);
|
|
523
|
+
|
|
524
|
+
expect(text).toContain(
|
|
525
|
+
'warning: Expo module "expo-modules-core" links its pod ExpoModulesCore as a precompiled XCFramework, so its product "ExpoModulesWorkletsAdapter" is left out of the app.'
|
|
526
|
+
);
|
|
527
|
+
expect(text).toContain(`CocoaPods links "ExpoModulesWorkletsAdapter" because ${because}.`);
|
|
528
|
+
}
|
|
529
|
+
);
|
|
530
|
+
|
|
531
|
+
it('says the feature is unavailable and how Swift Package Manager would link it', () => {
|
|
532
|
+
const text = renderLeftOutCompanionWarning([adapter({ podName: 'RNWorklets' }, false)]);
|
|
533
|
+
|
|
534
|
+
expect(text).toContain('from source without a checked-in Package.swift');
|
|
535
|
+
expect(text).toContain('unavailable at runtime');
|
|
536
|
+
expect(text).toContain('`.library(name: "ExpoModulesWorkletsAdapter", …)`');
|
|
537
|
+
expect(text).toContain(
|
|
538
|
+
'Otherwise, if the app needs "ExpoModulesWorkletsAdapter", build the app with CocoaPods.'
|
|
539
|
+
);
|
|
540
|
+
expect(text).not.toContain('until then');
|
|
541
|
+
expect(text).not.toContain('https://github.com/expo/expo/issues');
|
|
542
|
+
expect(text).not.toContain('error: ');
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
it('names every left-out companion', () => {
|
|
546
|
+
const text = renderLeftOutCompanionWarning([
|
|
547
|
+
adapter({ podName: 'RNWorklets' }),
|
|
548
|
+
{
|
|
549
|
+
...adapter({ npmPackage: 'expo-camera' }),
|
|
550
|
+
podName: 'ExpoCameraBarcodeScanning',
|
|
551
|
+
productName: 'ExpoCameraBarcodeScanning',
|
|
552
|
+
packageName: 'expo-camera',
|
|
553
|
+
},
|
|
554
|
+
]);
|
|
555
|
+
|
|
556
|
+
expect(text).toContain('"ExpoModulesWorkletsAdapter"');
|
|
557
|
+
expect(text).toContain('"ExpoCameraBarcodeScanning"');
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
it('returns an empty string when nothing is left out', () => {
|
|
561
|
+
expect(renderLeftOutCompanionWarning([])).toBe('');
|
|
562
|
+
});
|
|
563
|
+
});
|
|
564
|
+
|
|
384
565
|
describe('reportUnsupported', () => {
|
|
385
566
|
it('returns null and prints nothing when every module is covered', () => {
|
|
386
567
|
const spy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
@@ -410,14 +591,14 @@ describe('reportUnsupported', () => {
|
|
|
410
591
|
|
|
411
592
|
describe('unresolvable target paths', () => {
|
|
412
593
|
const pending = [
|
|
413
|
-
{
|
|
594
|
+
pendingPod({
|
|
414
595
|
podName: 'ExpoFoo',
|
|
415
596
|
packageName: 'expo-foo',
|
|
416
597
|
moduleRoot: '/node_modules/expo-foo',
|
|
417
598
|
hasSources: true,
|
|
418
599
|
prebuildProduct: null,
|
|
419
|
-
|
|
420
|
-
},
|
|
600
|
+
refusal: { reason: 'unresolvable-target-path', targetNames: ['Example'] },
|
|
601
|
+
}),
|
|
421
602
|
];
|
|
422
603
|
|
|
423
604
|
it('classifies a module whose target sources could not be located', () => {
|
|
@@ -443,16 +624,16 @@ describe('unresolvable target paths', () => {
|
|
|
443
624
|
});
|
|
444
625
|
|
|
445
626
|
describe('dependencies on targets the generated package cannot declare', () => {
|
|
446
|
-
const
|
|
447
|
-
{
|
|
627
|
+
const podDependingOn = (dependencies) =>
|
|
628
|
+
pendingPod({
|
|
448
629
|
podName: 'ExpoFoo',
|
|
449
630
|
packageName: 'expo-foo',
|
|
450
631
|
moduleRoot: '/node_modules/expo-foo',
|
|
451
632
|
hasSources: true,
|
|
452
633
|
prebuildProduct: null,
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
];
|
|
634
|
+
refusal: { reason: 'unsupported-target-dependency', dependencies },
|
|
635
|
+
});
|
|
636
|
+
const pending = [podDependingOn([{ target: 'ExpoFoo', dependsOn: 'FooKit', kind: 'binary' }])];
|
|
456
637
|
|
|
457
638
|
it('classifies a module whose manifest depends on a non-regular target', () => {
|
|
458
639
|
expect(classifyUnsupported({ pending, coreAvailable: true })).toEqual([
|
|
@@ -482,13 +663,10 @@ describe('dependencies on targets the generated package cannot declare', () => {
|
|
|
482
663
|
const report = renderUnsupportedReport(
|
|
483
664
|
classifyUnsupported({
|
|
484
665
|
pending: [
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
{ target: 'ExpoFoo', dependsOn: 'FooMystery' },
|
|
490
|
-
],
|
|
491
|
-
},
|
|
666
|
+
podDependingOn([
|
|
667
|
+
{ target: 'ExpoFoo', dependsOn: 'FooSystem', kind: 'systemLibrary' },
|
|
668
|
+
{ target: 'ExpoFoo', dependsOn: 'FooMystery' },
|
|
669
|
+
]),
|
|
492
670
|
],
|
|
493
671
|
coreAvailable: true,
|
|
494
672
|
})
|
|
@@ -503,13 +681,10 @@ describe('dependencies on targets the generated package cannot declare', () => {
|
|
|
503
681
|
const report = renderUnsupportedReport(
|
|
504
682
|
classifyUnsupported({
|
|
505
683
|
pending: [
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
{ target: 'ExpoFooObjC', dependsOn: 'FooMacros', kind: 'macro' },
|
|
511
|
-
],
|
|
512
|
-
},
|
|
684
|
+
podDependingOn([
|
|
685
|
+
{ target: 'ExpoFoo', dependsOn: 'FooKit', kind: 'binary' },
|
|
686
|
+
{ target: 'ExpoFooObjC', dependsOn: 'FooMacros', kind: 'macro' },
|
|
687
|
+
]),
|
|
513
688
|
],
|
|
514
689
|
coreAvailable: true,
|
|
515
690
|
})
|
|
@@ -527,7 +702,14 @@ describe('a module installed twice', () => {
|
|
|
527
702
|
fs.mkdirSync(created, { recursive: true });
|
|
528
703
|
return created;
|
|
529
704
|
};
|
|
530
|
-
const
|
|
705
|
+
const conflicts = (documented, autolinked) =>
|
|
706
|
+
collectRootConflicts(
|
|
707
|
+
resolvePodIdentities(
|
|
708
|
+
[{ packageName: 'expo-camera', pods: [{ podName: 'ExpoCamera' }] }],
|
|
709
|
+
new Map([['ExpoCamera', { packageRoot: documented }]]),
|
|
710
|
+
new Map([['expo-camera', autolinked]])
|
|
711
|
+
)
|
|
712
|
+
);
|
|
531
713
|
|
|
532
714
|
beforeAll(() => {
|
|
533
715
|
tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-roots-')));
|
|
@@ -540,42 +722,20 @@ describe('a module installed twice', () => {
|
|
|
540
722
|
const link = path.join(dir('links'), 'expo-camera');
|
|
541
723
|
fs.symlinkSync(packageRoot, link, 'dir');
|
|
542
724
|
|
|
543
|
-
expect(
|
|
544
|
-
collectRootConflicts(
|
|
545
|
-
resolvePodIdentities(
|
|
546
|
-
modules,
|
|
547
|
-
{ ExpoCamera: { packageRoot } },
|
|
548
|
-
new Map([['expo-camera', link]])
|
|
549
|
-
)
|
|
550
|
-
)
|
|
551
|
-
).toEqual([]);
|
|
725
|
+
expect(conflicts(packageRoot, link)).toEqual([]);
|
|
552
726
|
});
|
|
553
727
|
|
|
554
728
|
it('finds a conflict when the two roots are different directories', () => {
|
|
555
729
|
const packageRoot = dir('node_modules', 'expo-camera');
|
|
556
730
|
const autolinkedRoot = dir('node_modules', 'some-lib', 'node_modules', 'expo-camera');
|
|
557
731
|
|
|
558
|
-
expect(
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
modules,
|
|
562
|
-
{ ExpoCamera: { packageRoot } },
|
|
563
|
-
new Map([['expo-camera', autolinkedRoot]])
|
|
564
|
-
)
|
|
565
|
-
)
|
|
566
|
-
).toEqual([{ packageName: 'expo-camera', moduleRoot: packageRoot, autolinkedRoot }]);
|
|
732
|
+
expect(conflicts(packageRoot, autolinkedRoot)).toEqual([
|
|
733
|
+
{ packageName: 'expo-camera', moduleRoot: packageRoot, autolinkedRoot },
|
|
734
|
+
]);
|
|
567
735
|
});
|
|
568
736
|
|
|
569
737
|
it('finds no conflict for a documented root that is gone', () => {
|
|
570
|
-
expect(
|
|
571
|
-
collectRootConflicts(
|
|
572
|
-
resolvePodIdentities(
|
|
573
|
-
modules,
|
|
574
|
-
{ ExpoCamera: { packageRoot: path.join(tmp, 'vanished') } },
|
|
575
|
-
new Map([['expo-camera', dir('node_modules', 'expo-camera')]])
|
|
576
|
-
)
|
|
577
|
-
)
|
|
578
|
-
).toEqual([]);
|
|
738
|
+
expect(conflicts(path.join(tmp, 'vanished'), dir('node_modules', 'expo-camera'))).toEqual([]);
|
|
579
739
|
});
|
|
580
740
|
|
|
581
741
|
// A path that cannot be resolved cannot be compared, and a diagnostic is never
|
|
@@ -586,18 +746,11 @@ describe('a module installed twice', () => {
|
|
|
586
746
|
throw Object.assign(new Error('ENOENT'), { code: 'ENOENT' });
|
|
587
747
|
});
|
|
588
748
|
|
|
589
|
-
expect(
|
|
590
|
-
collectRootConflicts(
|
|
591
|
-
resolvePodIdentities(
|
|
592
|
-
modules,
|
|
593
|
-
{ ExpoCamera: { packageRoot } },
|
|
594
|
-
new Map([['expo-camera', path.join(tmp, 'elsewhere')]])
|
|
595
|
-
)
|
|
596
|
-
)
|
|
597
|
-
).toEqual([]);
|
|
749
|
+
expect(conflicts(packageRoot, path.join(tmp, 'elsewhere'))).toEqual([]);
|
|
598
750
|
});
|
|
599
751
|
|
|
600
|
-
|
|
752
|
+
// The copies can be different versions, so the mismatch is not confined to runtime.
|
|
753
|
+
it('names both directories, what uses each, both failure modes, and how to deduplicate', () => {
|
|
601
754
|
const report = renderRootConflictWarning([
|
|
602
755
|
{
|
|
603
756
|
packageName: 'expo-camera',
|
|
@@ -610,17 +763,6 @@ describe('a module installed twice', () => {
|
|
|
610
763
|
expect(report).toContain('/app/node_modules/some-lib/node_modules/expo-camera');
|
|
611
764
|
expect(report).toContain('npm ls expo-camera');
|
|
612
765
|
expect(report).toContain('dedupe');
|
|
613
|
-
});
|
|
614
|
-
|
|
615
|
-
// The copies can be different versions, so the mismatch is not confined to runtime.
|
|
616
|
-
it('names both failure modes, without pseudo-code for the import', () => {
|
|
617
|
-
const report = renderRootConflictWarning([
|
|
618
|
-
{
|
|
619
|
-
packageName: 'expo-camera',
|
|
620
|
-
moduleRoot: '/app/node_modules/expo-camera',
|
|
621
|
-
autolinkedRoot: '/app/node_modules/some-lib/node_modules/expo-camera',
|
|
622
|
-
},
|
|
623
|
-
]);
|
|
624
766
|
expect(report).toContain("your app's JavaScript imports the second");
|
|
625
767
|
expect(report).toContain('usually surfaces at runtime');
|
|
626
768
|
expect(report).toContain('can fail the build');
|
|
@@ -631,50 +773,253 @@ describe('a module installed twice', () => {
|
|
|
631
773
|
});
|
|
632
774
|
});
|
|
633
775
|
|
|
634
|
-
describe('
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
expect(report).
|
|
776
|
+
describe('a package kept for more than the products a precompiled framework provides', () => {
|
|
777
|
+
it('names the package, both sets of products, why that can duplicate one, and the fixes', () => {
|
|
778
|
+
const report = renderPartlyProvidedPackageWarning([
|
|
779
|
+
{
|
|
780
|
+
packageName: 'expo-maps-extra',
|
|
781
|
+
moduleRoot: '/app/node_modules/expo-maps-extra',
|
|
782
|
+
url: 'https://github.com/SDWebImage/SDWebImage.git',
|
|
783
|
+
providedProducts: ['SDWebImage'],
|
|
784
|
+
keptProducts: ['SDWebImageMapKit'],
|
|
785
|
+
},
|
|
786
|
+
]);
|
|
787
|
+
expect(report).toMatch(
|
|
788
|
+
/^warning: Expo module "expo-maps-extra" still declares https:\/\/github\.com\/SDWebImage\/SDWebImage\.git for "SDWebImageMapKit"/
|
|
789
|
+
);
|
|
790
|
+
expect(report).toContain('"SDWebImage" comes from a precompiled framework');
|
|
791
|
+
expect(report).toContain('second copy');
|
|
792
|
+
expect(report).toContain('stop using "SDWebImageMapKit"');
|
|
793
|
+
expect(report).toContain('from source');
|
|
794
|
+
expect(report).toContain('Module path: /app/node_modules/expo-maps-extra');
|
|
646
795
|
});
|
|
647
796
|
|
|
648
|
-
it('names a
|
|
649
|
-
const report =
|
|
650
|
-
{
|
|
651
|
-
|
|
797
|
+
it('names a product depended on by name without a package, and every package kept', () => {
|
|
798
|
+
const report = renderPartlyProvidedPackageWarning([
|
|
799
|
+
{
|
|
800
|
+
packageName: 'expo-maps-extra',
|
|
801
|
+
moduleRoot: '/app/node_modules/expo-maps-extra',
|
|
802
|
+
providedProducts: ['SDWebImage'],
|
|
803
|
+
keptPackages: ['https://github.com/SDWebImage/libavif-Xcode.git'],
|
|
804
|
+
},
|
|
652
805
|
]);
|
|
806
|
+
expect(report).toMatch(
|
|
807
|
+
/^warning: Expo module "expo-maps-extra" names "SDWebImage" without a package, and it comes from a precompiled framework\./
|
|
808
|
+
);
|
|
653
809
|
expect(report).toContain(
|
|
654
|
-
'
|
|
810
|
+
'may still build it from https://github.com/SDWebImage/libavif-Xcode.git, which'
|
|
655
811
|
);
|
|
656
|
-
expect(report).toContain('
|
|
812
|
+
expect(report).toContain('stop using https://github.com/SDWebImage/libavif-Xcode.git');
|
|
813
|
+
expect(report).toContain('from source');
|
|
814
|
+
expect(report).toContain('Module path: /app/node_modules/expo-maps-extra');
|
|
657
815
|
});
|
|
658
816
|
|
|
659
|
-
it('
|
|
660
|
-
const report =
|
|
661
|
-
{
|
|
662
|
-
|
|
663
|
-
|
|
817
|
+
it('says "one of" only when more than one package is still declared', () => {
|
|
818
|
+
const report = renderPartlyProvidedPackageWarning([
|
|
819
|
+
{
|
|
820
|
+
packageName: 'expo-maps-extra',
|
|
821
|
+
moduleRoot: '/app/node_modules/expo-maps-extra',
|
|
822
|
+
providedProducts: ['SDWebImage'],
|
|
823
|
+
keptPackages: [
|
|
824
|
+
'https://github.com/SDWebImage/libavif-Xcode.git',
|
|
825
|
+
'https://github.com/airbnb/lottie-spm.git',
|
|
826
|
+
],
|
|
827
|
+
},
|
|
664
828
|
]);
|
|
665
829
|
expect(report).toContain(
|
|
666
|
-
'
|
|
830
|
+
'may still build it from one of https://github.com/SDWebImage/libavif-Xcode.git, https://github.com/airbnb/lottie-spm.git, which'
|
|
667
831
|
);
|
|
668
|
-
|
|
669
|
-
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
// Only the package's own products can be attributed to it.
|
|
835
|
+
it('names a remaining byName dependency as possibly, not certainly, from the package', () => {
|
|
836
|
+
const report = renderPartlyProvidedPackageWarning([
|
|
837
|
+
{
|
|
838
|
+
packageName: 'expo-maps-extra',
|
|
839
|
+
moduleRoot: '/app/node_modules/expo-maps-extra',
|
|
840
|
+
url: 'https://github.com/SDWebImage/SDWebImage.git',
|
|
841
|
+
providedProducts: ['SDWebImage'],
|
|
842
|
+
keptProducts: [],
|
|
843
|
+
unattributedNames: ['Lottie'],
|
|
844
|
+
},
|
|
845
|
+
]);
|
|
846
|
+
expect(report).toMatch(
|
|
847
|
+
/^warning: Expo module "expo-maps-extra" still declares https:\/\/github\.com\/SDWebImage\/SDWebImage\.git, while "SDWebImage" comes from a precompiled framework\./
|
|
670
848
|
);
|
|
671
|
-
expect(report).toContain(
|
|
672
|
-
|
|
849
|
+
expect(report).not.toContain('for "Lottie"');
|
|
850
|
+
expect(report).not.toContain('for ""');
|
|
851
|
+
expect(report).toContain('names "Lottie" without a package, which may come from it');
|
|
852
|
+
});
|
|
853
|
+
|
|
854
|
+
it('names each product the module uses once, joined as alternatives', () => {
|
|
855
|
+
const report = renderPartlyProvidedPackageWarning([
|
|
856
|
+
{
|
|
857
|
+
packageName: 'expo-maps-extra',
|
|
858
|
+
moduleRoot: '/app/node_modules/expo-maps-extra',
|
|
859
|
+
url: 'https://github.com/SDWebImage/SDWebImage.git',
|
|
860
|
+
providedProducts: ['SDWebImage'],
|
|
861
|
+
keptProducts: ['SDWebImageMapKit'],
|
|
862
|
+
unattributedNames: ['SDWebImageMapKit', 'Lottie'],
|
|
863
|
+
},
|
|
864
|
+
]);
|
|
865
|
+
expect(report).toContain('If "SDWebImageMapKit" or "Lottie" depends on "SDWebImage"');
|
|
866
|
+
expect(report).toContain('stop using "SDWebImageMapKit" or "Lottie" in "expo-maps-extra"');
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
it('renders nothing when every such package was left out', () => {
|
|
870
|
+
expect(renderPartlyProvidedPackageWarning([])).toBe('');
|
|
871
|
+
});
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
describe('separate copies of one pod name', () => {
|
|
875
|
+
let tmp;
|
|
876
|
+
beforeAll(() => {
|
|
877
|
+
tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-copies-')));
|
|
878
|
+
});
|
|
879
|
+
const dir = (name) => {
|
|
880
|
+
const created = path.join(tmp, name);
|
|
881
|
+
fs.mkdirSync(created, { recursive: true });
|
|
882
|
+
return created;
|
|
883
|
+
};
|
|
884
|
+
const duplicatesIn = (...listings) =>
|
|
885
|
+
collectDuplicatePods(
|
|
886
|
+
new Map(
|
|
887
|
+
listings.map(([packageName, declaringRoot], index) => [
|
|
888
|
+
index,
|
|
889
|
+
{ podName: 'ExpoX', packageName, declaringRoot },
|
|
890
|
+
])
|
|
891
|
+
)
|
|
673
892
|
);
|
|
893
|
+
|
|
894
|
+
// P at r1 and P at r2 are one package; Q at r2 is the directory P at r2 is in.
|
|
895
|
+
// Joined either way, all three are one copy.
|
|
896
|
+
it('is one copy for listings joined through a shared package or directory, in any order', () => {
|
|
897
|
+
const a = ['expo-p', dir('r1')];
|
|
898
|
+
const b = ['expo-q', dir('r2')];
|
|
899
|
+
const c = ['expo-p', dir('r2')];
|
|
900
|
+
|
|
901
|
+
for (const order of [
|
|
902
|
+
[a, b, c],
|
|
903
|
+
[a, c, b],
|
|
904
|
+
[b, a, c],
|
|
905
|
+
[b, c, a],
|
|
906
|
+
[c, a, b],
|
|
907
|
+
[c, b, a],
|
|
908
|
+
]) {
|
|
909
|
+
expect(duplicatesIn(...order)).toEqual([]);
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
it('shows each copy by its lowest root, in any order', () => {
|
|
914
|
+
const a = ['expo-p', dir('r1')];
|
|
915
|
+
const c = ['expo-p', dir('r2')];
|
|
916
|
+
const d = ['expo-z', dir('r3')];
|
|
917
|
+
const copies = [
|
|
918
|
+
{ packageName: 'expo-p', moduleRoot: a[1] },
|
|
919
|
+
{ packageName: 'expo-z', moduleRoot: d[1] },
|
|
920
|
+
];
|
|
921
|
+
|
|
922
|
+
for (const order of [
|
|
923
|
+
[a, c, d],
|
|
924
|
+
[a, d, c],
|
|
925
|
+
[c, a, d],
|
|
926
|
+
[c, d, a],
|
|
927
|
+
[d, a, c],
|
|
928
|
+
[d, c, a],
|
|
929
|
+
]) {
|
|
930
|
+
expect(duplicatesIn(...order)).toEqual([
|
|
931
|
+
{ reason: 'duplicate-pod-name', podName: 'ExpoX', copies },
|
|
932
|
+
]);
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
|
|
936
|
+
it('is one copy for one directory reached through a symlink', () => {
|
|
937
|
+
const link = path.join(tmp, 'alias');
|
|
938
|
+
fs.symlinkSync(dir('shared'), link, 'dir');
|
|
939
|
+
|
|
940
|
+
expect(duplicatesIn(['expo-a', dir('shared')], ['expo-b', link])).toEqual([]);
|
|
941
|
+
});
|
|
942
|
+
|
|
943
|
+
it('keeps two roots that cannot be resolved apart, in any order', () => {
|
|
944
|
+
const a = ['expo-a', path.join(tmp, 'missing-a')];
|
|
945
|
+
const b = ['expo-b', path.join(tmp, 'missing-b')];
|
|
946
|
+
const duplicate = [
|
|
947
|
+
{
|
|
948
|
+
reason: 'duplicate-pod-name',
|
|
949
|
+
podName: 'ExpoX',
|
|
950
|
+
copies: [
|
|
951
|
+
{ packageName: a[0], moduleRoot: a[1] },
|
|
952
|
+
{ packageName: b[0], moduleRoot: b[1] },
|
|
953
|
+
],
|
|
954
|
+
},
|
|
955
|
+
];
|
|
956
|
+
|
|
957
|
+
expect(duplicatesIn(a, b)).toEqual(duplicate);
|
|
958
|
+
expect(duplicatesIn(b, a)).toEqual(duplicate);
|
|
959
|
+
});
|
|
960
|
+
|
|
961
|
+
it('is one copy for one unresolvable root two packages name identically', () => {
|
|
962
|
+
const missing = path.join(tmp, 'missing');
|
|
963
|
+
|
|
964
|
+
expect(duplicatesIn(['expo-a', missing], ['expo-b', missing])).toEqual([]);
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
it('names every copy, why the sync fails, and how to keep one', () => {
|
|
968
|
+
const report = renderUnsupportedReport([
|
|
969
|
+
{
|
|
970
|
+
reason: 'duplicate-pod-name',
|
|
971
|
+
podName: 'ExpoX',
|
|
972
|
+
copies: [
|
|
973
|
+
{ packageName: 'expo-x', moduleRoot: '/app/node_modules/expo-x' },
|
|
974
|
+
{ packageName: 'expo-x-fork', moduleRoot: '/app/node_modules/expo-x-fork' },
|
|
975
|
+
{ packageName: 'expo-x-next', moduleRoot: '/app/node_modules/expo-x-next' },
|
|
976
|
+
],
|
|
977
|
+
},
|
|
978
|
+
]);
|
|
979
|
+
|
|
980
|
+
expect(report).toMatch(/^error: The pod ExpoX is declared by 3 different packages/);
|
|
981
|
+
expect(report).toContain('\n "expo-x" at /app/node_modules/expo-x\n');
|
|
982
|
+
expect(report).toContain('\n "expo-x-fork" at /app/node_modules/expo-x-fork\n');
|
|
983
|
+
expect(report).toContain('links a pod name only once');
|
|
984
|
+
expect(report).toContain('"exclude": ["expo-x-fork", "expo-x-next"]');
|
|
985
|
+
});
|
|
986
|
+
});
|
|
987
|
+
|
|
988
|
+
describe('extra CocoaPods dependencies', () => {
|
|
989
|
+
const FIREBASE_GIT = 'https://github.com/firebase/firebase-ios-sdk.git';
|
|
990
|
+
const origins = [
|
|
991
|
+
[
|
|
992
|
+
'MyLocalPod (local path: ../vendor/MyLocalPod)',
|
|
993
|
+
{ name: 'MyLocalPod', path: '../vendor/MyLocalPod' },
|
|
994
|
+
],
|
|
995
|
+
[`Firebase (git: ${FIREBASE_GIT})`, { name: 'Firebase', git: FIREBASE_GIT }],
|
|
996
|
+
['AppCenter (published pod)', { name: 'AppCenter' }],
|
|
997
|
+
[
|
|
998
|
+
'InternalSDK (spec repo: https://specs.example.com/private.git, version 2.1.0)',
|
|
999
|
+
{ name: 'InternalSDK', source: 'https://specs.example.com/private.git', version: '2.1.0' },
|
|
1000
|
+
],
|
|
1001
|
+
['AppCenter (published pod, version 5.0.0)', { name: 'AppCenter', version: '5.0.0' }],
|
|
1002
|
+
// A git pod's ref is the only thing that says which code it means.
|
|
1003
|
+
[
|
|
1004
|
+
`Firebase (git: ${FIREBASE_GIT}, tag 10.0.0)`,
|
|
1005
|
+
{ name: 'Firebase', git: FIREBASE_GIT, tag: '10.0.0' },
|
|
1006
|
+
],
|
|
1007
|
+
[
|
|
1008
|
+
'Sentry (git: https://github.com/getsentry/sentry-cocoa.git, branch main)',
|
|
1009
|
+
{ name: 'Sentry', git: 'https://github.com/getsentry/sentry-cocoa.git', branch: 'main' },
|
|
1010
|
+
],
|
|
1011
|
+
[
|
|
1012
|
+
'Lottie (git: https://github.com/airbnb/lottie-ios.git, commit a1b2c3d)',
|
|
1013
|
+
{ name: 'Lottie', git: 'https://github.com/airbnb/lottie-ios.git', commit: 'a1b2c3d' },
|
|
1014
|
+
],
|
|
1015
|
+
];
|
|
1016
|
+
const report = renderExtraPodsWarning(origins.map(([, pod]) => pod));
|
|
1017
|
+
|
|
1018
|
+
it.each(origins)('lists %s', (line) => {
|
|
1019
|
+
expect(report).toContain(line);
|
|
674
1020
|
});
|
|
675
1021
|
|
|
676
1022
|
it('says what declared them, how they fail, and what to do instead', () => {
|
|
677
|
-
const report = renderExtraPodsWarning(pods);
|
|
678
1023
|
expect(report).toMatch(/^warning: /);
|
|
679
1024
|
expect(report).toContain('extraPods');
|
|
680
1025
|
expect(report).toContain('Podfile.properties.json');
|
|
@@ -687,3 +1032,231 @@ describe('extra CocoaPods dependencies', () => {
|
|
|
687
1032
|
expect(renderExtraPodsWarning([])).toBe('');
|
|
688
1033
|
});
|
|
689
1034
|
});
|
|
1035
|
+
|
|
1036
|
+
describe('Swift packages the generated package cannot declare', () => {
|
|
1037
|
+
const podDeclaring = (dependencies) =>
|
|
1038
|
+
pendingPod({
|
|
1039
|
+
podName: 'ExpoImage',
|
|
1040
|
+
packageName: 'expo-image',
|
|
1041
|
+
moduleRoot: '/node_modules/expo-image',
|
|
1042
|
+
hasSources: true,
|
|
1043
|
+
prebuildProduct: null,
|
|
1044
|
+
refusal: { reason: 'unsupported-package-dependency', dependencies },
|
|
1045
|
+
});
|
|
1046
|
+
const pending = [podDeclaring([{ form: 'local-path', identity: 'sdwebimage', target: null }])];
|
|
1047
|
+
|
|
1048
|
+
const report = (unsupportedPackageDeps) =>
|
|
1049
|
+
renderUnsupportedReport(
|
|
1050
|
+
classifyUnsupported({
|
|
1051
|
+
pending: [podDeclaring(unsupportedPackageDeps)],
|
|
1052
|
+
coreAvailable: true,
|
|
1053
|
+
})
|
|
1054
|
+
);
|
|
1055
|
+
|
|
1056
|
+
it('classifies a module whose manifest declares a package it cannot mirror', () => {
|
|
1057
|
+
expect(classifyUnsupported({ pending, coreAvailable: true })).toEqual([
|
|
1058
|
+
{
|
|
1059
|
+
reason: 'unsupported-package-dependency',
|
|
1060
|
+
podName: 'ExpoImage',
|
|
1061
|
+
packageName: 'expo-image',
|
|
1062
|
+
moduleRoot: '/node_modules/expo-image',
|
|
1063
|
+
dependencies: [{ form: 'local-path', identity: 'sdwebimage', target: null }],
|
|
1064
|
+
},
|
|
1065
|
+
]);
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
it('names the package, what is wrong with it, and the next step', () => {
|
|
1069
|
+
const text = renderUnsupportedReport(classifyUnsupported({ pending, coreAvailable: true }));
|
|
1070
|
+
expect(text).toMatch(/^error: Expo module "expo-image" \(pod ExpoImage\)/);
|
|
1071
|
+
expect(text).toContain('"sdwebimage"');
|
|
1072
|
+
expect(text).toContain('local path');
|
|
1073
|
+
expect(text).toContain('npx patch-package expo-image');
|
|
1074
|
+
expect(text).toContain('Module path: /node_modules/expo-image');
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
it('names the target of a product whose package the manifest never declared', () => {
|
|
1078
|
+
const text = report([
|
|
1079
|
+
{ form: 'undeclared-package', identity: 'libavif-Xcode', target: 'ExpoImage' },
|
|
1080
|
+
]);
|
|
1081
|
+
expect(text).toContain('"libavif-Xcode"');
|
|
1082
|
+
expect(text).toContain('target "ExpoImage"');
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
it('describes a product that names no package without printing a placeholder', () => {
|
|
1086
|
+
const text = report([{ form: 'undeclared-package', identity: null, target: 'ExpoImage' }]);
|
|
1087
|
+
expect(text).toContain('target "ExpoImage"');
|
|
1088
|
+
expect(text).not.toContain('null');
|
|
1089
|
+
expect(text).not.toContain('undefined');
|
|
1090
|
+
});
|
|
1091
|
+
|
|
1092
|
+
// One remedy cannot serve every cause: a collision is already declared the way a
|
|
1093
|
+
// local path should be, and an undeclared package needs a declaration ADDED.
|
|
1094
|
+
it('gives each fault its own next step', () => {
|
|
1095
|
+
const step = (form) => report([{ form, identity: 'acme', target: 'Main' }]);
|
|
1096
|
+
expect(step('local-path')).toContain('remote URL');
|
|
1097
|
+
expect(step('undeclared-package')).toContain('Declare that package');
|
|
1098
|
+
expect(step('unsupported-requirement')).toContain(
|
|
1099
|
+
'an exact version, a branch, a revision or a version range'
|
|
1100
|
+
);
|
|
1101
|
+
expect(step('module-aliases')).toContain('alias');
|
|
1102
|
+
expect(step('unsupported-condition')).toContain('platform');
|
|
1103
|
+
expect(step('collides-with-injected')).toContain('React Native');
|
|
1104
|
+
expect(step('collides-with-injected')).not.toContain('remote URL');
|
|
1105
|
+
});
|
|
1106
|
+
|
|
1107
|
+
it('calls a package a package and a target dependency a dependency', () => {
|
|
1108
|
+
expect(
|
|
1109
|
+
report([{ form: 'unsupported-condition', identity: 'SDWebImage', target: 'Main' }])
|
|
1110
|
+
).toContain('package "SDWebImage", used by target "Main",');
|
|
1111
|
+
const sibling = report([
|
|
1112
|
+
{ form: 'unsupported-target-condition', identity: 'Helper', target: 'Main' },
|
|
1113
|
+
]);
|
|
1114
|
+
expect(sibling).toContain('the dependency on "Helper" in target "Main"');
|
|
1115
|
+
expect(sibling).not.toContain('package "Helper"');
|
|
1116
|
+
});
|
|
1117
|
+
|
|
1118
|
+
it('names a package claimed twice without calling either one the package', () => {
|
|
1119
|
+
const text = report([{ form: 'ambiguous-package-name', identity: 'libavif', target: null }]);
|
|
1120
|
+
expect(text).toContain('"libavif" is claimed by two');
|
|
1121
|
+
expect(text).toContain('distinct');
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
it('lists every dependency it found, not just the first', () => {
|
|
1125
|
+
const text = report([
|
|
1126
|
+
{ form: 'registry', identity: 'acme.widgets', target: null },
|
|
1127
|
+
{ form: 'unsupported-requirement', identity: 'futured', target: null },
|
|
1128
|
+
]);
|
|
1129
|
+
expect(text).toContain('"acme.widgets"');
|
|
1130
|
+
expect(text).toContain('"futured"');
|
|
1131
|
+
});
|
|
1132
|
+
|
|
1133
|
+
it('renders every form as prose, never as the name the parser uses for it', () => {
|
|
1134
|
+
const dependencies = [
|
|
1135
|
+
{ form: 'local-path', identity: 'alpha', target: null },
|
|
1136
|
+
{ form: 'registry', identity: 'bravo', target: null },
|
|
1137
|
+
{ form: 'unsupported-location', identity: 'charlie', target: null },
|
|
1138
|
+
{ form: 'unsupported-requirement', identity: 'delta', target: null },
|
|
1139
|
+
{ form: 'unknown-form', identity: 'echo', target: null },
|
|
1140
|
+
{ form: 'undeclared-package', identity: 'foxtrot', target: 'Main' },
|
|
1141
|
+
{ form: 'collides-with-injected', identity: 'golf', target: null },
|
|
1142
|
+
{ form: 'module-aliases', identity: 'hotel', target: 'Main' },
|
|
1143
|
+
{ form: 'unsupported-condition', identity: 'india', target: 'Main' },
|
|
1144
|
+
{ form: 'unsupported-traits', identity: 'juliett', target: null },
|
|
1145
|
+
{ form: 'unsupported-target-condition', identity: 'kilo', target: 'Main' },
|
|
1146
|
+
{ form: 'ambiguous-package-name', identity: 'lima', target: null },
|
|
1147
|
+
];
|
|
1148
|
+
const text = report(dependencies);
|
|
1149
|
+
for (const { form, identity } of dependencies) {
|
|
1150
|
+
expect(text).toContain(`"${identity}"`);
|
|
1151
|
+
// "registry" is also the plain English word the prose uses.
|
|
1152
|
+
if (form !== 'registry') expect(text).not.toContain(form);
|
|
1153
|
+
}
|
|
1154
|
+
expect(text).not.toContain('undefined');
|
|
1155
|
+
});
|
|
1156
|
+
});
|
|
1157
|
+
|
|
1158
|
+
describe('a module with only some pods precompiled', () => {
|
|
1159
|
+
const artifactDirs = [
|
|
1160
|
+
'/precompiled/expo-dual/output',
|
|
1161
|
+
'/repo/packages/precompile/.build/expo-dual/output',
|
|
1162
|
+
'/node_modules/expo-dual/prebuilds/output',
|
|
1163
|
+
];
|
|
1164
|
+
const pending = ({
|
|
1165
|
+
prebuildProduct = null,
|
|
1166
|
+
precompiledSiblings = ['ExpoDual'],
|
|
1167
|
+
precompiledProducts = ['ExpoDual'],
|
|
1168
|
+
} = {}) =>
|
|
1169
|
+
pendingPod({
|
|
1170
|
+
podName: 'ExpoDualExtras',
|
|
1171
|
+
packageName: 'expo-dual',
|
|
1172
|
+
moduleRoot: '/node_modules/expo-dual',
|
|
1173
|
+
hasSources: true,
|
|
1174
|
+
prebuildProduct,
|
|
1175
|
+
refusal: {
|
|
1176
|
+
reason: 'partially-precompiled',
|
|
1177
|
+
precompiledSiblings,
|
|
1178
|
+
precompiledProducts,
|
|
1179
|
+
artifactDirs,
|
|
1180
|
+
prebuildProduct,
|
|
1181
|
+
},
|
|
1182
|
+
});
|
|
1183
|
+
const entries = (extra) =>
|
|
1184
|
+
classifyUnsupported({ pending: [pending(extra)], coreAvailable: true });
|
|
1185
|
+
|
|
1186
|
+
it('classifies the pod that is not precompiled, naming the siblings that are', () => {
|
|
1187
|
+
expect(entries()).toEqual([
|
|
1188
|
+
{
|
|
1189
|
+
reason: 'partially-precompiled',
|
|
1190
|
+
podName: 'ExpoDualExtras',
|
|
1191
|
+
packageName: 'expo-dual',
|
|
1192
|
+
moduleRoot: '/node_modules/expo-dual',
|
|
1193
|
+
precompiledSiblings: ['ExpoDual'],
|
|
1194
|
+
precompiledProducts: ['ExpoDual'],
|
|
1195
|
+
artifactDirs,
|
|
1196
|
+
prebuildProduct: null,
|
|
1197
|
+
},
|
|
1198
|
+
]);
|
|
1199
|
+
});
|
|
1200
|
+
|
|
1201
|
+
it('reports it before the prebuild route, which would not explain the double link', () => {
|
|
1202
|
+
expect(
|
|
1203
|
+
entries({ prebuildProduct: { name: 'ExpoDualExtras', sourceOnly: false } })[0].reason
|
|
1204
|
+
).toBe('partially-precompiled');
|
|
1205
|
+
});
|
|
1206
|
+
|
|
1207
|
+
it('names both pods, the double link, and the all-or-none remedies', () => {
|
|
1208
|
+
const report = renderUnsupportedReport(entries());
|
|
1209
|
+
expect(report).toMatch(/^error: Expo module "expo-dual" \(pod ExpoDualExtras\)/);
|
|
1210
|
+
expect(report).toContain('ExpoDual ');
|
|
1211
|
+
expect(report).toContain('twice');
|
|
1212
|
+
expect(report).toContain('et prebuild expo-dual');
|
|
1213
|
+
expect(report).toContain('spm.config.json');
|
|
1214
|
+
expect(report).toContain('"exclude": ["expo-dual"]');
|
|
1215
|
+
expect(report).toContain('Module path: /node_modules/expo-dual');
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
it('lists every precompiled sibling', () => {
|
|
1219
|
+
const report = renderUnsupportedReport(
|
|
1220
|
+
entries({ precompiledSiblings: ['ExpoDual', 'ExpoDualKit'] })
|
|
1221
|
+
);
|
|
1222
|
+
expect(report).toContain('ExpoDual, ExpoDualKit');
|
|
1223
|
+
});
|
|
1224
|
+
|
|
1225
|
+
it('names every directory the artifact resolver searches, in its order, and both artifact forms', () => {
|
|
1226
|
+
const report = renderUnsupportedReport(entries());
|
|
1227
|
+
const positions = artifactDirs.map((dir) => report.indexOf(dir));
|
|
1228
|
+
expect(positions.every((position) => position >= 0)).toBe(true);
|
|
1229
|
+
expect(positions).toEqual([...positions].sort((a, b) => a - b));
|
|
1230
|
+
expect(report).toContain('ExpoDual.xcframework');
|
|
1231
|
+
expect(report).toContain('ExpoDual.tar.gz');
|
|
1232
|
+
expect(report).toContain('debug/xcframeworks');
|
|
1233
|
+
expect(report).toContain('release/xcframeworks');
|
|
1234
|
+
expect(report).toContain("add a product for ExpoDualExtras to expo-dual's spm.config.json");
|
|
1235
|
+
});
|
|
1236
|
+
|
|
1237
|
+
it('names the artifacts after the product a sibling ships, not after its pod', () => {
|
|
1238
|
+
const report = renderUnsupportedReport(
|
|
1239
|
+
entries({ precompiledSiblings: ['RNSkiaPod'], precompiledProducts: ['RNSkia'] })
|
|
1240
|
+
);
|
|
1241
|
+
expect(report).toContain('— RNSkia.xcframework or RNSkia.tar.gz, under');
|
|
1242
|
+
expect(report).not.toContain('RNSkiaPod.xcframework');
|
|
1243
|
+
expect(report).toContain('its sibling pod RNSkiaPod does');
|
|
1244
|
+
});
|
|
1245
|
+
|
|
1246
|
+
it('says so when spm.config.json already declares the pod it asks to build', () => {
|
|
1247
|
+
const report = renderUnsupportedReport(
|
|
1248
|
+
entries({ prebuildProduct: { name: 'ExpoDualExtras', sourceOnly: false } })
|
|
1249
|
+
);
|
|
1250
|
+
expect(report).toContain('already declares "ExpoDualExtras"');
|
|
1251
|
+
expect(report).toContain('et prebuild expo-dual');
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
it('does not promise an XCFramework for a source-only product', () => {
|
|
1255
|
+
const report = renderUnsupportedReport(
|
|
1256
|
+
entries({ prebuildProduct: { name: 'ExpoDualExtras', sourceOnly: true } })
|
|
1257
|
+
);
|
|
1258
|
+
expect(report).toContain('sourceOnly');
|
|
1259
|
+
expect(report).not.toContain('et prebuild');
|
|
1260
|
+
expect(report).toMatch(/^ {2}1\. To build it from source instead/m);
|
|
1261
|
+
});
|
|
1262
|
+
});
|