peachsim 0.1.1692 → 0.1.1700

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 (245) hide show
  1. package/cli/bridge-flow-runner.ts +61 -39
  2. package/cli/commands/agent-wrapper.ts +21 -10
  3. package/cli/commands/control.ts +27 -7
  4. package/cli/commands/coverage.ts +1 -1
  5. package/cli/commands/detect.ts +17 -4
  6. package/cli/commands/maestro-compare.ts +25 -99
  7. package/cli/help-core.ts +3 -4
  8. package/cli/maestro-compare.ts +172 -4
  9. package/cli/outbound-endpoints.ts +2 -10
  10. package/detox/index.ts +15 -0
  11. package/detox/launch-permissions.ts +169 -0
  12. package/dist-lib/agent-daemon-client.cjs +2 -2
  13. package/dist-lib/agent-events.cjs +2 -2
  14. package/dist-lib/attached-projects.cjs +2 -2
  15. package/dist-lib/auth/shared-session.cjs +2 -2
  16. package/dist-lib/backend-origin.cjs +2 -2
  17. package/dist-lib/beta.cjs +2 -2
  18. package/dist-lib/beta.mjs +1 -1
  19. package/dist-lib/bridge-constants.cjs +2 -2
  20. package/dist-lib/bridge-contract-input.cjs +2 -2
  21. package/dist-lib/bridge-contract-input.mjs +1 -1
  22. package/dist-lib/bridge-contract.cjs +2 -2
  23. package/dist-lib/bridge-contract.mjs +1 -1
  24. package/dist-lib/bundle-channel.cjs +18273 -15925
  25. package/dist-lib/capture-contract.cjs +2 -2
  26. package/dist-lib/capture-contract.mjs +1 -1
  27. package/dist-lib/cloud-contract.cjs +2 -2
  28. package/dist-lib/cloud-contract.mjs +1 -1
  29. package/dist-lib/cloud-test-args.cjs +2 -2
  30. package/dist-lib/cloud-test-args.mjs +1 -1
  31. package/dist-lib/cloud.cjs +2 -2
  32. package/dist-lib/cloud.mjs +1 -1
  33. package/dist-lib/config.cjs +2 -2
  34. package/dist-lib/config.mjs +1 -1
  35. package/dist-lib/detox/index.cjs +104 -3
  36. package/dist-lib/dev-bundle-resolution.cjs +208 -44
  37. package/dist-lib/expo-swift-bundle.cjs +2349 -1778
  38. package/dist-lib/expo-swift-metadata.cjs +2 -2
  39. package/dist-lib/expo-swift-metadata.mjs +1 -1
  40. package/dist-lib/home-paths.cjs +2 -2
  41. package/dist-lib/host/bridge-host.cjs +7885 -3334
  42. package/dist-lib/host/fetch-proxy-handler.cjs +331 -39
  43. package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
  44. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  45. package/dist-lib/host/replacement-module-handler.cjs +2 -2
  46. package/dist-lib/host/websocket-proxy.cjs +2 -2
  47. package/dist-lib/index.cjs +297 -77
  48. package/dist-lib/jump-to-source-babel.cjs +2 -2
  49. package/dist-lib/jump-to-source-native.cjs +2 -2
  50. package/dist-lib/kotlin-host.cjs +2 -2
  51. package/dist-lib/menu.cjs +2 -2
  52. package/dist-lib/menu.mjs +1 -1
  53. package/dist-lib/metro-fingerprint-registry.cjs +2 -2
  54. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  55. package/dist-lib/metro-production-bundle.cjs +2 -2
  56. package/dist-lib/metro-production-bundle.mjs +1 -1
  57. package/dist-lib/metro.cjs +294 -74
  58. package/dist-lib/native-app-identity-project.cjs +48 -37
  59. package/dist-lib/native-app-identity-project.mjs +47 -36
  60. package/dist-lib/native-app-identity.cjs +2 -2
  61. package/dist-lib/native-app-identity.mjs +1 -1
  62. package/dist-lib/native-firebase-metadata.cjs +2 -2
  63. package/dist-lib/native-firebase-metadata.mjs +1 -1
  64. package/dist-lib/plist.cjs +2 -2
  65. package/dist-lib/plist.mjs +1 -1
  66. package/dist-lib/profiles.cjs +2 -2
  67. package/dist-lib/public-brand.cjs +2 -2
  68. package/dist-lib/public-origins-lib-esm.json +24 -23
  69. package/dist-lib/public-origins-lib.json +199 -79
  70. package/dist-lib/react-native-host-modules.cjs +2 -2
  71. package/dist-lib/react-native-host-modules.mjs +1 -1
  72. package/dist-lib/reap-browser.cjs +2 -2
  73. package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
  74. package/dist-lib/sdk.cjs +2 -2
  75. package/dist-lib/sdk.mjs +1 -1
  76. package/dist-lib/skills.cjs +19600 -15992
  77. package/dist-lib/swift-compile.cjs +640 -402
  78. package/dist-lib/swift-compile.mjs +595 -357
  79. package/dist-lib/swift-package.cjs +24 -20
  80. package/dist-lib/swift-package.mjs +23 -19
  81. package/dist-lib/swift-submit.cjs +2 -2
  82. package/dist-lib/swift-submit.mjs +1 -1
  83. package/dist-lib/swift-toolchain.cjs +31 -4
  84. package/dist-lib/swift.cjs +2 -2
  85. package/dist-lib/vite-swift.cjs +1559 -1208
  86. package/dist-lib/vite.cjs +251 -42
  87. package/dist-lib/worklet-executable.cjs +2 -2
  88. package/dist-lib/worklet-executable.mjs +1 -1
  89. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
  90. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
  91. package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
  92. package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
  93. package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
  94. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  95. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
  96. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
  97. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
  98. package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
  99. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
  100. package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
  101. package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
  102. package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
  103. package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
  104. package/package.json +1 -1
  105. package/runtime-companion.json +1 -1
  106. package/scripts/dev-server-scanner.ts +4 -0
  107. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
  108. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
  109. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
  110. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
  111. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
  112. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
  113. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
  114. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
  115. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
  116. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
  117. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
  118. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
  119. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
  120. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
  121. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
  122. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
  123. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
  124. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
  125. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
  126. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
  127. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
  128. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
  129. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
  130. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
  131. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
  132. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
  133. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
  134. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
  135. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
  136. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
  137. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
  138. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
  139. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
  140. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
  141. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
  142. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
  143. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
  144. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
  145. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
  146. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
  147. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
  148. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
  149. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
  150. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
  151. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
  152. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
  153. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
  154. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
  155. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
  156. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
  157. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
  158. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
  159. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
  160. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
  161. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
  162. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
  163. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
  164. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
  165. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
  166. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
  167. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
  168. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
  169. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
  170. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
  171. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
  172. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
  173. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
  174. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -229
  175. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
  176. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2 -1
  177. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
  178. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
  179. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
  180. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
  181. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
  182. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
  183. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
  184. package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
  185. package/sdk/ios/usr/include/copyfile.h +143 -0
  186. package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
  187. package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
  188. package/sdk/ios/usr/include/malloc/_platform.h +80 -0
  189. package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
  190. package/sdk/ios/usr/include/malloc/malloc.h +768 -0
  191. package/sdk/ios/usr/include/os/availability.h +168 -6
  192. package/sdk/ios/usr/include/os/base.h +351 -0
  193. package/sdk/ios/usr/include/os/clock.h +18 -0
  194. package/sdk/ios/usr/include/os/lock.h +232 -10
  195. package/sdk/ios/usr/include/os/log.h +521 -38
  196. package/sdk/ios/usr/include/os/object.h +320 -3
  197. package/sdk/ios/usr/include/os/trace.h +492 -0
  198. package/sdk/ios/usr/include/os/trace_base.h +167 -0
  199. package/sdk/ios/usr/include/os/workgroup.h +37 -0
  200. package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
  201. package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
  202. package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
  203. package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
  204. package/sdk/ios/usr/include/sys/cdefs.h +38 -0
  205. package/sdk/ios/wasm/include/unistd.h +3 -0
  206. package/skills/contrast/SKILL.md +3 -0
  207. package/src/codex-client.ts +11 -6
  208. package/src/dev-bundle-resolution.ts +124 -48
  209. package/src/expo-native-workspace.ts +176 -0
  210. package/src/expo-swift-host.ts +161 -26
  211. package/src/expo-swift-ready.ts +14 -28
  212. package/src/expoSwiftContract.ts +4 -1
  213. package/src/generated/swift-c-predefines.json +68 -12
  214. package/src/host/bridge-host.ts +5 -0
  215. package/src/installed-package-versions.ts +14 -1
  216. package/src/metro-project-root.ts +44 -33
  217. package/src/native-app-identity-project.ts +1 -0
  218. package/src/nitro-adapter.lock.json +916 -10
  219. package/src/nitro-adapter.ts +33 -24
  220. package/src/nitro-bundle.ts +108 -22
  221. package/src/nitro-compile.ts +32 -5
  222. package/src/nitro-source.ts +13 -3
  223. package/src/nitroAdapterContract.ts +100 -20
  224. package/src/node-http-fetch.ts +116 -0
  225. package/src/packageVersionsContract.ts +46 -0
  226. package/src/serverDiscoveryContract.ts +1 -0
  227. package/src/settingsContract.ts +0 -30
  228. package/src/swift-binary-modules.ts +20 -5
  229. package/src/swift-compile.ts +168 -48
  230. package/src/swift-coverage/xcode-assets.ts +4 -3
  231. package/src/swift-host.ts +14 -3
  232. package/src/swift-objc-compile.ts +32 -5
  233. package/src/swift-objc-metadata.ts +2 -2
  234. package/src/swift-objc-platform.ts +2 -2
  235. package/src/swift-objc-standin.ts +43 -13
  236. package/src/swift-package.ts +33 -26
  237. package/src/swift-source-pods.ts +126 -41
  238. package/src/swift-standin-digest.ts +77 -0
  239. package/src/swift-standin-emit.ts +40 -4
  240. package/src/swift-standins.ts +68 -19
  241. package/src/swift-toolchain.ts +38 -0
  242. package/src/swiftContract.ts +8 -0
  243. package/src/vite-plugin.ts +0 -10
  244. package/src/xcode-project.ts +62 -42
  245. package/src/settings-flags.ts +0 -107
@@ -66,10 +66,12 @@ import {
66
66
  import { withSwiftRootLock, type SwiftRootLease } from './swift-root-lock'
67
67
  import {
68
68
  sourceSwiftCheckout,
69
+ SWIFT_AUTOLINK_LINKER,
69
70
  swiftEnvironment,
70
71
  swiftSdkOptions,
71
72
  swiftSourceSdk,
72
73
  swiftToolchain,
74
+ writeSwiftAutolinkLinker,
73
75
  type SwiftWasmSdk,
74
76
  } from './swift-toolchain'
75
77
  import {
@@ -339,12 +341,18 @@ export function swiftModuleInputFiles(root: string): string[] {
339
341
  * checkout's must be rebuilt (scripts/build-preview-plugin.sh) first. */
340
342
  export function swiftMacroPlugins(moduleRoot: string): {
341
343
  libraries: string[]
344
+ executables: string[]
342
345
  stale: boolean
343
346
  } {
344
347
  const distribution = swiftDistributionAt(moduleRoot)
345
348
  if (distribution)
346
349
  return {
347
- libraries: distribution.plugins.map((plugin) => path.join(moduleRoot, plugin)),
350
+ libraries: distribution.plugins
351
+ .filter((plugin) => path.basename(plugin) !== 'ExpoModulesMacros')
352
+ .map((plugin) => path.join(moduleRoot, plugin)),
353
+ executables: distribution.plugins
354
+ .filter((plugin) => path.basename(plugin) === 'ExpoModulesMacros')
355
+ .map((plugin) => path.join(moduleRoot, plugin)),
348
356
  stale: false,
349
357
  }
350
358
  const dir = path.join(moduleRoot, '.build/host/RnxPreviewMacros')
@@ -352,6 +360,8 @@ export function swiftMacroPlugins(moduleRoot: string): {
352
360
  readFileSync(path.join(moduleRoot, 'toolchain.json'), 'utf8'),
353
361
  ).release
354
362
  const compilerStamp = path.join(dir, 'compiler-release')
363
+ const pluginScript = path.join(moduleRoot, 'scripts/build-preview-plugin.sh')
364
+ const expoPlugin = path.join(dir, 'ExpoModulesMacros')
355
365
  // linux names a plugin's module from lib<Module>.so
356
366
  const ext = process.platform === 'darwin' ? 'dylib' : 'so'
357
367
  const plugins = [
@@ -376,8 +386,11 @@ export function swiftMacroPlugins(moduleRoot: string): {
376
386
  ]
377
387
  return {
378
388
  libraries: plugins.map(({ library }) => library),
389
+ executables: [expoPlugin],
379
390
  stale:
380
391
  !existsSync(compilerStamp) ||
392
+ !existsSync(expoPlugin) ||
393
+ statSync(pluginScript).mtimeMs > statSync(expoPlugin).mtimeMs ||
381
394
  readFileSync(compilerStamp, 'utf8').trim() !== release ||
382
395
  plugins.some(
383
396
  ({ library, sources }) =>
@@ -392,8 +405,8 @@ export async function ensureMacroPlugins(
392
405
  toolchainBin: string,
393
406
  release: string,
394
407
  signal?: AbortSignal,
395
- ): Promise<string[]> {
396
- const { libraries, stale } = swiftMacroPlugins(moduleRoot)
408
+ ): Promise<{ libraries: string[]; executables: string[] }> {
409
+ const { libraries, executables, stale } = swiftMacroPlugins(moduleRoot)
397
410
  if (stale) {
398
411
  await runCompiler(
399
412
  'sh',
@@ -409,7 +422,7 @@ export async function ensureMacroPlugins(
409
422
  `${release}\n`,
410
423
  )
411
424
  }
412
- return libraries
425
+ return { libraries, executables }
413
426
  }
414
427
 
415
428
  const linkedModuleDigests = new Map<string, { stamp: string; digest: Buffer }>()
@@ -543,6 +556,30 @@ const OPTIONAL_FRAMEWORKS = new Set(Object.keys(OPTIONAL_FRAMEWORK_DEPENDENCIES)
543
556
  const SWIFT_IMPORT =
544
557
  /^\s*(?:@\w+(?:\([^)]*\))?\s+)*import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([A-Za-z_][A-Za-z0-9_]*)/
545
558
 
559
+ // three-valued (kleene) logic shared by the swift and c condition
560
+ // evaluators: an undecided operand only decides when the other forces the
561
+ // outcome, so false && undefined is false and true || undefined is true.
562
+ const kleeneNot = (value: boolean | undefined): boolean | undefined =>
563
+ value === undefined ? undefined : !value
564
+ const kleeneAnd = (
565
+ left: boolean | undefined,
566
+ right: boolean | undefined,
567
+ ): boolean | undefined =>
568
+ left === false || right === false
569
+ ? false
570
+ : left === true && right === true
571
+ ? true
572
+ : undefined
573
+ const kleeneOr = (
574
+ left: boolean | undefined,
575
+ right: boolean | undefined,
576
+ ): boolean | undefined =>
577
+ left === true || right === true
578
+ ? true
579
+ : left === false && right === false
580
+ ? false
581
+ : undefined
582
+
546
583
  // a compilation condition as the wasm compile sees it after the source
547
584
  // rewrite below: `os(iOS)` and `os(WASI)` hold, other platforms do not,
548
585
  // `canImport` holds for an available module. what the scan cannot know
@@ -556,10 +593,7 @@ function swiftCondition(
556
593
  let index = 0
557
594
  const atom = (): boolean | undefined => {
558
595
  const token = tokens[index++]
559
- if (token === '!') {
560
- const value = atom()
561
- return value === undefined ? undefined : !value
562
- }
596
+ if (token === '!') return kleeneNot(atom())
563
597
  if (token === '(') {
564
598
  const value = either()
565
599
  index++
@@ -580,8 +614,7 @@ function swiftCondition(
580
614
  let value = atom()
581
615
  while (tokens[index] === '&&') {
582
616
  index++
583
- const next = atom()
584
- value = value === false || next === false ? false : value && next ? true : undefined
617
+ value = kleeneAnd(value, atom())
585
618
  }
586
619
  return value
587
620
  }
@@ -589,13 +622,7 @@ function swiftCondition(
589
622
  let value = both()
590
623
  while (tokens[index] === '||') {
591
624
  index++
592
- const next = both()
593
- value =
594
- value === true || next === true
595
- ? true
596
- : value === false && next === false
597
- ? false
598
- : undefined
625
+ value = kleeneOr(value, both())
599
626
  }
600
627
  return value
601
628
  }
@@ -681,7 +708,7 @@ export function swiftPeachModules(moduleRoot: string): string[] {
681
708
  : swiftManifestDeclarations(
682
709
  readFileSync(path.join(moduleRoot, 'Package.swift'), 'utf8'),
683
710
  )
684
- .filter((target) => !target.executable)
711
+ .filter((target) => !target.executable && !target.path.startsWith('fixtures/'))
685
712
  .map((target) => target.name)
686
713
  }
687
714
 
@@ -854,17 +881,20 @@ const ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One
854
881
  // target share (specs/peach-swift/build-plans.md). clang runs `wasm-opt -Os`
855
882
  // after a wasm link whenever the machine has one on PATH, which makes every
856
883
  // edit pay for an optimizer pass and the artifact depend on the machine, so
857
- // -O0 on the clang link turns that pass off everywhere. the rest is the
858
- // native main-thread stack budget.
859
- const EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
884
+ // -O0 on the clang link turns that pass off everywhere. the build root's
885
+ // linker drops repeated autolink -l flags (writeSwiftAutolinkLinker). the
886
+ // rest is the native main-thread stack budget.
887
+ const executableLinkFlags = (root: string) => ` "-Xclang-linker", "-O0",
888
+ "-Xclang-linker", ${JSON.stringify(`-fuse-ld=${path.join(root, SWIFT_AUTOLINK_LINKER)}`)},
860
889
  "-Xlinker", "-z", "-Xlinker", "stack-size=8372224",
861
890
  "-Xlinker", "--stack-first",
862
891
  "-Xlinker", "--global-base=8372224",
892
+ "-Xlinker", "-lsetjmp",
863
893
  `
864
894
  const REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n'
865
895
 
866
896
  /** bump with any change to the emitted multi-target manifest text. */
867
- export const MULTI_MANIFEST_VERSION = 43
897
+ export const MULTI_MANIFEST_VERSION = 45
868
898
 
869
899
  // build-cli replaces this in every bundle; source runs read the files directly.
870
900
  declare const __SWIFT_COMPILER_DIGEST__: string | undefined
@@ -960,6 +990,7 @@ interface SwiftNativeTargetPlan {
960
990
  flags?: string[]
961
991
  cxxFlags?: string[]
962
992
  mixed?: boolean
993
+ underlying?: { modulemap: string; flags: string[] }
963
994
  clang?: {
964
995
  modulemap: string
965
996
  sources: string[]
@@ -992,6 +1023,8 @@ function swiftCrossImportFlags(moduleRoot: string, distribution: boolean): strin
992
1023
  }
993
1024
 
994
1025
  export function emitSwiftPackageManifest(args: {
1026
+ /** the build root holding the linker each executable links with. */
1027
+ root: string
995
1028
  targets: SwiftPackageTarget[]
996
1029
  packages?: ReadonlyMap<string, string>
997
1030
  cxxLanguageStandard?: string
@@ -1123,9 +1156,20 @@ export function emitSwiftPackageManifest(args: {
1123
1156
  ])
1124
1157
  includeImportContext(dependency)
1125
1158
  const nativeImportFlags = [...importContext]
1126
- .flatMap((name) => args.native?.get(name)?.clang?.importFlags ?? [])
1159
+ .flatMap((name) => {
1160
+ const dependency = args.native?.get(name)
1161
+ return dependency?.underlying
1162
+ ? [
1163
+ `-fmodule-map-file=${dependency.underlying.modulemap}`,
1164
+ ...dependency.underlying.flags,
1165
+ ]
1166
+ : (dependency?.clang?.importFlags ?? [])
1167
+ })
1127
1168
  .map((flag) => `, "-Xcc", ${JSON.stringify(flag)}`)
1128
1169
  .join('')
1170
+ const underlying = native?.underlying
1171
+ ? `, "-import-underlying-module", "-Xcc", ${JSON.stringify(`-fmodule-map-file=${native.underlying.modulemap}`)}${native.underlying.flags.map((flag) => `, "-Xcc", ${JSON.stringify(flag)}`).join('')}`
1172
+ : ''
1129
1173
  const header =
1130
1174
  args.headerDirectory &&
1131
1175
  [...(args.native?.values() ?? [])].some((value) =>
@@ -1133,7 +1177,7 @@ export function emitSwiftPackageManifest(args: {
1133
1177
  )
1134
1178
  ? `, "-emit-objc-header-path", ${JSON.stringify(path.join(args.headerDirectory, `${target.name}-${args.objcExports?.modules.has(target.name) ? 'Cxx' : 'Swift'}.h`))}`
1135
1179
  : ''
1136
- const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming}${exports} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ''}${imports}${nativeImports}${nativeImportFlags}${header}${upstream}])]`
1180
+ const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming}${exports} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ''}${imports}${nativeImports}${nativeImportFlags}${underlying}${header}${upstream}])]`
1137
1181
  const deps = [
1138
1182
  ...new Set([
1139
1183
  ...(target.dependencies ?? []).flatMap((dependency) =>
@@ -1209,7 +1253,7 @@ export function emitSwiftPackageManifest(args: {
1209
1253
  linkerSettings: [
1210
1254
  ${librarySettings.map((setting) => `${setting},`).join('\n ')}
1211
1255
  .unsafeFlags([
1212
- ${REACTOR_FLAG}${EXECUTABLE_LINK_FLAGS} "-Xlinker", "--export-if-defined=__main_argc_argv"${args.objcExports ? ', "-Xlinker", "--fatal-warnings"' : ''}${library},
1256
+ ${REACTOR_FLAG}${executableLinkFlags(args.root)} "-Xlinker", "--export-if-defined=__main_argc_argv"${args.objcExports ? ', "-Xlinker", "--fatal-warnings"' : ''}${library},
1213
1257
  ]),
1214
1258
  .unsafeFlags(["-Xlinker", "--strip-all"], .when(configuration: .release)),
1215
1259
  ]`
@@ -1228,14 +1272,18 @@ export function emitSwiftPackageManifest(args: {
1228
1272
  `cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...(args.nativeFlags?.get(target.name) ?? []), ...(native?.flags ?? [])])})]`,
1229
1273
  `cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(['-fno-cxx-modules', ...(args.nativeFlags?.get(target.name) ?? []), ...(native?.cxxFlags ?? [])])})]`,
1230
1274
  ].join(', ')
1275
+ const exclusions = native?.clang
1276
+ ? (native.exclude ?? native.lateSources)
1277
+ : [
1278
+ ...(native ? (native.exclude ?? native.lateSources) : []),
1279
+ ...(target.exclude ?? []),
1280
+ ]
1231
1281
  return [
1232
1282
  ` ${kind}(`,
1233
1283
  ` name: "${target.name}",`,
1234
1284
  ` dependencies: [${deps}],`,
1235
1285
  ` path: ${JSON.stringify(native?.clang ? '.' : target.path)},`,
1236
- ...(native
1237
- ? [` exclude: ${JSON.stringify(native.exclude ?? native.lateSources)},`]
1238
- : []),
1286
+ ...(exclusions.length ? [` exclude: ${JSON.stringify(exclusions)},`] : []),
1239
1287
  ...(native?.clang
1240
1288
  ? [
1241
1289
  ` sources: ${JSON.stringify(native.clang.sources.map((source) => path.posix.join(native.path, source)))},`,
@@ -5862,8 +5910,7 @@ function cMacroBareValue(name: string, env: SwiftCMacroEnvironment): boolean | u
5862
5910
  }
5863
5911
 
5864
5912
  function cMacroNegated(name: string, env: SwiftCMacroEnvironment): boolean | undefined {
5865
- const value = cMacroDefined(name, env)
5866
- return value === undefined ? undefined : !value
5913
+ return kleeneNot(cMacroDefined(name, env))
5867
5914
  }
5868
5915
 
5869
5916
  // a preprocessor condition the macro environment decides, or undefined when
@@ -5884,8 +5931,7 @@ function cConditionValue(
5884
5931
  skipSpaces()
5885
5932
  if (!expression.startsWith('||', i)) return value
5886
5933
  i += 2
5887
- const right = parseAnd()
5888
- value = value === undefined || right === undefined ? undefined : value || right
5934
+ value = kleeneOr(value, parseAnd())
5889
5935
  }
5890
5936
  }
5891
5937
  const parseAnd = (): boolean | undefined => {
@@ -5894,16 +5940,14 @@ function cConditionValue(
5894
5940
  skipSpaces()
5895
5941
  if (!expression.startsWith('&&', i)) return value
5896
5942
  i += 2
5897
- const right = parseUnary()
5898
- value = value === undefined || right === undefined ? undefined : value && right
5943
+ value = kleeneAnd(value, parseUnary())
5899
5944
  }
5900
5945
  }
5901
5946
  const parseUnary = (): boolean | undefined => {
5902
5947
  skipSpaces()
5903
5948
  if (expression[i] === '!') {
5904
5949
  i++
5905
- const value = parseUnary()
5906
- return value === undefined ? undefined : !value
5950
+ return kleeneNot(parseUnary())
5907
5951
  }
5908
5952
  if (expression[i] === '(') {
5909
5953
  i++
@@ -6046,12 +6090,12 @@ const cPredefineTable: SwiftCPredefinesTable = cPredefinesJson
6046
6090
  const cPredefineCache = new Map<string, Map<string, string | undefined>>()
6047
6091
 
6048
6092
  // the compiler's own macros for the language xcode compiles the unit with:
6049
- // the pinned toolchain clang's `-dM -E -target arm64-apple-ios` predefines,
6050
- // committed in generated/swift-c-predefines.json and held at the pinned
6051
- // release by scripts/check/swift-c-predefines-generated.ts. a table, not a
6052
- // spawn, so the scan works hosted, on linux and without xcode. the triple
6053
- // is the arm64-apple-ios device triple (TARGET_OS_SIMULATOR is 0 there; it
6054
- // is 1 for the simulator SDK), matching the shipping configuration.
6093
+ // the pinned toolchain clang's `-dM -E -target arm64-apple-ios-simulator`
6094
+ // predefines, committed in generated/swift-c-predefines.json and held at
6095
+ // the pinned release by scripts/check/swift-c-predefines-generated.ts. a
6096
+ // table, not a spawn, so the scan works hosted, on linux and without xcode.
6097
+ // the triple is the arm64 simulator triple (TARGET_OS_SIMULATOR is 1 there),
6098
+ // matching the emulated target.
6055
6099
  export function swiftCPredefines(
6056
6100
  language: 'c' | 'c++' | 'objective-c' | 'objective-c++',
6057
6101
  ): Map<string, string | undefined> {
@@ -6071,7 +6115,28 @@ export function swiftCMainEntry(
6071
6115
  ): boolean {
6072
6116
  if (!isSwiftNativeTranslationUnit(file)) return false
6073
6117
  const code = cActiveCode(stripCCode(source), env)
6118
+ // brace depth ahead of each match, except linkage blocks (`extern "C"`,
6119
+ // strings already stripped): a main inside any other braces is a member,
6120
+ // not the file-scope entry. linkage stays transparent, matching clang,
6121
+ // which accepts the entry with a -Wmain warning.
6122
+ const linkage: boolean[] = []
6123
+ let scanned = 0
6074
6124
  for (const match of code.matchAll(/^\s*(?:int\s+|void\s+)?main\s*\(/gm)) {
6125
+ while (scanned < match.index) {
6126
+ if (code[scanned] === '{') {
6127
+ let start = scanned
6128
+ while (
6129
+ start > 0 &&
6130
+ code[start - 1] !== ';' &&
6131
+ code[start - 1] !== '{' &&
6132
+ code[start - 1] !== '}'
6133
+ )
6134
+ start--
6135
+ linkage.push(/(?:^|[^\w])extern\s*$/.test(code.slice(start, scanned)))
6136
+ } else if (code[scanned] === '}') linkage.pop()
6137
+ scanned += 1
6138
+ }
6139
+ if (linkage.some((open) => !open)) continue
6075
6140
  // a definition opens its body after the parameter list and any
6076
6141
  // trailing declarators (noexcept, attributes); a declaration or a
6077
6142
  // call ends with a semicolon instead.
@@ -6525,8 +6590,9 @@ export function writeSwiftProject(
6525
6590
  })
6526
6591
  }
6527
6592
  }
6528
- // headers keep their original project paths. product headers additionally
6529
- // occupy the same Module/Header.h namespace that xcode publishes.
6593
+ // headers keep their original project paths. an xcode target's product
6594
+ // headers additionally occupy the flat Module/Header.h namespace it
6595
+ // publishes; a swiftpm target's stay under its public headers directory.
6530
6596
  for (const settings of input.nativeTargets ?? []) {
6531
6597
  for (const file of settings.headers) {
6532
6598
  const contents = input.files[file]
@@ -6537,6 +6603,7 @@ export function writeSwiftProject(
6537
6603
  writeFileSync(destination, contents)
6538
6604
  files.set(destination, contents)
6539
6605
  }
6606
+ if (!settings.flattensPublicHeaders) continue
6540
6607
  for (const header of settings.publicHeaders) {
6541
6608
  const destination = path.join(headerDirectory, settings.name, path.basename(header))
6542
6609
  if (files.has(destination))
@@ -6770,7 +6837,6 @@ export function writeSwiftProject(
6770
6837
  // the complete original surface decides the importer, including
6771
6838
  // declarations absent from the swift symbol graph, such as globals.
6772
6839
  nativeC =
6773
- !entries.some(([file]) => file.endsWith('.swift')) &&
6774
6840
  !objcDeclarations &&
6775
6841
  view.graphs.every((graph) =>
6776
6842
  graph.symbols.every(
@@ -6905,6 +6971,46 @@ export function writeSwiftProject(
6905
6971
  })
6906
6972
  continue
6907
6973
  }
6974
+ if (nativeC && entries.some(([file]) => file.endsWith('.swift'))) {
6975
+ const modulemaps = Object.entries(settings.productHeaders).filter(([product]) =>
6976
+ product.endsWith('.modulemap'),
6977
+ )
6978
+ if (modulemaps.length !== 1)
6979
+ throw new Error(`target ${target.name} requires one original module map`)
6980
+ const [product, original] = modulemaps[0]!
6981
+ const contents = input.files[original]
6982
+ if (contents === undefined)
6983
+ throw new Error(`missing original module map ${original}`)
6984
+ stageTargetFile(target.name, path.join(layout.root, product), contents, {
6985
+ allowExisting: true,
6986
+ })
6987
+ const include = path.join(layout.root, target.path, 'include')
6988
+ stageTargetFile(
6989
+ target.name,
6990
+ path.join(include, 'module.modulemap'),
6991
+ `module ${target.name}ImplementationDeclarations { export * }\n`,
6992
+ )
6993
+ native.set(target.name, {
6994
+ mixed: true,
6995
+ path: target.path,
6996
+ includeDirectory: include,
6997
+ sources: nativeUnits.map(([file]) => unitSource(file)),
6998
+ lateSources: nativeUnits.map(([file]) => unitSource(file)),
6999
+ exclude: entries
7000
+ .filter(([file]) => !file.endsWith('.swift') && !file.endsWith('.metal'))
7001
+ .map(([file]) => file.slice(prefix.length))
7002
+ .concat('include'),
7003
+ underlying: { modulemap: path.join(layout.root, product), flags },
7004
+ groups: [...groups.values()],
7005
+ late: {
7006
+ name: `${target.name}SwiftImplementation`,
7007
+ producers: nativeUnits.some(([file]) => /\.mm?$/.test(file))
7008
+ ? [target.name]
7009
+ : [],
7010
+ },
7011
+ })
7012
+ continue
7013
+ }
6908
7014
  if (nativeC) {
6909
7015
  const modulemaps = Object.entries(settings.productHeaders).filter(([product]) =>
6910
7016
  product.endsWith('/Modules/module.modulemap'),
@@ -7112,7 +7218,11 @@ export function writeSwiftProject(
7112
7218
  continue
7113
7219
  }
7114
7220
  const original = imports.get(name)
7115
- if (!exported && !original) continue
7221
+ if (!exported && !original) {
7222
+ if (native.get(name)?.lateSources.some((file) => /\.mm?$/.test(file)))
7223
+ rootOwner ??= targetEntries(target).find(([file]) => file.endsWith('.swift'))?.[0]
7224
+ continue
7225
+ }
7116
7226
  let generated: ReturnType<typeof swiftObjCImports> | undefined
7117
7227
  try {
7118
7228
  generated =
@@ -7278,6 +7388,8 @@ export function writeSwiftProject(
7278
7388
  '-fobjc-exceptions',
7279
7389
  '-fexceptions',
7280
7390
  '-fwasm-exceptions',
7391
+ '-mllvm',
7392
+ '-wasm-enable-sjlj',
7281
7393
  '-fobjc-arc',
7282
7394
  '-fblocks',
7283
7395
  ...objcSdkIntakeFlags(headers, nativeToolchain(), minimum),
@@ -7366,7 +7478,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
7366
7478
  throw new Error(
7367
7479
  'scripts/contrast-app-Package.swift lost the executable linker line',
7368
7480
  )
7369
- manifest = manifest.replace(reactor, `${reactor}${EXECUTABLE_LINK_FLAGS}`)
7481
+ manifest = manifest.replace(reactor, `${reactor}${executableLinkFlags(layout.root)}`)
7370
7482
  const optionalProducts =
7371
7483
  swiftTargetDependencies(input.files, [{ name: 'App', path: '.' }]).get('App') ?? []
7372
7484
  if (optionalProducts.length > 0) {
@@ -7421,6 +7533,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
7421
7533
  files.set(
7422
7534
  path.join(layout.root, 'Package.swift'),
7423
7535
  emitSwiftPackageManifest({
7536
+ root: layout.root,
7424
7537
  targets,
7425
7538
  packages,
7426
7539
  native,
@@ -7932,6 +8045,7 @@ export function compileSwiftProjectUnit(
7932
8045
  // and that one reads and gzips it while swift builds
7933
8046
  const sdk = swiftModuleSdk(moduleRoot).wasmSdkId
7934
8047
  const icu = swiftIcuAsset(options.toolchainBin, sdk)
8048
+ writeSwiftAutolinkLinker(root, options.toolchainBin)
7935
8049
  const buildArgs = [
7936
8050
  'build',
7937
8051
  ...swiftPackageCacheOptions(),
@@ -7955,12 +8069,18 @@ export function compileSwiftProjectUnit(
7955
8069
  '-num-threads',
7956
8070
  '-Xswiftc',
7957
8071
  BUILD_JOBS,
7958
- ...macroPlugins.flatMap((plugin) => [
8072
+ ...macroPlugins.libraries.flatMap((plugin) => [
7959
8073
  '-Xswiftc',
7960
8074
  '-load-plugin-library',
7961
8075
  '-Xswiftc',
7962
8076
  plugin,
7963
8077
  ]),
8078
+ ...macroPlugins.executables.flatMap((plugin) => [
8079
+ '-Xswiftc',
8080
+ '-load-plugin-executable',
8081
+ '-Xswiftc',
8082
+ `${plugin}#ExpoModulesMacros`,
8083
+ ]),
7964
8084
  ]
7965
8085
  const buildOptions = {
7966
8086
  env: {
@@ -105,17 +105,17 @@ export function planAssetSymbols(
105
105
  'Generated asset symbols need a resolved PRODUCT_BUNDLE_IDENTIFIER and IPHONEOS_DEPLOYMENT_TARGET.',
106
106
  )
107
107
  const families = (settings.TARGETED_DEVICE_FAMILY ?? '').split(',').sort().join(',')
108
- // family 7 adds the visionOS designed-for-iPad slot, which changes neither the
109
- // actool arguments nor the symbols for the iOS slice
108
+ // families 6 and 7 change neither actool arguments nor symbols for the iOS slice
110
109
  const devices = {
111
110
  '1': ['iphone'],
112
111
  '2': ['ipad'],
113
112
  '1,2': ['iphone', 'ipad'],
113
+ '1,2,6': ['iphone', 'ipad'],
114
114
  '1,2,7': ['iphone', 'ipad'],
115
115
  }[families]
116
116
  if (!devices)
117
117
  return unknown(
118
- `Generated asset symbols are proven only for TARGETED_DEVICE_FAMILY 1, 2, 1,2 or 1,2,7; this target resolves to "${settings.TARGETED_DEVICE_FAMILY ?? ''}".`,
118
+ `Generated asset symbols are proven only for TARGETED_DEVICE_FAMILY 1, 2, 1,2, 1,2,6 or 1,2,7; this target resolves to "${settings.TARGETED_DEVICE_FAMILY ?? ''}".`,
119
119
  )
120
120
  return {
121
121
  status: 'plan' as const,
@@ -163,6 +163,7 @@ export function generateAssetSymbols(plan: SwiftAssetPlan, root: string, work: s
163
163
  join(work, 'GeneratedAssetSymbols-Index.plist'),
164
164
  ]
165
165
  const run = (extra: string[]) =>
166
+ // runner-toolchain-platform: darwin
166
167
  execFileSync('xcrun', extra, {
167
168
  encoding: 'utf8',
168
169
  stdio: ['ignore', 'pipe', 'pipe'],
package/src/swift-host.ts CHANGED
@@ -218,6 +218,7 @@ export interface SwiftProject {
218
218
  signal?: AbortSignal
219
219
  libraries?: Record<string, string>
220
220
  nativeTargets?: SwiftNativeTarget[]
221
+ nativeFiles?: Record<string, string>
221
222
  resourceBundles?: SwiftResourceBundle[]
222
223
  bundleFiles?: SwiftBundlePack
223
224
  }
@@ -503,13 +504,13 @@ const XCODE_PACKAGES_DIR = SWIFT_REMOTE_PACKAGES_DIR
503
504
 
504
505
  // the compile input key of a root-relative path in an xcode layout.
505
506
  function xcodeInputKey(
506
- layout: Pick<XcodeLayout, 'app' | 'targetDirs'>,
507
+ layout: Pick<XcodeLayout, 'checkouts' | 'targetDirs'>,
507
508
  file: string,
508
509
  relative: string,
509
510
  ): string {
510
511
  const owner = layout.targetDirs.get(file)
511
512
  if (owner) return path.posix.join(owner, relative)
512
- const checkouts = remoteSwiftCheckouts(layout.app.rootDir)
513
+ const checkouts = layout.checkouts
513
514
  return file.startsWith(`${checkouts}${path.sep}`)
514
515
  ? path.posix.join(
515
516
  XCODE_PACKAGES_DIR,
@@ -520,6 +521,7 @@ function xcodeInputKey(
520
521
 
521
522
  interface XcodeLayout {
522
523
  app: XcodeAppTarget
524
+ checkouts: string
523
525
  /** framework and package targets, with root-relative paths and the nested target directories they exclude. */
524
526
  targets: (SwiftPackageTarget & { exclude: string[] })[]
525
527
  packages: SwiftPackages
@@ -550,6 +552,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
550
552
  { prepareGeneratedSources: true, installedPods: true },
551
553
  )
552
554
  const appSources = app.allSources
555
+ const checkouts = remoteSwiftCheckouts(app.rootDir)
553
556
  const files = new Set([
554
557
  ...app.projectFiles,
555
558
  ...app.packageResolved,
@@ -777,7 +780,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
777
780
  }
778
781
  const relative = (file: string) =>
779
782
  xcodeInputKey(
780
- { app, targetDirs },
783
+ { checkouts, targetDirs },
781
784
  file,
782
785
  path.relative(app.rootDir, file).split(path.sep).join('/') || '.',
783
786
  )
@@ -795,6 +798,8 @@ function xcodeLayout(root: string): XcodeLayout | null {
795
798
  }
796
799
  const nativeFlags = (flags: string[], directory = app.rootDir) =>
797
800
  flags.map((flag, index) => {
801
+ if (flag.startsWith('-fmodule-map-file='))
802
+ return `-fmodule-map-file=${nativePath(flag.slice('-fmodule-map-file='.length), directory)}`
798
803
  if (
799
804
  [
800
805
  '-I',
@@ -826,6 +831,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
826
831
  deploymentTarget: target.iosDeploymentTarget,
827
832
  headers: [...new Set([...settings.headers, ...nativeHeaders])].map(relative),
828
833
  publicHeaders: settings.publicHeaders.map(relative),
834
+ flattensPublicHeaders: true,
829
835
  bridgingHeader: settings.bridgingHeader
830
836
  ? relative(settings.bridgingHeader)
831
837
  : null,
@@ -895,6 +901,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
895
901
  /\.(h|hh|hpp|hxx)$/.test(file),
896
902
  )
897
903
  .map(relative),
904
+ flattensPublicHeaders: false,
898
905
  bridgingHeader: null,
899
906
  prefixHeader: null,
900
907
  headerSearchPaths: settings.includes.map(relative),
@@ -912,6 +919,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
912
919
  }
913
920
  return {
914
921
  app,
922
+ checkouts,
915
923
  targets,
916
924
  packages,
917
925
  packagePaths,
@@ -1527,6 +1535,7 @@ export function sourceStamp(
1527
1535
  const libraries = projects.get(packagePath)?.libraries
1528
1536
  if (libraries) hash.update(JSON.stringify(libraries))
1529
1537
  hash.update(JSON.stringify(projects.get(packagePath)?.nativeTargets ?? []))
1538
+ hash.update(JSON.stringify(projects.get(packagePath)?.nativeFiles ?? {}))
1530
1539
  hash.update(JSON.stringify(projects.get(packagePath)?.resourceBundles ?? []))
1531
1540
  hash.update(JSON.stringify(projects.get(packagePath)?.bundleFiles ?? null))
1532
1541
  const projectInputs = new Set(packageFiles(packagePath))
@@ -1550,6 +1559,7 @@ export function sourceContentStamp(
1550
1559
  const libraries = projects.get(packagePath)?.libraries
1551
1560
  if (libraries) hash.update(JSON.stringify(libraries))
1552
1561
  hash.update(JSON.stringify(projects.get(packagePath)?.nativeTargets ?? []))
1562
+ hash.update(JSON.stringify(projects.get(packagePath)?.nativeFiles ?? {}))
1553
1563
  hash.update(JSON.stringify(projects.get(packagePath)?.resourceBundles ?? []))
1554
1564
  hash.update(JSON.stringify(projects.get(packagePath)?.bundleFiles ?? null))
1555
1565
  for (const file of [...new Set(packageFiles(packagePath))].sort()) {
@@ -1695,6 +1705,7 @@ function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnap
1695
1705
  Boolean(project.hosted),
1696
1706
  new Set([...linked.values()].flat()),
1697
1707
  )
1708
+ Object.assign(files, project.nativeFiles)
1698
1709
  const native = nativeSourceDescriptor(project.packagePath)
1699
1710
  const packageFiles: SwiftPackageFiles = {}
1700
1711
  for (const [file, relative] of layout?.packageFiles ?? [])