peachsim 0.1.1962 → 0.1.1964

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 (96) hide show
  1. package/README.md +4 -7
  2. package/cli/commands/setup.ts +18 -11
  3. package/cli/commands/telemetry.ts +1 -2
  4. package/cli/main.ts +0 -18
  5. package/cli/outbound-endpoints.ts +6 -6
  6. package/cli/privacy.ts +1 -21
  7. package/dist-lib/agent-daemon-client.cjs +1 -1
  8. package/dist-lib/agent-events.cjs +1 -1
  9. package/dist-lib/attached-projects.cjs +1 -1
  10. package/dist-lib/auth/shared-session.cjs +1 -1
  11. package/dist-lib/backend-origin.cjs +1 -1
  12. package/dist-lib/beta.cjs +1 -1
  13. package/dist-lib/beta.mjs +1 -1
  14. package/dist-lib/bridge-constants.cjs +1 -1
  15. package/dist-lib/bridge-contract-input.cjs +1 -1
  16. package/dist-lib/bridge-contract-input.mjs +1 -1
  17. package/dist-lib/bridge-contract.cjs +1 -1
  18. package/dist-lib/bridge-contract.mjs +1 -1
  19. package/dist-lib/bundle-channel.cjs +74 -29
  20. package/dist-lib/capture-contract.cjs +1 -1
  21. package/dist-lib/capture-contract.mjs +1 -1
  22. package/dist-lib/cloud-contract.cjs +1 -1
  23. package/dist-lib/cloud-contract.mjs +1 -1
  24. package/dist-lib/cloud-test-args.cjs +1 -1
  25. package/dist-lib/cloud-test-args.mjs +1 -1
  26. package/dist-lib/cloud.cjs +1 -1
  27. package/dist-lib/cloud.mjs +1 -1
  28. package/dist-lib/config.cjs +1 -1
  29. package/dist-lib/config.mjs +1 -1
  30. package/dist-lib/detox/index.cjs +2 -2
  31. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  32. package/dist-lib/expo-swift-bundle.cjs +72 -27
  33. package/dist-lib/expo-swift-metadata.cjs +1 -1
  34. package/dist-lib/expo-swift-metadata.mjs +1 -1
  35. package/dist-lib/home-paths.cjs +4 -4
  36. package/dist-lib/host/bridge-host.cjs +74 -29
  37. package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
  38. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  39. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  40. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  41. package/dist-lib/host/websocket-proxy.cjs +1 -1
  42. package/dist-lib/index.cjs +4 -4
  43. package/dist-lib/jump-to-source-babel.cjs +1 -1
  44. package/dist-lib/jump-to-source-native.cjs +1 -1
  45. package/dist-lib/kotlin-host.cjs +1 -1
  46. package/dist-lib/menu.cjs +1 -1
  47. package/dist-lib/menu.mjs +1 -1
  48. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  49. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  50. package/dist-lib/metro-production-bundle.cjs +1 -1
  51. package/dist-lib/metro-production-bundle.mjs +1 -1
  52. package/dist-lib/metro.cjs +4 -4
  53. package/dist-lib/native-app-identity-project.cjs +3 -3
  54. package/dist-lib/native-app-identity-project.mjs +3 -3
  55. package/dist-lib/native-app-identity.cjs +1 -1
  56. package/dist-lib/native-app-identity.mjs +1 -1
  57. package/dist-lib/native-firebase-metadata.cjs +1 -1
  58. package/dist-lib/native-firebase-metadata.mjs +1 -1
  59. package/dist-lib/pdfium-raster.cjs +1 -1
  60. package/dist-lib/pdfium-raster.mjs +1 -1
  61. package/dist-lib/plist.cjs +1 -1
  62. package/dist-lib/plist.mjs +1 -1
  63. package/dist-lib/profiles.cjs +1 -1
  64. package/dist-lib/public-brand.cjs +1 -1
  65. package/dist-lib/public-origins-lib-esm.json +24 -24
  66. package/dist-lib/public-origins-lib.json +53 -53
  67. package/dist-lib/react-native-host-modules.cjs +1 -1
  68. package/dist-lib/react-native-host-modules.mjs +1 -1
  69. package/dist-lib/reap-browser.cjs +1 -1
  70. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  71. package/dist-lib/sdk.cjs +1 -1
  72. package/dist-lib/sdk.mjs +1 -1
  73. package/dist-lib/skills.cjs +79 -44
  74. package/dist-lib/swift-compile.cjs +2 -2
  75. package/dist-lib/swift-compile.mjs +2 -2
  76. package/dist-lib/swift-package.cjs +1 -1
  77. package/dist-lib/swift-package.mjs +1 -1
  78. package/dist-lib/swift-submit.cjs +1 -1
  79. package/dist-lib/swift-submit.mjs +1 -1
  80. package/dist-lib/swift-toolchain.cjs +6 -1
  81. package/dist-lib/swift.cjs +1 -1
  82. package/dist-lib/vite-swift.cjs +44 -26
  83. package/dist-lib/vite.cjs +2 -2
  84. package/dist-lib/worklet-executable.cjs +1 -1
  85. package/dist-lib/worklet-executable.mjs +1 -1
  86. package/package.json +1 -1
  87. package/runtime-companion.json +1 -1
  88. package/src/expo-swift-host.ts +37 -0
  89. package/src/home-paths.ts +4 -5
  90. package/src/settingsContract.ts +2 -2
  91. package/src/swift-cxx-reachable.ts +11 -2
  92. package/src/swift-objc-compile.ts +7 -2
  93. package/src/swift-objc-standin.ts +3 -4
  94. package/src/swift-packages.ts +3 -0
  95. package/src/swift-standins.ts +44 -16
  96. package/src/swift-toolchain.ts +6 -0
@@ -448,6 +448,37 @@ function cloneNativeTarget(target: SwiftNativeTarget): SwiftNativeTarget {
448
448
  }
449
449
  }
450
450
 
451
+ // a podspec without a platform declaration is available everywhere; otherwise
452
+ // only the platforms it names are, through platforms, platform or a
453
+ // per-platform deployment target. ruby beyond those literals is not evaluated.
454
+ function podSupportsIOS(pod: unknown): boolean {
455
+ if (
456
+ !isRecord(pod) ||
457
+ typeof pod.podName !== 'string' ||
458
+ typeof pod.podspecDir !== 'string'
459
+ )
460
+ throw new Error('invalid Expo autolinking pod')
461
+ const base = path.join(pod.podspecDir, pod.podName)
462
+ if (fs.existsSync(`${base}.podspec.json`)) {
463
+ const platforms: unknown = JSON.parse(
464
+ fs.readFileSync(`${base}.podspec.json`, 'utf8'),
465
+ ).platforms
466
+ return !isRecord(platforms) || 'ios' in platforms
467
+ }
468
+ if (!fs.existsSync(`${base}.podspec`)) return true
469
+ const spec = fs.readFileSync(`${base}.podspec`, 'utf8')
470
+ const names = new Set<string>()
471
+ for (const [, hash] of spec.matchAll(/\.platforms\s*=\s*\{([^}]*)\}/g))
472
+ for (const [, a, b, c] of hash!.matchAll(
473
+ /:(\w+)\s*=>|\b(\w+):\s|['"](\w+)['"]\s*=>/g,
474
+ ))
475
+ names.add((a ?? b ?? c)!)
476
+ for (const [, name] of spec.matchAll(/\.platform\s*=\s*:(\w+)/g)) names.add(name!)
477
+ for (const [, name] of spec.matchAll(/\.(\w+)\.deployment_target\s*=/g))
478
+ names.add(name!)
479
+ return names.size === 0 || names.has('ios')
480
+ }
481
+
451
482
  // a deployment entry for a target the adapter synthesizes: no clang inputs
452
483
  // of its own, only an inherited floor.
453
484
  function synthesizedNativeTarget(
@@ -1165,6 +1196,12 @@ async function collectExpoSwiftSourcesUncached(
1165
1196
  resolution && typeof resolution === 'object'
1166
1197
  ? Reflect.get(resolution, 'pods')
1167
1198
  : null
1199
+ // expo links a package into an iOS target only when one of its pods
1200
+ // supports iOS (autolinking_manager.rb packages_to_generate).
1201
+ if (Array.isArray(pods) && pods.length > 0 && !pods.some(podSupportsIOS)) {
1202
+ report(`${packageName} was not linked: no pod supports iOS`)
1203
+ continue
1204
+ }
1168
1205
  const delegateNames = (key: string): unknown[] => {
1169
1206
  const names =
1170
1207
  resolution && typeof resolution === 'object' ? Reflect.get(resolution, key) : null
package/src/home-paths.ts CHANGED
@@ -298,16 +298,15 @@ export interface PrivacyPreferences {
298
298
  configured: boolean
299
299
  }
300
300
 
301
- // bounded diagnostics and automatic crash reports are on until the person turns
302
- // them off (`peach config telemetry off`, or DO_NOT_TRACK for one run).
303
301
  export function readPrivacyPreferences(): PrivacyPreferences {
304
302
  const settings = readSharedConfig().settings
305
303
  const productAnalytics = settings?.productAnalytics
306
304
  const crashReports = settings?.crashReports
307
305
  return {
308
- productAnalytics: typeof productAnalytics === 'boolean' ? productAnalytics : true,
309
- crashReports: typeof crashReports === 'boolean' ? crashReports : true,
310
- configured: typeof productAnalytics === 'boolean',
306
+ productAnalytics: typeof productAnalytics === 'boolean' ? productAnalytics : false,
307
+ crashReports: typeof crashReports === 'boolean' ? crashReports : false,
308
+ configured:
309
+ typeof productAnalytics === 'boolean' || typeof crashReports === 'boolean',
311
310
  }
312
311
  }
313
312
 
@@ -566,13 +566,13 @@ export const settingsSchema: Record<SettingKey, SettingDef> = {
566
566
  // privacy
567
567
  productAnalytics: {
568
568
  type: 'boolean',
569
- default: true,
569
+ default: false,
570
570
  description: 'send bounded product usage analytics',
571
571
  group: 'privacy',
572
572
  },
573
573
  crashReports: {
574
574
  type: 'boolean',
575
- default: true,
575
+ default: false,
576
576
  description: 'send anonymous crash reports',
577
577
  group: 'privacy',
578
578
  },
@@ -9,7 +9,11 @@ import {
9
9
  prepareXcodeObjCImplementations,
10
10
  xcodeObjCInputs,
11
11
  } from './swift-objc-compile'
12
- import { remoteSwiftCheckouts, type SwiftPackageBinary } from './swift-packages'
12
+ import {
13
+ remoteSwiftCheckouts,
14
+ swiftBinaryOnDisk,
15
+ type SwiftPackageBinary,
16
+ } from './swift-packages'
13
17
  import { relativeInside } from './swift-source-file'
14
18
  import { binaryHeaderSearchPaths } from './swift-standins'
15
19
  import { swiftEnvironment } from './swift-toolchain'
@@ -63,6 +67,7 @@ export async function xcodeCxxReachable(
63
67
  (binary) =>
64
68
  binary.publicHeaders === undefined &&
65
69
  binary.placeholder === undefined &&
70
+ swiftBinaryOnDisk(binary) &&
66
71
  binaryHeaderSearchPaths(binary, staged).headers.length === 1,
67
72
  )
68
73
  )
@@ -125,7 +130,11 @@ export async function xcodeCxxReachable(
125
130
  })
126
131
  const checkouts = remoteSwiftCheckouts(app.rootDir)
127
132
  const search = binaries.map((binary) => {
128
- if (binary.publicHeaders !== undefined || binary.placeholder !== undefined)
133
+ if (
134
+ binary.publicHeaders !== undefined ||
135
+ binary.placeholder !== undefined ||
136
+ !swiftBinaryOnDisk(binary)
137
+ )
129
138
  return null
130
139
  const headers = binaryHeaderSearchPaths(binary, checkouts).headers
131
140
  if (headers.length !== 1) return null
@@ -25,7 +25,11 @@ import {
25
25
  swiftTargetModuleName,
26
26
  } from './swift-package'
27
27
  import { swiftPackageManifest, swiftTargetFiles } from './swift-package-manifest'
28
- import { remoteSwiftCheckouts, type SwiftPackageBinary } from './swift-packages'
28
+ import {
29
+ remoteSwiftCheckouts,
30
+ swiftBinaryOnDisk,
31
+ type SwiftPackageBinary,
32
+ } from './swift-packages'
29
33
  import { readPackageFile, relativeInside } from './swift-source-file'
30
34
  import { STANDIN_SOURCE_DIGEST } from './swift-standin-digest'
31
35
  import { binaryHeaderSearchPaths, isBinaryLibraryFile } from './swift-standins'
@@ -403,7 +407,8 @@ function* xcodeObjCInputSteps(
403
407
  (binary) =>
404
408
  binary.reached &&
405
409
  binary.publicHeaders === undefined &&
406
- binary.placeholder === undefined,
410
+ binary.placeholder === undefined &&
411
+ swiftBinaryOnDisk(binary),
407
412
  )
408
413
  // all binaries consume the same source snapshot. scan its imports once.
409
414
  const declaredFrameworks =
@@ -23,7 +23,7 @@ import { swiftObjCPlatformFlags } from './swift-objc-platform'
23
23
  import { IOS_SDK_HEADERS, IOS_SDK_OVERLAYS, IOS_SDK_TARGET } from './swift-objc-sdk'
24
24
  import { clangImportNames, moduleMapTokens } from './swift-package'
25
25
  import { objcProtocolsInSwiftSignatures, type SymbolGraph } from './swift-standin-emit'
26
- import { swiftEnvironment } from './swift-toolchain'
26
+ import { swiftEnvironment, withoutCoreDump } from './swift-toolchain'
27
27
 
28
28
  /** a module map and the headers it reaches: a framework's, or a library
29
29
  * slice's headers directory. */
@@ -688,8 +688,7 @@ export function objcView(
688
688
  fs.rmSync(out, { recursive: true, force: true })
689
689
  fs.mkdirSync(out, { recursive: true })
690
690
  const run = spawnSync(
691
- path.join(toolchainBin, 'swift-symbolgraph-extract'),
692
- [
691
+ ...withoutCoreDump(path.join(toolchainBin, 'swift-symbolgraph-extract'), [
693
692
  '-module-name',
694
693
  surface.module,
695
694
  '-target',
@@ -709,7 +708,7 @@ export function objcView(
709
708
  '-omit-extension-block-symbols',
710
709
  '-output-dir',
711
710
  out,
712
- ],
711
+ ]),
713
712
  { encoding: 'utf8', env: swiftEnvironment(), maxBuffer: 256 * 1024 * 1024 },
714
713
  )
715
714
  if (run.error) throw run.error
@@ -128,6 +128,9 @@ export interface SwiftPackageBinary {
128
128
  placeholder?: { gap: string; sources: string[]; flags: string[] }
129
129
  }
130
130
 
131
+ export const swiftBinaryOnDisk = (binary: SwiftPackageBinary): boolean =>
132
+ binary.url !== null || fs.existsSync(binary.dir)
133
+
131
134
  // sdks that send telemetry, by package identity, that peach's swift cannot
132
135
  // compile yet, each with the compiler gap that forces it. their swift targets
133
136
  // stand in from their own public interface with inert bodies, so an app's
@@ -64,6 +64,7 @@ import {
64
64
  import {
65
65
  sourceSwiftCheckout,
66
66
  swiftEnvironment,
67
+ withoutCoreDump,
67
68
  swiftPackageCacheOptions,
68
69
  } from './swift-toolchain'
69
70
  import { simulatorNativeLibrary } from './swift-xcframework'
@@ -890,22 +891,24 @@ function swiftStandin(
890
891
  // no -Xllvm either, so the -mllvm half of the toolset's sjlj pair never reaches the
891
892
  // backend that wraps each clang module as an object; raw modules skip it.
892
893
  symbolgraphWasm.push('-Xcc', '-Xclang', '-Xcc', '-fmodule-format=raw')
893
- exec(path.join(toolchain.toolchainBin, 'swift-symbolgraph-extract'), [
894
- '-module-name',
895
- surface.module,
896
- ...symbolgraphWasm,
897
- '-I',
898
- search,
899
- // at public the graph drops underscored public declarations, which other
900
- // public ones name; the emitter keeps only public and open symbols
901
- '-minimum-access-level',
902
- 'internal',
903
- '-include-spi-symbols',
904
- '-skip-synthesized-members',
905
- '-omit-extension-block-symbols',
906
- '-output-dir',
907
- out,
908
- ])
894
+ exec(
895
+ ...withoutCoreDump(path.join(toolchain.toolchainBin, 'swift-symbolgraph-extract'), [
896
+ '-module-name',
897
+ surface.module,
898
+ ...symbolgraphWasm,
899
+ '-I',
900
+ search,
901
+ // at public the graph drops underscored public declarations, which other
902
+ // public ones name; the emitter keeps only public and open symbols
903
+ '-minimum-access-level',
904
+ 'internal',
905
+ '-include-spi-symbols',
906
+ '-skip-synthesized-members',
907
+ '-omit-extension-block-symbols',
908
+ '-output-dir',
909
+ out,
910
+ ]),
911
+ )
909
912
  const graphs = fs
910
913
  .readdirSync(out)
911
914
  .filter((name) => name.endsWith('.symbols.json'))
@@ -2693,6 +2696,31 @@ export async function swiftStandins(
2693
2696
  toolchain: Toolchain,
2694
2697
  provided: ReadonlySet<string> = new Set(),
2695
2698
  behavior: SwiftStandinBehaviors = {},
2699
+ ): Promise<SwiftStandins> {
2700
+ const built = await buildStandins(binaries, toolchain, provided, behavior)
2701
+ return {
2702
+ standins: built.standins,
2703
+ gaps: new Map([...built.gaps].map(([target, gap]) => [target, gapText(gap)])),
2704
+ }
2705
+ }
2706
+
2707
+ // a gap prints inside the blocker report, so it keeps the tool's error lines
2708
+ // and drops compiler dumps (clang AST JSON) a failed probe printed with them.
2709
+ function gapText(gap: string): string {
2710
+ const lines = gap
2711
+ .split('\n')
2712
+ .map((line) => line.trim())
2713
+ .filter((line) => line && !/^[{[\]}",]/.test(line) && !/"kind":/.test(line))
2714
+ const errors = lines.filter((line) => /\berror:/.test(line))
2715
+ const text = (errors.length > 0 ? errors : lines).slice(0, 4).join('; ')
2716
+ return text.length > 600 ? `${text.slice(0, 600)}…` : text
2717
+ }
2718
+
2719
+ async function buildStandins(
2720
+ binaries: readonly SwiftPackageBinary[],
2721
+ toolchain: Toolchain,
2722
+ provided: ReadonlySet<string>,
2723
+ behavior: SwiftStandinBehaviors,
2696
2724
  ): Promise<SwiftStandins> {
2697
2725
  const requested = binaries.filter((binary) => !provided.has(binary.target))
2698
2726
  if (requested.length === 0) return { standins: [], gaps: new Map() }
@@ -636,6 +636,12 @@ function processRuns(pid: number): boolean {
636
636
  }
637
637
  }
638
638
 
639
+ /** a crashed swift tool dumps a core file the size of its memory into its
640
+ * working directory, which is the caller's repository. */
641
+ export function withoutCoreDump(file: string, args: string[]): [string, string[]] {
642
+ return ['/bin/sh', ['-c', 'ulimit -c 0; exec "$@"', 'sh', file, ...args]]
643
+ }
644
+
639
645
  /** every swift child's temporary and xdg paths stay in peach's cache. only
640
646
  * linux changes HOME; macOS keeps its account and idiomatic SDK discovery. */
641
647
  export function swiftEnvironment(