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
@@ -1,4 +1,13 @@
1
- import { createHash } from 'node:crypto'
1
+ import { createHash, randomUUID } from 'node:crypto'
2
+ import {
3
+ existsSync,
4
+ mkdirSync,
5
+ readFileSync,
6
+ renameSync,
7
+ rmSync,
8
+ writeFileSync,
9
+ } from 'node:fs'
10
+ import { dirname, join } from 'node:path'
2
11
  import { mapLimit } from '../../../src/helpers/mapLimit'
3
12
  import {
4
13
  NATIVE_DYLD_PACKS_SECTION,
@@ -9,6 +18,7 @@ import {
9
18
  NATIVE_LAZY_SECTION,
10
19
  readNativeLazyParts,
11
20
  } from '../../peach-kit/src/nativeWasmContract'
21
+ import { cacheDir } from './home-paths'
12
22
 
13
23
  type PublishedSdkAsset = { bytes: Buffer; contentType: string; digest: string }
14
24
 
@@ -21,6 +31,12 @@ async function readAsset(
21
31
  digest: string,
22
32
  contentType = 'application/wasm',
23
33
  ): Promise<PublishedSdkAsset> {
34
+ const file = join(cacheDir(), 'published-swift-sdk', digest)
35
+ if (existsSync(file)) {
36
+ const bytes = readFileSync(file)
37
+ if (createHash('sha256').update(bytes).digest('hex') === digest)
38
+ return { bytes, contentType, digest }
39
+ }
24
40
  const response = await fetch(url, {
25
41
  redirect: 'error',
26
42
  signal: AbortSignal.timeout(30_000),
@@ -32,6 +48,14 @@ async function readAsset(
32
48
  const bytes = Buffer.from(await response.arrayBuffer())
33
49
  if (createHash('sha256').update(bytes).digest('hex') !== digest)
34
50
  throw new Error(`published Swift SDK asset ${digest} digest mismatch`)
51
+ mkdirSync(dirname(file), { recursive: true })
52
+ const pending = `${file}.${randomUUID()}`
53
+ try {
54
+ writeFileSync(pending, bytes)
55
+ renameSync(pending, file)
56
+ } finally {
57
+ rmSync(pending, { force: true })
58
+ }
35
59
  return { bytes, contentType, digest }
36
60
  }
37
61
 
@@ -10,8 +10,10 @@ import { peachAnsweredNativePackages } from './answeredNativePackages'
10
10
  import { hasNitroIosInitializer } from './nitro-source'
11
11
  import { loadPodspec, podspecAttribute } from './podspec-sources'
12
12
  import { swiftCodeMask, swiftSourceClosure } from './swift-compile'
13
+ import { nativeHeaderIncludes } from './swift-header-dependencies'
13
14
  import { xcodeNativeFlags, xcodeObjCInputsAsync } from './swift-objc-compile'
14
15
  import { BRIDGE_MODULE_FILE_PREFIX, SWIFT_REACT_BRIDGE_IMPORTS } from './swift-package'
16
+ import { includesNativeArchiveHeader } from './swift-xcframework'
15
17
  import { SWIFT_NATIVE_INPUT_ROOT, SWIFT_NATIVE_SDK_INCLUDE } from './swiftContract'
16
18
  import { ownsFabricPod, turboProviderCandidates } from './turbo-source'
17
19
  import {
@@ -20,6 +22,7 @@ import {
20
22
  readXcodeAppTarget,
21
23
  } from './xcode-project'
22
24
  import type { ExpoSwiftSourceUnit } from './expoSwiftContract'
25
+ import type { SwiftPackageBinary } from './swift-packages'
23
26
 
24
27
  interface MethodInfo {
25
28
  jsName: string
@@ -354,10 +357,34 @@ export async function collectBridgeModuleSources(
354
357
  installedPods: installedWorkspace !== undefined,
355
358
  })
356
359
  : null
360
+ const appTargets = app ? [...app.frameworks, app] : []
361
+ const bridgeIncludes = appTargets.flatMap(({ objc }) => {
362
+ const header = objc?.bridgingHeader
363
+ return header && fs.existsSync(header)
364
+ ? [...nativeHeaderIncludes(fs.readFileSync(header, 'utf8'))]
365
+ : []
366
+ })
367
+ const bridgeArchives: SwiftPackageBinary[] =
368
+ app?.binaryFrameworks.flatMap(({ name, path: dir, rustCrate, genrule }) =>
369
+ dir && includesNativeArchiveHeader(dir, bridgeIncludes)
370
+ ? [
371
+ {
372
+ target: name,
373
+ source: 'the project',
374
+ url: null,
375
+ checksum: null,
376
+ dir,
377
+ reached: true,
378
+ rustCrate,
379
+ genrule,
380
+ },
381
+ ]
382
+ : [],
383
+ ) ?? []
357
384
  let nativeInputs: Awaited<ReturnType<typeof xcodeObjCInputsAsync>> | undefined
358
385
  // the reader owns dependency order and visits a shared framework only once.
359
386
  // each target keeps its own Swift module identity and compilation settings.
360
- for (const target of app ? [...app.frameworks, app] : []) {
387
+ for (const target of appTargets) {
361
388
  signal?.throwIfAborted()
362
389
  const namespace = target.moduleName.replace(/[^A-Za-z0-9_]/g, '_')
363
390
  const outside: string[] = []
@@ -482,12 +509,17 @@ export async function collectBridgeModuleSources(
482
509
  if (bridgingHeader && target.objc && app) {
483
510
  nativeInputs ??= await xcodeObjCInputsAsync(
484
511
  app,
485
- [],
512
+ bridgeArchives,
486
513
  null,
487
514
  undefined,
488
515
  installedWorkspace ? app.rootDir : projectRoot,
489
516
  )
517
+ unit.frameworks = bridgeArchives.map(({ dir }) => dir)
490
518
  const native = target.objc
519
+ const resolved = bridgeArchives.length
520
+ ? nativeInputs.targets.find((input) => input.name === target.moduleName)
521
+ : undefined
522
+ const headerSearchPaths = resolved?.includes ?? native.headerSearchPaths
491
523
  // an installed package a monorepo hoists above the project keeps its
492
524
  // absolute path under one reserved prefix.
493
525
  const key = (file: string) => {
@@ -545,7 +577,7 @@ export async function collectBridgeModuleSources(
545
577
  bridgingHeader: key(bridgingHeader),
546
578
  prefixHeader: native.prefixHeader ? key(native.prefixHeader) : null,
547
579
  headerSearchPaths: directories(
548
- native.headerSearchPaths.filter(
580
+ headerSearchPaths.filter(
549
581
  (file) => file !== '/usr/include' && !file.startsWith('/usr/include/'),
550
582
  ),
551
583
  ),
@@ -1,6 +1,7 @@
1
1
  import { execFileSync } from 'node:child_process'
2
2
  import fs from 'node:fs'
3
3
  import path from 'node:path'
4
+ import { prepareNativeAppRoot } from './expo-native-workspace'
4
5
  import { cacheDir } from './home-paths'
5
6
  import { describeNativeEntry, nativeEntryCache, nativeEntryKey } from './native-prebuilt'
6
7
  import { resolveAdapterArchive } from './nitro-adapter'
@@ -29,8 +30,9 @@ export async function buildReactNativeCore(
29
30
  reactNativeRoot: string,
30
31
  mode: ReactNativeCoreMode,
31
32
  moduleRoot: string,
33
+ removeLegacyArch = false,
32
34
  ): Promise<string> {
33
- const entry = reactNativeCoreEntry(reactNativeRoot, moduleRoot, mode)
35
+ const entry = reactNativeCoreEntry(reactNativeRoot, moduleRoot, mode, removeLegacyArch)
34
36
  const directory = nativeEntryCache('react-native', entry.name, entry.key)
35
37
  const work = path.join(cacheDir(), 'react-native-core-build', entry.key)
36
38
  const {
@@ -52,12 +54,22 @@ export async function buildReactNativeCore(
52
54
  const codegenDir = path.join(work, 'codegen')
53
55
  fs.mkdirSync(work, { recursive: true })
54
56
  fs.rmSync(codegenDir, { recursive: true, force: true })
57
+ const hermesHeader = 'ios/Pods/Headers/Public/hermes-engine/hermes/hermes.h'
58
+ const projectRoot =
59
+ mode !== 'turbo-cxx' &&
60
+ !fs.existsSync(path.join(project, hermesHeader)) &&
61
+ /\bRCTCxxBridge\b/.test(
62
+ fs.readFileSync(path.join(reactNativeRoot, 'React/Base/RCTBridge.mm'), 'utf8'),
63
+ )
64
+ ? await prepareNativeAppRoot(project)
65
+ : project
55
66
  const collection = await collectTurboSources({
56
67
  appRoot: project,
57
- projectRoot: project,
68
+ projectRoot,
58
69
  reactNativeRoot,
59
70
  providers: [],
60
71
  codegenDir,
72
+ removeLegacyArch,
61
73
  ...(mode === 'turbo-cxx'
62
74
  ? { reactNativeCore: true }
63
75
  : { reactNativeProvider: true }),
@@ -3,6 +3,7 @@ import fs from 'node:fs'
3
3
  import { createRequire } from 'node:module'
4
4
  import path from 'node:path'
5
5
  import { isDeepStrictEqual } from 'node:util'
6
+ import { reactNativeRemovesLegacyArch } from './expo-native-workspace'
6
7
  import { cacheDir } from './home-paths'
7
8
  import { isRecord } from './is-record'
8
9
  import {
@@ -85,6 +86,7 @@ export function reactNativeCoreEntry(
85
86
  reactNativeRoot: string,
86
87
  moduleRoot: string,
87
88
  mode: ReactNativeCoreMode,
89
+ removeLegacyArch = false,
88
90
  ) {
89
91
  reactNativeRoot = fs.realpathSync(reactNativeRoot)
90
92
  const manifest: unknown = JSON.parse(
@@ -140,6 +142,7 @@ export function reactNativeCoreEntry(
140
142
  compiler: swiftArchiveCompilerDigestValue(),
141
143
  recipe,
142
144
  mode: archiveMode,
145
+ 'remove-legacy-arch': removeLegacyArch ? '1' : '0',
143
146
  'ios-deployment-target': reactNativeCoreFloor(reactNativeRoot),
144
147
  distribution: distribution?.id ?? swiftModuleDigest(moduleRoot).toString('hex'),
145
148
  release: swiftModuleCompiler(moduleRoot).release,
@@ -160,8 +163,9 @@ export async function prebuiltReactNativeCore(
160
163
  reactNativeRoot: string,
161
164
  moduleRoot: string,
162
165
  mode: ReactNativeCoreMode,
166
+ removeLegacyArch = reactNativeRemovesLegacyArch(project),
163
167
  ): Promise<ReactNativeCoreInput> {
164
- const entry = reactNativeCoreEntry(reactNativeRoot, moduleRoot, mode)
168
+ const entry = reactNativeCoreEntry(reactNativeRoot, moduleRoot, mode, removeLegacyArch)
165
169
  let dir = fetchNativeEntry('react-native', entry.name, entry.key)
166
170
  if (!dir) {
167
171
  let pending = building.get(entry.key)
@@ -171,7 +175,13 @@ export async function prebuiltReactNativeCore(
171
175
  )
172
176
  pending = import('./react-native-core-build')
173
177
  .then(({ buildReactNativeCore }) =>
174
- buildReactNativeCore(project, reactNativeRoot, mode, moduleRoot),
178
+ buildReactNativeCore(
179
+ project,
180
+ reactNativeRoot,
181
+ mode,
182
+ moduleRoot,
183
+ removeLegacyArch,
184
+ ),
175
185
  )
176
186
  .finally(() => building.delete(entry.key))
177
187
  building.set(entry.key, pending)
@@ -5,13 +5,48 @@ import os from 'node:os'
5
5
  import path from 'node:path'
6
6
  import { setTimeout as sleep } from 'node:timers/promises'
7
7
  import { cacheDir } from './home-paths'
8
+ import { fetchNativeEntry, nativeEntryKey, nativeEntryPrefix } from './native-prebuilt'
8
9
  import { tryAcquireNumberedLock } from './numbered-lock'
10
+ import { bindPrivateWasmSymbols } from './swift-guest-image-ledger'
9
11
  import { swiftObjCRuntimeFlags } from './swift-objc-runtime'
10
12
  import { objcSdkIntakeFlags } from './swift-objc-standin'
11
- import { swiftModuleToolchain, swiftSdkPaths } from './swift-sdk-surface'
13
+ import {
14
+ swiftModuleRelease,
15
+ swiftModuleSdk,
16
+ swiftModuleToolchain,
17
+ swiftSdkPaths,
18
+ } from './swift-sdk-surface'
19
+ import { readArMembers } from './swift-wasm-archive'
20
+ import { guestWasmSymbols } from './swift-wasm-prune'
12
21
  import { SWIFT_WASM_TRIPLE, wasmThreadFlags } from './swiftTargetContract'
13
22
 
14
- const RECIPE = 'rive-runtime-sim-2'
23
+ export const RIVE_RUNTIME_REPOSITORY = 'https://github.com/rive-app/rive-ios.git'
24
+ export const RIVE_RUNTIME_BUNDLE = 'dependencies.tar.gz'
25
+ export const RIVE_RUNTIME_SOURCES = {
26
+ v6204: {
27
+ name: 'rive-runtime-6.20.4',
28
+ revision: '7ab5bc0dcbb49467c451622c862029f2bd56e4ca',
29
+ withCanvas: false,
30
+ },
31
+ v6211: {
32
+ name: 'rive-runtime-6.21.1',
33
+ revision: 'c8252fe1f774c4b807d656621d1f93df6c5b92aa',
34
+ withCanvas: false,
35
+ },
36
+ v6280: {
37
+ name: 'rive-runtime-6.28.0',
38
+ revision: 'b9966d5effb9aece78c70934f0bd245523e47a18',
39
+ withCanvas: true,
40
+ },
41
+ v6281: {
42
+ name: 'rive-runtime-6.28.1',
43
+ revision: 'e04bb30881261a94643c9fede9be32ac620359d7',
44
+ withCanvas: true,
45
+ },
46
+ }
47
+ export type RiveRuntimeSource =
48
+ (typeof RIVE_RUNTIME_SOURCES)[keyof typeof RIVE_RUNTIME_SOURCES]
49
+ const RECIPE = 'rive-runtime-sim-2-private-yoga'
15
50
  const CONFIG = 'release'
16
51
  // scripts/build.sh links these from dependencies/release as -l<name>_sim.
17
52
  const RUNTIME_LIBRARIES = [
@@ -23,19 +58,89 @@ const RUNTIME_LIBRARIES = [
23
58
  'luau_vm',
24
59
  ]
25
60
 
26
- /**
27
- * builds the C++ archives rive-ios's RiveRuntime target links, as its
28
- * `scripts/build.sh ios_sim release` does, with the guest compiler standing in
29
- * for Apple clang. Xcode compiles the renderer's Metal shaders. the checkout's
30
- * `dependencies` names the cached output, in upstream's layout.
31
- */
61
+ export function riveRuntimeDependencyEntry(
62
+ { name, revision, withCanvas }: RiveRuntimeSource,
63
+ { release, wasmSdkChecksum }: { release: string; wasmSdkChecksum: string },
64
+ ) {
65
+ const inputs = {
66
+ upstream: revision,
67
+ recipe: RECIPE,
68
+ compiler: release,
69
+ sdkChecksum: wasmSdkChecksum,
70
+ canvas: String(withCanvas),
71
+ target: SWIFT_WASM_TRIPLE,
72
+ }
73
+ return { name, inputs, key: nativeEntryKey(inputs) }
74
+ }
75
+
76
+ /** stages the guest archives and headers upstream's Xcode target links. */
32
77
  export async function buildRiveRuntimeDependencies(
33
78
  checkout: string,
34
79
  moduleRoot: string,
80
+ source: RiveRuntimeSource,
35
81
  ): Promise<void> {
36
- if (process.platform !== 'darwin')
37
- throw new Error('RiveRuntime: Metal shader compilation requires macOS and Xcode')
38
- const runtime = path.join(checkout, 'submodules/rive-runtime')
82
+ const entry = riveRuntimeDependencyEntry(source, {
83
+ release: swiftModuleRelease(moduleRoot),
84
+ wasmSdkChecksum: swiftModuleSdk(moduleRoot).wasmSdkChecksum,
85
+ })
86
+ const native =
87
+ process.platform === 'darwin'
88
+ ? await compileRiveRuntimeDependencies(
89
+ checkout,
90
+ moduleRoot,
91
+ source.withCanvas,
92
+ entry.key,
93
+ )
94
+ : undefined
95
+ const dependencies = path.join(checkout, 'dependencies')
96
+ const stagedKey = native?.key ?? entry.key
97
+ const ready = () => {
98
+ const stamp = path.join(dependencies, '.peach-build')
99
+ return fs.existsSync(stamp) && fs.readFileSync(stamp, 'utf8') === stagedKey
100
+ }
101
+ const release = await acquireBuildLock(dependencies + '.peach-lock')
102
+ try {
103
+ if (ready()) return
104
+ const staging = fs.mkdtempSync(path.join(checkout, '.peach-rive-'))
105
+ try {
106
+ if (native) {
107
+ execFileSync('cp', ['-Rc', native.output + '/.', staging])
108
+ bindRiveYoga(path.join(staging, CONFIG), native.archiver)
109
+ } else {
110
+ const published = fetchNativeEntry('slice', entry.name, entry.key)
111
+ if (!published)
112
+ throw new Error(
113
+ 'RiveRuntime needs the Mac-built dependencies at ' +
114
+ nativeEntryPrefix('slice', entry.name, entry.key),
115
+ )
116
+ execFileSync('tar', [
117
+ '-xzf',
118
+ path.join(published, RIVE_RUNTIME_BUNDLE),
119
+ '--no-same-owner',
120
+ '--no-same-permissions',
121
+ '-C',
122
+ staging,
123
+ ])
124
+ }
125
+ fs.writeFileSync(path.join(staging, '.peach-build'), stagedKey)
126
+ fs.chmodSync(staging, 0o755)
127
+ fs.rmSync(dependencies, { recursive: true, force: true })
128
+ fs.renameSync(staging, dependencies)
129
+ } finally {
130
+ fs.rmSync(staging, { recursive: true, force: true })
131
+ }
132
+ } finally {
133
+ release()
134
+ }
135
+ }
136
+
137
+ // xcode compiles the metal shaders while the guest compiler builds the c++ archives.
138
+ async function compileRiveRuntimeDependencies(
139
+ checkout: string,
140
+ moduleRoot: string,
141
+ withCanvas: boolean,
142
+ entryKey: string,
143
+ ) {
39
144
  const { toolchainBin } = swiftModuleToolchain(moduleRoot)
40
145
  const sdk = swiftSdkPaths(moduleRoot, toolchainBin)
41
146
  // the simulator build's -mios-simulator-version-min.
@@ -54,41 +159,71 @@ export async function buildRiveRuntimeDependencies(
54
159
  // runner-toolchain-platform: darwin
55
160
  const xcode = execFileSync('xcodebuild', ['-version'], { encoding: 'utf8' })
56
161
  const key = createHash('sha256')
57
- .update(
58
- JSON.stringify([
59
- RECIPE,
60
- execFileSync('git', ['-C', runtime, 'rev-parse', 'HEAD'], {
61
- encoding: 'utf8',
62
- }).trim(),
63
- toolchainBin,
64
- common,
65
- objc,
66
- xcode,
67
- ]),
68
- )
162
+ .update(JSON.stringify([entryKey, toolchainBin, common, objc, xcode]))
69
163
  .digest('hex')
70
164
  .slice(0, 32)
71
165
  const output = path.join(cacheDir(), 'rive-runtime', key)
72
166
  const complete = path.join(output, '.complete')
73
167
  if (!fs.existsSync(complete)) {
74
- let release = tryAcquireNumberedLock(`${output}.lock`)
75
- while (!release) {
76
- await sleep(1000)
77
- release = tryAcquireNumberedLock(`${output}.lock`)
78
- }
168
+ const release = await acquireBuildLock(output + '.lock')
79
169
  try {
80
- if (!fs.existsSync(complete)) build(checkout, output, toolchainBin, common, objc)
170
+ if (!fs.existsSync(complete))
171
+ build(checkout, output, toolchainBin, common, objc, withCanvas)
81
172
  } finally {
82
173
  release()
83
174
  }
84
175
  }
85
- // package inputs stay inside the checkout, so it holds a clone, not a link.
86
- const dependencies = path.join(checkout, 'dependencies')
87
- const stamp = path.join(dependencies, '.peach-build')
88
- if (fs.existsSync(stamp) && fs.readFileSync(stamp, 'utf8') === key) return
89
- fs.rmSync(dependencies, { recursive: true, force: true })
90
- execFileSync('cp', ['-Rc', output, dependencies])
91
- fs.writeFileSync(stamp, key)
176
+ return { key, output, archiver: path.join(toolchainBin, 'llvm-ar') }
177
+ }
178
+
179
+ async function acquireBuildLock(lock: string) {
180
+ let release = tryAcquireNumberedLock(lock)
181
+ while (!release) {
182
+ await sleep(1000)
183
+ release = tryAcquireNumberedLock(lock)
184
+ }
185
+ return release
186
+ }
187
+
188
+ // RiveRuntime links its own Yoga fork. Keep those bindings inside RiveRuntime
189
+ // when the flat wasm link also includes React Native's Yoga.
190
+ function bindRiveYoga(libraries: string, archiver: string) {
191
+ const symbols = new Map<string, string>()
192
+ const yoga = readArMembers(fs.readFileSync(path.join(libraries, 'librive_yoga_sim.a')))
193
+ for (const { bytes } of yoga) {
194
+ const { defined, globals, tags } = guestWasmSymbols(bytes)
195
+ for (const name of defined) {
196
+ if (!globals.includes(name) && !tags.includes(name))
197
+ symbols.set(name, `rive_yoga_${name}`)
198
+ }
199
+ }
200
+ if (!symbols.size)
201
+ throw new Error('RiveRuntime: the bundled Yoga archive defines no symbols')
202
+ for (const filename of fs
203
+ .readdirSync(libraries)
204
+ .filter((name) => name.endsWith('.a'))) {
205
+ const archive = path.join(libraries, filename)
206
+ const members = readArMembers(fs.readFileSync(archive))
207
+ const bound = members.map(({ bytes }) => {
208
+ const { defined, undefined: references } = guestWasmSymbols(bytes)
209
+ return [...defined, ...references].some((name) => symbols.has(name))
210
+ ? bindPrivateWasmSymbols(bytes, symbols, 'rive_yoga')
211
+ : bytes
212
+ })
213
+ if (bound.every((bytes, index) => bytes === members[index]!.bytes)) continue
214
+ const scratch = fs.mkdtempSync(path.join(libraries, '.yoga-'))
215
+ try {
216
+ const objects = members.map(({ name }, index) => {
217
+ const member = `${index}-${path.basename(name)}`
218
+ fs.writeFileSync(path.join(scratch, member), bound[index]!)
219
+ return member
220
+ })
221
+ execFileSync(archiver, ['rcsD', filename, ...objects], { cwd: scratch })
222
+ fs.renameSync(path.join(scratch, filename), archive)
223
+ } finally {
224
+ fs.rmSync(scratch, { recursive: true, force: true })
225
+ }
226
+ }
92
227
  }
93
228
 
94
229
  function build(
@@ -97,6 +232,7 @@ function build(
97
232
  toolchainBin: string,
98
233
  common: string[],
99
234
  objc: string[],
235
+ withCanvas: boolean,
100
236
  ) {
101
237
  const work = `${output}.${process.pid}.work`
102
238
  fs.rmSync(work, { recursive: true, force: true })
@@ -109,10 +245,12 @@ function build(
109
245
  const scripts = path.join(runtime, 'build')
110
246
  const logFile = path.join(work, 'build.log')
111
247
  const log = { file: logFile, fd: fs.openSync(logFile, 'w') }
112
- const canvas = [
113
- '--with_rive_canvas',
114
- `--systemscript=${path.join(source, 'scripts/premake_options.lua')}`,
115
- ]
248
+ const canvas = withCanvas
249
+ ? [
250
+ '--with_rive_canvas',
251
+ `--systemscript=${path.join(source, 'scripts/premake_options.lua')}`,
252
+ ]
253
+ : []
116
254
  const premakeArgs = [
117
255
  '--with_rive_layout',
118
256
  '--with_rive_audio=system',
@@ -1,5 +1,5 @@
1
- import type { ConfiguredOneWidget } from './oneWidgetContract'
2
1
  import type { AppSettingsSpecifier } from '@peach/globals'
2
+ import type { ConfiguredOneWidget } from '@peach/globals/one-widget'
3
3
 
4
4
  export interface DiscoveredServer {
5
5
  port: number
@@ -12,7 +12,7 @@ import {
12
12
  SECURE_ITEM_NAMESPACES,
13
13
  type SecureItemRecord,
14
14
  } from '@peach/globals/secure-item-store'
15
- import { NATIVE_HTTP_COOKIE_STORAGE_PREFIX } from '../../peach-compat/src/stubs/native-cookie-storage-contract'
15
+ import { NATIVE_HTTP_COOKIE_STORAGE_PREFIX } from '../../peach-globals/src/hostStorageBridgeContract'
16
16
  import { ONE_STORAGE_PREFIX } from '../../peach-kit/src/one-storage-contract'
17
17
  import type { AppSettingsSnapshot } from '#peach-cli-contract/permissions/app-settings-client'
18
18
  import type {
@@ -0,0 +1,35 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'
3
+ import { join } from 'node:path'
4
+ import { refreshSwiftCacheHold, swiftCacheDir } from './swift-toolchain'
5
+ import { wasmSections } from './wasm-binary-sections'
6
+
7
+ // an app image's pieces live under the digest of its data section, so any split of that
8
+ // image finds them from its bytes alone; a rebound or rewritten image matches no entry.
9
+ function swiftAppDataEntry(wasm: Uint8Array) {
10
+ const data = wasmSections(wasm).find((section) => section.id === 11)
11
+ if (!data) return undefined
12
+ const key = createHash('sha256')
13
+ .update(wasm.subarray(data.start, data.end))
14
+ .digest('hex')
15
+ return join(swiftCacheDir(), 'swift-app-data', key)
16
+ }
17
+
18
+ export function writeSwiftAppData(wasm: Uint8Array, pieces: Uint8Array) {
19
+ const entry = swiftAppDataEntry(wasm)
20
+ if (!entry) return
21
+ mkdirSync(entry, { recursive: true })
22
+ const file = join(entry, 'pieces.bin')
23
+ const pending = `${file}.${process.pid}`
24
+ writeFileSync(pending, pieces)
25
+ renameSync(pending, file)
26
+ refreshSwiftCacheHold(entry)
27
+ }
28
+
29
+ export function readSwiftAppData(wasm: Uint8Array) {
30
+ const entry = swiftAppDataEntry(wasm)
31
+ const file = entry && join(entry, 'pieces.bin')
32
+ if (!file || !existsSync(file)) return undefined
33
+ refreshSwiftCacheHold(entry)
34
+ return readFileSync(file)
35
+ }