peachsim 0.1.1744 → 0.1.1801

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 (690) hide show
  1. package/README.md +28 -28
  2. package/cli/account-gate.ts +97 -0
  3. package/cli/app-catalog.ts +24 -0
  4. package/cli/app-stubs.ts +7 -0
  5. package/cli/auth.ts +48 -18
  6. package/cli/bin.ts +35 -2
  7. package/cli/bridge-flow-runner.ts +174 -6
  8. package/cli/cloud-dispatch.ts +0 -3
  9. package/cli/command-registry.ts +2 -6
  10. package/cli/commands/auth.ts +68 -3
  11. package/cli/commands/compat.ts +1116 -0
  12. package/cli/commands/control.ts +90 -13
  13. package/cli/commands/coverage.ts +85 -116
  14. package/cli/commands/detox.ts +20 -20
  15. package/cli/commands/device.ts +31 -27
  16. package/cli/commands/doctor.ts +76 -1032
  17. package/cli/commands/flow.ts +80 -41
  18. package/cli/commands/guest-host.ts +2 -2
  19. package/cli/commands/inspect/core.ts +8 -7
  20. package/cli/commands/inspect/settling.ts +60 -25
  21. package/cli/commands/inspect/wait-ready.ts +6 -4
  22. package/cli/commands/inspect/wait-selector.ts +32 -18
  23. package/cli/commands/inspect.ts +8 -6
  24. package/cli/commands/kotlin.ts +15 -6
  25. package/cli/commands/logout.ts +4 -2
  26. package/cli/commands/maestro-compare.ts +19 -37
  27. package/cli/commands/maestro-generate.ts +4 -4
  28. package/cli/commands/maestro.ts +56 -37
  29. package/cli/commands/package.ts +136 -57
  30. package/cli/commands/preview.ts +10 -1
  31. package/cli/commands/{film.ts → record-three.ts} +33 -28
  32. package/cli/commands/record.ts +41 -39
  33. package/cli/commands/screenshots.ts +4 -0
  34. package/cli/commands/setup.ts +38 -1
  35. package/cli/commands/shell-url.ts +49 -24
  36. package/cli/commands/swift.ts +29 -11
  37. package/cli/commands/test.ts +43 -13
  38. package/cli/commands/upload.ts +12 -9
  39. package/cli/drivers/playwright-core-pin.ts +2 -2
  40. package/cli/flow-export.ts +1 -1
  41. package/cli/flow-file.ts +1 -1
  42. package/cli/internal-child.ts +3 -8
  43. package/cli/maestro-compare.ts +73 -7
  44. package/cli/maestro-js.ts +1 -1
  45. package/cli/maestro-report.ts +1 -1
  46. package/cli/maestro-workspace.ts +66 -4
  47. package/cli/main.ts +22 -55
  48. package/cli/native-input.ts +13 -20
  49. package/cli/outbound-endpoints.ts +40 -7
  50. package/cli/output-redaction.ts +8 -3
  51. package/cli/packaged-app-launcher.ts +40 -28
  52. package/cli/prompt.ts +20 -0
  53. package/cli/recording-access.ts +7 -7
  54. package/cli/run-registry.ts +1 -1
  55. package/cli/scene-video.ts +0 -4
  56. package/cli/ws-bridge.ts +7 -4
  57. package/detox/index.ts +293 -50
  58. package/detox/jest-preset.cjs +6 -0
  59. package/detox/launch-permissions.ts +1 -21
  60. package/dist-lib/agent-daemon-client.cjs +1 -1
  61. package/dist-lib/agent-events.cjs +1 -1
  62. package/dist-lib/attached-projects.cjs +1 -1
  63. package/dist-lib/auth/shared-session.cjs +1 -1
  64. package/dist-lib/backend-origin.cjs +1 -1
  65. package/dist-lib/beta.cjs +1 -1
  66. package/dist-lib/beta.mjs +1 -1
  67. package/dist-lib/bridge-constants.cjs +1 -1
  68. package/dist-lib/bridge-contract-input.cjs +1 -1
  69. package/dist-lib/bridge-contract-input.mjs +1 -1
  70. package/dist-lib/bridge-contract.cjs +2 -8
  71. package/dist-lib/bridge-contract.mjs +2 -7
  72. package/dist-lib/bundle-channel.cjs +45273 -38265
  73. package/dist-lib/capture-contract.cjs +37 -14
  74. package/dist-lib/capture-contract.mjs +36 -13
  75. package/dist-lib/cloud-contract.cjs +1 -1
  76. package/dist-lib/cloud-contract.mjs +1 -1
  77. package/dist-lib/cloud-test-args.cjs +1 -1
  78. package/dist-lib/cloud-test-args.mjs +1 -1
  79. package/dist-lib/cloud.cjs +2 -2
  80. package/dist-lib/cloud.mjs +2 -2
  81. package/dist-lib/config.cjs +1 -1
  82. package/dist-lib/config.mjs +1 -1
  83. package/dist-lib/detox/index.cjs +562 -126
  84. package/dist-lib/detox/jest-preset.cjs +6 -0
  85. package/dist-lib/dev-bundle-resolution.cjs +18 -13
  86. package/dist-lib/expo-swift-bundle.cjs +28566 -23874
  87. package/dist-lib/expo-swift-metadata.cjs +104 -2
  88. package/dist-lib/expo-swift-metadata.mjs +104 -2
  89. package/dist-lib/home-paths.cjs +8 -5
  90. package/dist-lib/host/bridge-host.cjs +36618 -29846
  91. package/dist-lib/host/fetch-proxy-handler.cjs +23 -20
  92. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  93. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  94. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  95. package/dist-lib/host/websocket-proxy.cjs +5 -2
  96. package/dist-lib/index.cjs +1921 -1549
  97. package/dist-lib/jump-to-source-babel.cjs +1 -1
  98. package/dist-lib/jump-to-source-native.cjs +1 -1
  99. package/dist-lib/kotlin-host.cjs +1 -1
  100. package/dist-lib/menu.cjs +21 -7
  101. package/dist-lib/menu.mjs +21 -7
  102. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  103. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  104. package/dist-lib/metro-production-bundle.cjs +1 -1
  105. package/dist-lib/metro-production-bundle.mjs +1 -1
  106. package/dist-lib/metro.cjs +1877 -1584
  107. package/dist-lib/native-app-identity-project.cjs +1274 -951
  108. package/dist-lib/native-app-identity-project.mjs +1414 -963
  109. package/dist-lib/native-app-identity.cjs +64 -58
  110. package/dist-lib/native-app-identity.mjs +64 -58
  111. package/dist-lib/native-firebase-metadata.cjs +1 -1
  112. package/dist-lib/native-firebase-metadata.mjs +1 -1
  113. package/dist-lib/plist.cjs +1 -1
  114. package/dist-lib/plist.mjs +1 -1
  115. package/dist-lib/profiles.cjs +1 -1
  116. package/dist-lib/public-brand.cjs +1 -1
  117. package/dist-lib/public-origins-lib-esm.json +79 -33
  118. package/dist-lib/public-origins-lib-static.json +1 -1
  119. package/dist-lib/public-origins-lib.json +484 -280
  120. package/dist-lib/react-native-host-modules.cjs +3 -1
  121. package/dist-lib/react-native-host-modules.mjs +3 -1
  122. package/dist-lib/reap-browser.cjs +23 -26
  123. package/dist-lib/scripts/dev-server-scanner.cjs +13 -10
  124. package/dist-lib/sdk.cjs +69 -36
  125. package/dist-lib/sdk.mjs +69 -36
  126. package/dist-lib/skills.cjs +33781 -27141
  127. package/dist-lib/swift-compile.cjs +3759 -2520
  128. package/dist-lib/swift-compile.mjs +3680 -2441
  129. package/dist-lib/swift-package.cjs +33 -1
  130. package/dist-lib/swift-package.mjs +31 -1
  131. package/dist-lib/swift-submit.cjs +1 -1
  132. package/dist-lib/swift-submit.mjs +1 -1
  133. package/dist-lib/swift-toolchain.cjs +102 -5
  134. package/dist-lib/swift.cjs +1 -1
  135. package/dist-lib/vite-swift.cjs +16480 -14579
  136. package/dist-lib/vite.cjs +269 -295
  137. package/dist-lib/worklet-executable.cjs +1 -1
  138. package/dist-lib/worklet-executable.mjs +1 -1
  139. package/dist-types/packages/peach-compat/src/secure-item-store.d.ts +38 -0
  140. package/dist-types/packages/peach-compat/src/stubs/ring-mode-state.d.ts +4 -0
  141. package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +21 -12
  142. package/dist-types/packages/peach-engine/src/billing/plans.d.ts +1 -2
  143. package/dist-types/packages/peach-engine/src/capture/browser-composite-provider.d.ts +2 -0
  144. package/dist-types/packages/peach-engine/src/capture/browser-composite.d.ts +1 -1
  145. package/dist-types/packages/peach-engine/src/engine/animated-driven-style.d.ts +10 -10
  146. package/dist-types/packages/peach-engine/src/engine/animated.d.ts +1 -0
  147. package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +6 -2
  148. package/dist-types/packages/peach-engine/src/engine/canvaskit-api.d.ts +1 -0
  149. package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +3 -2
  150. package/dist-types/packages/peach-engine/src/engine/fiber-debug-metadata.d.ts +5 -0
  151. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +3 -0
  152. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
  153. package/dist-types/packages/peach-engine/src/engine/lottie-runtime.d.ts +3 -0
  154. package/dist-types/packages/peach-engine/src/engine/native-animation-driver.d.ts +18 -1
  155. package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +1 -0
  156. package/dist-types/packages/peach-engine/src/engine/nativeReplayContract.d.ts +71 -0
  157. package/dist-types/packages/peach-engine/src/engine/node.d.ts +31 -3
  158. package/dist-types/packages/peach-engine/src/engine/paint-boundary-types.d.ts +0 -1
  159. package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +7 -2
  160. package/dist-types/packages/peach-engine/src/engine/portals.d.ts +2 -4
  161. package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +5 -0
  162. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +7 -1
  163. package/dist-types/packages/peach-engine/src/engine/scroll-momentum-math.d.ts +3 -3
  164. package/dist-types/packages/peach-engine/src/engine/scroll-velocity.d.ts +1 -0
  165. package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +10 -0
  166. package/dist-types/packages/peach-engine/src/engine/secureItemHostContract.d.ts +30 -0
  167. package/dist-types/packages/peach-engine/src/engine/shell-owned-values.d.ts +55 -0
  168. package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +2 -1
  169. package/dist-types/packages/peach-engine/src/engine/types.d.ts +85 -26
  170. package/dist-types/packages/peach-engine/src/graphite-stats-fields.d.ts +28 -0
  171. package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +1 -0
  172. package/dist-types/packages/peach-engine/src/ios/aux-home-scene.d.ts +3 -4
  173. package/dist-types/packages/peach-engine/src/ios/aux-shell-animated-sources.d.ts +1 -1
  174. package/dist-types/packages/peach-engine/src/ios/home-app-catalog.d.ts +2 -0
  175. package/dist-types/packages/peach-engine/src/ios/photo-store.d.ts +2 -0
  176. package/dist-types/packages/peach-engine/src/ios/photoLibraryContract.d.ts +15 -0
  177. package/dist-types/packages/peach-engine/src/ios/shell-controller-types.d.ts +1 -0
  178. package/dist-types/packages/peach-engine/src/metro-asset-path.d.ts +2 -0
  179. package/dist-types/packages/peach-engine/src/react-native/platform-colors.d.ts +1 -0
  180. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  181. package/dist-types/packages/peach-engine/src/render-worker/canvaskit-webgpu.d.ts +2 -0
  182. package/dist-types/packages/peach-engine/src/render-worker/canvaskit-worker-init.d.ts +1 -1
  183. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +31 -12
  184. package/dist-types/packages/peach-engine/src/render-worker/compositor-runtime/scroll-drag-presentation.d.ts +23 -0
  185. package/dist-types/packages/peach-engine/src/render-worker/expo-widgetContract.d.ts +6 -0
  186. package/dist-types/packages/peach-engine/src/render-worker/expo-widgets-activityContract.d.ts +15 -0
  187. package/dist-types/packages/peach-engine/src/render-worker/graph-linked-value.d.ts +3 -1
  188. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +12 -2
  189. package/dist-types/packages/peach-engine/src/render-worker/image-pixel-contract.d.ts +12 -0
  190. package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +30 -0
  191. package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +4 -1
  192. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +15 -9
  193. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror-tenant.d.ts +3 -1
  194. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +24 -0
  195. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +8 -4
  196. package/dist-types/packages/peach-engine/src/render-worker/shell-scene-schema.d.ts +4 -0
  197. package/dist-types/packages/peach-engine/src/render-worker/shell-tree-wire.d.ts +3 -2
  198. package/dist-types/packages/peach-engine/src/render-worker/text-inputContract.d.ts +1 -0
  199. package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
  200. package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -0
  201. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +10 -1
  202. package/dist-types/packages/peach-engine/src/render-worker/worklet-sab.d.ts +5 -0
  203. package/dist-types/packages/peach-engine/src/rolldown-production-module.d.ts +2 -1
  204. package/dist-types/packages/peach-engine/src/settings/devices.d.ts +4 -0
  205. package/dist-types/packages/peach-globals/src/eventBridgeContract.d.ts +1 -1
  206. package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +7 -0
  207. package/dist-types/packages/peach-globals/src/nodeContract.d.ts +3 -1
  208. package/dist-types/packages/peach-globals/src/recordingBridgeContract.d.ts +5 -1
  209. package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +2 -0
  210. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +3 -1
  211. package/dist-types/packages/peach-kit/src/capabilities.d.ts +23 -1
  212. package/dist-types/packages/peach-kit/src/internal.d.ts +2 -1
  213. package/dist-types/packages/peach-kit/src/ui/hosting-safe-area.d.ts +2 -0
  214. package/dist-types/packages/peach-kit/src/ui/keyboard-toolbar.d.ts +5 -0
  215. package/install.sh +20 -1
  216. package/package.json +6 -5
  217. package/runtime-companion.json +1 -1
  218. package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h +629 -0
  219. package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVAudioSessionDeprecated.h +90 -0
  220. package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVAudioSessionRoute.h +256 -0
  221. package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVAudioSessionTypes.h +1006 -0
  222. package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVFAudio.apinotes +246 -0
  223. package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVFAudio.h +5 -0
  224. package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Modules/module.modulemap +5 -0
  225. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h +52 -0
  226. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVAudioSession.h +11 -0
  227. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVBase.h +264 -0
  228. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h +88 -0
  229. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureSession.h +1360 -0
  230. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureSessionPreset.h +167 -0
  231. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.h +13 -0
  232. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVMediaFormat.h +508 -0
  233. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVMetadataItem.h +1 -1
  234. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVPlayerItem.h +31 -0
  235. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVSampleBufferDisplayLayer.h +18 -0
  236. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVCaptureDeviceDirectionCoordinator.h +113 -0
  237. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVCaptureEvent.h +82 -0
  238. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVCaptureEventInteraction.h +114 -0
  239. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVCaptureEventSound.h +50 -0
  240. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVError.h +51 -0
  241. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVInputPickerInteraction.h +93 -0
  242. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVInterstitialTimeRange.h +39 -0
  243. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVKit.apinotes +112 -0
  244. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVKit.h +110 -0
  245. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVKitDefines.h +79 -0
  246. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVKitTypes.h +54 -0
  247. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVLegibleMediaOptionsMenuController.h +193 -0
  248. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPictureInPictureController.h +271 -0
  249. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPictureInPictureController_AVSampleBufferDisplayLayerSupport.h +135 -0
  250. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPictureInPictureController_VideoCallSupport.h +66 -0
  251. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPlaybackRouteSelecting.h +46 -0
  252. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPlaybackSpeed.h +71 -0
  253. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPlaybackUserInterfaceControllable.h +551 -0
  254. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPlayerItem+AVKitAdditions.h +42 -0
  255. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPlayerViewController.h +704 -0
  256. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVRoutePickerView.h +186 -0
  257. package/sdk/ios/System/Library/Frameworks/AVKit.framework/Modules/module.modulemap +5 -0
  258. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccount.h +1 -1
  259. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +1 -1
  260. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +1 -1
  261. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +1 -1
  262. package/sdk/ios/System/Library/Frameworks/CoreAudioTypes.framework/Headers/AudioSessionTypes.h +104 -0
  263. package/sdk/ios/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioBaseTypes.h +1621 -0
  264. package/sdk/ios/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioTypes.apinotes +42 -0
  265. package/sdk/ios/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioTypes.h +9 -0
  266. package/sdk/ios/System/Library/Frameworks/CoreAudioTypes.framework/Modules/module.modulemap +6 -0
  267. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBAttribute.h +1 -1
  268. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCentralManager.h +1 -1
  269. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCharacteristic.h +1 -1
  270. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBDescriptor.h +1 -1
  271. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBManager.h +1 -1
  272. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeer.h +1 -1
  273. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheral.h +1 -1
  274. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBService.h +1 -1
  275. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBUUID.h +1 -1
  276. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchRequest.h +1 -1
  277. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectID.h +1 -1
  278. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectModel.h +1 -1
  279. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreCoordinator.h +1 -1
  280. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreRequest.h +1 -1
  281. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFRunLoop.h +195 -0
  282. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSocket.h +220 -0
  283. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h +501 -0
  284. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +3 -18
  285. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconIdentityConstraint.h +1 -1
  286. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconRegion.h +2 -2
  287. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCircularRegion.h +1 -1
  288. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLGeocoder.h +2 -2
  289. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLHeading.h +1 -1
  290. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager+CLVisitExtensions.h +1 -1
  291. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +1 -1
  292. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h +2 -2
  293. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +1 -1
  294. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLVisit.h +1 -1
  295. package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMBase.h +443 -0
  296. package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMFormatDescription.h +8 -0
  297. package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMSync.h +996 -0
  298. package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMTime.h +9 -0
  299. package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.h +3 -0
  300. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFMessage.h +1 -1
  301. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFPayload.h +2 -2
  302. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFReaderSession.h +1 -1
  303. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCReaderSession.h +1 -1
  304. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularData.h +1 -1
  305. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h +1 -1
  306. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFont.h +1811 -0
  307. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontCollection.h +360 -0
  308. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontManager.h +574 -17
  309. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontManagerErrors.h +109 -0
  310. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFrame.h +336 -0
  311. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFramesetter.h +203 -0
  312. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTGlyphInfo.h +264 -0
  313. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTLine.h +531 -0
  314. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTParagraphStyle.h +496 -0
  315. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTRubyAnnotation.h +326 -0
  316. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTRun.h +547 -0
  317. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTRunDelegate.h +213 -0
  318. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTStringAttributes.h +496 -0
  319. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTTextTab.h +158 -0
  320. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTTypesetter.h +286 -0
  321. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h +80 -1
  322. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/SFNTLayoutTypes.h +1833 -0
  323. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/SFNTTypes.h +482 -0
  324. package/sdk/ios/System/Library/Frameworks/DeviceDiscoveryUI.framework/Headers/DDDevicePickerViewController.h +41 -0
  325. package/sdk/ios/System/Library/Frameworks/DeviceDiscoveryUI.framework/Headers/DeviceDiscoveryUI.h +9 -0
  326. package/sdk/ios/System/Library/Frameworks/DeviceDiscoveryUI.framework/Headers/DeviceDiscoveryUIDefines.h +14 -0
  327. package/sdk/ios/System/Library/Frameworks/DeviceDiscoveryUI.framework/Modules/DeviceDiscoveryUI.swiftcrossimport/SwiftUI.swiftoverlay +4 -0
  328. package/sdk/ios/System/Library/Frameworks/DeviceDiscoveryUI.framework/Modules/module.modulemap +9 -0
  329. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +1 -1
  330. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +49 -1
  331. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h +2 -0
  332. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSRegularExpression.h +15 -0
  333. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSUbiquitousKeyValueStore.h +30 -0
  334. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKAchievement.h +3 -3
  335. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKBasePlayer.h +1 -1
  336. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKChallenge.h +6 -6
  337. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameCenterViewController.h +4 -4
  338. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLocalPlayer.h +6 -6
  339. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKMatchmaker.h +2 -2
  340. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKNotificationBanner.h +1 -1
  341. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKPlayer.h +3 -3
  342. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKSavedGame.h +2 -2
  343. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKTurnBasedMatch.h +4 -4
  344. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKTurnBasedMatchmakerViewController.h +3 -3
  345. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKActivitySummary.h +1 -1
  346. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKActivitySummaryQuery.h +1 -1
  347. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCategorySample.h +1 -1
  348. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKClinicalType.h +1 -1
  349. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHealthStore.h +6 -6
  350. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObject.h +1 -1
  351. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObjectType.h +5 -5
  352. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObserverQuery.h +1 -1
  353. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantity.h +1 -1
  354. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantitySample.h +1 -1
  355. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuery.h +14 -14
  356. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSample.h +1 -1
  357. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSampleQuery.h +1 -1
  358. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStatistics.h +1 -1
  359. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStatisticsQuery.h +1 -1
  360. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKUnit.h +20 -20
  361. package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h +1 -1
  362. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageAnimation.h +2 -0
  363. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageDestination.h +2 -0
  364. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageMetadata.h +2 -0
  365. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageProperties.h +2 -0
  366. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageSource.h +2 -0
  367. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/ImageIOBase.h +6 -0
  368. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSBase.h +195 -0
  369. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSContext.h +245 -0
  370. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSContextRef.h +178 -0
  371. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSExport.h +151 -0
  372. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSManagedValue.h +81 -0
  373. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSObjectRef.h +755 -0
  374. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSStringRef.h +148 -0
  375. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSStringRefCF.h +60 -0
  376. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSTypedArray.h +180 -0
  377. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSValue.h +824 -0
  378. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSValueRef.h +555 -0
  379. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSVirtualMachine.h +92 -0
  380. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JavaScript.h +37 -0
  381. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JavaScriptCore.h +38 -0
  382. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/WebKitAvailability.h +36 -0
  383. package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Modules/module.modulemap +8 -0
  384. package/sdk/ios/System/Library/Frameworks/MobileCoreServices.framework/Headers/UTType.h +19 -0
  385. package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCAdvertiserAssistant.h +76 -0
  386. package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCBrowserViewController.h +88 -0
  387. package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCError.h +34 -0
  388. package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCNearbyServiceAdvertiser.h +84 -0
  389. package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCNearbyServiceBrowser.h +94 -0
  390. package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCPeerID.h +37 -0
  391. package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCSession.h +215 -0
  392. package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MultipeerConnectivity.apinotes +5 -0
  393. package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MultipeerConnectivity.h +15 -0
  394. package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Modules/module.modulemap +7 -0
  395. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEHotspotHelper.h +1 -1
  396. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEHotspotNetwork.h +1 -1
  397. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterCell.h +1 -1
  398. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterLayer.h +1 -1
  399. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAGradientLayer.h +1 -1
  400. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAReplicatorLayer.h +1 -1
  401. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAScrollLayer.h +1 -1
  402. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAShapeLayer.h +1 -1
  403. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATextLayer.h +1 -1
  404. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATiledLayer.h +1 -1
  405. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransformLayer.h +1 -1
  406. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAValueFunction.h +1 -1
  407. package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h +1 -1
  408. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/ModelIO.h +6 -6
  409. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAction.h +1 -1
  410. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAudioSource.h +1 -1
  411. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNCamera.h +1 -1
  412. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNConstraint.h +2 -2
  413. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNGeometry.h +1 -1
  414. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNHitTest.h +2 -2
  415. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNLight.h +1 -1
  416. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNMaterial.h +1 -1
  417. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNMaterialProperty.h +1 -1
  418. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNNode.h +4 -4
  419. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNParametricGeometry.h +1 -1
  420. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNParticleSystem.h +2 -2
  421. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNScene.h +1 -1
  422. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNTransaction.h +1 -1
  423. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNView.h +1 -1
  424. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKitDeprecated.h +3 -3
  425. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSLayoutManager.h +14 -0
  426. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSParagraphStyle.h +172 -27
  427. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSText.h +59 -0
  428. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSTextContainer.h +13 -0
  429. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSTextList.h +63 -0
  430. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSTextStorage.h +10 -0
  431. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSToolbar+UIKitAdditions.h +142 -0
  432. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityConstants.h +20 -20
  433. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAction.h +103 -0
  434. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +6 -0
  435. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UICommand.h +131 -0
  436. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h +8 -3
  437. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIFont.h +80 -0
  438. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIFontDescriptor.h +191 -0
  439. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGeometry.h +259 -0
  440. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizer.h +9 -3
  441. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizerSubclass.h +5 -3
  442. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIHoverGestureRecognizer.h +6 -3
  443. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInteraction.h +37 -0
  444. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes +4248 -0
  445. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +66 -102
  446. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h +55 -0
  447. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UILayoutGuide.h +62 -0
  448. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenu.h +283 -0
  449. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenuDisplayPreferences.h +27 -0
  450. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenuElement.h +86 -0
  451. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenuLeaf.h +68 -0
  452. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITouch.h +1 -0
  453. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITraitCollection.h +2 -2
  454. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +3 -0
  455. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Modules/module.modulemap +2 -0
  456. package/sdk/ios/System/Library/Frameworks/UIKitText.framework/Headers/UIKitText.apinotes +135 -0
  457. package/sdk/ios/System/Library/Frameworks/UIKitText.framework/Modules/module.modulemap +8 -0
  458. package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTAdditions.h +167 -0
  459. package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTCoreTypes.h +1332 -0
  460. package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UniformTypeIdentifiers.apinotes +53 -0
  461. package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UniformTypeIdentifiers.h +18 -0
  462. package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Modules/module.modulemap +6 -0
  463. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/NSString+UserNotifications.h +19 -0
  464. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNError.h +29 -0
  465. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotification.h +27 -0
  466. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAction.h +69 -0
  467. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationActionIcon.h +23 -0
  468. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAttachment.h +44 -0
  469. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAttributedMessageContext.h +24 -0
  470. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationCategory.h +82 -0
  471. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationContent.h +152 -0
  472. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationRequest.h +34 -0
  473. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationResponse.h +41 -0
  474. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationServiceExtension.h +27 -0
  475. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationSettings.h +90 -0
  476. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationSound.h +45 -0
  477. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationTrigger.h +64 -0
  478. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNUserNotificationCenter.h +107 -0
  479. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes +17 -0
  480. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.h +23 -0
  481. package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Modules/module.modulemap +6 -0
  482. package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCDefines.h +14 -0
  483. package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCError.h +38 -0
  484. package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCSession.h +200 -0
  485. package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCSessionFile.h +30 -0
  486. package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCSessionUserInfoTransfer.h +22 -0
  487. package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WatchConnectivity.apinotes +19 -0
  488. package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WatchConnectivity.h +15 -0
  489. package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Modules/module.modulemap +5 -0
  490. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/NSAttributedString.h +120 -0
  491. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKBackForwardList.h +77 -0
  492. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKBackForwardListItem.h +54 -0
  493. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKContentRuleList.h +37 -0
  494. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKContentRuleListStore.h +47 -0
  495. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKContentWorld.h +87 -0
  496. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKContentWorldConfiguration.h +71 -0
  497. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKContextMenuElementInfo.h +47 -0
  498. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKDOMNodeSnapshot.h +57 -0
  499. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKDataDetectorTypes.h +60 -0
  500. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKDownload.h +67 -0
  501. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKDownloadDelegate.h +146 -0
  502. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKError.h +71 -0
  503. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKFindConfiguration.h +52 -0
  504. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKFindResult.h +41 -0
  505. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKFormInfo.h +63 -0
  506. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKFoundation.h +72 -0
  507. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKFrameInfo.h +62 -0
  508. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKHTTPCookieStore.h +108 -0
  509. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKImmersiveEnvironment.h +50 -0
  510. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKImmersiveEnvironmentDelegate.h +69 -0
  511. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKJSHandle.h +80 -0
  512. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKNavigation.h +45 -0
  513. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKNavigationAction.h +118 -0
  514. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKNavigationDelegate.h +219 -0
  515. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKNavigationResponse.h +60 -0
  516. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKOpenPanelParameters.h +47 -0
  517. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKPDFConfiguration.h +49 -0
  518. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKPreferences.h +117 -0
  519. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKPreviewActionItem.h +39 -0
  520. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKPreviewActionItemIdentifiers.h +38 -0
  521. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKPreviewElementInfo.h +43 -0
  522. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKProcessPool.h +39 -0
  523. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKScriptMessage.h +64 -0
  524. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKScriptMessageHandler.h +52 -0
  525. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKScriptMessageHandlerWithReply.h +95 -0
  526. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKSecurityOrigin.h +57 -0
  527. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKSnapshotConfiguration.h +59 -0
  528. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKUIDelegate.h +316 -0
  529. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKURLSchemeHandler.h +61 -0
  530. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKURLSchemeTask.h +75 -0
  531. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKUserContentController.h +162 -0
  532. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKUserScript.h +76 -0
  533. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtension.h +237 -0
  534. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionAction.h +164 -0
  535. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionCommand.h +106 -0
  536. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionContext.h +790 -0
  537. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionController.h +255 -0
  538. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionControllerConfiguration.h +89 -0
  539. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionControllerDelegate.h +207 -0
  540. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionDataRecord.h +90 -0
  541. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionDataType.h +43 -0
  542. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionMatchPattern.h +175 -0
  543. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionMessagePort.h +99 -0
  544. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionPermission.h +95 -0
  545. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionTab.h +396 -0
  546. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionTabConfiguration.h +94 -0
  547. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionWindow.h +170 -0
  548. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionWindowConfiguration.h +87 -0
  549. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebView.h +800 -0
  550. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfiguration.h +275 -0
  551. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebpagePreferences.h +150 -0
  552. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataRecord.h +90 -0
  553. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h +137 -0
  554. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWindowFeatures.h +72 -0
  555. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WebKit.apinotes +204 -0
  556. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WebKit.h +93 -0
  557. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WebKitLegacy.h +3 -0
  558. package/sdk/ios/System/Library/Frameworks/WebKit.framework/Modules/module.modulemap +5 -0
  559. package/sdk/ios/System/Library/Frameworks/WiFiAware.framework/Modules/WiFiAware.swiftmodule/arm64-apple-ios-simulator.swiftinterface +605 -0
  560. package/sdk/ios/System/Library/Frameworks/_DeviceDiscoveryUI_SwiftUI.framework/Modules/_DeviceDiscoveryUI_SwiftUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +79 -0
  561. package/sdk/ios/usr/include/MacTypes.h +8 -0
  562. package/sdk/ios/usr/include/objc/NSObjCRuntime.h +5 -0
  563. package/sdk/ios/wasm/include/fcntl.h +1 -0
  564. package/sdk/ios/wasm/include/pthread.h +2 -0
  565. package/sdk/ios/wasm/include/stdlib.h +1 -0
  566. package/sdk/native-hashes.json +11 -1
  567. package/skills/contrast/SKILL.md +4 -9
  568. package/skills/peach-perf/SKILL.md +3 -1
  569. package/skills/peach-perf/references/profiling.md +1 -1
  570. package/skills/peach-test/SKILL.md +20 -17
  571. package/skills/peach-test/references/detox.md +7 -7
  572. package/skills/peach-test/references/maestro.md +20 -18
  573. package/src/admitted-mac-build.ts +7 -0
  574. package/src/android-autolinking.ts +2 -2
  575. package/src/android-drawables.ts +5 -5
  576. package/src/android-string-value.ts +1 -1
  577. package/src/android-strings.ts +1 -1
  578. package/src/android-theme.ts +2 -2
  579. package/src/appPackageContract.ts +1 -1
  580. package/src/bridge-contract.ts +12 -16
  581. package/src/build-cache.ts +65 -0
  582. package/src/bundle-channel.mjs +69 -9
  583. package/src/capture-contract.ts +55 -17
  584. package/src/chromium-admission.ts +24 -21
  585. package/src/conformance-comparison-contract.ts +105 -40
  586. package/src/dev-bundle-resolution.ts +23 -10
  587. package/src/device-catalog.ts +35 -2
  588. package/src/disk-cleanup.ts +18 -8
  589. package/src/expo-autolinking.ts +24 -0
  590. package/src/expo-discovery-cache.ts +168 -23
  591. package/src/expo-native-workspace.ts +551 -191
  592. package/src/expo-swift-host.ts +711 -314
  593. package/src/expo-swift-ready.ts +39 -5
  594. package/src/expo-widget-assets.ts +2 -2
  595. package/src/expo-widgets-bundle.ts +56 -0
  596. package/src/expo-workspace-exclusion.ts +62 -0
  597. package/src/expoSwiftContract.ts +27 -4
  598. package/src/forked-script-contract.ts +3 -0
  599. package/src/home-paths.ts +10 -6
  600. package/src/host/bridge-host.ts +27 -0
  601. package/src/host/network-policy.ts +1 -1
  602. package/src/kotlin-app.ts +9 -11
  603. package/src/kotlin-host.ts +2 -2
  604. package/src/launchMetadataContract.ts +5 -0
  605. package/src/menu.ts +19 -5
  606. package/src/native-app-identity-project.ts +35 -49
  607. package/src/native-app-identity.ts +5 -6
  608. package/src/native-firebase-config.ts +10 -48
  609. package/src/native-prebuilt.ts +3 -2
  610. package/src/native-slices.ts +39 -0
  611. package/src/native-static-libraries.ts +73 -0
  612. package/src/nitro-adapter.lock.json +249 -249
  613. package/src/nitro-adapter.ts +16 -5
  614. package/src/nitro-bundle.ts +35 -16
  615. package/src/nitro-compile.ts +254 -16
  616. package/src/nitro-compiler-digest.ts +39 -0
  617. package/src/nitro-dependencies.ts +368 -28
  618. package/src/nitro-source.ts +432 -77
  619. package/src/nitro-superset.lock.json +27 -36
  620. package/src/nitro-superset.ts +6 -0
  621. package/src/nitroAdapterContract.ts +52 -0
  622. package/src/nitroContract.ts +40 -4
  623. package/src/numbered-lock.ts +2 -2
  624. package/src/one-native-app-accent.ts +32 -0
  625. package/src/one-widget-discovery.ts +6 -1
  626. package/src/one-widget-metadata.ts +2 -2
  627. package/src/portable-expo-contract.ts +103 -0
  628. package/src/portable-expo-workspace.ts +94 -0
  629. package/src/prepared-native-inventory.ts +93 -0
  630. package/src/prepared-xcode-phases.ts +194 -0
  631. package/src/process-group.ts +8 -15
  632. package/src/process-table.ts +117 -0
  633. package/src/react-native-bridge-modules.ts +240 -14
  634. package/src/react-native-coverage/native-typescript-parser.ts +11 -2
  635. package/src/react-native-coverage/verified-reach.ts +12 -6
  636. package/src/react-native-host-modules.ts +2 -0
  637. package/src/reap-browser.ts +13 -9
  638. package/src/retired-cache-directory.ts +34 -0
  639. package/src/runtime-assets.ts +1 -0
  640. package/src/screenshots/orchestrate.ts +4 -0
  641. package/src/screenshots/schema.ts +2 -2
  642. package/src/storageSnapshotContract.ts +9 -2
  643. package/src/stub-pattern-matcher.ts +53 -19
  644. package/src/swift-compile.ts +1011 -327
  645. package/src/swift-compiler-digest.ts +3 -0
  646. package/src/swift-coverage/indexing.ts +1 -1
  647. package/src/swift-coverage/xcode-asset-symbols.ts +72 -39
  648. package/src/swift-coverage/xcode-assets.ts +2 -1
  649. package/src/swift-cxx-declarations.ts +114 -130
  650. package/src/swift-cxx-standin.ts +3 -3
  651. package/src/swift-darwin-records.ts +88 -0
  652. package/src/swift-distribution.lock.json +15 -12
  653. package/src/swift-distribution.ts +25 -9
  654. package/src/swift-host.ts +443 -142
  655. package/src/swift-icu.ts +72 -4
  656. package/src/swift-link-roots.ts +2 -0
  657. package/src/swift-objc-compile.ts +312 -65
  658. package/src/swift-objc-import.ts +8 -1
  659. package/src/swift-objc-standin.ts +20 -2
  660. package/src/swift-package-manifest.ts +189 -57
  661. package/src/swift-package.ts +51 -0
  662. package/src/swift-packages.ts +117 -45
  663. package/src/swift-pdf-raster.ts +7 -4
  664. package/src/swift-project-user.ts +183 -0
  665. package/src/swift-reproducible.ts +26 -0
  666. package/src/swift-root-lock.ts +34 -62
  667. package/src/swift-shared-sdk.ts +232 -21
  668. package/src/swift-source-pods.ts +9 -2
  669. package/src/swift-standin-emit.ts +248 -7
  670. package/src/swift-standins.ts +130 -108
  671. package/src/swift-submit.ts +3 -0
  672. package/src/swift-toolchain.ts +109 -8
  673. package/src/swift-wasm-prune.ts +210 -55
  674. package/src/swiftContract.ts +14 -0
  675. package/src/swiftGuestImageContract.ts +113 -0
  676. package/src/turbo-bundle.ts +5 -8
  677. package/src/turbo-codegen-intake.ts +134 -0
  678. package/src/turbo-compile.ts +198 -21
  679. package/src/turbo-native-libraries.ts +98 -0
  680. package/src/turbo-runtime.lock.json +25 -18
  681. package/src/turbo-source.ts +1519 -147
  682. package/src/vite-plugin-one.ts +25 -3
  683. package/src/vite-plugin-swift.ts +5 -1
  684. package/src/vite-plugin.ts +40 -18
  685. package/src/worker-system-chunks.ts +103 -15
  686. package/src/worklets-babel.ts +50 -29
  687. package/src/xcode-header-search.ts +15 -5
  688. package/src/xcode-project.ts +444 -88
  689. package/src/xcode-target-members.ts +72 -63
  690. package/dist-types/packages/peach-engine/src/render-worker/compositor-runtime/scroll-drag-resample.d.ts +0 -44
package/src/swift-host.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks'
1
2
  import { createHash } from 'node:crypto'
2
3
  // the node host for every Swift preview: package inputs, one compile and
3
4
  // immutable artifact addresses. vite and the foreground CLI adapt this host.
@@ -16,13 +17,16 @@ import iosSdk from './ios-sdk-frameworks.json' with { type: 'json' }
16
17
  import { type NativeAppIdentity } from './native-app-identity'
17
18
  import { readNativeAppIdentityFromXcodeTarget } from './native-app-identity-project'
18
19
  import { parsePlistSource } from './plist'
20
+ import { preparedSwiftCheckouts } from './prepared-xcode-phases'
19
21
  import { swiftBinaryModules } from './swift-binary-modules'
20
22
  import {
23
+ brotliCompressQ4,
21
24
  compileSwiftProjectUnit,
22
25
  compileTargets,
23
26
  missingSwiftModules,
24
27
  swiftAvailableModules,
25
28
  swiftSystemLibrarySurface,
29
+ swiftIcuBrotliQ4,
26
30
  swiftImportNames,
27
31
  swiftPeachModules,
28
32
  withNativeSourceGlue,
@@ -31,6 +35,7 @@ import {
31
35
  swiftCDefinedNames,
32
36
  swiftCMainEntry,
33
37
  swiftCPredefines,
38
+ swiftDistributionAt,
34
39
  } from './swift-compile'
35
40
  import {
36
41
  assetSymbolText,
@@ -40,10 +45,11 @@ import {
40
45
  import { xcodeCxxReachable } from './swift-cxx-reachable'
41
46
  import { designTimeValues } from './swift-design-time'
42
47
  import { swiftDistributionRoot, swiftModuleToolchain } from './swift-distribution'
43
- import { xcodeObjCInputs } from './swift-objc-compile'
48
+ import { xcodeNativeFlags, xcodeObjCInputsAsync } from './swift-objc-compile'
44
49
  import {
45
50
  isSwiftNativeTranslationUnit,
46
51
  swiftImplicitResourcePaths,
52
+ swiftManifestSettings,
47
53
  swiftMetalSourceFiles,
48
54
  swiftResourceBundles,
49
55
  swiftResourceBundleForFile,
@@ -64,7 +70,7 @@ import {
64
70
  import {
65
71
  prefetchSwiftCheckouts,
66
72
  remoteSwiftCheckouts,
67
- resolveSwiftPackages,
73
+ resolveSwiftPackagesAsync,
68
74
  type SwiftPackageBinary,
69
75
  type SwiftPackageGap,
70
76
  type SwiftPackages,
@@ -81,6 +87,7 @@ import {
81
87
  swiftStandins,
82
88
  SWIFT_STANDINS_DIR,
83
89
  type SwiftStandin,
90
+ type SwiftStandins,
84
91
  } from './swift-standins'
85
92
  import {
86
93
  MAX_SWIFT_COMPILE_FILES,
@@ -102,6 +109,7 @@ import {
102
109
  type SwiftImageUpload,
103
110
  type SwiftNativeModules,
104
111
  } from './swift-submit'
112
+ import { privateSwiftDistributionRoot } from './swift-toolchain'
105
113
  import { isSwiftResourcePath } from './swiftContract'
106
114
  import {
107
115
  SWIFT_NATIVE_INPUT_ROOT,
@@ -114,6 +122,7 @@ import {
114
122
  import {
115
123
  enclosingXcodeWorkspace,
116
124
  readXcodeAppTarget,
125
+ resolveXcodeSwiftPackages,
117
126
  type XcodeAppTarget,
118
127
  type XcodeModuleTarget,
119
128
  } from './xcode-project'
@@ -130,6 +139,7 @@ import type {
130
139
  SwiftMetalLibrarySource,
131
140
  SwiftPackageFiles,
132
141
  SwiftNativeTarget,
142
+ SwiftHeaderAliases,
133
143
  SwiftResourceBundle,
134
144
  } from './swiftContract'
135
145
  import type { ServerResponse } from 'node:http'
@@ -210,6 +220,8 @@ export interface SwiftArtifact {
210
220
 
211
221
  export interface SwiftProject {
212
222
  packagePath: string
223
+ /** one Swift source packages import the dispatch module; native providers do not. */
224
+ oneModule: boolean
213
225
  artifact: SwiftArtifact | null
214
226
  // the build in flight and the sources it was started from
215
227
  building: {
@@ -225,7 +237,9 @@ export interface SwiftProject {
225
237
  signal?: AbortSignal
226
238
  libraries?: Record<string, string>
227
239
  lazyDistribution?: boolean
240
+ staticClangTargets?: string[]
228
241
  nativeTargets?: SwiftNativeTarget[]
242
+ headerAliases?: SwiftHeaderAliases
229
243
  nativeFiles?: Record<string, string>
230
244
  resourceBundles?: SwiftResourceBundle[]
231
245
  bundleFiles?: SwiftBundlePack
@@ -270,6 +284,7 @@ export function projectFor(
270
284
  }
271
285
  const created: SwiftProject = {
272
286
  packagePath,
287
+ oneModule: true,
273
288
  artifact: null,
274
289
  building: null,
275
290
  resourceFiles: new Map(),
@@ -287,6 +302,7 @@ export function projectFor(
287
302
  // the local packages it links, are the input tree.
288
303
  interface XcodeProjectEntry {
289
304
  xcodeproj: string
305
+ nativeModules?: readonly string[]
290
306
  target?: string
291
307
  /** the build configuration a selected scheme runs; xcode's default otherwise. */
292
308
  configuration?: string
@@ -318,6 +334,25 @@ const xcodeProjects = new Map<string, XcodeProjectEntry>()
318
334
  // once per project per process: the checkouts persist and the link is
319
335
  // idempotent, and a later re-resolve refetches through the same writer.
320
336
  const preparedScriptInputs = new Set<string>()
337
+
338
+ /**
339
+ * writes the project's lock and fetches every pinned checkout, off the event
340
+ * loop, so the synchronous reads that follow find both. a process that
341
+ * serves requests awaits this before opening the project.
342
+ */
343
+ export async function prepareXcodeSwiftPackages(
344
+ input: string,
345
+ target?: string,
346
+ configuration?: string,
347
+ signal?: AbortSignal,
348
+ ): Promise<void> {
349
+ await resolveXcodeSwiftPackages(input, signal, target, configuration)
350
+ const app = readXcodeAppTarget(input, target, configuration, {
351
+ installedPods: true,
352
+ requireSources: false,
353
+ })
354
+ await prefetchSwiftCheckouts(app.rootDir, app.packageResolved, signal)
355
+ }
321
356
  function readXcodeAppTargetPrepared(
322
357
  input: string,
323
358
  target: string | undefined,
@@ -326,18 +361,24 @@ function readXcodeAppTargetPrepared(
326
361
  requireSources?: boolean
327
362
  prepareGeneratedSources?: boolean
328
363
  installedPods?: boolean
364
+ nativeModules?: readonly string[]
329
365
  },
330
366
  ): XcodeAppTarget {
331
367
  if (options.prepareGeneratedSources !== true)
332
- return readXcodeAppTarget(input, target, configuration, options)
333
- const key = JSON.stringify([input, target, configuration])
334
- if (!preparedScriptInputs.has(key)) {
368
+ return readXcodeAppTarget(input, target, configuration, {
369
+ ...options,
370
+ deferPackageResolution: true,
371
+ })
372
+ const key = JSON.stringify([input, target, configuration, options.nativeModules])
373
+ // a transported workspace consumes attested outputs and pinned checkouts
374
+ // directly. readers must not relink its shared, already relocated tree.
375
+ if (!preparedScriptInputs.has(key) && !preparedSwiftCheckouts(input)) {
335
376
  const probe = readXcodeAppTarget(input, target, configuration, {
336
377
  ...options,
337
378
  prepareGeneratedSources: false,
338
379
  requireSources: false,
380
+ deferPackageResolution: true,
339
381
  })
340
- prefetchSwiftCheckouts(probe.rootDir, probe.packageResolved)
341
382
  const checkouts = remoteSwiftCheckouts(probe.rootDir)
342
383
  for (const projectDir of probe.projectDirs) {
343
384
  const packages = path.join(projectDir, '.build', 'peach-xcode', 'SourcePackages')
@@ -353,11 +394,23 @@ function readXcodeAppTargetPrepared(
353
394
  if (path.resolve(packages, linked) === checkouts) continue
354
395
  fs.unlinkSync(link)
355
396
  } else if (fs.existsSync(link)) continue
356
- fs.symlinkSync(checkouts, link)
397
+ try {
398
+ fs.symlinkSync(checkouts, link)
399
+ } catch (error) {
400
+ // another compiler can prepare the same shared workspace concurrently.
401
+ if (
402
+ !(error instanceof Error && 'code' in error && error.code === 'EEXIST') ||
403
+ path.resolve(packages, fs.readlinkSync(link)) !== checkouts
404
+ )
405
+ throw error
406
+ }
357
407
  }
358
408
  preparedScriptInputs.add(key)
359
409
  }
360
- return readXcodeAppTarget(input, target, configuration, options)
410
+ return readXcodeAppTarget(input, target, configuration, {
411
+ ...options,
412
+ deferPackageResolution: true,
413
+ })
361
414
  }
362
415
 
363
416
  /**
@@ -372,14 +425,17 @@ export function openXcodeProject(
372
425
  moduleRoot: string | undefined,
373
426
  configuration?: string,
374
427
  interfaceRoot?: string,
428
+ nativeModules?: readonly string[],
375
429
  ): string {
376
430
  const app = readXcodeAppTargetPrepared(xcodeproj, target, configuration, {
377
431
  prepareGeneratedSources: true,
378
432
  installedPods: true,
433
+ nativeModules,
379
434
  })
380
435
  const root = app.rootDir
381
436
  xcodeProjects.set(root, {
382
437
  xcodeproj,
438
+ nativeModules,
383
439
  target: app.name,
384
440
  configuration: app.configuration,
385
441
  provided: moduleRoot ? new Set(swiftPeachModules(moduleRoot)) : null,
@@ -412,16 +468,18 @@ export function configureSwiftStandinBehavior(
412
468
  entry.behavior = behavior
413
469
  }
414
470
 
471
+ const standinBuilds = new Map<string, Promise<SwiftStandins>>()
472
+
415
473
  // packages resolve once per set of linked products, pins and local manifests.
416
- function swiftPackages(
474
+ async function swiftPackages(
417
475
  entry: XcodeProjectEntry,
418
476
  app: XcodeAppTarget,
419
- ): {
477
+ ): Promise<{
420
478
  packages: SwiftPackages
421
479
  standins: SwiftStandin[]
422
480
  projectGaps: Map<string, string>
423
481
  binaries: SwiftPackageBinary[]
424
- } {
482
+ }> {
425
483
  const stamp = (file: string) =>
426
484
  fs.existsSync(file)
427
485
  ? createHash('sha256').update(fs.readFileSync(file)).digest('hex')
@@ -443,7 +501,7 @@ function swiftPackages(
443
501
  // timestamps. the stand-in key also covers artifacts, peach modules and emitter.
444
502
  let cached = entry.packages
445
503
  if (cached?.key !== key) {
446
- const packages = resolveSwiftPackages({
504
+ const packages = await resolveSwiftPackagesAsync({
447
505
  rootDir: app.rootDir,
448
506
  resolved: app.packageResolved,
449
507
  products: app.linkedProducts,
@@ -506,8 +564,13 @@ function swiftPackages(
506
564
  const cxxArtifacts = reached.filter(standinArtifact)
507
565
  const generation = standinGenerationInputs(cxxArtifacts, toolchain, entry.behavior)
508
566
  if (cached.standinKey !== generation) {
509
- const built = swiftStandins(cxxArtifacts, toolchain, entry.provided, entry.behavior)
510
- cached.packages = resolveSwiftPackages({
567
+ const built = await swiftStandins(
568
+ cxxArtifacts,
569
+ toolchain,
570
+ entry.provided,
571
+ entry.behavior,
572
+ )
573
+ cached.packages = await resolveSwiftPackagesAsync({
511
574
  rootDir: app.rootDir,
512
575
  resolved: app.packageResolved,
513
576
  products: app.linkedProducts,
@@ -563,14 +626,30 @@ function xcodeInputKey(
563
626
  relative: string,
564
627
  ): string {
565
628
  const owner = layout.targetDirs.get(file)
566
- if (owner) return path.posix.join(owner, relative)
629
+ if (owner) {
630
+ // swiftpm ignores sources beneath hidden directories, including pnpm's
631
+ // .pnpm store, even when xcode explicitly includes those files.
632
+ const input = file.endsWith('.swift')
633
+ ? relative
634
+ .split('/')
635
+ .map((part) =>
636
+ part === '.' || part === '..'
637
+ ? part
638
+ : part.replaceAll('%', '%25').replace(/^\./, '%2E'),
639
+ )
640
+ .join('/')
641
+ : relative
642
+ return path.posix.join(owner, input)
643
+ }
567
644
  const checkouts = layout.checkouts
568
645
  return file.startsWith(`${checkouts}${path.sep}`)
569
646
  ? path.posix.join(
570
647
  XCODE_PACKAGES_DIR,
571
648
  path.relative(checkouts, file).split(path.sep).join('/'),
572
649
  )
573
- : relative
650
+ : relative === '..' || relative.startsWith('../')
651
+ ? path.posix.join('external', file.split(path.sep).join('/'))
652
+ : relative
574
653
  }
575
654
 
576
655
  interface XcodeLayout {
@@ -592,40 +671,47 @@ interface XcodeLayout {
592
671
  /** the symbol sources xcode generates from package target catalogs, by input key. */
593
672
  generatedSources: Record<string, string>
594
673
  nativeTargets: SwiftNativeTarget[]
674
+ headerAliases: SwiftHeaderAliases
595
675
  nativeFiles: Map<string, Buffer>
596
676
  files: string[]
597
677
  }
598
678
 
599
679
  // package snapshot reads this several times in one synchronous compile. the
600
680
  // project does not change during that pass.
601
- let xcodeLayouts: Map<string, XcodeLayout | null> | null = null
602
-
603
- function withXcodeLayout<T>(run: () => T): T {
604
- if (xcodeLayouts) return run()
605
- xcodeLayouts = new Map()
606
- try {
681
+ const layoutScope = new AsyncLocalStorage<Map<string, XcodeLayout | null>>()
682
+
683
+ // layouts build async because stand-in admission waits on a remote host. a
684
+ // pass prepares the project's layout once, then reads it sync in its scope.
685
+ export async function withXcodeLayout<T>(
686
+ root: string,
687
+ run: () => T | Promise<T>,
688
+ ): Promise<T> {
689
+ const scope = new Map<string, XcodeLayout | null>()
690
+ return layoutScope.run(scope, async () => {
691
+ scope.set(root, await buildXcodeLayout(root))
607
692
  return run()
608
- } finally {
609
- xcodeLayouts = null
610
- }
693
+ })
611
694
  }
612
695
 
613
696
  function xcodeLayout(root: string): XcodeLayout | null {
614
- const cached = xcodeLayouts
615
- if (cached?.has(root)) return cached.get(root) ?? null
616
- const layout = buildXcodeLayout(root)
617
- cached?.set(root, layout)
618
- return layout
697
+ if (!xcodeProjects.has(root)) return null
698
+ const cached = layoutScope.getStore()
699
+ if (!cached?.has(root)) throw new Error(`xcode layout for ${root} was not prepared`)
700
+ return cached.get(root) ?? null
619
701
  }
620
702
 
621
- function buildXcodeLayout(root: string): XcodeLayout | null {
703
+ async function buildXcodeLayout(root: string): Promise<XcodeLayout | null> {
622
704
  const registered = xcodeProjects.get(root)
623
705
  if (!registered) return null
624
706
  const app = readXcodeAppTargetPrepared(
625
707
  registered.xcodeproj,
626
708
  registered.target,
627
709
  registered.configuration,
628
- { prepareGeneratedSources: true, installedPods: true },
710
+ {
711
+ prepareGeneratedSources: true,
712
+ installedPods: true,
713
+ nativeModules: registered.nativeModules,
714
+ },
629
715
  )
630
716
  const appSources = app.allSources
631
717
  const checkouts = remoteSwiftCheckouts(app.rootDir)
@@ -642,7 +728,32 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
642
728
  const resourceBundles: SwiftResourceBundle[] = [
643
729
  { target: app.moduleName, sourcePath: XCODE_APP_DIR, path: '.' },
644
730
  ]
731
+ const { packages, standins, projectGaps, binaries } = await swiftPackages(
732
+ registered,
733
+ app,
734
+ )
645
735
  const targets: XcodeLayout['targets'] = []
736
+ const frameworkNames = new Map<XcodeModuleTarget, string>()
737
+ const usedNames = new Set(
738
+ [
739
+ app.moduleName,
740
+ ...app.frameworks.map((item) => item.moduleName),
741
+ ...packages.targets.map((item) => item.name),
742
+ ].map(swiftTargetModuleName),
743
+ )
744
+ const moduleOwners = new Map<string, XcodeModuleTarget>()
745
+ const publishes = (item: XcodeModuleTarget) =>
746
+ item.sources.length > 0 || (item.objc?.publicHeaders.length ?? 0) > 0
747
+ for (const framework of app.frameworks) {
748
+ if (framework.allSources.length === 0 && framework.resources.length === 0) continue
749
+ const previous = moduleOwners.get(framework.moduleName)
750
+ if (previous && publishes(previous) && publishes(framework))
751
+ throw new Error(
752
+ `${framework.name}: duplicate module ${framework.moduleName} publishes multiple interfaces`,
753
+ )
754
+ if (!previous || publishes(framework))
755
+ moduleOwners.set(framework.moduleName, framework)
756
+ }
646
757
  const generatedSources: Record<string, string> = {}
647
758
  // xcode generates symbols for each target's own catalogs from its own settings
648
759
  const targetAssetSymbols = (module: XcodeModuleTarget, dir: string) => {
@@ -661,12 +772,26 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
661
772
  // a framework target that only links products compiles nothing, so it has
662
773
  // no module, directory or bundle contents for swiftpm to take as a target
663
774
  if (framework.allSources.length === 0 && framework.resources.length === 0) continue
664
- const dir = path.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName)
665
- resourceBundles.push({
666
- target: framework.moduleName,
667
- sourcePath: dir,
668
- path: `Frameworks/${framework.moduleName}.framework`,
669
- })
775
+ let name = framework.moduleName
776
+ if (moduleOwners.get(name) !== framework) {
777
+ // swiftpm needs distinct target names when native targets share a module.
778
+ if (framework.resources.length > 0)
779
+ throw new Error(
780
+ `${framework.name}: secondary target of shared module ${name} has resources`,
781
+ )
782
+ let suffix = 1
783
+ while (usedNames.has(`${name}__xcode_${suffix}`)) suffix++
784
+ name = `${name}__xcode_${suffix}`
785
+ usedNames.add(name)
786
+ }
787
+ frameworkNames.set(framework, name)
788
+ const dir = path.posix.join(XCODE_FRAMEWORKS_DIR, name)
789
+ if (name === framework.moduleName)
790
+ resourceBundles.push({
791
+ target: name,
792
+ sourcePath: dir,
793
+ path: `Frameworks/${framework.moduleName}.framework`,
794
+ })
670
795
  for (const file of framework.allSources) {
671
796
  if (targetDirs.has(file)) continue
672
797
  targetDirs.set(file, dir)
@@ -679,17 +804,17 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
679
804
  }
680
805
  targetAssetSymbols(framework, dir)
681
806
  targets.push({
682
- name: framework.moduleName,
807
+ name,
683
808
  path: dir,
684
809
  executable: false,
685
810
  resources: false,
686
811
  exclude: [],
687
812
  languageMode: framework.languageMode,
688
813
  mainActorIsolation: framework.mainActorIsolation,
814
+ cxxInterop: framework.swift?.cxxInterop,
689
815
  defines: framework.defines,
690
816
  })
691
817
  }
692
- const { packages, standins, projectGaps, binaries } = swiftPackages(registered, app)
693
818
  const packagePaths = new Map<string, string>()
694
819
  const packageFiles = new Map<string, string>()
695
820
  let localPackageRoot = root
@@ -899,62 +1024,104 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
899
1024
  .filter((other) => other.path.startsWith(`${target.path}/`))
900
1025
  .map((other) => other.path.slice(target.path.length + 1))
901
1026
  }
1027
+ // a search path some pod xcconfigs stringify from an array embeds the
1028
+ // workspace's absolute path, which names the host: key it by the input root
902
1029
  const relative = (file: string) =>
903
1030
  xcodeInputKey(
904
1031
  { checkouts, targetDirs },
905
1032
  file,
906
- path.relative(app.rootDir, file).split(path.sep).join('/') || '.',
1033
+ path
1034
+ .relative(app.rootDir, file)
1035
+ .split(path.sep)
1036
+ .join('/')
1037
+ .replaceAll(app.rootDir, SWIFT_NATIVE_INPUT_ROOT) || '.',
907
1038
  )
908
- const nativeInputs = xcodeObjCInputs(
1039
+ const nativeInputs = await xcodeObjCInputsAsync(
909
1040
  app,
910
1041
  binaries,
911
1042
  registered.moduleRoot ?? registered.interfaceRoot,
912
1043
  )
913
1044
  const nativeFiles = nativeInputs.sources
1045
+ const headerAliases: SwiftHeaderAliases = {}
1046
+ for (const [file, real] of Object.entries(nativeInputs.links)) {
1047
+ const bytes = nativeFiles.get(file)!
1048
+ if (!nativeFiles.has(real)) nativeFiles.set(real, bytes)
1049
+ if (file.endsWith('.modulemap')) continue
1050
+ // header aliases retain their bytes and canonical file identity in the
1051
+ // product overlay. forwarding imports lose clang module ownership.
1052
+ if (/\.(?:h|hh|hpp|hxx|inc|inl|pch)$/.test(file)) {
1053
+ const alias = relative(file)
1054
+ const canonical = relative(real)
1055
+ if (alias !== canonical) headerAliases[alias] = canonical
1056
+ continue
1057
+ }
1058
+ nativeFiles.set(
1059
+ file,
1060
+ Buffer.from(
1061
+ `#include ${JSON.stringify(path.relative(path.dirname(file), real).split(path.sep).join('/'))}\n`,
1062
+ ),
1063
+ )
1064
+ }
914
1065
  for (const file of nativeFiles.keys()) files.add(file)
915
1066
  const nativeHeaders = [...nativeFiles.keys()].filter((file) =>
916
1067
  /\.(?:h|hh|hpp|hxx|pch|inc|inl|modulemap)$/.test(file),
917
1068
  )
918
1069
  const nativePath = (file: string, directory = app.rootDir) => {
919
- const absolute = path.resolve(directory, file)
1070
+ const requested = path.resolve(directory, file)
1071
+ // module maps resolve relative headers beside the requested symlink.
1072
+ const absolute = app.moduleMapSources?.[requested] ?? requested
920
1073
  return absolute === '/usr/include' || absolute.startsWith('/usr/include/')
921
1074
  ? SWIFT_NATIVE_SDK_INCLUDE + absolute.slice('/usr/include'.length)
922
1075
  : `${SWIFT_NATIVE_INPUT_ROOT}/${relative(absolute)}`
923
1076
  }
924
1077
  const nativeFlags = (flags: string[], directory = app.rootDir) =>
925
- flags.map((flag, index) => {
926
- if (flag.startsWith('-fmodule-map-file='))
927
- return `-fmodule-map-file=${nativePath(flag.slice('-fmodule-map-file='.length), directory)}`
1078
+ xcodeNativeFlags(flags, (file) => nativePath(file, directory))
1079
+ for (const target of targets) {
1080
+ const original = app.frameworks.find(
1081
+ (item) => frameworkNames.get(item) === target.name,
1082
+ )
1083
+ if (!original?.swift) continue
1084
+ const flags: string[] = []
1085
+ const ownMap = original.swift.compatibility?.moduleMap
1086
+ for (let index = 0; index < original.swift.flags.length; index++) {
1087
+ const flag = original.swift.flags[index]!
1088
+ // native preparation supplies the staged underlying module and its map.
1089
+ if (flag === '-import-underlying-module') continue
928
1090
  if (
929
- [
930
- '-I',
931
- '-F',
932
- '-iquote',
933
- '-isystem',
934
- '-include',
935
- '-imacros',
936
- '-iframework',
937
- ].includes(flags[index - 1] ?? '')
938
- )
939
- return nativePath(flag, directory)
940
- const joined = /^(-I|-F|-iquote|-isystem|-iframework)(.+)$/.exec(flag)
941
- return joined ? `${joined[1]}${nativePath(joined[2]!, directory)}` : flag
942
- })
1091
+ flag === '-Xfrontend' &&
1092
+ original.swift.flags[index + 1] === '-import-underlying-module'
1093
+ ) {
1094
+ index++
1095
+ continue
1096
+ }
1097
+ if (
1098
+ ownMap &&
1099
+ flag === '-Xcc' &&
1100
+ original.swift.flags[index + 1] === `-fmodule-map-file=${ownMap}`
1101
+ ) {
1102
+ index++
1103
+ continue
1104
+ }
1105
+ flags.push(flag)
1106
+ }
1107
+ target.swiftFlags = [
1108
+ ...nativeFlags(flags),
1109
+ ...(original.swift.cxxInterop && original.swift.cxxStandard
1110
+ ? ['-Xcc', `-std=${original.swift.cxxStandard}`]
1111
+ : []),
1112
+ ]
1113
+ }
943
1114
  const nativeTargets = [app, ...app.frameworks].flatMap(
944
1115
  (target): SwiftNativeTarget[] => {
945
1116
  if (!target.objc) return []
946
1117
  const settings = target.objc
947
- for (const file of [
948
- ...settings.headers,
949
- settings.bridgingHeader,
950
- settings.prefixHeader,
951
- ])
952
- if (file) files.add(file)
1118
+ const xcodeIndex =
1119
+ target === app ? app.frameworks.length : app.frameworks.indexOf(target)
953
1120
  return [
954
1121
  {
955
- name: target.moduleName,
1122
+ name: frameworkNames.get(target) ?? target.moduleName,
956
1123
  deploymentTarget: target.iosDeploymentTarget,
957
- headers: [...new Set([...settings.headers, ...nativeHeaders])].map(relative),
1124
+ headers: nativeHeaders.map(relative),
958
1125
  publicHeaders: settings.publicHeaders.map(relative),
959
1126
  flattensPublicHeaders: true,
960
1127
  bridgingHeader: settings.bridgingHeader
@@ -967,14 +1134,14 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
967
1134
  )
968
1135
  .map(relative),
969
1136
  moduleMaps: nativeInputs.targets
970
- .find((value) => value.name === target.moduleName)!
1137
+ .find((value) => value.xcodeIndex === xcodeIndex)!
971
1138
  .moduleMaps.map((map) => ({
972
1139
  module: map.module,
973
1140
  headers: relative(map.headers),
974
1141
  })),
975
1142
  userHeaderSearchPaths: settings.userHeaderSearchPaths.map(relative),
976
1143
  frameworkSearchPaths: nativeInputs.targets
977
- .find((value) => value.name === target.moduleName)!
1144
+ .find((value) => value.xcodeIndex === xcodeIndex)!
978
1145
  .frameworks.map(relative),
979
1146
  // the same prepared maps and overlay the implementation compile stages
980
1147
  headerMaps: settings.headerMaps.map((map) => ({
@@ -988,10 +1155,9 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
988
1155
  ),
989
1156
  })),
990
1157
  productHeaders: Object.fromEntries(
991
- Object.entries(settings.productHeaders).map(([product, file]) => [
992
- relative(product),
993
- relative(file),
994
- ]),
1158
+ Object.entries(settings.productHeaders).flatMap(([product, file]) =>
1159
+ nativeFiles.has(file) ? [[relative(product), relative(file)]] : [],
1160
+ ),
995
1161
  ),
996
1162
  flags: [
997
1163
  ...nativeFlags(settings.flags),
@@ -1002,12 +1168,24 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
1002
1168
  .flatMap((file) => ['-I', nativePath(file)]),
1003
1169
  ],
1004
1170
  cxxFlags: nativeFlags(settings.cxxFlags),
1005
- fileFlags: Object.fromEntries(
1006
- Object.entries(settings.fileFlags).map(([file, flags]) => [
1171
+ fileFlags: Object.fromEntries([
1172
+ ...Object.entries(settings.fileFlags).map(([file, flags]) => [
1007
1173
  relative(file),
1008
1174
  nativeFlags(flags),
1009
1175
  ]),
1010
- ),
1176
+ ...(frameworkNames.get(target) &&
1177
+ frameworkNames.get(target) !== target.moduleName
1178
+ ? target.allSources
1179
+ .filter(isSwiftNativeTranslationUnit)
1180
+ .map((file) => [
1181
+ relative(file),
1182
+ [
1183
+ ...nativeFlags(settings.fileFlags[file] ?? []),
1184
+ `-fmodule-name=${target.moduleName}`,
1185
+ ],
1186
+ ])
1187
+ : []),
1188
+ ]),
1011
1189
  sourceDirectories: Object.fromEntries(
1012
1190
  target.allSources
1013
1191
  .filter(isSwiftNativeTranslationUnit)
@@ -1069,6 +1247,7 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
1069
1247
  resourceBundles,
1070
1248
  generatedSources,
1071
1249
  nativeTargets,
1250
+ headerAliases,
1072
1251
  nativeFiles,
1073
1252
  files: [...files].sort(),
1074
1253
  }
@@ -1105,30 +1284,6 @@ function xcodeManifest(layout: XcodeLayout): string {
1105
1284
  )
1106
1285
  return native ? [productDependency(native.name, native.packageDir)] : []
1107
1286
  })
1108
- const settings = (target: {
1109
- languageMode: number
1110
- mainActorIsolation: boolean
1111
- defines?: string[]
1112
- experimentalFeatures?: string[]
1113
- upcomingFeatures?: string[]
1114
- swiftFlags?: string[]
1115
- }) =>
1116
- `swiftSettings: [${[
1117
- `.swiftLanguageMode(.v${target.languageMode})`,
1118
- ...(target.mainActorIsolation ? ['.defaultIsolation(MainActor.self)'] : []),
1119
- ...(target.defines ?? []).map((name) => `.define(${JSON.stringify(name)})`),
1120
- ...(target.experimentalFeatures ?? []).map(
1121
- (name) => `.enableExperimentalFeature(${JSON.stringify(name)})`,
1122
- ),
1123
- ...(target.upcomingFeatures ?? []).map(
1124
- (name) => `.enableUpcomingFeature(${JSON.stringify(name)})`,
1125
- ),
1126
- ...(target.swiftFlags?.length
1127
- ? [
1128
- `.unsafeFlags([${target.swiftFlags.map((flag) => JSON.stringify(flag)).join(', ')}])`,
1129
- ]
1130
- : []),
1131
- ].join(', ')}]`
1132
1287
  const clangSettings = (target: SwiftPackageTarget) =>
1133
1288
  (
1134
1289
  [
@@ -1148,15 +1303,24 @@ function xcodeManifest(layout: XcodeLayout): string {
1148
1303
  target.linkedLibraries?.length
1149
1304
  ? `, linkerSettings: [${target.linkedLibraries.map((name) => `.linkedLibrary(${JSON.stringify(name)})`).join(', ')}]`
1150
1305
  : ''
1306
+ const appSwift = layout.app.swift
1307
+ const appSettings = swiftManifestSettings({
1308
+ ...layout.app,
1309
+ cxxInterop: appSwift?.cxxInterop,
1310
+ swiftFlags:
1311
+ appSwift?.cxxInterop && appSwift.cxxStandard
1312
+ ? ['-Xcc', `-std=${appSwift.cxxStandard}`]
1313
+ : undefined,
1314
+ })
1151
1315
  return [
1152
1316
  '// swift-tools-version: 6.2',
1153
1317
  'import PackageDescription',
1154
1318
  `let package = Package(name: "app", ${layout.app.iosDeploymentTarget ? `platforms: [.iOS(${JSON.stringify(layout.app.iosDeploymentTarget)})], ` : ''}dependencies: [${[...nativePaths].map(([name, directory]) => `.package(name: ${JSON.stringify(name)}, path: ${JSON.stringify(directory)})`).join(', ')}], targets: [`,
1155
- ` .executableTarget(name: "${layout.app.moduleName}", dependencies: [${appProducts.join(', ')}], path: "${XCODE_APP_DIR}", ${settings(layout.app)}),`,
1319
+ ` .executableTarget(name: "${layout.app.moduleName}", dependencies: [${appProducts.join(', ')}], path: "${XCODE_APP_DIR}", ${appSettings}),`,
1156
1320
  ...layout.targets.map((target) =>
1157
1321
  target.systemLibrary
1158
1322
  ? ` .systemLibrary(name: "${target.name}", path: "${target.path}"),`
1159
- : ` .target(name: "${target.name}", dependencies: [${dependencies(target)}], path: "${target.path}", ${target.exclude.length > 0 ? `exclude: ${JSON.stringify(target.exclude)}, ` : ''}${target.resources ? 'resources: [], ' : ''}${target.publicHeadersPath === undefined ? '' : `publicHeadersPath: ${JSON.stringify(target.publicHeadersPath)}, `}${clangSettings(target)}${settings(target)}${libraries(target)}),`,
1323
+ : ` .target(name: "${target.name}", dependencies: [${dependencies(target)}], path: "${target.path}", ${target.exclude.length > 0 ? `exclude: ${JSON.stringify(target.exclude)}, ` : ''}${target.resources ? 'resources: [], ' : ''}${target.publicHeadersPath === undefined ? '' : `publicHeadersPath: ${JSON.stringify(target.publicHeadersPath)}, `}${clangSettings(target)}${swiftManifestSettings(target)}${libraries(target)}),`,
1160
1324
  ),
1161
1325
  '])',
1162
1326
  '',
@@ -1673,17 +1837,34 @@ export function buildSwiftBundleFiles(
1673
1837
  )
1674
1838
  }
1675
1839
  for (const product of xcode?.app.resourceProducts ?? []) {
1840
+ if ('sourceRoot' in product) {
1841
+ // cocoapods copies a vendored bundle verbatim, including its original plist.
1842
+ for (const file of product.resources) {
1843
+ const relative = path.relative(product.sourceRoot, file)
1844
+ watched.push(path.relative(packagePath, file).split(path.sep).join('/'))
1845
+ addFile(
1846
+ `${product.path}/${relative.split(path.sep).join('/')}`,
1847
+ readPackageFile(packagePath, file, limits.resourceBytes),
1848
+ )
1849
+ }
1850
+ continue
1851
+ }
1676
1852
  addFile(`${product.path}/Info.plist`, Buffer.from(product.infoPlist))
1677
1853
  const group = groups.get(product.path) ?? new Map<string, string>()
1678
1854
  for (const file of product.resources)
1679
1855
  group.set(
1680
- `Resources/${path.relative(packagePath, file).split(path.sep).join('/')}`,
1856
+ // pod resources may live outside the preview package. the shared
1857
+ // enumerator flattens ordinary files and preserves localized folders.
1858
+ `Resources/${path.relative(path.parse(file).root, file).split(path.sep).join('/')}`,
1681
1859
  file,
1682
1860
  )
1683
1861
  groups.set(product.path, group)
1684
1862
  }
1685
1863
  for (const [bundlePath, members] of groups) {
1686
- for (const { base, file } of enumerateBundleResources([...members.keys()])) {
1864
+ for (const { base, file } of enumerateBundleResources(
1865
+ [...members.keys()],
1866
+ bundlePath.endsWith('.bundle'),
1867
+ )) {
1687
1868
  const disk = members.get(file)!
1688
1869
  watched.push(path.relative(packagePath, disk).split(path.sep).join('/'))
1689
1870
  const bytes = readPackageFile(packagePath, disk, limits.resourceBytes)
@@ -1713,6 +1894,8 @@ export function serveSwiftResource(
1713
1894
  // dependency, and `swift build` compiles it with the project, so an edit
1714
1895
  // there changes the artifact without moving any of the project's own mtimes.
1715
1896
  export function linkedModuleRoots(packagePath: string): string[] {
1897
+ // an explicit private distribution wins over a linked checkout, as in resolveSwiftModule
1898
+ if (privateSwiftDistributionRoot()) return []
1716
1899
  packagePath = fs.realpathSync(packagePath)
1717
1900
  let manifest: string
1718
1901
  try {
@@ -1751,7 +1934,10 @@ export function sourceStamp(
1751
1934
  const libraries = projects.get(packagePath)?.libraries
1752
1935
  if (libraries) hash.update(JSON.stringify(libraries))
1753
1936
  if (projects.get(packagePath)?.lazyDistribution) hash.update('lazy-distribution')
1937
+ hash.update(JSON.stringify(projects.get(packagePath)?.staticClangTargets ?? []))
1938
+ hash.update(JSON.stringify(projects.get(packagePath)?.oneModule ?? true))
1754
1939
  hash.update(JSON.stringify(projects.get(packagePath)?.nativeTargets ?? []))
1940
+ hash.update(JSON.stringify(projects.get(packagePath)?.headerAliases ?? {}))
1755
1941
  hash.update(JSON.stringify(projects.get(packagePath)?.nativeFiles ?? {}))
1756
1942
  hash.update(JSON.stringify(projects.get(packagePath)?.resourceBundles ?? []))
1757
1943
  hash.update(JSON.stringify(projects.get(packagePath)?.bundleFiles ?? null))
@@ -1776,7 +1962,10 @@ export function sourceContentStamp(
1776
1962
  const libraries = projects.get(packagePath)?.libraries
1777
1963
  if (libraries) hash.update(JSON.stringify(libraries))
1778
1964
  if (projects.get(packagePath)?.lazyDistribution) hash.update('lazy-distribution')
1965
+ hash.update(JSON.stringify(projects.get(packagePath)?.staticClangTargets ?? []))
1966
+ hash.update(JSON.stringify(projects.get(packagePath)?.oneModule ?? true))
1779
1967
  hash.update(JSON.stringify(projects.get(packagePath)?.nativeTargets ?? []))
1968
+ hash.update(JSON.stringify(projects.get(packagePath)?.headerAliases ?? {}))
1780
1969
  hash.update(JSON.stringify(projects.get(packagePath)?.nativeFiles ?? {}))
1781
1970
  hash.update(JSON.stringify(projects.get(packagePath)?.resourceBundles ?? []))
1782
1971
  hash.update(JSON.stringify(projects.get(packagePath)?.bundleFiles ?? null))
@@ -1841,6 +2030,7 @@ export function standinLibraries(
1841
2030
  binaries: readonly SwiftPackageBinary[],
1842
2031
  standins: readonly SwiftStandin[],
1843
2032
  rootDir: string,
2033
+ toolchain?: { moduleRoot: string; release: string },
1844
2034
  ): Map<string, SwiftStandin[]> {
1845
2035
  const linked = new Map<string, SwiftStandin[]>()
1846
2036
  for (const binary of binaries) {
@@ -1851,7 +2041,7 @@ export function standinLibraries(
1851
2041
  `${standin.module}.cpp` in standin.files),
1852
2042
  )
1853
2043
  if (modules.length === 0) continue
1854
- const library = standinLibrary(binary, rootDir)
2044
+ const library = standinLibrary(binary, rootDir, toolchain)
1855
2045
  if (!library) continue
1856
2046
  linked.set(library, modules)
1857
2047
  }
@@ -1903,11 +2093,13 @@ function packageSources(
1903
2093
 
1904
2094
  interface SwiftPackageSnapshot {
1905
2095
  nativeModules: string[]
2096
+ oneModule: boolean
1906
2097
  packageFiles?: SwiftPackageFiles
1907
2098
  projectFiles?: Record<string, string>
1908
2099
  packageGuestImports?: string[]
1909
2100
  files: Record<string, string>
1910
2101
  nativeTargets?: SwiftNativeTarget[]
2102
+ headerAliases?: SwiftHeaderAliases
1911
2103
  defaultLocalization?: string
1912
2104
  entry: string
1913
2105
  resourcePaths: string[]
@@ -1917,12 +2109,26 @@ interface SwiftPackageSnapshot {
1917
2109
  glue?: string
1918
2110
  libraries?: Record<string, string>
1919
2111
  lazyDistribution?: boolean
2112
+ staticClangTargets?: string[]
1920
2113
  }
1921
2114
 
1922
- function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnapshot {
2115
+ function packageSnapshot(
2116
+ project: SwiftProject,
2117
+ entry: string,
2118
+ moduleRoot?: string,
2119
+ ): SwiftPackageSnapshot {
1923
2120
  const layout = xcodeLayout(project.packagePath)
2121
+ const pin = moduleRoot
2122
+ ? (swiftDistributionAt(moduleRoot) ??
2123
+ JSON.parse(fs.readFileSync(path.join(moduleRoot, 'toolchain.json'), 'utf8')))
2124
+ : null
1924
2125
  const linked = layout
1925
- ? standinLibraries(layout.binaries, layout.standins, layout.app.rootDir)
2126
+ ? standinLibraries(
2127
+ layout.binaries,
2128
+ layout.standins,
2129
+ layout.app.rootDir,
2130
+ pin && moduleRoot ? { moduleRoot, release: pin.release } : undefined,
2131
+ )
1926
2132
  : new Map<string, SwiftStandin[]>()
1927
2133
  const files = packageSources(
1928
2134
  project.packagePath,
@@ -1933,12 +2139,26 @@ function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnap
1933
2139
  const native = nativeSourceDescriptor(project.packagePath)
1934
2140
  const limits = inputLimits(Boolean(project.hosted))
1935
2141
  const packageFiles: SwiftPackageFiles = {}
2142
+ const headerAliases: SwiftHeaderAliases = {
2143
+ ...layout?.headerAliases,
2144
+ ...project.headerAliases,
2145
+ }
2146
+ // checkout headers retain their original bytes and alias identity too.
2147
+ const packageReals = new Map<string, string>()
1936
2148
  for (const [file, relative] of layout?.packageFiles ?? [])
2149
+ if (!fs.lstatSync(file).isSymbolicLink())
2150
+ packageReals.set(fs.realpathSync(file), relative)
2151
+ for (const [file, relative] of layout?.packageFiles ?? []) {
2152
+ const real = fs.realpathSync(file)
2153
+ const target = packageReals.get(real)
2154
+ if (target !== undefined && target !== relative && /\.(?:h|hh|hpp|hxx)$/.test(file))
2155
+ headerAliases[relative] = target
1937
2156
  packageFiles[relative] = readPackageFile(
1938
2157
  project.packagePath,
1939
- fs.realpathSync(file),
2158
+ real,
1940
2159
  limits.sourceBytes,
1941
2160
  ).toString('base64')
2161
+ }
1942
2162
  // target members that are not sources. the builder hop receives only this
1943
2163
  // request, so the bytes travel at the project-relative path Xcode reads.
1944
2164
  const projectFiles: Record<string, string> = {}
@@ -1963,6 +2183,8 @@ function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnap
1963
2183
  }
1964
2184
  return {
1965
2185
  files,
2186
+ oneModule: project.oneModule,
2187
+ ...(Object.keys(headerAliases).length > 0 ? { headerAliases } : {}),
1966
2188
  nativeModules: (layout?.packages.nativePackages ?? []).flatMap(
1967
2189
  ({ guestTargets: targets }) =>
1968
2190
  targets
@@ -2018,6 +2240,9 @@ function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnap
2018
2240
  ),
2019
2241
  native,
2020
2242
  ...(project.lazyDistribution ? { lazyDistribution: true } : {}),
2243
+ ...(project.staticClangTargets
2244
+ ? { staticClangTargets: project.staticClangTargets }
2245
+ : {}),
2021
2246
  ...(linked.size > 0 || project.libraries
2022
2247
  ? {
2023
2248
  libraries: {
@@ -2054,6 +2279,7 @@ function snapshotCompileInput(snapshot: SwiftPackageSnapshot): SwiftCompileInput
2054
2279
  : {}),
2055
2280
  ...(snapshot.projectFiles ? { projectFiles: snapshot.projectFiles } : {}),
2056
2281
  ...(snapshot.nativeTargets ? { nativeTargets: snapshot.nativeTargets } : {}),
2282
+ ...(snapshot.headerAliases ? { headerAliases: snapshot.headerAliases } : {}),
2057
2283
  ...(snapshot.defaultLocalization
2058
2284
  ? { defaultLocalization: snapshot.defaultLocalization }
2059
2285
  : {}),
@@ -2063,16 +2289,23 @@ function snapshotCompileInput(snapshot: SwiftPackageSnapshot): SwiftCompileInput
2063
2289
  resources: snapshot.bundleFiles.files,
2064
2290
  images: snapshot.resources.images,
2065
2291
  entry: snapshot.entry,
2066
- oneModule: true,
2292
+ oneModule: snapshot.oneModule,
2067
2293
  ...(snapshot.libraries ? { libraries: snapshot.libraries } : {}),
2068
2294
  ...(snapshot.lazyDistribution ? { lazyDistribution: true } : {}),
2295
+ ...(snapshot.staticClangTargets
2296
+ ? { staticClangTargets: snapshot.staticClangTargets }
2297
+ : {}),
2069
2298
  }
2070
2299
  return snapshot.glue ? withNativeSourceGlue(input, snapshot.glue) : input
2071
2300
  }
2072
2301
 
2073
- export function compileInput(packagePath: string, entry: string): SwiftCompileInput {
2074
- return withXcodeLayout(() =>
2075
- snapshotCompileInput(packageSnapshot(projectFor(packagePath), entry)),
2302
+ export function compileInput(
2303
+ packagePath: string,
2304
+ entry: string,
2305
+ ): Promise<SwiftCompileInput> {
2306
+ const project = projectFor(packagePath)
2307
+ return withXcodeLayout(project.packagePath, () =>
2308
+ snapshotCompileInput(packageSnapshot(project, entry)),
2076
2309
  )
2077
2310
  }
2078
2311
 
@@ -2081,13 +2314,34 @@ export function compileInput(packagePath: string, entry: string): SwiftCompileIn
2081
2314
  export function installedWorkspaceInput(
2082
2315
  packagePath: string,
2083
2316
  entry: string,
2084
- ): { input: SwiftCompileInput; binaryFrameworks: string[] } {
2085
- return withXcodeLayout(() => {
2086
- const input = snapshotCompileInput(packageSnapshot(projectFor(packagePath), entry))
2087
- const binaryFrameworks = (
2088
- xcodeLayout(fs.realpathSync(packagePath))?.app.binaryFrameworks ?? []
2089
- ).flatMap(({ path: dir }) => (dir ? [dir] : []))
2090
- return { input, binaryFrameworks }
2317
+ moduleRoot?: string,
2318
+ ): Promise<{
2319
+ input: SwiftCompileInput
2320
+ binaryFrameworks: string[]
2321
+ sourcePaths: Record<string, string>
2322
+ }> {
2323
+ const project = projectFor(packagePath)
2324
+ return withXcodeLayout(project.packagePath, () => {
2325
+ const input = snapshotCompileInput(packageSnapshot(project, entry, moduleRoot))
2326
+ const layout = xcodeLayout(fs.realpathSync(packagePath))
2327
+ const binaryFrameworks = (layout?.app.binaryFrameworks ?? []).flatMap(
2328
+ ({ path: dir }) => (dir ? [dir] : []),
2329
+ )
2330
+ const sourcePaths = Object.fromEntries(
2331
+ layout
2332
+ ? [...new Set([...layout.files, ...layout.nativeFiles.keys()])].flatMap(
2333
+ (file) => {
2334
+ const key = xcodeInputKey(
2335
+ layout,
2336
+ file,
2337
+ path.relative(packagePath, file).split(path.sep).join('/'),
2338
+ )
2339
+ return input.files[key] === undefined ? [] : [[key, file]]
2340
+ },
2341
+ )
2342
+ : [],
2343
+ )
2344
+ return { input, binaryFrameworks, sourcePaths }
2091
2345
  })
2092
2346
  }
2093
2347
 
@@ -2169,14 +2423,18 @@ async function compile(
2169
2423
  if (process.env.CONTRAST_SWIFT_BUILD_ROOT)
2170
2424
  return process.env.CONTRAST_SWIFT_BUILD_ROOT
2171
2425
  const resolvedPath = path.resolve(packagePath)
2172
- // units of one app share a root so the module cache stays warm across
2173
- // server restarts: peach-expo-swift/<app>/<scope>/<package> shares
2174
- // <app>. servers on one app queue on the root lock.
2426
+ // units of one app or nitro module share a root so the module cache stays
2427
+ // warm across server restarts: peach-expo-swift/<app>/<scope>/<package>
2428
+ // and peach-nitro-swift/<module>/<scope> share <app> or <module>.
2429
+ // servers on one app or module queue on the root lock.
2175
2430
  const parts = resolvedPath.split(path.sep)
2176
- const expoAt = parts.lastIndexOf('peach-expo-swift')
2431
+ const scopedAt = Math.max(
2432
+ parts.lastIndexOf('peach-expo-swift'),
2433
+ parts.lastIndexOf('peach-nitro-swift'),
2434
+ )
2177
2435
  const buildKeyPath =
2178
- expoAt >= 0 && parts.length >= expoAt + 3
2179
- ? parts.slice(0, expoAt + 2).join(path.sep)
2436
+ scopedAt >= 0 && parts.length >= scopedAt + 3
2437
+ ? parts.slice(0, scopedAt + 2).join(path.sep)
2180
2438
  : (sourceEntries.get(resolvedPath) ?? resolvedPath)
2181
2439
  return path.join(
2182
2440
  swiftCacheDir(),
@@ -2357,7 +2615,7 @@ async function missingModulesMessage(
2357
2615
  ].join('\n')
2358
2616
  }
2359
2617
 
2360
- // a hosted compile (`peach swift --upload-source`) compiles the package where
2618
+ // a hosted compile (`peach open --upload-source`) compiles the package where
2361
2619
  // a Contrast project's compiles: Contrast's compile route, authorized by
2362
2620
  // `peach login` or PEACH_API_KEY. the service renders the
2363
2621
  // native dispatch glue itself under the package's id and answers the wasm at a
@@ -2404,6 +2662,7 @@ async function compileRemote(
2404
2662
  }
2405
2663
  : {}),
2406
2664
  ...(snapshot.nativeTargets ? { nativeTargets: snapshot.nativeTargets } : {}),
2665
+ ...(snapshot.headerAliases ? { headerAliases: snapshot.headerAliases } : {}),
2407
2666
  ...(snapshot.defaultLocalization
2408
2667
  ? { defaultLocalization: snapshot.defaultLocalization }
2409
2668
  : {}),
@@ -2458,11 +2717,31 @@ async function compileRemote(
2458
2717
  }
2459
2718
  }
2460
2719
 
2720
+ // the stamp reads the project layout, which builds async.
2721
+ function currentStamp(project: SwiftProject, moduleRoot: string | undefined) {
2722
+ return withXcodeLayout(project.packagePath, () =>
2723
+ sourceStamp(project.packagePath, moduleRoot, Boolean(project.hosted)),
2724
+ )
2725
+ }
2726
+
2727
+ // one layout scope per call: the build, its stamps and the compile read the
2728
+ // layout prepared at the start, and a later call prepares its own.
2461
2729
  export function artifactFor(
2462
2730
  project: SwiftProject,
2463
2731
  entry: string,
2464
2732
  moduleRoot?: string,
2465
2733
  signal: AbortSignal | undefined = project.signal,
2734
+ ): Promise<SwiftArtifact> {
2735
+ return withXcodeLayout(project.packagePath, () =>
2736
+ scopedArtifact(project, entry, moduleRoot, signal),
2737
+ )
2738
+ }
2739
+
2740
+ function scopedArtifact(
2741
+ project: SwiftProject,
2742
+ entry: string,
2743
+ moduleRoot: string | undefined,
2744
+ signal: AbortSignal | undefined,
2466
2745
  ): Promise<SwiftArtifact> {
2467
2746
  if (project.signal && signal !== project.signal)
2468
2747
  signal = signal ? AbortSignal.any([project.signal, signal]) : project.signal
@@ -2493,10 +2772,13 @@ export function artifactFor(
2493
2772
  .finally(() => signal.removeEventListener('abort', stop))
2494
2773
  })
2495
2774
  }
2496
- const snapshot = packageSnapshot(project, entry)
2497
- if (sourceStamp(project.packagePath, moduleRoot, Boolean(project.hosted)) !== stamp) {
2498
- return artifactFor(project, entry, moduleRoot, signal)
2499
- }
2775
+ const snapshotRoot =
2776
+ moduleRoot ??
2777
+ xcodeProjects.get(project.packagePath)?.moduleRoot ??
2778
+ linkedModuleRoots(project.packagePath).find((root) =>
2779
+ fs.existsSync(path.join(root, 'toolchain.json')),
2780
+ )
2781
+ const snapshot = packageSnapshot(project, entry, snapshotRoot)
2500
2782
  // a save that changed only view builder literals keeps the running bytes
2501
2783
  const compiled = project.artifact?.compiled
2502
2784
  if (
@@ -2536,9 +2818,8 @@ export function artifactFor(
2536
2818
  throw error
2537
2819
  },
2538
2820
  )
2539
- const fresh = promise.then((artifact) =>
2540
- sourceStamp(project.packagePath, moduleRoot, Boolean(project.hosted)) ===
2541
- artifact.stamp
2821
+ const fresh = promise.then(async (artifact) =>
2822
+ (await currentStamp(project, moduleRoot)) === artifact.stamp
2542
2823
  ? artifact
2543
2824
  : artifactFor(project, entry, moduleRoot, signal),
2544
2825
  )
@@ -2546,12 +2827,12 @@ export function artifactFor(
2546
2827
  return fresh
2547
2828
  }
2548
2829
 
2549
- export function swiftPackageWatchFiles(
2830
+ export async function swiftPackageWatchFiles(
2550
2831
  packagePath: string,
2551
2832
  moduleRoot: string | undefined,
2552
- ): string[] {
2833
+ ): Promise<string[]> {
2553
2834
  packagePath = fs.realpathSync(packagePath)
2554
- return [
2835
+ return withXcodeLayout(packagePath, () => [
2555
2836
  ...(xcodeProjects.has(packagePath) || sourceEntries.has(packagePath)
2556
2837
  ? []
2557
2838
  : [path.join(packagePath, 'Package.swift')]),
@@ -2560,7 +2841,7 @@ export function swiftPackageWatchFiles(
2560
2841
  ...(moduleRoot
2561
2842
  ? swiftModuleInputFiles(moduleRoot).map((file) => path.join(moduleRoot, file))
2562
2843
  : []),
2563
- ]
2844
+ ])
2564
2845
  }
2565
2846
 
2566
2847
  export async function swiftPackageMetadata(
@@ -2691,7 +2972,14 @@ export async function swiftPackageMetadata(
2691
2972
  }
2692
2973
  }
2693
2974
 
2694
- export function serveSwiftPackageAsset(pathname: string, res: ServerResponse): boolean {
2975
+ export async function serveSwiftPackageAsset(
2976
+ pathname: string,
2977
+ res: ServerResponse,
2978
+ ): Promise<boolean> {
2979
+ const acceptEncoding = res.req?.headers['accept-encoding'] ?? ''
2980
+ const acceptsBr = /\bbr\b/.test(
2981
+ Array.isArray(acceptEncoding) ? acceptEncoding.join(',') : acceptEncoding,
2982
+ )
2695
2983
  if (pathname.startsWith(RESOURCE_PATH)) {
2696
2984
  for (const project of projects.values()) {
2697
2985
  const served = serveSwiftResource(project, pathname.slice(RESOURCE_PATH.length))
@@ -2715,9 +3003,16 @@ export function serveSwiftPackageAsset(pathname: string, res: ServerResponse): b
2715
3003
  // the address is the content, so the browser keeps it across reloads,
2716
3004
  // restarts and every app built with this toolchain
2717
3005
  res.setHeader('access-control-allow-origin', '*')
2718
- res.setHeader('content-type', 'application/gzip')
2719
3006
  res.setHeader('cache-control', 'public, max-age=31536000, immutable')
2720
- res.end(icu.gzip)
3007
+ res.setHeader('vary', 'accept-encoding')
3008
+ if (acceptsBr) {
3009
+ res.setHeader('content-type', 'application/octet-stream')
3010
+ res.setHeader('content-encoding', 'br')
3011
+ res.end(await swiftIcuBrotliQ4(icu))
3012
+ } else {
3013
+ res.setHeader('content-type', 'application/gzip')
3014
+ res.end(icu.gzip)
3015
+ }
2721
3016
  return true
2722
3017
  }
2723
3018
  res.statusCode = 404
@@ -2732,7 +3027,13 @@ export function serveSwiftPackageAsset(pathname: string, res: ServerResponse): b
2732
3027
  if (!artifact || pathname !== `${ARTIFACT_PATH}${artifact.hash}.wasm`) continue
2733
3028
  res.setHeader('access-control-allow-origin', '*')
2734
3029
  res.setHeader('content-type', 'application/wasm')
2735
- res.end(artifact.bytes)
3030
+ res.setHeader('vary', 'accept-encoding')
3031
+ if (acceptsBr) {
3032
+ res.setHeader('content-encoding', 'br')
3033
+ res.end(await brotliCompressQ4(artifact.bytes, artifact.hash))
3034
+ } else {
3035
+ res.end(artifact.bytes)
3036
+ }
2736
3037
  return true
2737
3038
  }
2738
3039
  res.statusCode = 404