peachsim 0.1.1684 → 0.1.1692

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 (254) hide show
  1. package/cli/commands/coverage-swift.ts +72 -5
  2. package/cli/commands/inspect/actions.ts +1 -0
  3. package/cli/commands/screenshot.ts +12 -0
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +2252 -1462
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +1 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +1 -1
  27. package/dist-lib/detox/index.cjs +1 -1
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +1762 -995
  30. package/dist-lib/expo-swift-metadata.cjs +1 -1
  31. package/dist-lib/expo-swift-metadata.mjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +2184 -1417
  34. package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +175 -69
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +1 -1
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +174 -68
  50. package/dist-lib/native-app-identity-project.cjs +163 -51
  51. package/dist-lib/native-app-identity-project.mjs +206 -82
  52. package/dist-lib/native-app-identity.cjs +1 -1
  53. package/dist-lib/native-app-identity.mjs +1 -1
  54. package/dist-lib/native-firebase-metadata.cjs +1 -1
  55. package/dist-lib/native-firebase-metadata.mjs +1 -1
  56. package/dist-lib/plist.cjs +1 -1
  57. package/dist-lib/plist.mjs +1 -1
  58. package/dist-lib/profiles.cjs +1 -1
  59. package/dist-lib/public-brand.cjs +1 -1
  60. package/dist-lib/public-origins-lib-esm.json +26 -23
  61. package/dist-lib/public-origins-lib.json +74 -61
  62. package/dist-lib/react-native-host-modules.cjs +1 -1
  63. package/dist-lib/react-native-host-modules.mjs +1 -1
  64. package/dist-lib/reap-browser.cjs +1 -1
  65. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  66. package/dist-lib/sdk.cjs +2 -2
  67. package/dist-lib/sdk.mjs +2 -2
  68. package/dist-lib/skills.cjs +2633 -1840
  69. package/dist-lib/swift-compile.cjs +2478 -100
  70. package/dist-lib/swift-compile.mjs +2475 -100
  71. package/dist-lib/swift-package.cjs +108 -50
  72. package/dist-lib/swift-package.mjs +104 -50
  73. package/dist-lib/swift-submit.cjs +1 -1
  74. package/dist-lib/swift-submit.mjs +1 -1
  75. package/dist-lib/swift-toolchain.cjs +1 -1
  76. package/dist-lib/swift.cjs +1 -1
  77. package/dist-lib/vite-swift.cjs +3979 -985
  78. package/dist-lib/vite.cjs +12 -18
  79. package/dist-lib/worklet-executable.cjs +7 -4
  80. package/dist-lib/worklet-executable.mjs +7 -4
  81. package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +15 -1
  82. package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +6 -0
  83. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  84. package/dist-types/packages/peach-globals/src/nodeContract.d.ts +3 -2
  85. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  86. package/package.json +1 -1
  87. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +9 -0
  88. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLAvailability.h +22 -0
  89. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBackgroundActivitySession.h +145 -0
  90. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconIdentityCondition.h +113 -0
  91. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconIdentityConstraint.h +34 -0
  92. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconRegion.h +225 -0
  93. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBody.h +26 -0
  94. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCircularGeographicCondition.h +59 -0
  95. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCircularRegion.h +64 -0
  96. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCondition.h +48 -0
  97. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLError.h +52 -0
  98. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLErrorDomain.h +24 -0
  99. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLGeocoder.h +55 -0
  100. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLHeading.h +117 -0
  101. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocation.h +9 -0
  102. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager+CLVisitExtensions.h +45 -0
  103. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +877 -0
  104. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManagerDelegate.h +225 -0
  105. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationPushServiceError.h +33 -0
  106. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationPushServiceExtension.h +28 -0
  107. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationUpdater.h +250 -0
  108. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitor.h +140 -0
  109. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitorConfiguration.h +77 -0
  110. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitoringEvent.h +184 -0
  111. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitoringRecord.h +57 -0
  112. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h +98 -0
  113. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +123 -0
  114. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLServiceSession.h +211 -0
  115. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLVisit.h +66 -0
  116. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CoreLocation.h +46 -0
  117. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Modules/module.modulemap +7 -0
  118. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +96 -2
  119. package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h +52 -0
  120. package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h +240 -0
  121. package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceRef.h +474 -0
  122. package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceTypes.h +66 -0
  123. package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Modules/module.modulemap +10 -0
  124. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4AccelerationStructure.h +9 -0
  125. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Archive.h +16 -0
  126. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ArgumentTable.h +17 -0
  127. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BinaryFunction.h +13 -0
  128. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BinaryFunctionDescriptor.h +14 -0
  129. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BufferRange.h +79 -0
  130. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandAllocator.h +15 -0
  131. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandBuffer.h +17 -0
  132. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandEncoder.h +16 -0
  133. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandQueue.h +19 -0
  134. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommitFeedback.h +15 -0
  135. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Compiler.h +13 -0
  136. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CompilerTask.h +13 -0
  137. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ComputeCommandEncoder.h +19 -0
  138. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ComputePipeline.h +13 -0
  139. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Counters.h +19 -0
  140. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4FunctionDescriptor.h +13 -0
  141. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LibraryDescriptor.h +13 -0
  142. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LibraryFunctionDescriptor.h +13 -0
  143. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LinkingDescriptor.h +13 -0
  144. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MachineLearningCommandEncoder.h +17 -0
  145. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MachineLearningPipeline.h +13 -0
  146. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MeshRenderPipeline.h +13 -0
  147. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4PipelineDataSetSerializer.h +13 -0
  148. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4PipelineState.h +13 -0
  149. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderCommandEncoder.h +17 -0
  150. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderPass.h +17 -0
  151. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderPipeline.h +13 -0
  152. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4SpecializedFunctionDescriptor.h +13 -0
  153. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4StitchedFunctionDescriptor.h +13 -0
  154. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4TileRenderPipeline.h +13 -0
  155. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructure.h +1212 -0
  156. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructureCommandEncoder.h +322 -0
  157. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructureTypes.h +224 -0
  158. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAllocation.h +22 -0
  159. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLArgument.h +279 -0
  160. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLArgumentEncoder.h +199 -0
  161. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBinaryArchive.h +142 -0
  162. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBlitCommandEncoder.h +266 -0
  163. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBlitPass.h +82 -0
  164. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBuffer.h +94 -0
  165. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCaptureManager.h +113 -0
  166. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCaptureScope.h +43 -0
  167. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandBuffer.h +449 -0
  168. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandEncoder.h +148 -0
  169. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandQueue.h +102 -0
  170. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputeCommandEncoder.h +350 -0
  171. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputePass.h +90 -0
  172. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputePipeline.h +274 -0
  173. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCounters.h +225 -0
  174. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDataType.h +232 -0
  175. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDefines.h +39 -0
  176. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDepthStencil.h +93 -0
  177. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDevice.h +1122 -0
  178. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDeviceCertification.h +29 -0
  179. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDrawable.h +36 -0
  180. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDynamicLibrary.h +81 -0
  181. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLEvent.h +79 -0
  182. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFence.h +22 -0
  183. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionConstantValues.h +30 -0
  184. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionDescriptor.h +95 -0
  185. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionHandle.h +29 -0
  186. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionLog.h +37 -0
  187. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionStitching.h +131 -0
  188. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLGPUAddress.h +19 -0
  189. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLHeap.h +284 -0
  190. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCommandBuffer.h +10 -0
  191. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCommandQueue.h +11 -0
  192. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCompressor.h +10 -0
  193. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIndirectCommandBuffer.h +157 -0
  194. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIndirectCommandEncoder.h +110 -0
  195. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIntersectionFunctionTable.h +186 -0
  196. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLibrary.h +549 -0
  197. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLinkedFunctions.h +57 -0
  198. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLogState.h +65 -0
  199. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLParallelRenderCommandEncoder.h +77 -0
  200. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLPipeline.h +57 -0
  201. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h +342 -0
  202. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRasterizationRate.h +323 -0
  203. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h +1068 -0
  204. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderPass.h +411 -0
  205. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderPipeline.h +788 -0
  206. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResidencySet.h +141 -0
  207. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResource.h +307 -0
  208. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceStateCommandEncoder.h +125 -0
  209. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceStatePass.h +85 -0
  210. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceViewPool.h +22 -0
  211. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLSampler.h +252 -0
  212. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLStageInputOutputDescriptor.h +158 -0
  213. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTensor.h +17 -0
  214. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTexture.h +460 -0
  215. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTextureViewPool.h +18 -0
  216. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTypes.h +125 -0
  217. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLVertexDescriptor.h +153 -0
  218. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLVisibleFunctionTable.h +45 -0
  219. package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/Metal.h +94 -0
  220. package/sdk/ios/System/Library/Frameworks/Metal.framework/Modules/module.modulemap +6 -0
  221. package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTDefines.h +35 -0
  222. package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTTagClass.h +33 -0
  223. package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTType.h +504 -0
  224. package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/CLEssentialsAvailability.h +14 -0
  225. package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/CLLocationEssentials.h +444 -0
  226. package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/LocationEssentials.h +14 -0
  227. package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Modules/module.modulemap +14 -0
  228. package/sdk/ios/usr/include/complex.h +167 -0
  229. package/sdk/ios/usr/include/dispatch/dispatch.h +5 -0
  230. package/sdk/ios/usr/include/mach/mach_types.h +1 -0
  231. package/sdk/ios/usr/include/math.h +835 -2
  232. package/sdk/ios/usr/include/sys/cdefs.h +0 -1
  233. package/src/generated/swift-c-predefines.json +1988 -0
  234. package/src/nitro-bundle.ts +1 -0
  235. package/src/nitro-compile.ts +4 -0
  236. package/src/nitroContract.ts +18 -2
  237. package/src/swift-compile.ts +446 -49
  238. package/src/swift-coverage/package.ts +3 -1
  239. package/src/swift-coverage/xcode-assets.ts +62 -2
  240. package/src/swift-coverage/xcode-packages.ts +11 -6
  241. package/src/swift-host.ts +333 -57
  242. package/src/swift-objc-compile.ts +20 -5
  243. package/src/swift-objc-standin.ts +21 -11
  244. package/src/swift-package-manifest.ts +151 -28
  245. package/src/swift-package.ts +134 -58
  246. package/src/swift-packages.ts +141 -44
  247. package/src/swift-source-file.ts +10 -15
  248. package/src/swift-standins.ts +87 -13
  249. package/src/swift-submit.ts +5 -0
  250. package/src/swiftContract.ts +160 -75
  251. package/src/target-matcher.ts +15 -2
  252. package/src/worklet-executable.ts +7 -3
  253. package/src/xcode-json-project.ts +14 -2
  254. package/src/xcode-project.ts +154 -59
@@ -34,10 +34,11 @@ import {
34
34
  WASI_EMULATION,
35
35
  WASI_EMULATION_FLAGS,
36
36
  nativeInterfaceView,
37
+ moduleMapHeaders,
37
38
  objcView,
38
39
  type ObjcSurface,
39
40
  } from './swift-objc-standin'
40
- import { swiftTargetModuleName } from './swift-package'
41
+ import { moduleMapName, swiftTargetModuleName } from './swift-package'
41
42
  import {
42
43
  STANDIN_EMIT_VERSION,
43
44
  STANDIN_IMPORTS,
@@ -62,6 +63,8 @@ export interface SwiftStandin {
62
63
  target: string
63
64
  /** the target's files, relative to its directory. */
64
65
  files: Record<string, string>
66
+ /** target-relative directory containing the original public module map. */
67
+ publicHeadersPath?: string
65
68
  /** other generated modules named by this target's public headers. */
66
69
  dependencies?: string[]
67
70
  }
@@ -236,6 +239,52 @@ function xcframework(binary: SwiftPackageBinary): {
236
239
  return { dir: found, digest: sha }
237
240
  }
238
241
 
242
+ /**
243
+ * the -F directory xcode gives a package binary target: the iOS simulator
244
+ * slice's frameworks with their headers and module maps, staged under `root`
245
+ * where the original Objective-C compile reads its inputs. the executable
246
+ * stays in the artifact. null when the slice has no framework with a module
247
+ * map, which a swift-only module lacks.
248
+ */
249
+ export function binaryFrameworkSearchPath(
250
+ binary: SwiftPackageBinary,
251
+ root: string,
252
+ ): string | null {
253
+ const artifact = xcframework(binary)
254
+ const frameworks = [
255
+ ...new Set(
256
+ surfaces(artifact.dir).flatMap((surface) =>
257
+ 'modulemap' in surface &&
258
+ path.basename(path.dirname(surface.modulemap)) === 'Modules'
259
+ ? [path.dirname(path.dirname(surface.modulemap))]
260
+ : [],
261
+ ),
262
+ ),
263
+ ]
264
+ if (frameworks.length === 0) return null
265
+ const search = path.join(root, 'peach-binary-frameworks', artifact.digest.slice(0, 32))
266
+ if (fs.existsSync(search)) return search
267
+ // publish a complete directory so concurrent workspaces never read a partial one.
268
+ const pending = `${search}.${process.pid}.tmp`
269
+ fs.rmSync(pending, { recursive: true, force: true })
270
+ for (const framework of frameworks)
271
+ for (const part of ['Headers', 'Modules'])
272
+ if (fs.existsSync(path.join(framework, part)))
273
+ fs.cpSync(
274
+ path.join(framework, part),
275
+ path.join(pending, path.basename(framework), part),
276
+ { recursive: true, dereference: true },
277
+ )
278
+ try {
279
+ fs.renameSync(pending, search)
280
+ } catch (error) {
281
+ // another process published the same digest first; its directory is complete
282
+ fs.rmSync(pending, { recursive: true, force: true })
283
+ if (!fs.existsSync(search)) throw error
284
+ }
285
+ return search
286
+ }
287
+
239
288
  const files = (dir: string, test: (name: string) => boolean): string[] =>
240
289
  fs.existsSync(dir)
241
290
  ? fs
@@ -264,6 +313,12 @@ function headerSurface(module: string, modulemap: string, headers: string): Surf
264
313
  }
265
314
 
266
315
  function surfaces(xcframeworkDir: string): Surface[] {
316
+ const standaloneMap = path.join(xcframeworkDir, 'module.modulemap')
317
+ if (fs.existsSync(standaloneMap)) {
318
+ const module = moduleMapName(fs.readFileSync(standaloneMap, 'utf8'))
319
+ if (!module) throw new Error('its module map declares no module')
320
+ return [headerSurface(module, standaloneMap, xcframeworkDir)]
321
+ }
267
322
  const slice = fs
268
323
  .readdirSync(xcframeworkDir)
269
324
  .filter((name) => /^ios-.+-simulator$/.test(name))
@@ -318,7 +373,7 @@ function surfaces(xcframeworkDir: string): Surface[] {
318
373
  const headers = path.join(root, 'Headers')
319
374
  for (const map of files(headers, (name) => name === 'module.modulemap')) {
320
375
  const modulemap = path.join(headers, map)
321
- const module = /(?:^|\s)module\s+(\w+)/.exec(fs.readFileSync(modulemap, 'utf8'))?.[1]
376
+ const module = moduleMapName(fs.readFileSync(modulemap, 'utf8'))
322
377
  if (module) found.push(headerSurface(module, modulemap, path.dirname(modulemap)))
323
378
  }
324
379
  return found
@@ -794,15 +849,12 @@ function cStandin(
794
849
  toolchain: Toolchain,
795
850
  work: string,
796
851
  ): SwiftStandin {
797
- const named = [
798
- ...fs
799
- .readFileSync(surface.modulemap, 'utf8')
800
- .matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g),
801
- ].map((match) => match[1]!)
802
852
  const headers = files(surface.headers, (name) => name.endsWith('.h'))
853
+ const framework = path.basename(path.dirname(surface.modulemap)) === 'Modules'
854
+ const headerDirectory = framework ? `${surface.module}.framework/Headers` : '.'
803
855
  const texts = new Map(
804
856
  headers.map((file) => [
805
- file,
857
+ path.posix.join(headerDirectory, file),
806
858
  fs.readFileSync(path.join(surface.headers, file), 'utf8'),
807
859
  ]),
808
860
  )
@@ -812,7 +864,10 @@ function cStandin(
812
864
  fs.mkdirSync(path.dirname(path.join(include, file)), { recursive: true })
813
865
  fs.writeFileSync(path.join(include, file), text)
814
866
  }
815
- const roots = named.length > 0 ? named : headers
867
+ const roots = moduleMapHeaders(surface.modulemap, headers).map((file) =>
868
+ path.posix.join(headerDirectory, file),
869
+ )
870
+ const frameworkMap = `${surface.module}.framework/Modules/module.modulemap`
816
871
  const modulemap = `module ${surface.module} {\n${roots.map((file) => ` header "${file}"\n`).join('')} export *\n}\n`
817
872
  const probe = path.join(work, 'declarations.c')
818
873
  fs.writeFileSync(probe, roots.map((file) => `#include "${file}"\n`).join(''))
@@ -832,7 +887,9 @@ function cStandin(
832
887
  probe,
833
888
  ]),
834
889
  )
835
- const byPath = new Map(headers.map((file) => [path.join(include, file), file]))
890
+ const byPath = new Map(
891
+ [...texts.keys()].map((file) => [path.join(include, file), file]),
892
+ )
836
893
  // clang's offsets count bytes, which a header with non-ascii comments
837
894
  // (generated ffi headers carry emoji) puts ahead of string indices
838
895
  const bytes = new Map(
@@ -878,7 +935,7 @@ function cStandin(
878
935
  const source = [
879
936
  `// generated by peach from ${surface.module}'s headers: ${binary.target} ships`,
880
937
  '// iOS machine code only, so every extern function traps naming itself.',
881
- ...roots.map((file) => `#include "${file}"`),
938
+ ...roots.map((file) => `#include "${framework ? `include/${file}` : file}"`),
882
939
  '#include <stdio.h>',
883
940
  '#include <stdlib.h>',
884
941
  '',
@@ -911,11 +968,16 @@ function cStandin(
911
968
  return {
912
969
  module: surface.module,
913
970
  target: binary.target,
971
+ ...(framework
972
+ ? { publicHeadersPath: `include/${surface.module}.framework/Modules` }
973
+ : {}),
914
974
  files: {
915
975
  ...Object.fromEntries(
916
976
  [...texts].map(([file, text]) => [`include/${file}`, text] as const),
917
977
  ),
918
- 'include/module.modulemap': modulemap,
978
+ ...(framework
979
+ ? { [`include/${frameworkMap}`]: fs.readFileSync(surface.modulemap, 'utf8') }
980
+ : { 'include/module.modulemap': modulemap }),
919
981
  [`${surface.module}.c`]: source,
920
982
  },
921
983
  }
@@ -975,6 +1037,7 @@ function crateFor(root: string, name: string): string | null {
975
1037
  // the simulator slice's static library as the xcframework's Info.plist
976
1038
  // declares it, the name Xcode links; the archive itself may be unbuilt.
977
1039
  function simulatorLibraryName(dir: string): string | undefined {
1040
+ if (!dir.endsWith('.xcframework')) return undefined
978
1041
  const info = parsePlistSource(fs.readFileSync(path.join(dir, 'Info.plist'), 'utf8'))
979
1042
  const libraries =
980
1043
  info && typeof info === 'object' ? Reflect.get(info, 'AvailableLibraries') : undefined
@@ -1246,6 +1309,10 @@ function readStandinResults(
1246
1309
  item.target !== entry.target ||
1247
1310
  !isRecord(item.files) ||
1248
1311
  !Object.values(item.files).every((text) => typeof text === 'string') ||
1312
+ (item.publicHeadersPath !== undefined &&
1313
+ (typeof item.publicHeadersPath !== 'string' ||
1314
+ typeof item.files[`${item.publicHeadersPath}/module.modulemap`] !==
1315
+ 'string')) ||
1249
1316
  (item.dependencies !== undefined &&
1250
1317
  (!Array.isArray(item.dependencies) ||
1251
1318
  !item.dependencies.every((name) => typeof name === 'string')))
@@ -1260,6 +1327,9 @@ function readStandinResults(
1260
1327
  module: item.module,
1261
1328
  target: entry.target,
1262
1329
  files,
1330
+ ...(typeof item.publicHeadersPath === 'string'
1331
+ ? { publicHeadersPath: item.publicHeadersPath }
1332
+ : {}),
1263
1333
  ...(item.dependencies === undefined ? {} : { dependencies: item.dependencies }),
1264
1334
  })
1265
1335
  }
@@ -1281,7 +1351,7 @@ export function standinGenerationInputs(
1281
1351
  const { moduleRoot, release } = toolchain
1282
1352
  const sdk = swiftModuleSdk(moduleRoot)
1283
1353
  const parts = [
1284
- 'standin/v9',
1354
+ 'standin/v11',
1285
1355
  release,
1286
1356
  sdk.wasmSdkId,
1287
1357
  sdk.wasmSdkChecksum,
@@ -1633,6 +1703,7 @@ export function swiftStandins(
1633
1703
  const target = byModule.get(module)
1634
1704
  if (target) visit(target)
1635
1705
  }
1706
+ const started = Date.now()
1636
1707
  const result = binaryStandins(
1637
1708
  binary,
1638
1709
  generatedToolchain,
@@ -1641,6 +1712,9 @@ export function swiftStandins(
1641
1712
  frameworks,
1642
1713
  siblings.get(binary)!,
1643
1714
  )
1715
+ console.error(
1716
+ `[swift-standins] ${binary.target} ${typeof result === 'string' ? 'gap' : 'ready'} in ${Date.now() - started}ms`,
1717
+ )
1644
1718
  if (typeof result === 'string') {
1645
1719
  gaps.set(binary.target, result)
1646
1720
  return
@@ -25,6 +25,7 @@ import {
25
25
  isSwiftMetalLibrarySources,
26
26
  type SwiftMetalLibrarySource,
27
27
  type SwiftResourceBundle,
28
+ type SwiftPackageFiles,
28
29
  type SwiftNativeTarget,
29
30
  type SwiftObjCPeerStartup,
30
31
  } from './swiftContract'
@@ -237,6 +238,8 @@ export interface SwiftCompileContext {
237
238
 
238
239
  export type SwiftCompileSubmit = (work: {
239
240
  files: Record<string, string>
241
+ packageFiles?: SwiftPackageFiles
242
+ packageGuestImports?: string[]
240
243
  nativeTargets?: SwiftNativeTarget[]
241
244
  objcPeerStartup?: SwiftObjCPeerStartup
242
245
  metalSources?: Record<string, string>
@@ -404,6 +407,8 @@ export async function compileSwiftProject(
404
407
  submit: SwiftCompileSubmit,
405
408
  work: {
406
409
  files: Record<string, string>
410
+ packageFiles?: SwiftPackageFiles
411
+ packageGuestImports?: string[]
407
412
  nativeTargets?: SwiftNativeTarget[]
408
413
  objcPeerStartup?: SwiftObjCPeerStartup
409
414
  metalSources?: Record<string, string>
@@ -17,6 +17,46 @@ export interface SwiftResourceBundle {
17
17
  path: string
18
18
  }
19
19
 
20
+ /** original package bytes, kept separate from guest source transformations. */
21
+ export type SwiftPackageFiles = Record<string, string>
22
+
23
+ export const SWIFT_REMOTE_PACKAGES_DIR = '__packages__'
24
+ export const SWIFT_LOCAL_PACKAGES_DIR = '__local_packages__'
25
+
26
+ /** decoded length of a validated base64 package input. */
27
+ export function swiftPackageInputBytes(encoded: string): number {
28
+ return (
29
+ (encoded.length / 4) * 3 -
30
+ (encoded.endsWith('==') ? 2 : encoded.endsWith('=') ? 1 : 0)
31
+ )
32
+ }
33
+
34
+ export function swiftPackageInputNames(files: SwiftPackageFiles = {}): string[] {
35
+ return [
36
+ ...new Set(
37
+ Object.keys(files)
38
+ .filter((file) => file.endsWith('/Package.swift'))
39
+ .map((file) => file.split('/').at(-2)!),
40
+ ),
41
+ ].sort()
42
+ }
43
+
44
+ export function isSwiftPackageFiles(value: unknown): value is SwiftPackageFiles {
45
+ return (
46
+ value !== null &&
47
+ typeof value === 'object' &&
48
+ !Array.isArray(value) &&
49
+ Object.entries(value).every(
50
+ ([file, bytes]) =>
51
+ isSwiftResourcePath(file) &&
52
+ (file.startsWith(`${SWIFT_REMOTE_PACKAGES_DIR}/`) ||
53
+ file.startsWith(`${SWIFT_LOCAL_PACKAGES_DIR}/`)) &&
54
+ typeof bytes === 'string' &&
55
+ /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(bytes),
56
+ )
57
+ )
58
+ }
59
+
20
60
  export interface SwiftObjCPeerClass {
21
61
  name: string
22
62
  header: string
@@ -92,89 +132,134 @@ export interface SwiftNativeTarget {
92
132
  }
93
133
 
94
134
  export function isSwiftNativeTargets(value: unknown): value is SwiftNativeTarget[] {
135
+ return swiftNativeTargetsRefusal(value) === null
136
+ }
137
+
138
+ /** the first native target or field that fails validation, or null when all pass. */
139
+ export function swiftNativeTargetsRefusal(value: unknown): string | null {
95
140
  const strings = (value: unknown): value is string[] =>
96
141
  Array.isArray(value) &&
97
142
  value.every((item: unknown) => typeof item === 'string' && !item.includes('\0'))
98
143
  const paths = (value: unknown): value is string[] =>
99
144
  strings(value) && value.every(isSwiftResourcePath)
100
- return (
101
- Array.isArray(value) &&
102
- value.length <= 128 &&
103
- value.every((target: unknown) => {
104
- if (!target || typeof target !== 'object') return false
105
- const field = (name: string): unknown => Reflect.get(target, name)
106
- const nullablePath = (name: string) =>
107
- field(name) === null || isSwiftResourcePath(field(name))
108
- const perFile = field('fileFlags')
109
- const directories = field('sourceDirectories')
110
- const searches = field('headerSearchPaths')
111
- const userSearches = field('userHeaderSearchPaths')
112
- const frameworks = field('frameworkSearchPaths')
113
- const maps = field('headerMaps')
114
- const products = field('productHeaders')
115
- const inputPath = (value: unknown) =>
116
- typeof value === 'string' &&
117
- value.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) &&
118
- isSwiftResourcePath(value.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1))
119
- const deployment = field('deploymentTarget')
120
- return (
121
- typeof field('name') === 'string' &&
122
- /^[A-Za-z_]\w*$/.test(String(field('name'))) &&
123
- (deployment === null ||
124
- (typeof deployment === 'string' && /^\d+(?:\.\d+){0,2}$/.test(deployment))) &&
125
- paths(field('headers')) &&
126
- paths(field('publicHeaders')) &&
127
- nullablePath('bridgingHeader') &&
128
- nullablePath('prefixHeader') &&
129
- strings(searches) &&
130
- searches.every((item) => item === '.' || isSwiftResourcePath(item)) &&
131
- strings(userSearches) &&
132
- userSearches.every((item) => item === '.' || isSwiftResourcePath(item)) &&
133
- strings(frameworks) &&
134
- frameworks.every((item) => item === '.' || isSwiftResourcePath(item)) &&
135
- Array.isArray(maps) &&
136
- maps.every((map: unknown) => {
137
- if (!map || typeof map !== 'object') return false
138
- const flag: unknown = Reflect.get(map, 'flag')
139
- const entries: unknown = Reflect.get(map, 'entries')
140
- return (
141
- (flag === '-I' || flag === '-iquote') &&
142
- Array.isArray(entries) &&
143
- entries.every(
144
- (entry: unknown) =>
145
- Array.isArray(entry) &&
146
- entry.length === 2 &&
147
- typeof entry[0] === 'string' &&
148
- !entry[0].includes('\0') &&
149
- (inputPath(entry[1]) || isSwiftResourcePath(entry[1])),
150
- )
145
+ if (!Array.isArray(value)) return 'nativeTargets'
146
+ if (value.length > 128) return 'nativeTargets:length'
147
+ for (const target of value) {
148
+ if (!target || typeof target !== 'object') return 'nativeTargets:shape'
149
+ const field = (name: string): unknown => Reflect.get(target, name)
150
+ const name = typeof field('name') === 'string' ? String(field('name')) : '?'
151
+ const at = (shape: string) => `nativeTargets:${name}:${shape}`
152
+ const nullablePath = (key: string) =>
153
+ field(key) === null || isSwiftResourcePath(field(key))
154
+ const perFile = field('fileFlags')
155
+ const directories = field('sourceDirectories')
156
+ const searches = field('headerSearchPaths')
157
+ const userSearches = field('userHeaderSearchPaths')
158
+ const frameworks = field('frameworkSearchPaths')
159
+ const maps = field('headerMaps')
160
+ const products = field('productHeaders')
161
+ const inputPath = (value: unknown) =>
162
+ typeof value === 'string' &&
163
+ value.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) &&
164
+ isSwiftResourcePath(value.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1))
165
+ const deployment = field('deploymentTarget')
166
+ // swiftpm accepts nearly any target name (oracle: `A+B`, `A-B`,
167
+ // `A B` and `A/B` all build, the module derived via the c99 rule),
168
+ // and the builder matches entries by this raw name. the builder also
169
+ // stages product headers under it, so it must be one path segment:
170
+ // `+`, `-` and space pass, but no separator, `.` or `..`.
171
+ const targetName = field('name')
172
+ if (
173
+ typeof targetName !== 'string' ||
174
+ targetName.length === 0 ||
175
+ targetName.length > 4096 ||
176
+ targetName.includes('\0') ||
177
+ targetName.includes('/') ||
178
+ targetName.includes('\\') ||
179
+ targetName === '.' ||
180
+ targetName === '..'
181
+ )
182
+ return at('name')
183
+ if (
184
+ !(
185
+ deployment === null ||
186
+ (typeof deployment === 'string' && /^\d+(?:\.\d+){0,2}$/.test(deployment))
187
+ )
188
+ )
189
+ return at('deploymentTarget')
190
+ if (!paths(field('headers'))) return at('headers')
191
+ if (!paths(field('publicHeaders'))) return at('publicHeaders')
192
+ if (!nullablePath('bridgingHeader')) return at('bridgingHeader')
193
+ if (!nullablePath('prefixHeader')) return at('prefixHeader')
194
+ if (
195
+ !strings(searches) ||
196
+ !searches.every((item) => item === '.' || isSwiftResourcePath(item))
197
+ )
198
+ return at('headerSearchPaths')
199
+ if (
200
+ !strings(userSearches) ||
201
+ !userSearches.every((item) => item === '.' || isSwiftResourcePath(item))
202
+ )
203
+ return at('userHeaderSearchPaths')
204
+ if (
205
+ !strings(frameworks) ||
206
+ !frameworks.every((item) => item === '.' || isSwiftResourcePath(item))
207
+ )
208
+ return at('frameworkSearchPaths')
209
+ if (
210
+ !Array.isArray(maps) ||
211
+ !maps.every((map: unknown) => {
212
+ if (!map || typeof map !== 'object') return false
213
+ const flag: unknown = Reflect.get(map, 'flag')
214
+ const entries: unknown = Reflect.get(map, 'entries')
215
+ return (
216
+ (flag === '-I' || flag === '-iquote') &&
217
+ Array.isArray(entries) &&
218
+ entries.every(
219
+ (entry: unknown) =>
220
+ Array.isArray(entry) &&
221
+ entry.length === 2 &&
222
+ typeof entry[0] === 'string' &&
223
+ !entry[0].includes('\0') &&
224
+ (inputPath(entry[1]) || isSwiftResourcePath(entry[1])),
151
225
  )
152
- }) &&
153
- !!products &&
154
- typeof products === 'object' &&
155
- !Array.isArray(products) &&
156
- Object.entries(products).every(
157
- ([product, file]) => isSwiftResourcePath(product) && isSwiftResourcePath(file),
158
- ) &&
159
- strings(field('flags')) &&
160
- strings(field('cxxFlags')) &&
161
- !!perFile &&
162
- typeof perFile === 'object' &&
163
- !Array.isArray(perFile) &&
164
- Object.entries(perFile).every(
165
- ([file, flags]) => isSwiftResourcePath(file) && strings(flags),
166
- ) &&
167
- !!directories &&
168
- typeof directories === 'object' &&
169
- !Array.isArray(directories) &&
170
- Object.entries(directories).every(
171
- ([file, directory]) =>
172
- isSwiftResourcePath(file) &&
173
- (directory === '.' || isSwiftResourcePath(directory)),
174
226
  )
227
+ })
228
+ )
229
+ return at('headerMaps')
230
+ if (
231
+ !products ||
232
+ typeof products !== 'object' ||
233
+ Array.isArray(products) ||
234
+ !Object.entries(products).every(
235
+ ([product, file]) => isSwiftResourcePath(product) && isSwiftResourcePath(file),
175
236
  )
176
- })
177
- )
237
+ )
238
+ return at('productHeaders')
239
+ if (!strings(field('flags'))) return at('flags')
240
+ if (!strings(field('cxxFlags'))) return at('cxxFlags')
241
+ if (
242
+ !perFile ||
243
+ typeof perFile !== 'object' ||
244
+ Array.isArray(perFile) ||
245
+ !Object.entries(perFile).every(
246
+ ([file, flags]) => isSwiftResourcePath(file) && strings(flags),
247
+ )
248
+ )
249
+ return at('fileFlags')
250
+ if (
251
+ !directories ||
252
+ typeof directories !== 'object' ||
253
+ Array.isArray(directories) ||
254
+ !Object.entries(directories).every(
255
+ ([file, directory]) =>
256
+ isSwiftResourcePath(file) &&
257
+ (directory === '.' || isSwiftResourcePath(directory)),
258
+ )
259
+ )
260
+ return at('sourceDirectories')
261
+ }
262
+ return null
178
263
  }
179
264
 
180
265
  export interface SwiftObjCImplementationPreparation {
@@ -19,6 +19,15 @@ export function targetQueryFilter(matcher: SootSimTargetMatcher): SootSimTestQue
19
19
  }
20
20
  }
21
21
 
22
+ function isFieldLine(style: unknown): boolean {
23
+ return (
24
+ typeof style === 'object' &&
25
+ style !== null &&
26
+ '_fieldLine' in style &&
27
+ style._fieldLine === true
28
+ )
29
+ }
30
+
22
31
  export function filterTargetNodes<
23
32
  T extends {
24
33
  type?: unknown
@@ -26,6 +35,8 @@ export function filterTargetNodes<
26
35
  testID?: unknown
27
36
  id?: unknown
28
37
  text?: unknown
38
+ style?: unknown
39
+ isTextInput?: unknown
29
40
  accessibilityLabel?: unknown
30
41
  accessible?: unknown
31
42
  },
@@ -37,9 +48,11 @@ export function filterTargetNodes<
37
48
  return nodes.filter((node) => {
38
49
  if (
39
50
  matcher.type === 'text' &&
40
- node.type !== 'text' &&
41
51
  typeof node.nodeId === 'number' &&
42
- node.nodeId >= 0
52
+ node.nodeId >= 0 &&
53
+ // detox matches a text field by its own text, so the line a Peach field
54
+ // draws that text with is not a target; the field is.
55
+ (node.type === 'text' ? isFieldLine(node.style) : node.isTextInput !== true)
43
56
  )
44
57
  return false
45
58
  if (!regex) return matcher.type !== 'text' || node.text === matcher.value
@@ -526,10 +526,14 @@ export function compileWorkletExecutables(
526
526
  if (typeof offset !== 'number') throw new Error('peach: worklet code has no offset')
527
527
  return { offset, text: `, __peachExecutable: (${body})` }
528
528
  })
529
- let compiled = source
529
+ const parts: string[] = []
530
+ let cursor = source.length
530
531
  for (const edit of edits.sort((a, b) => b.offset - a.offset)) {
531
532
  onInsert?.(edit.offset, edit.text)
532
- compiled = compiled.slice(0, edit.offset) + edit.text + compiled.slice(edit.offset)
533
+ parts.push(source.slice(edit.offset, cursor), edit.text)
534
+ cursor = edit.offset
533
535
  }
534
- return compiled
536
+ // reverse assembly places later insertions first at equal offsets.
537
+ parts.push(source.slice(0, cursor))
538
+ return parts.reverse().join('')
535
539
  }
@@ -224,12 +224,24 @@ export function readXcodeJsonProject(xcodeproj: string, source: string): PlistDi
224
224
  isa: 'XCConfigurationList',
225
225
  defaultConfigurationName: text(json['default-configuration']) ?? 'Debug',
226
226
  buildConfigurations: configurations.map(({ name, file }) => {
227
- const base = lookup(specialized.has(name) ? specialized.get(name) : file)
227
+ const reference = specialized.has(name) ? specialized.get(name) : file
228
+ const base = lookup(reference)
229
+ // a synchronized folder lists no children, so a file inside it is
230
+ // named by the folder and its relative path
231
+ const anchor = isObject(reference) ? lookupNode(reference.anchor, root)?.id : null
232
+ const relative = isObject(reference) ? text(reference['relative-path']) : null
228
233
  return add({
229
234
  isa: 'XCBuildConfiguration',
230
235
  name,
231
236
  buildSettings: settings,
232
- ...(base ? { baseConfigurationReference: base } : {}),
237
+ ...(base
238
+ ? { baseConfigurationReference: base }
239
+ : anchor && relative
240
+ ? {
241
+ baseConfigurationReferenceAnchor: anchor,
242
+ baseConfigurationReferenceRelativePath: relative,
243
+ }
244
+ : {}),
233
245
  })
234
246
  }),
235
247
  })