expo 58.0.17 → 58.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,9 +4,6 @@ const fs = require('fs');
4
4
  const os = require('os');
5
5
  const path = require('path');
6
6
 
7
- jest.mock('../cli', () => ({ runDumpPackage: jest.fn() }));
8
- const { runDumpPackage } = require('../cli');
9
-
10
7
  const {
11
8
  parseDumpedManifest,
12
9
  renderSourceManifest,
@@ -271,18 +268,15 @@ describe('macro plugin flags', () => {
271
268
  });
272
269
 
273
270
  it('carries the flags through emitSourceManifestPackage', () => {
274
- runDumpPackage.mockReturnValue(
271
+ emitSourceManifestPackage(
272
+ moduleRoot,
273
+ { frameworkSearchPath: '/abs/interfaces', outDir, macroFlags: MACRO_FLAGS },
275
274
  JSON.stringify({
276
275
  name: 'TestModule',
277
276
  products: [{ name: 'TestModule', type: { library: ['automatic'] }, targets: ['Main'] }],
278
277
  targets: [{ name: 'Main', type: 'regular', path: 'Main', dependencies: [] }],
279
278
  })
280
279
  );
281
- emitSourceManifestPackage(moduleRoot, {
282
- frameworkSearchPath: '/abs/interfaces',
283
- outDir,
284
- macroFlags: MACRO_FLAGS,
285
- });
286
280
 
287
281
  expect(
288
282
  fs.readFileSync(path.join(outDir, 'expo-source', 'TestModule', 'Package.swift'), 'utf8')
@@ -350,8 +344,8 @@ describe('implicit target source paths', () => {
350
344
  fs.mkdirSync(outDir, { recursive: true });
351
345
  });
352
346
 
353
- const emit = () =>
354
- emitSourceManifestPackage(moduleRoot, { frameworkSearchPath: '/abs/interfaces', outDir });
347
+ const emit = (dump) =>
348
+ emitSourceManifestPackage(moduleRoot, { frameworkSearchPath: '/abs/interfaces', outDir }, dump);
355
349
  const emittedManifest = () =>
356
350
  fs.readFileSync(path.join(outDir, 'expo-source', 'TestModule', 'Package.swift'), 'utf8');
357
351
 
@@ -361,9 +355,8 @@ describe('implicit target source paths', () => {
361
355
 
362
356
  it('resolves a target with no explicit path to its predefined source directory', () => {
363
357
  fs.mkdirSync(path.join(moduleRoot, 'Sources', 'Example'), { recursive: true });
364
- runDumpPackage.mockReturnValue(dumpWithoutPath);
365
358
 
366
- expect(emit().ok.packageDep).toEqual({
359
+ expect(emit(dumpWithoutPath).ok.packageDep).toEqual({
367
360
  name: 'TestModule',
368
361
  path: path.join(outDir, 'expo-source', 'TestModule'),
369
362
  });
@@ -371,20 +364,18 @@ describe('implicit target source paths', () => {
371
364
  });
372
365
 
373
366
  it('leaves an explicit path untouched', () => {
374
- runDumpPackage.mockReturnValue(
367
+ emit(
375
368
  JSON.stringify({
376
369
  name: 'TestModule',
377
370
  products: [{ name: 'TestModule', type: { library: ['automatic'] }, targets: ['Example'] }],
378
371
  targets: [{ name: 'Example', type: 'regular', path: 'ios/Example', dependencies: [] }],
379
372
  })
380
373
  );
381
- emit();
382
374
  expect(emittedManifest()).toContain('path: "root/ios/Example"');
383
375
  });
384
376
 
385
377
  it('skips the module and names the unresolved targets instead of emitting root/undefined', () => {
386
- runDumpPackage.mockReturnValue(dumpWithoutPath);
387
- const result = emit();
378
+ const result = emit(dumpWithoutPath);
388
379
 
389
380
  expect(result.ok).toBeUndefined();
390
381
  expect(result.refusal).toEqual({
@@ -540,14 +531,17 @@ describe('single-target packages with sources directly in a predefined directory
540
531
  fs.mkdirSync(path.dirname(target), { recursive: true });
541
532
  fs.writeFileSync(target, content);
542
533
  };
543
- const emit = () =>
544
- emitSourceManifestPackage(moduleRoot, { frameworkSearchPath: '/abs/interfaces', outDir });
534
+ const emit = (targetNames) =>
535
+ emitSourceManifestPackage(
536
+ moduleRoot,
537
+ { frameworkSearchPath: '/abs/interfaces', outDir },
538
+ dumpTargets(targetNames)
539
+ );
545
540
 
546
541
  it('resolves the only target to the bare predefined directory holding its sources', () => {
547
542
  write('Sources/File.swift');
548
- runDumpPackage.mockReturnValue(dumpTargets(['RootSrc']));
549
543
 
550
- expect(emit().refusal).toBeUndefined();
544
+ expect(emit(['RootSrc']).refusal).toBeUndefined();
551
545
  expect(
552
546
  fs.readFileSync(path.join(outDir, 'expo-source', 'TestModule', 'Package.swift'), 'utf8')
553
547
  ).toContain('path: "root/Sources"');
@@ -556,9 +550,8 @@ describe('single-target packages with sources directly in a predefined directory
556
550
  it('prefers Sources/<target name> over the bare directory', () => {
557
551
  write('Sources/File.swift');
558
552
  write('Sources/RootSrc/File.swift');
559
- runDumpPackage.mockReturnValue(dumpTargets(['RootSrc']));
560
553
 
561
- emit();
554
+ emit(['RootSrc']);
562
555
  expect(
563
556
  fs.readFileSync(path.join(outDir, 'expo-source', 'TestModule', 'Package.swift'), 'utf8')
564
557
  ).toContain('path: "root/Sources/RootSrc"');
@@ -566,16 +559,17 @@ describe('single-target packages with sources directly in a predefined directory
566
559
 
567
560
  it('never resolves the targets of a multi-target package to the shared bare directory', () => {
568
561
  write('Sources/File.swift');
569
- runDumpPackage.mockReturnValue(dumpTargets(['A', 'B']));
570
562
 
571
- expect(emit().refusal).toEqual({ reason: 'unresolvable-target-path', targetNames: ['A', 'B'] });
563
+ expect(emit(['A', 'B']).refusal).toEqual({
564
+ reason: 'unresolvable-target-path',
565
+ targetNames: ['A', 'B'],
566
+ });
572
567
  });
573
568
 
574
569
  it('accepts a predefined directory whose sources are nested below it', () => {
575
570
  write('Sources/Nested/File.swift');
576
- runDumpPackage.mockReturnValue(dumpTargets(['RootSrc']));
577
571
 
578
- expect(emit().refusal).toBeUndefined();
572
+ expect(emit(['RootSrc']).refusal).toBeUndefined();
579
573
  expect(
580
574
  fs.readFileSync(path.join(outDir, 'expo-source', 'TestModule', 'Package.swift'), 'utf8')
581
575
  ).toContain('path: "root/Sources"');
@@ -583,9 +577,8 @@ describe('single-target packages with sources directly in a predefined directory
583
577
 
584
578
  it('ignores a predefined directory with no source files at any depth', () => {
585
579
  write('Sources/Nested/README.md', '# docs\n');
586
- runDumpPackage.mockReturnValue(dumpTargets(['RootSrc']));
587
580
 
588
- expect(emit().refusal).toEqual({
581
+ expect(emit(['RootSrc']).refusal).toEqual({
589
582
  reason: 'unresolvable-target-path',
590
583
  targetNames: ['RootSrc'],
591
584
  });
@@ -1090,12 +1083,11 @@ describe('the minimum floor a checked-in manifest is raised to', () => {
1090
1083
  });
1091
1084
 
1092
1085
  const emitted = (declared, minimum) => {
1093
- runDumpPackage.mockReturnValue(dumpWithIos(declared));
1094
- emitSourceManifestPackage(moduleRoot, {
1095
- frameworkSearchPath: '/abs/interfaces',
1096
- outDir,
1097
- minimumIosDeploymentTarget: minimum,
1098
- });
1086
+ emitSourceManifestPackage(
1087
+ moduleRoot,
1088
+ { frameworkSearchPath: '/abs/interfaces', outDir, minimumIosDeploymentTarget: minimum },
1089
+ dumpWithIos(declared)
1090
+ );
1099
1091
  return fs.readFileSync(path.join(outDir, 'expo-source', 'TestModule', 'Package.swift'), 'utf8');
1100
1092
  };
1101
1093
 
@@ -1219,12 +1211,11 @@ describe('dependencies on targets the generated package cannot declare', () => {
1219
1211
  const moduleRoot = path.join(tmp, 'module');
1220
1212
  const outDir = path.join(tmp, 'out');
1221
1213
  fs.mkdirSync(path.join(moduleRoot, 'ios', 'Src'), { recursive: true });
1222
- runDumpPackage.mockReturnValue(dumpWithBinaryTarget);
1223
-
1224
- const result = emitSourceManifestPackage(moduleRoot, {
1225
- frameworkSearchPath: '/abs/interfaces',
1226
- outDir,
1227
- });
1214
+ const result = emitSourceManifestPackage(
1215
+ moduleRoot,
1216
+ { frameworkSearchPath: '/abs/interfaces', outDir },
1217
+ dumpWithBinaryTarget
1218
+ );
1228
1219
 
1229
1220
  expect(result.ok).toBeUndefined();
1230
1221
  expect(result.refusal).toEqual({
@@ -1894,15 +1885,12 @@ let package = Package(
1894
1885
  const emittedManifestPath = () =>
1895
1886
  path.join(outDir, 'expo-source', 'TestModule', 'Package.swift');
1896
1887
  const emittedManifest = () => fs.readFileSync(emittedManifestPath(), 'utf8');
1897
- const emit = (dump, react, satisfiedDependencies) => {
1898
- runDumpPackage.mockReturnValue(dump);
1899
- return emitSourceManifestPackage(moduleRoot, {
1900
- react,
1901
- frameworkSearchPath: '/abs/interfaces',
1902
- outDir,
1903
- satisfiedDependencies,
1904
- });
1905
- };
1888
+ const emit = (dump, react, satisfiedDependencies) =>
1889
+ emitSourceManifestPackage(
1890
+ moduleRoot,
1891
+ { react, frameworkSearchPath: '/abs/interfaces', outDir, satisfiedDependencies },
1892
+ dump
1893
+ );
1906
1894
 
1907
1895
  // A package can export several products; only the ones a precompiled framework
1908
1896
  // provides go, and the package stays while anything still depends on it.