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
@@ -15,15 +15,19 @@ import fs from 'node:fs'
15
15
  import path from 'node:path'
16
16
  import { cacheDir as peachCacheDir, swiftPackageCacheOptions } from './home-paths'
17
17
  import { isRecord } from './is-record'
18
+ import { fetchNativeEntry, nativeEntryKey } from './native-prebuilt'
18
19
  import { outputLockStdio } from './output-lock-stdio'
19
20
  import { parsePlistSource } from './plist'
20
21
  import {
21
22
  FOUNDATION_IMPLICIT_MODULES,
23
+ foundationOwnerOf,
22
24
  swiftDistributionAt,
25
+ swiftModuleInterface,
23
26
  swiftImportNames,
24
27
  swiftMacroPlugins,
25
28
  swiftModuleDigest,
26
29
  swiftModuleSdk,
30
+ swiftCompileSdkOptions,
27
31
  swiftPeachModules,
28
32
  swiftSdkPaths,
29
33
  } from './swift-compile'
@@ -51,11 +55,12 @@ import {
51
55
  emitSwiftStandin,
52
56
  isSwiftDeclaration,
53
57
  objcProtocolsInSwiftSignatures,
58
+ type SymbolFragment,
54
59
  type SymbolGraph,
55
60
  type SwiftStandinBehaviors,
56
61
  type StandinBehavior,
57
62
  } from './swift-standin-emit'
58
- import { sourceSwiftCheckout, swiftEnvironment, swiftSdkOptions } from './swift-toolchain'
63
+ import { sourceSwiftCheckout, swiftEnvironment } from './swift-toolchain'
59
64
  import type { SwiftPackageBinary } from './swift-packages'
60
65
 
61
66
  const TRIPLE = 'wasm32-unknown-wasip1'
@@ -252,10 +257,166 @@ function xcframework(binary: SwiftPackageBinary): {
252
257
  export const isBinaryLibraryFile = (file: string): boolean =>
253
258
  /\.(?:a|dylib|o|tbd)$/i.test(file)
254
259
 
260
+ /**
261
+ * the headers a framework's consumers import and the module root that
262
+ * compiles the framework's Swift. a framework whose module the root provides
263
+ * takes that module's `<Module>-Swift.h` for the declarations Swift owns
264
+ * there, as a mixed framework's own interface header does.
265
+ */
266
+ export interface SwiftDeclaredFrameworks {
267
+ moduleRoot: string
268
+ /** the framework headers its consumers import, by framework name. */
269
+ imports: ReadonlyMap<string, ReadonlySet<string>>
270
+ /** the headers the compiled translation units reach, which stage frameworks without Swift. */
271
+ compiledImports: ReadonlyMap<string, ReadonlySet<string>>
272
+ }
273
+
274
+ /**
275
+ * UIKit declarations the sdk header surface does not carry because the Swift
276
+ * UIKitCore module owns them. a staged header that names one gets a private
277
+ * clang typedef, which Swift does not import under the public name.
278
+ */
279
+ const UIKIT_SWIFT_OWNED_TYPEDEFS: Readonly<Record<string, string>> = {
280
+ UIApplicationLaunchOptionsKey:
281
+ 'typedef NSString *UIApplicationLaunchOptionsKey __attribute__((swift_private));',
282
+ UIBackgroundFetchResult:
283
+ 'typedef NSUInteger UIBackgroundFetchResult __attribute__((swift_private));',
284
+ }
285
+
286
+ /**
287
+ * frameworks without Swift declarations that stage by the headers consumers
288
+ * import: React's umbrella imports UIKit headers (UIKeyCommand, UIFontMetrics,
289
+ * UIAccessibilityElement) the sdk's clang UIKit surface does not carry.
290
+ */
291
+ const REACH_STAGED_FRAMEWORKS: ReadonlySet<string> = new Set(['React'])
292
+
293
+ const OBJC_IMPORT = /#\s*(?:import|include)\s*[<"](?:[\w+-]+\/)?([\w+.-]+\.h)[>"]/g
294
+
295
+ /** a header with the definitions Swift owns replaced by an import of its interface header. */
296
+ function withoutSwiftDeclarations(
297
+ text: string,
298
+ declared: ReadonlySet<string>,
299
+ interfaceImport: string,
300
+ ): string {
301
+ const out: string[] = []
302
+ let skipping = false
303
+ let imported = false
304
+ // clang refuses to enter a header inside an assume_nonnull region, so the
305
+ // import goes above the region's start when the declaration sits inside it.
306
+ let regionStart = -1
307
+ for (const line of text.split('\n')) {
308
+ if (skipping) {
309
+ if (/^@end\b/.test(line)) skipping = false
310
+ continue
311
+ }
312
+ if (regionStart < 0 && /^NS_ASSUME_NONNULL_BEGIN\b/.test(line))
313
+ regionStart = out.length
314
+ const name = /^@(?:protocol|interface)\s+(\w+)\s*(?=[:<{]|$)/.exec(line)?.[1]
315
+ if (name && declared.has(name)) {
316
+ skipping = true
317
+ if (!imported)
318
+ out.splice(regionStart < 0 ? out.length : regionStart, 0, interfaceImport)
319
+ imported = true
320
+ continue
321
+ }
322
+ out.push(line)
323
+ }
324
+ return out.join('\n')
325
+ }
326
+
327
+ /**
328
+ * a framework whose module the distribution provides as Swift is staged as a
329
+ * mixed framework: the upstream headers minus the umbrella, with the
330
+ * definitions Swift owns taken from the distribution's interface header, and
331
+ * a module map that lists the headers consumers import with what they pull in.
332
+ * clang builds one module per framework, so a header no consumer reaches
333
+ * (one that needs a system framework this sysroot lacks) stays out of it. the
334
+ * header named for the framework imports every other header, so it stays out
335
+ * too, and a consumer of it is refused as a missing header.
336
+ */
337
+ function stageDeclaredFramework(
338
+ framework: string,
339
+ declared: ReadonlySet<string> | null,
340
+ imports: ReadonlySet<string>,
341
+ destination: string,
342
+ ): void {
343
+ const name = path.basename(framework, '.framework')
344
+ const own = `${name}-Swift.h`
345
+ const modulemap = fs.readFileSync(
346
+ path.join(framework, 'Modules/module.modulemap'),
347
+ 'utf8',
348
+ )
349
+ const umbrella = /umbrella header "([^"]+)"/.exec(modulemap)?.[1]
350
+ if (!umbrella) throw new Error(`${name} module map names no umbrella header`)
351
+ const headers = new Map(
352
+ fs
353
+ .readdirSync(path.join(framework, 'Headers'))
354
+ .filter(
355
+ (file) =>
356
+ file.endsWith('.h') &&
357
+ file !== umbrella &&
358
+ file !== own &&
359
+ file !== `${name}.h`,
360
+ )
361
+ .map((file) => [
362
+ file,
363
+ fs.readFileSync(path.join(framework, 'Headers', file), 'utf8'),
364
+ ]),
365
+ )
366
+ const reached = new Set<string>()
367
+ const reach = (file: string) => {
368
+ const source = headers.get(file)
369
+ if (source === undefined || reached.has(file)) return
370
+ reached.add(file)
371
+ for (const match of source.matchAll(OBJC_IMPORT)) reach(match[1]!)
372
+ }
373
+ for (const file of imports) reach(file)
374
+ const target = path.join(destination, 'frameworks', path.basename(framework))
375
+ fs.mkdirSync(path.join(target, 'Headers'), { recursive: true })
376
+ fs.mkdirSync(path.join(target, 'Modules'))
377
+ // each header is its own submodule, so it sees only what it imports; the
378
+ // umbrella gave them Foundation and UIKit first, and the platform macros
379
+ // that choose UIKit come from Foundation.
380
+ for (const [file, source] of headers) {
381
+ const body = declared
382
+ ? withoutSwiftDeclarations(source, declared, `#import <${name}/${own}>`)
383
+ : source
384
+ const uikit =
385
+ /\bUI[A-Z]\w+/.test(body) && !body.includes('UIKit/UIKit.h')
386
+ ? '#import <UIKit/UIKit.h>\n'
387
+ : ''
388
+ const owned = Object.entries(UIKIT_SWIFT_OWNED_TYPEDEFS)
389
+ .filter(([type]) => new RegExp(`\\b${type}\\b`).test(body))
390
+ .map(([, typedef]) => `${typedef}\n`)
391
+ .join('')
392
+ fs.writeFileSync(
393
+ path.join(target, 'Headers', file),
394
+ `#import <Foundation/Foundation.h>\n${uikit}${owned}${body}`,
395
+ )
396
+ }
397
+ const submodules = [
398
+ ...(declared ? [` module Swift { header "${own}" export * }`] : []),
399
+ ...[...reached]
400
+ .filter((file) => !modulemap.includes(`textual header "${file}"`))
401
+ .sort()
402
+ .map(
403
+ (file) =>
404
+ ` module ${path.basename(file, '.h').replace(/\W/g, '_')} { header "${file}" export * }`,
405
+ ),
406
+ ]
407
+ fs.writeFileSync(
408
+ path.join(target, 'Modules/module.modulemap'),
409
+ modulemap
410
+ .replace(/^\s*umbrella header "[^"]*"\s*\n/m, '')
411
+ .replace(/^\s*module \*\s*\{[^}]*\}\s*\n/m, `${submodules.join('\n')}\n`),
412
+ )
413
+ }
414
+
255
415
  /** stage simulator framework and library headers for original clang units. */
256
416
  export function binaryHeaderSearchPaths(
257
417
  binary: SwiftPackageBinary,
258
418
  root: string,
419
+ declaredFrameworks?: SwiftDeclaredFrameworks,
259
420
  ): { frameworks: string[]; headers: string[] } {
260
421
  const artifact = xcframework(binary)
261
422
  const slice = simulatorSlice(artifact.dir)
@@ -279,16 +440,51 @@ export function binaryHeaderSearchPaths(
279
440
  const headers = libraryHeaders && fs.existsSync(libraryHeaders) ? [libraryHeaders] : []
280
441
  if (headers.length === 0 && frameworks.length === 0)
281
442
  return { frameworks: [], headers: [] }
443
+ const declared = new Map<
444
+ string,
445
+ {
446
+ declared: ReadonlySet<string> | null
447
+ header: string | null
448
+ imports: ReadonlySet<string>
449
+ }
450
+ >()
451
+ for (const framework of frameworks) {
452
+ const name = path.basename(framework, '.framework')
453
+ if (!declaredFrameworks) continue
454
+ const imports = declaredFrameworks.imports.get(name)
455
+ const swift = imports && swiftModuleInterface(declaredFrameworks.moduleRoot, name)
456
+ const compiled = declaredFrameworks.compiledImports.get(name)
457
+ if (swift) declared.set(framework, { ...swift, imports })
458
+ else if (compiled && REACH_STAGED_FRAMEWORKS.has(name))
459
+ declared.set(framework, { declared: null, header: null, imports: compiled })
460
+ }
461
+ // the interface header's bytes change with the module, so the staged
462
+ // directory names the declarations and imports it was cut by, and the
463
+ // header is written into it on every call
464
+ const declaredDigest = createHash('sha256')
465
+ for (const [framework, { declared: names, imports }] of declared)
466
+ declaredDigest
467
+ .update(framework)
468
+ .update([...(names ?? [])].sort().join('\0'))
469
+ .update('\n')
470
+ .update([...imports].sort().join('\0'))
282
471
  const search = path.join(
283
472
  root,
284
473
  'peach-binary-inputs',
285
474
  STANDIN_SOURCE_DIGEST.slice(0, 32),
286
- artifact.digest.slice(0, 32),
475
+ declared.size
476
+ ? `${artifact.digest.slice(0, 32)}-${declaredDigest.digest('hex').slice(0, 16)}`
477
+ : artifact.digest.slice(0, 32),
287
478
  )
288
479
  if (!fs.existsSync(search)) {
289
480
  const pending = `${search}.${process.pid}.tmp`
290
481
  fs.rmSync(pending, { recursive: true, force: true })
291
- for (const framework of frameworks)
482
+ for (const framework of frameworks) {
483
+ const swift = declared.get(framework)
484
+ if (swift) {
485
+ stageDeclaredFramework(framework, swift.declared, swift.imports, pending)
486
+ continue
487
+ }
292
488
  for (const part of ['Headers', 'Modules'])
293
489
  if (fs.existsSync(path.join(framework, part)))
294
490
  fs.cpSync(
@@ -296,6 +492,7 @@ export function binaryHeaderSearchPaths(
296
492
  path.join(pending, 'frameworks', path.basename(framework), part),
297
493
  { recursive: true, dereference: true },
298
494
  )
495
+ }
299
496
  for (const [index, directory] of headers.entries())
300
497
  fs.cpSync(directory, path.join(pending, 'headers', String(index)), {
301
498
  recursive: true,
@@ -317,6 +514,19 @@ export function binaryHeaderSearchPaths(
317
514
  if (!fs.existsSync(search)) throw error
318
515
  }
319
516
  }
517
+ for (const [framework, { header }] of declared) {
518
+ if (header === null) continue
519
+ const name = path.basename(framework, '.framework')
520
+ const staged = path.join(
521
+ search,
522
+ 'frameworks',
523
+ path.basename(framework),
524
+ 'Headers',
525
+ `${name}-Swift.h`,
526
+ )
527
+ if (!fs.existsSync(staged) || fs.readFileSync(staged, 'utf8') !== header)
528
+ fs.writeFileSync(staged, header)
529
+ }
320
530
  return {
321
531
  frameworks: frameworks.length ? [path.join(search, 'frameworks')] : [],
322
532
  headers: headers.map((_, index) => path.join(search, 'headers', String(index))),
@@ -467,7 +677,7 @@ function peachModuleDirs(toolchain: Toolchain, imports: string[]): string[] {
467
677
  'native',
468
678
  '-j',
469
679
  '4',
470
- ...swiftSdkOptions(),
680
+ ...swiftCompileSdkOptions(moduleRoot, toolchainBin),
471
681
  '--swift-sdk',
472
682
  swiftModuleSdk(moduleRoot).wasmSdkId,
473
683
  '-c',
@@ -557,7 +767,12 @@ export function swiftInterfaceForWasm(text: string, cFlags: readonly string[]):
557
767
  const interop = /\s-enable-objc-interop\b/.test(targeted)
558
768
  ? targeted
559
769
  : `${targeted} -enable-objc-interop`
560
- return `${interop} ${cFlags.flatMap((flag) => ['-Xcc', flag]).join(' ')}`
770
+ // raw modules skip the object wrap the toolset's -mllvm sjlj pair aborts in.
771
+ const xcc = [...cFlags, '-Xclang', '-fmodule-format=raw'].flatMap((flag) => [
772
+ '-Xcc',
773
+ flag,
774
+ ])
775
+ return `${interop} ${xcc.join(' ')}`
561
776
  })
562
777
  return retargeted
563
778
  .split('\n')
@@ -589,15 +804,22 @@ function swiftStandin(
589
804
  const wasm = wasmFlags(toolchain, imports)
590
805
  const out = path.join(work, 'graphs')
591
806
  fs.mkdirSync(out, { recursive: true })
592
- // symbolgraph-extract rejects -Xfrontend. the same interop switch is its own flag.
807
+ // symbolgraph-extract rejects -Xfrontend and -Xllvm. the interop switch is its own flag.
593
808
  const symbolgraphWasm: string[] = ['-enable-objc-interop']
594
809
  for (let index = 0; index < wasm.length; index++) {
595
810
  if (wasm[index] === '-Xfrontend' && wasm[index + 1] === '-enable-objc-interop') {
596
811
  index += 1
597
812
  continue
598
813
  }
814
+ if (wasm[index] === '-Xllvm') {
815
+ index += 1
816
+ continue
817
+ }
599
818
  symbolgraphWasm.push(wasm[index]!)
600
819
  }
820
+ // no -Xllvm either, so the -mllvm half of the toolset's sjlj pair never reaches the
821
+ // backend that wraps each clang module as an object; raw modules skip it.
822
+ symbolgraphWasm.push('-Xcc', '-Xclang', '-Xcc', '-fmodule-format=raw')
601
823
  exec(path.join(toolchain.toolchainBin, 'swift-symbolgraph-extract'), [
602
824
  '-module-name',
603
825
  surface.module,
@@ -667,6 +889,7 @@ function placeholderStandin(
667
889
  surface.module,
668
890
  ...surface.flags,
669
891
  ...wasm,
892
+ ...WASM_EH_FLAGS,
670
893
  '-enable-library-evolution',
671
894
  '-emit-module-path',
672
895
  path.join(work, 'interface', `${surface.module}.swiftmodule`),
@@ -791,13 +1014,46 @@ function mixedStandin(
791
1014
  }
792
1015
  }
793
1016
  const provided = new Set(swiftPeachModules(toolchain.moduleRoot))
794
- const imports = [...new Set(swiftImportNames(interfaceText))].filter(
1017
+ const owners = new Set<string>()
1018
+ const graphs = view.graphs.map((graph) => {
1019
+ const own = new Set(graph.symbols.map((symbol) => symbol.identifier.precise))
1020
+ // darwin's Foundation names these bare; the guest keeps them in their owning
1021
+ // modules, and the sdk headers declare the networking types and NSErrorPointer
1022
+ // a second time, which makes the bare name ambiguous
1023
+ const qualify = (fragment: SymbolFragment) => {
1024
+ const owner =
1025
+ fragment.kind === 'typeIdentifier' &&
1026
+ fragment.preciseIdentifier !== undefined &&
1027
+ !own.has(fragment.preciseIdentifier)
1028
+ ? foundationOwnerOf(fragment.spelling)
1029
+ : undefined
1030
+ if (
1031
+ owner === undefined ||
1032
+ (owner !== 'FoundationNetworking' && fragment.spelling !== 'NSErrorPointer')
1033
+ )
1034
+ return fragment
1035
+ owners.add(owner)
1036
+ return { ...fragment, spelling: `${owner}.${fragment.spelling}` }
1037
+ }
1038
+ return {
1039
+ ...graph,
1040
+ symbols: graph.symbols.map((symbol) => ({
1041
+ ...symbol,
1042
+ declarationFragments: symbol.declarationFragments?.map(qualify),
1043
+ functionSignature: symbol.functionSignature && {
1044
+ ...symbol.functionSignature,
1045
+ returns: symbol.functionSignature.returns?.map(qualify),
1046
+ },
1047
+ })),
1048
+ }
1049
+ })
1050
+ const imports = [...new Set([...swiftImportNames(interfaceText), ...owners])].filter(
795
1051
  (module) =>
796
1052
  module !== surface.module && (provided.has(module) || siblings.has(module)),
797
1053
  )
798
1054
  return graphStandin(
799
1055
  surface.module,
800
- view.graphs,
1056
+ graphs,
801
1057
  values,
802
1058
  wasmFlags(toolchain, imports),
803
1059
  binary,
@@ -904,6 +1160,11 @@ function nativeProtocolProperties(
904
1160
  return properties
905
1161
  }
906
1162
 
1163
+ // the sdk toolset passes this to every swiftc compile; raw swiftc does not read the toolset,
1164
+ // and emitting a module aborts without it when the source reaches the wasm exception model.
1165
+ // swift-symbolgraph-extract has no -Xllvm.
1166
+ const WASM_EH_FLAGS = ['-Xllvm', '-wasm-enable-eh']
1167
+
907
1168
  // the wasm target, sdk and peach module search paths a stand-in compiles with.
908
1169
  function wasmFlags(toolchain: Toolchain, imports: string[]): string[] {
909
1170
  const { sysroot, resources, cFlags } = swiftSdkPaths(
@@ -925,6 +1186,10 @@ function wasmFlags(toolchain: Toolchain, imports: string[]): string[] {
925
1186
  // symbolgraph caller translates it.
926
1187
  '-Xfrontend',
927
1188
  '-enable-objc-interop',
1189
+ // the toolset's -Xcc -mllvm -wasm-enable-sjlj lets libc's setjmp import,
1190
+ // and the module build aborts unless its -Xllvm half is passed with it.
1191
+ '-Xllvm',
1192
+ '-wasm-enable-sjlj',
928
1193
  // the intake's darwin/usr/include declares `os` with its explicit
929
1194
  // submodules (os.log), so a vendor interface naming one resolves as the
930
1195
  // ios sdk resolves it; a second `os` map on the path is a redefinition.
@@ -949,6 +1214,12 @@ function objcStandin(
949
1214
  cacheDir,
950
1215
  path.join(work, 'objc'),
951
1216
  )
1217
+ // the modules its headers import carry the types its declarations name; a
1218
+ // module peach does not ship stays unimported and drops what needs it
1219
+ const provided = new Set(swiftPeachModules(toolchain.moduleRoot))
1220
+ const headerModules = view.imports.filter(
1221
+ (name) => !STANDIN_IMPORTS.includes(name) && provided.has(name),
1222
+ )
952
1223
  return graphStandin(
953
1224
  surface.module,
954
1225
  view.graphs,
@@ -958,12 +1229,19 @@ function objcStandin(
958
1229
  toolchain,
959
1230
  work,
960
1231
  behavior,
961
- binary.headerDependencies?.map((dependency) =>
962
- swiftTargetModuleName(dependency.module),
963
- ),
1232
+ [
1233
+ ...new Set([
1234
+ ...headerModules,
1235
+ ...(binary.headerDependencies?.map((dependency) =>
1236
+ swiftTargetModuleName(dependency.module),
1237
+ ) ?? []),
1238
+ ]),
1239
+ ],
964
1240
  )
965
1241
  }
966
1242
 
1243
+ const OBJC_UNREPRESENTABLE =
1244
+ "cannot be marked '@objc' because its type cannot be represented in Objective-C"
967
1245
  const INERT_VALUE =
968
1246
  /missing argument|cannot be constructed|has no member 'init'|no exact matches in call to initializer|cannot convert return expression|does not conform to '|extra argument|takes no arguments|could not be inferred|cannot infer/
969
1247
 
@@ -1028,6 +1306,7 @@ function graphStandin(
1028
1306
  }
1029
1307
  const omit = new Map<string, string>()
1030
1308
  const plain = new Set<string>()
1309
+ const unobjc = new Set<string>()
1031
1310
  const trapped = new Set<string>()
1032
1311
  const file = path.join(work, `${module}.swift`)
1033
1312
  // a source target whose implementation compiles keeps inert bodies, and a
@@ -1045,6 +1324,7 @@ function graphStandin(
1045
1324
  behavior,
1046
1325
  omit,
1047
1326
  plain,
1327
+ unobjc,
1048
1328
  trapped,
1049
1329
  inert,
1050
1330
  imports: [...(placeholder?.peachImports ?? []), ...imports],
@@ -1077,6 +1357,7 @@ function graphStandin(
1077
1357
  '-module-name',
1078
1358
  module,
1079
1359
  ...wasm,
1360
+ ...WASM_EH_FLAGS,
1080
1361
  '-emit-module-path',
1081
1362
  path.join(work, `${module}.swiftmodule`),
1082
1363
  file,
@@ -1090,10 +1371,16 @@ function graphStandin(
1090
1371
  files: { [`${module}.swift`]: source },
1091
1372
  ...(imports.length ? { dependencies: imports } : {}),
1092
1373
  }
1093
- const before = omit.size + plain.size + trapped.size
1374
+ const before = omit.size + plain.size + unobjc.size + trapped.size
1094
1375
  const elsewhere: string[] = []
1095
1376
  for (const match of check.stderr.matchAll(/^(\S+?):(\d+):\d+: error: (.*)$/gm)) {
1096
1377
  const owner = match[1] === file ? owners[Number(match[2]) - 1] : undefined
1378
+ // the guest's protocol for an objc type is a swift protocol, so the
1379
+ // declaration that names it cannot be objc-visible
1380
+ if (owner && match[3]!.includes(OBJC_UNREPRESENTABLE)) {
1381
+ unobjc.add(owner)
1382
+ continue
1383
+ }
1097
1384
  if (owner && swiftPaths.has(owner))
1098
1385
  throw new Error(
1099
1386
  `Swift declaration ${module}.${owner} does not typecheck: ${match[3]}`,
@@ -1110,7 +1397,7 @@ function graphStandin(
1110
1397
  else if (owner) omit.set(owner, `rejected by swiftc: ${match[3]}`)
1111
1398
  else elsewhere.push(match[3]!)
1112
1399
  }
1113
- if (omit.size + plain.size + trapped.size === before)
1400
+ if (omit.size + plain.size + unobjc.size + trapped.size === before)
1114
1401
  throw new Error(
1115
1402
  `its generated source does not typecheck: ${elsewhere.slice(0, 3).join('; ') || check.stderr.trim().slice(0, 400)}`,
1116
1403
  )
@@ -1528,7 +1815,7 @@ function cxxStandin(
1528
1815
  }
1529
1816
  }
1530
1817
 
1531
- const RUST_TARGET = 'wasm32-wasip1'
1818
+ export const RUST_TARGET = 'wasm32-wasip1'
1532
1819
  // directories a crate search never enters: build output and installed deps
1533
1820
  const UNSEARCHED = new Set([
1534
1821
  'node_modules',
@@ -1541,7 +1828,7 @@ const UNSEARCHED = new Set([
1541
1828
 
1542
1829
  // the crate whose static library is `lib<name>.a`: its `[lib] name`, or its
1543
1830
  // package name with dashes as underscores, as cargo names the library.
1544
- function crateFor(root: string, name: string): string | null {
1831
+ export function crateFor(root: string, name: string): string | null {
1545
1832
  const walk = (dir: string, depth: number): string | null => {
1546
1833
  const manifest = path.join(dir, 'Cargo.toml')
1547
1834
  if (fs.existsSync(manifest)) {
@@ -1599,12 +1886,92 @@ function simulatorLibraryName(dir: string): string | undefined {
1599
1886
  .find((name): name is string => typeof name === 'string' && /^lib.+\.a$/.test(name))
1600
1887
  }
1601
1888
 
1889
+ /**
1890
+ * the Rust toolchain the registry's `rust` entries are built with. a host looks
1891
+ * entries up under this release whatever cargo it has, so a host with no wasm
1892
+ * target links the archive the publisher built.
1893
+ */
1894
+ export const RUST_TOOLCHAIN = '1.94.0'
1895
+
1896
+ // the directories a crate's build reads: the workspace that owns its Cargo.lock
1897
+ // plus every path dependency that lies outside it.
1898
+ function crateSourceRoots(manifest: string): string[] {
1899
+ let workspace = path.dirname(manifest)
1900
+ while (!fs.existsSync(path.join(workspace, 'Cargo.lock'))) {
1901
+ const parent = path.dirname(workspace)
1902
+ if (parent === workspace)
1903
+ throw new Error(`${manifest} has no Cargo.lock; the build runs --locked`)
1904
+ workspace = parent
1905
+ }
1906
+ const roots = [workspace]
1907
+ const inside = (dir: string) =>
1908
+ roots.some((root) => !path.relative(root, dir).startsWith('..'))
1909
+ const manifests = (dir: string): string[] =>
1910
+ fs
1911
+ .readdirSync(dir, { withFileTypes: true })
1912
+ .flatMap((entry) =>
1913
+ entry.isDirectory() && !UNSEARCHED.has(entry.name)
1914
+ ? manifests(path.join(dir, entry.name))
1915
+ : entry.name === 'Cargo.toml'
1916
+ ? [path.join(dir, entry.name)]
1917
+ : [],
1918
+ )
1919
+ for (let scanned = 0; scanned < roots.length; scanned++)
1920
+ for (const file of manifests(roots[scanned])) {
1921
+ const text = fs.readFileSync(file, 'utf8')
1922
+ for (const match of text.matchAll(/\bpath\s*=\s*"([^"]+)"/g)) {
1923
+ const dir = path.resolve(path.dirname(file), match[1])
1924
+ if (!inside(dir)) roots.push(dir)
1925
+ }
1926
+ }
1927
+ return roots
1928
+ }
1929
+
1930
+ // a digest of every file under the roots a crate builds from, build output and
1931
+ // installed dependencies aside.
1932
+ function crateSourceDigest(manifest: string): string {
1933
+ const hash = createHash('sha256')
1934
+ const walk = (dir: string, root: string) => {
1935
+ for (const entry of fs
1936
+ .readdirSync(dir, { withFileTypes: true })
1937
+ .sort((left, right) => (left.name < right.name ? -1 : 1))) {
1938
+ const full = path.join(dir, entry.name)
1939
+ if (entry.isDirectory()) {
1940
+ if (!UNSEARCHED.has(entry.name)) walk(full, root)
1941
+ } else if (entry.isFile()) {
1942
+ hash.update(`${path.relative(root, full)}\0`)
1943
+ hash.update(fs.readFileSync(full))
1944
+ hash.update('\0')
1945
+ }
1946
+ }
1947
+ }
1948
+ for (const root of crateSourceRoots(manifest)) {
1949
+ hash.update(`root\0`)
1950
+ walk(root, root)
1951
+ }
1952
+ return hash.digest('hex')
1953
+ }
1954
+
1955
+ /** the registry entry a crate's static library lives under. */
1956
+ export function rustCrateEntry(manifest: string, library: string) {
1957
+ const inputs = {
1958
+ crate: library,
1959
+ source: crateSourceDigest(manifest),
1960
+ target: RUST_TARGET,
1961
+ build: 'release locked',
1962
+ rust: RUST_TOOLCHAIN,
1963
+ rustflags: process.env.RUSTFLAGS ?? '',
1964
+ }
1965
+ return { name: library, inputs, key: nativeEntryKey(inputs) }
1966
+ }
1967
+
1602
1968
  /**
1603
1969
  * the WebAssembly static library a c stand-in links in place of its traps,
1604
1970
  * or null when it has none. a build the developer supplies in the
1605
1971
  * xcframework (`wasm32-wasip1/lib<name>.a`) wins; otherwise the crate under
1606
- * `searchRoot` that builds the slice's library compiles with the developer's
1607
- * own cargo. peach ships no rust compiler.
1972
+ * `searchRoot` that builds the slice's library comes from the registry when
1973
+ * it holds that crate's source and toolchain, else compiles with the
1974
+ * developer's cargo with the registry's pinned toolchain. peach ships no rust compiler.
1608
1975
  */
1609
1976
  export function standinLibrary(
1610
1977
  binary: SwiftPackageBinary,
@@ -1627,6 +1994,18 @@ export function standinLibrary(
1627
1994
  if (!library) return null
1628
1995
  const manifest = crateFor(searchRoot, library.slice('lib'.length, -'.a'.length))
1629
1996
  if (!manifest) return null
1997
+ const entry = rustCrateEntry(manifest, library)
1998
+ const prebuilt = fetchNativeEntry('rust', entry.name, entry.key)
1999
+ if (prebuilt) return path.join(prebuilt, library)
2000
+ return buildRustCrate(manifest, library, searchRoot)
2001
+ }
2002
+
2003
+ /** compiles a crate with the same rust standard library as registry archives. */
2004
+ export function buildRustCrate(
2005
+ manifest: string,
2006
+ library: string,
2007
+ searchRoot: string,
2008
+ ): string {
1630
2009
  const result = spawnSync(
1631
2010
  // runner-toolchain-platform: darwin
1632
2011
  'cargo',
@@ -1644,7 +2023,11 @@ export function standinLibrary(
1644
2023
  ],
1645
2024
  {
1646
2025
  encoding: 'utf8',
1647
- env: { ...process.env, CARGO_HOME: path.join(cacheDir, 'cargo-home') },
2026
+ env: {
2027
+ ...process.env,
2028
+ RUSTUP_TOOLCHAIN: RUST_TOOLCHAIN,
2029
+ CARGO_HOME: path.join(cacheDir, 'cargo-home'),
2030
+ },
1648
2031
  maxBuffer: 256 * 1024 * 1024,
1649
2032
  stdio: ['ignore', 'pipe', 'pipe'],
1650
2033
  },
@@ -1659,7 +2042,7 @@ export function standinLibrary(
1659
2042
  /target may not be installed|can't find crate for `(core|std)`/.test(result.stderr)
1660
2043
  )
1661
2044
  throw new Error(
1662
- `${crate} builds for ${RUST_TARGET}, which this rust lacks; run \`rustup target add ${RUST_TARGET}\`, then run again`,
2045
+ `${crate} builds for ${RUST_TARGET}, which Rust ${RUST_TOOLCHAIN} lacks; run \`rustup target add --toolchain ${RUST_TOOLCHAIN} ${RUST_TARGET}\`, then run again`,
1663
2046
  )
1664
2047
  throw new Error(
1665
2048
  `cargo could not build ${crate} for ${RUST_TARGET}: ${failure(result)}`,
@@ -2359,6 +2742,7 @@ export function swiftStandins(
2359
2742
  '-module-name',
2360
2743
  standin.module,
2361
2744
  ...wasmFlags(generatedToolchain, swiftImportNames(source)),
2745
+ ...WASM_EH_FLAGS,
2362
2746
  '-emit-module-path',
2363
2747
  path.join(modules, `${standin.module}.swiftmodule`),
2364
2748
  file,
@@ -121,7 +121,19 @@ export const MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024
121
121
  // 51: PDFKit asks the PDF host for one page's glyph spans on demand.
122
122
  // 52: the PDFKit inspection reply reports a password-locked document as
123
123
  // `{ok: true, locked: true}`, distinct from bytes the parser rejects.
124
- export const SWIFT_HOST_ABI = 52
124
+ // 53: block-backed IMP signature keys can carry compiler-emitted invoke roles.
125
+ // 54: `rnx.draw_text` lays attributed runs out and answers premultiplied rgba.
126
+ // 55: NSInvocation calls IMPs of any encoding through host-minted callers
127
+ // (`peach.imp_caller_mint`).
128
+ // 56: peach.ios_version_at_least answers a guest's iOS availability query
129
+ // from the simulated device's iOS version.
130
+ // 57: shape sublayers paint as `UIKitShape` path nodes.
131
+ // 58: `peach.permission_status` slot 7 answers speech recognition, and the
132
+ // `speechAuthorization` request asks for it.
133
+ // 59: `peach.idle_timer_disabled` moves the screen wake lock behind
134
+ // UIApplication.isIdleTimerDisabled.
135
+ // 60: `peach.net_en0_ipv4` answers the en0 IPv4 address getifaddrs lists.
136
+ export const SWIFT_HOST_ABI = 60
125
137
 
126
138
  export interface SwiftImageUpload {
127
139
  /** the raster file picked for the asset (has the extension). */
@@ -254,6 +266,8 @@ export type SwiftCompileSubmit = (work: {
254
266
  /** project-relative resource paths used to associate implicit resources with targets. */
255
267
  resourcePaths?: string[]
256
268
  resourceBundles?: SwiftResourceBundle[]
269
+ /** the Xcode app project's development region, for the emitted manifest's default localization. */
270
+ defaultLocalization?: string
257
271
  /** the photo rasters to publish; absent means the project packs none. */
258
272
  images?: Record<string, SwiftImageUpload>
259
273
  entry: string
@@ -425,6 +439,8 @@ export async function compileSwiftProject(
425
439
  /** project-relative resource paths used to associate implicit resources with targets. */
426
440
  resourcePaths?: string[]
427
441
  resourceBundles?: SwiftResourceBundle[]
442
+ /** the Xcode app project's development region, for the emitted manifest's default localization. */
443
+ defaultLocalization?: string
428
444
  images?: Record<string, SwiftImageUpload>
429
445
  entry: string
430
446
  packageId: string