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
@@ -42,9 +42,9 @@ import {
42
42
  import { resolveSwiftModule } from './swift-distribution'
43
43
  import {
44
44
  artifactFor,
45
- compileInput,
46
45
  disposeSwiftProject,
47
46
  icuUrl,
47
+ installedWorkspaceInput,
48
48
  openXcodeProject,
49
49
  projectFor,
50
50
  serveSwiftPackageAsset,
@@ -78,9 +78,6 @@ const run = promisify(execFile)
78
78
  const scriptEnv = { ...process.env, [RNX_FORKED_SCRIPT_ENV]: '1' }
79
79
  export const EXPO_SWIFT_ROUTE = '/__peach/expo-swift'
80
80
  export const EXPO_SWIFT_ENTRY = 'Sources/PeachExpoApp/PeachExpoEntry.swift'
81
- // a transient client disconnect leaves a short window for another client to
82
- // rejoin the same compile; after that the last client cancels its shared work.
83
- const EXPO_SWIFT_CLIENT_GAP_MS = 5_000
84
81
 
85
82
  // discovery walks the prepared workspace on the calling thread. each input is
86
83
  // stamped just before it is read and never restamped, so a stamp is never newer
@@ -117,11 +114,7 @@ type PreparedEntry = {
117
114
  witness: Witness
118
115
  base: string
119
116
  result: ExpoSwiftCompilationResult
120
- // set only when the result failed because no toolchain was available, so a
121
- // later endpoint or toolchain checkout is not reused as that failure.
122
- toolchain?: string
123
117
  }
124
- const TOOLCHAIN_UNAVAILABLE = 'No local Swift toolchain or distribution is available'
125
118
  type SavedFs = {
126
119
  readFileSync: typeof fs.readFileSync
127
120
  readdirSync: typeof fs.readdirSync
@@ -521,6 +514,8 @@ function cloneUnits(units: ExpoSwiftSourceUnit[] | null): ExpoSwiftSourceUnit[]
521
514
  ...unit,
522
515
  classes: unit.classes.slice(),
523
516
  bridgeModules: unit.bridgeModules.slice(),
517
+ appDelegateSubscribers: unit.appDelegateSubscribers.slice(),
518
+ reactDelegateHandlers: unit.reactDelegateHandlers.slice(),
524
519
  frameworks: unit.frameworks.slice(),
525
520
  files: { ...unit.files },
526
521
  ...(unit.nativeFiles ? { nativeFiles: { ...unit.nativeFiles } } : {}),
@@ -548,20 +543,6 @@ function replaceBase(value: string, from: string, to: string): string {
548
543
  return `${to}${value.slice(from.length)}`
549
544
  }
550
545
 
551
- function reportsMissingToolchain(result: ExpoSwiftCompilationResult): boolean {
552
- return result.failures.some((failure) => failure.diagnostic === TOOLCHAIN_UNAVAILABLE)
553
- }
554
-
555
- // file stamps miss an endpoint or toolchain directory that was never read.
556
- // the value is the availability the failure was decided under.
557
- function toolchainAvailability(): string {
558
- return [
559
- process.env.PEACH_SWIFT_ENDPOINT?.trim().replace(/\/+$/, '') ?? '',
560
- process.env.CONTRAST_SWIFT_TOOLCHAINS ?? '',
561
- fs.existsSync(path.join(sourceSwiftCheckout(), 'toolchain.json')) ? '1' : '0',
562
- ].join('\0')
563
- }
564
-
565
546
  function retarget(cached: PreparedEntry, base: string): ExpoSwiftCompilationResult {
566
547
  const result = cloneResult(cached.result)
567
548
  if (cached.base === base) return result
@@ -590,11 +571,9 @@ function autolinkerAppleFlags(autolinkerManifest: string, appRoot: string) {
590
571
  )
591
572
  const atLeast = (m: number, n: number, p: number) =>
592
573
  major !== m ? major > m : minor !== n ? minor > n : patch >= p
593
- if (atLeast(1, 10, 3))
594
- return { args: ['--platform', 'apple', '--project-root', appRoot], cwd: undefined }
595
- if (atLeast(1, 8, 0))
596
- return { args: ['--platform', 'ios', '--project-root', appRoot], cwd: undefined }
597
- return { args: ['--platform', 'ios'], cwd: appRoot }
574
+ if (atLeast(1, 10, 3)) return ['--platform', 'apple', '--project-root', appRoot]
575
+ if (atLeast(1, 8, 0)) return ['--platform', 'ios', '--project-root', appRoot]
576
+ return ['--platform', 'ios']
598
577
  }
599
578
 
600
579
  // only omit a class when its module and every declared view have app-owned
@@ -740,19 +719,20 @@ async function collectExpoSwiftSourcesUncached(
740
719
  // before propagating errors so a failed request leaves no child running.
741
720
  const [searched, resolvedModules] = await Promise.allSettled(
742
721
  ['search', 'resolve'].map((command) =>
743
- run(process.execPath, [cli, command, ...flags.args, '--json'], {
722
+ run(process.execPath, [cli, command, ...flags, '--json'], {
744
723
  timeout: 120_000,
745
724
  maxBuffer: 8 * 1024 * 1024,
746
725
  env: scriptEnv,
747
- cwd: flags.cwd,
726
+ // autolinkers call process.cwd() at startup, which throws when the
727
+ // bridge's inherited cwd was deleted.
728
+ cwd: appRoot,
748
729
  signal,
749
730
  }),
750
731
  ),
751
732
  )
752
733
  if (searched.status === 'rejected') throw searched.reason
753
734
  const search: unknown = JSON.parse(searched.value.stdout)
754
- if (!search || typeof search !== 'object' || Array.isArray(search))
755
- throw new Error('invalid Expo autolinking result')
735
+ if (!isRecord(search)) throw new Error('invalid Expo autolinking result')
756
736
  if (resolvedModules.status === 'rejected') throw resolvedModules.reason
757
737
  report('expo autolinking done')
758
738
  const resolvedText = resolvedModules.value.stdout
@@ -760,6 +740,27 @@ async function collectExpoSwiftSourcesUncached(
760
740
  const resolutions =
761
741
  resolved && typeof resolved === 'object' ? Reflect.get(resolved, 'modules') : null
762
742
  if (!Array.isArray(resolutions)) throw new Error('invalid Expo Apple resolution')
743
+ // `resolve` does not run upstream's macro scanner, so a package that leaves
744
+ // `apple.modules` undeclared and annotates its classes with `@ExpoModule` is
745
+ // linked from the same scan the generated provider uses. autolinking before
746
+ // 58 has no macro scanner, so those apps link only what `resolve` reports.
747
+ const scan: unknown = Reflect.get(
748
+ appRequire(path.join(path.dirname(autolinker), 'build/platforms/apple')),
749
+ 'scanNativeModulesAsync',
750
+ )
751
+ const scanned: unknown = typeof scan === 'function' ? await scan(search, 'apple') : null
752
+ if (isRecord(scanned)) {
753
+ for (const resolution of resolutions) {
754
+ if (!isRecord(resolution)) continue
755
+ const name = resolution.packageName
756
+ const entry = typeof name === 'string' ? search[name] : null
757
+ const config = isRecord(entry) ? entry.config : null
758
+ const apple = isRecord(config) ? (config.apple ?? config.ios) : null
759
+ if (isRecord(apple) && apple.modules != null) continue
760
+ const found = typeof name === 'string' ? scanned[name] : null
761
+ if (Array.isArray(found)) resolution.modules = found
762
+ }
763
+ }
763
764
  const units: ExpoSwiftSourceUnit[] = []
764
765
  const namespacesSeen = new Set<string>()
765
766
  let needsNativeWorkspace = false
@@ -780,7 +781,7 @@ async function collectExpoSwiftSourcesUncached(
780
781
  if (
781
782
  canonical.split(path.sep).includes('node_modules') &&
782
783
  (typeof packageName !== 'string' ||
783
- !COMPILED_EXPO_NATIVE_PACKAGES.includes(packageName))
784
+ !COMPILED_EXPO_NATIVE_PACKAGES.ios.includes(packageName))
784
785
  )
785
786
  continue
786
787
  // the autolinker read these in a child, so the parent can only stamp them
@@ -812,10 +813,22 @@ async function collectExpoSwiftSourcesUncached(
812
813
  resolution && typeof resolution === 'object'
813
814
  ? Reflect.get(resolution, 'pods')
814
815
  : null
816
+ const delegateNames = (key: string): unknown[] => {
817
+ const names =
818
+ resolution && typeof resolution === 'object' ? Reflect.get(resolution, key) : null
819
+ return Array.isArray(names) ? names : []
820
+ }
821
+ const subscriberNames = delegateNames('appDelegateSubscribers')
822
+ const handlerNames = delegateNames('reactDelegateHandlers')
815
823
  // a package with pods is rediscovered in the prepared workspace, which has no caps.
816
824
  const deferredToWorkspace =
817
825
  prepareNative && !installedWorkspace && Array.isArray(pods) && pods.length > 0
818
- if (!Array.isArray(modules) || modules.length === 0) continue
826
+ if (
827
+ (!Array.isArray(modules) || modules.length === 0) &&
828
+ subscriberNames.length === 0 &&
829
+ handlerNames.length === 0
830
+ )
831
+ continue
819
832
  if (
820
833
  !Array.isArray(namespaces) ||
821
834
  namespaces.length !== 1 ||
@@ -831,9 +844,14 @@ async function collectExpoSwiftSourcesUncached(
831
844
  namespacesSeen.add(namespace)
832
845
  const files: Record<string, string> = {}
833
846
  const frameworks = new Set<string>()
834
- const classes: { name: string; nativeName: string | null; registration: string }[] =
835
- []
836
- for (const module of modules) {
847
+ const classes: {
848
+ name: string
849
+ nativeName: string | null
850
+ registration: string | null
851
+ subscriber: string | null
852
+ handler: string | null
853
+ }[] = []
854
+ for (const module of Array.isArray(modules) ? modules : []) {
837
855
  const className =
838
856
  typeof module === 'string'
839
857
  ? module
@@ -855,9 +873,43 @@ async function collectExpoSwiftSourcesUncached(
855
873
  classes.push({
856
874
  name: className.split('.').pop()!,
857
875
  nativeName: name,
858
- registration: `(${className.includes('.') ? className : `${namespace}.${className}`}.self, ${name === null ? 'nil' : JSON.stringify(name)})`,
876
+ // a class named like its module shadows that module, so only the bare
877
+ // name reaches it; Swift's unqualified lookup finds the class.
878
+ registration: `(${className.includes('.') || className === namespace ? className : `${namespace}.${className}`}.self, ${name === null ? 'nil' : JSON.stringify(name)})`,
879
+ subscriber: null,
880
+ handler: null,
859
881
  })
860
882
  }
883
+ // a delegate class is compiled with its closure like a module class; one
884
+ // class may be both a module and a delegate
885
+ for (const [names, role] of [
886
+ [subscriberNames, 'subscriber'],
887
+ [handlerNames, 'handler'],
888
+ ] as const) {
889
+ for (const className of names) {
890
+ if (
891
+ typeof className !== 'string' ||
892
+ !/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(className)
893
+ )
894
+ throw new Error(`${sourceRoot}: invalid Expo Apple delegate descriptor`)
895
+ const name = className.split('.').pop()!
896
+ const reference = `${className.includes('.') || className === namespace ? className : `${namespace}.${className}`}.self`
897
+ const expression =
898
+ role === 'subscriber'
899
+ ? reference
900
+ : `(packageName: ${JSON.stringify(packageName)}, handler: ${reference})`
901
+ const existing = classes.find((item) => item.name === name)
902
+ if (existing) existing[role] = expression
903
+ else
904
+ classes.push({
905
+ name,
906
+ nativeName: null,
907
+ registration: null,
908
+ subscriber: role === 'subscriber' ? expression : null,
909
+ handler: role === 'handler' ? expression : null,
910
+ })
911
+ }
912
+ }
861
913
  const ios = path.join(canonical, 'ios')
862
914
  // an app's own module may share sources with its other native targets
863
915
  // through links that stay inside the app; installed packages stay sealed.
@@ -959,14 +1011,18 @@ async function collectExpoSwiftSourcesUncached(
959
1011
  walkFrameworks(canonical)
960
1012
  for (const module of classes) {
961
1013
  const closure = swiftSourceClosure(files, [module.name])
962
- if (configuredExpoSwiftModule(closure, module.name, module.nativeName, appConfig))
963
- continue
1014
+ const configured =
1015
+ module.registration !== null &&
1016
+ configuredExpoSwiftModule(closure, module.name, module.nativeName, appConfig)
1017
+ if (configured && !module.subscriber && !module.handler) continue
964
1018
  if (Array.isArray(pods) && pods.length > 0) needsNativeWorkspace = true
965
1019
  const unit: ExpoSwiftSourceUnit = {
966
1020
  namespace,
967
1021
  moduleId: `${namespace}.${module.name}`,
968
- classes: [module.registration],
1022
+ classes: module.registration && !configured ? [module.registration] : [],
969
1023
  bridgeModules: [],
1024
+ appDelegateSubscribers: module.subscriber ? [module.subscriber] : [],
1025
+ reactDelegateHandlers: module.handler ? [module.handler] : [],
970
1026
  files: closure,
971
1027
  frameworks: [...frameworks],
972
1028
  }
@@ -975,7 +1031,7 @@ async function collectExpoSwiftSourcesUncached(
975
1031
  }
976
1032
  }
977
1033
  if (prepareNative && !installedWorkspace && needsNativeWorkspace) {
978
- const discovery = expoDiscoveryKey({
1034
+ const discovery = await expoDiscoveryKey({
979
1035
  appRoot,
980
1036
  searchText: searched.value.stdout,
981
1037
  resolveText: resolvedText,
@@ -1013,23 +1069,19 @@ async function collectExpoSwiftSourcesUncached(
1013
1069
  )
1014
1070
  throw new Error('invalid Expo inline watched directories')
1015
1071
  if (directories !== undefined && directories.length > 0) {
1016
- const inlineResult = await run(
1017
- process.execPath,
1018
- [
1019
- '-e',
1020
- `
1021
- const appRoot = process.argv[1];
1022
- const { getMirrorStateObject } = require(process.argv[2]);
1023
- getMirrorStateObject({ appRoot, watchedDirectories: JSON.parse(process.argv[3]) })
1024
- .then(value => process.stdout.write(JSON.stringify(value)));
1025
- `,
1026
- appRoot,
1072
+ const scanInline: unknown = Reflect.get(
1073
+ appRequire(
1027
1074
  path.join(path.dirname(autolinker), 'build/inlineModules/inlineModules.js'),
1028
- JSON.stringify(directories),
1029
- ],
1030
- { timeout: 30_000, maxBuffer: 8 * 1024 * 1024, env: scriptEnv, signal },
1075
+ ),
1076
+ 'getMirrorStateObject',
1031
1077
  )
1032
- const inline: unknown = JSON.parse(inlineResult.stdout)
1078
+ if (typeof scanInline !== 'function')
1079
+ throw new Error('Expo autolinker does not expose its inline module scanner')
1080
+ const inline: unknown = await scanInline({
1081
+ appRoot,
1082
+ watchedDirectories: directories,
1083
+ })
1084
+ signal?.throwIfAborted()
1033
1085
  if (!inline || typeof inline !== 'object')
1034
1086
  throw new Error('invalid Expo inline modules')
1035
1087
  const inlineFiles = Reflect.get(inline, 'files')
@@ -1071,6 +1123,8 @@ async function collectExpoSwiftSourcesUncached(
1071
1123
  moduleId: 'PeachExpoApp',
1072
1124
  classes: inlineClasses.map((name) => `(${name}.self, nil)`),
1073
1125
  bridgeModules: [],
1126
+ appDelegateSubscribers: [],
1127
+ reactDelegateHandlers: [],
1074
1128
  files: appFiles,
1075
1129
  frameworks: [],
1076
1130
  }
@@ -1081,22 +1135,34 @@ async function collectExpoSwiftSourcesUncached(
1081
1135
  if (units.length === 0) return null
1082
1136
  if (installedWorkspace) {
1083
1137
  report(`reading installed workspace ${installedWorkspace}`)
1138
+ const module = await resolveSwiftModule({ signal })
1084
1139
  const projectRoot = openXcodeProject(
1085
1140
  installedWorkspace,
1086
1141
  undefined,
1087
1142
  undefined,
1088
1143
  'Debug',
1144
+ module?.root,
1089
1145
  )
1090
1146
  try {
1091
- const input = compileInput(projectRoot, 'main.swift')
1147
+ const { input, binaryFrameworks } = installedWorkspaceInput(
1148
+ projectRoot,
1149
+ 'main.swift',
1150
+ )
1092
1151
  const targets = swiftManifestTargets(input.files['Package.swift'] ?? '')
1093
1152
  for (const unit of units) {
1153
+ // a unit links the installed binary frameworks it imports; the
1154
+ // compile step keeps only the ones its sources name.
1155
+ unit.frameworks = [...new Set([...unit.frameworks, ...binaryFrameworks])]
1094
1156
  const target = targets.find((item) => item.name === unit.namespace)
1095
1157
  const native = input.nativeTargets?.find((item) => item.name === unit.namespace)
1096
1158
  if (!target || !native) continue
1159
+ // cocoapods compiles each pod at its own SWIFT_VERSION
1160
+ unit.swiftLanguageMode = target.languageMode
1161
+ // package reads skip node_modules directories, so an installed pod's
1162
+ // unit takes its path below the package that ships it.
1097
1163
  const map = (file: string) =>
1098
1164
  file.startsWith(`${target.path}/`)
1099
- ? `Sources/${unit.namespace}/${file.slice(target.path.length + 1)}`
1165
+ ? `Sources/${unit.namespace}/${file.slice(target.path.length + 1).replace(/^(?:.*\/)?node_modules\//, '')}`
1100
1166
  : file
1101
1167
  const isDummyUnit = (file: string) =>
1102
1168
  /(?:^|\/)Target Support Files\/[^/]+\/[^/]+-dummy\.m$/.test(file)
@@ -1195,7 +1261,11 @@ async function collectExpoSwiftSourcesUncached(
1195
1261
  if (name.startsWith(`Sources/${namespace}/`)) unit.files[name] = source
1196
1262
  }
1197
1263
  }
1198
- unit.files['Package.swift'] = expoManifest(unit.files)
1264
+ unit.files['Package.swift'] = expoManifest(
1265
+ unit.files,
1266
+ '',
1267
+ languageModes([...included].flatMap((namespace) => byNamespace.get(namespace)!)),
1268
+ )
1199
1269
  }
1200
1270
  return units
1201
1271
  }
@@ -1238,17 +1308,18 @@ function expoEntry(units: ExpoSwiftSourceUnit[]): string {
1238
1308
  ),
1239
1309
  )
1240
1310
  const bridgeModules = units.flatMap((unit) => unit.bridgeModules)
1241
- return `import SwiftUI\nimport ExpoModulesCore\n${bridgeModules.length ? 'import React\n' : ''}${namespaces.map((namespace) => `import ${namespace}`).join('\n')}\n\n@main struct PeachExpoApp: PeachPackage {\n init() { MainActor.assumeIsolated { PeachExpoRuntime.register([${units.flatMap((unit) => unit.classes).join(', ')}])${bridgeModules.length ? `; RCTModuleHost.register([${bridgeModules.join(', ')}])` : ''} } }\n func view(props: JSON) -> PeachExpoNativeView { PeachExpoNativeView(props: props) }\n}\n\n@_expose(wasm, "peach_expo_call")\n@_cdecl("peach_expo_call")\n@MainActor public func peachExpoCall(_ payload: UnsafePointer<UInt8>?, _ length: Int32) -> UnsafeMutablePointer<UInt8>? {\n PeachExpoRuntime.dispatch(payload, length)\n}\n`
1311
+ const subscribers = units.flatMap((unit) => unit.appDelegateSubscribers)
1312
+ const handlers = units.flatMap((unit) => unit.reactDelegateHandlers)
1313
+ const delegates =
1314
+ subscribers.length + handlers.length > 0
1315
+ ? `; PeachExpoRuntime.registerDelegates(subscribers: [${subscribers.join(', ')}], handlers: [${handlers.join(', ')}])`
1316
+ : ''
1317
+ return `import SwiftUI\ninternal import ExpoModulesCore\n${bridgeModules.length ? 'import React\n' : ''}${namespaces.map((namespace) => `import ${namespace}`).join('\n')}\n\n@main struct PeachExpoApp: PeachPackage {\n init() { MainActor.assumeIsolated { PeachExpoRuntime.register([${units.flatMap((unit) => unit.classes).join(', ')}])${delegates}${bridgeModules.length ? `; RCTModuleHost.register([${bridgeModules.join(', ')}])` : ''} } }\n func view(props: JSON) -> PeachExpoNativeView { PeachExpoNativeView(props: props) }\n}\n\n@_expose(wasm, "peach_expo_call")\n@_cdecl("peach_expo_call")\n@MainActor public func peachExpoCall(_ payload: UnsafePointer<UInt8>?, _ length: Int32) -> UnsafeMutablePointer<UInt8>? {\n PeachExpoRuntime.dispatch(payload, length)\n}\n`
1242
1318
  }
1243
1319
 
1244
- const compiling = new Map<
1245
- string,
1246
- {
1247
- promise: Promise<ExpoSwiftCompilationResult | null>
1248
- controller: AbortController
1249
- clients: number
1250
- }
1251
- >()
1320
+ // a compile outlives its client: a dropped open leaves the work running so the
1321
+ // next open joins it, or reuses its result, instead of starting over.
1322
+ const compiling = new Map<string, Promise<ExpoSwiftCompilationResult | null>>()
1252
1323
  // identical sources already produced a wasm that is still registered on its
1253
1324
  // project. a second caller otherwise relinks namespaces whose failure records
1254
1325
  // did not stick, and that link blows the flow's ready bound.
@@ -1281,7 +1352,7 @@ function expoSwiftPreparedKey(base: string, units: ExpoSwiftSourceUnit[]): strin
1281
1352
  }
1282
1353
 
1283
1354
  // this process's copy of the app's expo sources. the build key covers the
1284
- // same directory, so another server compiling the app keeps its own tree.
1355
+ // same app directory, so servers compiling the app share one warm build root.
1285
1356
  function expoSwiftPackage(appKey: string, name: string): string {
1286
1357
  return path.join(os.tmpdir(), 'peach-expo-swift', appKey, `p${process.pid}`, name)
1287
1358
  }
@@ -1345,30 +1416,21 @@ export async function compileExpoSwiftModules(
1345
1416
  return compileExpoSwiftModulesTraced(root, base, publishArtifact, options)
1346
1417
  }
1347
1418
  const cached = preparedCache.get(key)
1348
- if (
1349
- cached &&
1350
- (cached.toolchain === undefined || cached.toolchain === toolchainAvailability()) &&
1351
- (await witnessMatches(cached.witness))
1352
- ) {
1419
+ if (cached && (await witnessMatches(cached.witness))) {
1353
1420
  signal.throwIfAborted()
1354
1421
  report('reusing prepared expo swift artifact')
1355
1422
  return retarget(cached, base)
1356
1423
  }
1357
- const availabilityBefore = toolchainAvailability()
1358
1424
  const witness: Witness = { marks: new Map(), tainted: false }
1359
1425
  const result = await traceStore.run(witness, () =>
1360
1426
  compileExpoSwiftModulesTraced(root, base, publishArtifact, options),
1361
1427
  )
1362
1428
  if (result && witness.marks.size > 0 && (await witnessMatches(witness))) {
1363
- const availabilityChanged = toolchainAvailability() !== availabilityBefore
1364
- // a toolchain that arrived during the walk is not the failure just built.
1365
- if (!reportsMissingToolchain(result) || !availabilityChanged)
1366
- preparedCache.set(key, {
1367
- witness,
1368
- base,
1369
- result: cloneResult(result),
1370
- ...(reportsMissingToolchain(result) ? { toolchain: availabilityBefore } : {}),
1371
- })
1429
+ preparedCache.set(key, {
1430
+ witness,
1431
+ base,
1432
+ result: cloneResult(result),
1433
+ })
1372
1434
  }
1373
1435
  return result
1374
1436
  }
@@ -1435,15 +1497,6 @@ async function compileExpoSwiftModulesTraced(
1435
1497
  // namespace alone to isolate the failures, so a framework change costs one build.
1436
1498
  const module = await resolveSwiftModule({ signal })
1437
1499
  signal.throwIfAborted()
1438
- if (!module && publishArtifact) throw new Error(TOOLCHAIN_UNAVAILABLE)
1439
- if (!module) {
1440
- for (const unit of units)
1441
- result.failures.push({
1442
- namespace: unit.moduleId,
1443
- diagnostic: TOOLCHAIN_UNAVAILABLE,
1444
- })
1445
- return result
1446
- }
1447
1500
  const key = createHash('sha256').update(fs.realpathSync(root)).digest('hex')
1448
1501
  const failures = new Map<string, string>()
1449
1502
  const failureRecords = new Map<
@@ -1868,38 +1921,14 @@ export async function handleExpoSwiftRequest(
1868
1921
  return true
1869
1922
  }
1870
1923
  let pending = compiling.get(flightKey)
1871
- if (pending?.controller.signal.aborted) {
1872
- await pending.promise.catch(() => {})
1873
- if (res.destroyed) return true
1874
- pending = compiling.get(flightKey)
1875
- }
1876
1924
  if (!pending) {
1877
- const controller = new AbortController()
1878
- const promise = compileExpoSwiftModules(key, `http://${host}`, undefined, {
1879
- signal: controller.signal,
1880
- }).finally(() => {
1881
- if (compiling.get(flightKey)?.controller === controller) compiling.delete(flightKey)
1925
+ pending = compileExpoSwiftModules(key, `http://${host}`).finally(() => {
1926
+ compiling.delete(flightKey)
1882
1927
  })
1883
- pending = { controller, promise, clients: 0 }
1884
1928
  compiling.set(flightKey, pending)
1885
1929
  }
1886
- const current = pending
1887
- current.clients++
1888
- let released = false
1889
- const release = () => {
1890
- if (released) return
1891
- released = true
1892
- if (--current.clients > 0) return
1893
- const flight = current
1894
- setTimeout(() => {
1895
- if (flight.clients > 0 || flight.controller.signal.aborted) return
1896
- if (compiling.get(flightKey)?.controller !== flight.controller) return
1897
- flight.controller.abort(new Error('Expo Swift preparation client disconnected'))
1898
- }, EXPO_SWIFT_CLIENT_GAP_MS)
1899
- }
1900
- res.once('close', release)
1901
1930
  try {
1902
- const metadata = await current.promise
1931
+ const metadata = await pending
1903
1932
  if (!res.destroyed) {
1904
1933
  openPreparations.store(
1905
1934
  flightKey,
@@ -1917,9 +1946,6 @@ export async function handleExpoSwiftRequest(
1917
1946
  res.writeHead(500, { 'Content-Type': 'text/plain' })
1918
1947
  res.end(error instanceof Error ? error.message : String(error))
1919
1948
  }
1920
- } finally {
1921
- res.off('close', release)
1922
- release()
1923
1949
  }
1924
1950
  return true
1925
1951
  }
@@ -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)
@@ -0,0 +1,76 @@
1
+ import { createHash } from 'node:crypto'
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import { readAssetCatalog } from '../cli/app-catalog'
5
+ import { prepareExpoNativeWorkspace } from './expo-native-workspace'
6
+ import { stageHostBytes } from './host/staged-host-files'
7
+ import { isRecord } from './is-record'
8
+ import { rasterizePdfFile } from './swift-pdf-raster'
9
+ import { readPackageFile } from './swift-source-file'
10
+ import { findWorkspaceRoot } from './workspace-root'
11
+ import { readXcodeExtensionTargets } from './xcode-project'
12
+ import type { AppCatalog } from '#peach-cli-contract/engine/app-catalog-wire'
13
+
14
+ // upstream's plist identifies the expo extension independently of its target
15
+ // name. only that target's resources enter the extension's main namespace.
16
+ // callers already preparing native modules pass prepared.app here. the bridge
17
+ // serves these content-addressed urls through handleStagedHostFileRequest;
18
+ // captureStagedHostFiles also records the bytes for bundled delivery.
19
+ export function stagePreparedExpoWidgetAssets(
20
+ preparedApp: string,
21
+ origin: string,
22
+ ): AppCatalog | null {
23
+ const ios = path.join(preparedApp, 'ios')
24
+ const targets = fs
25
+ .readdirSync(ios, { withFileTypes: true })
26
+ .filter((entry) => entry.isDirectory() && entry.name.endsWith('.xcodeproj'))
27
+ .flatMap((entry) => readXcodeExtensionTargets(path.join(ios, entry.name)))
28
+ .filter(
29
+ ({ infoPlist }) =>
30
+ isRecord(infoPlist.NSExtension) &&
31
+ infoPlist.NSExtension.NSExtensionPointIdentifier ===
32
+ 'com.apple.widgetkit-extension' &&
33
+ typeof infoPlist.ExpoWidgetsAppGroupIdentifier === 'string',
34
+ )
35
+ if (targets.length === 0) return null
36
+ if (targets.length !== 1) throw new Error('expected one Expo Widgets extension target')
37
+ const target = targets[0]!
38
+ const root = fs.realpathSync(findWorkspaceRoot(preparedApp))
39
+ const members = new Map(
40
+ target.resources.map((file) => [
41
+ path.relative(root, file).split(path.sep).join('/'),
42
+ file,
43
+ ]),
44
+ )
45
+ const read = (file: string) => {
46
+ const source = members.get(file)
47
+ if (!source)
48
+ throw new Error(`widget catalog image is not an Xcode target member: ${file}`)
49
+ return readPackageFile(root, source, Infinity)
50
+ }
51
+ return readAssetCatalog(
52
+ [...members.keys()],
53
+ (file) => (members.has(file) ? read(file).toString('utf8') : null),
54
+ (file) => {
55
+ const bytes = read(file)
56
+ if (path.extname(file).toLowerCase() === '.pdf') {
57
+ const digest = createHash('sha256').update(bytes).digest('hex')
58
+ return stageHostBytes(
59
+ rasterizePdfFile(members.get(file)!, digest).bytes,
60
+ origin,
61
+ '.png',
62
+ )
63
+ }
64
+ return stageHostBytes(bytes, origin, path.extname(file))
65
+ },
66
+ target.accentName,
67
+ )
68
+ }
69
+
70
+ export async function stageExpoWidgetAssets(
71
+ appRoot: string,
72
+ origin: string,
73
+ ): Promise<AppCatalog | null> {
74
+ const prepared = await prepareExpoNativeWorkspace(appRoot)
75
+ return stagePreparedExpoWidgetAssets(prepared.app, origin)
76
+ }
@@ -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