peachsim 0.1.1815 → 0.1.1818

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 (147) hide show
  1. package/cli/commands/agent-indicator-mode.ts +2 -1
  2. package/cli/commands/coverage-swift.ts +4 -3
  3. package/cli/commands/flow.ts +7 -0
  4. package/cli/commands/inspect/core.ts +1 -1
  5. package/cli/commands/maestro-compare.ts +7 -0
  6. package/cli/commands/package.ts +87 -31
  7. package/cli/commands/screenshot-mode.ts +2 -1
  8. package/cli/commands/shell-boolean-mode.ts +7 -3
  9. package/cli/commands/shell-url.ts +4 -0
  10. package/cli/commands/show-touches-mode.ts +2 -1
  11. package/cli/commands/test.ts +3 -2
  12. package/cli/commands/three-mode.ts +2 -1
  13. package/cli/outbound-endpoints.ts +1 -1
  14. package/cli/packaged-app-launcher.ts +6 -1
  15. package/dist-lib/agent-daemon-client.cjs +1 -1
  16. package/dist-lib/agent-events.cjs +1 -1
  17. package/dist-lib/attached-projects.cjs +1 -1
  18. package/dist-lib/auth/shared-session.cjs +1 -1
  19. package/dist-lib/backend-origin.cjs +1 -1
  20. package/dist-lib/beta.cjs +1 -1
  21. package/dist-lib/beta.mjs +1 -1
  22. package/dist-lib/bridge-constants.cjs +1 -1
  23. package/dist-lib/bridge-contract-input.cjs +1 -1
  24. package/dist-lib/bridge-contract-input.mjs +1 -1
  25. package/dist-lib/bridge-contract.cjs +1 -1
  26. package/dist-lib/bridge-contract.mjs +1 -1
  27. package/dist-lib/bundle-channel.cjs +5728 -7551
  28. package/dist-lib/capture-contract.cjs +1 -1
  29. package/dist-lib/capture-contract.mjs +1 -1
  30. package/dist-lib/cloud-contract.cjs +1 -1
  31. package/dist-lib/cloud-contract.mjs +1 -1
  32. package/dist-lib/cloud-test-args.cjs +1 -1
  33. package/dist-lib/cloud-test-args.mjs +1 -1
  34. package/dist-lib/cloud.cjs +1 -1
  35. package/dist-lib/cloud.mjs +1 -1
  36. package/dist-lib/config.cjs +1 -1
  37. package/dist-lib/config.mjs +1 -1
  38. package/dist-lib/detox/index.cjs +13 -4
  39. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  40. package/dist-lib/expo-swift-bundle.cjs +5234 -5704
  41. package/dist-lib/expo-swift-metadata.cjs +1 -1
  42. package/dist-lib/expo-swift-metadata.mjs +1 -1
  43. package/dist-lib/home-paths.cjs +1 -1
  44. package/dist-lib/host/bridge-host.cjs +4913 -6811
  45. package/dist-lib/host/fetch-proxy-handler.cjs +13 -4
  46. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  47. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  48. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  49. package/dist-lib/host/websocket-proxy.cjs +1 -1
  50. package/dist-lib/index.cjs +40 -30
  51. package/dist-lib/jump-to-source-babel.cjs +1 -1
  52. package/dist-lib/jump-to-source-native.cjs +1 -1
  53. package/dist-lib/kotlin-host.cjs +1 -1
  54. package/dist-lib/menu.cjs +1 -1
  55. package/dist-lib/menu.mjs +1 -1
  56. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  57. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  58. package/dist-lib/metro-production-bundle.cjs +1 -1
  59. package/dist-lib/metro-production-bundle.mjs +1 -1
  60. package/dist-lib/metro.cjs +39 -29
  61. package/dist-lib/native-app-identity-project.cjs +31 -26
  62. package/dist-lib/native-app-identity-project.mjs +295 -279
  63. package/dist-lib/native-app-identity.cjs +1 -1
  64. package/dist-lib/native-app-identity.mjs +1 -1
  65. package/dist-lib/native-firebase-metadata.cjs +1 -1
  66. package/dist-lib/native-firebase-metadata.mjs +1 -1
  67. package/dist-lib/pdfium-raster.cjs +1 -1
  68. package/dist-lib/pdfium-raster.mjs +1 -1
  69. package/dist-lib/plist.cjs +1 -1
  70. package/dist-lib/plist.mjs +1 -1
  71. package/dist-lib/profiles.cjs +1 -1
  72. package/dist-lib/public-brand.cjs +1 -1
  73. package/dist-lib/public-origins-lib-esm.json +29 -24
  74. package/dist-lib/public-origins-lib.json +121 -93
  75. package/dist-lib/react-native-host-modules.cjs +1 -1
  76. package/dist-lib/react-native-host-modules.mjs +1 -1
  77. package/dist-lib/reap-browser.cjs +1 -1
  78. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  79. package/dist-lib/sdk.cjs +2 -2
  80. package/dist-lib/sdk.mjs +2 -2
  81. package/dist-lib/skills.cjs +64622 -66476
  82. package/dist-lib/swift-compile.cjs +328 -265
  83. package/dist-lib/swift-compile.mjs +335 -270
  84. package/dist-lib/swift-package.cjs +1 -1
  85. package/dist-lib/swift-package.mjs +1 -1
  86. package/dist-lib/swift-submit.cjs +1 -1
  87. package/dist-lib/swift-submit.mjs +1 -1
  88. package/dist-lib/swift-toolchain.cjs +52 -6
  89. package/dist-lib/swift.cjs +1 -1
  90. package/dist-lib/vite-swift.cjs +2405 -2262
  91. package/dist-lib/vite.cjs +13 -4
  92. package/dist-lib/worklet-executable.cjs +1 -1
  93. package/dist-lib/worklet-executable.mjs +1 -1
  94. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +5 -0
  95. package/dist-types/packages/peach-engine/src/render-worker/map-command-channel.d.ts +41 -0
  96. package/dist-types/packages/peach-engine/src/render-worker/mapServicesContract.d.ts +45 -0
  97. package/package.json +2 -1
  98. package/runtime-companion.json +1 -1
  99. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes +1 -1
  100. package/sdk/ios/usr/include/module.modulemap +3 -0
  101. package/sdk/ios/usr/include/notify.modulemap +9 -0
  102. package/sdk/ios/usr/lib/swift/Darwin.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
  103. package/sdk/ios/usr/lib/swift/Dispatch.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -1
  104. package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +7 -1
  105. package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -0
  106. package/sdk/ios/usr/lib/swift/SwiftUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +21 -0
  107. package/sdk/ios/usr/lib/swift/SwiftUICore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -1
  108. package/sdk/ios/wasm/include/__header_time.h +4 -0
  109. package/sdk/ios/wasm/include/pthread.h +2 -0
  110. package/sdk/ios/wasm/include/sys/mman.h +1 -1
  111. package/sdk/ios/wasm/include/sys/resource.h +31 -0
  112. package/sdk/ios/wasm/include/unistd.h +4 -0
  113. package/src/answeredNativePackages.ts +43 -0
  114. package/src/cli-runtime.ts +2 -9
  115. package/src/expo-discovery-cache.ts +71 -52
  116. package/src/expo-kotlin-host.ts +11 -9
  117. package/src/expo-swift-host.ts +55 -13
  118. package/src/installed-native-libraries.ts +103 -20
  119. package/src/native-static-libraries.ts +69 -33
  120. package/src/nitro-adapter.ts +0 -9
  121. package/src/nitro-bundle.ts +8 -6
  122. package/src/nitro-compile.ts +45 -16
  123. package/src/nitro-compiler-digest.ts +2 -4
  124. package/src/nitro-superset.lock.json +19 -251
  125. package/src/nitro-superset.ts +63 -68
  126. package/src/plist-bytes.ts +9 -0
  127. package/src/portable-expo-workspace.ts +4 -3
  128. package/src/react-native-bridge-modules.ts +13 -19
  129. package/src/swift-compile.ts +379 -269
  130. package/src/swift-cxx-reachable.ts +13 -0
  131. package/src/swift-distribution.ts +3 -4
  132. package/src/swift-host.ts +5 -3
  133. package/src/swift-installed-targets.ts +32 -14
  134. package/src/swift-native-pin.ts +45 -0
  135. package/src/swift-objc-compile.ts +23 -1
  136. package/src/swift-objc-standin.ts +14 -7
  137. package/src/swift-package-manifest.ts +2 -2
  138. package/src/swift-root-lock.ts +4 -3
  139. package/src/swift-standins.ts +41 -38
  140. package/src/swift-toolchain.ts +69 -12
  141. package/src/swift-wasm-prune.ts +1 -0
  142. package/src/swift-xcframework.ts +23 -12
  143. package/src/swiftContract.ts +2 -0
  144. package/src/swiftNativePinContract.ts +68 -0
  145. package/src/turbo-bundle.ts +14 -6
  146. package/src/turbo-compile.ts +76 -11
  147. package/src/turbo-source.ts +93 -18
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1818 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -2674,6 +2674,7 @@ var SWIFT_HOST_COMPILER_ID = "81b2c791c27276bf";
2674
2674
  var compilerArchives = {
2675
2675
  "swift-6.4.0-RELEASE-custom-0b2d0a9011c88e66": {
2676
2676
  identity: "0b2d0a9011c88e66",
2677
+ archive: "tar.gz",
2677
2678
  hosts: {
2678
2679
  "darwin-arm64": {
2679
2680
  checksum: "dc6a494227297ea657e8e5f7c5b4a861cb5e142bdbcfcb028ace2aeb19db90cc",
@@ -2691,6 +2692,7 @@ var compilerArchives = {
2691
2692
  },
2692
2693
  "swift-6.4.0-RELEASE-custom-f7c03c3f59ec5d83": {
2693
2694
  identity: "f7c03c3f59ec5d83",
2695
+ archive: "tar.gz",
2694
2696
  hosts: {
2695
2697
  "darwin-arm64": {
2696
2698
  checksum: "8946a2d4716d3b0784cef7a85a35f66537bd319c4c5a48c63457d607260df5c5",
@@ -2708,6 +2710,7 @@ var compilerArchives = {
2708
2710
  },
2709
2711
  "swift-6.4.0-RELEASE-custom-3e3dca8fd1d82975": {
2710
2712
  identity: "3e3dca8fd1d82975",
2713
+ archive: "tar.gz",
2711
2714
  hosts: {
2712
2715
  "darwin-arm64": {
2713
2716
  checksum: "dfad56454f5e1e465071ff708bf485be65b438cf55d02b04d26d17d26df9f54a",
@@ -2725,6 +2728,7 @@ var compilerArchives = {
2725
2728
  },
2726
2729
  "swift-6.4.0-RELEASE-custom-b082ac5437336790": {
2727
2730
  identity: "b082ac5437336790",
2731
+ archive: "tar.gz",
2728
2732
  hosts: {
2729
2733
  "darwin-arm64": {
2730
2734
  checksum: "85e601982321d3a6f81f05928bc9bbe7a61bc75b27ce24508e79f6b5b537254d",
@@ -2742,6 +2746,7 @@ var compilerArchives = {
2742
2746
  },
2743
2747
  "swift-6.4.0-RELEASE-custom-9cdaffdb6b37fb47": {
2744
2748
  identity: "9cdaffdb6b37fb47",
2749
+ archive: "tar.gz",
2745
2750
  hosts: {
2746
2751
  "darwin-arm64": {
2747
2752
  checksum: "fdd3f88cf76a8dc2083275d4253255030068a25b5ba68acbf59e0407c45677dd",
@@ -2759,6 +2764,7 @@ var compilerArchives = {
2759
2764
  },
2760
2765
  "swift-6.4.0-RELEASE-custom-bd49e2f77434e7b1": {
2761
2766
  identity: "bd49e2f77434e7b1",
2767
+ archive: "tar.gz",
2762
2768
  hosts: {
2763
2769
  "darwin-arm64": {
2764
2770
  checksum: "e815b06394566e8125475afc8f1807f7f465318c845549c5831043cdc28eca64",
@@ -2776,6 +2782,7 @@ var compilerArchives = {
2776
2782
  },
2777
2783
  "swift-6.4.0-RELEASE-custom-13450179a7e01c81": {
2778
2784
  identity: "13450179a7e01c81",
2785
+ archive: "tar.gz",
2779
2786
  hosts: {
2780
2787
  "darwin-arm64": {
2781
2788
  checksum: "a29be6b722f15c7aafac26ba5703a7392f49ce7ea5e1c56548846b7e458290f7",
@@ -2793,6 +2800,7 @@ var compilerArchives = {
2793
2800
  },
2794
2801
  "swift-6.4.0-RELEASE-custom-f6868fa6054e83d6": {
2795
2802
  identity: "f6868fa6054e83d6",
2803
+ archive: "tar.gz",
2796
2804
  hosts: {
2797
2805
  "darwin-arm64": {
2798
2806
  checksum: "bd80c2f35864ec29883dd22001d0165821e80d78002fc12f92406c3c708694a4",
@@ -2810,23 +2818,25 @@ var compilerArchives = {
2810
2818
  },
2811
2819
  "swift-6.4.0-RELEASE-custom-a560ff35bf882b5c": {
2812
2820
  identity: "a560ff35bf882b5c",
2821
+ archive: "tar.zst",
2813
2822
  hosts: {
2814
2823
  "darwin-arm64": {
2815
- checksum: "ec20a41851ac558fe663d78def6b93d0d47c5a0cb69688ee270fd85de637a522",
2824
+ checksum: "36c50bcdfba88a4c0989af0bd60371497eb4403aa7b80644b479fa509a2187a9",
2816
2825
  manifest: "253e891527d2213f54eace768b902de89de5e9495a3c5f4018de1985516bd553"
2817
2826
  },
2818
2827
  "linux-x64": {
2819
- checksum: "f0126a2e63d275895036d02d75a901070da0343dbf03bf17342e10cb6f893dee",
2828
+ checksum: "ba25da9182314fc7b7dd2fc041280e1c7b409f80a1fbccdfa5c342669d164c8e",
2820
2829
  manifest: "6f951cc4071dd0d6054d85711a7c5fe272273658847831b477a8b24be7254ca0"
2821
2830
  },
2822
2831
  "linux-arm64": {
2823
- checksum: "315fa766559a6e69bfd10dcddf40e04c91155f0db3047d210d74ac87652fb7e6",
2832
+ checksum: "5f0f4456e9fe22b5486025db9f679c865841660797d71761245291c2c6811c20",
2824
2833
  manifest: "b6f62fca2ec37593e274ee5bac474f21ffc5db14cd82f492ccbc774f8e9b75d8"
2825
2834
  }
2826
2835
  }
2827
2836
  },
2828
2837
  [SWIFT_HOST_COMPILER_RELEASE]: {
2829
2838
  identity: SWIFT_HOST_COMPILER_ID,
2839
+ archive: "tar.gz",
2830
2840
  hosts: {
2831
2841
  "darwin-arm64": {
2832
2842
  checksum: "bc51b83d9e2e01c9873875326544734486d3ff3a868d650379c304045e8838d3",
@@ -2859,15 +2869,20 @@ function privateSwiftRelease() {
2859
2869
  throw new Error(`${root} holds no Swift distribution release`);
2860
2870
  return release;
2861
2871
  }
2862
- function swiftHostCompilerArchive(release, host2 = `${process.platform}-${process.arch}`) {
2872
+ function swiftHostCompilerPin(release) {
2863
2873
  const compiler = compilerArchives[release];
2864
2874
  if (!compiler) throw new Error(`unqualified host compiler ${release}`);
2875
+ return compiler;
2876
+ }
2877
+ function swiftHostCompilerArchive(release, host2 = `${process.platform}-${process.arch}`) {
2878
+ const compiler = swiftHostCompilerPin(release);
2865
2879
  const archive = compiler.hosts[host2];
2866
2880
  if (!archive) throw new Error(`unsupported Swift compiler host ${host2}`);
2867
2881
  return {
2868
2882
  ...archive,
2869
2883
  identity: compiler.identity,
2870
- url: `https://r2.sootsim.com/swift-host-compiler/${compiler.identity}/${release}-${host2}.tar.gz`
2884
+ archive: compiler.archive,
2885
+ url: `https://r2.sootsim.com/swift-host-compiler/${compiler.identity}/${archive.checksum}.${compiler.archive}`
2871
2886
  };
2872
2887
  }
2873
2888
  function swiftUpstreamRelease(release) {
@@ -3796,26 +3811,6 @@ var NATIVE_GRAPH_INPUTS = {
3796
3811
  target: IOS_SDK_TARGET
3797
3812
  };
3798
3813
  var NATIVE_GRAPH_ID = (0, import_node_crypto3.createHash)("sha256").update(JSON.stringify(NATIVE_GRAPH_INPUTS)).digest("hex");
3799
- function stripExternalSourceMarks(text2) {
3800
- return text2.split("\n").map(
3801
- (line) => line.startsWith("#define PEACH_SWIFT_CLASS(") ? line : line.replace(/PEACH_SWIFT_CLASS\(\w+\)\s*/g, "")
3802
- ).join("\n");
3803
- }
3804
- function iosSdkEntries() {
3805
- const overlays = Object.entries(IOS_SDK_OVERLAYS).map(
3806
- ([module2, text2]) => [
3807
- `usr/lib/swift/${module2}.swiftmodule/arm64-apple-ios-simulator.swiftinterface`,
3808
- `// swift-interface-format-version: 1.0
3809
- // swift-module-flags: -target ${IOS_SDK_TARGET} -enable-objc-interop -enable-library-evolution -module-name ${module2}
3810
- ${text2}`
3811
- ]
3812
- );
3813
- const headers = Object.entries(IOS_SDK_HEADERS).map(
3814
- ([file, text2]) => [file, stripExternalSourceMarks(text2)]
3815
- );
3816
- return [...headers, ...overlays].sort(([a], [b]) => a < b ? -1 : 1);
3817
- }
3818
- var IOS_SDK_ID = (0, import_node_crypto3.createHash)("sha256").update(JSON.stringify(iosSdkEntries())).digest("hex").slice(0, 16);
3819
3814
  function objcSdkIntakeFlags(headers, toolchainBin, minimum) {
3820
3815
  return [
3821
3816
  ...swiftObjCPlatformFlags(toolchainBin, minimum),
@@ -3843,6 +3838,9 @@ function objcSdkIntakeFlags(headers, toolchainBin, minimum) {
3843
3838
  import_node_path7.default.join(headers, "System/Library/Frameworks"),
3844
3839
  "-isystem",
3845
3840
  import_node_path7.default.join(headers, "wasm/include"),
3841
+ // compiler intrinsics an arm64 unit includes, ahead of clang's arm-only ones.
3842
+ "-isystem",
3843
+ import_node_path7.default.join(headers, "wasm/intrinsics"),
3846
3844
  // libxml2 headers sit one level deeper, as in the iOS sdk: a unit
3847
3845
  // includes <libxml/parser.h> through usr/include/libxml2, never the parent.
3848
3846
  "-I",
@@ -5207,12 +5205,12 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
5207
5205
  const children = [];
5208
5206
  const lease = {
5209
5207
  register(child) {
5210
- children.push(child);
5208
+ const index = children.push(child);
5211
5209
  if (child.pid === void 0) throw new Error("could not register compiler process");
5212
- const childPending = `${pending}.child.${child.pid}`;
5210
+ const childPending = `${pending}.child.${index}`;
5213
5211
  try {
5214
5212
  (0, import_node_fs13.writeFileSync)(childPending, JSON.stringify(ownIdentity(child.pid)));
5215
- (0, import_node_fs13.linkSync)(childPending, import_node_path14.default.join(directory, name(held, `child.${child.pid}`)));
5213
+ (0, import_node_fs13.linkSync)(childPending, import_node_path14.default.join(directory, name(held, `child.${index}`)));
5216
5214
  } finally {
5217
5215
  (0, import_node_fs13.rmSync)(childPending, { force: true });
5218
5216
  }
@@ -6788,7 +6786,8 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
6788
6786
  const prunedRspPath = import_node_path16.default.join(directory, ".peach-link.pruned.rsp");
6789
6787
  import_node_fs14.default.writeFileSync(prunedRspPath, outTokens.map((t) => JSON.stringify(t)).join(" "));
6790
6788
  (0, import_node_child_process12.execFileSync)(import_node_path16.default.join(toolchainBin, "wasm-ld"), [`@${prunedRspPath}`], {
6791
- stdio: "pipe"
6789
+ stdio: "pipe",
6790
+ maxBuffer: Infinity
6792
6791
  });
6793
6792
  import_node_fs14.default.rmSync(rspPath, { force: true });
6794
6793
  }
@@ -7312,7 +7311,7 @@ function swiftModuleInputFiles(root) {
7312
7311
  walk("ios-simulator-stdlib");
7313
7312
  return files.sort();
7314
7313
  }
7315
- function swiftMacroPlugins(moduleRoot) {
7314
+ function swiftMacroPlugins(moduleRoot, dir = import_node_path19.default.join(moduleRoot, ".build/host/RnxPreviewMacros")) {
7316
7315
  const distribution = swiftDistributionAt(moduleRoot);
7317
7316
  if (distribution)
7318
7317
  return {
@@ -7320,7 +7319,6 @@ function swiftMacroPlugins(moduleRoot) {
7320
7319
  executables: distribution.plugins.filter((plugin) => import_node_path19.default.basename(plugin) === "ExpoModulesMacros").map((plugin) => import_node_path19.default.join(moduleRoot, plugin)),
7321
7320
  stale: false
7322
7321
  };
7323
- const dir = import_node_path19.default.join(moduleRoot, ".build/host/RnxPreviewMacros");
7324
7322
  const release = JSON.parse(
7325
7323
  (0, import_node_fs17.readFileSync)(import_node_path19.default.join(moduleRoot, "toolchain.json"), "utf8")
7326
7324
  ).release;
@@ -7714,14 +7712,20 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
7714
7712
  for (const match of (0, import_node_fs17.readFileSync)(map, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
7715
7713
  modules.add(match[1]);
7716
7714
  }
7717
- const libc = import_node_path19.default.join(darwin, "usr/include");
7718
- for (const entry of (0, import_node_fs17.readdirSync)(libc)) {
7719
- if (!entry.endsWith(".modulemap")) continue;
7720
- for (const match of (0, import_node_fs17.readFileSync)(import_node_path19.default.join(libc, entry), "utf8").matchAll(
7721
- /^module\s+([A-Za-z_]\w*)/gm
7722
- ))
7723
- modules.add(match[1]);
7724
- }
7715
+ for (const libc of [
7716
+ import_node_path19.default.join(darwin, "usr/include"),
7717
+ import_node_path19.default.join(
7718
+ swiftSharedSdkRoot(moduleRoot, swiftDistributionAt(moduleRoot) !== null),
7719
+ "usr/include"
7720
+ )
7721
+ ])
7722
+ for (const entry of (0, import_node_fs17.readdirSync)(libc)) {
7723
+ if (!entry.endsWith(".modulemap")) continue;
7724
+ for (const match of (0, import_node_fs17.readFileSync)(import_node_path19.default.join(libc, entry), "utf8").matchAll(
7725
+ /^module\s+([A-Za-z_]\w*)/gm
7726
+ ))
7727
+ modules.add(match[1]);
7728
+ }
7725
7729
  for (const directory of frameworks) {
7726
7730
  for (const entry of (0, import_node_fs17.readdirSync)(directory)) {
7727
7731
  const map = import_node_path19.default.join(directory, entry, "Modules/module.modulemap");
@@ -7853,7 +7857,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
7853
7857
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
7854
7858
  var MULTI_MANIFEST_VERSION = 65;
7855
7859
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
7856
- var compilerSourceDigest = true ? "f6bf05da9a8bbde24169c3c8ff29e36d48f13ea9f817f33a350da3c475783ddd" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
7860
+ var compilerSourceDigest = true ? "f079d0f9f3d0467a52729f6950de38e5f71e1ad9017031a3ec3722aad044dac2" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
7857
7861
  function swiftArtifactHash(input, release, moduleRoot) {
7858
7862
  const hash = (0, import_node_crypto8.createHash)("sha256");
7859
7863
  hash.update(`swift-compile
@@ -8050,6 +8054,14 @@ function emitSwiftPackageManifest(args) {
8050
8054
  );
8051
8055
  const macroSettings = (values) => (values ?? []).map((value) => ` ${clangMacroSetting(value)},`).join("");
8052
8056
  const flagArray = (literal) => `peachCompilerArguments(${JSON.stringify(literal.replace(/,\s*]$/, "]"))})`;
8057
+ const swiftFlagArray = (literal) => {
8058
+ const flags = JSON.parse(literal.replace(/,\s*]$/, "]"));
8059
+ const content = flags.map((flag) => JSON.stringify(flag)).join("\n") + "\n";
8060
+ const digest = (0, import_node_crypto8.createHash)("sha256").update(content).digest("hex");
8061
+ const file = import_node_path19.default.join(args.root, ".peach-swift-arguments", `${digest}.rsp`);
8062
+ args.files.set(file, content);
8063
+ return JSON.stringify([`@${file}`]);
8064
+ };
8053
8065
  const declaredClangSettings = (target, tool) => clangSettingEntries(
8054
8066
  target?.clangSettings?.map(
8055
8067
  (setting) => "flags" in setting ? {
@@ -8112,7 +8124,7 @@ function emitSwiftPackageManifest(args) {
8112
8124
  (value) => value.late?.producers.includes(target.name)
8113
8125
  )) ? `, "-emit-objc-header-path", ${JSON.stringify(import_node_path19.default.join(args.headerDirectory, `${target.name}-Swift${args.nativeHeaderDeclarations?.[target.name] ? ".original" : ""}.h`))}` : "";
8114
8126
  const clangMode = target.cxxInterop ? "" : ', "-Xcc", "-fno-cxx-modules"';
8115
- const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming} .unsafeFlags(${flagArray(`["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImportFlags}${objcFlags}${header}${clangMode}${upstream}]`)})]`;
8127
+ const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming} .unsafeFlags(${swiftFlagArray(`["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImportFlags}${objcFlags}${header}${clangMode}${upstream}]`)})]`;
8116
8128
  const deps = [
8117
8129
  .../* @__PURE__ */ new Set([
8118
8130
  ...(target.dependencies ?? []).flatMap(
@@ -9814,7 +9826,13 @@ function namesLibxml2(input) {
9814
9826
  }
9815
9827
  return false;
9816
9828
  }
9829
+ function needsNativeToolset(input, prebuilt) {
9830
+ return Boolean(
9831
+ input.packageFiles || prebuilt || Object.keys(input.files).some(isSwiftNativeTranslationUnit)
9832
+ );
9833
+ }
9817
9834
  function writeSwiftProject(layout, input, moduleRoot, prebuilt) {
9835
+ const nativeToolset = needsNativeToolset(input, prebuilt);
9818
9836
  if (input.headerAliases !== void 0 && !isSwiftHeaderAliases(input.headerAliases))
9819
9837
  throw new Error("swift compile input has invalid original header aliases");
9820
9838
  if (input.nativeTargets !== void 0 && !isSwiftNativeTargets(input.nativeTargets))
@@ -10160,7 +10178,11 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
10160
10178
  importModuleMaps,
10161
10179
  generatedModuleMaps
10162
10180
  );
10163
- const flags = [...stageFlags(originalFlags, sdkInclude), ...dependencyModuleMaps];
10181
+ const flags = [
10182
+ ...stageFlags(originalFlags, sdkInclude),
10183
+ ...dependencyModuleMaps,
10184
+ ...target.defines?.includes(SWIFT_XCODE_BUILD_CONDITION) && !target.defines.includes("SWIFT_PACKAGE") ? ["-USWIFT_PACKAGE"] : []
10185
+ ];
10164
10186
  const prefixHeader = settings?.prefixHeader ? ["-include", import_node_path19.default.join(layout.root, settings.prefixHeader)] : [];
10165
10187
  const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
10166
10188
  target: target.name,
@@ -10316,7 +10338,8 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
10316
10338
  ).digest("hex").slice(0, 12);
10317
10339
  const name2 = `${target.name}${nativeC ? "Native" : "Swift"}Implementation_${identity}`;
10318
10340
  const groupPath = import_node_path19.default.posix.join("PeachNativeSources", name2);
10319
- const sourceIdentity = `-ffile-prefix-map=${import_node_path19.default.join(layout.root, groupPath)}=${import_node_path19.default.join(layout.root, target.path)}`;
10341
+ const identityRoot = nativeToolset ? "/peach/build" : layout.root;
10342
+ const sourceIdentity = `-ffile-prefix-map=${import_node_path19.default.join(identityRoot, groupPath)}=${import_node_path19.default.join(identityRoot, target.path)}`;
10320
10343
  const group = groups.get(identity) ?? {
10321
10344
  name: name2,
10322
10345
  path: groupPath,
@@ -10841,6 +10864,7 @@ module ${moduleName}.Swift {
10841
10864
  import_node_path19.default.join(layout.root, "Package.swift"),
10842
10865
  emitSwiftPackageManifest({
10843
10866
  root: layout.root,
10867
+ files,
10844
10868
  targets: manifestTargets,
10845
10869
  packages,
10846
10870
  native,
@@ -10895,7 +10919,7 @@ module ${moduleName}.Swift {
10895
10919
  if (files.has(destination)) continue;
10896
10920
  files.set(destination, Buffer.from(bytes, "base64"));
10897
10921
  }
10898
- if (input.packageFiles || prebuilt) {
10922
+ if (nativeToolset) {
10899
10923
  files.set(
10900
10924
  import_node_path19.default.join(layout.root, ".peach-target-toolset.json"),
10901
10925
  JSON.stringify({
@@ -10986,6 +11010,10 @@ module ${moduleName}.Swift {
10986
11010
  for (const producer of producers)
10987
11011
  for (const dependency of dependencies.get(producer) ?? []) include(dependency);
10988
11012
  return {
11013
+ nativeBuildTargets: [...native].flatMap(([name2, plan]) => [
11014
+ ...!plan.mixed && plan.sources.length > 0 ? [name2] : [],
11015
+ ...plan.groups?.map((group) => group.name) ?? (plan.late ? [plan.late.name] : [])
11016
+ ]),
10989
11017
  headerProducers: [
10990
11018
  .../* @__PURE__ */ new Set([
10991
11019
  ...Object.keys(nativeHeaderDeclarations),
@@ -11008,7 +11036,7 @@ function outputOf(error) {
11008
11036
  streamText(Reflect.get(error, "stdout")),
11009
11037
  streamText(Reflect.get(error, "stderr"))
11010
11038
  ].filter(Boolean);
11011
- if (error instanceof Error) streams.push(error.message);
11039
+ if (error instanceof Error) streams.unshift(error.message);
11012
11040
  if (streams.length > 0) return streams.join("\n");
11013
11041
  }
11014
11042
  return error instanceof Error ? error.message : String(error);
@@ -11557,7 +11585,17 @@ function retireStaleSwiftLink(root, stamp) {
11557
11585
  (0, import_node_fs17.rmSync)(retired, { recursive: true, force: true });
11558
11586
  return true;
11559
11587
  }
11560
- function compileSwiftProjectUnit(input, options) {
11588
+ async function compileSwiftProjectUnit(input, options) {
11589
+ for (let attempt = 1; ; attempt++) {
11590
+ try {
11591
+ return await compileSwiftProjectOnce(input, options);
11592
+ } catch (error) {
11593
+ if (attempt >= 3 || !outputOf(error).includes("differs from the caller"))
11594
+ throw error;
11595
+ }
11596
+ }
11597
+ }
11598
+ function compileSwiftProjectOnce(input, options) {
11561
11599
  options.signal?.throwIfAborted();
11562
11600
  (0, import_node_fs17.mkdirSync)(options.buildRoot, { recursive: true });
11563
11601
  const root = (0, import_node_fs17.realpathSync)(options.buildRoot);
@@ -11668,245 +11706,270 @@ function compileSwiftProjectUnit(input, options) {
11668
11706
  `swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
11669
11707
  );
11670
11708
  }
11671
- return withSwiftRootLock(
11672
- swiftFrameworkScratch(frameworkKey),
11673
- async (frameworkLease) => {
11674
- const frameworkRoot = stageFrameworkSource(moduleRoot, frameworkKey);
11675
- report("preparing compiler plugins");
11676
- const macroPlugins = await ensureMacroPlugins(
11677
- frameworkRoot,
11678
- options.toolchainBin,
11679
- options.release,
11680
- options.signal,
11681
- frameworkLease
11709
+ const frameworkScratch = swiftFrameworkScratch(frameworkKey);
11710
+ const withFrameworkLock = (work) => distribution ? work() : withSwiftRootLock(frameworkScratch, work, options.signal);
11711
+ return withFrameworkLock(async (frameworkLease) => {
11712
+ const frameworkRoot = stageFrameworkSource(moduleRoot, frameworkKey);
11713
+ report("preparing compiler plugins");
11714
+ const pluginsFor = (pluginLease) => ensureMacroPlugins(
11715
+ frameworkRoot,
11716
+ options.toolchainBin,
11717
+ options.release,
11718
+ options.signal,
11719
+ pluginLease
11720
+ );
11721
+ const macroPlugins = distribution ? await withSwiftRootLock(frameworkScratch, pluginsFor, options.signal) : await pluginsFor(frameworkLease);
11722
+ const sdk = swiftModuleSdk(frameworkRoot).wasmSdkId;
11723
+ const icu = swiftIcuAsset(options.toolchainBin, sdk);
11724
+ const buildOptions = {
11725
+ env: {
11726
+ ...options.project?.env ?? process.env,
11727
+ // shipped host plugins resolve against the selected compiler's runtime.
11728
+ ...process.platform === "linux" ? {
11729
+ LD_LIBRARY_PATH: [
11730
+ import_node_path19.default.resolve(options.toolchainBin, "../lib/swift/linux"),
11731
+ import_node_path19.default.resolve(options.toolchainBin, "../lib/swift/host"),
11732
+ process.env.LD_LIBRARY_PATH
11733
+ ].filter(Boolean).join(":")
11734
+ } : {},
11735
+ ...input.lazyDistribution ? { PEACH_DEFER_WASM_LINK: "1" } : {}
11736
+ },
11737
+ maxBuffer: 64 * 1024 * 1024,
11738
+ timeout: options.timeoutMs,
11739
+ signal: options.signal,
11740
+ lease,
11741
+ frameworkLease
11742
+ };
11743
+ let prebuilt;
11744
+ if (!distribution) {
11745
+ report("compiling framework products");
11746
+ prebuilt = await compileFrameworkProducts({
11747
+ moduleRoot: frameworkRoot,
11748
+ frameworkKey,
11749
+ input,
11750
+ swift,
11751
+ sdk,
11752
+ toolchainBin: options.toolchainBin,
11753
+ plugins: macroPlugins,
11754
+ buildOptions
11755
+ });
11756
+ await pruneFrameworkScratches(frameworkKey);
11757
+ }
11758
+ if (options.project) removeProjectLinks(root);
11759
+ if (retireStaleSwiftLink(
11760
+ root,
11761
+ swiftLinkStamp({
11762
+ frameworkKey,
11763
+ prebuilt
11764
+ })
11765
+ ))
11766
+ report("framework revision changed; rebuilding the app link");
11767
+ const nativeToolset = needsNativeToolset(input, prebuilt);
11768
+ const preparation = writeSwiftProject(layout, input, frameworkRoot, prebuilt);
11769
+ writeSwiftAutolinkLinker(root, options.toolchainBin);
11770
+ const projectProcess = options.project ? prepareSwiftProjectProcess(root, options.project) : void 0;
11771
+ const appOptions = projectProcess ? {
11772
+ ...buildOptions,
11773
+ uid: projectProcess.uid,
11774
+ gid: projectProcess.gid,
11775
+ confined: projectProcess.env
11776
+ } : buildOptions;
11777
+ const unprepared = preparation.targetFailures.map(
11778
+ (failure) => `error: target ${failure}`
11779
+ );
11780
+ const forwarders = /* @__PURE__ */ new Map();
11781
+ for (const [file, text2] of Object.entries(input.files)) {
11782
+ const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text2)?.[1];
11783
+ if (!parents) continue;
11784
+ const directory = import_node_path19.default.posix.dirname(file);
11785
+ forwarders.set(
11786
+ `${import_node_path19.default.join(root, directory)}/${parents.slice(0, -1)}`,
11787
+ import_node_path19.default.posix.join("build", directory, parents).replace(/\/$/, "")
11682
11788
  );
11683
- const sdk = swiftModuleSdk(frameworkRoot).wasmSdkId;
11684
- const icu = swiftIcuAsset(options.toolchainBin, sdk);
11685
- const buildOptions = {
11686
- env: {
11687
- ...options.project?.env ?? process.env,
11688
- // shipped host plugins resolve against the selected compiler's runtime.
11689
- ...process.platform === "linux" ? {
11690
- LD_LIBRARY_PATH: [
11691
- import_node_path19.default.resolve(options.toolchainBin, "../lib/swift/linux"),
11692
- import_node_path19.default.resolve(options.toolchainBin, "../lib/swift/host"),
11693
- process.env.LD_LIBRARY_PATH
11694
- ].filter(Boolean).join(":")
11695
- } : {},
11696
- ...input.lazyDistribution ? { PEACH_DEFER_WASM_LINK: "1" } : {}
11697
- },
11698
- maxBuffer: 64 * 1024 * 1024,
11699
- timeout: options.timeoutMs,
11700
- signal: options.signal,
11701
- lease,
11702
- frameworkLease
11703
- };
11704
- let prebuilt;
11705
- if (!swiftDistributionAt(moduleRoot)) {
11706
- report("compiling framework products");
11707
- prebuilt = await compileFrameworkProducts({
11708
- moduleRoot: frameworkRoot,
11709
- frameworkKey,
11710
- input,
11789
+ }
11790
+ const buildArgs = [
11791
+ "build",
11792
+ ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
11793
+ "--build-system",
11794
+ "native",
11795
+ "-j",
11796
+ BUILD_JOBS,
11797
+ "--package-path",
11798
+ root,
11799
+ ...swiftCompileSdkOptions(frameworkRoot, options.toolchainBin),
11800
+ "--swift-sdk",
11801
+ sdk,
11802
+ ...nativeToolset ? ["--toolset", import_node_path19.default.join(root, ".peach-target-toolset.json")] : [],
11803
+ "-c",
11804
+ "release",
11805
+ "-Xswiftc",
11806
+ "-num-threads",
11807
+ "-Xswiftc",
11808
+ BUILD_JOBS,
11809
+ ...swiftReproducibleBuildFlags([
11810
+ [import_node_path19.default.dirname(options.toolchainBin), "toolchain"],
11811
+ [frameworkRoot, "framework"],
11812
+ [root, "build"],
11813
+ ...forwarders
11814
+ ]).flatMap((flag, index, flags) => {
11815
+ if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
11816
+ return [flag];
11817
+ const mapped = flag.replaceAll(root, "/peach/build").replaceAll(frameworkRoot, "/peach/framework").replaceAll(import_node_path19.default.dirname(options.toolchainBin), "/peach/toolchain");
11818
+ return flags[index - 1] === "-Xcc" ? [mapped, "-Xswiftc", "-Xcc", "-Xswiftc", flag] : [mapped];
11819
+ }),
11820
+ ...macroPlugins.libraries.flatMap((plugin) => [
11821
+ "-Xswiftc",
11822
+ "-load-plugin-library",
11823
+ "-Xswiftc",
11824
+ plugin
11825
+ ]),
11826
+ ...macroPlugins.executables.flatMap((plugin) => [
11827
+ "-Xswiftc",
11828
+ "-load-plugin-executable",
11829
+ "-Xswiftc",
11830
+ `${plugin}#ExpoModulesMacros`
11831
+ ])
11832
+ ];
11833
+ const linked = builtArtifact(layout);
11834
+ if (input.lazyDistribution) {
11835
+ (0, import_node_fs17.rmSync)(import_node_path19.default.join(root, ".peach-link.rsp"), { force: true });
11836
+ if ((0, import_node_fs17.existsSync)(linked) && (0, import_node_fs17.statSync)(linked).size <= 8)
11837
+ (0, import_node_fs17.rmSync)(linked, { force: true });
11838
+ }
11839
+ report("compiling and linking Swift modules");
11840
+ try {
11841
+ const headerBuilds = preparation.headerProductTarget ? [
11842
+ ...Object.keys(preparation.nativeHeaderDeclarations),
11843
+ preparation.headerProductTarget
11844
+ ] : preparation.headerProducers;
11845
+ for (const build of headerBuilds) {
11846
+ await runCompiler(
11711
11847
  swift,
11712
- sdk,
11713
- toolchainBin: options.toolchainBin,
11714
- plugins: macroPlugins,
11715
- buildOptions
11716
- });
11717
- await pruneFrameworkScratches(frameworkKey);
11848
+ [...buildArgs, "--target", build],
11849
+ appOptions,
11850
+ SWIFTPM_PROGRESS,
11851
+ SWIFTPM_NOISE
11852
+ );
11853
+ for (const producer of build === preparation.headerProductTarget ? preparation.headerProducers : [build]) {
11854
+ const emitted = import_node_path19.default.join(
11855
+ root,
11856
+ ".build",
11857
+ "peach-cxx-headers",
11858
+ `${producer}-Swift.h`
11859
+ );
11860
+ const original = preparation.nativeHeaderDeclarations[producer] ? emitted.replace(/-Swift\.h$/, "-Swift.original.h") : emitted;
11861
+ if ((0, import_node_fs17.existsSync)(original))
11862
+ writeBuildFile(
11863
+ emitted,
11864
+ withoutSwiftDeclarations(
11865
+ clangInterfaceHeader((0, import_node_fs17.readFileSync)(original, "utf8")),
11866
+ new Set(preparation.nativeHeaderDeclarations[producer]),
11867
+ `#import <${producer}/${producer}.h>`
11868
+ )
11869
+ );
11870
+ }
11718
11871
  }
11719
- if (options.project) removeProjectLinks(root);
11720
- if (retireStaleSwiftLink(
11872
+ const checkpoints = import_node_path19.default.join(
11721
11873
  root,
11722
- swiftLinkStamp({
11723
- frameworkKey,
11724
- prebuilt
11725
- })
11726
- ))
11727
- report("framework revision changed; rebuilding the app link");
11728
- const preparation = writeSwiftProject(
11729
- layout,
11730
- input,
11731
- frameworkRoot,
11732
- prebuilt
11874
+ ".build",
11875
+ "peach-native-targets",
11876
+ (0, import_node_crypto8.createHash)("sha256").update((0, import_node_fs17.readFileSync)(import_node_path19.default.join(root, "Package.swift"))).digest("hex")
11733
11877
  );
11734
- writeSwiftAutolinkLinker(root, options.toolchainBin);
11735
- const projectProcess = options.project ? prepareSwiftProjectProcess(root, options.project) : void 0;
11736
- const appOptions = projectProcess ? {
11737
- ...buildOptions,
11738
- uid: projectProcess.uid,
11739
- gid: projectProcess.gid,
11740
- confined: projectProcess.env
11741
- } : buildOptions;
11742
- const unprepared = preparation.targetFailures.map(
11743
- (failure) => `error: target ${failure}`
11744
- );
11745
- const forwarders = /* @__PURE__ */ new Map();
11746
- for (const [file, text2] of Object.entries(input.files)) {
11747
- const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text2)?.[1];
11748
- if (!parents) continue;
11749
- const directory = import_node_path19.default.posix.dirname(file);
11750
- forwarders.set(
11751
- `${import_node_path19.default.join(root, directory)}/${parents.slice(0, -1)}`,
11752
- import_node_path19.default.posix.join("build", directory, parents).replace(/\/$/, "")
11878
+ (0, import_node_fs17.mkdirSync)(checkpoints, { recursive: true });
11879
+ for (const target of /* @__PURE__ */ new Set([
11880
+ ...input.staticClangTargets ?? [],
11881
+ ...preparation.nativeBuildTargets
11882
+ ])) {
11883
+ const checkpoint = import_node_path19.default.join(
11884
+ checkpoints,
11885
+ (0, import_node_crypto8.createHash)("sha256").update(target).digest("hex")
11753
11886
  );
11887
+ if ((0, import_node_fs17.existsSync)(checkpoint)) continue;
11888
+ await runCompiler(
11889
+ swift,
11890
+ [...buildArgs, "--target", target],
11891
+ appOptions,
11892
+ SWIFTPM_PROGRESS,
11893
+ SWIFTPM_NOISE
11894
+ );
11895
+ (0, import_node_fs17.writeFileSync)(checkpoint, "");
11754
11896
  }
11755
- const buildArgs = [
11756
- "build",
11757
- ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
11758
- "--build-system",
11759
- "native",
11760
- "-j",
11761
- BUILD_JOBS,
11762
- "--package-path",
11897
+ await runCompiler(
11898
+ swift,
11899
+ buildArgs,
11900
+ appOptions,
11901
+ SWIFTPM_PROGRESS,
11902
+ SWIFTPM_NOISE
11903
+ );
11904
+ } catch (error) {
11905
+ const output2 = outputOf(error);
11906
+ const moduleCache = import_node_path19.default.join(
11763
11907
  root,
11764
- ...swiftCompileSdkOptions(frameworkRoot, options.toolchainBin),
11765
- "--swift-sdk",
11766
- sdk,
11767
- ...input.packageFiles || prebuilt ? ["--toolset", import_node_path19.default.join(root, ".peach-target-toolset.json")] : [],
11768
- "-c",
11908
+ ".build",
11909
+ WASM_TRIPLE,
11769
11910
  "release",
11770
- "-Xswiftc",
11771
- "-num-threads",
11772
- "-Xswiftc",
11773
- BUILD_JOBS,
11774
- ...swiftReproducibleBuildFlags([
11775
- [import_node_path19.default.dirname(options.toolchainBin), "toolchain"],
11776
- [frameworkRoot, "framework"],
11777
- [root, "build"],
11778
- ...forwarders
11779
- ]),
11780
- ...macroPlugins.libraries.flatMap((plugin) => [
11781
- "-Xswiftc",
11782
- "-load-plugin-library",
11783
- "-Xswiftc",
11784
- plugin
11785
- ]),
11786
- ...macroPlugins.executables.flatMap((plugin) => [
11787
- "-Xswiftc",
11788
- "-load-plugin-executable",
11789
- "-Xswiftc",
11790
- `${plugin}#ExpoModulesMacros`
11791
- ])
11792
- ];
11793
- const linked = builtArtifact(layout);
11794
- if (input.lazyDistribution) {
11795
- (0, import_node_fs17.rmSync)(import_node_path19.default.join(root, ".peach-link.rsp"), { force: true });
11796
- if ((0, import_node_fs17.existsSync)(linked) && (0, import_node_fs17.statSync)(linked).size <= 8)
11797
- (0, import_node_fs17.rmSync)(linked, { force: true });
11798
- }
11799
- report("compiling and linking Swift modules");
11800
- try {
11801
- const headerBuilds = preparation.headerProductTarget ? [
11802
- ...Object.keys(preparation.nativeHeaderDeclarations),
11803
- preparation.headerProductTarget
11804
- ] : preparation.headerProducers;
11805
- for (const build of headerBuilds) {
11911
+ "ModuleCache"
11912
+ );
11913
+ if (output2.includes("was compiled with module cache path") && (0, import_node_fs17.existsSync)(moduleCache)) {
11914
+ (0, import_node_fs17.rmSync)(moduleCache, { recursive: true, force: true });
11915
+ try {
11806
11916
  await runCompiler(
11807
11917
  swift,
11808
- [...buildArgs, "--target", build],
11918
+ buildArgs,
11809
11919
  appOptions,
11810
11920
  SWIFTPM_PROGRESS,
11811
11921
  SWIFTPM_NOISE
11812
11922
  );
11813
- for (const producer of build === preparation.headerProductTarget ? preparation.headerProducers : [build]) {
11814
- const emitted = import_node_path19.default.join(
11815
- root,
11816
- ".build",
11817
- "peach-cxx-headers",
11818
- `${producer}-Swift.h`
11819
- );
11820
- const original = preparation.nativeHeaderDeclarations[producer] ? emitted.replace(/-Swift\.h$/, "-Swift.original.h") : emitted;
11821
- if ((0, import_node_fs17.existsSync)(original))
11822
- writeBuildFile(
11823
- emitted,
11824
- withoutSwiftDeclarations(
11825
- clangInterfaceHeader((0, import_node_fs17.readFileSync)(original, "utf8")),
11826
- new Set(preparation.nativeHeaderDeclarations[producer]),
11827
- `#import <${producer}/${producer}.h>`
11828
- )
11829
- );
11830
- }
11831
- }
11832
- await runCompiler(
11833
- swift,
11834
- buildArgs,
11835
- appOptions,
11836
- SWIFTPM_PROGRESS,
11837
- SWIFTPM_NOISE
11838
- );
11839
- } catch (error) {
11840
- const output2 = outputOf(error);
11841
- const moduleCache = import_node_path19.default.join(
11842
- root,
11843
- ".build",
11844
- WASM_TRIPLE,
11845
- "release",
11846
- "ModuleCache"
11847
- );
11848
- if (output2.includes("was compiled with module cache path") && (0, import_node_fs17.existsSync)(moduleCache)) {
11849
- (0, import_node_fs17.rmSync)(moduleCache, { recursive: true, force: true });
11850
- try {
11851
- await runCompiler(
11852
- swift,
11853
- buildArgs,
11854
- appOptions,
11855
- SWIFTPM_PROGRESS,
11856
- SWIFTPM_NOISE
11857
- );
11858
- } catch (retryError) {
11859
- throw new Error(
11860
- [
11861
- ...unprepared,
11862
- projectDiagnostic(outputOf(retryError), layout, input.files)
11863
- ].join("\n"),
11864
- { cause: retryError }
11865
- );
11866
- }
11867
- } else {
11923
+ } catch (retryError) {
11868
11924
  throw new Error(
11869
- [...unprepared, projectDiagnostic(output2, layout, input.files)].join(
11870
- "\n"
11871
- ),
11872
- { cause: error }
11925
+ [
11926
+ ...unprepared,
11927
+ projectDiagnostic(outputOf(retryError), layout, input.files)
11928
+ ].join("\n"),
11929
+ { cause: retryError }
11873
11930
  );
11874
11931
  }
11875
- } finally {
11876
- if (options.project) endSwiftProjectProcesses(options.project);
11877
- }
11878
- if (unprepared.length) throw new Error(unprepared.join("\n"));
11879
- if (!(0, import_node_fs17.existsSync)(linked)) {
11880
- const binDir = import_node_path19.default.dirname(linked);
11881
- const found = (0, import_node_fs17.existsSync)(binDir) ? (0, import_node_fs17.readdirSync)(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
11932
+ } else {
11882
11933
  throw new Error(
11883
- `swift-compile: the build produced no ${import_node_path19.default.basename(linked)} (found: ${found.join(", ") || "none"})`
11934
+ [...unprepared, projectDiagnostic(output2, layout, input.files)].join(
11935
+ "\n"
11936
+ ),
11937
+ { cause: error }
11884
11938
  );
11885
11939
  }
11886
- if (options.project) removeProjectLinks(root);
11887
- const output = options.project ? projectOutputFile(root, linked, options.project) : linked;
11888
- const optimized = `${output}.optimized`;
11889
- if (input.lazyDistribution) {
11890
- pruneSwiftWasmLink(
11891
- root,
11892
- options.toolchainBin,
11893
- frameworkRoot,
11894
- input.staticClangTargets
11895
- );
11896
- await optimizeWasm(output, optimized);
11897
- }
11898
- const artifact = {
11899
- hash,
11900
- bytes: (0, import_node_fs17.readFileSync)(input.lazyDistribution ? optimized : output),
11901
- icu: await icu
11902
- };
11903
- if (!options.project) saveCompiledArtifact(root, artifact);
11904
- saveSharedArtifact(sharedRoot, artifact);
11905
- report("compiled artifact verified");
11906
- return retain(root, artifact);
11907
- },
11908
- options.signal
11909
- );
11940
+ } finally {
11941
+ if (options.project) endSwiftProjectProcesses(options.project);
11942
+ }
11943
+ if (unprepared.length) throw new Error(unprepared.join("\n"));
11944
+ if (!(0, import_node_fs17.existsSync)(linked)) {
11945
+ const binDir = import_node_path19.default.dirname(linked);
11946
+ const found = (0, import_node_fs17.existsSync)(binDir) ? (0, import_node_fs17.readdirSync)(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
11947
+ throw new Error(
11948
+ `swift-compile: the build produced no ${import_node_path19.default.basename(linked)} (found: ${found.join(", ") || "none"})`
11949
+ );
11950
+ }
11951
+ if (options.project) removeProjectLinks(root);
11952
+ const output = options.project ? projectOutputFile(root, linked, options.project) : linked;
11953
+ const optimized = `${output}.optimized`;
11954
+ if (input.lazyDistribution) {
11955
+ pruneSwiftWasmLink(
11956
+ root,
11957
+ options.toolchainBin,
11958
+ frameworkRoot,
11959
+ input.staticClangTargets
11960
+ );
11961
+ await optimizeWasm(output, optimized);
11962
+ }
11963
+ const artifact = {
11964
+ hash,
11965
+ bytes: (0, import_node_fs17.readFileSync)(input.lazyDistribution ? optimized : output),
11966
+ icu: await icu
11967
+ };
11968
+ if (!options.project) saveCompiledArtifact(root, artifact);
11969
+ saveSharedArtifact(sharedRoot, artifact);
11970
+ report("compiled artifact verified");
11971
+ return retain(root, artifact);
11972
+ });
11910
11973
  },
11911
11974
  options.signal
11912
11975
  );