peachsim 0.1.1660 → 0.1.1673

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 (515) hide show
  1. package/README.md +8 -1
  2. package/cli/bridge-flow-runner.ts +6 -3
  3. package/cli/commands/box.ts +2 -0
  4. package/cli/commands/control.ts +56 -17
  5. package/cli/commands/coverage-swift.ts +291 -0
  6. package/cli/commands/coverage.ts +168 -24
  7. package/cli/commands/debug.ts +100 -9
  8. package/cli/commands/diagnose.ts +1 -19
  9. package/cli/commands/flow.ts +2 -2
  10. package/cli/commands/inspect/settle.ts +4 -2
  11. package/cli/commands/inspect/settling.ts +17 -14
  12. package/cli/commands/platform.ts +3 -0
  13. package/cli/commands/react.ts +3 -18
  14. package/cli/commands/screenshot.ts +1 -1
  15. package/cli/commands/screenshots-capture.ts +1 -1
  16. package/cli/current-sim.ts +21 -1
  17. package/cli/dev-build-freshness.ts +36 -2
  18. package/cli/drivers/playwright-provisioning.ts +1 -4
  19. package/cli/drivers/playwright.ts +15 -1
  20. package/cli/maestro-compare.ts +44 -14
  21. package/cli/main.ts +3 -0
  22. package/cli/material-symbol-fonts.ts +3 -100
  23. package/cli/output-redaction.ts +21 -6
  24. package/cli/parent-pid.ts +2 -2
  25. package/cli/scene-video.ts +1 -1
  26. package/cli/ui.ts +20 -0
  27. package/cli/ws-bridge.ts +26 -37
  28. package/detox/frame-identity.cjs +21 -0
  29. package/detox/frame-identity.d.cts +6 -0
  30. package/detox/index.ts +39 -33
  31. package/detox/jest-environment.cjs +4 -1
  32. package/detox/jest-setup-after-env.cjs +0 -4
  33. package/detox/navigation-lifecycle.ts +2 -2
  34. package/detox/proof-observer.ts +126 -0
  35. package/dist-lib/agent-daemon-client.cjs +29 -1
  36. package/dist-lib/agent-events.cjs +1 -1
  37. package/dist-lib/attached-projects.cjs +10 -1
  38. package/dist-lib/auth/shared-session.cjs +1 -1
  39. package/dist-lib/backend-origin.cjs +1 -1
  40. package/dist-lib/beta.cjs +1 -1
  41. package/dist-lib/beta.mjs +1 -1
  42. package/dist-lib/bridge-constants.cjs +1 -1
  43. package/dist-lib/bridge-contract-input.cjs +1 -1
  44. package/dist-lib/bridge-contract-input.mjs +1 -1
  45. package/dist-lib/bridge-contract.cjs +1 -1
  46. package/dist-lib/bridge-contract.mjs +1 -1
  47. package/dist-lib/bundle-channel.cjs +2581 -27346
  48. package/dist-lib/capture-contract.cjs +1 -1
  49. package/dist-lib/capture-contract.mjs +1 -1
  50. package/dist-lib/cloud-contract.cjs +1 -1
  51. package/dist-lib/cloud-contract.mjs +1 -1
  52. package/dist-lib/cloud-test-args.cjs +1 -1
  53. package/dist-lib/cloud-test-args.mjs +1 -1
  54. package/dist-lib/cloud.cjs +1 -1
  55. package/dist-lib/cloud.mjs +1 -1
  56. package/dist-lib/config.cjs +1 -1
  57. package/dist-lib/config.mjs +1 -1
  58. package/dist-lib/detox/index.cjs +2752 -4982
  59. package/dist-lib/detox/jest-environment.cjs +4 -1
  60. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  61. package/dist-lib/expo-swift-bundle.cjs +2272 -27004
  62. package/dist-lib/expo-swift-metadata.cjs +1 -1
  63. package/dist-lib/expo-swift-metadata.mjs +1 -1
  64. package/dist-lib/home-paths.cjs +1 -1
  65. package/dist-lib/host/bridge-host.cjs +2801 -27484
  66. package/dist-lib/host/fetch-proxy-handler.cjs +7 -7
  67. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  68. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  69. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  70. package/dist-lib/host/websocket-proxy.cjs +1 -1
  71. package/dist-lib/index.cjs +394 -49
  72. package/dist-lib/jump-to-source-babel.cjs +1 -1
  73. package/dist-lib/jump-to-source-native.cjs +1 -1
  74. package/dist-lib/kotlin-host.cjs +1 -1
  75. package/dist-lib/menu.cjs +1 -1
  76. package/dist-lib/menu.mjs +1 -1
  77. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  78. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  79. package/dist-lib/metro-production-bundle.cjs +10 -1
  80. package/dist-lib/metro-production-bundle.mjs +12 -1
  81. package/dist-lib/metro.cjs +235 -13
  82. package/dist-lib/native-app-identity-project.cjs +123 -13
  83. package/dist-lib/native-app-identity-project.mjs +123 -13
  84. package/dist-lib/native-app-identity.cjs +1 -1
  85. package/dist-lib/native-app-identity.mjs +1 -1
  86. package/dist-lib/native-firebase-metadata.cjs +1 -1
  87. package/dist-lib/native-firebase-metadata.mjs +1 -1
  88. package/dist-lib/plist.cjs +1 -1
  89. package/dist-lib/plist.mjs +1 -1
  90. package/dist-lib/profiles.cjs +21 -1
  91. package/dist-lib/public-brand.cjs +1 -1
  92. package/dist-lib/public-origins-lib-esm.json +76 -28
  93. package/dist-lib/public-origins-lib-static.json +1 -1
  94. package/dist-lib/public-origins-lib.json +590 -184
  95. package/dist-lib/react-native-host-modules.cjs +1 -1
  96. package/dist-lib/react-native-host-modules.mjs +1 -1
  97. package/dist-lib/reap-browser.cjs +964 -0
  98. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  99. package/dist-lib/sdk.cjs +18 -15
  100. package/dist-lib/sdk.mjs +18 -15
  101. package/dist-lib/skills.cjs +3900 -28409
  102. package/dist-lib/swift-compile.cjs +1227 -26292
  103. package/dist-lib/swift-compile.mjs +1156 -26221
  104. package/dist-lib/swift-package.cjs +34 -4
  105. package/dist-lib/swift-package.mjs +33 -4
  106. package/dist-lib/swift-submit.cjs +2 -2
  107. package/dist-lib/swift-submit.mjs +2 -2
  108. package/dist-lib/swift-toolchain.cjs +52 -44
  109. package/dist-lib/swift.cjs +1 -1
  110. package/dist-lib/vite-swift.cjs +2317 -26955
  111. package/dist-lib/vite.cjs +132 -21
  112. package/dist-lib/worklet-executable.cjs +1 -1
  113. package/dist-lib/worklet-executable.mjs +1 -1
  114. package/dist-types/packages/peach-engine/src/demo/demo-bundle-platform.d.ts +29 -0
  115. package/dist-types/packages/peach-engine/src/engine/app-font-registry.d.ts +13 -1
  116. package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +24 -0
  117. package/dist-types/packages/peach-engine/src/engine/fontDataContract.d.ts +73 -0
  118. package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +2 -3
  119. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +21 -3
  120. package/dist-types/packages/peach-engine/src/engine/inspect-outline.d.ts +2 -1
  121. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -4
  122. package/dist-types/packages/peach-engine/src/engine/node.d.ts +0 -1
  123. package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +3 -1
  124. package/dist-types/packages/peach-engine/src/ios/aux-shell-animated-sources.d.ts +6 -0
  125. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +68 -0
  126. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +11 -0
  127. package/dist-types/packages/peach-engine/src/render-worker/nativeSyncReplyContract.d.ts +1 -0
  128. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +8 -1
  129. package/dist-types/packages/peach-engine/src/render-worker/shell-scene-schema.d.ts +10 -2
  130. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime-kind.d.ts +24 -0
  131. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +7 -2
  132. package/dist-types/packages/peach-engine/src/settings/devices.d.ts +1 -0
  133. package/dist-types/packages/peach-globals/src/accessibilityBridgeContract.d.ts +11 -0
  134. package/dist-types/packages/peach-globals/src/androidDateTimePickerBridgeContract.d.ts +41 -0
  135. package/dist-types/packages/peach-globals/src/appLifecycleBridgeContract.d.ts +22 -0
  136. package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +33 -0
  137. package/dist-types/packages/peach-globals/src/bridgeContract.d.ts +1 -0
  138. package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +94 -0
  139. package/dist-types/packages/peach-globals/src/captureBridgeContract.d.ts +36 -0
  140. package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +45 -0
  141. package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +31 -0
  142. package/dist-types/packages/peach-globals/src/debugBridgeContract.d.ts +27 -0
  143. package/dist-types/packages/peach-globals/src/electronBridgeContract.d.ts +29 -0
  144. package/dist-types/packages/peach-globals/src/eventBridgeContract.d.ts +200 -0
  145. package/dist-types/packages/peach-globals/src/globalsContract.d.ts +462 -0
  146. package/dist-types/packages/peach-globals/src/hostStorageBridgeContract.d.ts +3 -0
  147. package/dist-types/packages/peach-globals/src/imagePickerBridgeContract.d.ts +47 -0
  148. package/dist-types/packages/peach-globals/src/index.d.ts +47 -3343
  149. package/dist-types/packages/peach-globals/src/interactionBridgeContract.d.ts +21 -0
  150. package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +44 -0
  151. package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +77 -0
  152. package/dist-types/packages/peach-globals/src/nativeViewContract.d.ts +28 -0
  153. package/dist-types/packages/peach-globals/src/navigationBridgeContract.d.ts +11 -0
  154. package/dist-types/packages/peach-globals/src/nodeContract.d.ts +665 -0
  155. package/dist-types/packages/peach-globals/src/performanceBridgeContract.d.ts +100 -0
  156. package/dist-types/packages/peach-globals/src/permissionsBridgeContract.d.ts +152 -0
  157. package/dist-types/packages/peach-globals/src/photoLibraryBridgeContract.d.ts +36 -0
  158. package/dist-types/packages/peach-globals/src/portalBridgeContract.d.ts +9 -0
  159. package/dist-types/packages/peach-globals/src/recordingBridgeContract.d.ts +131 -0
  160. package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +125 -0
  161. package/dist-types/packages/peach-globals/src/sceneStreamBridgeContract.d.ts +37 -0
  162. package/dist-types/packages/peach-globals/src/settingsBridgeContract.d.ts +7 -0
  163. package/dist-types/packages/peach-globals/src/shareSheetBridgeContract.d.ts +14 -0
  164. package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +82 -0
  165. package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +28 -0
  166. package/dist-types/packages/peach-globals/src/speechSynthesisBridgeContract.d.ts +25 -0
  167. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +278 -0
  168. package/dist-types/packages/peach-globals/src/timelineBridgeContract.d.ts +58 -0
  169. package/dist-types/packages/peach-globals/src/videoBridgeContract.d.ts +80 -0
  170. package/dist-types/packages/peach-globals/src/webViewBridgeContract.d.ts +331 -0
  171. package/dist-types/packages/peach-globals/src/windowBridgeContract.d.ts +5 -0
  172. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  173. package/dist-types/packages/peach-kit/src/ui/popover-placement.d.ts +3 -5
  174. package/package.json +2 -1
  175. package/runtime-companion.json +1 -1
  176. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVAsset.h +20 -0
  177. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVAsynchronousKeyValueLoading.h +15 -0
  178. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.h +5 -0
  179. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVMetadataFormat.h +13 -0
  180. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVMetadataItem.h +16 -0
  181. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVTimedMetadataGroup.h +13 -0
  182. package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Modules/module.modulemap +4 -0
  183. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +19 -0
  184. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +11 -0
  185. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +17 -0
  186. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +13 -0
  187. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +307 -0
  188. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +174 -0
  189. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +7 -0
  190. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.h +5 -0
  191. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchRequest.h +21 -0
  192. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchedResultsController.h +39 -0
  193. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObject.h +10 -0
  194. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectContext.h +9 -0
  195. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectID.h +7 -0
  196. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectModel.h +5 -0
  197. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreCoordinator.h +5 -0
  198. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreRequest.h +5 -0
  199. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Modules/module.modulemap +5 -0
  200. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +2 -0
  201. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +221 -0
  202. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h +2 -0
  203. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +316 -0
  204. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Modules/module.modulemap +4 -0
  205. package/sdk/ios/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.h +46 -0
  206. package/sdk/ios/System/Library/Frameworks/CoreImage.framework/Modules/module.modulemap +4 -0
  207. package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMTime.h +31 -0
  208. package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMTimeRange.h +8 -0
  209. package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.h +3 -0
  210. package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Modules/module.modulemap +4 -0
  211. package/sdk/ios/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h +12 -0
  212. package/sdk/ios/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h +1276 -0
  213. package/sdk/ios/System/Library/Frameworks/CoreServices.framework/Headers/UTType.h +644 -0
  214. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontManager.h +20 -0
  215. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h +2 -0
  216. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Modules/module.modulemap +4 -0
  217. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +1441 -0
  218. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Modules/module.modulemap +4 -0
  219. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageAnimation.h +106 -0
  220. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageDestination.h +429 -0
  221. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageMetadata.h +665 -0
  222. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageProperties.h +2504 -0
  223. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageSource.h +634 -0
  224. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/ImageIO.h +22 -0
  225. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/ImageIOBase.h +18 -0
  226. package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Modules/module.modulemap +4 -0
  227. package/sdk/ios/System/Library/Frameworks/MobileCoreServices.framework/Headers/MobileCoreServices.h +9 -0
  228. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +40 -0
  229. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Modules/module.modulemap +4 -0
  230. package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h +14 -0
  231. package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewControllerConfiguration.h +9 -0
  232. package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SafariServices.h +2 -0
  233. package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Modules/module.modulemap +5 -0
  234. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +3 -0
  235. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +30 -0
  236. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +3 -0
  237. package/sdk/ios/System/Library/Frameworks/Security.framework/Modules/module.modulemap +5 -0
  238. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStore.h +439 -0
  239. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h +216 -0
  240. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreKey.h +267 -0
  241. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetwork.h +204 -0
  242. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h +1393 -0
  243. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConnection.h +568 -0
  244. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkReachability.h +369 -0
  245. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferences.h +473 -0
  246. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesPath.h +179 -0
  247. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesSetSpecific.h +95 -0
  248. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h +2395 -0
  249. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SystemConfiguration.h +184 -0
  250. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAppearance.h +5 -0
  251. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIColor.h +2 -0
  252. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +817 -0
  253. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Modules/module.modulemap +4 -0
  254. package/sdk/ios/usr/include/Availability.h +630 -0
  255. package/sdk/ios/usr/include/AvailabilityInternal.h +556 -0
  256. package/sdk/ios/usr/include/AvailabilityInternalLegacy.h +4346 -0
  257. package/sdk/ios/usr/include/AvailabilityVersions.h +547 -0
  258. package/sdk/ios/usr/include/CommonCrypto/CommonDigest.h +130 -0
  259. package/sdk/ios/usr/include/MacTypes.h +3 -0
  260. package/sdk/ios/usr/include/TargetConditionals.h +14 -0
  261. package/sdk/ios/usr/include/__xlocale.h +41 -0
  262. package/sdk/ios/usr/include/_bounds.h +67 -0
  263. package/sdk/ios/usr/include/_ctermid.h +42 -0
  264. package/sdk/ios/usr/include/_mb_cur_max.h +39 -0
  265. package/sdk/ios/usr/include/_printf.h +38 -0
  266. package/sdk/ios/usr/include/_stdio.h +510 -0
  267. package/sdk/ios/usr/include/_types/_intmax_t.h +40 -0
  268. package/sdk/ios/usr/include/_types/_locale_t.h +38 -0
  269. package/sdk/ios/usr/include/_types/_uint16_t.h +32 -0
  270. package/sdk/ios/usr/include/_types/_uint32_t.h +32 -0
  271. package/sdk/ios/usr/include/_types/_uint64_t.h +32 -0
  272. package/sdk/ios/usr/include/_types/_uint8_t.h +32 -0
  273. package/sdk/ios/usr/include/_types/_uintmax_t.h +40 -0
  274. package/sdk/ios/usr/include/_types.h +72 -0
  275. package/sdk/ios/usr/include/arm/_endian.h +105 -0
  276. package/sdk/ios/usr/include/arm/_mcontext.h +95 -0
  277. package/sdk/ios/usr/include/arm/_param.h +25 -0
  278. package/sdk/ios/usr/include/arm/_types.h +125 -0
  279. package/sdk/ios/usr/include/arm/endian.h +65 -0
  280. package/sdk/ios/usr/include/arm/signal.h +22 -0
  281. package/sdk/ios/usr/include/arm/types.h +110 -0
  282. package/sdk/ios/usr/include/asl.h +160 -0
  283. package/sdk/ios/usr/include/assert.h +14 -0
  284. package/sdk/ios/usr/include/dirent.h +224 -0
  285. package/sdk/ios/usr/include/dispatch/dispatch.h +114 -0
  286. package/sdk/ios/usr/include/dlfcn.h +16 -0
  287. package/sdk/ios/usr/include/errno.h +24 -0
  288. package/sdk/ios/usr/include/execinfo.h +11 -0
  289. package/sdk/ios/usr/include/fcntl.h +23 -0
  290. package/sdk/ios/usr/include/i386/_endian.h +105 -0
  291. package/sdk/ios/usr/include/i386/_mcontext.h +216 -0
  292. package/sdk/ios/usr/include/i386/_param.h +49 -0
  293. package/sdk/ios/usr/include/i386/_types.h +149 -0
  294. package/sdk/ios/usr/include/i386/endian.h +89 -0
  295. package/sdk/ios/usr/include/i386/signal.h +47 -0
  296. package/sdk/ios/usr/include/libkern/OSAtomic.h +51 -0
  297. package/sdk/ios/usr/include/libkern/OSAtomicDeprecated.h +1267 -0
  298. package/sdk/ios/usr/include/libkern/OSAtomicQueue.h +115 -0
  299. package/sdk/ios/usr/include/libkern/OSByteOrder.h +315 -0
  300. package/sdk/ios/usr/include/libkern/OSSpinLockDeprecated.h +212 -0
  301. package/sdk/ios/usr/include/libkern/_OSByteOrder.h +125 -0
  302. package/sdk/ios/usr/include/libkern/arm/_OSByteOrder.h +99 -0
  303. package/sdk/ios/usr/include/libkern/i386/_OSByteOrder.h +110 -0
  304. package/sdk/ios/usr/include/libkern/machine/OSByteOrder.h +147 -0
  305. package/sdk/ios/usr/include/limits.h +4 -0
  306. package/sdk/ios/usr/include/mach/arm/_structs.h +741 -0
  307. package/sdk/ios/usr/include/mach/boolean.h +4 -0
  308. package/sdk/ios/usr/include/mach/exception_types.h +40 -0
  309. package/sdk/ios/usr/include/mach/host_info.h +200 -0
  310. package/sdk/ios/usr/include/mach/i386/_structs.h +1316 -0
  311. package/sdk/ios/usr/include/mach/kern_return.h +61 -0
  312. package/sdk/ios/usr/include/mach/mach.h +16 -0
  313. package/sdk/ios/usr/include/mach/mach_error.h +10 -0
  314. package/sdk/ios/usr/include/mach/mach_host.h +18 -0
  315. package/sdk/ios/usr/include/mach/mach_init.h +15 -0
  316. package/sdk/ios/usr/include/mach/mach_port.h +11 -0
  317. package/sdk/ios/usr/include/mach/mach_time.h +14 -0
  318. package/sdk/ios/usr/include/mach/mach_types.h +20 -0
  319. package/sdk/ios/usr/include/mach/machine/_structs.h +40 -0
  320. package/sdk/ios/usr/include/mach/machine.h +144 -0
  321. package/sdk/ios/usr/include/mach/task.h +14 -0
  322. package/sdk/ios/usr/include/mach/task_info.h +23 -0
  323. package/sdk/ios/usr/include/mach/task_policy.h +29 -0
  324. package/sdk/ios/usr/include/mach/thread_act.h +12 -0
  325. package/sdk/ios/usr/include/mach/thread_info.h +32 -0
  326. package/sdk/ios/usr/include/mach/time_value.h +4 -0
  327. package/sdk/ios/usr/include/mach/vm_prot.h +8 -0
  328. package/sdk/ios/usr/include/mach/vm_region.h +43 -0
  329. package/sdk/ios/usr/include/mach/vm_statistics.h +491 -0
  330. package/sdk/ios/usr/include/mach/vm_types.h +8 -0
  331. package/sdk/ios/usr/include/mach-o/arch.h +21 -0
  332. package/sdk/ios/usr/include/mach-o/dyld.h +16 -0
  333. package/sdk/ios/usr/include/mach-o/dyld_images.h +71 -0
  334. package/sdk/ios/usr/include/mach-o/getsect.h +17 -0
  335. package/sdk/ios/usr/include/mach-o/loader.h +158 -0
  336. package/sdk/ios/usr/include/mach-o/nlist.h +38 -0
  337. package/sdk/ios/usr/include/mach-o/stab.h +33 -0
  338. package/sdk/ios/usr/include/mach-o/utils.h +10 -0
  339. package/sdk/ios/usr/include/machine/_endian.h +42 -0
  340. package/sdk/ios/usr/include/machine/_mcontext.h +39 -0
  341. package/sdk/ios/usr/include/machine/_param.h +39 -0
  342. package/sdk/ios/usr/include/machine/_types.h +39 -0
  343. package/sdk/ios/usr/include/machine/endian.h +42 -0
  344. package/sdk/ios/usr/include/machine/signal.h +39 -0
  345. package/sdk/ios/usr/include/machine/types.h +42 -0
  346. package/sdk/ios/usr/include/math.h +5 -0
  347. package/sdk/ios/usr/include/module.modulemap +4 -0
  348. package/sdk/ios/usr/include/net/if.h +20 -0
  349. package/sdk/ios/usr/include/net/if_dl.h +10 -0
  350. package/sdk/ios/usr/include/net/if_var.h +15 -0
  351. package/sdk/ios/usr/include/net/net_kev.h +100 -0
  352. package/sdk/ios/usr/include/netdb.h +5 -0
  353. package/sdk/ios/usr/include/netinet/in.h +670 -0
  354. package/sdk/ios/usr/include/netinet6/in6.h +676 -0
  355. package/sdk/ios/usr/include/notify.h +45 -0
  356. package/sdk/ios/usr/include/notify_keys.h +17 -0
  357. package/sdk/ios/usr/include/objc/NSObject.h +79 -0
  358. package/sdk/ios/usr/include/os/availability.h +140 -0
  359. package/sdk/ios/usr/include/os/lock.h +24 -0
  360. package/sdk/ios/usr/include/os/log.h +77 -0
  361. package/sdk/ios/usr/include/os/object.h +13 -0
  362. package/sdk/ios/usr/include/peach/darwin.h +6 -0
  363. package/sdk/ios/usr/include/peach/netdb.h +316 -0
  364. package/sdk/ios/usr/include/peach/pthread.h +19 -0
  365. package/sdk/ios/usr/include/pthread.h +4 -0
  366. package/sdk/ios/usr/include/secure/_common.h +45 -0
  367. package/sdk/ios/usr/include/secure/_stdio.h +130 -0
  368. package/sdk/ios/usr/include/signal.h +132 -0
  369. package/sdk/ios/usr/include/stdint.h +205 -0
  370. package/sdk/ios/usr/include/stdio.h +65 -0
  371. package/sdk/ios/usr/include/stdlib.h +17 -0
  372. package/sdk/ios/usr/include/string.h +8 -0
  373. package/sdk/ios/usr/include/sys/__endian.h +108 -0
  374. package/sdk/ios/usr/include/sys/_endian.h +152 -0
  375. package/sdk/ios/usr/include/sys/_posix_availability.h +73 -0
  376. package/sdk/ios/usr/include/sys/_pthread/_pthread_attr_t.h +32 -0
  377. package/sdk/ios/usr/include/sys/_pthread/_pthread_t.h +32 -0
  378. package/sdk/ios/usr/include/sys/_pthread/_pthread_types.h +120 -0
  379. package/sdk/ios/usr/include/sys/_symbol_aliasing.h +1093 -0
  380. package/sdk/ios/usr/include/sys/_types/_errno_t.h +31 -0
  381. package/sdk/ios/usr/include/sys/_types/_filesec_t.h +32 -0
  382. package/sdk/ios/usr/include/sys/_types/_gid_t.h +32 -0
  383. package/sdk/ios/usr/include/sys/_types/_in_addr_t.h +32 -0
  384. package/sdk/ios/usr/include/sys/_types/_in_port_t.h +32 -0
  385. package/sdk/ios/usr/include/sys/_types/_ino_t.h +32 -0
  386. package/sdk/ios/usr/include/sys/_types/_int16_t.h +31 -0
  387. package/sdk/ios/usr/include/sys/_types/_int32_t.h +31 -0
  388. package/sdk/ios/usr/include/sys/_types/_int64_t.h +31 -0
  389. package/sdk/ios/usr/include/sys/_types/_int8_t.h +31 -0
  390. package/sdk/ios/usr/include/sys/_types/_intptr_t.h +33 -0
  391. package/sdk/ios/usr/include/sys/_types/_iovec_t.h +35 -0
  392. package/sdk/ios/usr/include/sys/_types/_mode_t.h +32 -0
  393. package/sdk/ios/usr/include/sys/_types/_null.h +54 -0
  394. package/sdk/ios/usr/include/sys/_types/_o_dsync.h +30 -0
  395. package/sdk/ios/usr/include/sys/_types/_o_sync.h +30 -0
  396. package/sdk/ios/usr/include/sys/_types/_off_t.h +32 -0
  397. package/sdk/ios/usr/include/sys/_types/_pid_t.h +32 -0
  398. package/sdk/ios/usr/include/sys/_types/_ptrdiff_t.h +56 -0
  399. package/sdk/ios/usr/include/sys/_types/_s_ifmt.h +74 -0
  400. package/sdk/ios/usr/include/sys/_types/_sa_family_t.h +32 -0
  401. package/sdk/ios/usr/include/sys/_types/_seek_set.h +51 -0
  402. package/sdk/ios/usr/include/sys/_types/_sigaltstack.h +50 -0
  403. package/sdk/ios/usr/include/sys/_types/_sigset_t.h +32 -0
  404. package/sdk/ios/usr/include/sys/_types/_size_t.h +56 -0
  405. package/sdk/ios/usr/include/sys/_types/_socklen_t.h +32 -0
  406. package/sdk/ios/usr/include/sys/_types/_ssize_t.h +32 -0
  407. package/sdk/ios/usr/include/sys/_types/_timespec.h +38 -0
  408. package/sdk/ios/usr/include/sys/_types/_timeval32.h +3 -0
  409. package/sdk/ios/usr/include/sys/_types/_u_int16_t.h +31 -0
  410. package/sdk/ios/usr/include/sys/_types/_u_int32_t.h +31 -0
  411. package/sdk/ios/usr/include/sys/_types/_u_int64_t.h +31 -0
  412. package/sdk/ios/usr/include/sys/_types/_u_int8_t.h +31 -0
  413. package/sdk/ios/usr/include/sys/_types/_ucontext.h +59 -0
  414. package/sdk/ios/usr/include/sys/_types/_uid_t.h +32 -0
  415. package/sdk/ios/usr/include/sys/_types/_uintptr_t.h +37 -0
  416. package/sdk/ios/usr/include/sys/_types/_va_list.h +49 -0
  417. package/sdk/ios/usr/include/sys/_types/_wchar_t.h +59 -0
  418. package/sdk/ios/usr/include/sys/_types.h +103 -0
  419. package/sdk/ios/usr/include/sys/appleapiopts.h +61 -0
  420. package/sdk/ios/usr/include/sys/cdefs.h +341 -0
  421. package/sdk/ios/usr/include/sys/constrained_ctypes.h +622 -0
  422. package/sdk/ios/usr/include/sys/dirent.h +141 -0
  423. package/sdk/ios/usr/include/sys/errno.h +271 -0
  424. package/sdk/ios/usr/include/sys/fcntl.h +649 -0
  425. package/sdk/ios/usr/include/sys/mman.h +273 -0
  426. package/sdk/ios/usr/include/sys/proc.h +65 -0
  427. package/sdk/ios/usr/include/sys/qos.h +61 -0
  428. package/sdk/ios/usr/include/sys/signal.h +394 -0
  429. package/sdk/ios/usr/include/sys/socket.h +752 -0
  430. package/sdk/ios/usr/include/sys/stdio.h +61 -0
  431. package/sdk/ios/usr/include/sys/sysctl.h +74 -0
  432. package/sdk/ios/usr/include/sys/syslimits.h +11 -0
  433. package/sdk/ios/usr/include/sys/time.h +5 -0
  434. package/sdk/ios/usr/include/sys/types.h +21 -0
  435. package/sdk/ios/usr/include/sys/ucontext.h +41 -0
  436. package/sdk/ios/usr/include/sys/xattr.h +50 -0
  437. package/sdk/ios/usr/include/time.h +2 -0
  438. package/sdk/ios/usr/include/unistd.h +3 -0
  439. package/sdk/ios/usr/include/uuid/uuid.h +19 -0
  440. package/sdk/ios/usr/include/xlocale/_stdio.h +85 -0
  441. package/sdk/ios/usr/lib/swift/CoreGraphics.swiftmodule/arm64-apple-ios-simulator.swiftinterface +8 -0
  442. package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +51 -0
  443. package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +20 -0
  444. package/sdk/ios/wasm/include/dlfcn.h +3 -0
  445. package/sdk/ios/wasm/include/netdb.h +4 -0
  446. package/sdk/ios/wasm/include/pthread.h +3 -0
  447. package/sdk/ios/wasm/include/stdlib.h +3 -0
  448. package/sdk/ios/wasm/include/string.h +3 -0
  449. package/sdk/ios/wasm/include/sys/socket.h +7 -0
  450. package/sdk/ios/wasm/include/sys/types.h +4 -0
  451. package/sdk/ios/wasm/include/sys/ucontext.h +38 -0
  452. package/src/bridge-contract.ts +42 -0
  453. package/src/chromium-admission.ts +196 -0
  454. package/src/cli-runtime.ts +5 -5
  455. package/src/conformance-comparison-contract.ts +146 -0
  456. package/src/conformance-pixel-comparison.ts +327 -0
  457. package/src/device-catalog.ts +12 -3
  458. package/src/host/bridge-host.ts +6 -43
  459. package/src/launch-deadline.ts +74 -0
  460. package/src/material-symbol-fonts.ts +107 -0
  461. package/src/nitro-adapter.lock.json +3 -3
  462. package/src/profiles.ts +21 -0
  463. package/src/react-native-coverage/capability-reference-resolution.ts +402 -0
  464. package/src/react-native-coverage/capability-source-references.ts +1296 -0
  465. package/src/react-native-coverage/native-typescript-parser.ts +74 -0
  466. package/src/react-native-coverage/project-aliases.ts +207 -0
  467. package/src/react-native-coverage/verified-reach.ts +47 -0
  468. package/src/reap-browser.ts +1019 -0
  469. package/src/skills/builtin/a11y-review.ts +1 -1
  470. package/src/skills/builtin/perf-profile.ts +1 -1
  471. package/src/skills/builtin/screenshot-all.ts +1 -1
  472. package/src/skills/builtin/visual-diff.ts +1 -1
  473. package/src/swift-compile.ts +584 -226
  474. package/src/swift-compiler-digest.ts +6 -2
  475. package/src/swift-coverage/indexdump.ts +80 -0
  476. package/src/swift-coverage/indexing.ts +147 -0
  477. package/src/swift-coverage/package.ts +230 -0
  478. package/src/swift-coverage/provenance.ts +47 -0
  479. package/src/swift-coverage/reader.ts +81 -0
  480. package/src/swift-coverage/source.ts +252 -0
  481. package/src/swift-coverage/types.ts +58 -0
  482. package/src/swift-coverage/xcode-assets.ts +175 -0
  483. package/src/swift-coverage/xcode-bridging.ts +160 -0
  484. package/src/swift-coverage/xcode-packages.ts +251 -0
  485. package/src/swift-coverage/xcode-strings.ts +78 -0
  486. package/src/swift-coverage/xcode.ts +656 -0
  487. package/src/swift-distribution.lock.json +8 -8
  488. package/src/swift-distribution.ts +2 -1
  489. package/src/swift-host.ts +47 -4
  490. package/src/swift-objc-compile.ts +72 -97
  491. package/src/swift-objc-import.ts +238 -38
  492. package/src/swift-objc-metadata.ts +54 -7
  493. package/src/swift-objc-sdk-tree.ts +17 -0
  494. package/src/swift-objc-sdk.ts +27 -25677
  495. package/src/swift-objc-standin.ts +4 -2
  496. package/src/swift-package-manifest.ts +134 -13
  497. package/src/swift-package.ts +46 -4
  498. package/src/swift-standins.ts +2 -2
  499. package/src/swift-submit.ts +2 -1
  500. package/src/swift-toolchain.ts +72 -61
  501. package/src/swift-vite-lifetime.ts +42 -0
  502. package/src/swiftContract.ts +54 -0
  503. package/src/vite-plugin-one.ts +36 -15
  504. package/src/vite-plugin-swift.ts +21 -2
  505. package/src/worker-system-chunks.ts +3 -10
  506. package/src/xcode-header-search.ts +114 -0
  507. package/src/xcode-project.ts +108 -14
  508. package/detox/attempt-events.cjs +0 -884
  509. package/detox/attempt-events.d.cts +0 -113
  510. package/detox/motion-change.cjs +0 -524
  511. package/detox/motion-change.d.cts +0 -140
  512. package/detox/motion-leg-starts.cjs +0 -20
  513. package/detox/motion-leg-starts.d.cts +0 -8
  514. package/detox/proof-frame.cjs +0 -190
  515. package/detox/record-block-execution.cjs +0 -78
@@ -58,10 +58,25 @@ export async function swiftObjCPrivateImports(
58
58
  asts: AsyncIterable<string>,
59
59
  registeredClasses: readonly string[],
60
60
  ): Promise<string> {
61
+ const collected: string[] = []
62
+ for await (const ast of asts) collected.push(ast)
63
+ return swiftObjCPrivateAdapters(collected, registeredClasses)
64
+ }
65
+
66
+ export function swiftObjCPrivateAdapters(
67
+ asts: Iterable<string>,
68
+ registeredClasses: readonly string[],
69
+ ): string {
61
70
  const registered = new Set(registeredClasses)
62
71
  const implemented = new Set<string>()
63
72
  const adapters: { name: string; nativeName: string }[] = []
64
- for await (const ast of asts) {
73
+ const candidates: {
74
+ nativeName: string
75
+ ancestors: string[]
76
+ rooted: boolean
77
+ renamed: boolean
78
+ }[] = []
79
+ for (const ast of asts) {
65
80
  if (!/^TranslationUnitDecl\b/.test(ast))
66
81
  throw new SwiftObjCImportError('expected original Objective-C implementation AST')
67
82
  const declarations = new Map<string, { parent?: string; renamed: boolean }>()
@@ -98,24 +113,45 @@ export async function swiftObjCPrivateImports(
98
113
  }
99
114
  }
100
115
  for (const nativeName of implementations) {
101
- function fail(reason: string): never {
116
+ if (implemented.has(nativeName))
102
117
  throw new SwiftObjCImportError(
103
- `Objective-C implementation ${nativeName}: ${reason}`,
118
+ `Objective-C implementation ${nativeName}: duplicate original class implementation`,
104
119
  )
105
- }
106
- if (implemented.has(nativeName)) fail('duplicate original class implementation')
107
120
  implemented.add(nativeName)
108
121
  if (registered.has(nativeName)) continue
109
- const declaration = declarations.get(nativeName)
110
- if (!declaration || declaration.parent !== 'NSObject')
111
- fail('private superclass requires a qualified foreign proxy hierarchy')
112
- if (declaration.renamed) fail('private runtime class renaming is unqualified')
113
- adapters.push({
114
- name: `__PeachObjCPrivate_${hash(nativeName)}`,
122
+ // the ancestors between the class and the shared root
123
+ const ancestors: string[] = []
124
+ let declaration = declarations.get(nativeName)
125
+ while (declaration?.parent && declaration.parent !== 'NSObject') {
126
+ ancestors.push(declaration.parent)
127
+ declaration = declarations.get(declaration.parent)
128
+ }
129
+ candidates.push({
115
130
  nativeName,
131
+ ancestors,
132
+ rooted: declaration?.parent === 'NSObject',
133
+ renamed: declarations.get(nativeName)?.renamed ?? false,
116
134
  })
117
135
  }
118
136
  }
137
+ // a private class is allocated here only when every ancestor between it and the shared root is
138
+ // another original private implementation; any other hierarchy needs a qualified foreign proxy.
139
+ for (const { nativeName, ancestors, rooted, renamed } of candidates) {
140
+ if (
141
+ !rooted ||
142
+ !ancestors.every(
143
+ (ancestor) => implemented.has(ancestor) && !registered.has(ancestor),
144
+ )
145
+ )
146
+ throw new SwiftObjCImportError(
147
+ `Objective-C implementation ${nativeName}: private superclass requires a qualified foreign proxy hierarchy`,
148
+ )
149
+ if (renamed)
150
+ throw new SwiftObjCImportError(
151
+ `Objective-C implementation ${nativeName}: private runtime class renaming is unqualified`,
152
+ )
153
+ adapters.push({ name: `__PeachObjCPrivate_${hash(nativeName)}`, nativeName })
154
+ }
119
155
  adapters.sort((left, right) => left.nativeName.localeCompare(right.nativeName))
120
156
  return [
121
157
  '',
@@ -170,6 +206,7 @@ export function swiftObjCImports(
170
206
  const categories = new Map<string, Node[]>()
171
207
  const functions = new Map<string, Node[]>()
172
208
  const typedefs = new Map<string, string>()
209
+ const wrappedTypedefs = new Map<string, Node[]>()
173
210
  const visit = (node: unknown): void => {
174
211
  if (!record(node)) return
175
212
  if (
@@ -204,6 +241,9 @@ export function swiftObjCImports(
204
241
  ) {
205
242
  const canonical = node.type.desugaredQualType ?? node.type.qualType
206
243
  if (typeof canonical === 'string') typedefs.set(node.name, canonical)
244
+ if (nodes(node.inner).some((attribute) => attribute.kind === 'SwiftNewTypeAttr')) {
245
+ wrappedTypedefs.set(node.name, [...(wrappedTypedefs.get(node.name) ?? []), node])
246
+ }
207
247
  }
208
248
  for (const child of nodes(node.inner)) visit(child)
209
249
  }
@@ -211,15 +251,36 @@ export function swiftObjCImports(
211
251
  fail('declarations', 'expected a complete Clang translation unit AST')
212
252
  visit(options.clangAST)
213
253
 
214
- const symbols = new Map<string, GraphSymbol>()
254
+ const symbols = new Map<string, GraphSymbol[]>()
255
+ const seenSymbols = new Set<string>()
215
256
  for (const graph of graphs) {
216
257
  if (graph.module.name !== options.module)
217
258
  fail('declarations', `symbol graph belongs to ${graph.module.name}`)
218
259
  for (const symbol of graph.symbols) {
219
- const previous = symbols.get(symbol.identifier.precise)
220
- if (previous && JSON.stringify(previous) !== JSON.stringify(symbol))
221
- fail(symbol.identifier.precise, 'ambiguous imported declaration')
222
- symbols.set(symbol.identifier.precise, symbol)
260
+ if (
261
+ symbol.availability?.some(
262
+ (entry) =>
263
+ entry.isUnconditionallyUnavailable &&
264
+ (!entry.domain || entry.domain === 'Swift' || entry.domain === 'iOS'),
265
+ )
266
+ )
267
+ continue
268
+ // callback and async imports share a clang USR. documentation and source
269
+ // locations do not distinguish declarations; their swift signatures do.
270
+ const key = JSON.stringify([
271
+ symbol.identifier.precise,
272
+ symbol.kind.identifier,
273
+ symbol.pathComponents,
274
+ symbol.declarationFragments,
275
+ symbol.functionSignature,
276
+ symbol.accessLevel,
277
+ symbol.availability,
278
+ ])
279
+ if (seenSymbols.has(key)) continue
280
+ seenSymbols.add(key)
281
+ const overloads = symbols.get(symbol.identifier.precise) ?? []
282
+ overloads.push(symbol)
283
+ symbols.set(symbol.identifier.precise, overloads)
223
284
  }
224
285
  }
225
286
  const classes: SwiftObjCImport['classes'] = []
@@ -234,7 +295,10 @@ export function swiftObjCImports(
234
295
  types.set(name, nativeName)
235
296
  }
236
297
  for (const nativeName of [...selected].sort()) {
237
- const symbol = symbols.get(`c:objc(cs)${nativeName}`)
298
+ const candidates = symbols.get(`c:objc(cs)${nativeName}`)
299
+ if (candidates && candidates.length !== 1)
300
+ fail(nativeName, 'ambiguous imported class declaration')
301
+ const symbol = candidates?.[0]
238
302
  const name = symbol?.pathComponents[0]
239
303
  if (!symbol || symbol.kind.identifier !== 'swift.class' || !name || !identifier(name))
240
304
  fail(nativeName, 'missing Swift-imported class declaration')
@@ -250,6 +314,107 @@ export function swiftObjCImports(
250
314
  classes.push({ name, nativeName })
251
315
  }
252
316
 
317
+ const wrapperMembers = new Map<string, GraphSymbol[]>()
318
+ const wrapperConformances = new Map<string, Set<string>>()
319
+ for (const graph of graphs)
320
+ for (const edge of graph.relationships)
321
+ if (edge.kind === 'conformsTo' && edge.source.includes('@T@')) {
322
+ const protocols = wrapperConformances.get(edge.source) ?? new Set<string>()
323
+ protocols.add(edge.target)
324
+ wrapperConformances.set(edge.source, protocols)
325
+ }
326
+ for (const candidates of symbols.values())
327
+ for (const member of candidates)
328
+ if (
329
+ member.pathComponents.length === 2 &&
330
+ ['init(rawValue:)', 'init(_:)'].includes(member.pathComponents[1]!)
331
+ ) {
332
+ const owner = member.pathComponents[0]!
333
+ wrapperMembers.set(owner, [...(wrapperMembers.get(owner) ?? []), member])
334
+ }
335
+ const stringWrappers = new Map<string, string>()
336
+ const wrapperSymbols = [...symbols]
337
+ .filter(
338
+ ([usr, candidates]) =>
339
+ usr.includes('@T@') && candidates[0]?.kind.identifier === 'swift.struct',
340
+ )
341
+ .sort(([left], [right]) => left.localeCompare(right))
342
+ for (const [usr, candidates] of wrapperSymbols) {
343
+ const nativeName = /^c:.*@T@([A-Za-z_]\w*)$/.exec(usr)?.[1]
344
+ if (!nativeName) continue
345
+ const originals = wrappedTypedefs.get(nativeName)
346
+ const declaration = originals?.[0]
347
+ if (!declaration || !record(declaration.type)) continue
348
+ const original = declaration.type.desugaredQualType ?? declaration.type.qualType
349
+ if (typeof original !== 'string' || original.replace(/\s/g, '') !== 'NSString*')
350
+ continue
351
+ const symbol = candidates[0]!
352
+ const name = symbol.pathComponents[0]
353
+ if (
354
+ candidates.length !== 1 ||
355
+ originals?.length !== 1 ||
356
+ symbol.pathComponents.length !== 1 ||
357
+ !name ||
358
+ !identifier(name) ||
359
+ types.has(name) ||
360
+ stringWrappers.has(name) ||
361
+ symbol.accessLevel !== 'public' ||
362
+ text(symbol.declarationFragments ?? []).trim() !== `struct ${name}` ||
363
+ symbol.availability?.length
364
+ )
365
+ fail(usr, 'typed string wrapper identity is unqualified')
366
+ if (
367
+ !['s:SY', 's:SH', 's:SQ', 's:s8SendableP'].every((protocol) =>
368
+ wrapperConformances.get(usr)?.has(protocol),
369
+ )
370
+ )
371
+ fail(usr, 'typed string wrapper conformances are unqualified')
372
+ const members = wrapperMembers.get(name) ?? []
373
+ const initializers = members.filter(
374
+ (member) => member.pathComponents[1] === 'init(rawValue:)',
375
+ )
376
+ if (
377
+ initializers.length !== 1 ||
378
+ initializers[0]!.kind.identifier !== 'swift.init' ||
379
+ initializers[0]!.accessLevel !== 'public' ||
380
+ text(initializers[0]!.declarationFragments ?? []).trim() !==
381
+ 'init(rawValue: String)' ||
382
+ !initializers[0]!.declarationFragments?.some(
383
+ (part) => part.kind === 'typeIdentifier' && part.preciseIdentifier === 's:SS',
384
+ )
385
+ )
386
+ fail(usr, 'typed string wrapper raw initializer is unqualified')
387
+ const unlabelled = members.filter((member) => member.pathComponents[1] === 'init(_:)')
388
+ if (
389
+ unlabelled.length > 1 ||
390
+ (unlabelled.length === 1 &&
391
+ (unlabelled[0]!.kind.identifier !== 'swift.init' ||
392
+ unlabelled[0]!.accessLevel !== 'public' ||
393
+ text(unlabelled[0]!.declarationFragments ?? []).trim() !==
394
+ 'init(_ rawValue: String)' ||
395
+ !unlabelled[0]!.declarationFragments?.some(
396
+ (part) => part.kind === 'typeIdentifier' && part.preciseIdentifier === 's:SS',
397
+ )))
398
+ )
399
+ fail(usr, 'typed string wrapper unlabeled initializer is unqualified')
400
+ stringWrappers.set(
401
+ name,
402
+ [
403
+ `public struct ${swiftName(name)}: Swift.RawRepresentable, Swift.Hashable, Swift.Equatable, Swift._SwiftNewtypeWrapper, Swift._ObjectiveCBridgeable, Swift.Sendable {`,
404
+ ' public typealias RawValue = Swift.String',
405
+ ' public typealias _ObjectiveCType = Foundation.NSString',
406
+ ' private let _rawValue: Swift.String',
407
+ ' public var rawValue: Swift.String { _rawValue }',
408
+ ' public init(rawValue: Swift.String) { _rawValue = rawValue }',
409
+ ...(unlabelled.length
410
+ ? [' public init(_ rawValue: Swift.String) { _rawValue = rawValue }']
411
+ : []),
412
+ '}',
413
+ '',
414
+ ].join('\n'),
415
+ )
416
+ }
417
+
253
418
  const type = (parts: readonly SymbolFragment[], where: string): ImportType => {
254
419
  const written = text(parts).trim()
255
420
  const optional = /[?!]$/.test(written)
@@ -278,7 +443,7 @@ export function swiftObjCImports(
278
443
  (part) =>
279
444
  part.preciseIdentifier?.startsWith('c:') ||
280
445
  (part.preciseIdentifier &&
281
- symbols.get(part.preciseIdentifier)?.kind.identifier === 'swift.class'),
446
+ symbols.get(part.preciseIdentifier)?.[0]?.kind.identifier === 'swift.class'),
282
447
  )
283
448
  )
284
449
  return {
@@ -291,7 +456,7 @@ export function swiftObjCImports(
291
456
  const identifiers = parts.filter((part) => part.kind === 'typeIdentifier')
292
457
  const id = identifiers.length === 1 ? identifiers[0]?.preciseIdentifier : undefined
293
458
  const native = id && nativeClass(id)
294
- const swiftClass = id ? symbols.get(id) : undefined
459
+ const swiftClass = id ? symbols.get(id)?.[0] : undefined
295
460
  const resolved = native
296
461
  ? names.get(native)
297
462
  : swiftClass?.kind.identifier === 'swift.class' &&
@@ -377,7 +542,8 @@ export function swiftObjCImports(
377
542
  )
378
543
  }
379
544
  const membersByClass = new Map<string, GraphSymbol[]>()
380
- for (const symbol of symbols.values()) {
545
+ const importedSymbols = [...symbols.values()].flat()
546
+ for (const symbol of importedSymbols) {
381
547
  const owner = /^c:objc\(cs\)([A-Za-z_]\w*)\(/.exec(symbol.identifier.precise)?.[1]
382
548
  if (owner && selected.has(owner)) {
383
549
  const members = membersByClass.get(owner)
@@ -533,31 +699,58 @@ export function swiftObjCImports(
533
699
  if (
534
700
  member.kind === 'ObjCMethodDecl' &&
535
701
  typeof member.name === 'string' &&
702
+ member.name !== 'init' &&
536
703
  (/^init(?:$|[^a-z])/.test(member.name.replace(/^_+/, '')) ||
537
704
  nodes(member.inner).some(
538
705
  (attribute) =>
539
706
  attribute.kind === 'NSConsumesSelfAttr' ||
540
707
  attribute.kind === 'ObjCDesignatedInitializerAttr',
541
- ))
708
+ )) &&
709
+ !nodes(member.inner).some((attribute) => attribute.kind === 'UnavailableAttr')
542
710
  )
543
711
  fail(
544
712
  `${nativeName}.${member.name}`,
545
713
  'explicit or designated initialization is unqualified',
546
714
  )
547
- if (member.variadic === true)
548
- fail(`${nativeName}.${member.name}`, 'variadic methods are unqualified')
549
715
  }
550
- const constructor = thunk(
551
- `${nativeName}:new`,
552
- raw,
553
- [],
554
- null,
555
- `[[${nativeName} alloc] init]`,
556
- )
557
716
  const body = [
558
717
  `public required init(_objcRetained: Swift.UnsafeMutableRawPointer) { precondition(Self.self == ${swiftName(name)}.self, "Swift subclass construction is unqualified"); super.init(_objcRetained: _objcRetained) }`,
559
- `public init() { precondition(Self.self == ${swiftName(name)}.self, "Swift subclass construction is unqualified"); super.init(_objcRetained: ${constructor}()!) }`,
560
718
  ]
719
+ const defaultInitializer = members.find(
720
+ (member) =>
721
+ member.kind === 'ObjCMethodDecl' &&
722
+ member.instance === true &&
723
+ member.name === 'init',
724
+ )
725
+ const importedInitializer = symbols.get(`c:objc(cs)${nativeName}(im)init`)
726
+ const initializerSpelling = importedInitializer?.[0]
727
+ ? text(importedInitializer[0].declarationFragments ?? []).trim()
728
+ : 'init()'
729
+ if (!/^init[?!]?\(\)$/.test(initializerSpelling))
730
+ fail(`${nativeName}.init`, 'default initializer signature is unqualified')
731
+ if (
732
+ !defaultInitializer ||
733
+ !nodes(defaultInitializer.inner).some(
734
+ (attribute) => attribute.kind === 'UnavailableAttr',
735
+ )
736
+ ) {
737
+ if (
738
+ defaultInitializer &&
739
+ (importedInitializer?.length !== 1 ||
740
+ importedInitializer[0]?.kind.identifier !== 'swift.init')
741
+ )
742
+ fail(`${nativeName}.init`, 'missing Swift-imported default initializer')
743
+ const constructor = thunk(
744
+ `${nativeName}:new`,
745
+ raw,
746
+ [],
747
+ null,
748
+ `[[${nativeName} alloc] init]`,
749
+ )
750
+ body.push(
751
+ `public ${initializerSpelling} { precondition(Self.self == ${swiftName(name)}.self, "Swift subclass construction is unqualified"); ${/^init[?!]/.test(initializerSpelling) ? `guard let _peer = ${constructor}() else { return nil }; super.init(_objcRetained: _peer)` : `super.init(_objcRetained: ${constructor}()!)`} }`,
752
+ )
753
+ }
561
754
  bodies.set(name, body)
562
755
  const prefix = `c:objc(cs)${nativeName}`
563
756
  for (const symbol of membersByClass.get(nativeName) ?? []) {
@@ -578,6 +771,8 @@ export function swiftObjCImports(
578
771
  (property ? (m.class !== true) === instance : m.instance === instance),
579
772
  )
580
773
  if (!decl) fail(usr, 'member absent from original Clang interface')
774
+ if (decl.variadic === true)
775
+ fail(`${nativeName}.${selector}`, 'variadic methods are unqualified')
581
776
  const parts = symbol.declarationFragments ?? []
582
777
  const written = text(parts)
583
778
  if (
@@ -586,13 +781,16 @@ export function swiftObjCImports(
586
781
  )
587
782
  fail(usr, 'availability and asynchronous or throwing imports are unqualified')
588
783
  if (
589
- nodes(decl.inner).some((a) =>
590
- /^(?:Unavailable|SwiftPrivate|SwiftAsync|SwiftError|ObjCRequiresSuper|NSConsumesSelf)Attr$/.test(
591
- String(a.kind),
592
- ),
784
+ nodes(decl.inner).some(
785
+ (a) =>
786
+ /^(?:Unavailable|SwiftPrivate|SwiftAsync|SwiftError|ObjCRequiresSuper)Attr$/.test(
787
+ String(a.kind),
788
+ ) ||
789
+ (a.kind === 'NSConsumesSelfAttr' && selector !== 'init'),
593
790
  )
594
791
  )
595
792
  fail(usr, 'member attributes require a qualified importer path')
793
+ if (selector === 'init' && symbol.kind.identifier === 'swift.init') continue
596
794
  const receiver = instance ? '_object' : nativeName
597
795
  const access = symbol.accessLevel === 'open' ? 'open' : 'public'
598
796
  const memberName = parts.find((part) => part.kind === 'identifier')?.spelling
@@ -677,7 +875,7 @@ export function swiftObjCImports(
677
875
  }
678
876
 
679
877
  const importedFunctions: string[] = []
680
- for (const symbol of symbols.values()) {
878
+ for (const symbol of importedSymbols) {
681
879
  if (symbol.kind.identifier !== 'swift.func') continue
682
880
  const usr = symbol.identifier.precise
683
881
  const native = /^c:@F@([A-Za-z_]\w*)$/.exec(usr)?.[1]
@@ -730,7 +928,7 @@ export function swiftObjCImports(
730
928
  `public func ${swiftName(name)}(${argumentsSwift}) -> ${result.swift} { ${result.c === 'void' ? '' : 'return '}${local}(${parameters.map((p) => swiftName(p.name)).join(', ')}) }`,
731
929
  )
732
930
  }
733
- if (!classes.length && !importedFunctions.length)
931
+ if (!classes.length && !importedFunctions.length && !stringWrappers.size)
734
932
  fail('declarations', 'no represented original Objective-C classes or C functions')
735
933
 
736
934
  const registerFunction = `_peachRegisterObjCImports_${hash(options.module)}`
@@ -745,12 +943,14 @@ export function swiftObjCImports(
745
943
  '',
746
944
  ].join('\n')
747
945
  const swift = [
748
- ...(classes.length ? ['import Foundation', 'import PeachObjC'] : []),
946
+ ...(classes.length || stringWrappers.size ? ['import Foundation'] : []),
947
+ ...(classes.length ? ['import PeachObjC'] : []),
749
948
  '',
750
949
  ...external,
751
950
  '',
752
951
  ...importedFunctions,
753
952
  '',
953
+ ...stringWrappers.values(),
754
954
  ...classes.flatMap((c) => [
755
955
  `open class ${swiftName(c.name)}: PeachObjC._ObjCForeignObject {`,
756
956
  ...bodies.get(c.name)!.map((line) => ` ${line}`),
@@ -161,7 +161,9 @@ export function validateObjcPeerClasses(
161
161
  if (!/^[A-Za-z_]\w*$/.test(peer.name) || names.has(peer.name))
162
162
  throw new Error(`invalid or duplicate Objective-C metadata class: ${peer.name}`)
163
163
  if (peer.name === 'NSSimpleCString' || peer.name === 'NSConstantString')
164
- throw new Error(`${peer.name} metadata is emitted with NSString, not as its own peer`)
164
+ throw new Error(
165
+ `${peer.name} metadata is emitted with NSString, not as its own peer`,
166
+ )
165
167
  names.add(peer.name)
166
168
  const header = /^(\w+)\/([\w./-]+\.h)$/.exec(peer.header)
167
169
  if (
@@ -174,6 +176,19 @@ export function validateObjcPeerClasses(
174
176
  )
175
177
  throw new Error(`Objective-C peer header is outside the shared SDK: ${peer.header}`)
176
178
  }
179
+ for (const peer of classes) {
180
+ if (!peer.private) continue
181
+ const { superclass, swift } = peer.private
182
+ const parent = classes.find((candidate) => candidate.name === superclass)
183
+ if (!parent || parent.private)
184
+ throw new Error(
185
+ `Objective-C private peer ${peer.name} needs the header class ${superclass} in the same list`,
186
+ )
187
+ if (!/^[A-Za-z_]\w*(\.self)?$/.test(swift))
188
+ throw new Error(
189
+ `Objective-C private peer ${peer.name} has invalid Swift type ${swift}`,
190
+ )
191
+ }
177
192
  if (names.size === 0) throw new Error('Objective-C metadata requires peer classes')
178
193
  return names
179
194
  }
@@ -225,6 +240,15 @@ export function resolveObjcPeerTypes(
225
240
  const defined = definedInterfaces([...views.values()])
226
241
  const types = new Map<string, ObjcPeerType>()
227
242
  for (const peer of classes) {
243
+ if (peer.private) {
244
+ // no header or importer symbol exists for it: the registration names the metatype.
245
+ types.set(peer.name, {
246
+ native: peer.name,
247
+ swift: peer.private.swift,
248
+ importerModule: peer.header.split('/')[0]!,
249
+ })
250
+ continue
251
+ }
228
252
  if (!defined.has(peer.name))
229
253
  throw new Error(
230
254
  `Objective-C peer ${peer.name} has no @interface definition in ${peer.header}`,
@@ -297,6 +321,12 @@ function objcPeerViews(args: {
297
321
  return views
298
322
  }
299
323
 
324
+ const CORE_GRAPHICS_DATA = [
325
+ 'const CGSize CGSizeZero = {0, 0};',
326
+ 'const CGAffineTransform CGAffineTransformIdentity = {1, 0, 0, 1, 0, 0};',
327
+ 'const CFStringRef kCGColorSpaceSRGB = (__bridge CFStringRef)@"kCGColorSpaceSRGB";',
328
+ ]
329
+
300
330
  /** emits class metadata and its startup registration; adapters own every method. */
301
331
  export function compileObjcPeerMetadata(args: {
302
332
  classes: readonly SwiftObjCPeerClass[]
@@ -335,6 +365,8 @@ export function compileObjcPeerMetadata(args: {
335
365
  true,
336
366
  )
337
367
  }
368
+ const metatype = (peer: SwiftObjCPeerClass) =>
369
+ peer.private ? peer.private.swift : `\`${types.get(peer.name)!.swift}\`.self`
338
370
  const source = path.join(args.work, 'peer-metadata.m')
339
371
  const object = path.join(args.work, 'peer-metadata.o')
340
372
  const log = path.join(args.work, 'peer-metadata.log')
@@ -357,15 +389,19 @@ export function compileObjcPeerMetadata(args: {
357
389
  Number(right.name === 'NSObject') - Number(left.name === 'NSObject'),
358
390
  )
359
391
  .flatMap((peer) => [
360
- ` _objcRegisterPeerClass(\`${types.get(peer.name)!.swift}\`.self, nativeName: "${peer.name}")`,
361
- // foundation's adapters join the type it just registered.
362
- ...(peer.header.startsWith('Foundation/')
363
- ? [` _objcInstallFoundationPeerMethods(\`${types.get(peer.name)!.swift}\`.self)`]
392
+ ` _objcRegisterPeerClass(${metatype(peer)}, nativeName: "${peer.name}")`,
393
+ // each framework's adapters join the type it just registered; a private
394
+ // class inherits its header superclass's adapters through the runtime.
395
+ ...(peer.header.startsWith('Foundation/') && !peer.private
396
+ ? [` _objcInstallFoundationPeerMethods(${metatype(peer)})`]
397
+ : []),
398
+ ...(peer.header.startsWith('UIKit/') && !peer.private
399
+ ? [` _objcInstallUIKitPeerMethods(${metatype(peer)})`]
364
400
  : []),
365
401
  ]),
366
402
  '}()',
367
403
  '@_cdecl("_peach_objc_register_peers")',
368
- 'public func _peachRegisterObjcPeers() { _ = __peachPeerRegistration }',
404
+ 'public func _peachRegisterObjcPeers() {\n _ = __peachPeerRegistration\n __peachRegisterPrivateImplementations()\n}',
369
405
  '',
370
406
  ].join('\n'),
371
407
  )
@@ -375,9 +411,20 @@ export function compileObjcPeerMetadata(args: {
375
411
  ...[...new Set(args.classes.map((peer) => peer.header))].map(
376
412
  (header) => `#import <${header}>`,
377
413
  ),
414
+ // a private class has no header @interface, so its measured superclass declares it.
415
+ ...args.classes.flatMap((peer) =>
416
+ peer.private
417
+ ? [`@interface ${peer.name} : ${peer.private.superclass}\n@end`]
418
+ : [],
419
+ ),
378
420
  ...[...args.classes.map((peer) => peer.name), ...literals].map(
379
421
  (name) => `@implementation ${name}\n@end`,
380
422
  ),
423
+ // c data the headers declare extern: swift cannot define a named c global, so the values
424
+ // native publishes live here and the entry points that take them decode as native would.
425
+ ...(args.classes.some((peer) => peer.header.startsWith('UIKit/'))
426
+ ? CORE_GRAPHICS_DATA
427
+ : []),
381
428
  '',
382
429
  ].join('\n'),
383
430
  )
@@ -398,7 +445,7 @@ export function compileObjcPeerMetadata(args: {
398
445
  '-Xclang',
399
446
  '-disable-objc-default-synthesize-properties',
400
447
  '-Werror=objc-root-class',
401
- '-F',
448
+ '-iframework',
402
449
  path.join(headers, 'System/Library/Frameworks'),
403
450
  '-idirafter',
404
451
  path.join(headers, 'usr/include'),
@@ -0,0 +1,17 @@
1
+ import { readdirSync, readFileSync } from 'node:fs'
2
+ import path from 'node:path'
3
+
4
+ // every file under the sdk tree as [path under the sdk root, text], sorted by
5
+ // path. the tree is the sdk's source of truth and addresses the swift compiler.
6
+ export function readIosSdkTree(root: string): (readonly [string, string])[] {
7
+ return readdirSync(root, { recursive: true, withFileTypes: true })
8
+ .filter((entry) => entry.isFile())
9
+ .map((entry) => {
10
+ const file = path.join(entry.parentPath, entry.name)
11
+ return [
12
+ path.relative(root, file).split(path.sep).join('/'),
13
+ readFileSync(file, 'utf8'),
14
+ ] as const
15
+ })
16
+ .sort(([a], [b]) => (a < b ? -1 : 1))
17
+ }