peachsim 0.1.1817 → 0.1.1821

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 (144) hide show
  1. package/cli/commands/agent-indicator-mode.ts +2 -1
  2. package/cli/commands/coverage-swift.ts +4 -3
  3. package/cli/commands/flow.ts +7 -0
  4. package/cli/commands/inspect/core.ts +14 -4
  5. package/cli/commands/inspect/wait-selector.ts +9 -1
  6. package/cli/commands/maestro-compare.ts +7 -0
  7. package/cli/commands/package.ts +5 -0
  8. package/cli/commands/screenshot-mode.ts +2 -1
  9. package/cli/commands/shell-boolean-mode.ts +7 -3
  10. package/cli/commands/shell-url.ts +4 -0
  11. package/cli/commands/show-touches-mode.ts +2 -1
  12. package/cli/commands/test.ts +3 -2
  13. package/cli/commands/three-mode.ts +2 -1
  14. package/cli/outbound-endpoints.ts +5 -0
  15. package/dist-lib/agent-daemon-client.cjs +1 -1
  16. package/dist-lib/agent-events.cjs +1 -1
  17. package/dist-lib/attached-projects.cjs +1 -1
  18. package/dist-lib/auth/shared-session.cjs +1 -1
  19. package/dist-lib/backend-origin.cjs +1 -1
  20. package/dist-lib/beta.cjs +1 -1
  21. package/dist-lib/beta.mjs +1 -1
  22. package/dist-lib/bridge-constants.cjs +1 -1
  23. package/dist-lib/bridge-contract-input.cjs +1 -1
  24. package/dist-lib/bridge-contract-input.mjs +1 -1
  25. package/dist-lib/bridge-contract.cjs +1 -1
  26. package/dist-lib/bridge-contract.mjs +1 -1
  27. package/dist-lib/bundle-channel.cjs +2842 -3830
  28. package/dist-lib/capture-contract.cjs +1 -1
  29. package/dist-lib/capture-contract.mjs +1 -1
  30. package/dist-lib/cloud-contract.cjs +1 -1
  31. package/dist-lib/cloud-contract.mjs +1 -1
  32. package/dist-lib/cloud-test-args.cjs +1 -1
  33. package/dist-lib/cloud-test-args.mjs +1 -1
  34. package/dist-lib/cloud.cjs +1 -1
  35. package/dist-lib/cloud.mjs +1 -1
  36. package/dist-lib/config.cjs +1 -1
  37. package/dist-lib/config.mjs +1 -1
  38. package/dist-lib/detox/index.cjs +2 -2
  39. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  40. package/dist-lib/expo-swift-bundle.cjs +1722 -1580
  41. package/dist-lib/expo-swift-metadata.cjs +1 -1
  42. package/dist-lib/expo-swift-metadata.mjs +1 -1
  43. package/dist-lib/home-paths.cjs +1 -1
  44. package/dist-lib/host/bridge-host.cjs +2800 -3794
  45. package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
  46. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  47. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  48. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  49. package/dist-lib/host/websocket-proxy.cjs +1 -1
  50. package/dist-lib/index.cjs +32 -11
  51. package/dist-lib/jump-to-source-babel.cjs +1 -1
  52. package/dist-lib/jump-to-source-native.cjs +1 -1
  53. package/dist-lib/kotlin-host.cjs +1 -1
  54. package/dist-lib/menu.cjs +1 -1
  55. package/dist-lib/menu.mjs +1 -1
  56. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  57. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  58. package/dist-lib/metro-production-bundle.cjs +1 -1
  59. package/dist-lib/metro-production-bundle.mjs +1 -1
  60. package/dist-lib/metro.cjs +28 -7
  61. package/dist-lib/native-app-identity-project.cjs +31 -6
  62. package/dist-lib/native-app-identity-project.mjs +295 -259
  63. package/dist-lib/native-app-identity.cjs +1 -1
  64. package/dist-lib/native-app-identity.mjs +1 -1
  65. package/dist-lib/native-firebase-metadata.cjs +1 -1
  66. package/dist-lib/native-firebase-metadata.mjs +1 -1
  67. package/dist-lib/pdfium-raster.cjs +1 -1
  68. package/dist-lib/pdfium-raster.mjs +1 -1
  69. package/dist-lib/plist.cjs +1 -1
  70. package/dist-lib/plist.mjs +1 -1
  71. package/dist-lib/profiles.cjs +1 -1
  72. package/dist-lib/public-brand.cjs +1 -1
  73. package/dist-lib/public-origins-lib-esm.json +29 -24
  74. package/dist-lib/public-origins-lib.json +100 -80
  75. package/dist-lib/react-native-host-modules.cjs +1 -1
  76. package/dist-lib/react-native-host-modules.mjs +1 -1
  77. package/dist-lib/reap-browser.cjs +1 -1
  78. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  79. package/dist-lib/sdk.cjs +8 -6
  80. package/dist-lib/sdk.mjs +8 -6
  81. package/dist-lib/skills.cjs +3192 -4150
  82. package/dist-lib/swift-compile.cjs +136 -29
  83. package/dist-lib/swift-compile.mjs +143 -34
  84. package/dist-lib/swift-package.cjs +1 -1
  85. package/dist-lib/swift-package.mjs +1 -1
  86. package/dist-lib/swift-submit.cjs +1 -1
  87. package/dist-lib/swift-submit.mjs +1 -1
  88. package/dist-lib/swift-toolchain.cjs +52 -6
  89. package/dist-lib/swift.cjs +1 -1
  90. package/dist-lib/vite-swift.cjs +2206 -2060
  91. package/dist-lib/vite.cjs +2 -2
  92. package/dist-lib/worklet-executable.cjs +1 -1
  93. package/dist-lib/worklet-executable.mjs +1 -1
  94. package/dist-types/packages/peach-engine/src/ios/photoLibraryContract.d.ts +1 -1
  95. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +5 -0
  96. package/dist-types/packages/peach-engine/src/render-worker/map-command-channel.d.ts +41 -0
  97. package/dist-types/packages/peach-engine/src/render-worker/mapServicesContract.d.ts +45 -0
  98. package/package.json +2 -1
  99. package/runtime-companion.json +1 -1
  100. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes +1 -1
  101. package/sdk/ios/usr/include/module.modulemap +3 -0
  102. package/sdk/ios/usr/include/notify.modulemap +9 -0
  103. package/sdk/ios/usr/lib/swift/Darwin.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
  104. package/sdk/ios/usr/lib/swift/Dispatch.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -1
  105. package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +7 -1
  106. package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -0
  107. package/sdk/ios/usr/lib/swift/SwiftUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +21 -0
  108. package/sdk/ios/usr/lib/swift/SwiftUICore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -1
  109. package/sdk/ios/wasm/include/__header_time.h +4 -0
  110. package/sdk/ios/wasm/include/pthread.h +2 -0
  111. package/sdk/ios/wasm/include/sys/mman.h +1 -1
  112. package/sdk/ios/wasm/include/sys/resource.h +31 -0
  113. package/sdk/ios/wasm/include/unistd.h +4 -0
  114. package/src/answeredNativePackages.ts +11 -9
  115. package/src/expo-discovery-cache.ts +69 -52
  116. package/src/expo-native-workspace.ts +3 -1
  117. package/src/expo-swift-host.ts +45 -7
  118. package/src/installed-native-libraries.ts +103 -20
  119. package/src/native-static-libraries.ts +69 -33
  120. package/src/nitro-adapter.ts +0 -9
  121. package/src/nitro-compile.ts +45 -16
  122. package/src/nitro-superset.ts +4 -5
  123. package/src/plist-bytes.ts +9 -0
  124. package/src/portable-expo-workspace.ts +4 -3
  125. package/src/react-native-bridge-modules.ts +11 -15
  126. package/src/swift-compile.ts +146 -18
  127. package/src/swift-cxx-reachable.ts +13 -0
  128. package/src/swift-distribution.ts +3 -4
  129. package/src/swift-host.ts +5 -3
  130. package/src/swift-installed-targets.ts +32 -14
  131. package/src/swift-native-pin.ts +45 -0
  132. package/src/swift-objc-compile.ts +23 -1
  133. package/src/swift-objc-standin.ts +4 -1
  134. package/src/swift-package-manifest.ts +2 -2
  135. package/src/swift-root-lock.ts +4 -3
  136. package/src/swift-standins.ts +5 -26
  137. package/src/swift-toolchain.ts +69 -12
  138. package/src/swift-wasm-prune.ts +1 -0
  139. package/src/swift-xcframework.ts +23 -12
  140. package/src/swiftContract.ts +2 -0
  141. package/src/swiftNativePinContract.ts +68 -0
  142. package/src/turbo-bundle.ts +14 -6
  143. package/src/turbo-compile.ts +76 -11
  144. package/src/turbo-source.ts +91 -15
@@ -13,6 +13,7 @@ import fs from 'node:fs'
13
13
  import path from 'node:path'
14
14
  import { promisify } from 'node:util'
15
15
  import { rnxHomeDir } from './home-paths'
16
+ import { installedNativeSources } from './installed-native-libraries'
16
17
 
17
18
  const execFileAsync = promisify(execFile)
18
19
 
@@ -46,6 +47,7 @@ import {
46
47
  installedRendererDependencyGlobs,
47
48
  runInstalledTurboCodegen,
48
49
  } from './turbo-codegen-intake'
50
+ import { installedXcodeWorkspace } from './xcode-project'
49
51
  import type { SwiftCompileInput } from './swift-compile'
50
52
  import type { SwiftPackageTarget } from './swift-package'
51
53
  import type { SwiftNativeHeaderMap } from './swiftContract'
@@ -59,15 +61,22 @@ export interface TurboProvider {
59
61
  podspecPath: string
60
62
  }
61
63
 
62
- export interface TurboInstalledPod {
64
+ export interface TurboInstalledSources {
63
65
  root: string
64
66
  files: string[]
67
+ }
68
+
69
+ export interface TurboInstalledPod extends TurboInstalledSources {
65
70
  publicHeaders: string[]
66
71
  headerSearchPaths: string[]
72
+ dependencySearchPaths: { root: string; directory: string }[]
67
73
  reactHeaderMaps: SwiftNativeHeaderMap[]
74
+ dependencyHeaderMaps: (SwiftNativeHeaderMap & { root: string })[]
68
75
  mappedHeaders: [string, string][]
69
76
  preprocessorFlags: { c: string[]; cxx: string[] }
70
77
  library?: string
78
+ /** registered vendored framework implementations owned by the shared core. */
79
+ sharedLibrary?: string
71
80
  }
72
81
 
73
82
  /** source fragments for the common Swift host. the caller owns the executable,
@@ -881,18 +890,35 @@ function registers(root: string, files: Iterable<string>, objc = true): boolean
881
890
  }
882
891
 
883
892
  /** autolinked iOS pods that provide modules or original Fabric components. */
884
- export async function discoverTurboProviders(appRoot: string): Promise<TurboProvider[]> {
893
+ export async function discoverTurboProviders(
894
+ appRoot: string,
895
+ projectRoot?: string,
896
+ iosTarget?: string,
897
+ ): Promise<TurboProvider[]> {
885
898
  const providers: TurboProvider[] = []
899
+ const candidates: { provider: TurboProvider; fabric: boolean }[] = []
886
900
  for (const { name, root, podspecPath } of await iosAutolinkedDependencies(appRoot)) {
887
901
  // a package peach-compat answers keeps its answer, Fabric views included.
888
902
  if (peachAnsweredNativePackages().has(name)) continue
889
903
  // a pod can register Nitro objects and Fabric components independently.
890
904
  const fabric = fabricComponents(root)
891
905
  if (!podspecPath) continue
892
- const provider = { name, root, podspecPath }
906
+ candidates.push({ provider: { name, root, podspecPath }, fabric })
907
+ }
908
+ const installed =
909
+ projectRoot && installedXcodeWorkspace(projectRoot)
910
+ ? installedNativeSources(
911
+ candidates.map(({ provider }) => provider),
912
+ projectRoot,
913
+ iosTarget,
914
+ )
915
+ : null
916
+ for (const { provider, fabric } of candidates) {
893
917
  const pod = readPod(provider, appRoot)
894
- const files = fabric ? null : podGlobFiles(pod)
895
- if (fabric || (files !== null && registers(pod.root, files))) {
918
+ const { root, files } = installed
919
+ ? installed.get(provider.name)!
920
+ : { root: pod.root, files: fabric ? null : podGlobFiles(pod) }
921
+ if (fabric || (files !== null && registers(root, files))) {
896
922
  const dependencies = await Promise.all(
897
923
  podspecDependencies(pod.text).map((dep) =>
898
924
  resolveExternalTurboPod(dep.name, dep.requirements, dep.subspecs),
@@ -1020,6 +1046,13 @@ export async function collectTurboSources(options: {
1020
1046
  externalPodSources: [],
1021
1047
  rendererSwiftTargets: [],
1022
1048
  }
1049
+ const sharedLibrary = [...(options.installedPods?.values() ?? [])].find(
1050
+ (pod) => pod.sharedLibrary,
1051
+ )?.sharedLibrary
1052
+ if (sharedLibrary)
1053
+ result.libraries = {
1054
+ [TURBO_CORE_TARGET]: fs.readFileSync(sharedLibrary).toString('base64'),
1055
+ }
1023
1056
  const add = (file: string, text: string) => {
1024
1057
  if (Object.hasOwn(result.files, file)) {
1025
1058
  if (result.files[file] !== text)
@@ -1176,10 +1209,16 @@ export async function collectTurboSources(options: {
1176
1209
  label: string
1177
1210
  root: string
1178
1211
  searchPaths: string[]
1212
+ dependencySearchPaths: TurboInstalledPod['dependencySearchPaths']
1179
1213
  reactHeaderMaps: {
1180
1214
  flag: SwiftNativeHeaderMap['flag']
1181
1215
  headers: Map<string, string>
1182
1216
  }[]
1217
+ dependencyHeaderMaps: {
1218
+ flag: SwiftNativeHeaderMap['flag']
1219
+ root: string
1220
+ headers: Map<string, string>
1221
+ }[]
1183
1222
  }
1184
1223
  >()
1185
1224
  // an include a file names, resolved as clang would against the pod's own
@@ -1339,6 +1378,44 @@ export async function collectTurboSources(options: {
1339
1378
  )
1340
1379
  return
1341
1380
  }
1381
+ for (const map of quoted
1382
+ ? [
1383
+ ...(pod?.dependencyHeaderMaps.filter(({ flag }) => flag === '-iquote') ?? []),
1384
+ ...(pod?.dependencyHeaderMaps.filter(({ flag }) => flag === '-I') ?? []),
1385
+ ]
1386
+ : (pod?.dependencyHeaderMaps.filter(({ flag }) => flag === '-I') ?? [])) {
1387
+ const relative = map.headers.get(include)
1388
+ if (relative === undefined) continue
1389
+ // the workspace is a copy of the app. use the same pod-relative source
1390
+ // identity as public-header lookup so pragma once sees one file.
1391
+ const owner = installedHeaderPods.flatMap((candidate) => {
1392
+ const root = relativeInside(options.appRoot, candidate.root)
1393
+ const file = root === null ? null : relativeInside(root, relative)
1394
+ return file === null ? [] : [{ pod: candidate, file }]
1395
+ })[0]
1396
+ alias(
1397
+ own,
1398
+ owner
1399
+ ? original(from.targetName, owner.pod.name, owner.pod.root, owner.file, false)
1400
+ : original(from.targetName, 'installed-dependency', map.root, relative, false),
1401
+ )
1402
+ return
1403
+ }
1404
+ // preserve installed cross-pod search roots without copying every header
1405
+ // in the sandbox. the original file's adjacent includes keep its own root.
1406
+ for (const search of pod?.dependencySearchPaths ?? []) {
1407
+ const candidate = path.resolve(search.root, search.directory, include)
1408
+ if (!fs.statSync(candidate, { throwIfNoEntry: false })?.isFile()) continue
1409
+ const file = fs.realpathSync(candidate)
1410
+ const relative = relativeInside(search.root, file)
1411
+ if (relative === null)
1412
+ throw new Error('installed dependency header escapes its workspace: ' + candidate)
1413
+ alias(
1414
+ own,
1415
+ original(from.targetName, 'installed-dependency', search.root, relative, false),
1416
+ )
1417
+ return
1418
+ }
1342
1419
  resolveDependency(include)
1343
1420
  }
1344
1421
  const scanText = (from: Scan, text: string, dependency = false) => {
@@ -1479,12 +1556,16 @@ export async function collectTurboSources(options: {
1479
1556
  (match) => match[1]!,
1480
1557
  ),
1481
1558
  ),
1559
+ dependencySearchPaths: pod.installed?.dependencySearchPaths ?? [],
1482
1560
  reactHeaderMaps: (pod.installed?.reactHeaderMaps ?? []).map(
1483
1561
  ({ flag, entries }) => ({
1484
1562
  flag,
1485
1563
  headers: new Map(entries),
1486
1564
  }),
1487
1565
  ),
1566
+ dependencyHeaderMaps: (pod.installed?.dependencyHeaderMaps ?? []).map(
1567
+ ({ flag, root, entries }) => ({ flag, root, headers: new Map(entries) }),
1568
+ ),
1488
1569
  })
1489
1570
  const mappings = podHeaderMappings(pod)
1490
1571
  // CocoaPods flattens a pod's headers: `Name.h` and `<pod>/Name.h`
@@ -1890,15 +1971,6 @@ export async function collectTurboSources(options: {
1890
1971
  '#import <UIKit/UIKit.h>',
1891
1972
  '#endif',
1892
1973
  '#if defined(__OBJC__) && !defined(__swift__)',
1893
- '@class NSURLConnection;',
1894
- '@class NSURLAuthenticationChallenge;',
1895
- '@class NSURLProtectionSpace;',
1896
- '@protocol NSURLConnectionDelegate <NSObject>',
1897
- '@optional',
1898
- '- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;',
1899
- '- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;',
1900
- '- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;',
1901
- '@end',
1902
1974
  '@interface UIScreen (PeachTurboRuntime)',
1903
1975
  '@property(nonatomic) CGFloat brightness;',
1904
1976
  '@end',
@@ -1977,7 +2049,11 @@ export async function collectTurboSources(options: {
1977
2049
  })
1978
2050
  result.rendererSwiftTargets.push(name)
1979
2051
  }
1980
- for (const file of pod.files) original(name, 'react-native', reactNative.root, file)
2052
+ for (const file of pod.files) {
2053
+ const collected = original(name, 'react-native', reactNative.root, file)
2054
+ if (swift)
2055
+ result.externalPodSources.push({ moduleName: pod.module, file: collected })
2056
+ }
1981
2057
  }
1982
2058
  const patterns = installedRendererDependencyGlobs(reactNative.root)
1983
2059
  const matchers = new Map(