peachsim 0.1.2935 → 0.1.2937

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 (345) hide show
  1. package/LICENSE +6 -8
  2. package/cli/account-gate.ts +20 -3
  3. package/cli/app-bundle-resources.ts +66 -19
  4. package/cli/catalog/meta.ts +2 -106
  5. package/cli/command-agent.ts +7 -0
  6. package/cli/command-registry.ts +0 -1
  7. package/cli/commands/control.ts +13 -5
  8. package/cli/commands/daemon.ts +4 -2
  9. package/cli/commands/device.ts +78 -8
  10. package/cli/commands/do-chain.ts +11 -8
  11. package/cli/commands/inspect/core.ts +4 -9
  12. package/cli/commands/inspect/settling.ts +1 -0
  13. package/cli/commands/logout.ts +6 -1
  14. package/cli/commands/map.ts +2 -6
  15. package/cli/commands/package.ts +112 -57
  16. package/cli/commands/shell-url.ts +0 -1
  17. package/cli/download-auth.ts +2 -0
  18. package/cli/drivers/playwright-provisioning.ts +10 -38
  19. package/cli/github-workflow-identity.ts +8 -0
  20. package/cli/internal-child-contract.ts +1 -0
  21. package/cli/internal-child.ts +5 -0
  22. package/cli/main.ts +2 -10
  23. package/cli/outbound-endpoints.ts +26 -0
  24. package/detox/index.ts +227 -131
  25. package/dist-lib/agent-daemon-client.cjs +1 -1
  26. package/dist-lib/agent-events.cjs +1 -1
  27. package/dist-lib/attached-projects.cjs +1 -1
  28. package/dist-lib/auth/shared-session.cjs +1 -1
  29. package/dist-lib/backend-origin.cjs +1 -1
  30. package/dist-lib/beta.cjs +1 -1
  31. package/dist-lib/beta.mjs +2 -2
  32. package/dist-lib/bridge-constants.cjs +1 -1
  33. package/dist-lib/bridge-contract-input.cjs +47 -3
  34. package/dist-lib/bridge-contract-input.mjs +6 -6
  35. package/dist-lib/bridge-contract.cjs +10 -1
  36. package/dist-lib/bridge-contract.mjs +3 -3
  37. package/dist-lib/bundle-channel.cjs +12779 -9515
  38. package/dist-lib/capture-contract.cjs +39 -17
  39. package/dist-lib/capture-contract.mjs +3 -3
  40. package/dist-lib/cloud-contract.cjs +1 -1
  41. package/dist-lib/cloud-contract.mjs +3 -3
  42. package/dist-lib/cloud-test-args.cjs +1 -1
  43. package/dist-lib/cloud-test-args.mjs +2 -2
  44. package/dist-lib/cloud.cjs +1 -1
  45. package/dist-lib/cloud.mjs +8 -8
  46. package/dist-lib/config.cjs +1 -1
  47. package/dist-lib/config.mjs +6 -6
  48. package/dist-lib/detox/index.cjs +200 -132
  49. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  50. package/dist-lib/esm-chunks/{acorn-Q5TRRYSO.mjs → acorn-IIBLEO25.mjs} +3 -3
  51. package/dist-lib/esm-chunks/{chunk-UDWBTBVG.mjs → chunk-4FTPQKPT.mjs} +10 -1
  52. package/dist-lib/esm-chunks/chunk-4WIDTRBB.mjs +10232 -0
  53. package/dist-lib/esm-chunks/{chunk-LCMFYMT7.mjs → chunk-5QZOQ3NZ.mjs} +1 -1
  54. package/dist-lib/esm-chunks/{chunk-BJ2OGUX7.mjs → chunk-CIY67HNL.mjs} +39 -17
  55. package/dist-lib/esm-chunks/{chunk-SKQTNQYE.mjs → chunk-CQFEMJ64.mjs} +1 -1
  56. package/dist-lib/esm-chunks/{chunk-AXWVXRHX.mjs → chunk-CWVMCW23.mjs} +1 -1
  57. package/dist-lib/esm-chunks/{chunk-MTALOHQR.mjs → chunk-F6DZ4DS2.mjs} +1 -1
  58. package/dist-lib/esm-chunks/{chunk-I4R7IZRD.mjs → chunk-HJMF6O7L.mjs} +74 -46
  59. package/dist-lib/esm-chunks/chunk-I6T4PXJF.mjs +154 -0
  60. package/dist-lib/esm-chunks/{chunk-XWAUZKIA.mjs → chunk-IJU3JMWM.mjs} +1 -1
  61. package/dist-lib/esm-chunks/{chunk-CXWUIOCH.mjs → chunk-KODEPXQC.mjs} +4 -4
  62. package/dist-lib/esm-chunks/{chunk-WJE5QHSD.mjs → chunk-LD4K2VBL.mjs} +155 -36
  63. package/dist-lib/esm-chunks/{chunk-2TSM64HI.mjs → chunk-LTE7YMEG.mjs} +1 -1
  64. package/dist-lib/esm-chunks/{chunk-3GGOXUJA.mjs → chunk-M3CSKAJE.mjs} +1 -1
  65. package/dist-lib/esm-chunks/{chunk-7G5UETIG.mjs → chunk-NA6DJPB6.mjs} +43 -1
  66. package/dist-lib/esm-chunks/{chunk-MSUHMNAI.mjs → chunk-NNAX24FS.mjs} +1 -1
  67. package/dist-lib/esm-chunks/{chunk-VDJA4LP4.mjs → chunk-PZPJJBAS.mjs} +1 -1
  68. package/dist-lib/esm-chunks/{chunk-UEEEJVQA.mjs → chunk-QXSTHMWN.mjs} +1 -1
  69. package/dist-lib/esm-chunks/{chunk-S2RJB5I7.mjs → chunk-RBPVK5YI.mjs} +1 -1
  70. package/dist-lib/esm-chunks/{chunk-VRAXNGYT.mjs → chunk-SCT5OFDV.mjs} +1 -1
  71. package/dist-lib/esm-chunks/{chunk-T3M73LGP.mjs → chunk-U3CJGYSP.mjs} +50 -6
  72. package/dist-lib/esm-chunks/{chunk-SLUGTGQQ.mjs → chunk-VXTOQ522.mjs} +12 -6
  73. package/dist-lib/esm-chunks/{chunk-EL44SZMV.mjs → chunk-WMSVGYTH.mjs} +1 -1
  74. package/dist-lib/esm-chunks/{chunk-FEDEPSEV.mjs → chunk-WRWINRWK.mjs} +1 -1
  75. package/dist-lib/esm-chunks/{chunk-BNO52N2S.mjs → chunk-YZF2USRD.mjs} +1905 -8760
  76. package/dist-lib/esm-chunks/{chunk-TQLKYMVP.mjs → chunk-ZNHR6C3L.mjs} +1 -1
  77. package/dist-lib/esm-chunks/{download-auth-registry-G75MIT55.mjs → download-auth-registry-AHS5MSIB.mjs} +4 -4
  78. package/dist-lib/esm-chunks/{metro-layout-parser-FXLUDTYT.mjs → metro-layout-parser-24ZYK5UP.mjs} +3 -3
  79. package/dist-lib/esm-chunks/{swift-package-prebuilt-524D4MA2.mjs → swift-package-prebuilt-L4YNXQRD.mjs} +15 -15
  80. package/dist-lib/esm-chunks/{swift-sdk-app-module-EX544YJY.mjs → swift-sdk-app-module-RM652JSW.mjs} +87 -71
  81. package/dist-lib/esm-chunks/{swift-sdk-image-LOTMWVM7.mjs → swift-sdk-image-5PQ44UJT.mjs} +15 -15
  82. package/dist-lib/esm-chunks/{swift-sdk-image-producer-UO6B3M4U.mjs → swift-sdk-image-producer-GD3SM6YI.mjs} +5 -5
  83. package/dist-lib/esm-chunks/swift-sdk-later-data-62QYJ2KH.mjs +590 -0
  84. package/dist-lib/expo-swift-bundle.cjs +21037 -17896
  85. package/dist-lib/expo-swift-metadata.cjs +8 -2
  86. package/dist-lib/expo-swift-metadata.mjs +9 -8
  87. package/dist-lib/home-paths.cjs +1 -1
  88. package/dist-lib/host/bridge-host.cjs +22481 -18741
  89. package/dist-lib/host/fetch-proxy-handler.cjs +21079 -17980
  90. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  91. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  92. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  93. package/dist-lib/host/websocket-proxy.cjs +1 -1
  94. package/dist-lib/index.cjs +68 -38
  95. package/dist-lib/kotlin-host.cjs +97 -21
  96. package/dist-lib/menu.cjs +1 -1
  97. package/dist-lib/menu.mjs +3 -3
  98. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  99. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  100. package/dist-lib/metro-production-bundle.cjs +23 -1
  101. package/dist-lib/metro-production-bundle.mjs +24 -4
  102. package/dist-lib/native-app-identity-project.cjs +3582 -571
  103. package/dist-lib/native-app-identity-project.mjs +1024 -398
  104. package/dist-lib/native-app-identity.cjs +1 -1
  105. package/dist-lib/native-app-identity.mjs +6 -6
  106. package/dist-lib/native-firebase-metadata.cjs +1 -1
  107. package/dist-lib/native-firebase-metadata.mjs +3 -3
  108. package/dist-lib/pdfium-raster.cjs +1 -1
  109. package/dist-lib/pdfium-raster.mjs +2 -2
  110. package/dist-lib/plist.cjs +1 -1
  111. package/dist-lib/plist.mjs +3 -3
  112. package/dist-lib/profiles.cjs +1 -1
  113. package/dist-lib/public-brand.cjs +1 -1
  114. package/dist-lib/public-origins-lib-esm.json +132 -116
  115. package/dist-lib/public-origins-lib.json +215 -173
  116. package/dist-lib/react-native-host-modules.cjs +1 -1
  117. package/dist-lib/react-native-host-modules.mjs +2 -2
  118. package/dist-lib/reap-browser.cjs +17 -1
  119. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  120. package/dist-lib/sdk.cjs +6 -7
  121. package/dist-lib/sdk.mjs +13 -14
  122. package/dist-lib/skills.cjs +23216 -19650
  123. package/dist-lib/swift-compile.cjs +4337 -2905
  124. package/dist-lib/swift-compile.mjs +15 -13
  125. package/dist-lib/swift-package.cjs +1 -1
  126. package/dist-lib/swift-package.mjs +3 -3
  127. package/dist-lib/swift-submit.cjs +1 -1
  128. package/dist-lib/swift-submit.mjs +6 -6
  129. package/dist-lib/swift-svg-raster.cjs +1 -1
  130. package/dist-lib/swift-svg-raster.mjs +2 -2
  131. package/dist-lib/swift-toolchain.cjs +19 -1
  132. package/dist-lib/swift.cjs +1 -1
  133. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  134. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  135. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  136. package/dist-lib/vendor/acorn.cjs +1 -1
  137. package/dist-lib/vendor/stream-json.cjs +1 -1
  138. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  139. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  140. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  141. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  142. package/dist-lib/vendor/sucrase.cjs +1 -1
  143. package/dist-lib/vendor/terser.cjs +1 -1
  144. package/dist-lib/vendor/valibot.cjs +1 -1
  145. package/dist-lib/vendor/ws.cjs +94 -32
  146. package/dist-lib/vendor/zod.cjs +1 -1
  147. package/dist-lib/worklet-executable.cjs +8 -5
  148. package/dist-lib/worklet-executable.mjs +9 -6
  149. package/dist-types/packages/peach-engine/src/canvaskit-artifact-urls.d.ts +2 -1
  150. package/dist-types/packages/peach-engine/src/capture/compositor-presentation-recording.d.ts +1 -0
  151. package/dist-types/packages/peach-engine/src/engine/generated/canvaskit-artifact-hashes.d.ts +26 -0
  152. package/dist-types/packages/peach-engine/src/engine/guest-scene-inspect.d.ts +1 -1
  153. package/dist-types/packages/peach-engine/src/engine/inspect-info.d.ts +1 -0
  154. package/dist-types/packages/peach-engine/src/engine/metalTypes.d.ts +32 -2
  155. package/dist-types/packages/peach-engine/src/engine/portalContract.d.ts +24 -0
  156. package/dist-types/packages/peach-engine/src/engine/remote-display-protocol.d.ts +12 -2
  157. package/dist-types/packages/peach-engine/src/guest/http-cookie-storage.d.ts +73 -0
  158. package/dist-types/packages/peach-engine/src/guest/native-evaluation-lease.d.ts +5 -0
  159. package/dist-types/packages/peach-engine/src/guest/nitro-jsi-host.d.ts +3 -1
  160. package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +225 -9
  161. package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +4 -1
  162. package/dist-types/packages/peach-engine/src/ios/duo-vertical-bar-geometry.d.ts +0 -1
  163. package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +1 -0
  164. package/dist-types/packages/peach-engine/src/remote-stream/canvas-display-compositor.d.ts +1 -0
  165. package/dist-types/packages/peach-engine/src/remote-stream/canvas-display-contract.d.ts +44 -10
  166. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +4 -3
  167. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +2 -4
  168. package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +2 -0
  169. package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +1 -1
  170. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +15 -27
  171. package/dist-types/packages/peach-engine/src/render-worker/reanimated-readiness.d.ts +2 -6
  172. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +11 -3
  173. package/dist-types/packages/peach-engine/src/settings/devices.d.ts +3 -1
  174. package/dist-types/packages/peach-engine/src/settings/duo-fold.d.ts +1 -1
  175. package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +1 -1
  176. package/dist-types/packages/peach-globals/src/app-bundle-resources.d.ts +10 -0
  177. package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +1 -1
  178. package/dist-types/packages/peach-globals/src/hostStorageBridgeContract.d.ts +1 -0
  179. package/dist-types/packages/peach-globals/src/index.d.ts +2 -2
  180. package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +9 -6
  181. package/dist-types/packages/peach-globals/src/nodeContract.d.ts +11 -0
  182. package/dist-types/packages/peach-globals/src/oneWidgetContract.d.ts +28 -0
  183. package/package.json +2 -2
  184. package/runtime-companion.json +1 -1
  185. package/sdk/ios/System/Library/Frameworks/CoreHaptics.framework/Headers/CoreHaptics.h +251 -0
  186. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INImage.h +14 -0
  187. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntent.h +18 -0
  188. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntentIdentifiers.h +30 -0
  189. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntentResponse.h +12 -0
  190. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INInteraction.h +35 -0
  191. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INObjectCollection.h +0 -7
  192. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INObjectSection.h +0 -7
  193. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INOutgoingMessageType.h +7 -0
  194. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INPerson.h +36 -0
  195. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INPersonHandle.h +22 -0
  196. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSendMessageIntent+UserNotifications.h +6 -0
  197. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSendMessageIntent.h +33 -0
  198. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSpeakableString.h +24 -0
  199. package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/Intents.h +11 -7
  200. package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeViewController.h +1 -1
  201. package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController.h +1 -1
  202. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h +0 -8
  203. package/sdk/ios/System/Library/Frameworks/MetalTypes.framework/Headers/MetalTypes.h +8 -0
  204. package/sdk/ios/System/Library/Frameworks/Social.framework/Headers/SLServiceTypes.h +9 -0
  205. package/sdk/ios/System/Library/Frameworks/Social.framework/Headers/Social.h +1 -0
  206. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotification.h +1 -1
  207. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAction.h +2 -2
  208. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAttachment.h +1 -1
  209. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationCategory.h +1 -1
  210. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationContent.h +2 -2
  211. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationRequest.h +1 -1
  212. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationResponse.h +2 -2
  213. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationSound.h +1 -1
  214. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationTrigger.h +5 -5
  215. package/sdk/ios/usr/lib/swift/UIKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
  216. package/sdk/ios/wasm/include/unistd.h +1 -0
  217. package/src/acorn-program.ts +3 -0
  218. package/src/audio-codec-archives.ts +141 -0
  219. package/src/bridge-contract-input.ts +61 -1
  220. package/src/bridge-contract.ts +45 -4
  221. package/src/bundle-channel.mjs +44 -30
  222. package/src/capture-contract.ts +57 -39
  223. package/src/conformance-comparison-contract.ts +2 -0
  224. package/src/expo-discovery-cache.ts +0 -2
  225. package/src/expo-macro-host.ts +8 -3
  226. package/src/expo-native-compiler-digest.ts +0 -1
  227. package/src/expo-native-prebuilt.ts +1 -1
  228. package/src/expo-native-workspace.ts +83 -45
  229. package/src/expo-pod-prebuilt.ts +1 -0
  230. package/src/expo-swift-host.ts +158 -77
  231. package/src/expo-swift-legacy-runtime-source.ts +12 -1
  232. package/src/expo-swift-view-source.ts +51 -20
  233. package/src/expo-workspace-exclusion.ts +7 -1
  234. package/src/expoSwiftContract.ts +10 -1
  235. package/src/ffmpeg-source-build.ts +123 -59
  236. package/src/genrule-archives.ts +7 -2
  237. package/src/genrule-library-builds.ts +101 -18
  238. package/src/host/bridge-host.ts +10 -1
  239. package/src/installed-native-libraries.ts +147 -23
  240. package/src/installed-package-versions.ts +30 -0
  241. package/src/ios-rn-bundle-request.ts +3 -1
  242. package/src/ios-rn-bundle.ts +38 -27
  243. package/src/ios-rn-compile.ts +23 -6
  244. package/src/ios-rn-startup.ts +2 -1
  245. package/src/java-module-abi.ts +4 -3
  246. package/src/kotlin-host.ts +4 -4
  247. package/src/kotlin-library-sources.ts +8 -5
  248. package/src/metro-production-bundle.ts +24 -0
  249. package/src/native-firebase-config.ts +2 -0
  250. package/src/native-framework-compiler.ts +5 -0
  251. package/src/native-package-slice-build.ts +3 -0
  252. package/src/native-package-slice.ts +15 -10
  253. package/src/native-preparation.ts +4 -1
  254. package/src/native-static-libraries.ts +107 -33
  255. package/src/nativeRuntimePackageIndex.ts +1 -4
  256. package/src/nitro-adapter.lock.json +286 -286
  257. package/src/nitro-app-providers.ts +20 -8
  258. package/src/nitro-compile.ts +131 -37
  259. package/src/nitro-dependencies.ts +42 -8
  260. package/src/nitro-source.ts +40 -36
  261. package/src/nitro-superset.lock.json +4 -4
  262. package/src/nitroAdapterContract.ts +32 -7
  263. package/src/nitroContract.ts +21 -37
  264. package/src/one-direct-host-source.ts +247 -140
  265. package/src/one-fabric.ts +129 -0
  266. package/src/one-native-controls-package.ts +95 -21
  267. package/src/one-native-controls-release.ts +147 -14
  268. package/src/one-native-source.ts +4 -1
  269. package/src/one-nitro-inputs.ts +1 -1
  270. package/src/one-nitro-source.ts +45 -1
  271. package/src/one-sdk/source.ts +10 -41
  272. package/src/one-widget-metadata.ts +2 -2
  273. package/src/one-widget-package.ts +1 -1
  274. package/src/oneSdkContract.ts +3 -0
  275. package/src/playwright-browser-paths.ts +30 -0
  276. package/src/pods-install.ts +6 -2
  277. package/src/pods-post-install.ts +2 -2
  278. package/src/pods-project.ts +10 -0
  279. package/src/podspec-ruby-stdlib.ts +73 -0
  280. package/src/podspec-ruby.ts +1 -1
  281. package/src/podspec-sources.ts +31 -13
  282. package/src/process-group.ts +135 -5
  283. package/src/published-swift-sdk.ts +25 -1
  284. package/src/react-native-bridge-modules.ts +35 -3
  285. package/src/react-native-core-build.ts +14 -2
  286. package/src/react-native-core.ts +12 -2
  287. package/src/rive-runtime-dependencies.ts +178 -40
  288. package/src/serverDiscoveryContract.ts +1 -1
  289. package/src/storageSnapshotContract.ts +1 -1
  290. package/src/swift-app-data-store.ts +35 -0
  291. package/src/swift-compile.ts +403 -121
  292. package/src/swift-compiler-digest.ts +4 -0
  293. package/src/swift-darwin-records.ts +6 -0
  294. package/src/swift-distribution-mirror.ts +10 -1
  295. package/src/swift-distribution.lock.json +19 -18
  296. package/src/swift-distribution.ts +17 -1
  297. package/src/swift-entry-module.ts +1 -0
  298. package/src/swift-guest-compile.ts +8 -1
  299. package/src/swift-host.ts +79 -23
  300. package/src/swift-installed-targets.ts +51 -20
  301. package/src/swift-objc-standin.ts +60 -8
  302. package/src/swift-packages.ts +104 -24
  303. package/src/swift-project-user.ts +2 -1
  304. package/src/swift-reproducible.ts +99 -1
  305. package/src/swift-root-lock.ts +52 -46
  306. package/src/swift-sdk-app-module.ts +65 -13
  307. package/src/swift-sdk-image-producer.ts +2 -1
  308. package/src/swift-sdk-image.ts +23 -8
  309. package/src/swift-sdk-later-data.ts +294 -44
  310. package/src/swift-sdk-surface.ts +233 -55
  311. package/src/swift-shared-sdk.ts +7 -0
  312. package/src/swift-standin-builtin-behavior.ts +18 -0
  313. package/src/swift-standin-emit.ts +242 -54
  314. package/src/swift-standins.ts +184 -38
  315. package/src/swift-startup-split.ts +19 -9
  316. package/src/swift-toolchain.ts +18 -0
  317. package/src/swift-wasm-prune.ts +179 -9
  318. package/src/swift-xcframework.ts +16 -0
  319. package/src/swiftContract.ts +4 -1
  320. package/src/swiftSdkLinkContract.ts +2 -0
  321. package/src/swiftTargetContract.ts +1 -0
  322. package/src/turbo-bundle.ts +6 -3
  323. package/src/turbo-codegen-intake.ts +106 -16
  324. package/src/turbo-compile.ts +89 -68
  325. package/src/turbo-fabric-app.ts +287 -23
  326. package/src/turbo-provider-host.ts +122 -31
  327. package/src/turbo-runtime.lock.json +26 -26
  328. package/src/turbo-source.ts +374 -157
  329. package/src/vite-plugin.ts +48 -112
  330. package/src/wasm-binary-sections.ts +40 -0
  331. package/src/wasm-code-immediates.ts +35 -5
  332. package/src/widget-extension-bundle.ts +15 -1
  333. package/src/worklet-executable.ts +2 -1
  334. package/src/worklet-kernel.ts +5 -3
  335. package/src/worklets-babel.ts +2 -1
  336. package/src/xcode-project.ts +151 -53
  337. package/src/xcode-scheme-actions.ts +104 -0
  338. package/cli/commands/canvas.ts +0 -1204
  339. package/dist-lib/esm-chunks/chunk-B5QD2KEV.mjs +0 -2787
  340. package/dist-lib/vendor/magic-string.cjs +0 -1693
  341. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +0 -127
  342. package/src/appBundleResourcesContract.ts +0 -51
  343. package/src/canvas-groups.ts +0 -28
  344. package/src/canvas-map-layout.ts +0 -161
  345. package/src/oneWidgetContract.ts +0 -134
@@ -9,7 +9,6 @@ import os from 'node:os'
9
9
  import path from 'node:path'
10
10
  import { fileURLToPath } from 'node:url'
11
11
  import { promisify } from 'node:util'
12
- import { EXPO_EAGER_NATIVE_VIEWS } from '../../peach-compat/src/stubs/native-seams/expo-eager-seam-contract'
13
12
  import { resolveAppProject } from '../cli/app-project'
14
13
  import { peachAnsweredNativePackages } from './answeredNativePackages'
15
14
  import { loadRNXAppConfig, withConfiguredNativeSources } from './app-config'
@@ -102,10 +101,11 @@ import {
102
101
  type SwiftPackageTarget,
103
102
  } from './swift-package'
104
103
  import { swiftRootLocksDir } from './swift-root-lock'
105
- import { swiftDistributionAt } from './swift-sdk-surface'
104
+ import { swiftConditionalLines, swiftDistributionAt } from './swift-sdk-surface'
106
105
  import { standinGenerationInputs, swiftStandins } from './swift-standins'
107
106
  import { MAX_SWIFT_COMPILE_FILES, MAX_SWIFT_COMPILE_SOURCE_BYTES } from './swift-submit'
108
107
  import { swiftCacheDir } from './swift-toolchain'
108
+ import { includesNativeArchiveHeader } from './swift-xcframework'
109
109
  import { SWIFT_NATIVE_INPUT_ROOT, type SwiftHeaderAliases } from './swiftContract'
110
110
  import { RENDERER_DEPENDENCY_PODS } from './turbo-codegen-intake'
111
111
  import { readReactNativeModuleManagerABI } from './turbo-provider-host'
@@ -729,11 +729,7 @@ function configuredExpoSwiftModule(
729
729
  if (names.length > 1) return false
730
730
  const name = registrationName ?? names[0]?.[1]
731
731
  if (!name) return false
732
- const builtInView =
733
- config?.nativeModules?.[name] === false
734
- ? undefined
735
- : EXPO_EAGER_NATIVE_VIEWS.get(name)
736
- if (!config?.nativeModules?.[name] && !builtInView) return false
732
+ if (!config?.nativeModules?.[name]) return false
737
733
  const views = [
738
734
  ...mask.matchAll(/\bView\s*\(\s*([A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*)\.self\s*\)/g),
739
735
  ]
@@ -741,7 +737,6 @@ function configuredExpoSwiftModule(
741
737
  return views.every(
742
738
  (view) =>
743
739
  Boolean(config?.nativeViews?.[`${name}_${view[1]!.split('.').pop()!}`]) ||
744
- builtInView === `${name}_${view[1]!.split('.').pop()!}` ||
745
740
  (views.length === 1 && Boolean(config?.nativeViews?.[name])),
746
741
  )
747
742
  }
@@ -754,16 +749,45 @@ const expoJsiInterfaceFlags = new Set([
754
749
  '-no-verify-emitted-module-interface',
755
750
  ])
756
751
 
757
- export function expoSwiftRequiresSourceCore(files: Record<string, string>): boolean {
758
- return Object.entries(files).some(
759
- ([file, source]) =>
760
- file.endsWith('.swift') &&
761
- /@(?:ExpoModulesCore\.)?(?:ExpoModule|SharedObject|JS)\b|\bExpoSwiftUI\s*\.|\bEmbeddedFingerprint\b/.test(
762
- swiftCodeMask(source),
763
- ),
752
+ // the legacy Objective-C surface the SDK's ExpoModulesCore serves (Sources/ExpoModulesCore/
753
+ // LegacyModuleRegistry.swift and LegacyInterfaces.swift); any other core header needs the installed core.
754
+ const SDK_EXPO_CORE_OBJC_HEADERS = new Set([
755
+ 'EXDefines.h',
756
+ 'Platform.h',
757
+ 'EXUtilities.h',
758
+ 'EXInternalModule.h',
759
+ 'EXConstantsInterface.h',
760
+ 'EXSingletonModule.h',
761
+ 'ExpoModulesCore.h',
762
+ ])
763
+
764
+ function needsInstalledCore(source: string): boolean {
765
+ return (
766
+ /@import\s+ExpoModulesCore\s*;/.test(source) ||
767
+ [
768
+ ...source.matchAll(/#\s*(?:import|include)\s*[<"]ExpoModulesCore\/([^>"]+)[>"]/g),
769
+ ].some(([, header]) => !SDK_EXPO_CORE_OBJC_HEADERS.has(header!))
764
770
  )
765
771
  }
766
772
 
773
+ export function expoSwiftRequiresSourceCore(
774
+ files: Record<string, string>,
775
+ defines?: ReadonlySet<string>,
776
+ ): boolean {
777
+ const references =
778
+ /@(?:ExpoModulesCore\.)?(?:ExpoModule|SharedObject|JS)\b|\bExpoSwiftUI\s*\.|\bEmbeddedFingerprint\b/
779
+ return Object.entries(files).some(([file, source]) => {
780
+ if (!file.endsWith('.swift') || !references.test(source)) return false
781
+ const active = defines
782
+ ? Array.from(
783
+ swiftConditionalLines(source, undefined, defines),
784
+ ({ line, active }) => (active === false ? '' : line),
785
+ ).join('\n')
786
+ : swiftCodeMask(source)
787
+ return references.test(active)
788
+ })
789
+ }
790
+
767
791
  function enrichInstalledUnits(
768
792
  units: ExpoSwiftSourceUnit[],
769
793
  installed: Awaited<ReturnType<typeof installedWorkspaceInput>>,
@@ -814,9 +838,7 @@ function enrichInstalledUnits(
814
838
  return (
815
839
  (implementations.length > 0 &&
816
840
  [...implementations, ...(target?.publicHeaders ?? [])].some((file) =>
817
- /(?:^\s*EX_REGISTER_(?:SINGLETON_)?MODULE\b|#\s*(?:import|include)\s*[<"]ExpoModulesCore\/|@import\s+ExpoModulesCore\s*;)/m.test(
818
- installed.input.files[file] ?? '',
819
- ),
841
+ needsInstalledCore(installed.input.files[file] ?? ''),
820
842
  )) ||
821
843
  (importedTargets.get(name) ?? []).some(importsNativeCore)
822
844
  )
@@ -859,9 +881,25 @@ function enrichInstalledUnits(
859
881
  : undefined
860
882
  const registryAbi = {
861
883
  legacyRuntime,
884
+ // Swift rejects an implicit import beside a file that gives the same module an explicit level
885
+ internalReactImport: installedSources.some(
886
+ ([file, source]) =>
887
+ sourceCore !== undefined &&
888
+ file.startsWith(`${sourceCore.path}/`) &&
889
+ file.endsWith('.swift') &&
890
+ /^[ \t]*(?:@\w+[ \t]+)*(?:internal|package|fileprivate|private)[ \t]+import[ \t]+React\b/m.test(
891
+ source,
892
+ ),
893
+ ),
862
894
  hasLegacyModuleRegistry:
863
895
  appContext?.includes('var legacyModuleRegistry: EXModuleRegistry?') ?? false,
864
896
  shadowNodeOwner,
897
+ hasShadowNodeStyleSize: /\bvar\s+setStyleSize\s*:/.test(
898
+ declaration(sourceCore, 'SwiftUIShadowNodeProxy.swift') ?? '',
899
+ ),
900
+ fabricViewConditional: /^\s*#if\s+RCT_NEW_ARCH_ENABLED\b/m.test(
901
+ declaration(sourceCore, 'ExpoFabricView.swift') ?? '',
902
+ ),
865
903
  hasJsiModule: sourceJsi !== undefined,
866
904
  jsiHasDrain:
867
905
  declaration(sourceJsi, 'JavaScriptRuntime.swift')?.includes(
@@ -926,9 +964,10 @@ function enrichInstalledUnits(
926
964
  const owner = byPath.find((target) => file.startsWith(`${target.path}/`))
927
965
  if (owner) reactTargets.add(owner.name)
928
966
  }
967
+ // a module the SDK provides links its own dependencies, so React behind it is not the pod's.
929
968
  const requiresReact = (name: string, seen = new Set<string>()): boolean => {
930
969
  if (name === 'React' || reactTargets.has(name)) return true
931
- if (seen.has(name)) return false
970
+ if (seen.has(name) || provided.has(name)) return false
932
971
  seen.add(name)
933
972
  return (importedTargets.get(name) ?? []).some((dependency) =>
934
973
  requiresReact(dependency, seen),
@@ -963,7 +1002,7 @@ function enrichInstalledUnits(
963
1002
  flag.startsWith(moduleMapFlag) ? [map(flag.slice(moduleMapFlag.length))] : [],
964
1003
  )
965
1004
  .find((file) => moduleMapName(supportFiles[file] ?? '') === 'jsi')
966
- const textualModules = new Set(['cxxreact', 'fmt', 'folly'])
1005
+ const textualModules = new Set(['ReactCommon', 'cxxreact', 'fmt', 'folly'])
967
1006
  const importerHeaders = new Set(
968
1007
  jsiMap
969
1008
  ? Object.entries(supportFiles).flatMap(([file, source]) =>
@@ -979,6 +1018,8 @@ function enrichInstalledUnits(
979
1018
  if (file.endsWith('.modulemap')) {
980
1019
  const name = moduleMapName(source) ?? ''
981
1020
  // these C++ pods use their own include graph for implementation headers.
1021
+ // an umbrella would own shared headers (react/timing) in submodules its
1022
+ // importers never see, hiding them from later textual includes.
982
1023
  if (
983
1024
  textualModules.has(name) ||
984
1025
  file.endsWith('/RCT-Folly.modulemap') ||
@@ -1050,6 +1091,13 @@ function enrichInstalledUnits(
1050
1091
  }
1051
1092
  for (const unit of units) {
1052
1093
  if (bridgeNamespaces.size > 0 && !bridgeNamespaces.has(unit.namespace)) continue
1094
+ if (
1095
+ unit.namespace === 'Expo' &&
1096
+ !bridgeNamespaces.has(unit.namespace) &&
1097
+ unit.appDelegateSubscribers.length === 0 &&
1098
+ unit.reactDelegateHandlers.length === 0
1099
+ )
1100
+ continue
1053
1101
  // native modules resolve the installed workspace resource products through Bundle.
1054
1102
  unit.resources = input.resources
1055
1103
  unit.resourceBundles = input.resourceBundles?.map((bundle) => ({
@@ -1440,7 +1488,10 @@ export async function collectExpoSwiftSources(
1440
1488
  options.configuration,
1441
1489
  )) +
1442
1490
  '\0' +
1443
- (options.metadataOnly ?? false)
1491
+ JSON.stringify([
1492
+ options.metadataOnly ?? false,
1493
+ [...(options.linkedNativeImports ?? [])].sort(),
1494
+ ])
1444
1495
  const cached = discoveryCache.get(key)
1445
1496
  if (cached && (await witnessMatches(cached.witness))) {
1446
1497
  signal?.throwIfAborted()
@@ -1550,12 +1601,15 @@ async function collectExpoSwiftSourcesUncached(
1550
1601
  installedWorkspace?: string,
1551
1602
  prepareNative = false,
1552
1603
  iosTarget?: string,
1553
- {
1604
+ options: ExpoSwiftSourceOptions = {},
1605
+ ): Promise<ExpoSwiftSourceUnit[] | null> {
1606
+ const {
1554
1607
  moduleRoot: moduleRootOverride,
1555
1608
  configuration = 'Debug',
1609
+ linkedNativeImports,
1556
1610
  metadataOnly = false,
1557
- }: ExpoSwiftSourceOptions = {},
1558
- ): Promise<ExpoSwiftSourceUnit[] | null> {
1611
+ toolEnvironment,
1612
+ } = options
1559
1613
  const started = performance.now()
1560
1614
  const report = (message: string) =>
1561
1615
  console.error(`[expo-swift ${Math.round(performance.now() - started)}ms] ${message}`)
@@ -1639,9 +1693,16 @@ async function collectExpoSwiftSourcesUncached(
1639
1693
  report('expo autolinking done')
1640
1694
  const resolvedText = resolvedModules.value.stdout
1641
1695
  const resolved: unknown = JSON.parse(resolvedText)
1642
- const resolutions =
1696
+ const linked =
1643
1697
  resolved && typeof resolved === 'object' ? Reflect.get(resolved, 'modules') : null
1644
- if (!Array.isArray(resolutions)) throw new Error('invalid Expo Apple resolution')
1698
+ if (!Array.isArray(linked)) throw new Error('invalid Expo Apple resolution')
1699
+ const debugOnlyPackages = new Set<string>()
1700
+ const resolutions = linked.filter((entry: unknown) => {
1701
+ if (configuration !== 'Release' || !isRecord(entry) || entry.debugOnly !== true)
1702
+ return true
1703
+ if (typeof entry.packageName === 'string') debugOnlyPackages.add(entry.packageName)
1704
+ return false
1705
+ })
1645
1706
  // `resolve` does not run upstream's macro scanner, so a package that leaves
1646
1707
  // `apple.modules` undeclared and annotates its classes with `@ExpoModule` is
1647
1708
  // linked from the same scan the generated provider uses. autolinking before
@@ -1688,27 +1749,30 @@ async function collectExpoSwiftSourcesUncached(
1688
1749
  configuration,
1689
1750
  interfaceRoot: module.root,
1690
1751
  moduleRoot: module.root,
1691
- nativeModules: resolutions.flatMap((resolution) => {
1692
- if (!isRecord(resolution) || !Array.isArray(resolution.swiftModuleNames))
1693
- return []
1694
- if (
1695
- typeof resolution.packageName === 'string' &&
1696
- answeredPackages.has(resolution.packageName)
1697
- )
1698
- return []
1699
- const hasRegistration = [
1700
- 'modules',
1701
- 'appDelegateSubscribers',
1702
- 'reactDelegateHandlers',
1703
- ].some((key) => {
1704
- const list = resolution[key]
1705
- return Array.isArray(list) && list.length > 0
1706
- })
1707
- if (!hasRegistration) return []
1708
- return resolution.swiftModuleNames.filter(
1709
- (name): name is string => typeof name === 'string',
1710
- )
1711
- }),
1752
+ nativeModules: [
1753
+ ...resolutions.flatMap((resolution) => {
1754
+ if (!isRecord(resolution) || !Array.isArray(resolution.swiftModuleNames))
1755
+ return []
1756
+ if (
1757
+ typeof resolution.packageName === 'string' &&
1758
+ answeredPackages.has(resolution.packageName)
1759
+ )
1760
+ return []
1761
+ const hasRegistration = [
1762
+ 'modules',
1763
+ 'appDelegateSubscribers',
1764
+ 'reactDelegateHandlers',
1765
+ ].some((key) => {
1766
+ const list = resolution[key]
1767
+ return Array.isArray(list) && list.length > 0
1768
+ })
1769
+ if (!hasRegistration) return []
1770
+ return resolution.swiftModuleNames.filter(
1771
+ (name): name is string => typeof name === 'string',
1772
+ )
1773
+ }),
1774
+ ...(linkedNativeImports ?? []),
1775
+ ],
1712
1776
  },
1713
1777
  async (projectRoot) => {
1714
1778
  const installed = await installedWorkspaceInput(
@@ -1784,6 +1848,10 @@ async function collectExpoSwiftSourcesUncached(
1784
1848
  }
1785
1849
  }
1786
1850
  noteChangedSince(canonical, childStart)
1851
+ if (debugOnlyPackages.has(packageName)) {
1852
+ processed.add(packageName)
1853
+ continue
1854
+ }
1787
1855
  const resolution = resolutions.find(
1788
1856
  (candidate) =>
1789
1857
  candidate &&
@@ -1829,8 +1897,12 @@ async function collectExpoSwiftSourcesUncached(
1829
1897
  }
1830
1898
  const subscriberNames = delegateNames('appDelegateSubscribers')
1831
1899
  const handlerNames = delegateNames('reactDelegateHandlers')
1832
- // a package with pods is rediscovered in the prepared workspace, which has no caps.
1833
- const deferredToWorkspace = prepareNative && !installedWorkspace && pods.length > 0
1900
+ // expo's app delegate and root-view factory belong to the UIKit host. the
1901
+ // guest only links the Swift closure for the modules Expo autolinks.
1902
+ const appHost =
1903
+ packageName === 'expo' && subscriberNames.length === 0 && handlerNames.length === 0
1904
+ const needsPodWorkspace = pods.length > 0 && !appHost
1905
+ const deferredToWorkspace = prepareNative && !installedWorkspace && needsPodWorkspace
1834
1906
  const dependencyOnly =
1835
1907
  answered ||
1836
1908
  ((!Array.isArray(modules) || modules.length === 0) &&
@@ -1896,7 +1968,7 @@ async function collectExpoSwiftSourcesUncached(
1896
1968
  prepared.workspace,
1897
1969
  false,
1898
1970
  iosTarget,
1899
- { moduleRoot: moduleRootOverride, metadataOnly },
1971
+ { ...options, toolEnvironment: prepared.toolEnvironment },
1900
1972
  )
1901
1973
  }
1902
1974
  const declarations: {
@@ -2086,7 +2158,7 @@ async function collectExpoSwiftSourcesUncached(
2086
2158
  if (file.startsWith(`${target.path}/`) && file.endsWith('.swift'))
2087
2159
  files[
2088
2160
  `Sources/${namespace}/${file.slice(target.path.length + 1).replace(/^(?:.*\/)?node_modules\//, '')}`
2089
- ] = source
2161
+ ] = appHost ? expoSwiftImports(source) + source : source
2090
2162
  }
2091
2163
  } else {
2092
2164
  walk(ios)
@@ -2102,6 +2174,7 @@ async function collectExpoSwiftSourcesUncached(
2102
2174
  ? fs.readFileSync(resolveSource(podspec), 'utf8')
2103
2175
  : null
2104
2176
  const usesReact = Boolean(
2177
+ !appHost &&
2105
2178
  !installed &&
2106
2179
  podspecText &&
2107
2180
  /\bdependency[\s(]+['"](?:React-(?!Core['"/])[\w-]+|ReactCommon|ReactCodegen|ExpoModulesWorklets|ExpoModulesJSI)(?:\/[^'"]*)?['"]/.test(
@@ -2154,7 +2227,7 @@ async function collectExpoSwiftSourcesUncached(
2154
2227
  files,
2155
2228
  frameworks: [...frameworks],
2156
2229
  ...(usesReact ? { reactNativeProvider: true as const } : {}),
2157
- ...(hasNativeFiles ? { workspaceSources: [namespace] } : {}),
2230
+ ...(hasNativeFiles && !appHost ? { workspaceSources: [namespace] } : {}),
2158
2231
  ...(podspecFloor
2159
2232
  ? {
2160
2233
  nativeTargets: [synthesizedNativeTarget(namespace, podspecFloor)],
@@ -2195,7 +2268,7 @@ async function collectExpoSwiftSourcesUncached(
2195
2268
  module.registration !== null &&
2196
2269
  configuredExpoSwiftModule(closure, module.name, module.nativeName, appConfig)
2197
2270
  if (configured && !module.subscriber && !module.handler) continue
2198
- if (pods.length > 0) needsNativeWorkspace = true
2271
+ if (needsPodWorkspace) needsNativeWorkspace = true
2199
2272
  const unit: ExpoSwiftSourceUnit = {
2200
2273
  namespace,
2201
2274
  moduleId: `${namespace}.${module.name}`,
@@ -2205,7 +2278,7 @@ async function collectExpoSwiftSourcesUncached(
2205
2278
  reactDelegateHandlers: module.handler ? [module.handler] : [],
2206
2279
  files: closure,
2207
2280
  frameworks: [...frameworks],
2208
- ...(hasNativeFiles ? { workspaceSources: [namespace] } : {}),
2281
+ ...(hasNativeFiles && !appHost ? { workspaceSources: [namespace] } : {}),
2209
2282
  ...(usesReact ? { reactNativeProvider: true as const } : {}),
2210
2283
  ...(absentFrameworks.length > 0 ? { absentFrameworks } : {}),
2211
2284
  ...(podspecFloor
@@ -2237,8 +2310,9 @@ async function collectExpoSwiftSourcesUncached(
2237
2310
  configuration: configuration === 'Debug' ? appConfig : { appConfig, configuration },
2238
2311
  signal,
2239
2312
  })
2240
- const cached = readExpoDiscovery(discovery.key)
2241
- if (!moduleRootOverride && cached !== undefined) return cached
2313
+ const reusableDiscovery = !moduleRootOverride && !linkedNativeImports?.size
2314
+ const cached = reusableDiscovery ? readExpoDiscovery(discovery.key) : undefined
2315
+ if (cached !== undefined) return cached
2242
2316
  const prepared = await prepareExpoNativeWorkspace(appRoot, signal, iosTarget)
2243
2317
  const discovered = await collectExpoSwiftSources(
2244
2318
  prepared.app,
@@ -2246,9 +2320,9 @@ async function collectExpoSwiftSourcesUncached(
2246
2320
  prepared.workspace,
2247
2321
  false,
2248
2322
  iosTarget,
2249
- { moduleRoot: moduleRootOverride, configuration, metadataOnly },
2323
+ { ...options, toolEnvironment: prepared.toolEnvironment },
2250
2324
  )
2251
- if (moduleRootOverride) return discovered
2325
+ if (!reusableDiscovery) return discovered
2252
2326
  const stored = writeExpoDiscovery({
2253
2327
  key: discovery.key,
2254
2328
  units: discovered,
@@ -2264,7 +2338,9 @@ async function collectExpoSwiftSourcesUncached(
2264
2338
  }
2265
2339
  // inline modules belong to the app target, including non-module intent files.
2266
2340
  // use Expo's scanner so its watched directories and class selection stay native.
2267
- const config = await traceStore.exit(() => readExpoConfigAsync(appRoot))
2341
+ const config = await traceStore.exit(() =>
2342
+ readExpoConfigAsync(appRoot, toolEnvironment),
2343
+ )
2268
2344
  signal?.throwIfAborted()
2269
2345
  const experiments = config.experiments
2270
2346
  const inlineConfig = isRecord(experiments) ? experiments.inlineModules : undefined
@@ -2365,6 +2441,7 @@ async function collectExpoSwiftSourcesUncached(
2365
2441
  try {
2366
2442
  await run('node', [configScript, workspaceRoot, output], {
2367
2443
  cwd: workspaceRoot,
2444
+ env: toolEnvironment && { ...process.env, ...toolEnvironment },
2368
2445
  signal,
2369
2446
  })
2370
2447
  constants.resources = {
@@ -2908,6 +2985,7 @@ async function compileExpoSwiftModulesTraced(
2908
2985
  report('using the published native build for this app')
2909
2986
  return await prebuiltExpoSwiftResult(root, prebuilt, signal)
2910
2987
  }
2988
+ const linkedNativeImports = await options.linkedNativeImports?.()
2911
2989
  report(`discovering app-owned modules: ${root}`)
2912
2990
  const expoUnits = await collectExpoSwiftSources(
2913
2991
  root,
@@ -2915,7 +2993,7 @@ async function compileExpoSwiftModulesTraced(
2915
2993
  options.installedWorkspace,
2916
2994
  options.prepareWorkspace ?? !options.only,
2917
2995
  options.iosTarget,
2918
- { moduleRoot: options.moduleRoot, configuration },
2996
+ { moduleRoot: options.moduleRoot, configuration, linkedNativeImports },
2919
2997
  )
2920
2998
  signal.throwIfAborted()
2921
2999
  // reading the app's xcode project resolves remote swift packages with the
@@ -3105,17 +3183,14 @@ async function compileExpoSwiftModulesTraced(
3105
3183
  provider.headerAliases ??= {}
3106
3184
  provider.headerAliases[file] = original.file
3107
3185
  }
3108
- const runtime = units.some((unit) =>
3109
- Object.hasOwn(unit.files, EXPO_SWIFT_VIEW_REGISTRY),
3186
+ // the provider's Hermes runtime unit runs JSI work on the host runtime the adapter carries.
3187
+ const runtime = await resolveAdapterArchive(
3188
+ 'turbo',
3189
+ { reactNative: reactNativeRoot },
3190
+ module.root,
3191
+ swiftNativePin().adapters.turbo,
3192
+ signal,
3110
3193
  )
3111
- ? await resolveAdapterArchive(
3112
- 'turbo',
3113
- { reactNative: reactNativeRoot },
3114
- module.root,
3115
- swiftNativePin().adapters.turbo,
3116
- signal,
3117
- )
3118
- : undefined
3119
3194
  return { ...provider, runtime }
3120
3195
  })()
3121
3196
  : undefined
@@ -3124,7 +3199,7 @@ async function compileExpoSwiftModulesTraced(
3124
3199
  .update(
3125
3200
  JSON.stringify({
3126
3201
  ...reactProvider,
3127
- runtime: reactProvider.runtime?.manifest,
3202
+ runtime: reactProvider.runtime.manifest,
3128
3203
  }),
3129
3204
  )
3130
3205
  .digest('hex')
@@ -3298,11 +3373,7 @@ async function compileExpoSwiftModulesTraced(
3298
3373
  const linkedLibraries = new Map<string, string>(
3299
3374
  Object.entries(provider?.libraries ?? {}),
3300
3375
  )
3301
- if (Object.hasOwn(files, EXPO_SWIFT_VIEW_REGISTRY)) {
3302
- if (!provider?.runtime)
3303
- throw new Error('source ExpoModulesCore requires the React Native JSI runtime')
3304
- linkedLibraries.set('PeachExpoApp', provider.runtime.base64)
3305
- }
3376
+ if (provider) linkedLibraries.set('PeachExpoApp', provider.runtime.base64)
3306
3377
  let linkedSharedLibrary = false
3307
3378
  for (const unit of linked)
3308
3379
  for (const [name, library] of Object.entries(libraries.get(unit) ?? {})) {
@@ -3477,8 +3548,18 @@ async function compileExpoSwiftModulesTraced(
3477
3548
  swiftImportNames(source, importedAvailable),
3478
3549
  ),
3479
3550
  )
3551
+ const bridgeIncludes = (unit.nativeTargets ?? []).flatMap(({ bridgingHeader }) =>
3552
+ bridgingHeader
3553
+ ? [...nativeHeaderIncludes(unit.nativeFiles?.[bridgingHeader] ?? '')]
3554
+ : [],
3555
+ )
3480
3556
  const reached = binaries
3481
- .filter((item) => item.modules.some((name) => imports.has(name)))
3557
+ .filter(
3558
+ ({ binary, modules }) =>
3559
+ modules.some(
3560
+ (name) => imports.has(name) || linkedNativeImports?.has(name),
3561
+ ) || includesNativeArchiveHeader(binary.dir, bridgeIncludes),
3562
+ )
3482
3563
  .map((item) => item.binary)
3483
3564
  if (reached.length > 0) {
3484
3565
  const toolchain = {
@@ -245,6 +245,7 @@ export function expoSwiftLegacyRuntimeNativeSource(
245
245
  ${
246
246
  legacyBridge
247
247
  ? String.raw`#import <ExpoModulesCore/EXJavaScriptRuntime.h>
248
+ #import <ExpoModulesCore/ExpoBridgeModule.h>
248
249
  #import <ExpoModulesCore/EXRawJavaScriptFunction.h>
249
250
  #import <React/RCTBridgeModuleDecorator.h>
250
251
  #import <React/RCTBridgeProxy.h>
@@ -370,7 +371,17 @@ extern "C" void *peachExpoWrapLegacyRuntime(void *pointer) {
370
371
 
371
372
  ${
372
373
  legacyBridge
373
- ? String.raw`extern "C" void peachExpoDisposeReactModuleRegistry() {
374
+ ? String.raw`extern "C" void *peachTurboModuleForClass(Class moduleClass) __attribute__((weak));
375
+
376
+ // React Native's module registry, when the app runs one in this process: as on
377
+ // iOS, creating its native modules proxy sets ExpoBridgeModule's context up
378
+ extern "C" void *peachExpoReactAppContext() {
379
+ if (!peachTurboModuleForClass || !peachTurboModuleForClass(EXNativeModulesProxy.class)) return nullptr;
380
+ ExpoBridgeModule *module = (__bridge ExpoBridgeModule *)peachTurboModuleForClass(ExpoBridgeModule.class);
381
+ return (__bridge void *)module.appContext;
382
+ }
383
+
384
+ extern "C" void peachExpoDisposeReactModuleRegistry() {
374
385
  [reactModuleManager invalidate];
375
386
  reactModuleManager = nil;
376
387
  reactModuleDelegate = nil;
@@ -20,11 +20,14 @@ export function expoSwiftViewSource({
20
20
  moduleClassTypes,
21
21
  copyableValues,
22
22
  legacyRuntime,
23
+ internalReactImport,
23
24
  hasLegacyModuleRegistry,
24
25
  hostWrapper,
25
26
  swiftViewWrapper,
26
27
  childIdentity,
27
28
  shadowNodeOwner,
29
+ hasShadowNodeStyleSize,
30
+ fabricViewConditional,
28
31
  classStaticFunctions,
29
32
  propComparator,
30
33
  scheduledRuntime,
@@ -38,11 +41,14 @@ export function expoSwiftViewSource({
38
41
  moduleClassTypes: boolean
39
42
  copyableValues: boolean
40
43
  legacyRuntime: boolean
44
+ internalReactImport: boolean
41
45
  hasLegacyModuleRegistry: boolean
42
46
  hostWrapper: boolean
43
47
  swiftViewWrapper: boolean
44
48
  childIdentity: boolean
45
49
  shadowNodeOwner: 'props' | 'hostingView' | undefined
50
+ hasShadowNodeStyleSize: boolean
51
+ fabricViewConditional: boolean
46
52
  classStaticFunctions: boolean
47
53
  propComparator: boolean
48
54
  scheduledRuntime: boolean
@@ -79,10 +85,16 @@ export function expoSwiftViewSource({
79
85
  : '(mount.methodReceiver as? any PeachExpoShadowNodeHost)?.peachExpoShadowNodeProxy'
80
86
  const withLegacyThread = (body: string) =>
81
87
  legacyJavaScriptThread ? `withExpoLegacyJavaScriptThread { ${body} }` : body
88
+ // a core whose React Native ExpoBridgeModule installs the runtime from its bridge
89
+ const reactInstalls = legacyRuntime && !hostWrapper
90
+ const ownSetup = (body: string) =>
91
+ reactInstalls
92
+ ? `if reactContext == nil {\n ${body.replaceAll('\n ', '\n ')}\n }`
93
+ : body
82
94
  return String.raw`
83
95
  import Dispatch
84
96
  import Foundation
85
- ${legacyRuntime ? 'import React\n' : ''}${hasJsiModule ? '@_exported import ExpoModulesJSI\n' : ''}@_spi(Peach) import PeachFoundation
97
+ ${legacyRuntime ? (internalReactImport ? 'internal import React\n' : 'import React\n') : ''}${hasJsiModule ? '@_exported import ExpoModulesJSI\n' : ''}@_spi(Peach) import PeachFoundation
86
98
  import PeachJSON
87
99
  import SwiftUI
88
100
  ${jsi57 ? 'import Synchronization\n' : ''}import UIKit
@@ -105,7 +117,14 @@ ${
105
117
  ? String.raw`
106
118
  @_silgen_name("peachExpoWrapLegacyRuntime")
107
119
  private func wrapLegacyRuntime(_ runtime: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer
108
-
120
+ ${
121
+ reactInstalls
122
+ ? String.raw`
123
+ @_silgen_name("peachExpoReactAppContext")
124
+ private func reactAppContext() -> UnsafeMutableRawPointer?
125
+ `
126
+ : ''
127
+ }
109
128
  @_silgen_name("peachExpoCallLegacyFunction")
110
129
  private func callLegacyFunction(
111
130
  _ function: UnsafeMutableRawPointer, _ arguments: UnsafeMutableRawPointer,
@@ -415,22 +434,29 @@ public final class PeachExpoViewRegistry {
415
434
  if let appDefines {
416
435
  EXAppDefines.load(appDefines)
417
436
  }
418
- let context = AppContext()
437
+ ${
438
+ reactInstalls
439
+ ? String.raw`// React Native's module registry, when the app runs one in this process,
440
+ // sets the app up as on iOS: its native modules proxy registers the modules
441
+ // on ExpoBridgeModule's context, whose bridge installs the runtime
442
+ let reactContext = reactAppContext().map { Unmanaged<AppContext>.fromOpaque($0).takeUnretainedValue() }
443
+ let context = reactContext ?? AppContext()`
444
+ : 'let context = AppContext()'
445
+ }
419
446
  ${
420
447
  hasLegacyModuleRegistry
421
- ? String.raw`let legacyModuleRegistry = ModuleRegistryProvider(
448
+ ? String.raw`let legacyModuleRegistry = ${reactInstalls ? 'reactContext?.legacyModuleRegistry ?? ' : ''}ModuleRegistryProvider(
422
449
  singletonModules: ModuleRegistryProvider.singletonModules()
423
450
  ).moduleRegistry()
424
- legacyModuleRegistry.initialize()
425
451
  self.legacyModuleRegistry = legacyModuleRegistry
426
- context.legacyModuleRegistry = legacyModuleRegistry`
452
+ ${ownSetup('legacyModuleRegistry.initialize()\n context.legacyModuleRegistry = legacyModuleRegistry')}`
427
453
  : ''
428
454
  }
429
455
  let runtime = installHostRuntime(Unmanaged.passRetained(context).toOpaque()) { pointer in
430
456
  ${withLegacyThread(`Unmanaged<AppContext>.fromOpaque(pointer).takeRetainedValue()${legacyRuntime ? '._runtime = nil' : '.destroy()'}`)}
431
457
  }
432
- ${
433
- legacyRuntime
458
+ ${ownSetup(
459
+ (legacyRuntime
434
460
  ? withLegacyThread(
435
461
  'context._runtime = Unmanaged<ExpoRuntime>.fromOpaque(wrapLegacyRuntime(runtime)).takeRetainedValue()',
436
462
  )
@@ -438,9 +464,9 @@ public final class PeachExpoViewRegistry {
438
464
  ? String.raw`typealias Schedule = @convention(c) (UnsafeMutableRawPointer, Int32, @convention(block) @escaping @Sendable () -> Void) -> Void
439
465
  let schedule: Schedule = { _, _, callback in DispatchQueue.main.async(execute: callback) }
440
466
  context.setRuntime(runtime, scheduler: runtime, dispatch: unsafeBitCast(schedule, to: UnsafeRawPointer.self))`
441
- : 'context.setRuntime(runtime)'
442
- }
443
- _ = context.useModulesProvider(provider)
467
+ : 'context.setRuntime(runtime)') +
468
+ '\n _ = context.useModulesProvider(provider)',
469
+ )}
444
470
  ExpoAppDelegateSubscriberRepository.registerSubscribersFrom(modulesProvider: provider)
445
471
  ExpoAppDelegateSubscriberRepository.registerReactDelegateHandlersFrom(modulesProvider: provider)
446
472
  let application = UIApplication.shared
@@ -679,7 +705,9 @@ public final class PeachExpoViewRegistry {
679
705
  proxy.setViewSize = { [weak mount] size in
680
706
  if let content = mount?.reactContent { content.size = size }
681
707
  else { updateSize?(size) }
682
- }
708
+ }${
709
+ hasShadowNodeStyleSize
710
+ ? String.raw`
683
711
  proxy.setStyleSize = { [weak self, weak mount] width, height in
684
712
  guard let self, let mount, self.mounts[id] === mount else { return }
685
713
  if let content = mount.reactContent {
@@ -696,6 +724,8 @@ public final class PeachExpoViewRegistry {
696
724
  }
697
725
  let size: [Any?] = [styleWidth, styleHeight]
698
726
  self.viewEvents.append(["view": id, "size": size.map { $0 ?? NSNull() }])
727
+ }`
728
+ : ''
699
729
  }
700
730
  }`
701
731
  : ''
@@ -728,18 +758,19 @@ public final class PeachExpoViewRegistry {
728
758
  try content.props.updateRawProps(props, appContext: context)
729
759
  mount.definition.callLifecycleMethods(withType: .didUpdateProps, forView: mount.view)
730
760
  case .uikit(let content):
731
- if let fabric = content as? ExpoFabricViewObjC {
761
+ ${fabricViewConditional ? '#if RCT_NEW_ARCH_ENABLED\n ' : ''}if let fabric = content as? ExpoFabricViewObjC {
732
762
  fabric.updateProps(props)
733
763
  fabric.viewDidUpdateProps()
734
- } else {
735
- for prop in mount.definition.props {
736
- let value = Conversions.fromNSObject(props[prop.name] as Any)
737
- if !${compareProps}(mount.props?[prop.name], value) {
738
- try prop.set(value: value, onView: content, appContext: context)
739
- }
764
+ break
765
+ }
766
+ ${fabricViewConditional ? '#endif\n ' : ''}for prop in mount.definition.props {
767
+ let value = props[prop.name]
768
+ if !${compareProps}(mount.props?[prop.name], value) {
769
+ ${legacyRuntime ? 'try?' : 'try'} prop.set(
770
+ value: Conversions.fromNSObject(value ?? NSNull()), onView: content, appContext: context)
740
771
  }
741
- mount.definition.callLifecycleMethods(withType: .didUpdateProps, forView: mount.view)
742
772
  }
773
+ mount.definition.callLifecycleMethods(withType: .didUpdateProps, forView: mount.view)
743
774
  }
744
775
  mount.props = props
745
776
  }