expo 58.0.0 → 58.0.1

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.
Files changed (31) hide show
  1. package/android/build.gradle +2 -2
  2. package/android/proguard-rules.pro +4 -0
  3. package/android/src/main/java/expo/modules/fetch/NativeResponse.kt +5 -1
  4. package/android/src/main/java/expo/modules/fetch/OkHttpFileUrlInterceptor.kt +5 -1
  5. package/build/winter/runtime.native.js +0 -2
  6. package/build/winter/runtime.native.js.map +1 -1
  7. package/bundledNativeModules.json +21 -21
  8. package/package.json +7 -7
  9. package/scripts/spm/README.md +0 -3
  10. package/scripts/spm/__tests__/cli.test.js +57 -1
  11. package/scripts/spm/__tests__/diagnostics.test.js +181 -131
  12. package/scripts/spm/__tests__/flavored-frameworks.test.js +9 -0
  13. package/scripts/spm/__tests__/helpers.js +88 -0
  14. package/scripts/spm/__tests__/manifests.test.js +289 -74
  15. package/scripts/spm/__tests__/plugin.test.js +1101 -111
  16. package/scripts/spm/__tests__/podspec.test.js +27 -138
  17. package/scripts/spm/__tests__/spm-dependencies.test.js +344 -0
  18. package/scripts/spm/classify.js +28 -6
  19. package/scripts/spm/cli.js +23 -9
  20. package/scripts/spm/diagnostics.js +111 -91
  21. package/scripts/spm/flavored-frameworks.js +233 -21
  22. package/scripts/spm/manifests.js +85 -34
  23. package/scripts/spm/plugin.js +214 -55
  24. package/scripts/spm/podspec.js +10 -160
  25. package/src/winter/runtime.native.ts +0 -2
  26. package/template.tgz +0 -0
  27. package/build/winter/AbortSignal.d.ts +0 -3
  28. package/build/winter/AbortSignal.js +0 -96
  29. package/build/winter/AbortSignal.js.map +0 -1
  30. package/src/winter/AbortSignal.ts +0 -132
  31. package/src/winter/__tests__/AbortSignal.test.native.ts +0 -163
@@ -13,6 +13,7 @@ const {
13
13
  renderPureSwiftManifest,
14
14
  emitSourceManifestPackage,
15
15
  emitPureSwiftSourcePackage,
16
+ raiseFloor,
16
17
  } = require('../manifests');
17
18
 
18
19
  describe('parseDumpedManifest', () => {
@@ -134,12 +135,12 @@ describe('renderSourceManifest', () => {
134
135
  },
135
136
  ],
136
137
  };
137
- const out = renderSourceManifest(
138
+ const out = renderSourceManifest({
138
139
  manifest,
139
- ['.package(name: "ReactNative", path: "/abs/rn")'],
140
- ['.product(name: "ReactHeaders", package: "ReactNative")'],
141
- '/abs/interfaces'
142
- );
140
+ pkgDeps: ['.package(name: "ReactNative", path: "/abs/rn")'],
141
+ injectedTargetDeps: ['.product(name: "ReactHeaders", package: "ReactNative")'],
142
+ frameworkSearchPath: '/abs/interfaces',
143
+ });
143
144
 
144
145
  it('mirrors targets with sibling deps first, then injected deps', () => {
145
146
  expect(out).toContain('name: "ExpoFileSystem"');
@@ -170,7 +171,11 @@ describe('renderSourceManifest', () => {
170
171
  });
171
172
 
172
173
  describe('renderPureSwiftManifest', () => {
173
- const out = renderPureSwiftManifest('ExpoAsset', 'ios', [], [], '/abs/interfaces');
174
+ const out = renderPureSwiftManifest({
175
+ product: 'ExpoAsset',
176
+ srcRel: 'ios',
177
+ frameworkSearchPath: '/abs/interfaces',
178
+ });
174
179
 
175
180
  it('emits a single target over the source dir with the given deps', () => {
176
181
  expect(out).toContain('.library(name: "ExpoAsset", targets: ["ExpoAsset"])');
@@ -180,20 +185,125 @@ describe('renderPureSwiftManifest', () => {
180
185
  expect(out).not.toMatch(/\[\s*,\s*\]/);
181
186
  expect(out).toContain('swiftLanguageModes: [.v5],\n cxxLanguageStandard: .cxx20');
182
187
  });
188
+
189
+ it('loads no macro plugin when no macro flags are given', () => {
190
+ expect(out).not.toContain('-Xfrontend');
191
+ });
192
+ });
193
+
194
+ // Expo modules use Swift macros (@Field, @Record, @OptimizedFunction). A macro only
195
+ // expands when the compiler is handed the macro plugin executable, the same way
196
+ // `project_integrator.rb#integrate_core_macro_plugins` hands it to CocoaPods.
197
+ describe('macro plugin flags', () => {
198
+ const MACRO_FLAGS = [
199
+ '-Xfrontend',
200
+ '-load-plugin-executable',
201
+ '-Xfrontend',
202
+ '/abs/macros/ExpoModulesMacros#ExpoModulesMacros',
203
+ ];
204
+ const EXPECTED_SWIFT =
205
+ 'swiftSettings: [.unsafeFlags(["-F", "/abs/interfaces", "-Xfrontend", ' +
206
+ '"-load-plugin-executable", "-Xfrontend", ' +
207
+ '"/abs/macros/ExpoModulesMacros#ExpoModulesMacros"])]';
208
+
209
+ describe('renderPureSwiftManifest', () => {
210
+ const out = renderPureSwiftManifest({
211
+ product: 'ExpoCrypto',
212
+ srcRel: 'ios',
213
+ frameworkSearchPath: '/abs/interfaces',
214
+ extraSwiftFlags: MACRO_FLAGS,
215
+ });
216
+
217
+ it('loads the macro plugin from swiftSettings', () => {
218
+ expect(out).toContain(EXPECTED_SWIFT);
219
+ });
220
+
221
+ it('never hands the Swift-only frontend flags to clang', () => {
222
+ expect(out).toContain('cSettings: [.unsafeFlags(["-F", "/abs/interfaces"])]');
223
+ expect(out).toContain('cxxSettings: [.unsafeFlags(["-F", "/abs/interfaces"])]');
224
+ });
225
+ });
226
+
227
+ describe('renderSourceManifest', () => {
228
+ const out = renderSourceManifest({
229
+ manifest: {
230
+ name: 'TestModule',
231
+ products: [{ name: 'TestModule', targets: ['Main'] }],
232
+ targets: [{ name: 'Main', path: 'Main', publicHeadersPath: null, siblingDeps: [] }],
233
+ },
234
+ frameworkSearchPath: '/abs/interfaces',
235
+ extraSwiftFlags: MACRO_FLAGS,
236
+ });
237
+
238
+ it('loads the macro plugin from swiftSettings', () => {
239
+ expect(out).toContain(EXPECTED_SWIFT);
240
+ });
241
+
242
+ it('never hands the Swift-only frontend flags to clang', () => {
243
+ expect(out).toContain('cSettings: [.unsafeFlags(["-F", "/abs/interfaces"])]');
244
+ expect(out).toContain('cxxSettings: [.unsafeFlags(["-F", "/abs/interfaces"])]');
245
+ });
246
+ });
247
+
248
+ // The emit functions are what the plugin actually calls, so the flags have to
249
+ // survive the whole way to the file on disk, not just the render call.
250
+ describe('the emitted file', () => {
251
+ let moduleRoot;
252
+ let outDir;
253
+
254
+ beforeEach(() => {
255
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-macro-emit-'));
256
+ moduleRoot = path.join(tmp, 'module');
257
+ outDir = path.join(tmp, 'out');
258
+ fs.mkdirSync(path.join(moduleRoot, 'ios'), { recursive: true });
259
+ });
260
+
261
+ it('carries the flags through emitSourceManifestPackage', () => {
262
+ runDumpPackage.mockReturnValue(
263
+ JSON.stringify({
264
+ name: 'TestModule',
265
+ products: [{ name: 'TestModule', type: { library: ['automatic'] }, targets: ['Main'] }],
266
+ targets: [{ name: 'Main', type: 'regular', path: 'Main', dependencies: [] }],
267
+ })
268
+ );
269
+ emitSourceManifestPackage({
270
+ moduleRoot,
271
+ frameworkSearchPath: '/abs/interfaces',
272
+ outDir,
273
+ macroFlags: MACRO_FLAGS,
274
+ });
275
+
276
+ expect(
277
+ fs.readFileSync(path.join(outDir, 'expo-source', 'TestModule', 'Package.swift'), 'utf8')
278
+ ).toContain(EXPECTED_SWIFT);
279
+ });
280
+
281
+ it('carries the flags through emitPureSwiftSourcePackage', () => {
282
+ emitPureSwiftSourcePackage({
283
+ moduleRoot,
284
+ product: 'ExpoCrypto',
285
+ frameworkSearchPath: '/abs/interfaces',
286
+ outDir,
287
+ macroFlags: MACRO_FLAGS,
288
+ });
289
+
290
+ expect(
291
+ fs.readFileSync(path.join(outDir, 'expo-source', 'ExpoCrypto', 'Package.swift'), 'utf8')
292
+ ).toContain(EXPECTED_SWIFT);
293
+ });
294
+ });
183
295
  });
184
296
 
185
297
  describe('renderSourceManifest target dependency conditions', () => {
186
298
  const render = (siblingDeps) =>
187
- renderSourceManifest(
188
- {
299
+ renderSourceManifest({
300
+ manifest: {
189
301
  name: 'TestModule',
190
302
  products: [{ name: 'TestModule', targets: ['Main'] }],
191
303
  targets: [{ name: 'Main', path: 'Main', publicHeadersPath: null, siblingDeps }],
192
304
  },
193
- [],
194
- [],
195
- '/abs/interfaces'
196
- );
305
+ frameworkSearchPath: '/abs/interfaces',
306
+ });
197
307
 
198
308
  it('renders a conditioned sibling dependency with its platform condition', () => {
199
309
  expect(render([{ name: 'Helper', platforms: ['ios', 'macos'] }])).toContain(
@@ -232,7 +342,8 @@ describe('implicit target source paths', () => {
232
342
  fs.mkdirSync(outDir, { recursive: true });
233
343
  });
234
344
 
235
- const emit = () => emitSourceManifestPackage(moduleRoot, null, '/abs/interfaces', outDir, null);
345
+ const emit = () =>
346
+ emitSourceManifestPackage({ moduleRoot, frameworkSearchPath: '/abs/interfaces', outDir });
236
347
  const emittedManifest = () =>
237
348
  fs.readFileSync(path.join(outDir, 'expo-source', 'TestModule', 'Package.swift'), 'utf8');
238
349
 
@@ -276,48 +387,50 @@ describe('implicit target source paths', () => {
276
387
 
277
388
  it('refuses to render a target whose path was never resolved', () => {
278
389
  expect(() =>
279
- renderSourceManifest(
280
- {
390
+ renderSourceManifest({
391
+ manifest: {
281
392
  name: 'TestModule',
282
393
  products: [{ name: 'TestModule', targets: ['Example'] }],
283
394
  targets: [{ name: 'Example', path: null, publicHeadersPath: null, siblingDeps: [] }],
284
395
  },
285
- [],
286
- [],
287
- '/abs/interfaces'
288
- )
396
+ frameworkSearchPath: '/abs/interfaces',
397
+ })
289
398
  ).toThrow(/Example/);
290
399
  });
291
400
  });
292
401
 
293
402
  describe('renderPureSwiftManifest excludes', () => {
294
403
  it('excludes the directories classification ignores, in the given order', () => {
295
- const out = renderPureSwiftManifest('ExpoClipboard', 'ios', [], [], '/abs/interfaces', [
296
- 'Feature/Tests',
297
- 'Tests',
298
- ]);
404
+ const out = renderPureSwiftManifest({
405
+ product: 'ExpoClipboard',
406
+ srcRel: 'ios',
407
+ frameworkSearchPath: '/abs/interfaces',
408
+ excludes: ['Feature/Tests', 'Tests'],
409
+ });
299
410
  expect(out).toContain('path: "root/ios",\n exclude: ["Feature/Tests", "Tests"],');
300
411
  });
301
412
 
302
413
  it('emits no exclude key when nothing is ignored', () => {
303
414
  expect(
304
- renderPureSwiftManifest('ExpoAsset', 'ios', [], [], '/abs/interfaces', [])
415
+ renderPureSwiftManifest({
416
+ product: 'ExpoAsset',
417
+ srcRel: 'ios',
418
+ frameworkSearchPath: '/abs/interfaces',
419
+ excludes: [],
420
+ })
305
421
  ).not.toContain('exclude:');
306
422
  });
307
423
  });
308
424
 
309
425
  describe('renderPureSwiftManifest privacy manifest', () => {
310
426
  it('copies the privacy manifest into the target resources, after the excludes', () => {
311
- const out = renderPureSwiftManifest(
312
- 'ExpoDevice',
313
- 'ios',
314
- [],
315
- [],
316
- '/abs/interfaces',
317
- ['Tests'],
318
- null,
319
- true
320
- );
427
+ const out = renderPureSwiftManifest({
428
+ product: 'ExpoDevice',
429
+ srcRel: 'ios',
430
+ frameworkSearchPath: '/abs/interfaces',
431
+ excludes: ['Tests'],
432
+ hasPrivacyManifest: true,
433
+ });
321
434
  expect(out).toContain(
322
435
  'exclude: ["Tests"],\n resources: [.copy("PrivacyInfo.xcprivacy")],'
323
436
  );
@@ -325,11 +438,20 @@ describe('renderPureSwiftManifest privacy manifest', () => {
325
438
 
326
439
  it('emits no resources key when the module ships no privacy manifest', () => {
327
440
  expect(
328
- renderPureSwiftManifest('ExpoAsset', 'ios', [], [], '/abs/interfaces', [], null, false)
441
+ renderPureSwiftManifest({
442
+ product: 'ExpoAsset',
443
+ srcRel: 'ios',
444
+ frameworkSearchPath: '/abs/interfaces',
445
+ hasPrivacyManifest: false,
446
+ })
447
+ ).not.toContain('resources:');
448
+ expect(
449
+ renderPureSwiftManifest({
450
+ product: 'ExpoAsset',
451
+ srcRel: 'ios',
452
+ frameworkSearchPath: '/abs/interfaces',
453
+ })
329
454
  ).not.toContain('resources:');
330
- expect(renderPureSwiftManifest('ExpoAsset', 'ios', [], [], '/abs/interfaces')).not.toContain(
331
- 'resources:'
332
- );
333
455
  });
334
456
  });
335
457
 
@@ -342,7 +464,12 @@ describe('emitPureSwiftSourcePackage', () => {
342
464
  fs.mkdirSync(path.join(moduleRoot, 'ios', '__tests__'), { recursive: true });
343
465
  fs.writeFileSync(path.join(moduleRoot, 'ios', 'A.swift'), '// swift\n');
344
466
 
345
- emitPureSwiftSourcePackage(moduleRoot, 'ExpoAsset', null, '/abs/interfaces', outDir, null);
467
+ emitPureSwiftSourcePackage({
468
+ moduleRoot,
469
+ product: 'ExpoAsset',
470
+ frameworkSearchPath: '/abs/interfaces',
471
+ outDir,
472
+ });
346
473
  const manifest = fs.readFileSync(
347
474
  path.join(outDir, 'expo-source', 'ExpoAsset', 'Package.swift'),
348
475
  'utf8'
@@ -360,7 +487,12 @@ describe('emitPureSwiftSourcePackage', () => {
360
487
  if (withPrivacyManifest) {
361
488
  fs.writeFileSync(path.join(moduleRoot, 'ios', 'PrivacyInfo.xcprivacy'), '<plist/>\n');
362
489
  }
363
- emitPureSwiftSourcePackage(moduleRoot, 'ExpoDevice', null, '/abs/interfaces', outDir, null);
490
+ emitPureSwiftSourcePackage({
491
+ moduleRoot,
492
+ product: 'ExpoDevice',
493
+ frameworkSearchPath: '/abs/interfaces',
494
+ outDir,
495
+ });
364
496
  return fs.readFileSync(
365
497
  path.join(outDir, 'expo-source', 'ExpoDevice', 'Package.swift'),
366
498
  'utf8'
@@ -401,7 +533,8 @@ describe('single-target packages with sources directly in a predefined directory
401
533
  fs.mkdirSync(path.dirname(target), { recursive: true });
402
534
  fs.writeFileSync(target, content);
403
535
  };
404
- const emit = () => emitSourceManifestPackage(moduleRoot, null, '/abs/interfaces', outDir, null);
536
+ const emit = () =>
537
+ emitSourceManifestPackage({ moduleRoot, frameworkSearchPath: '/abs/interfaces', outDir });
405
538
 
406
539
  it('resolves the only target to the bare predefined directory holding its sources', () => {
407
540
  write('Sources/File.swift');
@@ -479,8 +612,8 @@ describe('sibling dependencies on non-regular targets', () => {
479
612
  describe('unsupported platform conditions', () => {
480
613
  it('refuses a freebsd-only condition instead of widening the dependency', () => {
481
614
  expect(() =>
482
- renderSourceManifest(
483
- {
615
+ renderSourceManifest({
616
+ manifest: {
484
617
  name: 'TestModule',
485
618
  products: [{ name: 'TestModule', targets: ['Main'] }],
486
619
  targets: [
@@ -492,10 +625,8 @@ describe('unsupported platform conditions', () => {
492
625
  },
493
626
  ],
494
627
  },
495
- [],
496
- [],
497
- '/abs/interfaces'
498
- )
628
+ frameworkSearchPath: '/abs/interfaces',
629
+ })
499
630
  ).toThrow(/"Helper".*freebsd/s);
500
631
  });
501
632
  });
@@ -522,7 +653,8 @@ describe('mirrored target file rules', () => {
522
653
  },
523
654
  ],
524
655
  });
525
- const render = (manifest) => renderSourceManifest(manifest, [], [], '/abs/interfaces');
656
+ const render = (manifest) =>
657
+ renderSourceManifest({ manifest, frameworkSearchPath: '/abs/interfaces' });
526
658
 
527
659
  it('carries exclude/sources/resources through parsing', () => {
528
660
  const [main] = parseDumpedManifest(dumped).targets;
@@ -620,12 +752,10 @@ describe('mirrored target build settings', () => {
620
752
  targets: [{ name: 'Main', type: 'regular', path: 'Main', dependencies: [], settings }],
621
753
  });
622
754
  const render = (settings) =>
623
- renderSourceManifest(
624
- parseDumpedManifest(dumpWithSettings(settings)),
625
- [],
626
- [],
627
- '/abs/interfaces'
628
- );
755
+ renderSourceManifest({
756
+ manifest: parseDumpedManifest(dumpWithSettings(settings)),
757
+ frameworkSearchPath: '/abs/interfaces',
758
+ });
629
759
 
630
760
  const settings = [
631
761
  { kind: { define: { _0: 'RCT_NEW_ARCH_ENABLED=1' } }, tool: 'c' },
@@ -835,7 +965,7 @@ describe('deployment target', () => {
835
965
  ])
836
966
  );
837
967
  expect(manifest.iosDeploymentTarget).toBe('16.4');
838
- const out = renderSourceManifest(manifest, [], [], '/abs/interfaces');
968
+ const out = renderSourceManifest({ manifest, frameworkSearchPath: '/abs/interfaces' });
839
969
  expect(out).toContain('platforms: [.iOS("16.4")],');
840
970
  expect(out).not.toContain('.macOS');
841
971
  });
@@ -845,29 +975,36 @@ describe('deployment target', () => {
845
975
  dumpWithPlatforms([{ options: [], platformName: 'macos', version: '13.4' }])
846
976
  );
847
977
  expect(manifest.iosDeploymentTarget).toBeNull();
848
- expect(renderSourceManifest(manifest, [], [], '/abs/interfaces')).toContain(
978
+ expect(renderSourceManifest({ manifest, frameworkSearchPath: '/abs/interfaces' })).toContain(
849
979
  'platforms: [.iOS(.v15)],'
850
980
  );
851
981
  });
852
982
 
853
983
  it('falls back to the plugin floor when the manifest declares no platforms at all', () => {
854
984
  expect(
855
- renderSourceManifest(
856
- parseDumpedManifest(dumpWithPlatforms(undefined)),
857
- [],
858
- [],
859
- '/abs/interfaces'
860
- )
985
+ renderSourceManifest({
986
+ manifest: parseDumpedManifest(dumpWithPlatforms(undefined)),
987
+ frameworkSearchPath: '/abs/interfaces',
988
+ })
861
989
  ).toContain('platforms: [.iOS(.v15)],');
862
990
  });
863
991
 
864
992
  it('takes the pure-Swift floor the plugin read from the podspec', () => {
865
993
  expect(
866
- renderPureSwiftManifest('ExpoAsset', 'ios', [], [], '/abs/interfaces', [], '16.4')
994
+ renderPureSwiftManifest({
995
+ product: 'ExpoAsset',
996
+ srcRel: 'ios',
997
+ frameworkSearchPath: '/abs/interfaces',
998
+ iosDeploymentTarget: '16.4',
999
+ })
867
1000
  ).toContain('platforms: [.iOS("16.4")],');
868
- expect(renderPureSwiftManifest('ExpoAsset', 'ios', [], [], '/abs/interfaces')).toContain(
869
- 'platforms: [.iOS(.v15)],'
870
- );
1001
+ expect(
1002
+ renderPureSwiftManifest({
1003
+ product: 'ExpoAsset',
1004
+ srcRel: 'ios',
1005
+ frameworkSearchPath: '/abs/interfaces',
1006
+ })
1007
+ ).toContain('platforms: [.iOS(.v15)],');
871
1008
  });
872
1009
 
873
1010
  it('emits the floor the emit layer was given, and never linker settings', () => {
@@ -877,15 +1014,13 @@ describe('deployment target', () => {
877
1014
  fs.mkdirSync(path.join(moduleRoot, 'ios'), { recursive: true });
878
1015
  fs.writeFileSync(path.join(moduleRoot, 'ios', 'A.swift'), '// swift\n');
879
1016
 
880
- emitPureSwiftSourcePackage(
1017
+ emitPureSwiftSourcePackage({
881
1018
  moduleRoot,
882
- 'ExpoAsset',
883
- null,
884
- '/abs/interfaces',
1019
+ product: 'ExpoAsset',
1020
+ frameworkSearchPath: '/abs/interfaces',
885
1021
  outDir,
886
- null,
887
- '16.4'
888
- );
1022
+ iosDeploymentTarget: '16.4',
1023
+ });
889
1024
  const manifest = fs.readFileSync(
890
1025
  path.join(outDir, 'expo-source', 'ExpoAsset', 'Package.swift'),
891
1026
  'utf8'
@@ -895,6 +1030,82 @@ describe('deployment target', () => {
895
1030
  });
896
1031
  });
897
1032
 
1033
+ describe('raiseFloor', () => {
1034
+ it('keeps the higher of the two floors', () => {
1035
+ expect(raiseFloor('15.0', '16.4')).toBe('16.4');
1036
+ expect(raiseFloor('17.0', '16.4')).toBe('17.0');
1037
+ });
1038
+
1039
+ it('keeps the declared floor when both are the same', () => {
1040
+ expect(raiseFloor('16.4', '16.4')).toBe('16.4');
1041
+ });
1042
+
1043
+ it('compares components numerically, not as text', () => {
1044
+ expect(raiseFloor('16.10', '16.9')).toBe('16.10');
1045
+ expect(raiseFloor('16.9', '16.10')).toBe('16.10');
1046
+ });
1047
+
1048
+ it('reads a missing component as zero', () => {
1049
+ expect(raiseFloor('16', '16.0')).toBe('16');
1050
+ expect(raiseFloor('16', '16.4')).toBe('16.4');
1051
+ });
1052
+
1053
+ it('falls back to whichever floor is present', () => {
1054
+ expect(raiseFloor(null, '16.4')).toBe('16.4');
1055
+ expect(raiseFloor('16.4', null)).toBe('16.4');
1056
+ expect(raiseFloor(undefined, '16.4')).toBe('16.4');
1057
+ expect(raiseFloor('16.4', undefined)).toBe('16.4');
1058
+ });
1059
+
1060
+ it('has no floor to report when neither side declares one', () => {
1061
+ expect(raiseFloor(null, null)).toBeNull();
1062
+ expect(raiseFloor(undefined, undefined)).toBeNull();
1063
+ });
1064
+ });
1065
+
1066
+ describe('the minimum floor a checked-in manifest is raised to', () => {
1067
+ const dumpWithIos = (version) =>
1068
+ JSON.stringify({
1069
+ name: 'TestModule',
1070
+ platforms: [{ options: [], platformName: 'ios', version }],
1071
+ products: [{ name: 'TestModule', type: { library: ['automatic'] }, targets: ['Main'] }],
1072
+ targets: [{ name: 'Main', type: 'regular', path: 'Main', dependencies: [] }],
1073
+ });
1074
+
1075
+ let moduleRoot;
1076
+ let outDir;
1077
+
1078
+ beforeEach(() => {
1079
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-minimum-'));
1080
+ moduleRoot = path.join(tmp, 'module');
1081
+ outDir = path.join(tmp, 'out');
1082
+ fs.mkdirSync(moduleRoot, { recursive: true });
1083
+ });
1084
+
1085
+ const emitted = (declared, minimum) => {
1086
+ runDumpPackage.mockReturnValue(dumpWithIos(declared));
1087
+ emitSourceManifestPackage({
1088
+ moduleRoot,
1089
+ frameworkSearchPath: '/abs/interfaces',
1090
+ outDir,
1091
+ minimumIosDeploymentTarget: minimum,
1092
+ });
1093
+ return fs.readFileSync(path.join(outDir, 'expo-source', 'TestModule', 'Package.swift'), 'utf8');
1094
+ };
1095
+
1096
+ it('raises a module declaring less than the minimum', () => {
1097
+ expect(emitted('15.0', '16.4')).toContain('platforms: [.iOS("16.4")],');
1098
+ });
1099
+
1100
+ it('leaves a module declaring more than the minimum alone', () => {
1101
+ expect(emitted('17.0', '16.4')).toContain('platforms: [.iOS("17.0")],');
1102
+ });
1103
+
1104
+ it('keeps the declared floor when there is no minimum', () => {
1105
+ expect(emitted('16.4', null)).toContain('platforms: [.iOS("16.4")],');
1106
+ });
1107
+ });
1108
+
898
1109
  describe('dependencies on targets the generated package cannot declare', () => {
899
1110
  const dumpWithBinaryTarget = JSON.stringify({
900
1111
  name: 'TestModule',
@@ -1002,7 +1213,11 @@ describe('dependencies on targets the generated package cannot declare', () => {
1002
1213
  fs.mkdirSync(path.join(moduleRoot, 'ios', 'Src'), { recursive: true });
1003
1214
  runDumpPackage.mockReturnValue(dumpWithBinaryTarget);
1004
1215
 
1005
- const result = emitSourceManifestPackage(moduleRoot, null, '/abs/interfaces', outDir, null);
1216
+ const result = emitSourceManifestPackage({
1217
+ moduleRoot,
1218
+ frameworkSearchPath: '/abs/interfaces',
1219
+ outDir,
1220
+ });
1006
1221
 
1007
1222
  expect(result.packageDep).toBeUndefined();
1008
1223
  expect(result.unsupportedTargetDeps).toEqual([