peachsim 0.1.1716 → 0.1.1738

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 (282) hide show
  1. package/README.md +21 -3
  2. package/cli/app-bundle-resources.ts +2 -1
  3. package/cli/app-fonts.ts +4 -4
  4. package/cli/app-splash.ts +4 -4
  5. package/cli/app-stubs.ts +17 -0
  6. package/cli/command-registry.ts +1 -0
  7. package/cli/commands/control.ts +83 -822
  8. package/cli/commands/coverage-swift.ts +112 -4
  9. package/cli/commands/daemon.ts +8 -0
  10. package/cli/commands/detox.ts +3 -0
  11. package/cli/commands/doctor.ts +19 -2
  12. package/cli/commands/inspect/actions.ts +74 -14
  13. package/cli/commands/inspect/core.ts +5 -1
  14. package/cli/commands/inspect/settling.ts +5 -2
  15. package/cli/commands/inspect/wait-ready.ts +6 -0
  16. package/cli/commands/inspect.ts +48 -45
  17. package/cli/commands/kotlin.ts +12 -2
  18. package/cli/commands/package.ts +760 -0
  19. package/cli/commands/serve.ts +6 -0
  20. package/cli/commands/shell-url.ts +838 -0
  21. package/cli/commands/swift.ts +42 -102
  22. package/cli/commands/test.ts +20 -0
  23. package/cli/commands/upload.ts +1 -1
  24. package/cli/device-option.ts +1 -1
  25. package/cli/main.ts +13 -1
  26. package/cli/native-input.ts +199 -0
  27. package/cli/outbound-endpoints.ts +26 -1
  28. package/cli/packaged-app-launcher.ts +95 -0
  29. package/cli/scene-video.ts +36 -12
  30. package/detox/index.ts +196 -24
  31. package/dist-lib/agent-daemon-client.cjs +1 -1
  32. package/dist-lib/agent-events.cjs +1 -1
  33. package/dist-lib/attached-projects.cjs +5 -2
  34. package/dist-lib/auth/shared-session.cjs +5 -2
  35. package/dist-lib/backend-origin.cjs +1 -1
  36. package/dist-lib/beta.cjs +1 -1
  37. package/dist-lib/beta.mjs +1 -1
  38. package/dist-lib/bridge-constants.cjs +1 -1
  39. package/dist-lib/bridge-contract-input.cjs +1 -1
  40. package/dist-lib/bridge-contract-input.mjs +1 -1
  41. package/dist-lib/bridge-contract.cjs +1 -1
  42. package/dist-lib/bridge-contract.mjs +1 -1
  43. package/dist-lib/bundle-channel.cjs +39889 -31873
  44. package/dist-lib/capture-contract.cjs +1 -1
  45. package/dist-lib/capture-contract.mjs +1 -1
  46. package/dist-lib/cloud-contract.cjs +1 -1
  47. package/dist-lib/cloud-contract.mjs +1 -1
  48. package/dist-lib/cloud-test-args.cjs +1 -1
  49. package/dist-lib/cloud-test-args.mjs +1 -1
  50. package/dist-lib/cloud.cjs +1 -1
  51. package/dist-lib/cloud.mjs +1 -1
  52. package/dist-lib/config.cjs +1 -1
  53. package/dist-lib/config.mjs +1 -1
  54. package/dist-lib/detox/index.cjs +195 -63
  55. package/dist-lib/dev-bundle-resolution.cjs +14 -13
  56. package/dist-lib/expo-swift-bundle.cjs +18507 -11835
  57. package/dist-lib/expo-swift-metadata.cjs +4 -1
  58. package/dist-lib/expo-swift-metadata.mjs +3 -1
  59. package/dist-lib/home-paths.cjs +27 -3
  60. package/dist-lib/host/bridge-host.cjs +28373 -24090
  61. package/dist-lib/host/fetch-proxy-handler.cjs +235 -225
  62. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  63. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  64. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  65. package/dist-lib/host/websocket-proxy.cjs +1 -1
  66. package/dist-lib/index.cjs +915 -399
  67. package/dist-lib/jump-to-source-babel.cjs +1 -1
  68. package/dist-lib/jump-to-source-native.cjs +1 -1
  69. package/dist-lib/kotlin-host.cjs +335 -47
  70. package/dist-lib/menu.cjs +13 -1
  71. package/dist-lib/menu.mjs +13 -1
  72. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  73. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  74. package/dist-lib/metro-production-bundle.cjs +1 -1
  75. package/dist-lib/metro-production-bundle.mjs +1 -1
  76. package/dist-lib/metro.cjs +918 -411
  77. package/dist-lib/native-app-identity-project.cjs +703 -283
  78. package/dist-lib/native-app-identity-project.mjs +500 -87
  79. package/dist-lib/native-app-identity.cjs +13 -2
  80. package/dist-lib/native-app-identity.mjs +13 -2
  81. package/dist-lib/native-firebase-metadata.cjs +1 -1
  82. package/dist-lib/native-firebase-metadata.mjs +1 -1
  83. package/dist-lib/plist.cjs +1 -1
  84. package/dist-lib/plist.mjs +1 -1
  85. package/dist-lib/profiles.cjs +5 -2
  86. package/dist-lib/public-brand.cjs +1 -1
  87. package/dist-lib/public-origins-lib-esm.json +28 -23
  88. package/dist-lib/public-origins-lib.json +418 -224
  89. package/dist-lib/react-native-host-modules.cjs +35 -2
  90. package/dist-lib/react-native-host-modules.mjs +35 -2
  91. package/dist-lib/reap-browser.cjs +12 -4
  92. package/dist-lib/scripts/dev-server-scanner.cjs +15 -8
  93. package/dist-lib/sdk.cjs +17 -7
  94. package/dist-lib/sdk.mjs +16 -7
  95. package/dist-lib/skills.cjs +44825 -29141
  96. package/dist-lib/swift-compile.cjs +616 -400
  97. package/dist-lib/swift-compile.mjs +528 -315
  98. package/dist-lib/swift-package.cjs +1 -1
  99. package/dist-lib/swift-package.mjs +1 -1
  100. package/dist-lib/swift-submit.cjs +2 -2
  101. package/dist-lib/swift-submit.mjs +2 -2
  102. package/dist-lib/swift-toolchain.cjs +105 -17
  103. package/dist-lib/swift.cjs +1 -1
  104. package/dist-lib/vite-swift.cjs +4660 -2252
  105. package/dist-lib/vite.cjs +248 -234
  106. package/dist-lib/worklet-executable.cjs +1 -1
  107. package/dist-lib/worklet-executable.mjs +1 -1
  108. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +17 -8
  109. package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +1 -0
  110. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +7 -4
  111. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +9 -6
  112. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +0 -5
  113. package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +11 -1
  114. package/dist-types/packages/peach-engine/src/engine/node.d.ts +5 -12
  115. package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +2 -2
  116. package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +5 -0
  117. package/dist-types/packages/peach-engine/src/engine/text-paragraph.d.ts +1 -0
  118. package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -0
  119. package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +2 -0
  120. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +9 -0
  121. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
  122. package/dist-types/packages/peach-engine/src/render-worker/native-ui-commandContract.d.ts +1 -1
  123. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +7 -2
  124. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -0
  125. package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
  126. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +36 -2
  127. package/dist-types/packages/peach-engine/src/shell-events.d.ts +1 -0
  128. package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +5 -0
  129. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  130. package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +11 -0
  131. package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +1 -0
  132. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +9 -2
  133. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  134. package/kotlin/README.md +3 -0
  135. package/kotlin/sdk.tar.gz +0 -0
  136. package/package.json +1 -1
  137. package/runtime-companion.json +1 -1
  138. package/scripts/dev-server-scanner.ts +12 -25
  139. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccount.h +55 -0
  140. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +35 -0
  141. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +94 -0
  142. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +53 -0
  143. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACError.h +37 -0
  144. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/Accounts.h +13 -0
  145. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/AccountsDefines.h +13 -0
  146. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Modules/module.modulemap +5 -0
  147. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASFoundation.h +52 -0
  148. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +128 -0
  149. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSessionCallback.h +35 -0
  150. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/AuthenticationServices.h +3 -0
  151. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Modules/module.modulemap +5 -0
  152. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFHTTPMessage.h +724 -0
  153. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +4 -0
  154. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkDefs.h +27 -0
  155. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Modules/module.modulemap +5 -0
  156. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h +1301 -0
  157. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +3 -1
  158. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +21 -50
  159. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +6 -6
  160. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +58 -3
  161. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +711 -46
  162. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +12 -0
  163. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInterface.h +23 -0
  164. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +7 -9
  165. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIOrientation.h +14 -0
  166. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIStringDrawing.h +12 -0
  167. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +14 -0
  168. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewAnimating.h +12 -0
  169. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h +16 -0
  170. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIWindow.h +2 -0
  171. package/sdk/ios/usr/include/ConditionalMacros.h +619 -0
  172. package/sdk/ios/usr/include/module.modulemap +1 -0
  173. package/sdk/ios/usr/include/objc/objc-sync.h +59 -0
  174. package/sdk/ios/usr/include/os/signpost.h +414 -0
  175. package/sdk/ios/usr/include/os.modulemap +10 -0
  176. package/sdk/ios/usr/include/sys/cdefs.h +5 -0
  177. package/sdk/ios/usr/include/sys/ioccom.h +99 -0
  178. package/sdk/ios/usr/include/sys/syslog.h +236 -0
  179. package/sdk/ios/usr/include/syslog.h +24 -0
  180. package/sdk/ios/wasm/include/errno.h +4 -20
  181. package/sdk/ios/wasm/include/fcntl.h +4 -2
  182. package/sdk/ios/wasm/include/pthread.h +3 -0
  183. package/sdk/ios/wasm/include/setjmp.h +57 -0
  184. package/sdk/ios/wasm/include/stdio.h +24 -0
  185. package/sdk/ios/wasm/include/stdlib.h +32 -7
  186. package/sdk/ios/wasm/include/sys/file.h +7 -0
  187. package/sdk/ios/wasm/include/sys/ioctl.h +6 -0
  188. package/sdk/ios/wasm/include/sys/resource.h +2 -2
  189. package/sdk/ios/wasm/include/sys/syscall.h +9 -0
  190. package/sdk/ios/wasm/include/sys/time.h +10 -0
  191. package/sdk/ios/wasm/include/unistd.h +12 -3
  192. package/sdk/native-hashes.json +4 -3
  193. package/skills/contrast/SKILL.md +2 -1
  194. package/skills/peach-debug/SKILL.md +0 -1
  195. package/skills/peach-perf/SKILL.md +0 -1
  196. package/skills/peach-setup/SKILL.md +0 -1
  197. package/skills/peach-test/SKILL.md +7 -4
  198. package/skills/peach-visual/SKILL.md +0 -1
  199. package/src/admitted-mac-build.ts +3 -0
  200. package/src/android-app-identity.ts +18 -0
  201. package/src/android-autolinking.ts +1 -0
  202. package/src/android-bridge-packages.ts +279 -0
  203. package/src/android-root-module.ts +9 -9
  204. package/src/appPackageContract.ts +83 -0
  205. package/src/bridge-contract.ts +50 -0
  206. package/src/bundle-channel.mjs +41 -6
  207. package/src/cli-runtime.ts +9 -5
  208. package/src/dev-bundle-resolution.ts +7 -27
  209. package/src/dom-source-reference.ts +15 -0
  210. package/src/expo-discovery-cache.ts +134 -26
  211. package/src/expo-kotlin-host.ts +97 -26
  212. package/src/expo-manifest-body.ts +33 -0
  213. package/src/expo-native-workspace.ts +158 -38
  214. package/src/expo-swift-host.ts +350 -75
  215. package/src/expo-swift-ready.ts +5 -1
  216. package/src/expoKotlinContract.ts +12 -2
  217. package/src/expoSwiftContract.ts +10 -0
  218. package/src/generated/swift-c-predefines.json +1 -1
  219. package/src/home-paths.ts +41 -2
  220. package/src/host/app-package-handler.ts +47 -0
  221. package/src/host/bridge-host.ts +8 -0
  222. package/src/host/fetch-proxy-handler.ts +10 -0
  223. package/src/host/staged-host-files.ts +18 -0
  224. package/src/index.ts +3 -0
  225. package/src/kotlin-host.ts +225 -48
  226. package/src/kotlin-instance-source.ts +126 -0
  227. package/src/kotlinSdkContract.ts +2 -1
  228. package/src/menu.ts +14 -0
  229. package/src/native-app-identity-project.ts +7 -2
  230. package/src/native-app-identity.ts +11 -0
  231. package/src/native-firebase-config.ts +24 -1
  232. package/src/native-prebuilt.ts +154 -0
  233. package/src/nitro-adapter.lock.json +270 -270
  234. package/src/nitro-adapter.ts +56 -50
  235. package/src/nitro-bundle.ts +92 -74
  236. package/src/nitro-compile.ts +45 -14
  237. package/src/nitro-dependencies.ts +63 -46
  238. package/src/nitro-source.ts +64 -26
  239. package/src/nitroAdapterContract.ts +146 -98
  240. package/src/nitroContract.ts +71 -21
  241. package/src/react-native-bridge-modules.ts +70 -42
  242. package/src/react-native-host-modules.ts +34 -1
  243. package/src/reactNativeConfigurationContract.ts +14 -0
  244. package/src/reap-browser.ts +15 -3
  245. package/src/sdk.ts +5 -0
  246. package/src/settingsContract.ts +38 -1
  247. package/src/sim-client.ts +4 -1
  248. package/src/storageSnapshotContract.ts +32 -81
  249. package/src/swift-compile.ts +268 -89
  250. package/src/swift-coverage/indexdump.ts +22 -6
  251. package/src/swift-coverage/indexing.ts +4 -4
  252. package/src/swift-coverage/provenance.ts +1 -0
  253. package/src/swift-coverage/sdk.ts +104 -20
  254. package/src/swift-coverage/types.ts +34 -0
  255. package/src/swift-coverage/xcode-asset-symbols.ts +922 -0
  256. package/src/swift-coverage/xcode-assets.ts +89 -131
  257. package/src/swift-coverage/xcode.ts +10 -2
  258. package/src/swift-cxx-reachable.ts +2 -1
  259. package/src/swift-distribution.lock.json +20 -16
  260. package/src/swift-host.ts +98 -22
  261. package/src/swift-icu.ts +1 -1
  262. package/src/swift-link-roots.ts +118 -0
  263. package/src/swift-objc-compile.ts +144 -22
  264. package/src/swift-objc-import.ts +6 -0
  265. package/src/swift-objc-standin.ts +2 -14
  266. package/src/swift-package-manifest.ts +14 -6
  267. package/src/swift-packages.ts +75 -11
  268. package/src/swift-pdf-raster.ts +1 -0
  269. package/src/swift-root-lock.ts +17 -1
  270. package/src/swift-source-pods.ts +2 -10
  271. package/src/swift-standin-emit.ts +597 -57
  272. package/src/swift-standins.ts +599 -56
  273. package/src/swift-submit.ts +7 -1
  274. package/src/swift-toolchain.ts +140 -17
  275. package/src/turbo-bundle.ts +81 -0
  276. package/src/turbo-codegen-intake.ts +91 -0
  277. package/src/turbo-compile.ts +120 -0
  278. package/src/turbo-runtime.lock.json +69 -0
  279. package/src/turbo-source.ts +754 -0
  280. package/src/vite-plugin-one.ts +17 -12
  281. package/src/vite-plugin.ts +28 -15
  282. package/src/xcode-project.ts +223 -22
@@ -8,7 +8,7 @@ import { nodeHttpFetch } from './node-http-fetch'
8
8
  // 120s for its first tree. so `peach open` GETs the same endpoint the engine
9
9
  // will fetch and returns only once it answers. the bridge gives this open's
10
10
  // response to its first engine request. an app without local modules answers
11
- // null; the nitro endpoint is read the same way. a bridge older than this cli
11
+ // null; the nitro and turbo endpoints are read the same way. a bridge older than this cli
12
12
  // lacks the route and answers 404 without CORS headers, which the engine would report as
13
13
  // a guest CORS rejection, so a 404 reports the route and the possible cause.
14
14
  const EXPO_SWIFT_READY_PROGRESS_MS = 30_000
@@ -72,6 +72,7 @@ export async function awaitStampedExpoSwiftReady(
72
72
  const params = new URL(shellUrl).searchParams
73
73
  const expoSwift = params.get('expoSwift')
74
74
  const nitro = params.get('nitro')
75
+ const turbo = params.get('turbo')
75
76
  const preparationUrl = (address: string) => {
76
77
  const url = new URL(address)
77
78
  url.searchParams.set(NATIVE_PREPARE_QUERY_PARAM, openToken)
@@ -88,6 +89,9 @@ export async function awaitStampedExpoSwiftReady(
88
89
  nitro
89
90
  ? awaitExpoSwiftReady(preparationUrl(nitro), { signal: linked }, 'nitro modules')
90
91
  : null,
92
+ turbo
93
+ ? awaitExpoSwiftReady(preparationUrl(turbo), { signal: linked }, 'turbo modules')
94
+ : null,
91
95
  ])
92
96
  } catch (error) {
93
97
  siblings.abort(error)
@@ -9,6 +9,9 @@ export interface ExpoKotlinCompilationResult {
9
9
  namespaces: string[]
10
10
  module: { url: string; hash: string; compose: boolean } | null
11
11
  failures: { namespace: string; diagnostic: string }[]
12
+ // the namespaces the app's own legacy React Native modules answer for; the
13
+ // engine installs them as bridge modules, not as Expo modules
14
+ bridgeModules: string[]
12
15
  }
13
16
 
14
17
  export function readExpoKotlinMetadata(value: unknown): ExpoKotlinCompilationResult {
@@ -16,7 +19,8 @@ export function readExpoKotlinMetadata(value: unknown): ExpoKotlinCompilationRes
16
19
  if (
17
20
  !isRecord(value) ||
18
21
  !Array.isArray(value.namespaces) ||
19
- !Array.isArray(value.failures)
22
+ !Array.isArray(value.failures) ||
23
+ !Array.isArray(value.bridgeModules)
20
24
  )
21
25
  throw invalid()
22
26
  const namespaces: string[] = []
@@ -24,6 +28,11 @@ export function readExpoKotlinMetadata(value: unknown): ExpoKotlinCompilationRes
24
28
  if (typeof namespace !== 'string') throw invalid()
25
29
  namespaces.push(namespace)
26
30
  }
31
+ const bridgeModules: string[] = []
32
+ for (const namespace of value.bridgeModules) {
33
+ if (typeof namespace !== 'string') throw invalid()
34
+ bridgeModules.push(namespace)
35
+ }
27
36
  const failures: ExpoKotlinCompilationResult['failures'] = []
28
37
  for (const failure of value.failures) {
29
38
  if (
@@ -35,7 +44,7 @@ export function readExpoKotlinMetadata(value: unknown): ExpoKotlinCompilationRes
35
44
  failures.push({ namespace: failure.namespace, diagnostic: failure.diagnostic })
36
45
  }
37
46
  const module = value.module
38
- if (module === null) return { namespaces, module: null, failures }
47
+ if (module === null) return { namespaces, module: null, failures, bridgeModules }
39
48
  if (
40
49
  !isRecord(module) ||
41
50
  typeof module.url !== 'string' ||
@@ -47,6 +56,7 @@ export function readExpoKotlinMetadata(value: unknown): ExpoKotlinCompilationRes
47
56
  namespaces,
48
57
  module: { url: module.url, hash: module.hash, compose: module.compose },
49
58
  failures,
59
+ bridgeModules,
50
60
  }
51
61
  }
52
62
 
@@ -2,6 +2,12 @@ import { insertBundleGlobalFooter, readBundleGlobalFooter } from './bundleGlobal
2
2
  import { isRecord } from './is-record'
3
3
  import type { SwiftNativeTarget } from './swiftContract'
4
4
 
5
+ // installed Expo packages whose unchanged native source the shared hosts compile
6
+ // on each platform; every other installed package keeps its native seam there.
7
+ export const COMPILED_EXPO_NATIVE_PACKAGES: Readonly<
8
+ Record<'ios' | 'android', readonly string[]>
9
+ > = { ios: ['expo-app-intents'], android: [] }
10
+
5
11
  export interface ExpoSwiftPreparationOptions {
6
12
  signal?: AbortSignal
7
13
  installedWorkspace?: string
@@ -13,6 +19,10 @@ export interface ExpoSwiftSourceUnit {
13
19
  classes: string[]
14
20
  // legacy bridge module registrations (react-native-bridge-modules.ts)
15
21
  bridgeModules: string[]
22
+ // expressions for the Expo app delegate subscribers and react delegate
23
+ // handlers the unit registers, as the autolinked Apple provider lists them
24
+ appDelegateSubscribers: string[]
25
+ reactDelegateHandlers: string[]
16
26
  files: Record<string, string>
17
27
  frameworks: string[]
18
28
  nativeTargets?: SwiftNativeTarget[]
@@ -1,5 +1,5 @@
1
1
  {
2
- "release": "swift-6.4.0-RELEASE-custom-ecd2ad9d3fe59329",
2
+ "release": "swift-6.4.0-RELEASE-custom-81b2c791c27276bf",
3
3
  "languages": {
4
4
  "c": {
5
5
  "TARGET_IPHONE_SIMULATOR": "1",
package/src/home-paths.ts CHANGED
@@ -46,10 +46,15 @@ export const CONFIG_FILE = 'config.json'
46
46
  export const CLI_UPDATE_FILE = 'cli-update.json'
47
47
  export const DAEMON_HEARTBEAT_STALE_MS = 30_000
48
48
 
49
+ // the user's own peach home, whatever PEACH_HOME isolates for this process.
50
+ export function ambientHomeDir(): string {
51
+ return path.join(homedir(), '.peach')
52
+ }
53
+
49
54
  export function rnxHomeDir(): string {
50
55
  const override = process.env[PEACH_HOME_ENV]
51
56
  if (override && override.length > 0) return path.resolve(override)
52
- return path.join(homedir(), '.peach')
57
+ return ambientHomeDir()
53
58
  }
54
59
 
55
60
  // detect when peach is running from a source checkout (the Contrast monorepo)
@@ -185,9 +190,43 @@ export function cacheDir(): string {
185
190
  return path.join(rnxHomeDir(), 'cache')
186
191
  }
187
192
 
193
+ export const BUILDERS_ROOT_ENV = 'CONTRAST_BUILDERS_ROOT'
194
+
195
+ // builder sessions export the resolved native build root (`<heavy>/builders`
196
+ // when machine policy configures heavy storage, else `~/builders`).
197
+ // remote.sh refuses before source transfer when a configured root is
198
+ // unavailable, so a set value is always usable and nothing here falls back to
199
+ // the internal disk: a missing directory fails at first write like the other
200
+ // heavy-root consumers.
201
+ function buildersRootEnv(): string | null {
202
+ const root = process.env[BUILDERS_ROOT_ENV]?.trim()
203
+ return root ? root : null
204
+ }
205
+
206
+ // machine-wide swift scratch and package caches, shared across lanes. on a
207
+ // builder this is the resolved heavy volume; everywhere else it stays
208
+ // ~/.peach/cache, so dev machines, containers and CI keep their layout.
209
+ export function swiftCacheDir(): string {
210
+ const root = buildersRootEnv()
211
+ return root ? path.join(root, 'peach-cache') : cacheDir()
212
+ }
213
+
214
+ // per-build-key swift project roots. on a builder every lane shares one
215
+ // machine-wide directory on the heavy volume (the key is content-derived, so
216
+ // lanes agree, and the root lock serializes concurrent builders); elsewhere
217
+ // roots stay in the checkout so two checkouts never build each other's
218
+ // sources. kept apart from the shared verified artifacts below: the builder
219
+ // script prunes idle keys here and must never sweep that cache.
220
+ export function swiftProjectBuildsDir(checkoutRoot: string): string {
221
+ const root = buildersRootEnv()
222
+ return root
223
+ ? path.join(swiftCacheDir(), 'swift-project-builds')
224
+ : path.join(checkoutRoot, 'scripts', 'tmp', 'swift-projects')
225
+ }
226
+
188
227
  // swiftpm otherwise uses shared caches and configuration outside PEACH_HOME.
189
228
  export function swiftPackageCacheOptions(): string[] {
190
- const root = path.join(cacheDir(), 'swiftpm')
229
+ const root = path.join(swiftCacheDir(), 'swiftpm')
191
230
  return ['cache', 'config', 'security'].flatMap((name) => [
192
231
  `--${name}-path`,
193
232
  path.join(root, name),
@@ -0,0 +1,47 @@
1
+ import fs from 'node:fs'
2
+ import path from 'node:path'
3
+ import { cacheDir } from '../home-paths'
4
+ import { isRecord } from '../is-record'
5
+ import type { IncomingMessage, ServerResponse } from 'node:http'
6
+
7
+ function readRoutes() {
8
+ const file = process.env.PEACH_APP_MANIFEST
9
+ const routes = new Map<string, { file: string; contentType: string }>()
10
+ if (!file) return routes
11
+ const manifest: unknown = JSON.parse(fs.readFileSync(file, 'utf8'))
12
+ if (!isRecord(manifest) || manifest.schemaVersion !== 1 || !isRecord(manifest.routes))
13
+ throw new Error('invalid packaged app manifest')
14
+ for (const [route, resource] of Object.entries(manifest.routes)) {
15
+ if (
16
+ !route.startsWith('/') ||
17
+ !isRecord(resource) ||
18
+ typeof resource.file !== 'string' ||
19
+ !resource.file ||
20
+ path.basename(resource.file) !== resource.file ||
21
+ ['.', '..'].includes(resource.file) ||
22
+ typeof resource.contentType !== 'string' ||
23
+ /[\r\n]/.test(resource.contentType)
24
+ )
25
+ throw new Error(`invalid packaged app resource: ${route}`)
26
+ routes.set(route, { file: resource.file, contentType: resource.contentType })
27
+ }
28
+ return routes
29
+ }
30
+
31
+ const routes = readRoutes()
32
+
33
+ export function serveAppPackageResource(
34
+ req: IncomingMessage,
35
+ res: ServerResponse,
36
+ ): boolean {
37
+ const resource = routes.get(new URL(req.url ?? '/', 'http://localhost').pathname)
38
+ if (!resource) return false
39
+ res.setHeader('Content-Type', resource.contentType)
40
+ const stream = fs.createReadStream(path.join(cacheDir(), 'staged', resource.file))
41
+ stream.on('error', () => {
42
+ res.statusCode = 500
43
+ res.end('packaged resource unavailable')
44
+ })
45
+ stream.pipe(res)
46
+ return true
47
+ }
@@ -53,7 +53,9 @@ import {
53
53
  sendFileWithRanges,
54
54
  } from '../runtime-assets.ts'
55
55
  import { rnxRuntime } from '../runtime-delivery.ts'
56
+ import { handleTurboRequest, TURBO_ROUTE } from '../turbo-bundle.ts'
56
57
  import { AgentHost, type AgentHostOptions } from './agent-host.ts'
58
+ import { serveAppPackageResource } from './app-package-handler'
57
59
  import {
58
60
  handleAppApiRequest,
59
61
  handleFetchProxyRequest,
@@ -1514,6 +1516,8 @@ export class SootSimBridgeHost {
1514
1516
  url.pathname,
1515
1517
  )
1516
1518
  if (!publicEngineFont && rejectUntrustedBridgeOrigin(req, res)) return
1519
+ if ((method === 'GET' || method === 'HEAD') && serveAppPackageResource(req, res))
1520
+ return
1517
1521
  if (req.url === '/__peach/fetch-transport') {
1518
1522
  res.writeHead(200, {
1519
1523
  'Content-Type': 'application/json',
@@ -1551,6 +1555,10 @@ export class SootSimBridgeHost {
1551
1555
  void handleNitroRequest(req, res)
1552
1556
  return
1553
1557
  }
1558
+ if (req.url?.split('?')[0] === TURBO_ROUTE) {
1559
+ void handleTurboRequest(req, res)
1560
+ return
1561
+ }
1554
1562
  if (
1555
1563
  req.url?.startsWith('/__peach/expo-swift') ||
1556
1564
  req.url?.startsWith('/__peach/swift')
@@ -485,6 +485,7 @@ async function proxyUpstream(
485
485
  else proxyReq.end(nextBody)
486
486
  })
487
487
  const proxyRes = await send().finally(() => req.off('aborted', markAborted))
488
+ upstreamAnswered = true
488
489
 
489
490
  const status = proxyRes.statusCode ?? 502
490
491
  const location = proxyRes.headers.location
@@ -547,6 +548,7 @@ async function proxyUpstream(
547
548
  await pipeline(proxyRes, res)
548
549
  }
549
550
 
551
+ let upstreamAnswered = false
550
552
  let body: Buffer | undefined
551
553
  try {
552
554
  if (req.method !== 'GET' && req.method !== 'HEAD') {
@@ -561,6 +563,10 @@ async function proxyUpstream(
561
563
  await proxy(upstreamUrl, originalMethod, body, 0, [])
562
564
  } catch (err) {
563
565
  const norm = normalizeHostname(upstreamUrl.hostname)
566
+ // an upstream that answered while this host then failed to forward it is a
567
+ // host defect the page can only see as a dropped connection, so name it
568
+ if (upstreamAnswered && !res.headersSent)
569
+ console.error(`[peach] fetch proxy could not forward ${upstreamUrl.href}:`, err)
564
570
  if (
565
571
  !res.headersSent &&
566
572
  isLoopbackHost(norm) &&
@@ -601,6 +607,10 @@ async function proxyUpstream(
601
607
  res.end()
602
608
  return
603
609
  }
610
+ // network errors carry a code; anything else is ours (a missing companion)
611
+ // and would otherwise leave only an empty reply
612
+ if (!(err instanceof Error && 'code' in err))
613
+ console.error('[peach] fetch proxy failed:', err)
604
614
  // an upstream that cannot be reached fails the page's request the way a
605
615
  // direct fetch would: as a network error, never a response. a synthetic
606
616
  // 5xx reads as a live server answering (the bundle loader then polls it as
@@ -1,3 +1,4 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks'
1
2
  import { createHash, randomUUID } from 'node:crypto'
2
3
  import fs from 'node:fs'
3
4
  import path from 'node:path'
@@ -9,6 +10,21 @@ import {
9
10
  } from '../launchMetadataContract'
10
11
  import type { IncomingMessage, ServerResponse } from 'node:http'
11
12
 
13
+ const stagedCapture = new AsyncLocalStorage<Set<string>>()
14
+
15
+ // capture only this preparation's resources, rather than copying a user's
16
+ // whole staging cache into an app. concurrent preparations remain isolated.
17
+ export async function captureStagedHostFiles<T>(
18
+ prepare: () => Promise<T>,
19
+ ): Promise<{ value: T; files: Map<string, string> }> {
20
+ const names = new Set<string>()
21
+ const value = await stagedCapture.run(names, prepare)
22
+ return {
23
+ value,
24
+ files: new Map([...names].map((name) => [name, path.join(stagedDir(), name)])),
25
+ }
26
+ }
27
+
12
28
  // local files a sim loads from the bridge: native-linked app fonts and
13
29
  // prebuilt app bundles. each is copied under its content digest, so the
14
30
  // bridge serves only what the cli staged and never an arbitrary path.
@@ -84,6 +100,7 @@ export function stageHostMetroAssets(
84
100
  )
85
101
  const name = staged.pathname.slice(STAGED_PREFIX.length)
86
102
  const destination = path.join(directory, index)
103
+ stagedCapture.getStore()?.add(index)
87
104
  const temporary = path.join(directory, randomUUID())
88
105
  try {
89
106
  fs.writeFileSync(temporary, name, { flag: 'wx' })
@@ -150,6 +167,7 @@ function writeStagedBytes(
150
167
  const digest = createHash('sha256').update(bytes).digest('hex')
151
168
  extension = extension.toLowerCase()
152
169
  const name = STAGED_NAME.test(digest + extension) ? digest + extension : digest
170
+ stagedCapture.getStore()?.add(name)
153
171
  const destination = path.join(directory, name)
154
172
  const now = Date.now()
155
173
  if (fs.existsSync(destination)) {
package/src/index.ts CHANGED
@@ -35,6 +35,9 @@ export type {
35
35
  SimSemanticResolveSelector,
36
36
  SimSemanticTargetSelector,
37
37
  SimSemanticSelector,
38
+ SimTapDiagnostics,
39
+ SimTapResult,
40
+ SimTapResultReason,
38
41
  } from './bridge-contract'
39
42
  export {
40
43
  isRnxCaptureRegionAtlas,