peachsim 0.1.1716 → 0.1.1728

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 (234) hide show
  1. package/README.md +21 -3
  2. package/cli/app-bundle-resources.ts +2 -1
  3. package/cli/app-fonts.ts +4 -4
  4. package/cli/app-splash.ts +4 -4
  5. package/cli/app-stubs.ts +17 -0
  6. package/cli/command-registry.ts +1 -0
  7. package/cli/commands/control.ts +82 -822
  8. package/cli/commands/daemon.ts +8 -0
  9. package/cli/commands/detox.ts +3 -0
  10. package/cli/commands/doctor.ts +19 -2
  11. package/cli/commands/inspect/actions.ts +74 -14
  12. package/cli/commands/inspect/core.ts +5 -1
  13. package/cli/commands/inspect/settling.ts +5 -2
  14. package/cli/commands/inspect/wait-ready.ts +6 -0
  15. package/cli/commands/inspect.ts +48 -45
  16. package/cli/commands/kotlin.ts +12 -2
  17. package/cli/commands/package.ts +750 -0
  18. package/cli/commands/serve.ts +6 -0
  19. package/cli/commands/shell-url.ts +834 -0
  20. package/cli/commands/swift.ts +42 -102
  21. package/cli/commands/test.ts +20 -0
  22. package/cli/commands/upload.ts +1 -1
  23. package/cli/device-option.ts +1 -1
  24. package/cli/main.ts +13 -1
  25. package/cli/native-input.ts +199 -0
  26. package/cli/outbound-endpoints.ts +26 -1
  27. package/cli/packaged-app-launcher.ts +95 -0
  28. package/cli/scene-video.ts +13 -6
  29. package/detox/index.ts +187 -23
  30. package/dist-lib/agent-daemon-client.cjs +1 -1
  31. package/dist-lib/agent-events.cjs +1 -1
  32. package/dist-lib/attached-projects.cjs +1 -1
  33. package/dist-lib/auth/shared-session.cjs +1 -1
  34. package/dist-lib/backend-origin.cjs +1 -1
  35. package/dist-lib/beta.cjs +1 -1
  36. package/dist-lib/beta.mjs +1 -1
  37. package/dist-lib/bridge-constants.cjs +1 -1
  38. package/dist-lib/bridge-contract-input.cjs +1 -1
  39. package/dist-lib/bridge-contract-input.mjs +1 -1
  40. package/dist-lib/bridge-contract.cjs +1 -1
  41. package/dist-lib/bridge-contract.mjs +1 -1
  42. package/dist-lib/bundle-channel.cjs +38000 -31658
  43. package/dist-lib/capture-contract.cjs +1 -1
  44. package/dist-lib/capture-contract.mjs +1 -1
  45. package/dist-lib/cloud-contract.cjs +1 -1
  46. package/dist-lib/cloud-contract.mjs +1 -1
  47. package/dist-lib/cloud-test-args.cjs +1 -1
  48. package/dist-lib/cloud-test-args.mjs +1 -1
  49. package/dist-lib/cloud.cjs +1 -1
  50. package/dist-lib/cloud.mjs +1 -1
  51. package/dist-lib/config.cjs +1 -1
  52. package/dist-lib/config.mjs +1 -1
  53. package/dist-lib/detox/index.cjs +184 -60
  54. package/dist-lib/dev-bundle-resolution.cjs +14 -13
  55. package/dist-lib/expo-swift-bundle.cjs +18199 -11834
  56. package/dist-lib/expo-swift-metadata.cjs +4 -1
  57. package/dist-lib/expo-swift-metadata.mjs +3 -1
  58. package/dist-lib/home-paths.cjs +21 -2
  59. package/dist-lib/host/bridge-host.cjs +26509 -23850
  60. package/dist-lib/host/fetch-proxy-handler.cjs +221 -222
  61. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  62. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  63. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  64. package/dist-lib/host/websocket-proxy.cjs +1 -1
  65. package/dist-lib/index.cjs +876 -389
  66. package/dist-lib/jump-to-source-babel.cjs +1 -1
  67. package/dist-lib/jump-to-source-native.cjs +1 -1
  68. package/dist-lib/kotlin-host.cjs +127 -16
  69. package/dist-lib/menu.cjs +7 -1
  70. package/dist-lib/menu.mjs +7 -1
  71. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  72. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  73. package/dist-lib/metro-production-bundle.cjs +1 -1
  74. package/dist-lib/metro-production-bundle.mjs +1 -1
  75. package/dist-lib/metro.cjs +883 -404
  76. package/dist-lib/native-app-identity-project.cjs +694 -280
  77. package/dist-lib/native-app-identity-project.mjs +490 -83
  78. package/dist-lib/native-app-identity.cjs +13 -2
  79. package/dist-lib/native-app-identity.mjs +13 -2
  80. package/dist-lib/native-firebase-metadata.cjs +1 -1
  81. package/dist-lib/native-firebase-metadata.mjs +1 -1
  82. package/dist-lib/plist.cjs +1 -1
  83. package/dist-lib/plist.mjs +1 -1
  84. package/dist-lib/profiles.cjs +1 -1
  85. package/dist-lib/public-brand.cjs +1 -1
  86. package/dist-lib/public-origins-lib-esm.json +28 -23
  87. package/dist-lib/public-origins-lib.json +392 -224
  88. package/dist-lib/react-native-host-modules.cjs +32 -2
  89. package/dist-lib/react-native-host-modules.mjs +32 -2
  90. package/dist-lib/reap-browser.cjs +12 -4
  91. package/dist-lib/scripts/dev-server-scanner.cjs +15 -8
  92. package/dist-lib/sdk.cjs +17 -7
  93. package/dist-lib/sdk.mjs +16 -7
  94. package/dist-lib/skills.cjs +61838 -47851
  95. package/dist-lib/swift-compile.cjs +583 -360
  96. package/dist-lib/swift-compile.mjs +496 -275
  97. package/dist-lib/swift-package.cjs +1 -1
  98. package/dist-lib/swift-package.mjs +1 -1
  99. package/dist-lib/swift-submit.cjs +2 -2
  100. package/dist-lib/swift-submit.mjs +2 -2
  101. package/dist-lib/swift-toolchain.cjs +105 -17
  102. package/dist-lib/swift.cjs +1 -1
  103. package/dist-lib/vite-swift.cjs +4453 -2231
  104. package/dist-lib/vite.cjs +230 -228
  105. package/dist-lib/worklet-executable.cjs +1 -1
  106. package/dist-lib/worklet-executable.mjs +1 -1
  107. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +17 -8
  108. package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +1 -0
  109. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +7 -5
  110. package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +3 -1
  111. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -11
  112. package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -0
  113. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +9 -0
  114. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
  115. package/dist-types/packages/peach-engine/src/render-worker/native-ui-commandContract.d.ts +1 -1
  116. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +4 -0
  117. package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
  118. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +23 -1
  119. package/dist-types/packages/peach-engine/src/shell-events.d.ts +1 -0
  120. package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +5 -0
  121. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  122. package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +11 -0
  123. package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +1 -0
  124. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +9 -2
  125. package/package.json +1 -1
  126. package/runtime-companion.json +1 -1
  127. package/scripts/dev-server-scanner.ts +12 -25
  128. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASFoundation.h +52 -0
  129. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +128 -0
  130. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSessionCallback.h +35 -0
  131. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/AuthenticationServices.h +3 -0
  132. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Modules/module.modulemap +5 -0
  133. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFHTTPMessage.h +724 -0
  134. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +4 -0
  135. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkDefs.h +27 -0
  136. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Modules/module.modulemap +5 -0
  137. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h +1301 -0
  138. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -0
  139. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +21 -50
  140. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +6 -6
  141. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +75 -9
  142. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +12 -0
  143. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInterface.h +23 -0
  144. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +7 -9
  145. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIOrientation.h +14 -0
  146. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIStringDrawing.h +12 -0
  147. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +14 -0
  148. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewAnimating.h +12 -0
  149. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h +16 -0
  150. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIWindow.h +2 -0
  151. package/sdk/ios/usr/include/ConditionalMacros.h +619 -0
  152. package/sdk/ios/usr/include/module.modulemap +1 -0
  153. package/sdk/ios/usr/include/objc/objc-sync.h +59 -0
  154. package/sdk/ios/usr/include/os.modulemap +5 -0
  155. package/sdk/ios/usr/include/sys/cdefs.h +5 -0
  156. package/sdk/ios/usr/include/sys/ioccom.h +99 -0
  157. package/sdk/ios/usr/include/sys/syslog.h +236 -0
  158. package/sdk/ios/usr/include/syslog.h +24 -0
  159. package/sdk/ios/wasm/include/fcntl.h +4 -2
  160. package/sdk/ios/wasm/include/stdio.h +24 -0
  161. package/sdk/ios/wasm/include/stdlib.h +32 -7
  162. package/sdk/ios/wasm/include/sys/file.h +7 -0
  163. package/sdk/ios/wasm/include/sys/ioctl.h +6 -0
  164. package/sdk/ios/wasm/include/sys/syscall.h +9 -0
  165. package/sdk/ios/wasm/include/sys/time.h +10 -0
  166. package/sdk/ios/wasm/include/unistd.h +12 -3
  167. package/sdk/native-hashes.json +1 -0
  168. package/skills/contrast/SKILL.md +2 -1
  169. package/skills/peach-test/SKILL.md +7 -3
  170. package/src/admitted-mac-build.ts +3 -0
  171. package/src/android-app-identity.ts +18 -0
  172. package/src/android-root-module.ts +9 -9
  173. package/src/appPackageContract.ts +81 -0
  174. package/src/bridge-contract.ts +50 -0
  175. package/src/bundle-channel.mjs +21 -4
  176. package/src/dev-bundle-resolution.ts +7 -27
  177. package/src/dom-source-reference.ts +15 -0
  178. package/src/expo-discovery-cache.ts +127 -23
  179. package/src/expo-manifest-body.ts +33 -0
  180. package/src/expo-native-workspace.ts +38 -13
  181. package/src/expo-swift-host.ts +264 -62
  182. package/src/expoSwiftContract.ts +3 -0
  183. package/src/generated/swift-c-predefines.json +1 -1
  184. package/src/home-paths.ts +35 -1
  185. package/src/host/app-package-handler.ts +47 -0
  186. package/src/host/bridge-host.ts +3 -0
  187. package/src/host/staged-host-files.ts +18 -0
  188. package/src/index.ts +3 -0
  189. package/src/kotlin-host.ts +21 -18
  190. package/src/kotlin-instance-source.ts +126 -0
  191. package/src/menu.ts +7 -0
  192. package/src/native-app-identity-project.ts +7 -2
  193. package/src/native-app-identity.ts +11 -0
  194. package/src/native-firebase-config.ts +24 -1
  195. package/src/nitro-adapter.lock.json +268 -268
  196. package/src/nitro-bundle.ts +8 -0
  197. package/src/nitro-compile.ts +35 -9
  198. package/src/nitro-dependencies.ts +21 -19
  199. package/src/nitro-source.ts +4 -0
  200. package/src/nitroContract.ts +7 -0
  201. package/src/react-native-bridge-modules.ts +68 -42
  202. package/src/react-native-host-modules.ts +31 -1
  203. package/src/reactNativeConfigurationContract.ts +14 -0
  204. package/src/reap-browser.ts +15 -3
  205. package/src/sdk.ts +5 -0
  206. package/src/settingsContract.ts +27 -1
  207. package/src/sim-client.ts +4 -1
  208. package/src/storageSnapshotContract.ts +3 -0
  209. package/src/swift-compile.ts +221 -41
  210. package/src/swift-coverage/provenance.ts +1 -0
  211. package/src/swift-coverage/xcode-asset-symbols.ts +922 -0
  212. package/src/swift-coverage/xcode-assets.ts +89 -131
  213. package/src/swift-coverage/xcode.ts +1 -1
  214. package/src/swift-cxx-reachable.ts +2 -1
  215. package/src/swift-distribution.lock.json +14 -13
  216. package/src/swift-host.ts +95 -22
  217. package/src/swift-icu.ts +1 -1
  218. package/src/swift-link-roots.ts +118 -0
  219. package/src/swift-objc-compile.ts +144 -22
  220. package/src/swift-objc-import.ts +6 -0
  221. package/src/swift-objc-standin.ts +2 -14
  222. package/src/swift-package-manifest.ts +14 -6
  223. package/src/swift-packages.ts +75 -11
  224. package/src/swift-pdf-raster.ts +1 -0
  225. package/src/swift-root-lock.ts +17 -1
  226. package/src/swift-source-pods.ts +2 -10
  227. package/src/swift-standin-emit.ts +592 -57
  228. package/src/swift-standins.ts +430 -49
  229. package/src/swift-submit.ts +3 -1
  230. package/src/swift-toolchain.ts +140 -17
  231. package/src/turbo-codegen-intake.ts +91 -0
  232. package/src/vite-plugin-one.ts +13 -9
  233. package/src/vite-plugin.ts +28 -15
  234. package/src/xcode-project.ts +223 -22
@@ -18,6 +18,7 @@ import { isRecord } from './is-record'
18
18
  import { outputLockStdio } from './output-lock-stdio'
19
19
  import { parsePlistSource } from './plist'
20
20
  import {
21
+ FOUNDATION_IMPLICIT_MODULES,
21
22
  swiftDistributionAt,
22
23
  swiftImportNames,
23
24
  swiftMacroPlugins,
@@ -27,23 +28,29 @@ import {
27
28
  swiftSdkPaths,
28
29
  } from './swift-compile'
29
30
  import { emitCxxStandin } from './swift-cxx-standin'
31
+ import { IOS_SDK_TARGET } from './swift-objc-sdk'
30
32
  import {
31
33
  IOS_SDK_ID,
32
34
  NATIVE_GRAPH_ID,
33
35
  pinnedNativeSdkReady,
34
36
  WASI_EMULATION,
35
37
  WASI_EMULATION_FLAGS,
36
- materializeObjcSdk,
37
38
  nativeInterfaceView,
38
39
  moduleMapHeaders,
39
40
  objcView,
40
41
  type ObjcSurface,
41
42
  } from './swift-objc-standin'
42
- import { moduleMapName, swiftTargetModuleName } from './swift-package'
43
+ import {
44
+ moduleMapName,
45
+ swiftManifestDeclarations,
46
+ swiftTargetModuleName,
47
+ } from './swift-package'
43
48
  import { STANDIN_SOURCE_DIGEST, standinSourceDigest } from './swift-standin-digest'
44
49
  import {
45
50
  STANDIN_IMPORTS,
46
51
  emitSwiftStandin,
52
+ isSwiftDeclaration,
53
+ objcProtocolsInSwiftSignatures,
47
54
  type SymbolGraph,
48
55
  type SwiftStandinBehaviors,
49
56
  type StandinBehavior,
@@ -325,16 +332,21 @@ const files = (dir: string, test: (name: string) => boolean): string[] =>
325
332
  : []
326
333
 
327
334
  /** the module surfaces an iOS simulator slice describes. */
328
- type Surface =
335
+ type SliceSurface =
329
336
  | { kind: 'swift'; module: string; interface: string }
330
337
  | (ObjcSurface & { kind: 'mixed'; interface: string })
331
338
  | { kind: 'c'; module: string; modulemap: string; headers: string }
332
339
  | (ObjcSurface & { kind: 'objc' })
333
340
 
341
+ type Surface =
342
+ | SliceSurface
343
+ // a placeholder package's swift target, from its own sources
344
+ | { kind: 'source'; module: string; sources: string[]; flags: string[] }
345
+
334
346
  const OBJC = /^\s*(?:@interface|@protocol|@class|@import|#import)\b/m
335
347
 
336
348
  // a module map's surface: objective-c when any header it reaches is.
337
- function headerSurface(module: string, modulemap: string, headers: string): Surface {
349
+ function headerSurface(module: string, modulemap: string, headers: string): SliceSurface {
338
350
  const objc = files(headers, (name) => name.endsWith('.h')).some((file) =>
339
351
  OBJC.test(fs.readFileSync(path.join(headers, file), 'utf8')),
340
352
  )
@@ -354,7 +366,7 @@ function simulatorSlice(xcframeworkDir: string): string | null {
354
366
  function surfaces(
355
367
  xcframeworkDir: string,
356
368
  slice = simulatorSlice(xcframeworkDir),
357
- ): Surface[] {
369
+ ): SliceSurface[] {
358
370
  const standaloneMap = path.join(xcframeworkDir, 'module.modulemap')
359
371
  if (fs.existsSync(standaloneMap)) {
360
372
  const module = moduleMapName(fs.readFileSync(standaloneMap, 'utf8'))
@@ -364,7 +376,7 @@ function surfaces(
364
376
  const plain = !slice && xcframeworkDir.endsWith('.framework')
365
377
  if (!slice && !plain) throw new Error('it has no iOS simulator slice')
366
378
  const root = plain ? path.dirname(xcframeworkDir) : slice!
367
- const found: Surface[] = []
379
+ const found: SliceSurface[] = []
368
380
  for (const entry of plain
369
381
  ? [path.basename(xcframeworkDir)]
370
382
  : fs.readdirSync(root).sort()) {
@@ -421,6 +433,7 @@ export function standinsNeedNativeSdk(binaries: readonly SwiftPackageBinary[]):
421
433
  return binaries.some(
422
434
  (binary) =>
423
435
  binary.publicHeaders === undefined &&
436
+ binary.placeholder === undefined &&
424
437
  surfaces(xcframework(binary).dir).some((surface) => surface.kind === 'mixed'),
425
438
  )
426
439
  }
@@ -478,11 +491,24 @@ function peachModuleDirs(toolchain: Toolchain, imports: string[]): string[] {
478
491
  ],
479
492
  moduleRoot,
480
493
  )
481
- // a c target's module map sits in its own build directory, where swiftpm
482
- // generated it; a peach module re-exporting one fails to load without it
494
+ // a c target's module map is the one swiftpm reads: a system library's in
495
+ // its directory, a c target's own in its include directory, else the one
496
+ // swiftpm generated in its build directory. a peach module re-exporting one
497
+ // fails to load without it
483
498
  const release = path.join(moduleRoot, '.build', TRIPLE, 'release')
484
499
  return [
485
500
  path.join(release, 'Modules'),
501
+ ...swiftManifestDeclarations(
502
+ fs.readFileSync(path.join(moduleRoot, 'Package.swift'), 'utf8'),
503
+ )
504
+ .map((target) =>
505
+ path.join(
506
+ moduleRoot,
507
+ target.path,
508
+ target.kind === 'systemLibrary' ? '' : 'include',
509
+ ),
510
+ )
511
+ .filter((dir) => fs.existsSync(path.join(dir, 'module.modulemap'))),
486
512
  ...fs
487
513
  .readdirSync(release)
488
514
  .filter(
@@ -600,6 +626,98 @@ function swiftStandin(
600
626
  work,
601
627
  behavior,
602
628
  [...new Set(imports)].filter((module) => siblings.has(module)),
629
+ true,
630
+ )
631
+ }
632
+
633
+ // a placeholder package's swift target from its own sources. the gap that
634
+ // forces the placeholder is a compile error in them, so the frontend reads
635
+ // only the public interface, skipping bodies and internals, and emits it in
636
+ // spite of errors; a declaration whose type did not resolve is left out.
637
+ function placeholderStandin(
638
+ surface: Extract<Surface, { kind: 'source' }>,
639
+ binary: SwiftPackageBinary,
640
+ toolchain: Toolchain,
641
+ work: string,
642
+ behavior: ReadonlyMap<string, StandinBehavior>,
643
+ siblings: ReadonlySet<string>,
644
+ ): SwiftStandin {
645
+ const texts = surface.sources.map((file) => fs.readFileSync(file, 'utf8'))
646
+ const imports = [...new Set(texts.flatMap((text) => swiftImportNames(text)))]
647
+ // every package target sees the modules darwin's Foundation exports
648
+ const wasm = [
649
+ ...wasmFlags(toolchain, [...FOUNDATION_IMPLICIT_MODULES, ...imports]),
650
+ ...FOUNDATION_IMPLICIT_MODULES.flatMap((module) => [
651
+ '-Xfrontend',
652
+ '-import-module',
653
+ '-Xfrontend',
654
+ module,
655
+ ]),
656
+ ]
657
+ const out = path.join(work, 'graphs')
658
+ fs.mkdirSync(path.join(work, 'interface'), { recursive: true })
659
+ fs.mkdirSync(out, { recursive: true })
660
+ const extracted = spawnSync(
661
+ path.join(toolchain.toolchainBin, 'swiftc'),
662
+ [
663
+ '-emit-module',
664
+ '-parse-as-library',
665
+ '-wmo',
666
+ '-module-name',
667
+ surface.module,
668
+ ...surface.flags,
669
+ ...wasm,
670
+ '-enable-library-evolution',
671
+ '-emit-module-path',
672
+ path.join(work, 'interface', `${surface.module}.swiftmodule`),
673
+ '-Xfrontend',
674
+ '-experimental-lazy-typecheck',
675
+ '-Xfrontend',
676
+ '-experimental-skip-non-exportable-decls',
677
+ '-experimental-skip-non-inlinable-function-bodies',
678
+ '-Xfrontend',
679
+ '-experimental-allow-module-with-compiler-errors',
680
+ '-emit-symbol-graph',
681
+ '-emit-symbol-graph-dir',
682
+ out,
683
+ '-symbol-graph-minimum-access-level',
684
+ 'public',
685
+ '-Xfrontend',
686
+ '-symbol-graph-skip-synthesized-members',
687
+ ...surface.sources,
688
+ ],
689
+ { encoding: 'utf8', env: swiftEnvironment(), maxBuffer: 256 * 1024 * 1024 },
690
+ )
691
+ const graphs = fs
692
+ .readdirSync(out)
693
+ .filter((name) => name.endsWith('.symbols.json'))
694
+ .sort()
695
+ .map((name): SymbolGraph => JSON.parse(fs.readFileSync(path.join(out, name), 'utf8')))
696
+ if (!graphs.some((graph) => graph.module.name === surface.module))
697
+ throw new Error(
698
+ `its public interface did not extract: ${extracted.error?.message ?? extracted.stderr.trim().slice(-2000)}`,
699
+ )
700
+ return graphStandin(
701
+ surface.module,
702
+ graphs,
703
+ new Map(),
704
+ wasm,
705
+ binary,
706
+ toolchain,
707
+ work,
708
+ behavior,
709
+ imports.filter((module) => siblings.has(module)),
710
+ false,
711
+ new Map(),
712
+ {
713
+ peachImports: FOUNDATION_IMPLICIT_MODULES,
714
+ exported: texts.flatMap((text) =>
715
+ text
716
+ .split('\n')
717
+ .filter((line) => /^\s*@_exported\s+import\s/.test(line))
718
+ .map((line) => line.trim()),
719
+ ),
720
+ },
603
721
  )
604
722
  }
605
723
 
@@ -613,26 +731,179 @@ function mixedStandin(
613
731
  siblings: ReadonlySet<string>,
614
732
  ): SwiftStandin {
615
733
  const view = nativeInterfaceView(surface, frameworkDirs, work)
734
+ const interfaceText = fs.readFileSync(surface.interface, 'utf8')
735
+ const values = new Map(view.values)
736
+ // native symbol graphs omit swift enum raw values. the compiler's public
737
+ // interface spells them; accept only simple top-level integer cases.
738
+ for (const graph of view.graphs) {
739
+ const enumCases = new Map<string, { id: string; name: string }[]>()
740
+ for (const member of graph.symbols)
741
+ if (
742
+ member.kind.identifier === 'swift.enum.case' &&
743
+ member.pathComponents.length === 2
744
+ ) {
745
+ const [parent, name] = member.pathComponents
746
+ enumCases.set(parent!, [
747
+ ...(enumCases.get(parent!) ?? []),
748
+ { id: member.identifier.precise, name: name! },
749
+ ])
750
+ }
751
+ for (const symbol of graph.symbols) {
752
+ if (
753
+ symbol.kind.identifier !== 'swift.enum' ||
754
+ !/^c:@C?M@[^@]+@E@/.test(symbol.identifier.precise) ||
755
+ symbol.pathComponents.length !== 1
756
+ )
757
+ continue
758
+ const name = symbol.pathComponents[0]!
759
+ const declaration = new RegExp(
760
+ `^@objc(?:\\([^)]*\\))?\\s+(?:(?:public|open)\\s+)?enum\\s+${name}\\s*:[^{]+\\{\\s*$`,
761
+ 'm',
762
+ ).exec(interfaceText)
763
+ if (!declaration) continue
764
+ const body =
765
+ interfaceText
766
+ .slice(declaration.index + declaration[0].length)
767
+ .split(/^\s*}\s*$/m)[0] ?? ''
768
+ const cases = new Map<string, string>()
769
+ let next = 0n
770
+ let valid = true
771
+ for (const line of body.split('\n')) {
772
+ const match = /^\s*(?:@\w+(?:\([^)]*\))?\s+)*case\s+(.+?)\s*$/.exec(line)
773
+ if (!match) continue
774
+ for (const part of match[1]!.split(',')) {
775
+ const item = /^\s*`?(\w+)`?(?:\s*=\s*(-?\d[\d_]*))?\s*$/.exec(part)
776
+ if (!item) {
777
+ valid = false
778
+ break
779
+ }
780
+ if (item[2] !== undefined) next = BigInt(item[2].replaceAll('_', ''))
781
+ cases.set(item[1]!, next.toString())
782
+ next++
783
+ }
784
+ if (!valid) break
785
+ }
786
+ if (!valid) continue
787
+ for (const member of enumCases.get(name) ?? []) {
788
+ const value = cases.get(member.name)
789
+ if (value !== undefined) values.set(member.id, value)
790
+ }
791
+ }
792
+ }
616
793
  const provided = new Set(swiftPeachModules(toolchain.moduleRoot))
617
- const imports = [
618
- ...new Set(swiftImportNames(fs.readFileSync(surface.interface, 'utf8'))),
619
- ].filter(
794
+ const imports = [...new Set(swiftImportNames(interfaceText))].filter(
620
795
  (module) =>
621
796
  module !== surface.module && (provided.has(module) || siblings.has(module)),
622
797
  )
623
798
  return graphStandin(
624
799
  surface.module,
625
800
  view.graphs,
626
- view.values,
801
+ values,
627
802
  wasmFlags(toolchain, imports),
628
803
  binary,
629
804
  toolchain,
630
805
  work,
631
806
  behavior,
632
807
  imports,
808
+ true,
809
+ surface.kind === 'mixed'
810
+ ? nativeProtocolProperties(surface, view.graphs, frameworkDirs, work)
811
+ : new Map(),
633
812
  )
634
813
  }
635
814
 
815
+ // symbol graphs omit custom property accessors. clang reads those selectors
816
+ // from the same native headers before a referenced objc protocol is emitted.
817
+ function nativeProtocolProperties(
818
+ surface: Extract<Surface, { kind: 'mixed' }>,
819
+ graphs: SymbolGraph[],
820
+ frameworkDirs: readonly string[],
821
+ work: string,
822
+ ): Map<string, { getter: string; setter?: string }> {
823
+ const properties = new Map<string, { getter: string; setter?: string }>()
824
+ const protocols = objcProtocolsInSwiftSignatures(graphs)
825
+ if (protocols.size === 0) return properties
826
+ const headers = files(surface.headers, (name) => name.endsWith('.h')).map((name) => ({
827
+ file: path.join(surface.headers, name),
828
+ text: fs.readFileSync(path.join(surface.headers, name), 'utf8'),
829
+ }))
830
+ // runner-toolchain-platform: darwin
831
+ const sdk = exec('xcrun', ['--sdk', 'iphonesimulator', '--show-sdk-path']).trim()
832
+ // runner-toolchain-platform: darwin
833
+ const clang = exec('xcrun', ['--find', 'clang']).trim()
834
+ for (const id of protocols) {
835
+ const name = /^c:objc\(pl\)(\w+)$/.exec(id)?.[1]
836
+ if (!name) throw new Error(`unknown Objective-C protocol identity ${id}`)
837
+ const pattern = new RegExp(`@protocol\\s+${name}\\b(?!\\s*;)`)
838
+ const candidates = headers.filter((header) => pattern.test(header.text))
839
+ if (candidates.length === 0)
840
+ throw new Error(`native headers have no definition of Objective-C protocol ${name}`)
841
+ const probe = path.join(work, 'objc-protocol-properties.m')
842
+ fs.writeFileSync(
843
+ probe,
844
+ candidates.map(({ file }) => `#import ${JSON.stringify(file)}\n`).join(''),
845
+ )
846
+ const output = exec(clang, [
847
+ '-x',
848
+ 'objective-c',
849
+ '-fobjc-arc',
850
+ '-fblocks',
851
+ '-fmodules',
852
+ `-fmodule-name=${surface.module}`,
853
+ '-fsyntax-only',
854
+ '-target',
855
+ IOS_SDK_TARGET,
856
+ '-isysroot',
857
+ sdk,
858
+ ...frameworkDirs.flatMap((dir) => ['-F', dir]),
859
+ '-I',
860
+ surface.headers,
861
+ '-Xclang',
862
+ '-ast-dump-all=json',
863
+ '-Xclang',
864
+ '-ast-dump-filter',
865
+ '-Xclang',
866
+ name,
867
+ probe,
868
+ ])
869
+ let found = false
870
+ for (const chunk of output.split(/\n(?=\{\n)/).filter((part) => part.trim())) {
871
+ const declaration: unknown = JSON.parse(chunk)
872
+ if (
873
+ !isRecord(declaration) ||
874
+ declaration.kind !== 'ObjCProtocolDecl' ||
875
+ declaration.name !== name ||
876
+ !Array.isArray(declaration.inner)
877
+ )
878
+ continue
879
+ found = true
880
+ for (const child of declaration.inner) {
881
+ if (
882
+ !isRecord(child) ||
883
+ child.kind !== 'ObjCPropertyDecl' ||
884
+ typeof child.name !== 'string'
885
+ )
886
+ continue
887
+ const getter =
888
+ isRecord(child.getter) && typeof child.getter.name === 'string'
889
+ ? child.getter.name
890
+ : child.name
891
+ const setter =
892
+ isRecord(child.setter) && typeof child.setter.name === 'string'
893
+ ? child.setter.name
894
+ : `set${child.name[0]?.toUpperCase() ?? ''}${child.name.slice(1)}:`
895
+ properties.set(`${id}(py)${child.name}`, {
896
+ getter,
897
+ ...(child.readonly === true ? {} : { setter }),
898
+ })
899
+ }
900
+ }
901
+ if (!found)
902
+ throw new Error(`clang found no definition of Objective-C protocol ${name}`)
903
+ }
904
+ return properties
905
+ }
906
+
636
907
  // the wasm target, sdk and peach module search paths a stand-in compiles with.
637
908
  function wasmFlags(toolchain: Toolchain, imports: string[]): string[] {
638
909
  const { sysroot, resources, cFlags } = swiftSdkPaths(
@@ -654,20 +925,15 @@ function wasmFlags(toolchain: Toolchain, imports: string[]): string[] {
654
925
  // symbolgraph caller translates it.
655
926
  '-Xfrontend',
656
927
  '-enable-objc-interop',
928
+ // the intake's darwin/usr/include declares `os` with its explicit
929
+ // submodules (os.log), so a vendor interface naming one resolves as the
930
+ // ios sdk resolves it; a second `os` map on the path is a redefinition.
657
931
  ...cFlags.flatMap((flag) => ['-Xcc', flag]),
658
- '-I',
659
- clangImportDir(),
660
932
  ...peachModuleDirs(toolchain, imports).flatMap((dir) => ['-I', dir]),
661
933
  ...(toolchain.standinModules ? ['-I', toolchain.standinModules] : []),
662
934
  ]
663
935
  }
664
936
 
665
- // the staged headerless import dir (swift-objc-standin.ts), carrying only
666
- // the sdk's os module map.
667
- function clangImportDir(): string {
668
- return path.join(materializeObjcSdk(cacheDir), 'clang-import')
669
- }
670
-
671
937
  // the objective-c module's swift view, emitted as an interface's graphs are.
672
938
  function objcStandin(
673
939
  surface: Extract<Surface, { kind: 'objc' }>,
@@ -698,6 +964,9 @@ function objcStandin(
698
964
  )
699
965
  }
700
966
 
967
+ const INERT_VALUE =
968
+ /missing argument|cannot be constructed|has no member 'init'|no exact matches in call to initializer|cannot convert return expression|does not conform to '|extra argument|takes no arguments|could not be inferred|cannot infer/
969
+
701
970
  // emit, typecheck for wasm against peach's modules, and leave out each
702
971
  // declaration the compiler rejects, its error the reason, until the source
703
972
  // is clean; a round that removes nothing fails the stand-in
@@ -711,12 +980,46 @@ function graphStandin(
711
980
  work: string,
712
981
  behavior: ReadonlyMap<string, StandinBehavior>,
713
982
  imports: string[] = [],
983
+ requireSwift = false,
984
+ objcProperties: ReadonlyMap<string, { getter: string; setter?: string }> = new Map(),
985
+ // peach modules the source names beside its sibling dependencies, and a
986
+ // placeholder's own re-exports
987
+ placeholder: { peachImports: string[]; exported: string[] } | null = null,
714
988
  ): SwiftStandin {
715
989
  const paths = new Set(
716
990
  graphs.flatMap((graph) =>
717
991
  graph.symbols.map((symbol) => symbol.pathComponents.join('.')),
718
992
  ),
719
993
  )
994
+ const swiftPaths = new Set(
995
+ requireSwift
996
+ ? graphs.flatMap((graph) =>
997
+ graph.symbols
998
+ .filter(isSwiftDeclaration)
999
+ .map((symbol) => symbol.pathComponents.join('.')),
1000
+ )
1001
+ : [],
1002
+ )
1003
+ if (requireSwift) {
1004
+ const protocols = objcProtocolsInSwiftSignatures(graphs)
1005
+ const names = new Map<string, string>()
1006
+ for (const graph of graphs)
1007
+ for (const symbol of graph.symbols)
1008
+ names.set(symbol.identifier.precise, symbol.pathComponents.join('.'))
1009
+ for (const graph of graphs)
1010
+ for (const edge of graph.relationships)
1011
+ if (
1012
+ protocols.has(edge.target) &&
1013
+ (edge.kind === 'requirementOf' || edge.kind === 'optionalRequirementOf')
1014
+ ) {
1015
+ const member = names.get(edge.source)
1016
+ if (member) swiftPaths.add(member)
1017
+ }
1018
+ for (const protocol of protocols) {
1019
+ const name = names.get(protocol)
1020
+ if (name) swiftPaths.add(name)
1021
+ }
1022
+ }
720
1023
  for (const name of behavior.keys()) {
721
1024
  if (!paths.has(name))
722
1025
  throw new Error(
@@ -725,7 +1028,15 @@ function graphStandin(
725
1028
  }
726
1029
  const omit = new Map<string, string>()
727
1030
  const plain = new Set<string>()
1031
+ const trapped = new Set<string>()
728
1032
  const file = path.join(work, `${module}.swift`)
1033
+ // a source target whose implementation compiles keeps inert bodies, and a
1034
+ // placeholder sends nothing. a target replaced because assembly cannot
1035
+ // lower has no implementation to keep, so its declarations trap by name
1036
+ // like a binary framework's.
1037
+ const inert =
1038
+ binary.placeholder !== undefined ||
1039
+ (binary.publicHeaders !== undefined && binary.assemblySources === undefined)
729
1040
  for (;;) {
730
1041
  const { source, owners, skipped } = emitSwiftStandin(graphs, {
731
1042
  module,
@@ -734,14 +1045,20 @@ function graphStandin(
734
1045
  behavior,
735
1046
  omit,
736
1047
  plain,
737
- // a source target whose implementation compiles keeps inert bodies. a
738
- // target replaced because assembly cannot lower has no implementation to
739
- // keep, so its declarations trap by name like a binary framework's.
740
- inert: binary.publicHeaders !== undefined && binary.assemblySources === undefined,
741
- imports,
742
- family: imports,
1048
+ trapped,
1049
+ inert,
1050
+ imports: [...(placeholder?.peachImports ?? []), ...imports],
1051
+ family: [...imports, ...(placeholder?.peachImports ?? [])],
1052
+ objcProperties,
1053
+ ...(placeholder
1054
+ ? { exported: placeholder.exported, placeholder: binary.placeholder!.gap }
1055
+ : {}),
743
1056
  })
744
1057
  for (const entry of skipped) {
1058
+ if (swiftPaths.has(entry.path))
1059
+ throw new Error(
1060
+ `Swift declaration ${module}.${entry.path} was not emitted: ${entry.reason}`,
1061
+ )
745
1062
  if (behavior.has(entry.path))
746
1063
  throw new Error(
747
1064
  `Configured Swift behavior ${module}.${entry.path} was not emitted: ${entry.reason}`,
@@ -773,20 +1090,27 @@ function graphStandin(
773
1090
  files: { [`${module}.swift`]: source },
774
1091
  ...(imports.length ? { dependencies: imports } : {}),
775
1092
  }
776
- const before = omit.size + plain.size
1093
+ const before = omit.size + plain.size + trapped.size
777
1094
  const elsewhere: string[] = []
778
1095
  for (const match of check.stderr.matchAll(/^(\S+?):(\d+):\d+: error: (.*)$/gm)) {
779
1096
  const owner = match[1] === file ? owners[Number(match[2]) - 1] : undefined
1097
+ if (owner && swiftPaths.has(owner))
1098
+ throw new Error(
1099
+ `Swift declaration ${module}.${owner} does not typecheck: ${match[3]}`,
1100
+ )
780
1101
  if (owner && behavior.has(owner))
781
1102
  throw new Error(
782
1103
  `Configured Swift behavior ${module}.${owner} does not typecheck: ${match[3]}`,
783
1104
  )
784
1105
  if (owner && /does not override any|overrides nothing/.test(match[3]!))
785
1106
  plain.add(owner)
1107
+ // an inert value the declaration's type cannot build: its body traps
1108
+ else if (owner && inert && INERT_VALUE.test(match[3]!) && !trapped.has(owner))
1109
+ trapped.add(owner)
786
1110
  else if (owner) omit.set(owner, `rejected by swiftc: ${match[3]}`)
787
1111
  else elsewhere.push(match[3]!)
788
1112
  }
789
- if (omit.size + plain.size === before)
1113
+ if (omit.size + plain.size + trapped.size === before)
790
1114
  throw new Error(
791
1115
  `its generated source does not typecheck: ${elsewhere.slice(0, 3).join('; ') || check.stderr.trim().slice(0, 400)}`,
792
1116
  )
@@ -1304,6 +1628,7 @@ export function standinLibrary(
1304
1628
  const manifest = crateFor(searchRoot, library.slice('lib'.length, -'.a'.length))
1305
1629
  if (!manifest) return null
1306
1630
  const result = spawnSync(
1631
+ // runner-toolchain-platform: darwin
1307
1632
  'cargo',
1308
1633
  [
1309
1634
  'build',
@@ -1391,7 +1716,14 @@ function sourceStandins(
1391
1716
  const headers = new Map<string, string>()
1392
1717
  for (const [index, binary] of binaries.entries()) {
1393
1718
  try {
1394
- if (binary.publicHeaders !== undefined) {
1719
+ if (binary.placeholder !== undefined) {
1720
+ const dir = path.join(artifact, 'placeholders', String(index))
1721
+ for (const source of binary.placeholder.sources) {
1722
+ fs.mkdirSync(path.dirname(path.join(dir, source)), { recursive: true })
1723
+ fs.copyFileSync(path.join(binary.dir, source), path.join(dir, source))
1724
+ }
1725
+ local.push({ ...binary, dir, url: null, checksum: null })
1726
+ } else if (binary.publicHeaders !== undefined) {
1395
1727
  const copyHeader = (relative: string) => {
1396
1728
  const source = fs.realpathSync(path.join(binary.dir, relative))
1397
1729
  let destination = headers.get(source)
@@ -1590,7 +1922,7 @@ export function standinGenerationInputs(
1590
1922
  const modules = new Set(
1591
1923
  binaries.flatMap((binary) => {
1592
1924
  try {
1593
- return binary.publicHeaders !== undefined
1925
+ return binary.publicHeaders !== undefined || binary.placeholder !== undefined
1594
1926
  ? [swiftTargetModuleName(binary.target)]
1595
1927
  : surfaces(xcframework(binary).dir).map((surface) => surface.module)
1596
1928
  } catch {
@@ -1613,6 +1945,21 @@ export function standinGenerationInputs(
1613
1945
  ),
1614
1946
  )
1615
1947
  for (const binary of binaries) {
1948
+ if (binary.placeholder !== undefined) {
1949
+ parts.push(
1950
+ binary.target,
1951
+ binary.source,
1952
+ `placeholder/${binary.placeholder.gap}`,
1953
+ ...binary.placeholder.flags,
1954
+ ...binary.placeholder.sources.flatMap((source) => [
1955
+ source,
1956
+ createHash('sha256')
1957
+ .update(fs.readFileSync(path.join(binary.dir, source)))
1958
+ .digest('hex'),
1959
+ ]),
1960
+ )
1961
+ continue
1962
+ }
1616
1963
  if (
1617
1964
  binary.publicHeaders !== undefined &&
1618
1965
  swiftTargetModuleName(binary.target) !== binary.target
@@ -1684,7 +2031,19 @@ function binaryStandins(
1684
2031
  let all: Surface[]
1685
2032
  let digest: string
1686
2033
  try {
1687
- if (binary.publicHeaders !== undefined) {
2034
+ if (binary.placeholder !== undefined) {
2035
+ all = [
2036
+ {
2037
+ kind: 'source',
2038
+ module: swiftTargetModuleName(binary.target),
2039
+ sources: binary.placeholder.sources.map((source) =>
2040
+ path.join(binary.dir, source),
2041
+ ),
2042
+ flags: binary.placeholder.flags,
2043
+ },
2044
+ ]
2045
+ digest = binary.placeholder.gap
2046
+ } else if (binary.publicHeaders !== undefined) {
1688
2047
  const headers = path.join(binary.dir, binary.publicHeaders)
1689
2048
  const module = swiftTargetModuleName(binary.target)
1690
2049
  const modulemap = path.join(work, 'module.modulemap')
@@ -1744,13 +2103,15 @@ function binaryStandins(
1744
2103
  hash.update(`${surface.kind}\0${surface.module}\0`)
1745
2104
  for (const file of surface.kind === 'swift'
1746
2105
  ? [surface.interface]
1747
- : [
1748
- ...(surface.kind === 'mixed' ? [surface.interface] : []),
1749
- surface.modulemap,
1750
- ...files(surface.headers, (name) => name.endsWith('.h')).map((file) =>
1751
- path.join(surface.headers, file),
1752
- ),
1753
- ])
2106
+ : surface.kind === 'source'
2107
+ ? surface.sources
2108
+ : [
2109
+ ...(surface.kind === 'mixed' ? [surface.interface] : []),
2110
+ surface.modulemap,
2111
+ ...files(surface.headers, (name) => name.endsWith('.h')).map((file) =>
2112
+ path.join(surface.headers, file),
2113
+ ),
2114
+ ])
1754
2115
  hash.update(fs.readFileSync(file))
1755
2116
  }
1756
2117
  const id = hash.digest('hex').slice(0, 32)
@@ -1775,36 +2136,45 @@ function binaryStandins(
1775
2136
  throw new Error(
1776
2137
  "Configured behavior requires the framework's Swift declarations",
1777
2138
  )
1778
- return surface.kind === 'mixed'
1779
- ? mixedStandin(
2139
+ return surface.kind === 'source'
2140
+ ? placeholderStandin(
1780
2141
  surface,
1781
2142
  binary,
1782
2143
  toolchain,
1783
2144
  dir,
1784
2145
  new Map(Object.entries(configured.get(surface.module) ?? {})),
1785
- frameworks.dirs,
1786
2146
  siblings,
1787
2147
  )
1788
- : surface.kind === 'swift'
1789
- ? swiftStandin(
2148
+ : surface.kind === 'mixed'
2149
+ ? mixedStandin(
1790
2150
  surface,
1791
2151
  binary,
1792
2152
  toolchain,
1793
2153
  dir,
1794
2154
  new Map(Object.entries(configured.get(surface.module) ?? {})),
2155
+ frameworks.dirs,
1795
2156
  siblings,
1796
2157
  )
1797
- : surface.kind === 'objc'
1798
- ? objcStandin(
2158
+ : surface.kind === 'swift'
2159
+ ? swiftStandin(
1799
2160
  surface,
1800
2161
  binary,
1801
2162
  toolchain,
1802
2163
  dir,
1803
2164
  new Map(Object.entries(configured.get(surface.module) ?? {})),
2165
+ siblings,
1804
2166
  )
1805
- : binary.cxxHeaders
1806
- ? cxxStandin(surface, binary, toolchain, dir)
1807
- : cStandin(surface, binary, toolchain, dir)
2167
+ : surface.kind === 'objc'
2168
+ ? objcStandin(
2169
+ surface,
2170
+ binary,
2171
+ toolchain,
2172
+ dir,
2173
+ new Map(Object.entries(configured.get(surface.module) ?? {})),
2174
+ )
2175
+ : binary.cxxHeaders
2176
+ ? cxxStandin(surface, binary, toolchain, dir)
2177
+ : cStandin(surface, binary, toolchain, dir)
1808
2178
  } catch (error) {
1809
2179
  throw new Error(
1810
2180
  `no stand-in for ${surface.module}: ${error instanceof Error && !('stderr' in error) ? error.message : failure(error)}`,
@@ -1882,6 +2252,17 @@ export function swiftStandins(
1882
2252
  // the modules each binary's swift interfaces import
1883
2253
  const interfaceImports = new Map<SwiftPackageBinary, Set<string>>()
1884
2254
  for (const binary of binaries) {
2255
+ if (binary.placeholder !== undefined) {
2256
+ interfaceImports.set(
2257
+ binary,
2258
+ new Set(
2259
+ binary.placeholder.sources.flatMap((source) =>
2260
+ swiftImportNames(fs.readFileSync(path.join(binary.dir, source), 'utf8')),
2261
+ ),
2262
+ ),
2263
+ )
2264
+ continue
2265
+ }
1885
2266
  if (binary.publicHeaders !== undefined) continue
1886
2267
  try {
1887
2268
  const artifact = xcframework(binary)
@@ -1977,7 +2358,7 @@ export function swiftStandins(
1977
2358
  '5',
1978
2359
  '-module-name',
1979
2360
  standin.module,
1980
- ...wasmFlags(generatedToolchain, standin.dependencies ?? []),
2361
+ ...wasmFlags(generatedToolchain, swiftImportNames(source)),
1981
2362
  '-emit-module-path',
1982
2363
  path.join(modules, `${standin.module}.swiftmodule`),
1983
2364
  file,