peachsim 0.1.1728 → 0.1.1744

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 (374) hide show
  1. package/README.md +4 -0
  2. package/cli/app-catalog.ts +47 -23
  3. package/cli/app-fonts.ts +19 -1
  4. package/cli/command-registry.ts +3 -0
  5. package/cli/commands/control.ts +68 -16
  6. package/cli/commands/coverage-swift.ts +112 -4
  7. package/cli/commands/device.ts +3 -1
  8. package/cli/commands/doctor.ts +1 -4
  9. package/cli/commands/inspect/settling.ts +6 -1
  10. package/cli/commands/inspect/wait-ready.ts +22 -2
  11. package/cli/commands/package.ts +33 -21
  12. package/cli/commands/push.ts +56 -0
  13. package/cli/commands/serve.ts +9 -0
  14. package/cli/commands/shell-url.ts +41 -9
  15. package/cli/commands/swift.ts +1 -1
  16. package/cli/current-sim.ts +27 -0
  17. package/cli/drivers/linux-browser-libs.lock.json +323 -1
  18. package/cli/drivers/linux-browser-libs.ts +8 -6
  19. package/cli/drivers/playwright.ts +5 -1
  20. package/cli/internal-child.ts +11 -1
  21. package/cli/main.ts +6 -0
  22. package/cli/native-input.ts +1 -7
  23. package/cli/outbound-endpoints.ts +9 -1
  24. package/cli/packaged-app-launcher.ts +3 -1
  25. package/cli/scene-video.ts +28 -7
  26. package/cli/ws-bridge.ts +3 -1
  27. package/detox/index.ts +18 -5
  28. package/dist-lib/agent-daemon-client.cjs +1 -1
  29. package/dist-lib/agent-events.cjs +1 -1
  30. package/dist-lib/attached-projects.cjs +5 -2
  31. package/dist-lib/auth/shared-session.cjs +5 -2
  32. package/dist-lib/backend-origin.cjs +1 -1
  33. package/dist-lib/beta.cjs +1 -1
  34. package/dist-lib/beta.mjs +1 -1
  35. package/dist-lib/bridge-constants.cjs +1 -1
  36. package/dist-lib/bridge-contract-input.cjs +1 -1
  37. package/dist-lib/bridge-contract-input.mjs +1 -1
  38. package/dist-lib/bridge-contract.cjs +1 -1
  39. package/dist-lib/bridge-contract.mjs +1 -1
  40. package/dist-lib/bundle-channel.cjs +9932 -4561
  41. package/dist-lib/capture-contract.cjs +1 -1
  42. package/dist-lib/capture-contract.mjs +1 -1
  43. package/dist-lib/cloud-contract.cjs +1 -1
  44. package/dist-lib/cloud-contract.mjs +1 -1
  45. package/dist-lib/cloud-test-args.cjs +1 -1
  46. package/dist-lib/cloud-test-args.mjs +1 -1
  47. package/dist-lib/cloud.cjs +1 -1
  48. package/dist-lib/cloud.mjs +1 -1
  49. package/dist-lib/config.cjs +1 -1
  50. package/dist-lib/config.mjs +1 -1
  51. package/dist-lib/detox/index.cjs +30 -8
  52. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  53. package/dist-lib/expo-swift-bundle.cjs +6886 -3303
  54. package/dist-lib/expo-swift-metadata.cjs +14 -2
  55. package/dist-lib/expo-swift-metadata.mjs +14 -2
  56. package/dist-lib/home-paths.cjs +7 -2
  57. package/dist-lib/host/bridge-host.cjs +8513 -3085
  58. package/dist-lib/host/fetch-proxy-handler.cjs +19 -7
  59. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  60. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  61. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  62. package/dist-lib/host/websocket-proxy.cjs +6 -3
  63. package/dist-lib/index.cjs +175 -80
  64. package/dist-lib/jump-to-source-babel.cjs +1 -1
  65. package/dist-lib/jump-to-source-native.cjs +1 -1
  66. package/dist-lib/kotlin-host.cjs +209 -32
  67. package/dist-lib/menu.cjs +7 -1
  68. package/dist-lib/menu.mjs +7 -1
  69. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  70. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  71. package/dist-lib/metro-production-bundle.cjs +1 -1
  72. package/dist-lib/metro-production-bundle.mjs +1 -1
  73. package/dist-lib/metro.cjs +146 -76
  74. package/dist-lib/native-app-identity-project.cjs +76 -39
  75. package/dist-lib/native-app-identity-project.mjs +76 -39
  76. package/dist-lib/native-app-identity.cjs +10 -3
  77. package/dist-lib/native-app-identity.mjs +10 -3
  78. package/dist-lib/native-firebase-metadata.cjs +1 -1
  79. package/dist-lib/native-firebase-metadata.mjs +1 -1
  80. package/dist-lib/plist.cjs +1 -1
  81. package/dist-lib/plist.mjs +1 -1
  82. package/dist-lib/profiles.cjs +5 -2
  83. package/dist-lib/public-brand.cjs +1 -1
  84. package/dist-lib/public-origins-lib-esm.json +25 -23
  85. package/dist-lib/public-origins-lib.json +138 -80
  86. package/dist-lib/react-native-host-modules.cjs +5 -2
  87. package/dist-lib/react-native-host-modules.mjs +5 -2
  88. package/dist-lib/reap-browser.cjs +1 -1
  89. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  90. package/dist-lib/sdk.cjs +4 -1
  91. package/dist-lib/sdk.mjs +4 -1
  92. package/dist-lib/skills.cjs +41126 -36493
  93. package/dist-lib/swift-compile.cjs +2103 -444
  94. package/dist-lib/swift-compile.mjs +2025 -369
  95. package/dist-lib/swift-package.cjs +1 -1
  96. package/dist-lib/swift-package.mjs +1 -1
  97. package/dist-lib/swift-submit.cjs +2 -2
  98. package/dist-lib/swift-submit.mjs +2 -2
  99. package/dist-lib/swift-toolchain.cjs +84 -24
  100. package/dist-lib/swift.cjs +1 -1
  101. package/dist-lib/vite-swift.cjs +6094 -2687
  102. package/dist-lib/vite.cjs +32 -10
  103. package/dist-lib/worklet-executable.cjs +1 -1
  104. package/dist-lib/worklet-executable.mjs +1 -1
  105. package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +1 -0
  106. package/dist-types/packages/peach-engine/src/cli-companion.d.ts +1 -0
  107. package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +2 -0
  108. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +7 -4
  109. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +1 -3
  110. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +0 -5
  111. package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +8 -0
  112. package/dist-types/packages/peach-engine/src/engine/node.d.ts +10 -1
  113. package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +1 -0
  114. package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +2 -2
  115. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +25 -3
  116. package/dist-types/packages/peach-engine/src/engine/scroll-platform.d.ts +1 -15
  117. package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +1 -3
  118. package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +6 -0
  119. package/dist-types/packages/peach-engine/src/engine/text-paragraph.d.ts +1 -0
  120. package/dist-types/packages/peach-engine/src/engine/types.d.ts +23 -0
  121. package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +6 -0
  122. package/dist-types/packages/peach-engine/src/metro-identity-contract.d.ts +33 -0
  123. package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +2 -0
  124. package/dist-types/packages/peach-engine/src/preview/bundle-layout.d.ts +1 -1
  125. package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +2 -0
  126. package/dist-types/packages/peach-engine/src/render-worker/compositor-gpu.d.ts +1 -1
  127. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +2 -0
  128. package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +28 -0
  129. package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +21 -1
  130. package/dist-types/packages/peach-engine/src/render-worker/prepared-boot-bundle.d.ts +7 -0
  131. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +15 -2
  132. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +1 -0
  133. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +6 -0
  134. package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +3 -3
  135. package/dist-types/packages/peach-engine/src/render-worker/webgpu-frame-transaction.d.ts +1 -0
  136. package/dist-types/packages/peach-engine/src/render-worker/webgpu-readback-scheduler.d.ts +1 -1
  137. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +14 -1
  138. package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +8 -1
  139. package/dist-types/packages/peach-engine/src/rolldown-production-fingerprint.d.ts +1 -4
  140. package/dist-types/packages/peach-engine/src/rolldown-production-module.d.ts +12 -0
  141. package/dist-types/packages/peach-engine/src/rolldown-production-roles.d.ts +6 -0
  142. package/dist-types/packages/peach-engine/src/settings/devices.d.ts +6 -1
  143. package/dist-types/packages/peach-engine/src/settings/duo-fold-bus.d.ts +1 -0
  144. package/dist-types/packages/peach-engine/src/shell-events.d.ts +4 -0
  145. package/dist-types/packages/peach-kit/src/capabilities.d.ts +8 -0
  146. package/kotlin/README.md +3 -0
  147. package/kotlin/sdk.tar.gz +0 -0
  148. package/package.json +2 -1
  149. package/runtime-companion.json +1 -1
  150. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccount.h +55 -0
  151. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +35 -0
  152. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +94 -0
  153. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +53 -0
  154. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACError.h +37 -0
  155. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/Accounts.h +13 -0
  156. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/AccountsDefines.h +13 -0
  157. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Modules/module.modulemap +5 -0
  158. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +1 -0
  159. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkErrors.h +257 -0
  160. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFByteOrder.h +305 -0
  161. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +2 -0
  162. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGAffineTransform.h +204 -0
  163. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h +260 -0
  164. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColor.h +164 -0
  165. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorConversionInfo.h +101 -0
  166. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorSpace.h +510 -0
  167. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h +1132 -0
  168. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGConvertColorDataWithFormat.h +34 -0
  169. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDataConsumer.h +83 -0
  170. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDataProvider.h +197 -0
  171. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGEXRToneMappingGamma.h +36 -0
  172. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGError.h +38 -0
  173. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFont.h +312 -0
  174. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFunction.h +106 -0
  175. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGradient.h +123 -0
  176. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGITUToneMapping.h +31 -0
  177. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGImage.h +409 -0
  178. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGLayer.h +78 -0
  179. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h +120 -0
  180. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContentStream.h +55 -0
  181. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContext.h +535 -0
  182. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h +133 -0
  183. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h +252 -0
  184. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFMarkedContentItem.h +37 -0
  185. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFObject.h +67 -0
  186. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFOperatorTable.h +51 -0
  187. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h +101 -0
  188. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFScanner.h +123 -0
  189. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFStream.h +44 -0
  190. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFString.h +52 -0
  191. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFStructureElement.h +87 -0
  192. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h +441 -0
  193. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPattern.h +89 -0
  194. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGRenderingBufferProvider.h +49 -0
  195. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGShading.h +124 -0
  196. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGToneMapping.h +85 -0
  197. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +44 -252
  198. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Modules/module.modulemap +1 -0
  199. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/CFNetworkErrors.h +257 -0
  200. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +58 -9
  201. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +992 -98
  202. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/NSURLSession+Network.h +32 -0
  203. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/Network.h +51 -0
  204. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/advertise_descriptor.h +193 -0
  205. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browse_descriptor.h +163 -0
  206. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browse_result.h +207 -0
  207. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browser.h +285 -0
  208. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection.h +714 -0
  209. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection_group.h +629 -0
  210. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection_report.h +932 -0
  211. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/content_context.h +229 -0
  212. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/endpoint.h +390 -0
  213. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/error.h +135 -0
  214. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ethernet_channel.h +349 -0
  215. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/framer_options.h +1187 -0
  216. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/group_descriptor.h +184 -0
  217. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/interface.h +150 -0
  218. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ip_options.h +351 -0
  219. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/listener.h +438 -0
  220. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/nw_object.h +200 -0
  221. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/parameters.h +1205 -0
  222. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/path.h +392 -0
  223. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/path_monitor.h +216 -0
  224. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/privacy_context.h +188 -0
  225. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/protocol_options.h +126 -0
  226. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/proxy_config.h +357 -0
  227. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/quic_options.h +889 -0
  228. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/resolver_config.h +94 -0
  229. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/tcp_options.h +459 -0
  230. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/tls_options.h +115 -0
  231. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/txt_record.h +432 -0
  232. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/udp_options.h +112 -0
  233. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ws_options.h +743 -0
  234. package/sdk/ios/System/Library/Frameworks/Network.framework/Modules/module.modulemap +9 -0
  235. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAAnimation.h +395 -0
  236. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h +132 -0
  237. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CADisplayLink.h +107 -0
  238. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterCell.h +153 -0
  239. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterLayer.h +151 -0
  240. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAFrameRateRange.h +40 -0
  241. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAGradientLayer.h +78 -0
  242. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h +1078 -0
  243. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h +97 -0
  244. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTimingFunction.h +67 -0
  245. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAReplicatorLayer.h +65 -0
  246. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAScrollLayer.h +64 -0
  247. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAShapeLayer.h +135 -0
  248. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATextLayer.h +99 -0
  249. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATiledLayer.h +67 -0
  250. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransaction.h +124 -0
  251. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransform3D.h +138 -0
  252. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransformLayer.h +40 -0
  253. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAValueFunction.h +78 -0
  254. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +19 -38
  255. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecureTransport.h +1757 -0
  256. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSAttributedString.h +19 -0
  257. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSParagraphStyle.h +28 -0
  258. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityConstants.h +114 -0
  259. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +16 -0
  260. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBarAppearance.h +47 -0
  261. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDataDetectors.h +20 -0
  262. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDatePicker.h +13 -0
  263. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h +16 -0
  264. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h +84 -0
  265. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizer.h +119 -0
  266. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizerSubclass.h +66 -0
  267. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIHoverGestureRecognizer.h +45 -0
  268. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +161 -37
  269. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h +76 -0
  270. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBar.h +8 -0
  271. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBarAppearance.h +78 -0
  272. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITextInputTraits.h +29 -0
  273. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITouch.h +104 -0
  274. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITraitCollection.h +19 -0
  275. package/sdk/ios/usr/include/dns_sd.h +3616 -0
  276. package/sdk/ios/usr/include/dnssd.modulemap +4 -0
  277. package/sdk/ios/usr/include/module.modulemap +1 -0
  278. package/sdk/ios/usr/include/os/signpost.h +414 -0
  279. package/sdk/ios/usr/include/os.modulemap +5 -0
  280. package/sdk/ios/usr/include/sys/socketvar.h +191 -0
  281. package/sdk/ios/usr/include/sys/vsock.h +84 -0
  282. package/sdk/ios/wasm/include/errno.h +4 -20
  283. package/sdk/ios/wasm/include/pthread.h +3 -0
  284. package/sdk/ios/wasm/include/setjmp.h +57 -0
  285. package/sdk/ios/wasm/include/sys/resource.h +2 -2
  286. package/sdk/native-hashes.json +3 -3
  287. package/skills/contrast/SKILL.md +6 -5
  288. package/skills/peach-debug/SKILL.md +68 -265
  289. package/skills/peach-debug/references/accessibility.md +37 -73
  290. package/skills/peach-debug/references/commands.md +2 -2
  291. package/skills/peach-debug/references/events.md +74 -0
  292. package/skills/peach-perf/SKILL.md +64 -402
  293. package/skills/peach-perf/references/presentation.md +46 -0
  294. package/skills/peach-perf/references/profiling.md +93 -0
  295. package/skills/peach-perf/references/render-counters.md +57 -0
  296. package/skills/peach-setup/SKILL.md +66 -217
  297. package/skills/peach-setup/references/native-config.md +35 -0
  298. package/skills/peach-setup/references/reporting.md +28 -0
  299. package/skills/peach-test/SKILL.md +68 -285
  300. package/skills/peach-test/references/detox.md +69 -0
  301. package/skills/peach-test/references/maestro.md +95 -0
  302. package/skills/peach-visual/SKILL.md +53 -106
  303. package/src/android-autolinking.ts +1 -0
  304. package/src/android-bridge-packages.ts +279 -0
  305. package/src/appPackageContract.ts +14 -1
  306. package/src/assetCatalogContract.ts +8 -1
  307. package/src/bridge-contract.ts +6 -0
  308. package/src/bundle-channel.mjs +152 -60
  309. package/src/cli-runtime.ts +3 -0
  310. package/src/configured-bundle-producer.ts +10 -0
  311. package/src/device-catalog.ts +68 -4
  312. package/src/expo-discovery-cache.ts +10 -3
  313. package/src/expo-kotlin-host.ts +97 -26
  314. package/src/expo-native-workspace.ts +211 -52
  315. package/src/expo-swift-host.ts +149 -123
  316. package/src/expo-swift-ready.ts +5 -1
  317. package/src/expo-widget-assets.ts +76 -0
  318. package/src/expoKotlinContract.ts +12 -2
  319. package/src/expoSwiftContract.ts +21 -2
  320. package/src/generated/swift-c-predefines.json +1 -1
  321. package/src/home-paths.ts +6 -1
  322. package/src/host/bridge-host.ts +5 -0
  323. package/src/host/fetch-proxy-handler.ts +10 -0
  324. package/src/host/websocket-proxy.ts +7 -2
  325. package/src/kotlin-host.ts +204 -30
  326. package/src/kotlinSdkContract.ts +2 -1
  327. package/src/menu.ts +7 -0
  328. package/src/native-prebuilt.ts +154 -0
  329. package/src/nitro-adapter.lock.json +261 -261
  330. package/src/nitro-adapter.ts +118 -50
  331. package/src/nitro-bundle.ts +134 -96
  332. package/src/nitro-compile.ts +16 -6
  333. package/src/nitro-dependencies.ts +43 -28
  334. package/src/nitro-source.ts +142 -30
  335. package/src/nitro-superset.lock.json +103 -0
  336. package/src/nitro-superset.ts +137 -0
  337. package/src/nitroAdapterContract.ts +146 -98
  338. package/src/nitroContract.ts +68 -21
  339. package/src/react-bridge-importers.ts +1 -0
  340. package/src/react-native-bridge-modules.ts +2 -0
  341. package/src/react-native-host-modules.ts +4 -1
  342. package/src/settingsContract.ts +37 -1
  343. package/src/storageSnapshotContract.ts +29 -81
  344. package/src/swift-compile.ts +315 -117
  345. package/src/swift-compiler-digest.ts +2 -0
  346. package/src/swift-coverage/indexdump.ts +22 -6
  347. package/src/swift-coverage/indexing.ts +4 -4
  348. package/src/swift-coverage/sdk.ts +104 -20
  349. package/src/swift-coverage/types.ts +34 -0
  350. package/src/swift-coverage/xcode-packages.ts +61 -1
  351. package/src/swift-coverage/xcode.ts +19 -13
  352. package/src/swift-cxx-reachable.ts +1 -1
  353. package/src/swift-distribution.lock.json +18 -13
  354. package/src/swift-distribution.ts +57 -26
  355. package/src/swift-host.ts +51 -35
  356. package/src/swift-link-roots.ts +45 -18
  357. package/src/swift-objc-compile.ts +78 -2
  358. package/src/swift-objc-standin.ts +3 -0
  359. package/src/swift-shared-sdk.ts +85 -1
  360. package/src/swift-standin-emit.ts +6 -1
  361. package/src/swift-standins.ts +403 -19
  362. package/src/swift-submit.ts +17 -1
  363. package/src/swift-toolchain.ts +98 -23
  364. package/src/swift-wasm-prune.ts +1629 -0
  365. package/src/turbo-bundle.ts +82 -0
  366. package/src/turbo-compile.ts +120 -0
  367. package/src/turbo-runtime.lock.json +69 -0
  368. package/src/turbo-source.ts +754 -0
  369. package/src/vite-plugin-one.ts +15 -3
  370. package/src/vite-plugin.ts +82 -23
  371. package/src/wasm-optimize.ts +34 -0
  372. package/src/worker-system-chunks.ts +3 -3
  373. package/src/xcode-project.ts +52 -0
  374. package/src/xcode-target-members.ts +12 -1
@@ -2,8 +2,23 @@ import { insertBundleGlobalFooter, readBundleGlobalFooter } from './bundleGlobal
2
2
  import { isRecord } from './is-record'
3
3
  import type { SwiftNativeTarget } from './swiftContract'
4
4
 
5
- // installed Expo modules whose native implementation is compiled by the shared host.
6
- export const COMPILED_EXPO_NATIVE_PACKAGES: readonly string[] = ['expo-app-intents']
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
+ > = {
10
+ ios: [
11
+ '@rnw-community/react-native-screen-chrome',
12
+ 'expo-app-intents',
13
+ 'expo-battery',
14
+ 'expo-device',
15
+ 'expo-hinge',
16
+ 'expo-location',
17
+ 'expo-store-review',
18
+ 'expo-web-browser',
19
+ ],
20
+ android: [],
21
+ }
7
22
 
8
23
  export interface ExpoSwiftPreparationOptions {
9
24
  signal?: AbortSignal
@@ -16,6 +31,10 @@ export interface ExpoSwiftSourceUnit {
16
31
  classes: string[]
17
32
  // legacy bridge module registrations (react-native-bridge-modules.ts)
18
33
  bridgeModules: string[]
34
+ // expressions for the Expo app delegate subscribers and react delegate
35
+ // handlers the unit registers, as the autolinked Apple provider lists them
36
+ appDelegateSubscribers: string[]
37
+ reactDelegateHandlers: string[]
19
38
  files: Record<string, string>
20
39
  frameworks: string[]
21
40
  nativeTargets?: SwiftNativeTarget[]
@@ -1,5 +1,5 @@
1
1
  {
2
- "release": "swift-6.4.0-RELEASE-custom-0b2d0a9011c88e66",
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)
@@ -53,6 +53,7 @@ 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'
57
58
  import { serveAppPackageResource } from './app-package-handler'
58
59
  import {
@@ -1554,6 +1555,10 @@ export class SootSimBridgeHost {
1554
1555
  void handleNitroRequest(req, res)
1555
1556
  return
1556
1557
  }
1558
+ if (req.url?.split('?')[0] === TURBO_ROUTE) {
1559
+ void handleTurboRequest(req, res)
1560
+ return
1561
+ }
1557
1562
  if (
1558
1563
  req.url?.startsWith('/__peach/expo-swift') ||
1559
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
@@ -387,6 +387,9 @@ function handleTcpRelay(ws: WebSocket) {
387
387
  localPort: call.localPort,
388
388
  })
389
389
  relay(plain)
390
+ // relay() drops its listener when tls takes over, and a reset on the
391
+ // wrapped socket then has none
392
+ plain.on('error', () => {})
390
393
  // GCDAsyncSocket takes whole seconds
391
394
  const timeout =
392
395
  call.connectTimeout === undefined
@@ -456,6 +459,8 @@ export function handleWebSocketProxyUpgrade(
456
459
  tcpRelayServer.handleUpgrade(req, socket, head, handleTcpRelay)
457
460
  return true
458
461
  }
462
+ // a browser reset during the handshake or after it must not reach the process
463
+ socket.on('error', () => socket.destroy())
459
464
  const upgradeRejection = validateUpgradeRequest(req)
460
465
  if (upgradeRejection) {
461
466
  rejectUpgrade(
@@ -620,8 +625,8 @@ function relayWebSocketUpgrade(
620
625
  socket.write(`${responseHeaders.join('\r\n')}\r\n\r\n`)
621
626
  if (upstreamHead.length > 0) socket.write(upstreamHead)
622
627
  socket.once('close', () => upstreamSocket.destroy())
623
- socket.once('error', () => upstreamSocket.destroy())
624
- upstreamSocket.once('error', () => socket.destroy())
628
+ socket.on('error', () => upstreamSocket.destroy())
629
+ upstreamSocket.on('error', () => socket.destroy())
625
630
  upstreamSocket.pipe(socket)
626
631
  if (networkPolicyActive) {
627
632
  // frames are judged one message at a time before they are sent
@@ -11,6 +11,13 @@ import { createRequire } from 'node:module'
11
11
  import path from 'node:path'
12
12
  import { promisify } from 'node:util'
13
13
  import { parse } from 'acorn'
14
+ import {
15
+ readBridgeFiles,
16
+ type BridgeFile,
17
+ type BridgeMethod,
18
+ type BridgeModule,
19
+ type BridgeSelection,
20
+ } from './android-bridge-packages'
14
21
  import { rnxHomeDir } from './home-paths'
15
22
  import { isRecord } from './is-record'
16
23
  import { kotlinInstanceSource } from './kotlin-instance-source'
@@ -222,6 +229,8 @@ interface ExpoField {
222
229
  required: boolean
223
230
  mutable: boolean
224
231
  hidden: boolean
232
+ // a primary constructor parameter rather than a body property
233
+ parameter: boolean
225
234
  initializer: [number, number] | null
226
235
  }
227
236
 
@@ -249,7 +258,8 @@ function readExpoField(value: unknown): ExpoField {
249
258
  typeof value.key !== 'string' ||
250
259
  typeof value.required !== 'boolean' ||
251
260
  typeof value.mutable !== 'boolean' ||
252
- typeof value.hidden !== 'boolean'
261
+ typeof value.hidden !== 'boolean' ||
262
+ typeof value.parameter !== 'boolean'
253
263
  )
254
264
  throw new Error('expo-types printed an invalid field')
255
265
  const range = value.initializer
@@ -267,6 +277,7 @@ function readExpoField(value: unknown): ExpoField {
267
277
  required: value.required,
268
278
  mutable: value.mutable,
269
279
  hidden: value.hidden,
280
+ parameter: value.parameter,
270
281
  initializer: range === null ? null : [range[0], range[1]],
271
282
  }
272
283
  }
@@ -353,56 +364,208 @@ function readExpoTypes(output: string): ExpoTypesFile[] {
353
364
  })
354
365
  }
355
366
 
356
- const expoTypeScans = new Map<string, Promise<ExpoTypesFile[]>>()
367
+ const toolScans = new Map<string, Promise<string>>()
357
368
 
358
- // the records, enums, compose views and compose props the module sources
359
- // declare, read by Kotlin's own parser; sources that name none skip the JVM start
360
- async function scanExpoTypes(
369
+ // runs one of the SDK's parser tools over source files and parses its output;
370
+ // the same files under the same SDK answer from the first scan
371
+ async function scanSources<T>(
372
+ tool: string,
373
+ parse: (output: string) => T,
361
374
  toolchain: KotlinToolchain,
362
375
  moduleRoot: string,
363
- sources: string[],
364
- ): Promise<ExpoTypesFile[]> {
365
- const candidates = sources.filter((file) =>
366
- /\bRecord\b|\benum\s+class\b|\bExpoComposeView\b|\bExpoView\b|\bComposeProps\b|:\s*(?:[A-Za-z0-9_.]+\.)?(?:View|FrameLayout|LinearLayout|ViewGroup)\b/.test(
367
- fs.readFileSync(file, 'utf8'),
368
- ),
369
- )
370
- if (candidates.length === 0) return Promise.resolve([])
376
+ files: string[],
377
+ ): Promise<T> {
371
378
  const digest = createHash('sha256').update(JSON.stringify(toolchain.compiler))
372
379
  const sdk = await loadKotlinSdk(moduleRoot, toolchain)
373
- const packedSdk = fs.readFileSync(path.join(moduleRoot, 'sdk.tar.gz'))
374
- digest.update(packedSdk)
375
- for (const file of candidates)
376
- digest.update(`${file}\0${fs.readFileSync(file, 'utf8')}\0`)
380
+ digest.update(fs.readFileSync(path.join(moduleRoot, 'sdk.tar.gz')))
381
+ digest.update(tool)
382
+ for (const file of files) digest.update(`${file}\0${fs.readFileSync(file, 'utf8')}\0`)
377
383
  const key = digest.digest('hex')
378
- let scan = expoTypeScans.get(key)
384
+ let scan = toolScans.get(key)
379
385
  if (!scan) {
380
386
  scan = (async () => {
381
- const [{ kotlinc }, installed] = await Promise.all([
382
- ensureToolchain(toolchain),
383
- Promise.resolve(sdk),
384
- ])
387
+ const { kotlinc } = await ensureToolchain(toolchain)
385
388
  const { stdout } = await run(
386
389
  path.join(path.dirname(kotlinc), 'kotlin'),
387
390
  [
388
391
  '-cp',
389
392
  [
390
393
  path.resolve(path.dirname(kotlinc), '../lib/kotlin-compiler.jar'),
391
- path.join(installed.root, 'tools.jar'),
394
+ path.join(sdk.root, 'tools.jar'),
392
395
  ].join(path.delimiter),
393
- 'dev.peach.tools.expo.ExpoTypesKt',
394
- ...candidates,
396
+ tool,
397
+ ...files,
395
398
  ],
396
399
  { maxBuffer: 16 * 1024 * 1024 },
397
400
  )
398
- return readExpoTypes(stdout)
401
+ return stdout
399
402
  })().catch((error: unknown) => {
400
- expoTypeScans.delete(key)
403
+ toolScans.delete(key)
401
404
  throw error
402
405
  })
403
- expoTypeScans.set(key, scan)
406
+ toolScans.set(key, scan)
404
407
  }
405
- return scan
408
+ return parse(await scan)
409
+ }
410
+
411
+ // the records, enums, compose views and compose props the module sources
412
+ // declare, read by Kotlin's own parser; sources that name none skip the JVM start
413
+ async function scanExpoTypes(
414
+ toolchain: KotlinToolchain,
415
+ moduleRoot: string,
416
+ sources: string[],
417
+ ): Promise<ExpoTypesFile[]> {
418
+ const candidates = sources.filter((file) =>
419
+ /\bRecord\b|\benum\s+class\b|\bExpoComposeView\b|\bExpoView\b|\bComposeProps\b|:\s*(?:[A-Za-z0-9_.]+\.)?(?:View|FrameLayout|LinearLayout|ViewGroup)\b/.test(
420
+ fs.readFileSync(file, 'utf8'),
421
+ ),
422
+ )
423
+ if (candidates.length === 0) return []
424
+ return scanSources(
425
+ 'dev.peach.tools.expo.ExpoTypesKt',
426
+ readExpoTypes,
427
+ toolchain,
428
+ moduleRoot,
429
+ candidates,
430
+ )
431
+ }
432
+
433
+ // every app source's declared and used names, ReactPackage classes and
434
+ // @ReactMethod signatures, read by Kotlin's own parser
435
+ export async function scanBridgeFiles(
436
+ moduleRoot: string,
437
+ sources: string[],
438
+ ): Promise<BridgeFile[]> {
439
+ if (sources.length === 0) return []
440
+ return scanSources(
441
+ 'dev.peach.tools.bridge.BridgeModulesKt',
442
+ readBridgeFiles,
443
+ readToolchain(moduleRoot),
444
+ moduleRoot,
445
+ sources,
446
+ )
447
+ }
448
+
449
+ // the parameter kinds PeachBridgeParam names, by the class JavaTurboModule
450
+ // converts them to
451
+ const BRIDGE_PARAMETERS: Record<string, string> = {
452
+ Boolean: 'boolean',
453
+ Int: 'int',
454
+ Double: 'double',
455
+ Float: 'float',
456
+ String: 'string',
457
+ Callback: 'callback',
458
+ Promise: 'promise',
459
+ ReadableMap: 'map',
460
+ ReadableArray: 'array',
461
+ Dynamic: 'dynamic',
462
+ }
463
+
464
+ const BRIDGE_CASTS: Record<string, string> = {
465
+ boolean: 'Boolean',
466
+ int: 'Int',
467
+ double: 'Double',
468
+ float: 'Float',
469
+ string: 'String',
470
+ callback: 'com.facebook.react.bridge.Callback',
471
+ promise: 'com.facebook.react.bridge.Promise',
472
+ map: 'com.facebook.react.bridge.ReadableNativeMap',
473
+ array: 'com.facebook.react.bridge.ReadableNativeArray',
474
+ dynamic: 'com.facebook.react.bridge.Dynamic',
475
+ }
476
+
477
+ const BRIDGE_RETURNS = new Set([
478
+ 'Boolean',
479
+ 'Int',
480
+ 'Double',
481
+ 'Float',
482
+ 'String',
483
+ 'WritableMap',
484
+ 'WritableArray',
485
+ 'Map',
486
+ 'MutableMap',
487
+ ])
488
+
489
+ const bridgeType = (text: string) => ({
490
+ nullable: text.trim().endsWith('?'),
491
+ base: text.replace(/\?$/, '').trim().split('<')[0].split('.').pop()!,
492
+ })
493
+
494
+ // the Java classes of Kotlin types the JNI signature parser names
495
+ const JAVA_CLASSES: Record<string, string> = {
496
+ Long: 'long',
497
+ Short: 'short',
498
+ Byte: 'byte',
499
+ Char: 'char',
500
+ }
501
+
502
+ // TurboModuleInteropUtils's reading of one @ReactMethod
503
+ function bridgeUnsupported(method: BridgeMethod): string | null {
504
+ const promise = method.params.findIndex(
505
+ (param) => bridgeType(param.type).base === 'Promise',
506
+ )
507
+ if (promise !== -1 && promise !== method.params.length - 1)
508
+ return 'Unable to parse JavaScript arg count. Promises must be used as last parameter only.'
509
+ for (const param of method.params) {
510
+ const { base } = bridgeType(param.type)
511
+ if (!BRIDGE_PARAMETERS[base])
512
+ return `Unable to parse JNI signature. Detected unsupported parameter class: ${JAVA_CLASSES[base] ?? base}`
513
+ }
514
+ const returns = method.returns === null ? 'Unit' : bridgeType(method.returns).base
515
+ if (method.blocking === (returns === 'Unit'))
516
+ return 'TurboModule system assumes returnType == void iff the method is synchronous.'
517
+ if (returns !== 'Unit' && !BRIDGE_RETURNS.has(returns))
518
+ return `Unable to parse JNI signature. Detected unsupported return class: ${JAVA_CLASSES[returns] ?? returns}`
519
+ return null
520
+ }
521
+
522
+ function bridgeMethodSource(module: BridgeModule, method: BridgeMethod): string {
523
+ const unsupported = bridgeUnsupported(method)
524
+ const kinds = method.params.map((param) => {
525
+ const { base, nullable } = bridgeType(param.type)
526
+ return `dev.peach.expo.PeachBridgeParam(${JSON.stringify(BRIDGE_PARAMETERS[base] ?? 'unsupported')}, ${nullable})`
527
+ })
528
+ const returnsValue = method.blocking
529
+ const head = `dev.peach.expo.PeachBridgeMethod(${JSON.stringify(method.name)}, ${method.blocking}, ${returnsValue}, listOf(${kinds.join(', ')}), ${unsupported === null ? 'null' : JSON.stringify(unsupported)})`
530
+ if (unsupported !== null)
531
+ return `${head} { throw UnsupportedOperationException(${JSON.stringify(unsupported)}) }`
532
+ const args = method.params.map((param, index) => {
533
+ const { base, nullable } = bridgeType(param.type)
534
+ const kind = BRIDGE_PARAMETERS[base]
535
+ const cast = BRIDGE_CASTS[kind]
536
+ const read = `a[${index}] as ${cast}`
537
+ // Kotlin's null check on a non-null reference parameter
538
+ return nullable || !['string', 'map', 'array'].includes(kind)
539
+ ? `${read}${nullable ? '?' : ''}`
540
+ : `(${read}?) ?: throw NullPointerException(${JSON.stringify(`Parameter specified as non-null is null: method ${module.className}.${method.name}, parameter ${param.name}`)})`
541
+ })
542
+ const call = `m.${method.name}(${args.join(', ')})`
543
+ return `${head} { a -> ${returnsValue ? call : `${call}; null`} }`
544
+ }
545
+
546
+ // react native finds a module's @ReactMethod functions by reflection;
547
+ // Kotlin/Wasm has none, so each module class gets its table here
548
+ function bridgeSource(bridge: BridgeSelection): string[] {
549
+ const modules = bridge.packages.flatMap((hosted) => hosted.modules)
550
+ return [
551
+ ' dev.peach.expo.PeachBridgeRuntime.register(',
552
+ ` ${JSON.stringify(bridge.applicationId)},`,
553
+ ' listOf<() -> com.facebook.react.ReactPackage>(',
554
+ ...bridge.packages.map((hosted) => ` { ${hosted.className}() },`),
555
+ ' ),',
556
+ ' listOf<(com.facebook.react.bridge.NativeModule) -> Map<String, dev.peach.expo.PeachBridgeMethod>?>(',
557
+ ...modules.map(
558
+ (module) =>
559
+ ` { m -> if (m is ${module.className}) mapOf(${module.methods
560
+ .map(
561
+ (method) =>
562
+ `${JSON.stringify(method.name)} to ${bridgeMethodSource(module, method)}`,
563
+ )
564
+ .join(', ')}) else null },`,
565
+ ),
566
+ ' ),',
567
+ ' )',
568
+ ]
406
569
  }
407
570
 
408
571
  // upstream converts records and enums by reflection; Kotlin/Wasm has none, so
@@ -421,9 +584,16 @@ function expoTypeSources(files: ExpoTypesFile[]): {
421
584
  const calls: string[] = []
422
585
  for (const record of file.records) {
423
586
  const fields: string[] = []
587
+ // upstream allocates a record without a no-argument constructor without
588
+ // calling one; its undefaulted fields take the incoming values by name
589
+ const parameters: string[] = []
424
590
  for (const field of record.fields) {
425
591
  if (field.initializer)
426
592
  edits.push({ range: field.initializer, owner: record.name, field })
593
+ else if (field.parameter)
594
+ parameters.push(
595
+ `${field.name} = dev.peach.expo.PeachExpoTypes.initial(${record.name}::class, ${literal(field.key)}, ${field.required}) { dev.peach.expo.PeachExpoTypes.unset() }`,
596
+ )
427
597
  if (field.hidden) {
428
598
  if (!field.initializer)
429
599
  throw new Error(
@@ -444,7 +614,7 @@ function expoTypeSources(files: ExpoTypesFile[]): {
444
614
  if (record.hidden) continue
445
615
  calls.push(
446
616
  [
447
- ` dev.peach.expo.PeachExpoTypes.record(${record.name}::class, ${literal(file.package ? `${file.package}.${record.name}` : record.name)}, { ${record.name}() }, listOf(`,
617
+ ` dev.peach.expo.PeachExpoTypes.record(${record.name}::class, ${literal(file.package ? `${file.package}.${record.name}` : record.name)}, { ${record.name}(${parameters.join(', ')}) }, listOf(`,
448
618
  ...fields,
449
619
  ' ))',
450
620
  ].join('\n'),
@@ -547,6 +717,7 @@ export async function expoKotlinArtifact(
547
717
  '',
548
718
  'private val registered by lazy {',
549
719
  ...types.registrations.map((call) => ` ${call}`),
720
+ ...(modules.bridge ? bridgeSource(modules.bridge) : []),
550
721
  ' PeachExpoRuntime.register(listOf(',
551
722
  ...modules.modules.map(
552
723
  ({ classifier, name }) =>
@@ -555,6 +726,9 @@ export async function expoKotlinArtifact(
555
726
  ' ))',
556
727
  '}',
557
728
  '',
729
+ '@JsExport fun peachSetAndroidBuildInfo(model: String, release: String) =',
730
+ ' android.os.Build.setDevice(model, release)',
731
+ '',
558
732
  '@JsExport fun peachExpoListen(notify: () -> Unit) {',
559
733
  ' registered',
560
734
  ' PeachExpoRuntime.listen(notify)',
@@ -27,13 +27,14 @@ export const KOTLIN_SDK_PROFILES = {
27
27
  },
28
28
  expo: {
29
29
  compose: false,
30
- directories: [...platform, 'ExpoSources', 'AndroidViewSources'],
30
+ directories: [...platform, 'ExpoSources', 'BridgeSources', 'AndroidViewSources'],
31
31
  },
32
32
  expoCompose: {
33
33
  compose: true,
34
34
  directories: [
35
35
  ...platform,
36
36
  'ExpoSources',
37
+ 'BridgeSources',
37
38
  'AndroidViewSources',
38
39
  'ComposeSources',
39
40
  'ExpoComposeSources',
package/src/menu.ts CHANGED
@@ -137,6 +137,7 @@ export interface SootSimMenuState {
137
137
  showBezels: boolean
138
138
  showTouches: boolean
139
139
  systemCursor: boolean
140
+ hardwareKeyboard: boolean
140
141
  slowAnimations: boolean
141
142
  showMenuBar: boolean
142
143
  showRail: boolean
@@ -386,6 +387,12 @@ function deviceMenu(
386
387
  },
387
388
  { type: 'separator' },
388
389
  { label: 'Trigger Screenshot', action: 'screenshot' },
390
+ {
391
+ label: 'Connect Hardware Keyboard',
392
+ type: 'checkbox',
393
+ checked: state.hardwareKeyboard,
394
+ action: 'toggle-hardware-keyboard',
395
+ },
389
396
  // pose controls for the current device: open/close, book and laptop on
390
397
  // foldables, rotate left/right wherever a turn changes geometry, the way
391
398
  // ios simulator holds them (rotate left is cmd+left, rotate right
@@ -0,0 +1,154 @@
1
+ // the prebuilt native library registry's read side (plans/peach/native-prebuild-registry.md):
2
+ // immutable entries under `native/` in the compile CDN's public bucket, one per
3
+ // key. an entry is a descriptor plus the files it lists, all beside each other:
4
+ //
5
+ // native/<kind>/<name>/<key>/descriptor.json
6
+ // native/<kind>/<name>/<key>/<file>
7
+ //
8
+ // <kind> is `rust` for the build cache, `slice` for a hand-ported library's
9
+ // wasm slice and `turbo` for an app's compiled C++ TurboModule executable; <key> is a digest of everything the bytes depend on, so an entry
10
+ // can never serve different inputs. publishers hold the bucket credentials
11
+ // (scripts/ops/native-prebuilt-publish.ts); a host only reads.
12
+ import { execFileSync } from 'node:child_process'
13
+ import { createHash } from 'node:crypto'
14
+ import fs from 'node:fs'
15
+ import path from 'node:path'
16
+ import { cacheDir as peachCacheDir } from './home-paths'
17
+ import { isRecord } from './is-record'
18
+
19
+ export const NATIVE_PREBUILT_ORIGIN = 'https://r2.rnxsim.com'
20
+
21
+ export type NativeEntryKind = 'nitro' | 'rust' | 'slice' | 'turbo'
22
+
23
+ export interface NativeEntryFile {
24
+ path: string
25
+ sha256: string
26
+ size: number
27
+ }
28
+
29
+ export interface NativeEntryDescriptor {
30
+ kind: NativeEntryKind
31
+ name: string
32
+ key: string
33
+ /** the inputs the key digests, kept so an entry says what it was built from. */
34
+ inputs: Record<string, string>
35
+ files: NativeEntryFile[]
36
+ }
37
+
38
+ /** the key of an entry: a digest of its inputs, in a fixed order. */
39
+ export function nativeEntryKey(inputs: Record<string, string>): string {
40
+ const lines = Object.keys(inputs)
41
+ .sort()
42
+ .map((name) => `${name}\0${inputs[name]}`)
43
+ return createHash('sha256').update(lines.join('\n')).digest('hex').slice(0, 32)
44
+ }
45
+
46
+ export const nativeEntryPrefix = (kind: NativeEntryKind, name: string, key: string) =>
47
+ `native/${kind}/${name}/${key}`
48
+
49
+ const entryCache = (kind: NativeEntryKind, name: string, key: string) =>
50
+ path.join(peachCacheDir(), 'native-prebuilt', kind, name, key)
51
+
52
+ // one GET; a missing object is null. a network failure is a miss too, since a
53
+ // lookup only saves a build and the build that follows reports its own failures.
54
+ function download(url: string, to: string): boolean {
55
+ try {
56
+ execFileSync('curl', ['-fsS', '--max-time', '120', url, '-o', to], {
57
+ stdio: ['ignore', 'ignore', 'pipe'],
58
+ })
59
+ return true
60
+ } catch {
61
+ fs.rmSync(to, { force: true })
62
+ return false
63
+ }
64
+ }
65
+
66
+ const sha256 = (file: string) =>
67
+ createHash('sha256').update(fs.readFileSync(file)).digest('hex')
68
+
69
+ function isEntryFile(file: unknown): file is NativeEntryFile {
70
+ return (
71
+ isRecord(file) &&
72
+ typeof file.path === 'string' &&
73
+ !file.path.includes('/') &&
74
+ typeof file.sha256 === 'string' &&
75
+ typeof file.size === 'number'
76
+ )
77
+ }
78
+
79
+ function parseFiles(text: string, kind: string, name: string, key: string) {
80
+ const parsed: unknown = JSON.parse(text)
81
+ if (
82
+ !isRecord(parsed) ||
83
+ parsed.kind !== kind ||
84
+ parsed.name !== name ||
85
+ parsed.key !== key ||
86
+ !Array.isArray(parsed.files) ||
87
+ !parsed.files.every(isEntryFile)
88
+ )
89
+ throw new Error(`native prebuilt ${kind}/${name}/${key}: malformed descriptor`)
90
+ return parsed.files
91
+ }
92
+
93
+ /**
94
+ * the directory holding an entry's verified files, downloaded once into the
95
+ * peach cache, or null when the registry has no entry for the key.
96
+ */
97
+ export function fetchNativeEntry(
98
+ kind: NativeEntryKind,
99
+ name: string,
100
+ key: string,
101
+ ): string | null {
102
+ const dir = entryCache(kind, name, key)
103
+ const descriptorFile = path.join(dir, 'descriptor.json')
104
+ if (fs.existsSync(descriptorFile)) return dir
105
+ const base = `${NATIVE_PREBUILT_ORIGIN}/${nativeEntryPrefix(kind, name, key)}`
106
+ const staging = `${dir}.${process.pid}.partial`
107
+ fs.rmSync(staging, { recursive: true, force: true })
108
+ fs.mkdirSync(staging, { recursive: true })
109
+ try {
110
+ if (!download(`${base}/descriptor.json`, path.join(staging, 'descriptor.json')))
111
+ return null
112
+ const files = parseFiles(
113
+ fs.readFileSync(path.join(staging, 'descriptor.json'), 'utf8'),
114
+ kind,
115
+ name,
116
+ key,
117
+ )
118
+ for (const file of files) {
119
+ const target = path.join(staging, file.path)
120
+ if (!download(`${base}/${file.path}`, target))
121
+ throw new Error(`native prebuilt ${kind}/${name}/${key}: ${file.path} is missing`)
122
+ if (fs.statSync(target).size !== file.size || sha256(target) !== file.sha256)
123
+ throw new Error(
124
+ `native prebuilt ${kind}/${name}/${key}: ${file.path} does not match its descriptor`,
125
+ )
126
+ }
127
+ fs.mkdirSync(path.dirname(dir), { recursive: true })
128
+ fs.rmSync(dir, { recursive: true, force: true })
129
+ fs.renameSync(staging, dir)
130
+ return dir
131
+ } finally {
132
+ fs.rmSync(staging, { recursive: true, force: true })
133
+ }
134
+ }
135
+
136
+ /** the descriptor for files a publisher is about to upload. */
137
+ export function describeNativeEntry(
138
+ kind: NativeEntryKind,
139
+ name: string,
140
+ inputs: Record<string, string>,
141
+ files: readonly string[],
142
+ ): NativeEntryDescriptor {
143
+ return {
144
+ kind,
145
+ name,
146
+ key: nativeEntryKey(inputs),
147
+ inputs,
148
+ files: files.map((file) => ({
149
+ path: path.basename(file),
150
+ sha256: sha256(file),
151
+ size: fs.statSync(file).size,
152
+ })),
153
+ }
154
+ }