peachsim 0.1.1738 → 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 (327) 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 +67 -16
  6. package/cli/commands/device.ts +3 -1
  7. package/cli/commands/doctor.ts +1 -4
  8. package/cli/commands/inspect/settling.ts +6 -1
  9. package/cli/commands/inspect/wait-ready.ts +22 -2
  10. package/cli/commands/package.ts +22 -20
  11. package/cli/commands/push.ts +56 -0
  12. package/cli/commands/serve.ts +9 -0
  13. package/cli/commands/shell-url.ts +37 -9
  14. package/cli/commands/swift.ts +1 -1
  15. package/cli/current-sim.ts +27 -0
  16. package/cli/drivers/linux-browser-libs.lock.json +323 -1
  17. package/cli/drivers/linux-browser-libs.ts +8 -6
  18. package/cli/drivers/playwright.ts +5 -1
  19. package/cli/internal-child.ts +11 -1
  20. package/cli/main.ts +6 -0
  21. package/cli/native-input.ts +1 -7
  22. package/cli/outbound-endpoints.ts +9 -1
  23. package/cli/packaged-app-launcher.ts +3 -1
  24. package/cli/scene-video.ts +4 -0
  25. package/cli/ws-bridge.ts +3 -1
  26. package/detox/index.ts +9 -4
  27. package/dist-lib/agent-daemon-client.cjs +1 -1
  28. package/dist-lib/agent-events.cjs +1 -1
  29. package/dist-lib/attached-projects.cjs +1 -1
  30. package/dist-lib/auth/shared-session.cjs +1 -1
  31. package/dist-lib/backend-origin.cjs +1 -1
  32. package/dist-lib/beta.cjs +1 -1
  33. package/dist-lib/beta.mjs +1 -1
  34. package/dist-lib/bridge-constants.cjs +1 -1
  35. package/dist-lib/bridge-contract-input.cjs +1 -1
  36. package/dist-lib/bridge-contract-input.mjs +1 -1
  37. package/dist-lib/bridge-contract.cjs +1 -1
  38. package/dist-lib/bridge-contract.mjs +1 -1
  39. package/dist-lib/bundle-channel.cjs +7372 -3675
  40. package/dist-lib/capture-contract.cjs +1 -1
  41. package/dist-lib/capture-contract.mjs +1 -1
  42. package/dist-lib/cloud-contract.cjs +1 -1
  43. package/dist-lib/cloud-contract.mjs +1 -1
  44. package/dist-lib/cloud-test-args.cjs +1 -1
  45. package/dist-lib/cloud-test-args.mjs +1 -1
  46. package/dist-lib/cloud.cjs +1 -1
  47. package/dist-lib/cloud.mjs +1 -1
  48. package/dist-lib/config.cjs +1 -1
  49. package/dist-lib/config.mjs +1 -1
  50. package/dist-lib/detox/index.cjs +22 -8
  51. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  52. package/dist-lib/expo-swift-bundle.cjs +6340 -3064
  53. package/dist-lib/expo-swift-metadata.cjs +14 -2
  54. package/dist-lib/expo-swift-metadata.mjs +14 -2
  55. package/dist-lib/home-paths.cjs +1 -1
  56. package/dist-lib/host/bridge-host.cjs +6524 -2720
  57. package/dist-lib/host/fetch-proxy-handler.cjs +8 -7
  58. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  59. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  60. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  61. package/dist-lib/host/websocket-proxy.cjs +6 -3
  62. package/dist-lib/index.cjs +97 -31
  63. package/dist-lib/jump-to-source-babel.cjs +1 -1
  64. package/dist-lib/jump-to-source-native.cjs +1 -1
  65. package/dist-lib/kotlin-host.cjs +1 -1
  66. package/dist-lib/menu.cjs +1 -1
  67. package/dist-lib/menu.mjs +1 -1
  68. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  69. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  70. package/dist-lib/metro-production-bundle.cjs +1 -1
  71. package/dist-lib/metro-production-bundle.mjs +1 -1
  72. package/dist-lib/metro.cjs +71 -29
  73. package/dist-lib/native-app-identity-project.cjs +53 -22
  74. package/dist-lib/native-app-identity-project.mjs +53 -22
  75. package/dist-lib/native-app-identity.cjs +10 -3
  76. package/dist-lib/native-app-identity.mjs +10 -3
  77. package/dist-lib/native-firebase-metadata.cjs +1 -1
  78. package/dist-lib/native-firebase-metadata.mjs +1 -1
  79. package/dist-lib/plist.cjs +1 -1
  80. package/dist-lib/plist.mjs +1 -1
  81. package/dist-lib/profiles.cjs +1 -1
  82. package/dist-lib/public-brand.cjs +1 -1
  83. package/dist-lib/public-origins-lib-esm.json +25 -23
  84. package/dist-lib/public-origins-lib.json +111 -79
  85. package/dist-lib/react-native-host-modules.cjs +1 -1
  86. package/dist-lib/react-native-host-modules.mjs +1 -1
  87. package/dist-lib/reap-browser.cjs +1 -1
  88. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  89. package/dist-lib/sdk.cjs +4 -1
  90. package/dist-lib/sdk.mjs +4 -1
  91. package/dist-lib/skills.cjs +40549 -37613
  92. package/dist-lib/swift-compile.cjs +2054 -388
  93. package/dist-lib/swift-compile.mjs +1976 -312
  94. package/dist-lib/swift-package.cjs +1 -1
  95. package/dist-lib/swift-package.mjs +1 -1
  96. package/dist-lib/swift-submit.cjs +2 -2
  97. package/dist-lib/swift-submit.mjs +2 -2
  98. package/dist-lib/swift-toolchain.cjs +68 -8
  99. package/dist-lib/swift.cjs +1 -1
  100. package/dist-lib/vite-swift.cjs +5867 -2646
  101. package/dist-lib/vite.cjs +18 -8
  102. package/dist-lib/worklet-executable.cjs +1 -1
  103. package/dist-lib/worklet-executable.mjs +1 -1
  104. package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +1 -0
  105. package/dist-types/packages/peach-engine/src/cli-companion.d.ts +1 -0
  106. package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +2 -0
  107. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +0 -3
  108. package/dist-types/packages/peach-engine/src/engine/node.d.ts +6 -0
  109. package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +1 -0
  110. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +25 -3
  111. package/dist-types/packages/peach-engine/src/engine/scroll-platform.d.ts +1 -15
  112. package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +1 -3
  113. package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +1 -0
  114. package/dist-types/packages/peach-engine/src/engine/types.d.ts +23 -0
  115. package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +6 -0
  116. package/dist-types/packages/peach-engine/src/metro-identity-contract.d.ts +33 -0
  117. package/dist-types/packages/peach-engine/src/preview/bundle-layout.d.ts +1 -1
  118. package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +2 -0
  119. package/dist-types/packages/peach-engine/src/render-worker/compositor-gpu.d.ts +1 -1
  120. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +2 -0
  121. package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +28 -0
  122. package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +21 -1
  123. package/dist-types/packages/peach-engine/src/render-worker/prepared-boot-bundle.d.ts +7 -0
  124. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +8 -0
  125. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +1 -0
  126. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -0
  127. package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +3 -3
  128. package/dist-types/packages/peach-engine/src/render-worker/webgpu-frame-transaction.d.ts +1 -0
  129. package/dist-types/packages/peach-engine/src/render-worker/webgpu-readback-scheduler.d.ts +1 -1
  130. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +1 -0
  131. package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +8 -1
  132. package/dist-types/packages/peach-engine/src/rolldown-production-fingerprint.d.ts +1 -4
  133. package/dist-types/packages/peach-engine/src/rolldown-production-module.d.ts +12 -0
  134. package/dist-types/packages/peach-engine/src/rolldown-production-roles.d.ts +6 -0
  135. package/dist-types/packages/peach-engine/src/settings/devices.d.ts +6 -1
  136. package/dist-types/packages/peach-engine/src/settings/duo-fold-bus.d.ts +1 -0
  137. package/dist-types/packages/peach-engine/src/shell-events.d.ts +4 -0
  138. package/dist-types/packages/peach-kit/src/capabilities.d.ts +7 -0
  139. package/package.json +2 -1
  140. package/runtime-companion.json +1 -1
  141. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +1 -0
  142. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkErrors.h +257 -0
  143. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFByteOrder.h +305 -0
  144. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +2 -0
  145. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGAffineTransform.h +204 -0
  146. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h +260 -0
  147. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColor.h +164 -0
  148. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorConversionInfo.h +101 -0
  149. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorSpace.h +510 -0
  150. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h +1132 -0
  151. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGConvertColorDataWithFormat.h +34 -0
  152. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDataConsumer.h +83 -0
  153. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDataProvider.h +197 -0
  154. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGEXRToneMappingGamma.h +36 -0
  155. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGError.h +38 -0
  156. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFont.h +312 -0
  157. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFunction.h +106 -0
  158. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGradient.h +123 -0
  159. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGITUToneMapping.h +31 -0
  160. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGImage.h +409 -0
  161. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGLayer.h +78 -0
  162. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h +120 -0
  163. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContentStream.h +55 -0
  164. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContext.h +535 -0
  165. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h +133 -0
  166. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h +252 -0
  167. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFMarkedContentItem.h +37 -0
  168. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFObject.h +67 -0
  169. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFOperatorTable.h +51 -0
  170. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h +101 -0
  171. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFScanner.h +123 -0
  172. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFStream.h +44 -0
  173. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFString.h +52 -0
  174. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFStructureElement.h +87 -0
  175. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h +441 -0
  176. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPattern.h +89 -0
  177. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGRenderingBufferProvider.h +49 -0
  178. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGShading.h +124 -0
  179. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGToneMapping.h +85 -0
  180. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +44 -252
  181. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Modules/module.modulemap +1 -0
  182. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/CFNetworkErrors.h +257 -0
  183. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +0 -6
  184. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +356 -61
  185. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/NSURLSession+Network.h +32 -0
  186. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/Network.h +51 -0
  187. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/advertise_descriptor.h +193 -0
  188. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browse_descriptor.h +163 -0
  189. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browse_result.h +207 -0
  190. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browser.h +285 -0
  191. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection.h +714 -0
  192. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection_group.h +629 -0
  193. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection_report.h +932 -0
  194. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/content_context.h +229 -0
  195. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/endpoint.h +390 -0
  196. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/error.h +135 -0
  197. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ethernet_channel.h +349 -0
  198. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/framer_options.h +1187 -0
  199. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/group_descriptor.h +184 -0
  200. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/interface.h +150 -0
  201. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ip_options.h +351 -0
  202. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/listener.h +438 -0
  203. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/nw_object.h +200 -0
  204. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/parameters.h +1205 -0
  205. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/path.h +392 -0
  206. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/path_monitor.h +216 -0
  207. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/privacy_context.h +188 -0
  208. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/protocol_options.h +126 -0
  209. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/proxy_config.h +357 -0
  210. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/quic_options.h +889 -0
  211. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/resolver_config.h +94 -0
  212. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/tcp_options.h +459 -0
  213. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/tls_options.h +115 -0
  214. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/txt_record.h +432 -0
  215. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/udp_options.h +112 -0
  216. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ws_options.h +743 -0
  217. package/sdk/ios/System/Library/Frameworks/Network.framework/Modules/module.modulemap +9 -0
  218. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAAnimation.h +395 -0
  219. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h +132 -0
  220. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CADisplayLink.h +107 -0
  221. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterCell.h +153 -0
  222. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterLayer.h +151 -0
  223. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAFrameRateRange.h +40 -0
  224. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAGradientLayer.h +78 -0
  225. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h +1078 -0
  226. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h +97 -0
  227. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTimingFunction.h +67 -0
  228. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAReplicatorLayer.h +65 -0
  229. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAScrollLayer.h +64 -0
  230. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAShapeLayer.h +135 -0
  231. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATextLayer.h +99 -0
  232. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATiledLayer.h +67 -0
  233. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransaction.h +124 -0
  234. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransform3D.h +138 -0
  235. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransformLayer.h +40 -0
  236. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAValueFunction.h +78 -0
  237. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +19 -38
  238. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecureTransport.h +1757 -0
  239. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSAttributedString.h +19 -0
  240. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSParagraphStyle.h +28 -0
  241. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityConstants.h +114 -0
  242. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +16 -0
  243. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBarAppearance.h +47 -0
  244. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDataDetectors.h +20 -0
  245. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDatePicker.h +13 -0
  246. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h +16 -0
  247. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h +84 -0
  248. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizer.h +119 -0
  249. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizerSubclass.h +66 -0
  250. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIHoverGestureRecognizer.h +45 -0
  251. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +161 -37
  252. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h +76 -0
  253. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBar.h +8 -0
  254. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBarAppearance.h +78 -0
  255. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITextInputTraits.h +29 -0
  256. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITouch.h +104 -0
  257. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITraitCollection.h +19 -0
  258. package/sdk/ios/usr/include/dns_sd.h +3616 -0
  259. package/sdk/ios/usr/include/dnssd.modulemap +4 -0
  260. package/sdk/ios/usr/include/module.modulemap +1 -0
  261. package/sdk/ios/usr/include/sys/socketvar.h +191 -0
  262. package/sdk/ios/usr/include/sys/vsock.h +84 -0
  263. package/sdk/native-hashes.json +1 -1
  264. package/skills/contrast/SKILL.md +6 -5
  265. package/skills/peach-debug/SKILL.md +68 -264
  266. package/skills/peach-debug/references/accessibility.md +37 -73
  267. package/skills/peach-debug/references/commands.md +2 -2
  268. package/skills/peach-debug/references/events.md +74 -0
  269. package/skills/peach-perf/SKILL.md +64 -401
  270. package/skills/peach-perf/references/presentation.md +46 -0
  271. package/skills/peach-perf/references/profiling.md +93 -0
  272. package/skills/peach-perf/references/render-counters.md +57 -0
  273. package/skills/peach-setup/SKILL.md +66 -216
  274. package/skills/peach-setup/references/native-config.md +35 -0
  275. package/skills/peach-setup/references/reporting.md +28 -0
  276. package/skills/peach-test/SKILL.md +68 -284
  277. package/skills/peach-test/references/detox.md +69 -0
  278. package/skills/peach-test/references/maestro.md +95 -0
  279. package/skills/peach-visual/SKILL.md +53 -105
  280. package/src/appPackageContract.ts +12 -1
  281. package/src/assetCatalogContract.ts +8 -1
  282. package/src/bridge-contract.ts +6 -0
  283. package/src/bundle-channel.mjs +133 -59
  284. package/src/cli-runtime.ts +8 -9
  285. package/src/configured-bundle-producer.ts +10 -0
  286. package/src/device-catalog.ts +68 -4
  287. package/src/expo-discovery-cache.ts +3 -0
  288. package/src/expo-native-workspace.ts +81 -17
  289. package/src/expo-swift-host.ts +57 -104
  290. package/src/expo-widget-assets.ts +76 -0
  291. package/src/expoSwiftContract.ts +13 -1
  292. package/src/host/websocket-proxy.ts +7 -2
  293. package/src/native-prebuilt.ts +3 -3
  294. package/src/nitro-adapter.lock.json +263 -263
  295. package/src/nitro-adapter.ts +69 -7
  296. package/src/nitro-bundle.ts +52 -24
  297. package/src/nitro-compile.ts +6 -1
  298. package/src/nitro-source.ts +82 -4
  299. package/src/nitro-superset.lock.json +103 -0
  300. package/src/nitro-superset.ts +137 -0
  301. package/src/nitroContract.ts +5 -1
  302. package/src/react-bridge-importers.ts +1 -0
  303. package/src/settingsContract.ts +26 -1
  304. package/src/swift-compile.ts +267 -68
  305. package/src/swift-compiler-digest.ts +2 -0
  306. package/src/swift-coverage/xcode-packages.ts +61 -1
  307. package/src/swift-coverage/xcode.ts +10 -12
  308. package/src/swift-cxx-reachable.ts +1 -1
  309. package/src/swift-distribution.lock.json +15 -13
  310. package/src/swift-distribution.ts +57 -26
  311. package/src/swift-host.ts +48 -35
  312. package/src/swift-link-roots.ts +45 -18
  313. package/src/swift-objc-compile.ts +78 -2
  314. package/src/swift-objc-standin.ts +3 -0
  315. package/src/swift-shared-sdk.ts +85 -1
  316. package/src/swift-standins.ts +233 -11
  317. package/src/swift-submit.ts +13 -1
  318. package/src/swift-toolchain.ts +82 -7
  319. package/src/swift-wasm-prune.ts +1629 -0
  320. package/src/turbo-bundle.ts +11 -10
  321. package/src/turbo-runtime.lock.json +16 -16
  322. package/src/vite-plugin-one.ts +12 -1
  323. package/src/vite-plugin.ts +82 -23
  324. package/src/wasm-optimize.ts +34 -0
  325. package/src/worker-system-chunks.ts +3 -3
  326. package/src/xcode-project.ts +52 -0
  327. package/src/xcode-target-members.ts +12 -1
@@ -1,3 +1,5 @@
1
+ import { getRuntimePlatformAdapter } from './runtimePlatformContract.ts'
2
+
1
3
  export type RuntimePlatform = 'ios' | 'android'
2
4
 
3
5
  // hardware side-button layout. top/height are in the frame's coordinate
@@ -245,6 +247,9 @@ export interface DeviceSpec {
245
247
  // unresolvable off dev, so a shipped build cannot boot it. see
246
248
  // isDeviceResolvableById.
247
249
  developmentOnly?: boolean
250
+ // a window mode only a packaged app's host offers; browser, ide, tray and
251
+ // cli lists leave it out. it still resolves by id everywhere.
252
+ packagedOnly?: boolean
248
253
  // posture is present on a resolved posture-aware profile. ordinary devices
249
254
  // keep it absent so their existing device shape remains unchanged.
250
255
  posture?: DevicePosture
@@ -262,8 +267,21 @@ export interface DeviceSpec {
262
267
  // the foreground scene turned the duo's vertical bar off
263
268
  // (withSceneVerticalBar). absent while the bar is automatic.
264
269
  verticalBar?: 'disabled'
270
+ // distance from each window edge to the region a popover stays inside, where
271
+ // that region is not the default (10pt sides, safe area top and bottom).
272
+ popoverRegionInsets?: { left: number; top: number; right: number; bottom: number }
265
273
  }
266
274
 
275
+ // the dynamic device's window limits, from the iOS 27.0 Stage Manager window
276
+ // on the iPad Pro 13-inch (M5), docs/ios-ipad-window-geometry.md: the smallest
277
+ // window is 375 x 486 and the largest the 1032 x 1376 display.
278
+ export const DYNAMIC_WINDOW_LIMITS = {
279
+ minWidth: 375,
280
+ minHeight: 486,
281
+ maxWidth: 1032,
282
+ maxHeight: 1376,
283
+ } as const
284
+
267
285
  export type DeviceModel =
268
286
  | 'canvas-workspace'
269
287
  | 'iphone-se'
@@ -283,6 +301,7 @@ export type DeviceModel =
283
301
  | 'iphone-duo'
284
302
  | 'ipad-pro-11'
285
303
  | 'ipad-pro-13'
304
+ | 'dynamic'
286
305
  | 'pixel-8'
287
306
  | 'pixel-8-three-button'
288
307
  | 'pixel-9-pro-xl'
@@ -760,6 +779,10 @@ const profiles = {
760
779
  top: 88 / 3,
761
780
  trailing: 88 / 3,
762
781
  },
782
+ // closed portrait popover region on the ios 27.1 duo simulator (uikit
783
+ // sheet probe, popoverLayoutMargins zero): left 8, the other edges 25.
784
+ // the open and rotated profiles are unmeasured and drop it.
785
+ popoverRegionInsets: { left: 8, top: 25, right: 25, bottom: 25 },
763
786
  },
764
787
  'ipad-pro-11': {
765
788
  // frame and hardware buttons are not sourced yet, so this stays off the
@@ -782,6 +805,26 @@ const profiles = {
782
805
  13,
783
806
  403,
784
807
  ),
808
+ // an iPadOS app window the user resizes, on the iPad Pro 13-inch (M5). the
809
+ // profile is the launch window; the host sizes it with withWindowSize.
810
+ // numbers are the iOS 27.0 Stage Manager window in
811
+ // docs/ios-ipad-window-geometry.md.
812
+ dynamic: {
813
+ .../* @__PURE__ */ ipadProDevice('dynamic', 'Dynamic Window', 375, 753, 13, 403),
814
+ // the window starts below the screen's status strip and no home indicator
815
+ // is drawn in it, so neither insets the window.
816
+ statusBarHeight: 0,
817
+ landscapeStatusBarHeight: 0,
818
+ homeIndicatorHeight: 0,
819
+ navigationBarMode: 'none',
820
+ // the system clips the window to a 32pt circular arc.
821
+ cornerRadius: /* @__PURE__ */ cornerRadii(32),
822
+ continuousCornerRadius: /* @__PURE__ */ cornerRadii(32),
823
+ // the display's diagonal, not the window's.
824
+ physicalPPI: Math.hypot(2064, 2752) / 13,
825
+ safeAreaInsets: { top: 0, bottom: 0, left: 10, right: 10 },
826
+ packagedOnly: true,
827
+ },
785
828
  'pixel-8': {
786
829
  model: 'pixel-8',
787
830
  platform: 'android',
@@ -1102,18 +1145,39 @@ export function listDeviceModels(): DeviceModel[] {
1102
1145
  }
1103
1146
 
1104
1147
  // devices a picker, tray, or list may offer. experimental prototypes never
1105
- // appear, and developmentOnly devices appear only where the caller says it is
1106
- // running on a development surface.
1148
+ // appear, developmentOnly devices appear only where the caller says it is
1149
+ // running on a development surface, and packagedOnly ones only in a packaged
1150
+ // app's host.
1107
1151
  export function listSelectableDeviceModels(options?: {
1108
1152
  developmentMode?: boolean
1153
+ packaged?: boolean
1109
1154
  }): DeviceModel[] {
1110
1155
  return listDeviceModels().filter((model) => {
1111
1156
  const spec = devices[model]
1112
1157
  if (spec.experimental) return false
1158
+ if (spec.packagedOnly && options?.packaged !== true) return false
1113
1159
  return spec.developmentOnly !== true || options?.developmentMode === true
1114
1160
  })
1115
1161
  }
1116
1162
 
1163
+ // a swift guest's #available(iOS major.minor.patch) on this device: the
1164
+ // device's own iOS version answers, as the running OS does on device.
1165
+ export function iosVersionAtLeast(
1166
+ spec: DeviceSpec,
1167
+ major: number,
1168
+ minor: number,
1169
+ patch: number,
1170
+ ): boolean {
1171
+ if (!getRuntimePlatformAdapter(spec.platform).isIOS)
1172
+ throw new Error(`${spec.model} runs ${spec.platform}, which has no iOS version`)
1173
+ const [deviceMajor = 0, deviceMinor = 0, devicePatch = 0] = spec.osVersion
1174
+ .split('.')
1175
+ .map(Number)
1176
+ if (deviceMajor !== major) return deviceMajor > major
1177
+ if (deviceMinor !== minor) return deviceMinor > minor
1178
+ return devicePatch >= patch
1179
+ }
1180
+
1117
1181
  // reverse lookup by display name (e.g. "iPhone 16 Pro Max" → 'iphone-16-pro-max').
1118
1182
  // useful for consuming external manifests that record the human-readable
1119
1183
  // device name without a slug. returns null when no match exists.
@@ -1125,7 +1189,7 @@ export function getDeviceByName(name: string): DeviceSpec | null {
1125
1189
  }
1126
1190
 
1127
1191
  function ipadProDevice(
1128
- model: 'ipad-pro-11' | 'ipad-pro-13',
1192
+ model: 'ipad-pro-11' | 'ipad-pro-13' | 'dynamic',
1129
1193
  name: string,
1130
1194
  width: number,
1131
1195
  height: number,
@@ -1164,7 +1228,7 @@ function ipadProDevice(
1164
1228
  keyboardPanelHeights: {
1165
1229
  qwerty: keyboardHeight,
1166
1230
  pad: keyboardHeight,
1167
- emoji: keyboardHeight + (model === 'ipad-pro-13' ? 2.5 : 0),
1231
+ emoji: keyboardHeight + (model === 'ipad-pro-11' ? 0 : 2.5),
1168
1232
  },
1169
1233
  // hypot(1668, 2420) / 11, measured native pixels over the device type's
1170
1234
  // 11-inch name. not a separate density read.
@@ -27,8 +27,11 @@ const PIPELINE_FILES = [
27
27
  'expo-native-workspace',
28
28
  'expo-swift-host',
29
29
  'swift-compile',
30
+ 'swift-cxx-reachable',
30
31
  'swift-host',
32
+ 'swift-objc-compile',
31
33
  'swift-package',
34
+ 'swift-standins',
32
35
  'xcode-project',
33
36
  ]
34
37
 
@@ -50,6 +50,14 @@ async function workspaceExclusion(root: string) {
50
50
  }
51
51
  }
52
52
 
53
+ // the files whose content steers install, prebuild and pod install: manifests,
54
+ // lockfiles, app and plugin config, patches and native project files.
55
+ const NATIVE_CONFIG_FILE =
56
+ /(^|\/)(package\.json|bun\.lockb?|package-lock\.json|pnpm-lock\.yaml|pnpm-workspace\.yaml|yarn\.lock|\.yarnrc\.yml|\.npmrc|app\.json|app\.config\.[cm]?[jt]s|Podfile(\.lock|\.properties)?|expo-module\.config\.json|react-native\.config\.[cm]?[jt]s|\.nvmrc|\.tool-versions)$|\.(podspec|patch|plist|entitlements|xcconfig|pbxproj|storyboard|xib|gradle|rb)$|(^|\/)(plugins|patches)\//
57
+ // native sources steer pod install by existing, not by content: an edit to one
58
+ // is copied into the prepared workspace, an added or removed one rebuilds it.
59
+ const NATIVE_SOURCE_FILE = /\.(swift|mm?|hpp?|c|cc|cpp|kt|java)$/
60
+
53
61
  // every file the native prepare can read, plus the toolchain that reads it.
54
62
  // node_modules stays out: the js install rebuilds it from the hashed lockfiles,
55
63
  // and the discovery cache keys the live native inventory separately. the walk
@@ -61,6 +69,8 @@ export async function hashExpoWorkspace(
61
69
  root: string
62
70
  appRelative: string
63
71
  hash: string
72
+ // the subset of inputs that decides the prepared workspace
73
+ nativeHash: string
64
74
  excluded: (relative: string) => boolean
65
75
  }> {
66
76
  const root = findWorkspaceRoot(app)
@@ -68,6 +78,7 @@ export async function hashExpoWorkspace(
68
78
  const appRelative = path.relative(root, app)
69
79
  const manifest = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'))
70
80
  const hash = createHash('sha256')
81
+ const native = createHash('sha256')
71
82
  const walk = async (directory: string) => {
72
83
  const entries = await fs.promises.readdir(directory, { withFileTypes: true })
73
84
  for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
@@ -76,10 +87,18 @@ export async function hashExpoWorkspace(
76
87
  const relative = path.relative(root, file)
77
88
  if (excluded(relative)) continue
78
89
  hash.update(`${relative}\0`)
79
- if (entry.isSymbolicLink())
80
- hash.update(`link\0${await fs.promises.readlink(file)}\0`)
81
- else if (entry.isDirectory()) await walk(file)
82
- else if (entry.isFile()) hash.update(await fs.promises.readFile(file))
90
+ if (entry.isSymbolicLink()) {
91
+ const link = `link\0${await fs.promises.readlink(file)}\0`
92
+ hash.update(link)
93
+ native.update(`${relative}\0${link}`)
94
+ } else if (entry.isDirectory()) await walk(file)
95
+ else if (entry.isFile()) {
96
+ const bytes = await fs.promises.readFile(file)
97
+ hash.update(bytes)
98
+ const posix = relative.split(path.sep).join('/')
99
+ if (NATIVE_CONFIG_FILE.test(posix)) native.update(`${posix}\0`).update(bytes)
100
+ else if (NATIVE_SOURCE_FILE.test(posix)) native.update(`${posix}\0`)
101
+ }
83
102
  }
84
103
  }
85
104
  await walk(root)
@@ -89,16 +108,22 @@ export async function hashExpoWorkspace(
89
108
  } catch (cause) {
90
109
  throw new Error('CocoaPods is required to install source dependencies', { cause })
91
110
  }
92
- hash.update(
93
- JSON.stringify({
94
- appRelative,
95
- podVersion,
96
- node: process.version,
97
- xcode: execFileSync('xcodebuild', ['-version'], { encoding: 'utf8', env: utf8Env }),
98
- packageManager: manifest.packageManager,
99
- }),
100
- )
101
- return { root, appRelative, hash: hash.digest('hex'), excluded }
111
+ const toolchain = JSON.stringify({
112
+ appRelative,
113
+ podVersion,
114
+ node: process.version,
115
+ xcode: execFileSync('xcodebuild', ['-version'], { encoding: 'utf8', env: utf8Env }),
116
+ packageManager: manifest.packageManager,
117
+ })
118
+ hash.update(toolchain)
119
+ native.update(toolchain)
120
+ return {
121
+ root,
122
+ appRelative,
123
+ hash: hash.digest('hex'),
124
+ nativeHash: native.digest('hex'),
125
+ excluded,
126
+ }
102
127
  }
103
128
 
104
129
  // each prepared workspace copies the app's repository with its installed
@@ -149,6 +174,41 @@ function pruneExpoNativeWorkspaces(parent: string, keep: string) {
149
174
  if (Date.now() - used > WORKSPACE_GRACE_MS) retire(directory, used)
150
175
  }
151
176
 
177
+ // an edit that leaves the native inputs alone lands in the prepared copy by
178
+ // stat, so a warm open reads no file it did not have to.
179
+ function syncChangedFiles(
180
+ root: string,
181
+ work: string,
182
+ appRelative: string,
183
+ excluded: (relative: string) => boolean,
184
+ ) {
185
+ const walk = (directory: string) => {
186
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
187
+ const file = path.join(directory, entry.name)
188
+ const relative = path.relative(root, file)
189
+ // the app's ios project is prebuild output, not a source
190
+ if (
191
+ excluded(relative) ||
192
+ entry.isSymbolicLink() ||
193
+ relative === path.join(appRelative, 'ios')
194
+ )
195
+ continue
196
+ if (entry.isDirectory()) walk(file)
197
+ else if (entry.isFile()) {
198
+ const source = fs.statSync(file)
199
+ const target = path.join(work, relative)
200
+ const existing = fs.statSync(target, { throwIfNoEntry: false })
201
+ if (existing?.size === source.size && existing.mtimeMs === source.mtimeMs)
202
+ continue
203
+ fs.mkdirSync(path.dirname(target), { recursive: true })
204
+ fs.copyFileSync(file, target)
205
+ fs.utimesSync(target, source.atime, source.mtime)
206
+ }
207
+ }
208
+ }
209
+ walk(root)
210
+ }
211
+
152
212
  export async function prepareExpoNativeWorkspace(app: string, signal?: AbortSignal) {
153
213
  if (process.platform !== 'darwin')
154
214
  throw new Error('Expo CocoaPods workspace preparation requires a Mac')
@@ -157,17 +217,20 @@ export async function prepareExpoNativeWorkspace(app: string, signal?: AbortSign
157
217
  console.error(
158
218
  `[expo-native-workspace ${Math.round(performance.now() - started)}ms] ${message}`,
159
219
  )
160
- const { root, appRelative, hash, excluded } = await hashExpoWorkspace(app, signal)
220
+ const { root, appRelative, nativeHash, excluded } = await hashExpoWorkspace(app, signal)
161
221
  const manifest = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'))
162
222
  const appManifest = JSON.parse(fs.readFileSync(path.join(app, 'package.json'), 'utf8'))
163
- const work = path.join(cacheDir(), 'expo-native-workspaces', hash)
223
+ const work = path.join(cacheDir(), 'expo-native-workspaces', nativeHash)
164
224
  report(`hashed ${root}`)
165
225
  return withSwiftRootLock(
166
226
  work,
167
227
  async (lease) => {
168
228
  const marker = path.join(work, '.peach-complete')
169
229
  const preparedApp = path.join(work, appRelative)
170
- if (fs.existsSync(marker)) report(`reusing prepared workspace ${work}`)
230
+ if (fs.existsSync(marker)) {
231
+ syncChangedFiles(root, work, appRelative, excluded)
232
+ report(`reusing prepared workspace ${work}`)
233
+ }
171
234
  if (!fs.existsSync(marker)) {
172
235
  const partial = `${work}.${process.pid}.partial`
173
236
  fs.rmSync(partial, { recursive: true, force: true })
@@ -175,6 +238,7 @@ export async function prepareExpoNativeWorkspace(app: string, signal?: AbortSign
175
238
  fs.mkdirSync(path.dirname(work), { recursive: true })
176
239
  fs.cpSync(root, partial, {
177
240
  recursive: true,
241
+ preserveTimestamps: true,
178
242
  filter: (source) => !excluded(path.relative(root, source)),
179
243
  })
180
244
  fs.renameSync(partial, work)
@@ -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
@@ -550,20 +543,6 @@ function replaceBase(value: string, from: string, to: string): string {
550
543
  return `${to}${value.slice(from.length)}`
551
544
  }
552
545
 
553
- function reportsMissingToolchain(result: ExpoSwiftCompilationResult): boolean {
554
- return result.failures.some((failure) => failure.diagnostic === TOOLCHAIN_UNAVAILABLE)
555
- }
556
-
557
- // file stamps miss an endpoint or toolchain directory that was never read.
558
- // the value is the availability the failure was decided under.
559
- function toolchainAvailability(): string {
560
- return [
561
- process.env.PEACH_SWIFT_ENDPOINT?.trim().replace(/\/+$/, '') ?? '',
562
- process.env.CONTRAST_SWIFT_TOOLCHAINS ?? '',
563
- fs.existsSync(path.join(sourceSwiftCheckout(), 'toolchain.json')) ? '1' : '0',
564
- ].join('\0')
565
- }
566
-
567
546
  function retarget(cached: PreparedEntry, base: string): ExpoSwiftCompilationResult {
568
547
  const result = cloneResult(cached.result)
569
548
  if (cached.base === base) return result
@@ -753,8 +732,7 @@ async function collectExpoSwiftSourcesUncached(
753
732
  )
754
733
  if (searched.status === 'rejected') throw searched.reason
755
734
  const search: unknown = JSON.parse(searched.value.stdout)
756
- if (!search || typeof search !== 'object' || Array.isArray(search))
757
- throw new Error('invalid Expo autolinking result')
735
+ if (!isRecord(search)) throw new Error('invalid Expo autolinking result')
758
736
  if (resolvedModules.status === 'rejected') throw resolvedModules.reason
759
737
  report('expo autolinking done')
760
738
  const resolvedText = resolvedModules.value.stdout
@@ -762,6 +740,27 @@ async function collectExpoSwiftSourcesUncached(
762
740
  const resolutions =
763
741
  resolved && typeof resolved === 'object' ? Reflect.get(resolved, 'modules') : null
764
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
+ }
765
764
  const units: ExpoSwiftSourceUnit[] = []
766
765
  const namespacesSeen = new Set<string>()
767
766
  let needsNativeWorkspace = false
@@ -1070,23 +1069,19 @@ async function collectExpoSwiftSourcesUncached(
1070
1069
  )
1071
1070
  throw new Error('invalid Expo inline watched directories')
1072
1071
  if (directories !== undefined && directories.length > 0) {
1073
- const inlineResult = await run(
1074
- process.execPath,
1075
- [
1076
- '-e',
1077
- `
1078
- const appRoot = process.argv[1];
1079
- const { getMirrorStateObject } = require(process.argv[2]);
1080
- getMirrorStateObject({ appRoot, watchedDirectories: JSON.parse(process.argv[3]) })
1081
- .then(value => process.stdout.write(JSON.stringify(value)));
1082
- `,
1083
- appRoot,
1072
+ const scanInline: unknown = Reflect.get(
1073
+ appRequire(
1084
1074
  path.join(path.dirname(autolinker), 'build/inlineModules/inlineModules.js'),
1085
- JSON.stringify(directories),
1086
- ],
1087
- { timeout: 30_000, maxBuffer: 8 * 1024 * 1024, env: scriptEnv, signal },
1075
+ ),
1076
+ 'getMirrorStateObject',
1088
1077
  )
1089
- 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()
1090
1085
  if (!inline || typeof inline !== 'object')
1091
1086
  throw new Error('invalid Expo inline modules')
1092
1087
  const inlineFiles = Reflect.get(inline, 'files')
@@ -1140,16 +1135,24 @@ async function collectExpoSwiftSourcesUncached(
1140
1135
  if (units.length === 0) return null
1141
1136
  if (installedWorkspace) {
1142
1137
  report(`reading installed workspace ${installedWorkspace}`)
1138
+ const module = await resolveSwiftModule({ signal })
1143
1139
  const projectRoot = openXcodeProject(
1144
1140
  installedWorkspace,
1145
1141
  undefined,
1146
1142
  undefined,
1147
1143
  'Debug',
1144
+ module?.root,
1148
1145
  )
1149
1146
  try {
1150
- const input = compileInput(projectRoot, 'main.swift')
1147
+ const { input, binaryFrameworks } = installedWorkspaceInput(
1148
+ projectRoot,
1149
+ 'main.swift',
1150
+ )
1151
1151
  const targets = swiftManifestTargets(input.files['Package.swift'] ?? '')
1152
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])]
1153
1156
  const target = targets.find((item) => item.name === unit.namespace)
1154
1157
  const native = input.nativeTargets?.find((item) => item.name === unit.namespace)
1155
1158
  if (!target || !native) continue
@@ -1311,17 +1314,12 @@ function expoEntry(units: ExpoSwiftSourceUnit[]): string {
1311
1314
  subscribers.length + handlers.length > 0
1312
1315
  ? `; PeachExpoRuntime.registerDelegates(subscribers: [${subscribers.join(', ')}], handlers: [${handlers.join(', ')}])`
1313
1316
  : ''
1314
- 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(', ')}])${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`
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`
1315
1318
  }
1316
1319
 
1317
- const compiling = new Map<
1318
- string,
1319
- {
1320
- promise: Promise<ExpoSwiftCompilationResult | null>
1321
- controller: AbortController
1322
- clients: number
1323
- }
1324
- >()
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>>()
1325
1323
  // identical sources already produced a wasm that is still registered on its
1326
1324
  // project. a second caller otherwise relinks namespaces whose failure records
1327
1325
  // did not stick, and that link blows the flow's ready bound.
@@ -1354,7 +1352,7 @@ function expoSwiftPreparedKey(base: string, units: ExpoSwiftSourceUnit[]): strin
1354
1352
  }
1355
1353
 
1356
1354
  // this process's copy of the app's expo sources. the build key covers the
1357
- // 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.
1358
1356
  function expoSwiftPackage(appKey: string, name: string): string {
1359
1357
  return path.join(os.tmpdir(), 'peach-expo-swift', appKey, `p${process.pid}`, name)
1360
1358
  }
@@ -1418,30 +1416,21 @@ export async function compileExpoSwiftModules(
1418
1416
  return compileExpoSwiftModulesTraced(root, base, publishArtifact, options)
1419
1417
  }
1420
1418
  const cached = preparedCache.get(key)
1421
- if (
1422
- cached &&
1423
- (cached.toolchain === undefined || cached.toolchain === toolchainAvailability()) &&
1424
- (await witnessMatches(cached.witness))
1425
- ) {
1419
+ if (cached && (await witnessMatches(cached.witness))) {
1426
1420
  signal.throwIfAborted()
1427
1421
  report('reusing prepared expo swift artifact')
1428
1422
  return retarget(cached, base)
1429
1423
  }
1430
- const availabilityBefore = toolchainAvailability()
1431
1424
  const witness: Witness = { marks: new Map(), tainted: false }
1432
1425
  const result = await traceStore.run(witness, () =>
1433
1426
  compileExpoSwiftModulesTraced(root, base, publishArtifact, options),
1434
1427
  )
1435
1428
  if (result && witness.marks.size > 0 && (await witnessMatches(witness))) {
1436
- const availabilityChanged = toolchainAvailability() !== availabilityBefore
1437
- // a toolchain that arrived during the walk is not the failure just built.
1438
- if (!reportsMissingToolchain(result) || !availabilityChanged)
1439
- preparedCache.set(key, {
1440
- witness,
1441
- base,
1442
- result: cloneResult(result),
1443
- ...(reportsMissingToolchain(result) ? { toolchain: availabilityBefore } : {}),
1444
- })
1429
+ preparedCache.set(key, {
1430
+ witness,
1431
+ base,
1432
+ result: cloneResult(result),
1433
+ })
1445
1434
  }
1446
1435
  return result
1447
1436
  }
@@ -1508,15 +1497,6 @@ async function compileExpoSwiftModulesTraced(
1508
1497
  // namespace alone to isolate the failures, so a framework change costs one build.
1509
1498
  const module = await resolveSwiftModule({ signal })
1510
1499
  signal.throwIfAborted()
1511
- if (!module && publishArtifact) throw new Error(TOOLCHAIN_UNAVAILABLE)
1512
- if (!module) {
1513
- for (const unit of units)
1514
- result.failures.push({
1515
- namespace: unit.moduleId,
1516
- diagnostic: TOOLCHAIN_UNAVAILABLE,
1517
- })
1518
- return result
1519
- }
1520
1500
  const key = createHash('sha256').update(fs.realpathSync(root)).digest('hex')
1521
1501
  const failures = new Map<string, string>()
1522
1502
  const failureRecords = new Map<
@@ -1941,38 +1921,14 @@ export async function handleExpoSwiftRequest(
1941
1921
  return true
1942
1922
  }
1943
1923
  let pending = compiling.get(flightKey)
1944
- if (pending?.controller.signal.aborted) {
1945
- await pending.promise.catch(() => {})
1946
- if (res.destroyed) return true
1947
- pending = compiling.get(flightKey)
1948
- }
1949
1924
  if (!pending) {
1950
- const controller = new AbortController()
1951
- const promise = compileExpoSwiftModules(key, `http://${host}`, undefined, {
1952
- signal: controller.signal,
1953
- }).finally(() => {
1954
- if (compiling.get(flightKey)?.controller === controller) compiling.delete(flightKey)
1925
+ pending = compileExpoSwiftModules(key, `http://${host}`).finally(() => {
1926
+ compiling.delete(flightKey)
1955
1927
  })
1956
- pending = { controller, promise, clients: 0 }
1957
1928
  compiling.set(flightKey, pending)
1958
1929
  }
1959
- const current = pending
1960
- current.clients++
1961
- let released = false
1962
- const release = () => {
1963
- if (released) return
1964
- released = true
1965
- if (--current.clients > 0) return
1966
- const flight = current
1967
- setTimeout(() => {
1968
- if (flight.clients > 0 || flight.controller.signal.aborted) return
1969
- if (compiling.get(flightKey)?.controller !== flight.controller) return
1970
- flight.controller.abort(new Error('Expo Swift preparation client disconnected'))
1971
- }, EXPO_SWIFT_CLIENT_GAP_MS)
1972
- }
1973
- res.once('close', release)
1974
1930
  try {
1975
- const metadata = await current.promise
1931
+ const metadata = await pending
1976
1932
  if (!res.destroyed) {
1977
1933
  openPreparations.store(
1978
1934
  flightKey,
@@ -1990,9 +1946,6 @@ export async function handleExpoSwiftRequest(
1990
1946
  res.writeHead(500, { 'Content-Type': 'text/plain' })
1991
1947
  res.end(error instanceof Error ? error.message : String(error))
1992
1948
  }
1993
- } finally {
1994
- res.off('close', release)
1995
- release()
1996
1949
  }
1997
1950
  return true
1998
1951
  }
@@ -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
+ }