peachsim 0.1.2792 → 0.1.2794

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 (137) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +2 -2
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +5 -5
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +3 -3
  13. package/dist-lib/bundle-channel.cjs +1162 -997
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +3 -3
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +3 -3
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +2 -2
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +7 -7
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +5 -5
  24. package/dist-lib/detox/index.cjs +1 -1
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/esm-chunks/{acorn-WRJUSJKZ.mjs → acorn-A7OMJDVK.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-KM6MA4GX.mjs → chunk-2TCGEMEV.mjs} +5 -5
  28. package/dist-lib/esm-chunks/{chunk-LKQFWHTY.mjs → chunk-35HEHEYA.mjs} +1 -1
  29. package/dist-lib/esm-chunks/{chunk-T2AWHCFQ.mjs → chunk-5RQ3U7WK.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-HLTCPSRU.mjs → chunk-7QNWHCMJ.mjs} +1121 -1060
  31. package/dist-lib/esm-chunks/{chunk-MPN7ASMV.mjs → chunk-ANIC22U3.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-2RLCLA6D.mjs → chunk-AW4Z3K2U.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-UIMK6KUZ.mjs → chunk-B3E5ZI2D.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-GSH5UN7J.mjs → chunk-CIFEHSEA.mjs} +2 -2
  35. package/dist-lib/esm-chunks/{chunk-DTUV3X2Q.mjs → chunk-CIR4VZ22.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-JGMADAGT.mjs → chunk-DLEQ5NZ5.mjs} +4 -4
  37. package/dist-lib/esm-chunks/{chunk-KZF5BL3C.mjs → chunk-E6KA576K.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-ETD4V3AD.mjs → chunk-GDITZ3K2.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-6WTE57J5.mjs → chunk-GHGDWJY3.mjs} +6 -6
  40. package/dist-lib/esm-chunks/{chunk-47WU4TMV.mjs → chunk-K7RLWF5X.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-6M75JXV2.mjs → chunk-KVFRYFZI.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-YIQKUSLV.mjs → chunk-NKJ67PFZ.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-OLGTAPUD.mjs → chunk-O6HHWO4Y.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-WDTW47HC.mjs → chunk-OS6YJU3W.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-IVMQXMAB.mjs → chunk-PRYC6EMT.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-T66EPEFI.mjs → chunk-R6ES6QCH.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-GGEXRAIP.mjs → chunk-TJULYSLY.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-U66IKMQZ.mjs → chunk-V6BE34Q3.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-NHFLYRY6.mjs → chunk-Y6YMRYNX.mjs} +64 -21
  50. package/dist-lib/esm-chunks/{chunk-AWVOMHWY.mjs → chunk-ZTDPCBGG.mjs} +3 -3
  51. package/dist-lib/esm-chunks/{metro-layout-parser-DCAE4BLG.mjs → metro-layout-parser-WG2ITRQD.mjs} +3 -3
  52. package/dist-lib/esm-chunks/{swift-package-prebuilt-PP63JS2U.mjs → swift-package-prebuilt-DN7G5XKR.mjs} +16 -13
  53. package/dist-lib/esm-chunks/{swift-sdk-app-module-Q5PK6AH4.mjs → swift-sdk-app-module-3DB4F4Y2.mjs} +16 -16
  54. package/dist-lib/esm-chunks/{swift-sdk-image-NTCJSARK.mjs → swift-sdk-image-JTYM3OQY.mjs} +16 -16
  55. package/dist-lib/esm-chunks/{swift-sdk-image-producer-KIVLLITM.mjs → swift-sdk-image-producer-QQUODPXF.mjs} +5 -5
  56. package/dist-lib/expo-swift-bundle.cjs +1104 -939
  57. package/dist-lib/expo-swift-metadata.cjs +1 -1
  58. package/dist-lib/expo-swift-metadata.mjs +7 -7
  59. package/dist-lib/home-paths.cjs +1 -1
  60. package/dist-lib/host/bridge-host.cjs +3747 -3456
  61. package/dist-lib/host/fetch-proxy-handler.cjs +121 -117
  62. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  63. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  64. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  65. package/dist-lib/host/websocket-proxy.cjs +1 -1
  66. package/dist-lib/index.cjs +1 -1
  67. package/dist-lib/kotlin-host.cjs +1 -1
  68. package/dist-lib/menu.cjs +1 -1
  69. package/dist-lib/menu.mjs +3 -3
  70. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  71. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  72. package/dist-lib/metro-production-bundle.cjs +1 -1
  73. package/dist-lib/metro-production-bundle.mjs +4 -4
  74. package/dist-lib/native-app-identity-project.cjs +3 -1
  75. package/dist-lib/native-app-identity-project.mjs +15 -15
  76. package/dist-lib/native-app-identity.cjs +1 -1
  77. package/dist-lib/native-app-identity.mjs +6 -6
  78. package/dist-lib/native-firebase-metadata.cjs +1 -1
  79. package/dist-lib/native-firebase-metadata.mjs +3 -3
  80. package/dist-lib/pdfium-raster.cjs +1 -1
  81. package/dist-lib/pdfium-raster.mjs +2 -2
  82. package/dist-lib/plist.cjs +1 -1
  83. package/dist-lib/plist.mjs +3 -3
  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 +85 -85
  87. package/dist-lib/public-origins-lib.json +76 -76
  88. package/dist-lib/react-native-host-modules.cjs +1 -1
  89. package/dist-lib/react-native-host-modules.mjs +2 -2
  90. package/dist-lib/reap-browser.cjs +1 -1
  91. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  92. package/dist-lib/sdk.cjs +1 -1
  93. package/dist-lib/sdk.mjs +8 -8
  94. package/dist-lib/skills.cjs +2032 -1741
  95. package/dist-lib/swift-compile.cjs +1061 -967
  96. package/dist-lib/swift-compile.mjs +12 -12
  97. package/dist-lib/swift-package.cjs +1 -1
  98. package/dist-lib/swift-package.mjs +3 -3
  99. package/dist-lib/swift-submit.cjs +1 -1
  100. package/dist-lib/swift-submit.mjs +6 -6
  101. package/dist-lib/swift-svg-raster.cjs +1 -1
  102. package/dist-lib/swift-svg-raster.mjs +2 -2
  103. package/dist-lib/swift-toolchain.cjs +1 -1
  104. package/dist-lib/swift.cjs +1 -1
  105. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  106. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  107. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  108. package/dist-lib/vendor/acorn.cjs +1 -1
  109. package/dist-lib/vendor/magic-string.cjs +1 -1
  110. package/dist-lib/vendor/stream-json.cjs +1 -1
  111. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  112. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  113. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  114. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  115. package/dist-lib/vendor/sucrase.cjs +1 -1
  116. package/dist-lib/vendor/terser.cjs +1 -1
  117. package/dist-lib/vendor/valibot.cjs +1 -1
  118. package/dist-lib/vendor/ws.cjs +1 -1
  119. package/dist-lib/vendor/zod.cjs +1 -1
  120. package/dist-lib/worklet-executable.cjs +1 -1
  121. package/dist-lib/worklet-executable.mjs +3 -3
  122. package/dist-types/packages/peach-engine/src/engine/image-fetch.d.ts +0 -4
  123. package/dist-types/packages/peach-engine/src/engine/scene-native-binding.d.ts +2 -2
  124. package/dist-types/packages/peach-engine/src/render-worker/native-hot-ops.d.ts +1 -1
  125. package/dist-types/packages/peach-engine/src/render-worker/nativeReanimatedCSSContract.d.ts +7 -7
  126. package/dist-types/packages/peach-engine/src/render-worker/reanimated-css-contract.d.ts +1 -20
  127. package/dist-types/packages/peach-engine/src/render-worker/scene-packet-feed.d.ts +2 -0
  128. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +5 -23
  129. package/dist-types/packages/peach-engine/src/render-worker/worklet-wire.d.ts +4 -49
  130. package/package.json +1 -1
  131. package/src/one-native-controls-package.ts +56 -54
  132. package/src/swift-compile.ts +1034 -967
  133. package/src/swift-compiler-digest.ts +79 -4
  134. package/src/swift-host.ts +246 -91
  135. package/src/swift-package-prebuilt.ts +6 -3
  136. package/src/swift-sdk-surface.ts +75 -20
  137. package/src/swift-startup-split.ts +134 -12
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2792 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2794 | (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;
@@ -10481,37 +10481,18 @@ var init_swift_compile_budget = __esm({
10481
10481
  }
10482
10482
  });
10483
10483
 
10484
- // src/swift-objc-sdk-tree.ts
10485
- function readIosSdkTree(root) {
10486
- return (0, import_node_fs19.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => {
10487
- const file = import_node_path16.default.join(entry.parentPath, entry.name);
10488
- return [
10489
- import_node_path16.default.relative(root, file).split(import_node_path16.default.sep).join("/"),
10490
- (0, import_node_fs19.readFileSync)(file, "utf8")
10491
- ];
10492
- }).sort(([a], [b]) => a < b ? -1 : 1);
10493
- }
10494
- var import_node_fs19, import_node_path16;
10495
- var init_swift_objc_sdk_tree = __esm({
10496
- "src/swift-objc-sdk-tree.ts"() {
10497
- "use strict";
10498
- import_node_fs19 = require("node:fs");
10499
- import_node_path16 = __toESM(require("node:path"), 1);
10500
- }
10501
- });
10502
-
10503
10484
  // src/swift-compiler-digest.ts
10504
10485
  function swiftArchiveCompilerDigestValue() {
10505
- return true ? "55785eec94200dfda30d22e849c5f0b474eb704b467ed3db4d211ae938ad0081" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname, "archive");
10486
+ return true ? "9f3ce81119383c0a06504b3325d9b5dcd291f804e34d31b83428ee6fa494df7f" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname, "archive");
10506
10487
  }
10507
- var import_node_crypto10, import_node_fs20, import_node_path17, SWIFT_DIGEST_SOURCES, LINKED_IMAGE_SOURCES, SWIFT_ARCHIVE_DIGEST_SOURCES;
10488
+ var import_node_crypto10, import_node_fs19, import_node_os7, import_node_path16, SWIFT_DIGEST_SOURCES, LINKED_IMAGE_SOURCES, SWIFT_ARCHIVE_DIGEST_SOURCES;
10508
10489
  var init_swift_compiler_digest = __esm({
10509
10490
  "src/swift-compiler-digest.ts"() {
10510
10491
  "use strict";
10511
10492
  import_node_crypto10 = require("node:crypto");
10512
- import_node_fs20 = require("node:fs");
10513
- import_node_path17 = __toESM(require("node:path"), 1);
10514
- init_swift_objc_sdk_tree();
10493
+ import_node_fs19 = require("node:fs");
10494
+ import_node_os7 = __toESM(require("node:os"), 1);
10495
+ import_node_path16 = __toESM(require("node:path"), 1);
10515
10496
  SWIFT_DIGEST_SOURCES = [
10516
10497
  "swift-compile.ts",
10517
10498
  "swift-sdk-surface.ts",
@@ -10594,7 +10575,7 @@ function swiftObjCPlatformFlags(toolchainBin, minimum) {
10594
10575
  minimum % 100
10595
10576
  ].join(".");
10596
10577
  const result = (0, import_node_child_process11.spawnSync)(
10597
- import_node_path18.default.join(toolchainBin, "clang"),
10578
+ import_node_path17.default.join(toolchainBin, "clang"),
10598
10579
  [
10599
10580
  "-target",
10600
10581
  `arm64-apple-ios${version2}-simulator`,
@@ -10626,12 +10607,12 @@ function swiftObjCPlatformFlags(toolchainBin, minimum) {
10626
10607
  platforms.set(key2, flags);
10627
10608
  return flags;
10628
10609
  }
10629
- var import_node_child_process11, import_node_path18, platforms;
10610
+ var import_node_child_process11, import_node_path17, platforms;
10630
10611
  var init_swift_objc_platform = __esm({
10631
10612
  "src/swift-objc-platform.ts"() {
10632
10613
  "use strict";
10633
10614
  import_node_child_process11 = require("node:child_process");
10634
- import_node_path18 = __toESM(require("node:path"), 1);
10615
+ import_node_path17 = __toESM(require("node:path"), 1);
10635
10616
  init_swift_toolchain();
10636
10617
  platforms = /* @__PURE__ */ new Map();
10637
10618
  }
@@ -10653,42 +10634,42 @@ var init_swift_objc_runtime = __esm({
10653
10634
 
10654
10635
  // src/write-build-file.ts
10655
10636
  function writeBuildFile(file, contents2) {
10656
- const stat = (0, import_node_fs21.statSync)(file, { throwIfNoEntry: false });
10637
+ const stat = (0, import_node_fs20.statSync)(file, { throwIfNoEntry: false });
10657
10638
  if (stat?.isFile()) {
10658
10639
  if (typeof contents2 === "string") {
10659
- if ((0, import_node_fs21.readFileSync)(file, "utf8") === contents2) return;
10660
- } else if (stat.size === contents2.length && (0, import_node_fs21.readFileSync)(file).equals(contents2)) {
10640
+ if ((0, import_node_fs20.readFileSync)(file, "utf8") === contents2) return;
10641
+ } else if (stat.size === contents2.length && (0, import_node_fs20.readFileSync)(file).equals(contents2)) {
10661
10642
  return;
10662
10643
  }
10663
10644
  }
10664
- (0, import_node_fs21.mkdirSync)(import_node_path19.default.dirname(file), { recursive: true });
10665
- (0, import_node_fs21.writeFileSync)(file, contents2);
10645
+ (0, import_node_fs20.mkdirSync)(import_node_path18.default.dirname(file), { recursive: true });
10646
+ (0, import_node_fs20.writeFileSync)(file, contents2);
10666
10647
  }
10667
- var import_node_fs21, import_node_path19;
10648
+ var import_node_fs20, import_node_path18;
10668
10649
  var init_write_build_file = __esm({
10669
10650
  "src/write-build-file.ts"() {
10670
10651
  "use strict";
10671
- import_node_fs21 = require("node:fs");
10672
- import_node_path19 = __toESM(require("node:path"), 1);
10652
+ import_node_fs20 = require("node:fs");
10653
+ import_node_path18 = __toESM(require("node:path"), 1);
10673
10654
  }
10674
10655
  });
10675
10656
 
10676
10657
  // src/case-insensitive-header-overlay.ts
10677
10658
  function needsCaseOverlay(directory2) {
10678
10659
  if (process.platform !== "darwin") return true;
10679
- const device = import_node_fs22.default.statSync(directory2).dev;
10660
+ const device = import_node_fs21.default.statSync(directory2).dev;
10680
10661
  const known = volumeCaseSensitivity.get(device);
10681
10662
  if (known !== void 0) return known;
10682
10663
  let probed = false;
10683
- for (const name3 of import_node_fs22.default.readdirSync(directory2)) {
10664
+ for (const name3 of import_node_fs21.default.readdirSync(directory2)) {
10684
10665
  const alternate = name3.replace(
10685
10666
  /[a-zA-Z]/,
10686
10667
  (letter) => letter === letter.toLowerCase() ? letter.toUpperCase() : letter.toLowerCase()
10687
10668
  );
10688
10669
  if (alternate === name3) continue;
10689
- const original = import_node_fs22.default.lstatSync(import_node_path20.default.join(directory2, name3), { throwIfNoEntry: false });
10670
+ const original = import_node_fs21.default.lstatSync(import_node_path19.default.join(directory2, name3), { throwIfNoEntry: false });
10690
10671
  if (!original) continue;
10691
- const changed = import_node_fs22.default.lstatSync(import_node_path20.default.join(directory2, alternate), {
10672
+ const changed = import_node_fs21.default.lstatSync(import_node_path19.default.join(directory2, alternate), {
10692
10673
  throwIfNoEntry: false
10693
10674
  });
10694
10675
  if (!changed || original.ino !== changed.ino || original.dev !== changed.dev) {
@@ -10702,10 +10683,10 @@ function needsCaseOverlay(directory2) {
10702
10683
  }
10703
10684
  function scan(directory2, listed) {
10704
10685
  const node = { files: /* @__PURE__ */ new Map(), directories: /* @__PURE__ */ new Map() };
10705
- const entries2 = import_node_fs22.default.readdirSync(directory2, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
10686
+ const entries2 = import_node_fs21.default.readdirSync(directory2, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
10706
10687
  for (const entry of entries2) {
10707
- const full = import_node_path20.default.join(directory2, entry.name);
10708
- const stat = entry.isSymbolicLink() ? import_node_fs22.default.statSync(full, { throwIfNoEntry: false }) : entry;
10688
+ const full = import_node_path19.default.join(directory2, entry.name);
10689
+ const stat = entry.isSymbolicLink() ? import_node_fs21.default.statSync(full, { throwIfNoEntry: false }) : entry;
10709
10690
  if (!stat) continue;
10710
10691
  if (stat.isDirectory()) {
10711
10692
  const child = scan(full, listed);
@@ -10731,7 +10712,7 @@ function contents(node) {
10731
10712
  ];
10732
10713
  }
10733
10714
  function clearCaseInsensitiveHeaderOverlayCache(rootPrefix) {
10734
- const prefix = `${rootPrefix}${import_node_path20.default.sep}`;
10715
+ const prefix = `${rootPrefix}${import_node_path19.default.sep}`;
10735
10716
  for (const key2 of scans2.keys())
10736
10717
  if (key2 === rootPrefix || key2.startsWith(prefix)) scans2.delete(key2);
10737
10718
  }
@@ -10742,7 +10723,7 @@ function caseInsensitiveHeaderOverlay(directory2, roots, listed, fixedName) {
10742
10723
  listedScans.set(listed, known);
10743
10724
  }
10744
10725
  const existing = [...new Set(roots)].filter(
10745
- (root) => import_node_fs22.default.existsSync(root) && needsCaseOverlay(root)
10726
+ (root) => import_node_fs21.default.existsSync(root) && needsCaseOverlay(root)
10746
10727
  );
10747
10728
  if (existing.length === 0) return null;
10748
10729
  const unique2 = existing.filter(
@@ -10754,20 +10735,20 @@ function caseInsensitiveHeaderOverlay(directory2, roots, listed, fixedName) {
10754
10735
  return { name: root, type: "directory", contents: contents(node) };
10755
10736
  });
10756
10737
  const text7 = JSON.stringify({ "case-sensitive": "false", roots: roots_, version: 0 });
10757
- const file = import_node_path20.default.join(
10738
+ const file = import_node_path19.default.join(
10758
10739
  directory2,
10759
10740
  fixedName ?? `case-insensitive-${(0, import_node_crypto11.createHash)("sha256").update(text7).digest("hex").slice(0, 16)}.yaml`
10760
10741
  );
10761
10742
  writeBuildFile(file, text7);
10762
10743
  return file;
10763
10744
  }
10764
- var import_node_crypto11, import_node_fs22, import_node_path20, HEADER, volumeCaseSensitivity, scans2, listedScans;
10745
+ var import_node_crypto11, import_node_fs21, import_node_path19, HEADER, volumeCaseSensitivity, scans2, listedScans;
10765
10746
  var init_case_insensitive_header_overlay = __esm({
10766
10747
  "src/case-insensitive-header-overlay.ts"() {
10767
10748
  "use strict";
10768
10749
  import_node_crypto11 = require("node:crypto");
10769
- import_node_fs22 = __toESM(require("node:fs"), 1);
10770
- import_node_path20 = __toESM(require("node:path"), 1);
10750
+ import_node_fs21 = __toESM(require("node:fs"), 1);
10751
+ import_node_path19 = __toESM(require("node:path"), 1);
10771
10752
  init_write_build_file();
10772
10753
  HEADER = /\.(h|hh|hpp|hxx|inc|inl|def|modulemap|apinotes|tcc)$/i;
10773
10754
  volumeCaseSensitivity = /* @__PURE__ */ new Map();
@@ -10912,6 +10893,25 @@ var init_swift_interface_bodies = __esm({
10912
10893
  }
10913
10894
  });
10914
10895
 
10896
+ // src/swift-objc-sdk-tree.ts
10897
+ function readIosSdkTree(root) {
10898
+ return (0, import_node_fs22.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => {
10899
+ const file = import_node_path20.default.join(entry.parentPath, entry.name);
10900
+ return [
10901
+ import_node_path20.default.relative(root, file).split(import_node_path20.default.sep).join("/"),
10902
+ (0, import_node_fs22.readFileSync)(file, "utf8")
10903
+ ];
10904
+ }).sort(([a], [b]) => a < b ? -1 : 1);
10905
+ }
10906
+ var import_node_fs22, import_node_path20;
10907
+ var init_swift_objc_sdk_tree = __esm({
10908
+ "src/swift-objc-sdk-tree.ts"() {
10909
+ "use strict";
10910
+ import_node_fs22 = require("node:fs");
10911
+ import_node_path20 = __toESM(require("node:path"), 1);
10912
+ }
10913
+ });
10914
+
10915
10915
  // src/swift-objc-sdk.ts
10916
10916
  function iosSdk() {
10917
10917
  if (sdk) return sdk;
@@ -14964,7 +14964,7 @@ var init_swift_shared_sdk = __esm({
14964
14964
  // src/swift-darwin-records.ts
14965
14965
  function compileDarwinRecords(args) {
14966
14966
  const records = import_node_path24.default.join(args.packageRoot, "Sources/DarwinRecords");
14967
- const runtime = (0, import_node_fs25.mkdtempSync)(import_node_path24.default.join((0, import_node_os7.tmpdir)(), "peach-objc-runtime-"));
14967
+ const runtime = (0, import_node_fs25.mkdtempSync)(import_node_path24.default.join((0, import_node_os8.tmpdir)(), "peach-objc-runtime-"));
14968
14968
  (0, import_node_fs25.symlinkSync)(import_node_path24.default.join(args.darwin, "usr/include/objc"), import_node_path24.default.join(runtime, "objc"));
14969
14969
  const objects = (0, import_node_fs25.readdirSync)(records).filter((file) => file.endsWith(".c") || file.endsWith(".m")).sort((a, b) => a < b ? -1 : a > b ? 1 : 0).map((file) => {
14970
14970
  const object8 = import_node_path24.default.join(
@@ -15007,13 +15007,13 @@ function compileDarwinRecords(args) {
15007
15007
  (0, import_node_fs25.rmSync)(runtime, { recursive: true });
15008
15008
  return objects;
15009
15009
  }
15010
- var import_node_child_process14, import_node_fs25, import_node_os7, import_node_path24, DARWIN_RECORDS_PREFIX, darwinRecordsMinimum;
15010
+ var import_node_child_process14, import_node_fs25, import_node_os8, import_node_path24, DARWIN_RECORDS_PREFIX, darwinRecordsMinimum;
15011
15011
  var init_swift_darwin_records = __esm({
15012
15012
  "src/swift-darwin-records.ts"() {
15013
15013
  "use strict";
15014
15014
  import_node_child_process14 = require("node:child_process");
15015
15015
  import_node_fs25 = require("node:fs");
15016
- import_node_os7 = require("node:os");
15016
+ import_node_os8 = require("node:os");
15017
15017
  import_node_path24 = __toESM(require("node:path"), 1);
15018
15018
  init_swift_objc_platform();
15019
15019
  init_swift_objc_runtime();
@@ -28918,13 +28918,13 @@ var init_swift_lexical = __esm({
28918
28918
  // src/swift-sdk-surface.ts
28919
28919
  function swiftBuildJobs() {
28920
28920
  const admittedCores = windowAdmission()?.cores ?? Number(process.env.TM_EXEC_CPU_CORES);
28921
- const parallelism = Math.max(1, import_node_os8.default.availableParallelism());
28921
+ const parallelism = Math.max(1, import_node_os9.default.availableParallelism());
28922
28922
  if (!Number.isInteger(admittedCores) || admittedCores <= 0)
28923
28923
  return Math.min(4, Math.max(1, Math.floor(parallelism / 2)));
28924
28924
  const cores = Math.min(admittedCores, parallelism);
28925
28925
  if (process.platform === "darwin") return cores;
28926
28926
  const memory = process.env.TM_EXEC_ADMITTED === "1" && process.env.LINUX_BUILD_SCOPE ? Number(process.env.TM_EXEC_LINUX_MEMORY_MAX) : NaN;
28927
- const effectiveMemory = Number.isSafeInteger(memory) && memory > 0 ? memory : import_node_os8.default.totalmem();
28927
+ const effectiveMemory = Number.isSafeInteger(memory) && memory > 0 ? memory : import_node_os9.default.totalmem();
28928
28928
  const memoryJobs = Math.max(1, Math.floor(effectiveMemory / (2 * 1024 ** 3)));
28929
28929
  return Math.min(cores, memoryJobs);
28930
28930
  }
@@ -29255,6 +29255,16 @@ function swiftMacroPlugins(moduleRoot) {
29255
29255
  stale: [...libraries, ...executables, stamp].some((file) => !(0, import_node_fs40.existsSync)(file)) || (0, import_node_fs40.readFileSync)(stamp, "utf8").trim() !== release
29256
29256
  };
29257
29257
  }
29258
+ function withSwiftModuleDigestScope(fn) {
29259
+ if (moduleDigestScopes.getStore()) return fn();
29260
+ return moduleDigestScopes.run(/* @__PURE__ */ new Map(), fn);
29261
+ }
29262
+ function clearSwiftModuleDigestScope(root) {
29263
+ const scope2 = moduleDigestScopes.getStore();
29264
+ if (!scope2) return;
29265
+ if (root === void 0) scope2.clear();
29266
+ else scope2.delete(import_node_path39.default.resolve(root));
29267
+ }
29258
29268
  function gitCleanModuleInputsKey(root, files2) {
29259
29269
  if (swiftDistributionAt(root)) return null;
29260
29270
  const top = (0, import_node_child_process23.spawnSync)("git", ["-C", root, "rev-parse", "--show-toplevel"], {
@@ -29318,7 +29328,11 @@ function gitCleanModuleInputsKey(root, files2) {
29318
29328
  for (const file of files2) keyHash.update(file).update("\n");
29319
29329
  return keyHash.digest("hex");
29320
29330
  }
29321
- function swiftModuleDigest(root) {
29331
+ function swiftModuleEntry(root) {
29332
+ const scope2 = moduleDigestScopes.getStore();
29333
+ const key2 = import_node_path39.default.resolve(root);
29334
+ const scoped = scope2?.get(key2);
29335
+ if (scoped) return scoped;
29322
29336
  const files2 = swiftModuleInputFiles(root);
29323
29337
  const stampHash = (0, import_node_crypto25.createHash)("sha256");
29324
29338
  for (const file of files2) {
@@ -29331,7 +29345,10 @@ function swiftModuleDigest(root) {
29331
29345
  }
29332
29346
  const stamp = stampHash.digest("hex");
29333
29347
  const cached2 = linkedModuleDigests.get(root);
29334
- if (cached2?.stamp === stamp) return cached2.digest;
29348
+ if (cached2?.stamp === stamp) {
29349
+ scope2?.set(key2, cached2);
29350
+ return cached2;
29351
+ }
29335
29352
  const digestDir = import_node_path39.default.join(swiftCacheDir(), "swift-module-digests");
29336
29353
  const record5 = import_node_path39.default.join(
29337
29354
  digestDir,
@@ -29347,8 +29364,10 @@ function swiftModuleDigest(root) {
29347
29364
  const saved = JSON.parse((0, import_node_fs40.readFileSync)(record5, "utf8"));
29348
29365
  if (saved && typeof saved === "object" && Reflect.get(saved, "stamp") === stamp && typeof Reflect.get(saved, "digest") === "string") {
29349
29366
  const digest4 = Buffer.from(String(Reflect.get(saved, "digest")), "hex");
29350
- linkedModuleDigests.set(root, { stamp, digest: digest4 });
29351
- return digest4;
29367
+ const entry2 = { stamp, digest: digest4 };
29368
+ linkedModuleDigests.set(root, entry2);
29369
+ scope2?.set(key2, entry2);
29370
+ return entry2;
29352
29371
  }
29353
29372
  }
29354
29373
  const gitKey = gitCleanModuleInputsKey(root, files2);
@@ -29358,9 +29377,11 @@ function swiftModuleDigest(root) {
29358
29377
  if (saved && typeof saved === "object" && typeof Reflect.get(saved, "digest") === "string") {
29359
29378
  const hex2 = String(Reflect.get(saved, "digest"));
29360
29379
  const digest4 = Buffer.from(hex2, "hex");
29361
- linkedModuleDigests.set(root, { stamp, digest: digest4 });
29380
+ const entry2 = { stamp, digest: digest4 };
29381
+ linkedModuleDigests.set(root, entry2);
29382
+ scope2?.set(key2, entry2);
29362
29383
  writeRecord(record5, JSON.stringify({ stamp, digest: hex2 }));
29363
- return digest4;
29384
+ return entry2;
29364
29385
  }
29365
29386
  }
29366
29387
  const hash = (0, import_node_crypto25.createHash)("sha256");
@@ -29372,10 +29393,18 @@ function swiftModuleDigest(root) {
29372
29393
  }
29373
29394
  const digest3 = hash.digest();
29374
29395
  const hex = digest3.toString("hex");
29375
- linkedModuleDigests.set(root, { stamp, digest: digest3 });
29396
+ const entry = { stamp, digest: digest3 };
29397
+ linkedModuleDigests.set(root, entry);
29398
+ scope2?.set(key2, entry);
29376
29399
  writeRecord(record5, JSON.stringify({ stamp, digest: hex }));
29377
29400
  if (gitRecord) writeRecord(gitRecord, JSON.stringify({ digest: hex }));
29378
- return digest3;
29401
+ return entry;
29402
+ }
29403
+ function swiftModuleDigest(root) {
29404
+ return swiftModuleEntry(root).digest;
29405
+ }
29406
+ function swiftModuleStamp(root) {
29407
+ return swiftModuleEntry(root).stamp;
29379
29408
  }
29380
29409
  function swiftCompileSurfaceDigest(root) {
29381
29410
  const distribution = swiftDistributionAt(root);
@@ -29466,8 +29495,10 @@ function* swiftConditionalLines(contents2, available2, defines) {
29466
29495
  }
29467
29496
  }
29468
29497
  function swiftImportNames(contents2, available2, defines) {
29469
- if (available2 === void 0 && defines === void 0) {
29470
- const cached2 = importNamesCache.get(contents2);
29498
+ if (!contents2.includes("import")) return [];
29499
+ const definesKey = available2 === void 0 ? defines ? [...defines].sort().join("\0") : "" : void 0;
29500
+ if (definesKey !== void 0) {
29501
+ const cached2 = importNamesCache.get(definesKey)?.get(contents2);
29471
29502
  if (cached2 !== void 0) return cached2;
29472
29503
  }
29473
29504
  const names = [];
@@ -29476,8 +29507,14 @@ function swiftImportNames(contents2, available2, defines) {
29476
29507
  const name3 = SWIFT_IMPORT.exec(line)?.[1];
29477
29508
  if (name3) names.push(name3);
29478
29509
  }
29479
- if (available2 === void 0 && defines === void 0)
29480
- importNamesCache.set(contents2, names);
29510
+ if (definesKey !== void 0) {
29511
+ let bucket = importNamesCache.get(definesKey);
29512
+ if (!bucket) {
29513
+ bucket = /* @__PURE__ */ new Map();
29514
+ importNamesCache.set(definesKey, bucket);
29515
+ }
29516
+ bucket.set(contents2, names);
29517
+ }
29481
29518
  return names;
29482
29519
  }
29483
29520
  function swiftPeachModules(moduleRoot) {
@@ -29767,11 +29804,15 @@ function swiftCTakesReturnAddress(source) {
29767
29804
  cActiveCode(stripCCode(source), wasmMacroEnvironment)
29768
29805
  );
29769
29806
  }
29770
- function swiftModuleCompiler(root) {
29807
+ function swiftModuleRelease(root) {
29771
29808
  const pin2 = swiftDistributionAt(root) ?? JSON.parse((0, import_node_fs40.readFileSync)(import_node_path39.default.join(root, "toolchain.json"), "utf8"));
29809
+ return pin2.release;
29810
+ }
29811
+ function swiftModuleCompiler(root) {
29812
+ const release = swiftModuleRelease(root);
29772
29813
  return {
29773
- release: pin2.release,
29774
- toolchainBin: swiftCompiler(pin2.release)
29814
+ release,
29815
+ toolchainBin: swiftCompiler(release)
29775
29816
  };
29776
29817
  }
29777
29818
  function swiftModuleToolchain(root) {
@@ -29784,14 +29825,15 @@ function remoteSwiftCheckouts(root) {
29784
29825
  (0, import_node_fs40.mkdirSync)(cache, { recursive: true });
29785
29826
  return import_node_path39.default.join((0, import_node_fs40.realpathSync)(cache), "swift-packages", key2, "checkouts");
29786
29827
  }
29787
- var import_node_child_process23, import_node_crypto25, import_node_fs40, import_node_os8, import_node_path39, distributionManifests, distributionCompileViews, REACH_STAGED_FRAMEWORKS, objcEnumerations, clangDeclarationEnumCache, objcEnumForward, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, compileSurfaces, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, NON_IOS_MODULES, importNamesCache, sdkPaths, FOUNDATION_IMPLICIT_MODULES, FRAMEWORK_COMPANION_IMPORT, codeMasks, codeMaskChars, CODE_MASK_CACHE_CHARS, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, emptyMacroEnvironment, wasmMacroEnvironment, swiftBinaryOnDisk;
29828
+ var import_node_async_hooks2, import_node_child_process23, import_node_crypto25, import_node_fs40, import_node_os9, import_node_path39, distributionManifests, distributionCompileViews, REACH_STAGED_FRAMEWORKS, objcEnumerations, clangDeclarationEnumCache, objcEnumForward, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, moduleDigestScopes, compileSurfaces, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, NON_IOS_MODULES, importNamesCache, sdkPaths, FOUNDATION_IMPLICIT_MODULES, FRAMEWORK_COMPANION_IMPORT, codeMasks, codeMaskChars, CODE_MASK_CACHE_CHARS, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, emptyMacroEnvironment, wasmMacroEnvironment, swiftBinaryOnDisk;
29788
29829
  var init_swift_sdk_surface = __esm({
29789
29830
  "src/swift-sdk-surface.ts"() {
29790
29831
  "use strict";
29832
+ import_node_async_hooks2 = require("node:async_hooks");
29791
29833
  import_node_child_process23 = require("node:child_process");
29792
29834
  import_node_crypto25 = require("node:crypto");
29793
29835
  import_node_fs40 = require("node:fs");
29794
- import_node_os8 = __toESM(require("node:os"), 1);
29836
+ import_node_os9 = __toESM(require("node:os"), 1);
29795
29837
  import_node_path39 = __toESM(require("node:path"), 1);
29796
29838
  init_swift_source_mask();
29797
29839
  init_admitted_mac_build();
@@ -29825,6 +29867,7 @@ var init_swift_sdk_surface = __esm({
29825
29867
  ].map((m) => m[1])
29826
29868
  ]);
29827
29869
  linkedModuleDigests = /* @__PURE__ */ new Map();
29870
+ moduleDigestScopes = new import_node_async_hooks2.AsyncLocalStorage();
29828
29871
  compileSurfaces = /* @__PURE__ */ new WeakMap();
29829
29872
  SWIFT_IMPORT = /^\s*(?:@\w+(?:\([^)]*\))?\s+|(?:public|package|internal|fileprivate|private)\s+)*import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([A-Za-z_][A-Za-z0-9_]*)/;
29830
29873
  kleeneNot = (value) => value === void 0 ? void 0 : !value;
@@ -30264,7 +30307,7 @@ function dumpInputs(dir, xcode) {
30264
30307
  swiftCodeScan(source).lineStarts,
30265
30308
  (line) => line.replace(
30266
30309
  MANIFEST_HOST_OS,
30267
- (match, os26) => (os26 === "macOS" ? "true" : "false").padEnd(match.length)
30310
+ (match, os27) => (os27 === "macOS" ? "true" : "false").padEnd(match.length)
30268
30311
  )
30269
30312
  );
30270
30313
  if (projected !== source) overlays.push({ name: name3, source: projected });
@@ -30711,7 +30754,7 @@ let package = Package(
30711
30754
  ]
30712
30755
  )
30713
30756
  `;
30714
- const dir = import_node_fs41.default.mkdtempSync(import_node_path40.default.join(import_node_os9.default.tmpdir(), "peach-resolve-"));
30757
+ const dir = import_node_fs41.default.mkdtempSync(import_node_path40.default.join(import_node_os10.default.tmpdir(), "peach-resolve-"));
30715
30758
  import_node_fs41.default.writeFileSync(import_node_path40.default.join(dir, "Package.swift"), manifest);
30716
30759
  const args = [
30717
30760
  "package",
@@ -30778,14 +30821,14 @@ function swiftTargetFiles(manifest, target) {
30778
30821
  }
30779
30822
  return [...new Set(files2)].sort();
30780
30823
  }
30781
- var import_node_child_process24, import_node_crypto26, import_node_fs41, import_node_os9, import_node_path40, import_node_util5, TARGET_TYPES, targetRelative, isTargetType, record, array4, string4, swiftCommand, cacheDir2, evaluated, execFileAsync2, cachedToolchain, SwiftManifestPreparationRequired, MANIFEST_HOST_OS, manifestPreparations, GUEST_PLATFORMS, within, requirementClause;
30824
+ var import_node_child_process24, import_node_crypto26, import_node_fs41, import_node_os10, import_node_path40, import_node_util5, TARGET_TYPES, targetRelative, isTargetType, record, array4, string4, swiftCommand, cacheDir2, evaluated, execFileAsync2, cachedToolchain, SwiftManifestPreparationRequired, MANIFEST_HOST_OS, manifestPreparations, GUEST_PLATFORMS, within, requirementClause;
30782
30825
  var init_swift_package_manifest = __esm({
30783
30826
  "src/swift-package-manifest.ts"() {
30784
30827
  "use strict";
30785
30828
  import_node_child_process24 = require("node:child_process");
30786
30829
  import_node_crypto26 = require("node:crypto");
30787
30830
  import_node_fs41 = __toESM(require("node:fs"), 1);
30788
- import_node_os9 = __toESM(require("node:os"), 1);
30831
+ import_node_os10 = __toESM(require("node:os"), 1);
30789
30832
  import_node_path40 = __toESM(require("node:path"), 1);
30790
30833
  import_node_util5 = require("node:util");
30791
30834
  init_git_repo_env();
@@ -30970,7 +31013,7 @@ function swiftHostLibraryView(root, executables) {
30970
31013
  }
30971
31014
  const triple = process.arch === "x64" ? "x86_64-linux-gnu" : "aarch64-linux-gnu";
30972
31015
  const libraries = import_node_path41.default.join(root, "usr/lib", triple);
30973
- const view = import_node_fs42.default.mkdtempSync(import_node_path41.default.join(import_node_os10.default.tmpdir(), "peach-swift-libraries-"));
31016
+ const view = import_node_fs42.default.mkdtempSync(import_node_path41.default.join(import_node_os11.default.tmpdir(), "peach-swift-libraries-"));
30974
31017
  const linked = /* @__PURE__ */ new Set();
30975
31018
  try {
30976
31019
  while (missing2.length) {
@@ -30993,7 +31036,7 @@ function swiftHostLibraryView(root, executables) {
30993
31036
  }
30994
31037
  async function installSwiftToolchain(release, sdk2, signal, compilerOnly = false) {
30995
31038
  const root = import_node_path41.default.resolve(swiftToolchainBin(release), "../..");
30996
- const owned = process.platform === "darwin" ? import_node_path41.default.join(import_node_os10.default.homedir(), "Library/Developer/Toolchains", `${release}.xctoolchain`) : import_node_path41.default.join(rnxHomeDir(), "swift", "toolchains", release);
31039
+ const owned = process.platform === "darwin" ? import_node_path41.default.join(import_node_os11.default.homedir(), "Library/Developer/Toolchains", `${release}.xctoolchain`) : import_node_path41.default.join(rnxHomeDir(), "swift", "toolchains", release);
30997
31040
  const selectedCompiler = process.platform === "darwin" && import_node_fs42.default.existsSync(import_node_path41.default.join(root, "usr/bin/swift"));
30998
31041
  const ownsCompiler = release.includes("-custom-") && root === owned && !selectedCompiler;
30999
31042
  const executables = ["swift", "swift-package", "swift-frontend", "wasm-ld"].map(
@@ -31108,13 +31151,13 @@ async function resolveSwiftPackageRequirementsAsync(requirements, destination, s
31108
31151
  import_node_fs42.default.rmSync(dir, { recursive: true, force: true });
31109
31152
  }
31110
31153
  }
31111
- var import_node_child_process25, import_node_fs42, import_node_os10, import_node_path41, import_node_util6, SWIFT_ENDPOINT_ENV, DEFAULT_SWIFT_ENDPOINT, installs, staleWarned, hostLibraryViews;
31154
+ var import_node_child_process25, import_node_fs42, import_node_os11, import_node_path41, import_node_util6, SWIFT_ENDPOINT_ENV, DEFAULT_SWIFT_ENDPOINT, installs, staleWarned, hostLibraryViews;
31112
31155
  var init_swift_distribution = __esm({
31113
31156
  "src/swift-distribution.ts"() {
31114
31157
  "use strict";
31115
31158
  import_node_child_process25 = require("node:child_process");
31116
31159
  import_node_fs42 = __toESM(require("node:fs"), 1);
31117
- import_node_os10 = __toESM(require("node:os"), 1);
31160
+ import_node_os11 = __toESM(require("node:os"), 1);
31118
31161
  import_node_path41 = __toESM(require("node:path"), 1);
31119
31162
  import_node_util6 = require("node:util");
31120
31163
  init_src();
@@ -31244,7 +31287,7 @@ function rootLockKey(root) {
31244
31287
  return import_node_path42.default.join(backingPath, ...missing2);
31245
31288
  }
31246
31289
  function swiftRootLocksDir() {
31247
- return import_node_path42.default.join((0, import_node_os11.homedir)(), ".peach", "cache", "swift-root-locks");
31290
+ return import_node_path42.default.join((0, import_node_os12.homedir)(), ".peach", "cache", "swift-root-locks");
31248
31291
  }
31249
31292
  function withSwiftRootReadHolds(work) {
31250
31293
  const holds = [];
@@ -31426,15 +31469,15 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
31426
31469
  (0, import_node_fs43.writeFileSync)(import_node_path42.default.join(directory2, name(held, "released")), "");
31427
31470
  }
31428
31471
  }
31429
- var import_node_async_hooks2, import_node_child_process26, import_node_crypto27, import_node_fs43, import_node_os11, import_node_path42, POLL_MS, INSPECT_ATTEMPTS, START_TOLERANCE_MS, name, swiftRootReadHolds;
31472
+ var import_node_async_hooks3, import_node_child_process26, import_node_crypto27, import_node_fs43, import_node_os12, import_node_path42, POLL_MS, INSPECT_ATTEMPTS, START_TOLERANCE_MS, name, swiftRootReadHolds;
31430
31473
  var init_swift_root_lock = __esm({
31431
31474
  "src/swift-root-lock.ts"() {
31432
31475
  "use strict";
31433
- import_node_async_hooks2 = require("node:async_hooks");
31476
+ import_node_async_hooks3 = require("node:async_hooks");
31434
31477
  import_node_child_process26 = require("node:child_process");
31435
31478
  import_node_crypto27 = require("node:crypto");
31436
31479
  import_node_fs43 = require("node:fs");
31437
- import_node_os11 = require("node:os");
31480
+ import_node_os12 = require("node:os");
31438
31481
  import_node_path42 = __toESM(require("node:path"), 1);
31439
31482
  init_process_group();
31440
31483
  init_process_table();
@@ -31442,7 +31485,7 @@ var init_swift_root_lock = __esm({
31442
31485
  INSPECT_ATTEMPTS = 5;
31443
31486
  START_TOLERANCE_MS = 2e3;
31444
31487
  name = (number3, suffix) => `${String(number3).padStart(12, "0")}.${suffix}`;
31445
- swiftRootReadHolds = new import_node_async_hooks2.AsyncLocalStorage();
31488
+ swiftRootReadHolds = new import_node_async_hooks3.AsyncLocalStorage();
31446
31489
  }
31447
31490
  });
31448
31491
 
@@ -31587,7 +31630,7 @@ function producerSettled(directory2) {
31587
31630
  const value = JSON.parse((0, import_node_fs44.readFileSync)(receipt, "utf8"));
31588
31631
  return isRecord(value) && value.released === true;
31589
31632
  }
31590
- function swiftSdkProducerCores(admitted, platform2 = process.platform, hostCpus = import_node_os12.default.availableParallelism()) {
31633
+ function swiftSdkProducerCores(admitted, platform2 = process.platform, hostCpus = import_node_os13.default.availableParallelism()) {
31591
31634
  const floor = platform2 === "linux" && hostCpus >= 64 ? 24 : 4;
31592
31635
  return Number.isSafeInteger(admitted) && admitted > 0 ? Math.max(floor, admitted) : floor;
31593
31636
  }
@@ -31734,14 +31777,14 @@ async function produceSwiftSdkImage(input) {
31734
31777
  await (0, import_promises5.setTimeout)(2e3, void 0, { signal: input.signal });
31735
31778
  }
31736
31779
  }
31737
- var import_node_child_process27, import_node_crypto29, import_node_fs44, import_node_os12, import_node_path43, import_promises5, import_node_util7, run, environmentNames, launcher;
31780
+ var import_node_child_process27, import_node_crypto29, import_node_fs44, import_node_os13, import_node_path43, import_promises5, import_node_util7, run, environmentNames, launcher;
31738
31781
  var init_swift_sdk_image_producer = __esm({
31739
31782
  "src/swift-sdk-image-producer.ts"() {
31740
31783
  "use strict";
31741
31784
  import_node_child_process27 = require("node:child_process");
31742
31785
  import_node_crypto29 = require("node:crypto");
31743
31786
  import_node_fs44 = require("node:fs");
31744
- import_node_os12 = __toESM(require("node:os"), 1);
31787
+ import_node_os13 = __toESM(require("node:os"), 1);
31745
31788
  import_node_path43 = __toESM(require("node:path"), 1);
31746
31789
  import_promises5 = require("node:timers/promises");
31747
31790
  import_node_util7 = require("node:util");
@@ -35601,7 +35644,7 @@ function swiftIcuAddress(icu) {
35601
35644
  function swiftIcuPacked(icu) {
35602
35645
  return memo(packedFiles, icu.sha256, async () => {
35603
35646
  const file = import_node_path49.default.join(
35604
- import_node_os13.default.homedir(),
35647
+ import_node_os14.default.homedir(),
35605
35648
  ".peach",
35606
35649
  "cache",
35607
35650
  "swift-brotli",
@@ -35628,7 +35671,7 @@ async function swiftIcuBundleAsset(icu) {
35628
35671
  contentType: "application/octet-stream"
35629
35672
  };
35630
35673
  }
35631
- var import_node_child_process31, import_node_crypto33, import_node_fs49, import_promises6, import_node_os13, import_node_path49, import_node_util10, import_node_zlib6, run4, deflate, compressBrotli, inflateGzip, ARCHIVE, MEMBER, raw, assets, packedFiles;
35674
+ var import_node_child_process31, import_node_crypto33, import_node_fs49, import_promises6, import_node_os14, import_node_path49, import_node_util10, import_node_zlib6, run4, deflate, compressBrotli, inflateGzip, ARCHIVE, MEMBER, raw, assets, packedFiles;
35632
35675
  var init_swift_icu = __esm({
35633
35676
  "src/swift-icu.ts"() {
35634
35677
  "use strict";
@@ -35636,7 +35679,7 @@ var init_swift_icu = __esm({
35636
35679
  import_node_crypto33 = require("node:crypto");
35637
35680
  import_node_fs49 = require("node:fs");
35638
35681
  import_promises6 = require("node:fs/promises");
35639
- import_node_os13 = __toESM(require("node:os"), 1);
35682
+ import_node_os14 = __toESM(require("node:os"), 1);
35640
35683
  import_node_path49 = __toESM(require("node:path"), 1);
35641
35684
  import_node_util10 = require("node:util");
35642
35685
  import_node_zlib6 = require("node:zlib");
@@ -35943,7 +35986,7 @@ var init_swift_objc_prebuilt = __esm({
35943
35986
 
35944
35987
  // src/swift-reproducible.ts
35945
35988
  function canonicalHomeDir() {
35946
- const home = import_node_os14.default.homedir();
35989
+ const home = import_node_os15.default.homedir();
35947
35990
  const dotPeach = import_node_path52.default.join(home, ".peach");
35948
35991
  if ((0, import_node_fs52.existsSync)(dotPeach)) {
35949
35992
  const realHome = import_node_path52.default.dirname((0, import_node_fs52.realpathSync)(dotPeach));
@@ -35965,12 +36008,12 @@ function swiftReproducibleBuildFlags(roots) {
35965
36008
  `-ffile-prefix-map=${map2}`
35966
36009
  ]);
35967
36010
  }
35968
- var import_node_fs52, import_node_os14, import_node_path52;
36011
+ var import_node_fs52, import_node_os15, import_node_path52;
35969
36012
  var init_swift_reproducible = __esm({
35970
36013
  "src/swift-reproducible.ts"() {
35971
36014
  "use strict";
35972
36015
  import_node_fs52 = require("node:fs");
35973
- import_node_os14 = __toESM(require("node:os"), 1);
36016
+ import_node_os15 = __toESM(require("node:os"), 1);
35974
36017
  import_node_path52 = __toESM(require("node:path"), 1);
35975
36018
  }
35976
36019
  });
@@ -36246,7 +36289,10 @@ function swiftPackagePrebuiltEntries(input, moduleRoot, toolchainBin) {
36246
36289
  const calls = manifestCalls(manifest, ["target"]);
36247
36290
  const platform2 = /platforms:\s*\[\.iOS\("([\d.]+)"\)\]/.exec(manifest)?.[1];
36248
36291
  if (!platform2) return [];
36249
- const sdkModules = swiftAvailableModules(moduleRoot, toolchainBin);
36292
+ const sdkModules = swiftAvailableModules(
36293
+ moduleRoot,
36294
+ typeof toolchainBin === "function" ? toolchainBin() : toolchainBin
36295
+ );
36250
36296
  return selected.flatMap(([name3, modules]) => {
36251
36297
  const prefix = `${SWIFT_REMOTE_PACKAGES_DIR}/${name3}/`;
36252
36298
  const members2 = targets.filter(
@@ -36463,7 +36509,7 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
36463
36509
  }
36464
36510
  }
36465
36511
  function swiftCompilerJobs() {
36466
- return Math.min(64, swiftBuildJobs(), Math.max(1, Math.floor(import_node_os15.default.totalmem() / 2 ** 31)));
36512
+ return Math.min(64, swiftBuildJobs(), Math.max(1, Math.floor(import_node_os16.default.totalmem() / 2 ** 31)));
36467
36513
  }
36468
36514
  function swiftCompilerBaseEnv(toolchainBin, sourceEnv, includePeachHome = false) {
36469
36515
  const env = {};
@@ -37819,6 +37865,8 @@ function swiftSourceClosure(files2, roots) {
37819
37865
  return collectSwiftSourceClosure(files2, roots, swiftCodeMask);
37820
37866
  }
37821
37867
  function swiftApplicationEntry(file, source) {
37868
+ if (!source.includes("@main") && !source.includes("@UIApplicationMain") && !(import_node_path56.default.basename(file) === "main.swift" && source.includes("UIApplicationMain")))
37869
+ return false;
37822
37870
  const code = [...swiftConditionalLines(swiftCodeMask(source))].map(({ line, active }) => active === false ? " ".repeat(line.length) : line).join("\n");
37823
37871
  const { tokens: tokens2 } = swiftCodeScan(code);
37824
37872
  let depth = 0;
@@ -39674,7 +39722,7 @@ ${entry}`);
39674
39722
  files2.set(
39675
39723
  clangWrapper2,
39676
39724
  [
39677
- "#!/bin/sh",
39725
+ "#!/bin/bash",
39678
39726
  "name=",
39679
39727
  "explicit=",
39680
39728
  ...prebuiltCompiler.length ? ["module="] : [],
@@ -39725,19 +39773,20 @@ ${entry}`);
39725
39773
  // a target that turns modules off keeps them off: the toolset appends its
39726
39774
  // module flags after the target settings, which darwin swiftpm puts last.
39727
39775
  'if [ -n "$standard$cxxModulesOff$modulesOff" ]; then',
39776
+ " args=()",
39728
39777
  ' for arg in "$@"; do',
39729
39778
  ' case "$language:$arg" in',
39730
39779
  " *++:-std=*++*) ;;",
39731
- " *++:-std=*|c:-std=*++*|objective-c:-std=*++*) shift; continue ;;",
39780
+ " *++:-std=*|c:-std=*++*|objective-c:-std=*++*) continue ;;",
39732
39781
  " esac",
39733
- " shift",
39734
39782
  ' case "$modulesOff:$arg" in 1:-fmodules|1:-fmodules-cache-path=*) continue ;; esac',
39735
39783
  ' case "$cxxModulesOff:$language:$arg" in',
39736
39784
  " 1:*:-fmodules-cache-path=*) ;;",
39737
39785
  " 1:c++:-fmodule-map-file=*/.build/*/*.build/module.modulemap) ;;",
39738
- ' *) set -- "$@" "$arg" ;;',
39786
+ ' *) args+=("$arg") ;;',
39739
39787
  " esac",
39740
39788
  " done",
39789
+ ' set -- "${args[@]}"',
39741
39790
  "fi",
39742
39791
  'if [ -n "$name" ] && [ -z "$explicit" ]; then set -- "-fmodule-name=$name" "$@"; fi',
39743
39792
  ...prebuiltCompiler,
@@ -40578,8 +40627,8 @@ function readFrameworkProductsReceipt(scratch2, receiptKey, planChangedAt = 0n)
40578
40627
  function resolveBunBinary() {
40579
40628
  if (import_node_path56.default.basename(process.execPath).startsWith("bun")) return process.execPath;
40580
40629
  for (const candidate of [
40581
- import_node_path56.default.join(import_node_os15.default.homedir(), "builders/bun/bin/bun"),
40582
- import_node_path56.default.join(import_node_os15.default.homedir(), ".bun/bin/bun"),
40630
+ import_node_path56.default.join(import_node_os16.default.homedir(), "builders/bun/bin/bun"),
40631
+ import_node_path56.default.join(import_node_os16.default.homedir(), ".bun/bin/bun"),
40583
40632
  "/opt/homebrew/bin/bun",
40584
40633
  "/usr/local/bin/bun",
40585
40634
  "bun"
@@ -40926,18 +40975,18 @@ ${args.frameworkKey}`,
40926
40975
  function swiftFrameworkSlotCount(unoptimized) {
40927
40976
  const base2 = unoptimized ? SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS : SWIFT_FRAMEWORK_SLOTS;
40928
40977
  if (process.platform === "darwin") {
40929
- const gib = import_node_os15.default.totalmem() / (1024 * 1024 * 1024);
40978
+ const gib = import_node_os16.default.totalmem() / (1024 * 1024 * 1024);
40930
40979
  if (gib >= 120) return unoptimized ? 8 : 16;
40931
40980
  if (gib >= 56) return unoptimized ? 6 : 12;
40932
40981
  return base2;
40933
40982
  }
40934
40983
  if (process.platform !== "linux") return base2;
40935
- const cores = import_node_os15.default.availableParallelism();
40984
+ const cores = import_node_os16.default.availableParallelism();
40936
40985
  return unoptimized ? Math.min(8, Math.max(base2, Math.floor(cores / 16))) : Math.min(16, Math.max(base2, Math.floor(cores / 8)));
40937
40986
  }
40938
40987
  function swiftBuildRootSlotCount() {
40939
40988
  if (process.platform !== "linux") return SWIFT_BUILD_ROOT_SLOTS;
40940
- return import_node_os15.default.availableParallelism() >= 64 ? 8 : SWIFT_BUILD_ROOT_SLOTS;
40989
+ return import_node_os16.default.availableParallelism() >= 64 ? 8 : SWIFT_BUILD_ROOT_SLOTS;
40941
40990
  }
40942
40991
  function swiftFrameworksDir(unoptimized = false) {
40943
40992
  return import_node_path56.default.join(
@@ -41335,818 +41384,865 @@ async function compileSwiftProjectUnit(input, options2) {
41335
41384
  }
41336
41385
  }
41337
41386
  async function compileSwiftProjectOnce(sources, options2) {
41338
- options2.signal?.throwIfAborted();
41339
- assertSwiftBuildCores();
41340
- (0, import_node_fs55.mkdirSync)(options2.buildRoot, { recursive: true });
41341
- const root = (0, import_node_fs55.realpathSync)(options2.buildRoot);
41342
- refreshSwiftCacheHold(root);
41343
- const moduleRoot = import_node_path56.default.resolve(options2.moduleRoot);
41344
- const distribution = swiftDistributionAt(moduleRoot);
41345
- const mirrorDistribution = options2.linkOnly || options2.project ? null : distribution;
41346
- if (distribution) refreshSwiftCacheHold(moduleRoot);
41347
- const input = distribution && !options2.intermediates ? (await Promise.resolve().then(() => (init_swift_package_prebuilt(), swift_package_prebuilt_exports))).useSwiftPackagePrebuilts(
41348
- sources,
41349
- moduleRoot,
41350
- options2.toolchainBin
41351
- ) : sources;
41352
- const guestGraph = distribution ? input.sourceLinkGraph : void 0;
41353
- if (options2.linkOnly && guestGraph)
41354
- throw new Error("swift-compile: link-only builds do not support guest image graphs");
41355
- const layout2 = {
41356
- root,
41357
- sources: import_node_path56.default.join(root, "Sources", "App"),
41358
- multi: compileTargets(input).length > 0
41359
- };
41360
- const sdkImage = options2.linkOnly ? void 0 : await (await Promise.resolve().then(() => (init_swift_sdk_image(), swift_sdk_image_exports))).buildSwiftSdkImage(
41361
- moduleRoot,
41362
- !!guestGraph,
41363
- distribution ? [] : linkedFrameworkTargets(moduleRoot, input).imports,
41364
- { signal: options2.signal }
41365
- );
41366
- const inputHash = swiftCompileInputHash(input, options2.release);
41367
- const moduleDigest = swiftModuleDigest(moduleRoot);
41368
- const sourceHash = inputHash.copy().update(moduleDigest).digest("hex");
41369
- const hash = sdkImage ? swiftSdkArtifactHash(sourceHash, sdkImage.key) : sourceHash;
41370
- const frameworkKey = swiftProjectBuildKey(moduleRoot, options2.release);
41371
- const sharedRoot = import_node_path56.default.join(swiftCacheDir(), "swift-projects", hash);
41372
- const report = (message) => {
41373
- console.error(`[swift-project ${hash.slice(0, 16)}] ${message}`);
41374
- options2.onStage?.(message);
41375
- };
41376
- return serialize(
41377
- root,
41378
- async () => {
41379
- if (!options2.intermediates) {
41380
- report("checking verified artifacts");
41381
- const retained = retainedArtifacts.get(root)?.find((old) => old.hash === hash);
41382
- if (retained) {
41383
- report("reusing memory artifact");
41384
- return retain(root, retained);
41385
- }
41386
- const cached2 = readCompiledArtifact(import_node_path56.default.join(sharedRoot, "artifact"), hash);
41387
- const previous = cached2 ?? (options2.project ? null : readCompiledArtifact(import_node_path56.default.join(root, "artifact"), hash));
41388
- if (previous) {
41389
- if (cached2) renewSharedArtifact(sharedRoot);
41390
- else saveSharedArtifact(sharedRoot, previous);
41391
- report("reusing verified disk artifact");
41392
- return retain(root, previous);
41393
- }
41394
- }
41395
- const baseRoot = root;
41396
- const canPoolBuildRoot = !options2.intermediates && !options2.project && !options2.linkOnly && import_node_path56.default.basename(import_node_path56.default.dirname(baseRoot)) === "swift-builds";
41397
- const compatShapeParts = canPoolBuildRoot ? [
41398
- distribution ? options2.release : frameworkKey,
41399
- compileTargets(input).map((target) => target.name).sort(),
41400
- input.oneModule === true,
41401
- input.optimize === true,
41402
- input.unoptimized === true
41403
- ] : null;
41404
- const compatShape = compatShapeParts ? (0, import_node_crypto36.createHash)("sha256").update(JSON.stringify(compatShapeParts)).digest("hex").slice(0, 16) : "";
41405
- const exactShape = compatShapeParts ? (0, import_node_crypto36.createHash)("sha256").update(
41406
- JSON.stringify([...compatShapeParts, Object.keys(input.files).sort()])
41407
- ).digest("hex").slice(0, 16) : "";
41408
- const buildShape = compatShapeParts ? `${exactShape}
41409
- ${compatShape}` : "";
41410
- return withSwiftCompileBudget(options2.timeoutMs, options2.signal, async (budget) => {
41411
- const stage = (message) => {
41412
- budget.progress();
41413
- report(message);
41414
- };
41415
- const runLocked = (work) => {
41416
- const runInBuildRoot = () => {
41417
- if (canPoolBuildRoot)
41418
- return withSwiftBuildRootSlot(
41419
- baseRoot,
41420
- exactShape,
41421
- compatShape,
41422
- budget.signal,
41423
- work
41424
- );
41425
- const waitStart = Date.now();
41426
- return withSwiftRootLock(
41427
- baseRoot,
41428
- (lease) => work(baseRoot, lease, Date.now() - waitStart),
41429
- budget.signal
41430
- );
41431
- };
41432
- if (options2.intermediates || baseRoot === sharedRoot) return runInBuildRoot();
41433
- return withSwiftRootLock(
41434
- sharedRoot,
41435
- async () => {
41436
- const built2 = readCompiledArtifact(import_node_path56.default.join(sharedRoot, "artifact"), hash);
41437
- if (built2) {
41438
- renewSharedArtifact(sharedRoot);
41439
- stage("reusing verified disk artifact");
41440
- return retain(baseRoot, built2);
41441
- }
41442
- return runInBuildRoot();
41443
- },
41444
- budget.signal
41445
- );
41446
- };
41447
- return runLocked(async (slotRoot, lease, waitedMs) => {
41448
- const root2 = slotRoot;
41449
- const layout3 = {
41450
- root: root2,
41451
- sources: import_node_path56.default.join(root2, "Sources", "App"),
41452
- multi: compileTargets(input).length > 0
41453
- };
41454
- if (!options2.intermediates) {
41455
- const built2 = readCompiledArtifact(import_node_path56.default.join(sharedRoot, "artifact"), hash);
41456
- if (built2) {
41457
- stage("reusing verified disk artifact");
41458
- return retain(baseRoot, built2);
41459
- }
41460
- }
41461
- if (waitedMs >= 1e3)
41462
- report(`acquired build root ${import_node_path56.default.basename(root2)} after ${waitedMs}ms`);
41463
- if (canPoolBuildRoot) {
41464
- refreshSwiftCacheHold(root2);
41465
- (0, import_node_fs55.writeFileSync)(import_node_path56.default.join(root2, SWIFT_BUILD_ROOT_SHAPE), buildShape);
41387
+ return withSwiftModuleDigestScope(async () => {
41388
+ options2.signal?.throwIfAborted();
41389
+ (0, import_node_fs55.mkdirSync)(options2.buildRoot, { recursive: true });
41390
+ const root = (0, import_node_fs55.realpathSync)(options2.buildRoot);
41391
+ refreshSwiftCacheHold(root);
41392
+ const moduleRoot = import_node_path56.default.resolve(options2.moduleRoot);
41393
+ const distribution = swiftDistributionAt(moduleRoot);
41394
+ const mirrorDistribution = options2.linkOnly || options2.project ? null : distribution;
41395
+ if (distribution) refreshSwiftCacheHold(moduleRoot);
41396
+ let resolvedToolchainBin = options2.toolchainBin;
41397
+ const resolveToolchainBin = () => {
41398
+ if (resolvedToolchainBin) return resolvedToolchainBin;
41399
+ if (!options2.resolveToolchain)
41400
+ throw new Error("swift-compile: missing toolchainBin");
41401
+ resolvedToolchainBin = options2.resolveToolchain();
41402
+ return resolvedToolchainBin;
41403
+ };
41404
+ const input = distribution && !options2.intermediates ? (await Promise.resolve().then(() => (init_swift_package_prebuilt(), swift_package_prebuilt_exports))).useSwiftPackagePrebuilts(
41405
+ sources,
41406
+ moduleRoot,
41407
+ resolveToolchainBin
41408
+ ) : sources;
41409
+ const guestGraph = distribution ? input.sourceLinkGraph : void 0;
41410
+ if (options2.linkOnly && guestGraph)
41411
+ throw new Error("swift-compile: link-only builds do not support guest image graphs");
41412
+ const layout2 = {
41413
+ root,
41414
+ sources: import_node_path56.default.join(root, "Sources", "App"),
41415
+ multi: compileTargets(input).length > 0
41416
+ };
41417
+ const sdkImage = options2.linkOnly ? void 0 : await (await Promise.resolve().then(() => (init_swift_sdk_image(), swift_sdk_image_exports))).buildSwiftSdkImage(
41418
+ moduleRoot,
41419
+ !!guestGraph,
41420
+ distribution ? [] : linkedFrameworkTargets(moduleRoot, input).imports,
41421
+ { signal: options2.signal }
41422
+ );
41423
+ const inputHash = swiftCompileInputHash(input, options2.release);
41424
+ const moduleDigest = swiftModuleDigest(moduleRoot);
41425
+ const sourceHash = inputHash.copy().update(moduleDigest).digest("hex");
41426
+ const hash = sdkImage ? swiftSdkArtifactHash(sourceHash, sdkImage.key) : sourceHash;
41427
+ const sharedRoot = import_node_path56.default.join(swiftCacheDir(), "swift-projects", hash);
41428
+ const report = (message) => {
41429
+ console.error(`[swift-project ${hash.slice(0, 16)}] ${message}`);
41430
+ options2.onStage?.(message);
41431
+ };
41432
+ return serialize(
41433
+ root,
41434
+ async () => {
41435
+ if (!options2.intermediates) {
41436
+ report("checking verified artifacts");
41437
+ const retained = retainedArtifacts.get(root)?.find((old) => old.hash === hash);
41438
+ if (retained) {
41439
+ report("reusing memory artifact");
41440
+ return retain(root, retained);
41466
41441
  }
41467
- const swift = import_node_path56.default.join(options2.toolchainBin, "swift");
41468
- if (!(0, import_node_fs55.existsSync)(swift)) {
41469
- throw new Error(
41470
- `swift-compile: no swift.org toolchain at ${options2.toolchainBin}; install ${options2.release} and its matching wasm sdk`
41471
- );
41442
+ const cached2 = readCompiledArtifact(import_node_path56.default.join(sharedRoot, "artifact"), hash);
41443
+ const previous = cached2 ?? (options2.project ? null : readCompiledArtifact(import_node_path56.default.join(root, "artifact"), hash));
41444
+ if (previous) {
41445
+ if (cached2) renewSharedArtifact(sharedRoot);
41446
+ else saveSharedArtifact(sharedRoot, previous);
41447
+ report("reusing verified disk artifact");
41448
+ return retain(root, previous);
41472
41449
  }
41473
- const unoptimized = input.unoptimized === true;
41474
- const baseBuildEnv = options2.project?.env ? {
41475
- ...options2.project.env,
41476
- // shipped host plugins resolve against the selected compiler's runtime.
41477
- ...process.platform === "linux" ? {
41478
- LD_LIBRARY_PATH: [
41479
- import_node_path56.default.resolve(options2.toolchainBin, "../lib/swift/linux"),
41480
- import_node_path56.default.resolve(options2.toolchainBin, "../lib/swift/host"),
41481
- process.env.LD_LIBRARY_PATH
41482
- ].filter(Boolean).join(":")
41483
- } : {},
41484
- PEACH_DEFER_WASM_LINK: "1"
41485
- } : swiftCompilerBaseEnv(options2.toolchainBin, process.env);
41486
- const prepareFrameworks = async (slot, frameworkLease, allowWrite = true) => {
41487
- if (allowWrite) budget.startCompile();
41488
- const frameworkRoot2 = mirrorDistribution ? syncSwiftDistributionMirror(root2, moduleRoot, mirrorDistribution) : distribution ? moduleRoot : stageFrameworkSource(moduleRoot, slot, frameworkKey, options2.release);
41489
- if (!swiftModuleDigest(frameworkRoot2).equals(moduleDigest))
41490
- throw new Error("Swift staged project source differs from the caller");
41491
- if (!allowWrite && swiftMacroPlugins(frameworkRoot2).stale) return;
41492
- if (allowWrite) stage("preparing compiler plugins");
41493
- const macroPlugins2 = await ensureMacroPlugins(
41494
- frameworkRoot2,
41495
- options2.toolchainBin,
41496
- options2.release,
41497
- budget.signal,
41498
- frameworkLease
41499
- );
41500
- const compileFrameworkRoot2 = distribution ? swiftDistributionCompileView(frameworkRoot2, distribution) : frameworkRoot2;
41501
- const sdk2 = swiftModuleSdk(frameworkRoot2).wasmSdkId;
41502
- const compileSdk2 = mirrorDistribution ? syncSwiftSdkMirror(root2, frameworkRoot2, options2.toolchainBin, sdk2) : {
41503
- id: sdk2,
41504
- options: swiftCompileSdkOptions(frameworkRoot2, options2.toolchainBin),
41505
- toolsetChanged: false
41450
+ }
41451
+ assertSwiftBuildCores();
41452
+ const toolchainBin = resolveToolchainBin();
41453
+ await options2.beforeCompile?.(toolchainBin);
41454
+ clearSwiftModuleDigestScope(moduleRoot);
41455
+ const frameworkKey = swiftProjectBuildKey(moduleRoot, options2.release);
41456
+ const baseRoot = root;
41457
+ const canPoolBuildRoot = !options2.intermediates && !options2.project && !options2.linkOnly && import_node_path56.default.basename(import_node_path56.default.dirname(baseRoot)) === "swift-builds";
41458
+ const compatShapeParts = canPoolBuildRoot ? [
41459
+ distribution ? options2.release : frameworkKey,
41460
+ compileTargets(input).map((target) => target.name).sort(),
41461
+ input.oneModule === true,
41462
+ input.optimize === true,
41463
+ input.unoptimized === true
41464
+ ] : null;
41465
+ const compatShape = compatShapeParts ? (0, import_node_crypto36.createHash)("sha256").update(JSON.stringify(compatShapeParts)).digest("hex").slice(0, 16) : "";
41466
+ const exactShape = compatShapeParts ? (0, import_node_crypto36.createHash)("sha256").update(
41467
+ JSON.stringify([...compatShapeParts, Object.keys(input.files).sort()])
41468
+ ).digest("hex").slice(0, 16) : "";
41469
+ const buildShape = compatShapeParts ? `${exactShape}
41470
+ ${compatShape}` : "";
41471
+ return withSwiftCompileBudget(
41472
+ options2.timeoutMs,
41473
+ options2.signal,
41474
+ async (budget) => {
41475
+ const stage = (message) => {
41476
+ budget.progress();
41477
+ report(message);
41506
41478
  };
41507
- if (mirrorDistribution && compileSdk2.toolsetChanged)
41508
- clearSwiftSdkPathsCache(import_node_path56.default.join(root2, SWIFT_SDK_MIRROR));
41509
- const icu2 = options2.linkOnly ? null : swiftIcuAsset(options2.toolchainBin, sdk2);
41510
- let prebuilt2;
41511
- if (!distribution) {
41512
- if (allowWrite) stage("compiling framework products");
41513
- prebuilt2 = await buildFrameworkProducts(
41514
- slot,
41515
- {
41516
- moduleRoot: frameworkRoot2,
41517
- frameworkKey,
41518
- input,
41519
- swift,
41520
- sdk: sdk2,
41521
- toolchainBin: options2.toolchainBin,
41522
- plugins: macroPlugins2,
41523
- buildOptions: {
41524
- env: baseBuildEnv,
41525
- maxBuffer: 64 * 1024 * 1024,
41526
- signal: budget.signal,
41527
- onOutput: budget.progress,
41528
- lease,
41529
- frameworkLease
41479
+ const runLocked = (work) => {
41480
+ const runInBuildRoot = () => {
41481
+ if (canPoolBuildRoot)
41482
+ return withSwiftBuildRootSlot(
41483
+ baseRoot,
41484
+ exactShape,
41485
+ compatShape,
41486
+ budget.signal,
41487
+ work
41488
+ );
41489
+ const waitStart = Date.now();
41490
+ return withSwiftRootLock(
41491
+ baseRoot,
41492
+ (lease) => work(baseRoot, lease, Date.now() - waitStart),
41493
+ budget.signal
41494
+ );
41495
+ };
41496
+ if (options2.intermediates || baseRoot === sharedRoot)
41497
+ return runInBuildRoot();
41498
+ return withSwiftRootLock(
41499
+ sharedRoot,
41500
+ async () => {
41501
+ const built2 = readCompiledArtifact(
41502
+ import_node_path56.default.join(sharedRoot, "artifact"),
41503
+ hash
41504
+ );
41505
+ if (built2) {
41506
+ renewSharedArtifact(sharedRoot);
41507
+ stage("reusing verified disk artifact");
41508
+ return retain(baseRoot, built2);
41530
41509
  }
41510
+ return runInBuildRoot();
41531
41511
  },
41532
- allowWrite
41512
+ budget.signal
41533
41513
  );
41534
- if (!prebuilt2) return;
41535
- if (!allowWrite) {
41536
- budget.startCompile();
41537
- stage("reusing verified framework products");
41538
- }
41539
- }
41540
- const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
41541
- return {
41542
- frameworkRoot: frameworkRoot2,
41543
- compileFrameworkRoot: compileFrameworkRoot2,
41544
- macroPlugins: macroPlugins2,
41545
- sdk: sdk2,
41546
- compileSdk: compileSdk2,
41547
- icu: icu2,
41548
- prebuilt: prebuilt2,
41549
- readHold: readHold2
41550
41514
  };
41551
- };
41552
- const frameworks = distribution ? await prepareFrameworks(null) : await withSwiftFrameworkSlot(
41553
- frameworkKey,
41554
- options2.release,
41555
- moduleRoot,
41556
- budget.signal,
41557
- prepareFrameworks,
41558
- unoptimized,
41559
- options2.linkOnly === true
41560
- );
41561
- if (!frameworks)
41562
- throw new Error("Swift distribution did not provide its frameworks");
41563
- const {
41564
- frameworkRoot,
41565
- compileFrameworkRoot,
41566
- macroPlugins,
41567
- compileSdk,
41568
- icu,
41569
- prebuilt
41570
- } = frameworks;
41571
- let readHold = frameworks.readHold;
41572
- const buildOptions = {
41573
- env: baseBuildEnv,
41574
- maxBuffer: 64 * 1024 * 1024,
41575
- signal: budget.signal,
41576
- onOutput: budget.progress,
41577
- lease
41578
- };
41579
- try {
41580
- if (options2.project) removeProjectLinks(root2);
41581
- const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
41582
- if (retireStaleSwiftLink(
41583
- root2,
41584
- swiftLinkStamp({
41585
- frameworkKey: mirrorDistribution ? `${options2.release}\0mirror` : `${options2.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
41586
- packageHostMacros
41587
- }),
41588
- swiftLinkStamp({
41589
- // mirrored distributions and their WASI SDK mirror invalidate
41590
- // dependents per changed file instead of wiping every Clang object.
41591
- frameworkKey: mirrorDistribution ? `${options2.release}\0mirror` : distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
41592
- prebuilt,
41593
- packageHostMacros
41594
- }),
41595
- Boolean(options2.linkOnly)
41596
- ))
41597
- stage("framework revision changed; rebuilding the app link");
41598
- const nativeToolset = needsNativeToolset(input, prebuilt);
41599
- const preparation = writeSwiftProject(
41600
- layout3,
41601
- input,
41602
- frameworkRoot,
41603
- prebuilt,
41604
- !options2.project,
41605
- options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0),
41606
- compileSdk
41607
- );
41608
- const productFile = import_node_path56.default.join(frameworkRoot, SWIFT_FRAMEWORK_PRODUCT_FILE);
41609
- writeSwiftAutolinkLinker(
41610
- root2,
41611
- options2.toolchainBin,
41612
- (0, import_node_fs55.existsSync)(productFile) ? [
41613
- v6.parse(
41614
- swiftFrameworkProductSchema,
41615
- JSON.parse((0, import_node_fs55.readFileSync)(productFile, "utf8"))
41616
- ).product.name
41617
- ] : []
41618
- );
41619
- const compiler = preparation.targetToolset ? { CC: import_node_path56.default.join(root2, CLANG_TARGET_MODULE_WRAPPER) } : {};
41620
- if (packageHostMacros?.length) {
41621
- const swiftc = import_node_path56.default.join(root2, SWIFT_HOST_COMPILER_WRAPPER);
41622
- writeBuildFile(
41623
- swiftc,
41624
- [
41625
- "#!/bin/sh",
41626
- "target=",
41627
- "module=",
41628
- "compile=",
41629
- "previous=",
41630
- "for argument do",
41631
- ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
41632
- ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
41633
- " previous=$argument",
41634
- "done",
41635
- 'case "$target/$compile" in',
41636
- " *-*-linux*/1)",
41637
- ' case ",$PEACH_SWIFT_HOST_MACROS," in',
41638
- ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
41639
- " esac ;;",
41640
- "esac",
41641
- 'exec "$PEACH_SWIFTC" "$@"',
41642
- ""
41643
- ].join("\n")
41644
- );
41645
- (0, import_node_fs55.chmodSync)(swiftc, 493);
41646
- compiler.SWIFT_EXEC = swiftc;
41647
- compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
41648
- compiler.PEACH_SWIFTC = import_node_path56.default.join(options2.toolchainBin, "swiftc");
41649
- }
41650
- const projectProcess = options2.project ? prepareSwiftProjectProcess(root2, options2.project) : void 0;
41651
- const temporaryDirectory = projectProcess ? void 0 : import_node_path56.default.join(root2, ".build", "peach-compiler-tmp");
41652
- const appOptions = projectProcess ? {
41653
- ...buildOptions,
41654
- uid: projectProcess.uid,
41655
- gid: projectProcess.gid,
41656
- confined: { ...projectProcess.env, ...compiler }
41657
- } : {
41658
- ...buildOptions,
41659
- temporaryDirectory,
41660
- env: {
41661
- ...buildOptions.env,
41662
- ...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
41663
- ...compiler
41664
- }
41665
- };
41666
- const unprepared = preparation.targetFailures.map(
41667
- (failure2) => `error: target ${failure2}`
41668
- );
41669
- const forwarders = /* @__PURE__ */ new Map();
41670
- for (const [file, text7] of Object.entries(input.files)) {
41671
- const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text7)?.[1];
41672
- if (!parents) continue;
41673
- const directory2 = import_node_path56.default.posix.dirname(file);
41674
- forwarders.set(
41675
- `${import_node_path56.default.join(root2, directory2)}/${parents.slice(0, -1)}`,
41676
- import_node_path56.default.posix.join("build", directory2, parents).replace(/\/$/, "")
41677
- );
41678
- }
41679
- const jobs = swiftCompilerJobs();
41680
- const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
41681
- const batchGuest = guestGraph !== void 0 && !options2.project && !input.unoptimized;
41682
- const guestDriverJobs = Math.min(8, jobs);
41683
- const singleProducerJobs = Math.min(16, Math.floor(jobs / 2));
41684
- const batch = incrementalPreview || batchGuest;
41685
- const perFile = input.unoptimized || batch;
41686
- const reproducibleFrameworkRoot = mirrorDistribution ? frameworkRoot : compileFrameworkRoot;
41687
- const buildArgs = [
41688
- "build",
41689
- ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
41690
- "--build-system",
41691
- "native",
41692
- "-j",
41693
- String(jobs),
41694
- "--package-path",
41695
- root2,
41696
- ...compileSdk.options,
41697
- ...swiftObjCSelectorOptions(frameworkRoot),
41698
- "--swift-sdk",
41699
- compileSdk.id,
41700
- ...preparation.targetToolset ? ["--toolset", import_node_path56.default.join(root2, ".peach-target-toolset.json")] : [],
41701
- "-c",
41702
- "release",
41703
- ...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
41704
- ...perFile ? [
41705
- "-Xswiftc",
41706
- "-no-whole-module-optimization",
41707
- "-Xswiftc",
41708
- "-j",
41709
- "-Xswiftc",
41710
- String(batchGuest ? guestDriverJobs : jobs)
41711
- ] : [],
41712
- // optimized batches can move specialized definitions between objects.
41713
- ...incrementalPreview ? ["-Xswiftc", "-incremental"] : [],
41714
- ...batch ? ["-Xswiftc", "-enable-batch-mode"] : [],
41715
- // the mirror finds a changed sdk header's readers in their
41716
- // dependency files, which omit system headers by default
41717
- ...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
41718
- // the link strips debug info, so none is generated (as for the framework).
41719
- // keep -num-threads fixed across caller core caps so llbuild does not
41720
- // rebuild every target when callers alternate --cores, and bound backend
41721
- // fan-out under high -j.
41722
- "-Xswiftc",
41723
- "-gnone",
41724
- "-Xcc",
41725
- "-g0",
41726
- "-Xcxx",
41727
- "-g0",
41728
- ...batch ? [] : [
41729
- "-Xswiftc",
41730
- "-num-threads",
41731
- "-Xswiftc",
41732
- String(perFile ? 1 : Math.min(8, import_node_os15.default.availableParallelism()))
41733
- ],
41734
- ...swiftReproducibleBuildFlags([
41735
- [import_node_path56.default.dirname(options2.toolchainBin), "toolchain"],
41736
- [reproducibleFrameworkRoot, "framework"],
41737
- [root2, "build"],
41738
- ...forwarders
41739
- ]).flatMap((flag, index, flags) => {
41740
- if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
41741
- return [flag];
41742
- const toolchainDir = import_node_path56.default.dirname(options2.toolchainBin);
41743
- let mapped = flag;
41744
- for (const [dir, target] of [
41745
- [root2, "/peach/build"],
41746
- [reproducibleFrameworkRoot, "/peach/framework"],
41747
- [(0, import_node_fs55.realpathSync)(reproducibleFrameworkRoot), "/peach/framework"],
41748
- [toolchainDir, "/peach/toolchain"],
41749
- [(0, import_node_fs55.realpathSync)(toolchainDir), "/peach/toolchain"]
41750
- ]) {
41751
- mapped = mapped.replaceAll(dir, target);
41515
+ return runLocked(async (slotRoot, lease, waitedMs) => {
41516
+ const root2 = slotRoot;
41517
+ const layout3 = {
41518
+ root: root2,
41519
+ sources: import_node_path56.default.join(root2, "Sources", "App"),
41520
+ multi: compileTargets(input).length > 0
41521
+ };
41522
+ if (!options2.intermediates) {
41523
+ const built2 = readCompiledArtifact(
41524
+ import_node_path56.default.join(sharedRoot, "artifact"),
41525
+ hash
41526
+ );
41527
+ if (built2) {
41528
+ stage("reusing verified disk artifact");
41529
+ return retain(baseRoot, built2);
41752
41530
  }
41753
- const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
41754
- const tool = flags[index - 1];
41755
- return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
41756
- }),
41757
- ...macroPlugins.libraries.flatMap((plugin) => [
41758
- "-Xswiftc",
41759
- "-load-plugin-library",
41760
- "-Xswiftc",
41761
- plugin
41762
- ]),
41763
- ...macroPlugins.executables.flatMap((plugin) => [
41764
- "-Xswiftc",
41765
- "-load-plugin-executable",
41766
- "-Xswiftc",
41767
- `${plugin}#ExpoModulesMacros`
41768
- ])
41769
- ];
41770
- const linked = builtArtifact(layout3);
41771
- (0, import_node_fs55.rmSync)(import_node_path56.default.join(root2, ".peach-link.rsp"), { force: true });
41772
- if (options2.linkOnly || (0, import_node_fs55.existsSync)(linked) && (0, import_node_fs55.statSync)(linked).size <= 8)
41773
- (0, import_node_fs55.rmSync)(linked, { force: true });
41774
- stage("compiling and linking Swift modules");
41775
- const frameworkInterfaces = /* @__PURE__ */ new Map();
41776
- const compileSdkPaths = swiftSdkPaths(
41777
- frameworkRoot,
41778
- options2.toolchainBin,
41779
- compileSdk.options,
41780
- compileSdk.id
41781
- );
41782
- const sdkFrameworks = import_node_path56.default.join(
41783
- compileSdkPaths.darwin,
41784
- "System/Library/Frameworks"
41785
- );
41786
- const generatedInterface = (source) => withoutImportedSdkEnumForwards(
41787
- clangInterfaceHeader((0, import_node_fs55.readFileSync)(source, "utf8"), frameworkRoot),
41788
- sdkObjCDeclarationOwners(sdkFrameworks)
41789
- );
41790
- const nativeDeclarations = /* @__PURE__ */ new Map();
41791
- const nativeHeaders = Object.entries(input.files).filter(([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")).map(([, source]) => source);
41792
- for (const [file, contents2] of Object.entries(input.files)) {
41793
- if (!file.endsWith(".modulemap")) continue;
41794
- const name3 = moduleMapName(contents2);
41795
- const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents2)?.[1];
41796
- if (!name3 || !umbrella) continue;
41797
- const header = input.files[import_node_path56.default.posix.join(import_node_path56.default.posix.dirname(file), umbrella)];
41798
- if (header === void 0) continue;
41799
- const included = new Set(
41800
- [
41801
- ...header.matchAll(/^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm)
41802
- ].map((match) => import_node_path56.default.posix.basename(match[1]))
41803
- );
41804
- const declarations = nativeDeclarations.get(name3) ?? /* @__PURE__ */ new Set();
41805
- for (const declaration of swiftInterfaceDeclarations(header))
41806
- declarations.add(declaration);
41807
- for (const [candidate, source] of Object.entries(input.files))
41808
- if (included.has(import_node_path56.default.posix.basename(candidate)))
41809
- for (const declaration of swiftInterfaceDeclarations(source))
41810
- declarations.add(declaration);
41811
- nativeDeclarations.set(name3, declarations);
41812
- }
41813
- const frameworkInterface = (name3) => {
41814
- if (frameworkInterfaces.has(name3)) return frameworkInterfaces.get(name3);
41815
- const source = distribution ? import_node_path56.default.join(frameworkRoot, "modules", `${name3}-Swift.h`) : prebuilt.objcHeaders.get(name3);
41816
- if (!source || !(0, import_node_fs55.existsSync)(source)) {
41817
- frameworkInterfaces.set(name3, null);
41818
- return null;
41819
41531
  }
41820
- const headers = import_node_path56.default.join(sdkFrameworks, `${name3}.framework/Headers`);
41821
- const declared = /* @__PURE__ */ new Set();
41822
- if ((0, import_node_fs55.existsSync)(headers)) {
41823
- for (const file of (0, import_node_fs55.readdirSync)(headers, {
41824
- recursive: true,
41825
- encoding: "utf8"
41826
- }))
41827
- if (file.endsWith(".h"))
41828
- for (const name4 of swiftInterfaceDeclarations(
41829
- (0, import_node_fs55.readFileSync)(import_node_path56.default.join(headers, file), "utf8")
41830
- ))
41831
- declared.add(name4);
41532
+ if (waitedMs >= 1e3)
41533
+ report(`acquired build root ${import_node_path56.default.basename(root2)} after ${waitedMs}ms`);
41534
+ if (canPoolBuildRoot) {
41535
+ refreshSwiftCacheHold(root2);
41536
+ (0, import_node_fs55.writeFileSync)(import_node_path56.default.join(root2, SWIFT_BUILD_ROOT_SHAPE), buildShape);
41832
41537
  }
41833
- for (const declaration of nativeDeclarations.get(name3) ?? [])
41834
- declared.add(declaration);
41835
- const own2 = withoutSwiftDeclarations(
41836
- generatedInterface(source),
41837
- declared,
41838
- nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
41839
- );
41840
- const owners = sdkObjCDeclarationOwners(sdkFrameworks);
41841
- const foreign = /* @__PURE__ */ new Map();
41842
- for (const declaration of [
41843
- ...swiftInterfaceDeclarations(own2),
41844
- ...objcEnumerations(own2),
41845
- ...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
41846
- (match) => match[1]
41847
- )
41848
- ]) {
41849
- const owner = owners.get(declaration);
41850
- if (owner && owner !== name3) foreign.set(declaration, owner);
41538
+ const swift = import_node_path56.default.join(toolchainBin, "swift");
41539
+ if (!(0, import_node_fs55.existsSync)(swift)) {
41540
+ throw new Error(
41541
+ `swift-compile: no swift.org toolchain at ${toolchainBin}; install ${options2.release} and its matching wasm sdk`
41542
+ );
41851
41543
  }
41852
- const header = foreign.size ? withoutSwiftDeclarations(
41853
- own2,
41854
- new Set(foreign.keys()),
41855
- [...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
41856
- ) : own2;
41857
- const value = {
41858
- file: import_node_path56.default.join(root2, ".build/peach-framework-objc", `${name3}-Swift.h`),
41859
- header,
41860
- module: (0, import_node_fs55.existsSync)(headers)
41544
+ const unoptimized = input.unoptimized === true;
41545
+ const baseBuildEnv = options2.project?.env ? {
41546
+ ...options2.project.env,
41547
+ // shipped host plugins resolve against the selected compiler's runtime.
41548
+ ...process.platform === "linux" ? {
41549
+ LD_LIBRARY_PATH: [
41550
+ import_node_path56.default.resolve(toolchainBin, "../lib/swift/linux"),
41551
+ import_node_path56.default.resolve(toolchainBin, "../lib/swift/host"),
41552
+ process.env.LD_LIBRARY_PATH
41553
+ ].filter(Boolean).join(":")
41554
+ } : {},
41555
+ PEACH_DEFER_WASM_LINK: "1"
41556
+ } : swiftCompilerBaseEnv(toolchainBin, process.env);
41557
+ const prepareFrameworks = async (slot, frameworkLease, allowWrite = true) => {
41558
+ if (allowWrite) budget.startCompile();
41559
+ const frameworkRoot2 = mirrorDistribution ? syncSwiftDistributionMirror(root2, moduleRoot, mirrorDistribution) : distribution ? moduleRoot : stageFrameworkSource(
41560
+ moduleRoot,
41561
+ slot,
41562
+ frameworkKey,
41563
+ options2.release
41564
+ );
41565
+ if (!swiftModuleDigest(frameworkRoot2).equals(moduleDigest))
41566
+ throw new Error("Swift staged project source differs from the caller");
41567
+ if (!allowWrite && swiftMacroPlugins(frameworkRoot2).stale) return;
41568
+ if (allowWrite) stage("preparing compiler plugins");
41569
+ const macroPlugins2 = await ensureMacroPlugins(
41570
+ frameworkRoot2,
41571
+ toolchainBin,
41572
+ options2.release,
41573
+ budget.signal,
41574
+ frameworkLease
41575
+ );
41576
+ const compileFrameworkRoot2 = distribution ? swiftDistributionCompileView(frameworkRoot2, distribution) : frameworkRoot2;
41577
+ const sdk2 = swiftModuleSdk(frameworkRoot2).wasmSdkId;
41578
+ const compileSdk2 = mirrorDistribution ? syncSwiftSdkMirror(root2, frameworkRoot2, toolchainBin, sdk2) : {
41579
+ id: sdk2,
41580
+ options: swiftCompileSdkOptions(frameworkRoot2, toolchainBin),
41581
+ toolsetChanged: false
41582
+ };
41583
+ if (mirrorDistribution && compileSdk2.toolsetChanged)
41584
+ clearSwiftSdkPathsCache(import_node_path56.default.join(root2, SWIFT_SDK_MIRROR));
41585
+ const icu2 = options2.linkOnly ? null : swiftIcuAsset(toolchainBin, sdk2);
41586
+ let prebuilt2;
41587
+ if (!distribution) {
41588
+ if (allowWrite) stage("compiling framework products");
41589
+ prebuilt2 = await buildFrameworkProducts(
41590
+ slot,
41591
+ {
41592
+ moduleRoot: frameworkRoot2,
41593
+ frameworkKey,
41594
+ input,
41595
+ swift,
41596
+ sdk: sdk2,
41597
+ toolchainBin,
41598
+ plugins: macroPlugins2,
41599
+ buildOptions: {
41600
+ env: baseBuildEnv,
41601
+ maxBuffer: 64 * 1024 * 1024,
41602
+ signal: budget.signal,
41603
+ onOutput: budget.progress,
41604
+ lease,
41605
+ frameworkLease
41606
+ }
41607
+ },
41608
+ allowWrite
41609
+ );
41610
+ if (!prebuilt2) return;
41611
+ if (!allowWrite) {
41612
+ budget.startCompile();
41613
+ stage("reusing verified framework products");
41614
+ }
41615
+ }
41616
+ const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
41617
+ return {
41618
+ frameworkRoot: frameworkRoot2,
41619
+ compileFrameworkRoot: compileFrameworkRoot2,
41620
+ macroPlugins: macroPlugins2,
41621
+ sdk: sdk2,
41622
+ compileSdk: compileSdk2,
41623
+ icu: icu2,
41624
+ prebuilt: prebuilt2,
41625
+ readHold: readHold2
41626
+ };
41861
41627
  };
41862
- frameworkInterfaces.set(name3, value);
41863
- writeBuildFile(
41864
- value.file,
41865
- ((0, import_node_fs55.existsSync)(import_node_path56.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
41866
- ` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
41867
- );
41868
- return value;
41869
- };
41870
- const headerPaths = (producer) => {
41871
- const stem2 = import_node_path56.default.join(
41872
- root2,
41873
- ".build",
41874
- "peach-cxx-headers",
41875
- `${producer}-Swift`
41876
- );
41877
- return { producer, original: `${stem2}.original.h`, emitted: `${stem2}.h` };
41878
- };
41879
- const publishHeader = ({
41880
- producer,
41881
- original,
41882
- emitted
41883
- }) => {
41884
- const generated = generatedInterface(original);
41885
- writeBuildFile(
41886
- emitted,
41887
- withoutSwiftDeclarations(
41888
- swiftHeaderWithSuperclassImports(generated, frameworkInterface),
41889
- /* @__PURE__ */ new Set([
41890
- ...preparation.nativeHeaderDeclarations[producer] ?? [],
41891
- ...nativelyDeclaredFunctions(generated, nativeHeaders)
41892
- ]),
41893
- `#import <${producer}/${producer}.h>`
41894
- )
41628
+ const frameworks = distribution ? await prepareFrameworks(null) : await withSwiftFrameworkSlot(
41629
+ frameworkKey,
41630
+ options2.release,
41631
+ moduleRoot,
41632
+ budget.signal,
41633
+ prepareFrameworks,
41634
+ unoptimized,
41635
+ options2.linkOnly === true
41895
41636
  );
41896
- };
41897
- const recipe2 = inputHash.copy().update(
41898
- distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
41899
- ).update((0, import_node_fs55.readFileSync)(import_node_path56.default.join(root2, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
41900
- const runApp = async (compiler2) => {
41901
- const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
41902
- const stages = [
41903
- ...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
41904
- target,
41905
- producers: []
41906
- })),
41907
- ...preparation.headerBuilds,
41908
- ...(preparation.nativeProductTargets ?? []).map((target) => ({
41909
- target,
41910
- producers: []
41911
- }))
41912
- ];
41913
- const checkpoints = import_node_path56.default.join(root2, ".build", "peach-product-checkpoints");
41914
- const buildDbExists = (0, import_node_fs55.existsSync)(import_node_path56.default.join(root2, ".build", "build.db"));
41915
- const releaseDir = import_node_path56.default.dirname(linked);
41916
- for (const { target, producers } of stages) {
41917
- if (!options2.project && producers.length === 0 && buildDbExists) {
41918
- const expectedObjects = preparation.nativeStageObjects.get(target);
41919
- if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
41920
- (relative4) => (0, import_node_fs55.statSync)(import_node_path56.default.join(releaseDir, relative4), {
41921
- throwIfNoEntry: false
41922
- })?.isFile()
41923
- ))
41924
- continue;
41925
- }
41926
- const receipt = import_node_path56.default.join(
41927
- checkpoints,
41928
- (0, import_node_crypto36.createHash)("sha256").update(target).digest("hex")
41637
+ if (!frameworks)
41638
+ throw new Error("Swift distribution did not provide its frameworks");
41639
+ const {
41640
+ frameworkRoot,
41641
+ compileFrameworkRoot,
41642
+ macroPlugins,
41643
+ compileSdk,
41644
+ icu,
41645
+ prebuilt
41646
+ } = frameworks;
41647
+ let readHold = frameworks.readHold;
41648
+ const buildOptions = {
41649
+ env: baseBuildEnv,
41650
+ maxBuffer: 64 * 1024 * 1024,
41651
+ signal: budget.signal,
41652
+ onOutput: budget.progress,
41653
+ lease
41654
+ };
41655
+ try {
41656
+ if (options2.project) removeProjectLinks(root2);
41657
+ const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
41658
+ if (retireStaleSwiftLink(
41659
+ root2,
41660
+ swiftLinkStamp({
41661
+ frameworkKey: mirrorDistribution ? `${options2.release}\0mirror` : `${options2.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
41662
+ packageHostMacros
41663
+ }),
41664
+ swiftLinkStamp({
41665
+ // mirrored distributions and their WASI SDK mirror invalidate
41666
+ // dependents per changed file instead of wiping every Clang object.
41667
+ frameworkKey: mirrorDistribution ? `${options2.release}\0mirror` : distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
41668
+ prebuilt,
41669
+ packageHostMacros
41670
+ }),
41671
+ Boolean(options2.linkOnly)
41672
+ ))
41673
+ stage("framework revision changed; rebuilding the app link");
41674
+ const nativeToolset = needsNativeToolset(input, prebuilt);
41675
+ const preparation = writeSwiftProject(
41676
+ layout3,
41677
+ input,
41678
+ frameworkRoot,
41679
+ prebuilt,
41680
+ !options2.project,
41681
+ options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0),
41682
+ compileSdk
41929
41683
  );
41930
- const headers = producers.map(headerPaths);
41931
- for (const header of headers)
41932
- if ((0, import_node_fs55.existsSync)(header.original)) publishHeader(header);
41933
- const fingerprint = () => {
41934
- const digest3 = (0, import_node_crypto36.createHash)("sha256").update(recipe2);
41935
- for (const { original, emitted } of headers) {
41936
- if (!(0, import_node_fs55.existsSync)(original) || !(0, import_node_fs55.existsSync)(emitted)) return;
41937
- digest3.update(
41938
- (0, import_node_crypto36.createHash)("sha256").update((0, import_node_fs55.readFileSync)(emitted)).digest()
41939
- );
41684
+ const productFile = import_node_path56.default.join(frameworkRoot, SWIFT_FRAMEWORK_PRODUCT_FILE);
41685
+ writeSwiftAutolinkLinker(
41686
+ root2,
41687
+ toolchainBin,
41688
+ (0, import_node_fs55.existsSync)(productFile) ? [
41689
+ v6.parse(
41690
+ swiftFrameworkProductSchema,
41691
+ JSON.parse((0, import_node_fs55.readFileSync)(productFile, "utf8"))
41692
+ ).product.name
41693
+ ] : []
41694
+ );
41695
+ const compiler = preparation.targetToolset ? { CC: import_node_path56.default.join(root2, CLANG_TARGET_MODULE_WRAPPER) } : {};
41696
+ if (packageHostMacros?.length) {
41697
+ const swiftc = import_node_path56.default.join(root2, SWIFT_HOST_COMPILER_WRAPPER);
41698
+ writeBuildFile(
41699
+ swiftc,
41700
+ [
41701
+ "#!/bin/sh",
41702
+ "target=",
41703
+ "module=",
41704
+ "compile=",
41705
+ "previous=",
41706
+ "for argument do",
41707
+ ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
41708
+ ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
41709
+ " previous=$argument",
41710
+ "done",
41711
+ 'case "$target/$compile" in',
41712
+ " *-*-linux*/1)",
41713
+ ' case ",$PEACH_SWIFT_HOST_MACROS," in',
41714
+ ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
41715
+ " esac ;;",
41716
+ "esac",
41717
+ 'exec "$PEACH_SWIFTC" "$@"',
41718
+ ""
41719
+ ].join("\n")
41720
+ );
41721
+ (0, import_node_fs55.chmodSync)(swiftc, 493);
41722
+ compiler.SWIFT_EXEC = swiftc;
41723
+ compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
41724
+ compiler.PEACH_SWIFTC = import_node_path56.default.join(toolchainBin, "swiftc");
41725
+ }
41726
+ const projectProcess = options2.project ? prepareSwiftProjectProcess(root2, options2.project) : void 0;
41727
+ const temporaryDirectory = projectProcess ? void 0 : import_node_path56.default.join(root2, ".build", "peach-compiler-tmp");
41728
+ const appOptions = projectProcess ? {
41729
+ ...buildOptions,
41730
+ uid: projectProcess.uid,
41731
+ gid: projectProcess.gid,
41732
+ confined: { ...projectProcess.env, ...compiler }
41733
+ } : {
41734
+ ...buildOptions,
41735
+ temporaryDirectory,
41736
+ env: {
41737
+ ...buildOptions.env,
41738
+ ...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
41739
+ ...compiler
41940
41740
  }
41941
- return digest3.digest("hex");
41942
41741
  };
41943
- if (!options2.project && (0, import_node_fs55.existsSync)(receipt) && (0, import_node_fs55.readFileSync)(receipt, "utf8") === fingerprint())
41944
- continue;
41945
- if (!options2.project) (0, import_node_fs55.rmSync)(receipt, { force: true });
41946
- for (const header of headers) {
41947
- if (!(0, import_node_fs55.existsSync)(header.original))
41948
- (0, import_node_fs55.rmSync)(
41949
- import_node_path56.default.join(
41950
- import_node_path56.default.dirname(linked),
41951
- "Modules",
41952
- `${swiftTargetModuleName(header.producer)}.swiftmodule`
41953
- ),
41954
- { force: true }
41955
- );
41742
+ const unprepared = preparation.targetFailures.map(
41743
+ (failure2) => `error: target ${failure2}`
41744
+ );
41745
+ const forwarders = /* @__PURE__ */ new Map();
41746
+ for (const [file, text7] of Object.entries(input.files)) {
41747
+ const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text7)?.[1];
41748
+ if (!parents) continue;
41749
+ const directory2 = import_node_path56.default.posix.dirname(file);
41750
+ forwarders.set(
41751
+ `${import_node_path56.default.join(root2, directory2)}/${parents.slice(0, -1)}`,
41752
+ import_node_path56.default.posix.join("build", directory2, parents).replace(/\/$/, "")
41753
+ );
41956
41754
  }
41957
- await runCompiler(
41958
- swift,
41959
- [...buildArgs, "--target", target],
41960
- optionsWithCompiler,
41961
- /^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
41962
- SWIFTPM_NOISE
41755
+ const jobs = swiftCompilerJobs();
41756
+ const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
41757
+ const batchGuest = guestGraph !== void 0 && !options2.project && !input.unoptimized;
41758
+ const guestDriverJobs = Math.min(8, jobs);
41759
+ const singleProducerJobs = Math.min(16, Math.floor(jobs / 2));
41760
+ const batch = incrementalPreview || batchGuest;
41761
+ const perFile = input.unoptimized || batch;
41762
+ const reproducibleFrameworkRoot = mirrorDistribution ? frameworkRoot : compileFrameworkRoot;
41763
+ const buildArgs = [
41764
+ "build",
41765
+ ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
41766
+ "--build-system",
41767
+ "native",
41768
+ "-j",
41769
+ String(jobs),
41770
+ "--package-path",
41771
+ root2,
41772
+ ...compileSdk.options,
41773
+ ...swiftObjCSelectorOptions(frameworkRoot),
41774
+ "--swift-sdk",
41775
+ compileSdk.id,
41776
+ ...preparation.targetToolset ? ["--toolset", import_node_path56.default.join(root2, ".peach-target-toolset.json")] : [],
41777
+ "-c",
41778
+ "release",
41779
+ ...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
41780
+ ...perFile ? [
41781
+ "-Xswiftc",
41782
+ "-no-whole-module-optimization",
41783
+ "-Xswiftc",
41784
+ "-j",
41785
+ "-Xswiftc",
41786
+ String(batchGuest ? guestDriverJobs : jobs)
41787
+ ] : [],
41788
+ // optimized batches can move specialized definitions between objects.
41789
+ ...incrementalPreview ? ["-Xswiftc", "-incremental"] : [],
41790
+ ...batch ? ["-Xswiftc", "-enable-batch-mode"] : [],
41791
+ // the mirror finds a changed sdk header's readers in their
41792
+ // dependency files, which omit system headers by default
41793
+ ...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
41794
+ // the link strips debug info, so none is generated (as for the framework).
41795
+ // keep -num-threads fixed across caller core caps so llbuild does not
41796
+ // rebuild every target when callers alternate --cores, and bound backend
41797
+ // fan-out under high -j.
41798
+ "-Xswiftc",
41799
+ "-gnone",
41800
+ "-Xcc",
41801
+ "-g0",
41802
+ "-Xcxx",
41803
+ "-g0",
41804
+ ...batch ? [] : [
41805
+ "-Xswiftc",
41806
+ "-num-threads",
41807
+ "-Xswiftc",
41808
+ String(perFile ? 1 : Math.min(8, import_node_os16.default.availableParallelism()))
41809
+ ],
41810
+ ...swiftReproducibleBuildFlags([
41811
+ [import_node_path56.default.dirname(toolchainBin), "toolchain"],
41812
+ [reproducibleFrameworkRoot, "framework"],
41813
+ [root2, "build"],
41814
+ ...forwarders
41815
+ ]).flatMap((flag, index, flags) => {
41816
+ if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
41817
+ return [flag];
41818
+ const toolchainDir = import_node_path56.default.dirname(toolchainBin);
41819
+ let mapped = flag;
41820
+ for (const [dir, target] of [
41821
+ [root2, "/peach/build"],
41822
+ [reproducibleFrameworkRoot, "/peach/framework"],
41823
+ [(0, import_node_fs55.realpathSync)(reproducibleFrameworkRoot), "/peach/framework"],
41824
+ [toolchainDir, "/peach/toolchain"],
41825
+ [(0, import_node_fs55.realpathSync)(toolchainDir), "/peach/toolchain"]
41826
+ ]) {
41827
+ mapped = mapped.replaceAll(dir, target);
41828
+ }
41829
+ const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
41830
+ const tool = flags[index - 1];
41831
+ return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
41832
+ }),
41833
+ ...macroPlugins.libraries.flatMap((plugin) => [
41834
+ "-Xswiftc",
41835
+ "-load-plugin-library",
41836
+ "-Xswiftc",
41837
+ plugin
41838
+ ]),
41839
+ ...macroPlugins.executables.flatMap((plugin) => [
41840
+ "-Xswiftc",
41841
+ "-load-plugin-executable",
41842
+ "-Xswiftc",
41843
+ `${plugin}#ExpoModulesMacros`
41844
+ ])
41845
+ ];
41846
+ const linked = builtArtifact(layout3);
41847
+ (0, import_node_fs55.rmSync)(import_node_path56.default.join(root2, ".peach-link.rsp"), { force: true });
41848
+ if (options2.linkOnly || (0, import_node_fs55.existsSync)(linked) && (0, import_node_fs55.statSync)(linked).size <= 8)
41849
+ (0, import_node_fs55.rmSync)(linked, { force: true });
41850
+ stage("compiling and linking Swift modules");
41851
+ const frameworkInterfaces = /* @__PURE__ */ new Map();
41852
+ const compileSdkPaths = swiftSdkPaths(
41853
+ frameworkRoot,
41854
+ toolchainBin,
41855
+ compileSdk.options,
41856
+ compileSdk.id
41857
+ );
41858
+ const sdkFrameworks = import_node_path56.default.join(
41859
+ compileSdkPaths.darwin,
41860
+ "System/Library/Frameworks"
41963
41861
  );
41964
- if (!compiler2) for (const header of headers) publishHeader(header);
41965
- if (!options2.project) {
41966
- const checkpoint = fingerprint();
41967
- if (checkpoint === void 0)
41968
- throw new Error(`missing Swift headers after building ${target}`);
41969
- (0, import_node_fs55.mkdirSync)(checkpoints, { recursive: true });
41970
- (0, import_node_fs55.writeFileSync)(`${receipt}.partial`, checkpoint);
41971
- (0, import_node_fs55.renameSync)(`${receipt}.partial`, receipt);
41862
+ const generatedInterface = (source) => withoutImportedSdkEnumForwards(
41863
+ clangInterfaceHeader((0, import_node_fs55.readFileSync)(source, "utf8"), frameworkRoot),
41864
+ sdkObjCDeclarationOwners(sdkFrameworks)
41865
+ );
41866
+ const nativeDeclarations = /* @__PURE__ */ new Map();
41867
+ const nativeHeaders = Object.entries(input.files).filter(([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")).map(([, source]) => source);
41868
+ for (const [file, contents2] of Object.entries(input.files)) {
41869
+ if (!file.endsWith(".modulemap")) continue;
41870
+ const name3 = moduleMapName(contents2);
41871
+ const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents2)?.[1];
41872
+ if (!name3 || !umbrella) continue;
41873
+ const header = input.files[import_node_path56.default.posix.join(import_node_path56.default.posix.dirname(file), umbrella)];
41874
+ if (header === void 0) continue;
41875
+ const included = new Set(
41876
+ [
41877
+ ...header.matchAll(
41878
+ /^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm
41879
+ )
41880
+ ].map((match) => import_node_path56.default.posix.basename(match[1]))
41881
+ );
41882
+ const declarations = nativeDeclarations.get(name3) ?? /* @__PURE__ */ new Set();
41883
+ for (const declaration of swiftInterfaceDeclarations(header))
41884
+ declarations.add(declaration);
41885
+ for (const [candidate, source] of Object.entries(input.files))
41886
+ if (included.has(import_node_path56.default.posix.basename(candidate)))
41887
+ for (const declaration of swiftInterfaceDeclarations(source))
41888
+ declarations.add(declaration);
41889
+ nativeDeclarations.set(name3, declarations);
41972
41890
  }
41973
- }
41974
- await runCompiler(
41975
- swift,
41976
- buildArgs,
41977
- optionsWithCompiler,
41978
- SWIFTPM_PROGRESS,
41979
- SWIFTPM_NOISE
41980
- );
41981
- };
41982
- const compileApp = () => preparation.headerCompiler ? withSwiftHeaderCompiler(
41983
- root2,
41984
- options2.toolchainBin,
41985
- recipe2,
41986
- new Map(
41987
- preparation.headerBuilds.flatMap(({ producers }) => {
41988
- const driverJobs = batchGuest && producers.length === 1 && singleProducerJobs > guestDriverJobs ? singleProducerJobs : void 0;
41989
- return producers.map((producer) => {
41990
- const paths = headerPaths(producer);
41991
- return [
41992
- swiftTargetModuleName(producer),
41993
- {
41994
- header: paths.original,
41995
- publish: () => publishHeader(paths),
41996
- jobs: driverJobs
41891
+ const frameworkInterface = (name3) => {
41892
+ if (frameworkInterfaces.has(name3)) return frameworkInterfaces.get(name3);
41893
+ const source = distribution ? import_node_path56.default.join(frameworkRoot, "modules", `${name3}-Swift.h`) : prebuilt.objcHeaders.get(name3);
41894
+ if (!source || !(0, import_node_fs55.existsSync)(source)) {
41895
+ frameworkInterfaces.set(name3, null);
41896
+ return null;
41897
+ }
41898
+ const headers = import_node_path56.default.join(sdkFrameworks, `${name3}.framework/Headers`);
41899
+ const declared = /* @__PURE__ */ new Set();
41900
+ if ((0, import_node_fs55.existsSync)(headers)) {
41901
+ for (const file of (0, import_node_fs55.readdirSync)(headers, {
41902
+ recursive: true,
41903
+ encoding: "utf8"
41904
+ }))
41905
+ if (file.endsWith(".h"))
41906
+ for (const name4 of swiftInterfaceDeclarations(
41907
+ (0, import_node_fs55.readFileSync)(import_node_path56.default.join(headers, file), "utf8")
41908
+ ))
41909
+ declared.add(name4);
41910
+ }
41911
+ for (const declaration of nativeDeclarations.get(name3) ?? [])
41912
+ declared.add(declaration);
41913
+ const own2 = withoutSwiftDeclarations(
41914
+ generatedInterface(source),
41915
+ declared,
41916
+ nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
41917
+ );
41918
+ const owners = sdkObjCDeclarationOwners(sdkFrameworks);
41919
+ const foreign = /* @__PURE__ */ new Map();
41920
+ for (const declaration of [
41921
+ ...swiftInterfaceDeclarations(own2),
41922
+ ...objcEnumerations(own2),
41923
+ ...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
41924
+ (match) => match[1]
41925
+ )
41926
+ ]) {
41927
+ const owner = owners.get(declaration);
41928
+ if (owner && owner !== name3) foreign.set(declaration, owner);
41929
+ }
41930
+ const header = foreign.size ? withoutSwiftDeclarations(
41931
+ own2,
41932
+ new Set(foreign.keys()),
41933
+ [...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
41934
+ ) : own2;
41935
+ const value = {
41936
+ file: import_node_path56.default.join(
41937
+ root2,
41938
+ ".build/peach-framework-objc",
41939
+ `${name3}-Swift.h`
41940
+ ),
41941
+ header,
41942
+ module: (0, import_node_fs55.existsSync)(headers)
41943
+ };
41944
+ frameworkInterfaces.set(name3, value);
41945
+ writeBuildFile(
41946
+ value.file,
41947
+ ((0, import_node_fs55.existsSync)(import_node_path56.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
41948
+ ` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
41949
+ );
41950
+ return value;
41951
+ };
41952
+ const headerPaths = (producer) => {
41953
+ const stem2 = import_node_path56.default.join(
41954
+ root2,
41955
+ ".build",
41956
+ "peach-cxx-headers",
41957
+ `${producer}-Swift`
41958
+ );
41959
+ return {
41960
+ producer,
41961
+ original: `${stem2}.original.h`,
41962
+ emitted: `${stem2}.h`
41963
+ };
41964
+ };
41965
+ const publishHeader = ({
41966
+ producer,
41967
+ original,
41968
+ emitted
41969
+ }) => {
41970
+ const generated = generatedInterface(original);
41971
+ writeBuildFile(
41972
+ emitted,
41973
+ withoutSwiftDeclarations(
41974
+ swiftHeaderWithSuperclassImports(generated, frameworkInterface),
41975
+ /* @__PURE__ */ new Set([
41976
+ ...preparation.nativeHeaderDeclarations[producer] ?? [],
41977
+ ...nativelyDeclaredFunctions(generated, nativeHeaders)
41978
+ ]),
41979
+ `#import <${producer}/${producer}.h>`
41980
+ )
41981
+ );
41982
+ };
41983
+ const recipe2 = inputHash.copy().update(
41984
+ distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
41985
+ ).update((0, import_node_fs55.readFileSync)(import_node_path56.default.join(root2, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
41986
+ const runApp = async (compiler2) => {
41987
+ const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
41988
+ const stages = [
41989
+ ...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
41990
+ target,
41991
+ producers: []
41992
+ })),
41993
+ ...preparation.headerBuilds,
41994
+ ...(preparation.nativeProductTargets ?? []).map((target) => ({
41995
+ target,
41996
+ producers: []
41997
+ }))
41998
+ ];
41999
+ const checkpoints = import_node_path56.default.join(
42000
+ root2,
42001
+ ".build",
42002
+ "peach-product-checkpoints"
42003
+ );
42004
+ const buildDbExists = (0, import_node_fs55.existsSync)(import_node_path56.default.join(root2, ".build", "build.db"));
42005
+ const releaseDir = import_node_path56.default.dirname(linked);
42006
+ for (const { target, producers } of stages) {
42007
+ if (!options2.project && producers.length === 0 && buildDbExists) {
42008
+ const expectedObjects = preparation.nativeStageObjects.get(target);
42009
+ if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
42010
+ (relative4) => (0, import_node_fs55.statSync)(import_node_path56.default.join(releaseDir, relative4), {
42011
+ throwIfNoEntry: false
42012
+ })?.isFile()
42013
+ ))
42014
+ continue;
42015
+ }
42016
+ const receipt = import_node_path56.default.join(
42017
+ checkpoints,
42018
+ (0, import_node_crypto36.createHash)("sha256").update(target).digest("hex")
42019
+ );
42020
+ const headers = producers.map(headerPaths);
42021
+ for (const header of headers)
42022
+ if ((0, import_node_fs55.existsSync)(header.original)) publishHeader(header);
42023
+ const fingerprint = () => {
42024
+ const digest3 = (0, import_node_crypto36.createHash)("sha256").update(recipe2);
42025
+ for (const { original, emitted } of headers) {
42026
+ if (!(0, import_node_fs55.existsSync)(original) || !(0, import_node_fs55.existsSync)(emitted)) return;
42027
+ digest3.update(
42028
+ (0, import_node_crypto36.createHash)("sha256").update((0, import_node_fs55.readFileSync)(emitted)).digest()
42029
+ );
41997
42030
  }
41998
- ];
41999
- });
42000
- })
42001
- ),
42002
- runApp
42003
- ) : runApp();
42004
- try {
42005
- if (temporaryDirectory) (0, import_node_fs55.mkdirSync)(temporaryDirectory, { recursive: true });
42006
- await compileApp();
42007
- } catch (error) {
42008
- const output2 = outputOf(error);
42009
- const moduleCache = import_node_path56.default.join(
42010
- root2,
42011
- ".build",
42012
- WASM_TRIPLE,
42013
- "release",
42014
- "ModuleCache"
42015
- );
42016
- if (output2.includes("was compiled with module cache path") && (0, import_node_fs55.existsSync)(moduleCache)) {
42017
- (0, import_node_fs55.rmSync)(moduleCache, { recursive: true, force: true });
42031
+ return digest3.digest("hex");
42032
+ };
42033
+ if (!options2.project && (0, import_node_fs55.existsSync)(receipt) && (0, import_node_fs55.readFileSync)(receipt, "utf8") === fingerprint())
42034
+ continue;
42035
+ if (!options2.project) (0, import_node_fs55.rmSync)(receipt, { force: true });
42036
+ for (const header of headers) {
42037
+ if (!(0, import_node_fs55.existsSync)(header.original))
42038
+ (0, import_node_fs55.rmSync)(
42039
+ import_node_path56.default.join(
42040
+ import_node_path56.default.dirname(linked),
42041
+ "Modules",
42042
+ `${swiftTargetModuleName(header.producer)}.swiftmodule`
42043
+ ),
42044
+ { force: true }
42045
+ );
42046
+ }
42047
+ await runCompiler(
42048
+ swift,
42049
+ [...buildArgs, "--target", target],
42050
+ optionsWithCompiler,
42051
+ /^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
42052
+ SWIFTPM_NOISE
42053
+ );
42054
+ if (!compiler2) for (const header of headers) publishHeader(header);
42055
+ if (!options2.project) {
42056
+ const checkpoint = fingerprint();
42057
+ if (checkpoint === void 0)
42058
+ throw new Error(`missing Swift headers after building ${target}`);
42059
+ (0, import_node_fs55.mkdirSync)(checkpoints, { recursive: true });
42060
+ (0, import_node_fs55.writeFileSync)(`${receipt}.partial`, checkpoint);
42061
+ (0, import_node_fs55.renameSync)(`${receipt}.partial`, receipt);
42062
+ }
42063
+ }
42064
+ await runCompiler(
42065
+ swift,
42066
+ buildArgs,
42067
+ optionsWithCompiler,
42068
+ SWIFTPM_PROGRESS,
42069
+ SWIFTPM_NOISE
42070
+ );
42071
+ };
42072
+ const compileApp = () => preparation.headerCompiler ? withSwiftHeaderCompiler(
42073
+ root2,
42074
+ toolchainBin,
42075
+ recipe2,
42076
+ new Map(
42077
+ preparation.headerBuilds.flatMap(({ producers }) => {
42078
+ const driverJobs = batchGuest && producers.length === 1 && singleProducerJobs > guestDriverJobs ? singleProducerJobs : void 0;
42079
+ return producers.map((producer) => {
42080
+ const paths = headerPaths(producer);
42081
+ return [
42082
+ swiftTargetModuleName(producer),
42083
+ {
42084
+ header: paths.original,
42085
+ publish: () => publishHeader(paths),
42086
+ jobs: driverJobs
42087
+ }
42088
+ ];
42089
+ });
42090
+ })
42091
+ ),
42092
+ runApp
42093
+ ) : runApp();
42018
42094
  try {
42095
+ if (temporaryDirectory)
42096
+ (0, import_node_fs55.mkdirSync)(temporaryDirectory, { recursive: true });
42019
42097
  await compileApp();
42020
- } catch (retryError) {
42098
+ } catch (error) {
42099
+ const output2 = outputOf(error);
42100
+ const moduleCache = import_node_path56.default.join(
42101
+ root2,
42102
+ ".build",
42103
+ WASM_TRIPLE,
42104
+ "release",
42105
+ "ModuleCache"
42106
+ );
42107
+ if (output2.includes("was compiled with module cache path") && (0, import_node_fs55.existsSync)(moduleCache)) {
42108
+ (0, import_node_fs55.rmSync)(moduleCache, { recursive: true, force: true });
42109
+ try {
42110
+ await compileApp();
42111
+ } catch (retryError) {
42112
+ throw new Error(
42113
+ [
42114
+ ...unprepared,
42115
+ projectDiagnostic(outputOf(retryError), layout3, input.files)
42116
+ ].join("\n"),
42117
+ { cause: retryError }
42118
+ );
42119
+ }
42120
+ } else {
42121
+ throw new Error(
42122
+ [
42123
+ ...unprepared,
42124
+ projectDiagnostic(output2, layout3, input.files)
42125
+ ].join("\n"),
42126
+ { cause: error }
42127
+ );
42128
+ }
42129
+ } finally {
42130
+ if (temporaryDirectory)
42131
+ (0, import_node_fs55.rmSync)(temporaryDirectory, { recursive: true, force: true });
42132
+ if (options2.project) endSwiftProjectProcesses(options2.project);
42133
+ }
42134
+ if (unprepared.length) throw new Error(unprepared.join("\n"));
42135
+ if (!(0, import_node_fs55.existsSync)(linked)) {
42136
+ const binDir = import_node_path56.default.dirname(linked);
42137
+ const found = (0, import_node_fs55.existsSync)(binDir) ? (0, import_node_fs55.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
42021
42138
  throw new Error(
42022
- [
42023
- ...unprepared,
42024
- projectDiagnostic(outputOf(retryError), layout3, input.files)
42025
- ].join("\n"),
42026
- { cause: retryError }
42139
+ `swift-compile: the build produced no ${import_node_path56.default.basename(linked)} (found: ${found.join(", ") || "none"})`
42027
42140
  );
42028
42141
  }
42029
- } else {
42030
- throw new Error(
42031
- [...unprepared, projectDiagnostic(output2, layout3, input.files)].join(
42032
- "\n"
42033
- ),
42034
- { cause: error }
42142
+ if (options2.project) removeProjectLinks(root2);
42143
+ const resourceReferences = Object.values(input.resources ?? {}).map(
42144
+ (value) => Buffer.from(value, "base64")
42035
42145
  );
42036
- }
42037
- } finally {
42038
- if (temporaryDirectory)
42039
- (0, import_node_fs55.rmSync)(temporaryDirectory, { recursive: true, force: true });
42040
- if (options2.project) endSwiftProjectProcesses(options2.project);
42041
- }
42042
- if (unprepared.length) throw new Error(unprepared.join("\n"));
42043
- if (!(0, import_node_fs55.existsSync)(linked)) {
42044
- const binDir = import_node_path56.default.dirname(linked);
42045
- const found = (0, import_node_fs55.existsSync)(binDir) ? (0, import_node_fs55.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
42046
- throw new Error(
42047
- `swift-compile: the build produced no ${import_node_path56.default.basename(linked)} (found: ${found.join(", ") || "none"})`
42048
- );
42049
- }
42050
- if (options2.project) removeProjectLinks(root2);
42051
- const resourceReferences = Object.values(input.resources ?? {}).map(
42052
- (value) => Buffer.from(value, "base64")
42053
- );
42054
- if (!guestGraph)
42055
- pruneSwiftWasmLink(
42056
- root2,
42057
- options2.toolchainBin,
42058
- prebuilt?.root ?? frameworkRoot,
42059
- input.staticClangTargets,
42060
- options2.project,
42061
- void 0,
42062
- resourceReferences
42063
- );
42064
- if (options2.linkOnly) {
42065
- if ((0, import_node_fs55.statSync)(linked).size <= 8)
42066
- throw new Error("swift-compile: deferred linker produced no executable");
42067
- stage("project link verified");
42068
- if (readHold && retainSwiftRootReadHold(readHold)) readHold = void 0;
42069
- return;
42070
- }
42071
- const output = options2.project ? projectOutputFile(root2, linked, options2.project) : linked;
42072
- const optimized = `${output}.optimized`;
42073
- if (!sdkImage) throw new Error("swift-compile: missing shared SDK image");
42074
- if (options2.project) (0, import_node_fs55.rmSync)(optimized, { force: true });
42075
- let sdkAsset;
42076
- stage("linking the app image");
42077
- if (guestGraph) {
42078
- const binding = await compileGuestLink({
42079
- graph: guestGraph,
42080
- buildDirectory: root2,
42081
- releaseDirectory: import_node_path56.default.dirname(linked),
42082
- moduleRoot: frameworkRoot,
42083
- toolchainBin: options2.toolchainBin,
42084
- swiftCompiler: preparation.headerCompiler ? import_node_path56.default.join(root2, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path56.default.join(options2.toolchainBin, "swiftc"),
42085
- sysroot: compileSdkPaths.sysroot,
42086
- sdk: swiftModuleSdk(frameworkRoot),
42087
- sdkImage,
42088
- compilerDigest: compilerSourceDigest,
42089
- project: options2.project && {
42090
- ...options2.project,
42091
- env: { ...options2.project.env, ...projectProcess?.env }
42092
- },
42093
- staticClangTargets: input.staticClangTargets ?? [],
42094
- resourceReferences,
42095
- resourceBundles: input.resourceBundles ?? [],
42096
- generatedOwners: preparation.generatedOwners,
42097
- output,
42098
- optimized,
42099
- optimize: input.optimize === true,
42100
- jobs: swiftBuildJobs(),
42101
- onStage: stage
42102
- });
42103
- sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
42104
- } else {
42105
- const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
42106
- const binding = await buildSwiftAppModule2({
42107
- buildRoot: root2,
42108
- toolchainBin: options2.toolchainBin,
42109
- sdk: sdkImage,
42110
- output: optimized,
42111
- optimize: input.optimize === true,
42112
- project: options2.project && {
42113
- ...options2.project,
42114
- env: { ...options2.project.env, ...projectProcess?.env },
42115
- sdkRoot: import_node_path56.default.dirname(compileSdkPaths.sysroot),
42116
- linked: output
42146
+ if (!guestGraph)
42147
+ pruneSwiftWasmLink(
42148
+ root2,
42149
+ toolchainBin,
42150
+ prebuilt?.root ?? frameworkRoot,
42151
+ input.staticClangTargets,
42152
+ options2.project,
42153
+ void 0,
42154
+ resourceReferences
42155
+ );
42156
+ if (options2.linkOnly) {
42157
+ if ((0, import_node_fs55.statSync)(linked).size <= 8)
42158
+ throw new Error(
42159
+ "swift-compile: deferred linker produced no executable"
42160
+ );
42161
+ stage("project link verified");
42162
+ if (readHold && retainSwiftRootReadHold(readHold)) readHold = void 0;
42163
+ return;
42117
42164
  }
42118
- });
42119
- sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
42120
- }
42121
- const artifact = {
42122
- hash,
42123
- bytes: (0, import_node_fs55.readFileSync)(optimized),
42124
- icu: await icu,
42125
- sdk: sdkAsset
42126
- };
42127
- if (artifact.bytes.length <= 8)
42128
- throw new Error("swift-compile: deferred linker produced no executable");
42129
- if (!options2.project) saveCompiledArtifact(root2, artifact);
42130
- saveSharedArtifact(sharedRoot, artifact);
42131
- stage("compiled artifact verified");
42132
- return retain(baseRoot, artifact);
42133
- } finally {
42134
- readHold?.release();
42165
+ const output = options2.project ? projectOutputFile(root2, linked, options2.project) : linked;
42166
+ const optimized = `${output}.optimized`;
42167
+ if (!sdkImage) throw new Error("swift-compile: missing shared SDK image");
42168
+ if (options2.project) (0, import_node_fs55.rmSync)(optimized, { force: true });
42169
+ let sdkAsset;
42170
+ stage("linking the app image");
42171
+ if (guestGraph) {
42172
+ const binding = await compileGuestLink({
42173
+ graph: guestGraph,
42174
+ buildDirectory: root2,
42175
+ releaseDirectory: import_node_path56.default.dirname(linked),
42176
+ moduleRoot: frameworkRoot,
42177
+ toolchainBin,
42178
+ swiftCompiler: preparation.headerCompiler ? import_node_path56.default.join(root2, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path56.default.join(toolchainBin, "swiftc"),
42179
+ sysroot: compileSdkPaths.sysroot,
42180
+ sdk: swiftModuleSdk(frameworkRoot),
42181
+ sdkImage,
42182
+ compilerDigest: compilerSourceDigest,
42183
+ project: options2.project && {
42184
+ ...options2.project,
42185
+ env: { ...options2.project.env, ...projectProcess?.env }
42186
+ },
42187
+ staticClangTargets: input.staticClangTargets ?? [],
42188
+ resourceReferences,
42189
+ resourceBundles: input.resourceBundles ?? [],
42190
+ generatedOwners: preparation.generatedOwners,
42191
+ output,
42192
+ optimized,
42193
+ optimize: input.optimize === true,
42194
+ jobs: swiftBuildJobs(),
42195
+ onStage: stage
42196
+ });
42197
+ sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
42198
+ } else {
42199
+ const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
42200
+ const binding = await buildSwiftAppModule2({
42201
+ buildRoot: root2,
42202
+ toolchainBin,
42203
+ sdk: sdkImage,
42204
+ output: optimized,
42205
+ optimize: input.optimize === true,
42206
+ project: options2.project && {
42207
+ ...options2.project,
42208
+ env: { ...options2.project.env, ...projectProcess?.env },
42209
+ sdkRoot: import_node_path56.default.dirname(compileSdkPaths.sysroot),
42210
+ linked: output
42211
+ }
42212
+ });
42213
+ sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
42214
+ }
42215
+ const artifact = {
42216
+ hash,
42217
+ bytes: (0, import_node_fs55.readFileSync)(optimized),
42218
+ icu: await icu,
42219
+ sdk: sdkAsset
42220
+ };
42221
+ if (artifact.bytes.length <= 8)
42222
+ throw new Error("swift-compile: deferred linker produced no executable");
42223
+ if (!options2.project) saveCompiledArtifact(root2, artifact);
42224
+ saveSharedArtifact(sharedRoot, artifact);
42225
+ stage("compiled artifact verified");
42226
+ return retain(baseRoot, artifact);
42227
+ } finally {
42228
+ readHold?.release();
42229
+ }
42230
+ });
42135
42231
  }
42136
- });
42137
- });
42138
- },
42139
- options2.signal
42140
- );
42232
+ );
42233
+ },
42234
+ options2.signal
42235
+ );
42236
+ });
42141
42237
  }
42142
- var import_node_child_process35, import_node_crypto36, import_node_fs55, import_node_os15, import_node_path56, import_promises7, v6, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_COMPILER_ENV_KEYS, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, lastPartition, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, CLANG_DISTRIBUTION_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, MODULE_MAP_RESPONSE_FILE_RUN, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, cPredefineTable, cPredefineCache, HIDDEN_UNITS, FIRST_WINS_PAIRS, LAST_WINS_PAIRS, VALUE_FLAGS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, frameworkProductsReceiptSchema, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN, SWIFT_FRAMEWORK_SLOT_RELEASE, SWIFT_FRAMEWORK_SLOT_HANDOFF, SWIFT_BUILD_ROOT_SLOTS, SWIFT_BUILD_ROOT_SHAPE, SWIFT_FRAMEWORK_HANDOFF_MS;
42238
+ var import_node_child_process35, import_node_crypto36, import_node_fs55, import_node_os16, import_node_path56, import_promises7, v6, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_COMPILER_ENV_KEYS, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, lastPartition, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, CLANG_DISTRIBUTION_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, MODULE_MAP_RESPONSE_FILE_RUN, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, cPredefineTable, cPredefineCache, HIDDEN_UNITS, FIRST_WINS_PAIRS, LAST_WINS_PAIRS, VALUE_FLAGS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, frameworkProductsReceiptSchema, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN, SWIFT_FRAMEWORK_SLOT_RELEASE, SWIFT_FRAMEWORK_SLOT_HANDOFF, SWIFT_BUILD_ROOT_SLOTS, SWIFT_BUILD_ROOT_SHAPE, SWIFT_FRAMEWORK_HANDOFF_MS;
42143
42239
  var init_swift_compile = __esm({
42144
42240
  "src/swift-compile.ts"() {
42145
42241
  "use strict";
42146
42242
  import_node_child_process35 = require("node:child_process");
42147
42243
  import_node_crypto36 = require("node:crypto");
42148
42244
  import_node_fs55 = require("node:fs");
42149
- import_node_os15 = __toESM(require("node:os"), 1);
42245
+ import_node_os16 = __toESM(require("node:os"), 1);
42150
42246
  import_node_path56 = __toESM(require("node:path"), 1);
42151
42247
  import_promises7 = require("node:timers/promises");
42152
42248
  v6 = __toESM(require("peachsim/vendor/valibot"), 1);
@@ -42373,7 +42469,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
42373
42469
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
42374
42470
  MULTI_MANIFEST_VERSION = 76;
42375
42471
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
42376
- compilerSourceDigest = true ? "baac85ca6f30bfff118b7d4063d9361ee1667b3d7716774bc1ae52da63e27be0" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
42472
+ compilerSourceDigest = true ? "0c6bac10641208c362185255fa7a630f4699656735409862a61a2e125ad2e84b" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
42377
42473
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
42378
42474
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
42379
42475
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -42875,7 +42971,7 @@ async function downloadFile(pod, url, headers, file, algorithm) {
42875
42971
  return hash ? hash.digest("hex") : null;
42876
42972
  }
42877
42973
  function netrcCredentials(host2) {
42878
- const file = import_node_path58.default.join(import_node_os16.default.homedir(), ".netrc");
42974
+ const file = import_node_path58.default.join(import_node_os17.default.homedir(), ".netrc");
42879
42975
  if (!import_node_fs57.default.existsSync(file)) return null;
42880
42976
  const tokens2 = import_node_fs57.default.readFileSync(file, "utf8").split(/\s+/).filter(Boolean);
42881
42977
  let current2 = null;
@@ -43118,14 +43214,14 @@ function cleanInstalledPod(spec, root, used) {
43118
43214
  (node) => used.filter((entry) => entry.specs.includes(node.name)).map((entry) => entry.platform)
43119
43215
  );
43120
43216
  }
43121
- var import_node_child_process36, import_node_crypto38, import_node_fs57, import_node_os16, import_node_path58, COCOAPODS_VERSION, USER_AGENT, PLATFORMS, HEADER_EXTENSIONS, SOURCE_EXTENSIONS, SOURCE_FILES_PATTERN, STRATEGIES, OPTIONS, ARCHIVE_TYPES, object4, RETRY_STATUSES, chomp, stringList, bracketEnd, escapeRegex;
43217
+ var import_node_child_process36, import_node_crypto38, import_node_fs57, import_node_os17, import_node_path58, COCOAPODS_VERSION, USER_AGENT, PLATFORMS, HEADER_EXTENSIONS, SOURCE_EXTENSIONS, SOURCE_FILES_PATTERN, STRATEGIES, OPTIONS, ARCHIVE_TYPES, object4, RETRY_STATUSES, chomp, stringList, bracketEnd, escapeRegex;
43122
43218
  var init_pod_sources = __esm({
43123
43219
  "src/pod-sources.ts"() {
43124
43220
  "use strict";
43125
43221
  import_node_child_process36 = require("node:child_process");
43126
43222
  import_node_crypto38 = require("node:crypto");
43127
43223
  import_node_fs57 = __toESM(require("node:fs"), 1);
43128
- import_node_os16 = __toESM(require("node:os"), 1);
43224
+ import_node_os17 = __toESM(require("node:os"), 1);
43129
43225
  import_node_path58 = __toESM(require("node:path"), 1);
43130
43226
  init_home_paths();
43131
43227
  init_pod_prepare_toolchain();
@@ -55347,7 +55443,7 @@ function text4(interp, value) {
55347
55443
  );
55348
55444
  }
55349
55445
  function expandHome(p) {
55350
- return p === "~" || p.startsWith("~/") ? import_node_path61.default.join(import_node_os17.default.homedir(), p.slice(1)) : p;
55446
+ return p === "~" || p.startsWith("~/") ? import_node_path61.default.join(import_node_os18.default.homedir(), p.slice(1)) : p;
55351
55447
  }
55352
55448
  function joinPaths(parts) {
55353
55449
  let out = "";
@@ -55898,12 +55994,12 @@ function installStdlib(interp) {
55898
55994
  const dir = interp.defineModule("Dir", object8, true);
55899
55995
  def(dir, "pwd", () => str2(host2.cwd));
55900
55996
  def(dir, "getwd", () => str2(host2.cwd));
55901
- def(dir, "home", () => str2(import_node_os17.default.homedir()));
55997
+ def(dir, "home", () => str2(import_node_os18.default.homedir()));
55902
55998
  def(dir, "exist?", (c) => isDirectory(resolve4(text4(interp, c.args[0]))));
55903
55999
  def(dir, "exists?", (c) => isDirectory(resolve4(text4(interp, c.args[0]))));
55904
56000
  def(dir, "chdir", (c) => {
55905
56001
  const previous = host2.cwd;
55906
- host2.cwd = c.args[0] === void 0 ? import_node_os17.default.homedir() : resolve4(text4(interp, c.args[0]));
56002
+ host2.cwd = c.args[0] === void 0 ? import_node_os18.default.homedir() : resolve4(text4(interp, c.args[0]));
55907
56003
  if (!c.block) return 0;
55908
56004
  try {
55909
56005
  return interp.callProc(c.block, [str2(host2.cwd)]);
@@ -56484,7 +56580,7 @@ function installStdlib(interp) {
56484
56580
  (c) => c.self instanceof RObject && typeof c.self.data === "number" ? c.self.data : 0
56485
56581
  );
56486
56582
  const etc = interp.defineModule("Etc", object8);
56487
- def(etc, "nprocessors", () => import_node_os17.default.cpus().length);
56583
+ def(etc, "nprocessors", () => import_node_os18.default.cpus().length);
56488
56584
  const rbConfig = interp.defineModule("RbConfig", object8);
56489
56585
  rbConfig.consts.set(
56490
56586
  "CONFIG",
@@ -56584,14 +56680,14 @@ function fnmatch(pattern, subject, flags) {
56584
56680
  return !leadingDot && new RegExp(`^${source}$`, casefold ? "is" : "s").test(subject);
56585
56681
  });
56586
56682
  }
56587
- var import_node_child_process39, import_node_crypto42, import_node_fs62, import_node_os17, import_node_path61, segment, FileHandle, WriteHandle, DownloadHandle, GemRequirement, TimeValue, SetData;
56683
+ var import_node_child_process39, import_node_crypto42, import_node_fs62, import_node_os18, import_node_path61, segment, FileHandle, WriteHandle, DownloadHandle, GemRequirement, TimeValue, SetData;
56588
56684
  var init_podspec_ruby_stdlib = __esm({
56589
56685
  "src/podspec-ruby-stdlib.ts"() {
56590
56686
  "use strict";
56591
56687
  import_node_child_process39 = require("node:child_process");
56592
56688
  import_node_crypto42 = require("node:crypto");
56593
56689
  import_node_fs62 = __toESM(require("node:fs"), 1);
56594
- import_node_os17 = __toESM(require("node:os"), 1);
56690
+ import_node_os18 = __toESM(require("node:os"), 1);
56595
56691
  import_node_path61 = __toESM(require("node:path"), 1);
56596
56692
  init_podspec_ruby();
56597
56693
  segment = (s) => typeof s === "number" ? s : str2(s);
@@ -56742,7 +56838,7 @@ function cocoapodsInterpreter(app, writable, env) {
56742
56838
  loaded: /* @__PURE__ */ new Set(),
56743
56839
  // cocoapods and the podspecs it evaluates keep caches shared across
56744
56840
  // projects in the user's caches directory, as sentry's xcframework does
56745
- writable: [...writable, import_node_path62.default.join(import_node_os18.default.homedir(), "Library", "Caches")]
56841
+ writable: [...writable, import_node_path62.default.join(import_node_os19.default.homedir(), "Library", "Caches")]
56746
56842
  });
56747
56843
  installStdlib(interp);
56748
56844
  interp.evalString(PRELUDE, "cocoapods-core");
@@ -56869,14 +56965,14 @@ function evaluatePodspec(file, app, writable, env, installed) {
56869
56965
  return toJson(interp, call(pod, "peach_evaluated", [spec]));
56870
56966
  });
56871
56967
  }
56872
- var import_node_child_process40, import_node_fs63, import_node_module4, import_node_os18, import_node_path62, PRELUDE, PodspecEvaluationError, HOST_PROBES, hostProbe, SOURCE_BUILD_ENV, XCODE_TOOLCHAIN_BIN, XCODE_TOOLCHAIN_TOOLS;
56968
+ var import_node_child_process40, import_node_fs63, import_node_module4, import_node_os19, import_node_path62, PRELUDE, PodspecEvaluationError, HOST_PROBES, hostProbe, SOURCE_BUILD_ENV, XCODE_TOOLCHAIN_BIN, XCODE_TOOLCHAIN_TOOLS;
56873
56969
  var init_podspec_cocoapods = __esm({
56874
56970
  "src/podspec-cocoapods.ts"() {
56875
56971
  "use strict";
56876
56972
  import_node_child_process40 = require("node:child_process");
56877
56973
  import_node_fs63 = __toESM(require("node:fs"), 1);
56878
56974
  import_node_module4 = require("node:module");
56879
- import_node_os18 = __toESM(require("node:os"), 1);
56975
+ import_node_os19 = __toESM(require("node:os"), 1);
56880
56976
  import_node_path62 = __toESM(require("node:path"), 1);
56881
56977
  init_podspec_ruby();
56882
56978
  init_podspec_ruby_stdlib();
@@ -68367,10 +68463,10 @@ function bazelBinary(root) {
68367
68463
  const pinned = import_node_path74.default.join(root, ".bazelversion");
68368
68464
  if (!import_node_fs73.default.existsSync(pinned)) return "bazel";
68369
68465
  const version2 = import_node_fs73.default.readFileSync(pinned, "utf8").trim();
68370
- const platform2 = import_node_os19.default.platform() === "darwin" ? "darwin" : "linux";
68371
- const arch = import_node_os19.default.arch() === "arm64" ? "arm64" : "x86_64";
68466
+ const platform2 = import_node_os20.default.platform() === "darwin" ? "darwin" : "linux";
68467
+ const arch = import_node_os20.default.arch() === "arm64" ? "arm64" : "x86_64";
68372
68468
  const name3 = `bazel-${version2}-${platform2}-${arch}`;
68373
- const binary2 = import_node_path74.default.join(import_node_os19.default.homedir(), ".peach", "cache", "bazel", name3);
68469
+ const binary2 = import_node_path74.default.join(import_node_os20.default.homedir(), ".peach", "cache", "bazel", name3);
68374
68470
  if (import_node_fs73.default.existsSync(binary2)) return binary2;
68375
68471
  const url = `https://github.com/bazelbuild/bazel/releases/download/${version2}/${name3}`;
68376
68472
  import_node_fs73.default.mkdirSync(import_node_path74.default.dirname(binary2), { recursive: true });
@@ -69266,14 +69362,14 @@ function shellTokens(options2) {
69266
69362
  return words2;
69267
69363
  });
69268
69364
  }
69269
- var import_node_child_process41, import_node_crypto44, import_node_fs73, import_node_os19, import_node_path74, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER3, PRODUCTS, graphs, CLANG_CONFIGURATION_FLAGS, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
69365
+ var import_node_child_process41, import_node_crypto44, import_node_fs73, import_node_os20, import_node_path74, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER3, PRODUCTS, graphs, CLANG_CONFIGURATION_FLAGS, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
69270
69366
  var init_bazel_project = __esm({
69271
69367
  "src/bazel-project.ts"() {
69272
69368
  "use strict";
69273
69369
  import_node_child_process41 = require("node:child_process");
69274
69370
  import_node_crypto44 = require("node:crypto");
69275
69371
  import_node_fs73 = __toESM(require("node:fs"), 1);
69276
- import_node_os19 = __toESM(require("node:os"), 1);
69372
+ import_node_os20 = __toESM(require("node:os"), 1);
69277
69373
  import_node_path74 = __toESM(require("node:path"), 1);
69278
69374
  init_is_record();
69279
69375
  init_plist();
@@ -76137,7 +76233,7 @@ function nativeWorkspacesDir(root) {
76137
76233
  for (const cache of [
76138
76234
  sharedCacheDir(cacheDir()),
76139
76235
  cacheDir(),
76140
- import_node_path84.default.join(import_node_os20.default.homedir(), ".peach-cache")
76236
+ import_node_path84.default.join(import_node_os21.default.homedir(), ".peach-cache")
76141
76237
  ]) {
76142
76238
  let existing = cache;
76143
76239
  while (!import_node_fs82.default.existsSync(existing)) existing = import_node_path84.default.dirname(existing);
@@ -76147,7 +76243,7 @@ function nativeWorkspacesDir(root) {
76147
76243
  let mount = import_node_fs82.default.realpathSync(root);
76148
76244
  while (import_node_path84.default.dirname(mount) !== mount && import_node_fs82.default.statSync(import_node_path84.default.dirname(mount)).dev === device)
76149
76245
  mount = import_node_path84.default.dirname(mount);
76150
- const tmpRoots = /* @__PURE__ */ new Set(["/tmp", "/var/tmp", import_node_fs82.default.realpathSync(import_node_os20.default.tmpdir())]);
76246
+ const tmpRoots = /* @__PURE__ */ new Set(["/tmp", "/var/tmp", import_node_fs82.default.realpathSync(import_node_os21.default.tmpdir())]);
76151
76247
  if (tmpRoots.has(mount))
76152
76248
  return import_node_path84.default.join(sharedCacheDir(cacheDir()), "expo-native-workspaces");
76153
76249
  return import_node_path84.default.join(mount, ".peach-cache", "expo-native-workspaces");
@@ -76488,7 +76584,7 @@ ${failedOutputLine(command, cwd, bytes)}`
76488
76584
  });
76489
76585
  });
76490
76586
  }
76491
- var import_node_child_process43, import_node_crypto50, import_node_fs82, import_node_module6, import_node_os20, import_node_path84, import_node_util11, isolatedGitEnv, EXACT_VERSION, NATIVE_CONFIG_FILE, NATIVE_SOURCE_FILE, fileDigests, NATIVE_PACKAGE_ENTRY, hashing, KEPT_WORKSPACES, WORKSPACE_GRACE_MS, ABANDONED_WORKSPACE_MS, RETIRED_PREFIX2, preparing, watches, current, CLONE_ENTRIES;
76587
+ var import_node_child_process43, import_node_crypto50, import_node_fs82, import_node_module6, import_node_os21, import_node_path84, import_node_util11, isolatedGitEnv, EXACT_VERSION, NATIVE_CONFIG_FILE, NATIVE_SOURCE_FILE, fileDigests, NATIVE_PACKAGE_ENTRY, hashing, KEPT_WORKSPACES, WORKSPACE_GRACE_MS, ABANDONED_WORKSPACE_MS, RETIRED_PREFIX2, preparing, watches, current, CLONE_ENTRIES;
76492
76588
  var init_expo_native_workspace = __esm({
76493
76589
  "src/expo-native-workspace.ts"() {
76494
76590
  "use strict";
@@ -76496,7 +76592,7 @@ var init_expo_native_workspace = __esm({
76496
76592
  import_node_crypto50 = require("node:crypto");
76497
76593
  import_node_fs82 = __toESM(require("node:fs"), 1);
76498
76594
  import_node_module6 = require("node:module");
76499
- import_node_os20 = __toESM(require("node:os"), 1);
76595
+ import_node_os21 = __toESM(require("node:os"), 1);
76500
76596
  import_node_path84 = __toESM(require("node:path"), 1);
76501
76597
  import_node_util11 = require("node:util");
76502
76598
  init_detect();
@@ -88478,7 +88574,7 @@ var init_swift_standin_digest = __esm({
88478
88574
  ];
88479
88575
  RUNTIME_IMPORT = /(?:^|[;\n])[ \t]*(?:import|export)\s+(?!type(?:\s|\{))([\s\S]*?)\s+from\s*['"]([^'"]+)['"]|(?:^|[;\n])[ \t]*import\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
88480
88576
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS, STANDIN_DIGEST_EXCLUDED_FILES);
88481
- STANDIN_SOURCE_DIGEST = true ? "8b7dccbe4ecedba9dc6511eb4ab2e02ce2922969fcd9eebc93f3280c6529a48b" : standinSourceDigest();
88577
+ STANDIN_SOURCE_DIGEST = true ? "3f378daefc4c950a9d25cfd3184475a07f63966495c86443c5058ef8f9dd3ac9" : standinSourceDigest();
88482
88578
  }
88483
88579
  });
88484
88580
 
@@ -89656,7 +89752,7 @@ function genruleToolchain(moduleRoot) {
89656
89752
  ranlib: bin("llvm-ranlib"),
89657
89753
  jobs: Math.min(
89658
89754
  32,
89659
- Number(process.env.TM_EXEC_CPU_CORES) || import_node_os21.default.availableParallelism()
89755
+ Number(process.env.TM_EXEC_CPU_CORES) || import_node_os22.default.availableParallelism()
89660
89756
  ),
89661
89757
  frameworkIdentity: () => frameworkProbeIdentity(moduleRoot, compiler.toolchainBin),
89662
89758
  frameworks: () => frameworks ??= nativeFrameworkCompiler(
@@ -89812,14 +89908,14 @@ function genruleArchive(declaration, library, moduleRoot) {
89812
89908
  }
89813
89909
  return combined;
89814
89910
  }
89815
- var import_node_child_process51, import_node_crypto63, import_node_fs103, import_node_os21, import_node_path107, v8, BUILDERS, cacheDir4, toolIdentities, sysrootIdentities, GENRULE_RECIPE, GENRULE_BUNDLE;
89911
+ var import_node_child_process51, import_node_crypto63, import_node_fs103, import_node_os22, import_node_path107, v8, BUILDERS, cacheDir4, toolIdentities, sysrootIdentities, GENRULE_RECIPE, GENRULE_BUNDLE;
89816
89912
  var init_genrule_archives = __esm({
89817
89913
  "src/genrule-archives.ts"() {
89818
89914
  "use strict";
89819
89915
  import_node_child_process51 = require("node:child_process");
89820
89916
  import_node_crypto63 = require("node:crypto");
89821
89917
  import_node_fs103 = __toESM(require("node:fs"), 1);
89822
- import_node_os21 = __toESM(require("node:os"), 1);
89918
+ import_node_os22 = __toESM(require("node:os"), 1);
89823
89919
  import_node_path107 = __toESM(require("node:path"), 1);
89824
89920
  v8 = __toESM(require("peachsim/vendor/valibot"), 1);
89825
89921
  init_ffmpeg_source_build();
@@ -89905,7 +90001,7 @@ function privateSentrySlice(entry, moduleRoot) {
89905
90001
  throw new Error(
89906
90002
  "the Sentry slice for a private Swift distribution builds from a Contrast source checkout"
89907
90003
  );
89908
- const staging = import_node_fs104.default.mkdtempSync(import_node_path108.default.join(import_node_fs104.default.realpathSync(import_node_os22.default.tmpdir()), "sentry-slice-"));
90004
+ const staging = import_node_fs104.default.mkdtempSync(import_node_path108.default.join(import_node_fs104.default.realpathSync(import_node_os23.default.tmpdir()), "sentry-slice-"));
89909
90005
  try {
89910
90006
  process.stderr.write("peach: building the Sentry slice for a private distribution\u2026\n");
89911
90007
  (0, import_node_child_process52.execFileSync)("bun", [script, "--output", staging, "--module-root", moduleRoot], {
@@ -89983,14 +90079,14 @@ function nativeSwiftSlice(standin, moduleRoot, generator, configured, artifact)
89983
90079
  }
89984
90080
  };
89985
90081
  }
89986
- var import_node_child_process52, import_node_crypto64, import_node_fs104, import_node_os22, import_node_path108, SENTRY_SWIFT_SLICE;
90082
+ var import_node_child_process52, import_node_crypto64, import_node_fs104, import_node_os23, import_node_path108, SENTRY_SWIFT_SLICE;
89987
90083
  var init_native_swift_slices = __esm({
89988
90084
  "src/native-swift-slices.ts"() {
89989
90085
  "use strict";
89990
90086
  import_node_child_process52 = require("node:child_process");
89991
90087
  import_node_crypto64 = require("node:crypto");
89992
90088
  import_node_fs104 = __toESM(require("node:fs"), 1);
89993
- import_node_os22 = __toESM(require("node:os"), 1);
90089
+ import_node_os23 = __toESM(require("node:os"), 1);
89994
90090
  import_node_path108 = __toESM(require("node:path"), 1);
89995
90091
  init_native_prebuilt();
89996
90092
  init_swift_sdk_surface();
@@ -95063,7 +95159,7 @@ function build(checkout, output, toolchainBin, common2, objc) {
95063
95159
  import_node_fs110.default.cpSync(import_node_path113.default.join(runtime, "include"), import_node_path113.default.join(includes, "rive", "include"), {
95064
95160
  recursive: true
95065
95161
  });
95066
- const jobs = String(Number(process.env.TM_EXEC_CPU_CORES) || import_node_os23.default.availableParallelism());
95162
+ const jobs = String(Number(process.env.TM_EXEC_CPU_CORES) || import_node_os24.default.availableParallelism());
95067
95163
  const component = (directory2, target, args, headers) => {
95068
95164
  const cwd = import_node_path113.default.join(runtime, directory2);
95069
95165
  const out = `out/iphonesimulator_${CONFIG}`;
@@ -95173,14 +95269,14 @@ exec ${quote3(import_node_path113.default.join(toolchainBin, "llvm-ar"))} rcs "$
95173
95269
  );
95174
95270
  return directory2;
95175
95271
  }
95176
- var import_node_child_process56, import_node_crypto67, import_node_fs110, import_node_os23, import_node_path113, import_promises10, RECIPE, CONFIG, RUNTIME_LIBRARIES;
95272
+ var import_node_child_process56, import_node_crypto67, import_node_fs110, import_node_os24, import_node_path113, import_promises10, RECIPE, CONFIG, RUNTIME_LIBRARIES;
95177
95273
  var init_rive_runtime_dependencies = __esm({
95178
95274
  "src/rive-runtime-dependencies.ts"() {
95179
95275
  "use strict";
95180
95276
  import_node_child_process56 = require("node:child_process");
95181
95277
  import_node_crypto67 = require("node:crypto");
95182
95278
  import_node_fs110 = __toESM(require("node:fs"), 1);
95183
- import_node_os23 = __toESM(require("node:os"), 1);
95279
+ import_node_os24 = __toESM(require("node:os"), 1);
95184
95280
  import_node_path113 = __toESM(require("node:path"), 1);
95185
95281
  import_promises10 = require("node:timers/promises");
95186
95282
  init_home_paths();
@@ -96292,7 +96388,7 @@ function rasterizePdfFiles(inputs2, { imageBytes, imageTotalBytes } = { imageByt
96292
96388
  record5(input, bytes);
96293
96389
  }
96294
96390
  if (!pending2.size) return rendered;
96295
- const work = import_node_fs113.default.mkdtempSync(import_node_path116.default.join(import_node_os24.default.tmpdir(), "swift-pdf-png-"));
96391
+ const work = import_node_fs113.default.mkdtempSync(import_node_path116.default.join(import_node_os25.default.tmpdir(), "swift-pdf-png-"));
96296
96392
  let cacheWork;
96297
96393
  let writeCache = true;
96298
96394
  try {
@@ -96345,13 +96441,13 @@ function rasterizePdfFiles(inputs2, { imageBytes, imageTotalBytes } = { imageByt
96345
96441
  }
96346
96442
  return rendered;
96347
96443
  }
96348
- var import_node_child_process59, import_node_fs113, import_node_os24, import_node_path116, RASTER_PDF;
96444
+ var import_node_child_process59, import_node_fs113, import_node_os25, import_node_path116, RASTER_PDF;
96349
96445
  var init_swift_pdf_raster = __esm({
96350
96446
  "src/swift-pdf-raster.ts"() {
96351
96447
  "use strict";
96352
96448
  import_node_child_process59 = require("node:child_process");
96353
96449
  import_node_fs113 = __toESM(require("node:fs"), 1);
96354
- import_node_os24 = __toESM(require("node:os"), 1);
96450
+ import_node_os25 = __toESM(require("node:os"), 1);
96355
96451
  import_node_path116 = __toESM(require("node:path"), 1);
96356
96452
  init_internal_child_contract();
96357
96453
  init_self_invocation();
@@ -96894,6 +96990,15 @@ var init_swift_sdk_later_data = __esm({
96894
96990
  });
96895
96991
 
96896
96992
  // src/swift-host.ts
96993
+ function readPackageFileScoped(packagePath, file, maxBytes) {
96994
+ const scope2 = packageReadScopes.getStore();
96995
+ const key2 = `${packagePath}\0${file}`;
96996
+ const cached2 = scope2?.get(key2);
96997
+ if (cached2) return cached2;
96998
+ const bytes = readPackageFile2(packagePath, file, maxBytes);
96999
+ scope2?.set(key2, bytes);
97000
+ return bytes;
97001
+ }
96897
97002
  function swiftPackageId(packagePath) {
96898
97003
  return import_node_path117.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
96899
97004
  }
@@ -98517,7 +98622,7 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs2, resourceBundles) {
98517
98622
  }
98518
98623
  }
98519
98624
  if (xcode?.app.postBundleScripts.length) {
98520
- const dir = import_node_fs114.default.mkdtempSync(import_node_path117.default.join(import_node_os25.default.tmpdir(), "peach-xcode-bundle-"));
98625
+ const dir = import_node_fs114.default.mkdtempSync(import_node_path117.default.join(import_node_os26.default.tmpdir(), "peach-xcode-bundle-"));
98521
98626
  const wrapper = import_node_path117.default.basename(xcode.app.settings("UNLOCALIZED_RESOURCES_FOLDER_PATH")) || `${xcode.app.name}.app`;
98522
98627
  const bundle = import_node_path117.default.join(dir, wrapper);
98523
98628
  try {
@@ -98695,13 +98800,7 @@ function moduleStamp(packagePath, moduleRootOverride, hosted) {
98695
98800
  (root) => import_node_fs114.default.existsSync(import_node_path117.default.join(root, "toolchain.json"))
98696
98801
  );
98697
98802
  if (!moduleRoot) return "";
98698
- const hash = (0, import_node_crypto70.createHash)("sha256");
98699
- hash.update(moduleRoot);
98700
- for (const relative4 of swiftModuleInputFiles(moduleRoot)) {
98701
- hash.update(relative4);
98702
- hash.update(String(import_node_fs114.default.statSync(import_node_path117.default.join(moduleRoot, relative4)).mtimeMs));
98703
- }
98704
- return hash.digest("hex");
98803
+ return `${moduleRoot}\0${swiftModuleStamp(moduleRoot)}`;
98705
98804
  }
98706
98805
  function otherInputs(input) {
98707
98806
  const { files: _files, ...rest } = input;
@@ -98821,7 +98920,7 @@ function packageSources(packagePath, hosted = false, linked = /* @__PURE__ */ ne
98821
98920
  for (const file of sourceFiles(packagePath)) {
98822
98921
  const relative4 = import_node_path117.default.relative(packagePath, file).split(import_node_path117.default.sep).join(import_node_path117.default.posix.sep);
98823
98922
  if (manifests.has(file) || xcode?.packageFiles.has(file)) continue;
98824
- files2[xcode ? xcodeInputKey(xcode, file, relative4) : relative4] = (xcode?.nativeFiles.get(file) ?? readPackageFile2(packagePath, file, limits.sourceBytes)).toString("utf8");
98923
+ files2[xcode ? xcodeInputKey(xcode, file, relative4) : relative4] = (xcode?.nativeFiles.get(file) ?? readPackageFileScoped(packagePath, file, limits.sourceBytes)).toString("utf8");
98825
98924
  }
98826
98925
  if (xcode) {
98827
98926
  for (const [file, contents2] of xcode.nativeFiles)
@@ -99116,48 +99215,52 @@ async function compile(packagePath, stamp, moduleRootOverride, hosted, snapshot,
99116
99215
  const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
99117
99216
  (root) => import_node_fs114.default.existsSync(import_node_path117.default.join(root, "toolchain.json"))
99118
99217
  ) ?? await swiftDistributionRoot(signal);
99119
- const toolchain = swiftModuleToolchain(moduleRoot);
99218
+ const release = swiftModuleRelease(moduleRoot);
99120
99219
  const input = snapshotCompileInput(snapshot);
99121
99220
  const compiled = {
99122
99221
  files: input.files,
99123
99222
  inputs: otherInputs(input),
99124
99223
  module: moduleStamp(packagePath, moduleRootOverride, false)
99125
99224
  };
99126
- const parsed2 = compileTargets(input);
99127
- const targets = parsed2.map((target) => swiftTargetModuleName(target.name));
99128
- const byPath = [...parsed2].sort((left, right) => right.path.length - left.path.length);
99129
- const clangModulesByTarget = new Map(
99130
- (input.nativeTargets ?? []).map(({ name: name3, headerSearchPaths }) => [
99131
- name3,
99132
- headerSearchPaths.flatMap((directory2) => {
99133
- const map2 = input.files[import_node_path117.default.posix.join(directory2, "module.modulemap")] ?? input.files[import_node_path117.default.posix.join(directory2, "module.map")];
99134
- return map2 === void 0 ? [] : moduleMapModules(map2).map(({ name: name4 }) => name4);
99135
- })
99136
- ])
99137
- );
99138
- const providedByFile = (file) => {
99139
- const owner = byPath.find(
99140
- (target) => target.path === "." ? true : file.startsWith(`${target.path}/`)
99225
+ const verifyMissingModules = async (toolchainBin) => {
99226
+ const parsed2 = compileTargets(input);
99227
+ const targets = parsed2.map((target) => swiftTargetModuleName(target.name));
99228
+ const byPath = [...parsed2].sort((left, right) => right.path.length - left.path.length);
99229
+ const clangModulesByTarget = new Map(
99230
+ (input.nativeTargets ?? []).map(({ name: name3, headerSearchPaths }) => [
99231
+ name3,
99232
+ headerSearchPaths.flatMap((directory2) => {
99233
+ const map2 = input.files[import_node_path117.default.posix.join(directory2, "module.modulemap")] ?? input.files[import_node_path117.default.posix.join(directory2, "module.map")];
99234
+ return map2 === void 0 ? [] : moduleMapModules(map2).map(({ name: name4 }) => name4);
99235
+ })
99236
+ ])
99141
99237
  );
99142
- if (!owner) return [];
99143
- const clangModules = clangModulesByTarget.get(owner.name) ?? [];
99144
- return owner.experimentalFeatures?.includes("BuiltinModule") ? [...clangModules, "Builtin"] : clangModules;
99238
+ const providedByFile = (file) => {
99239
+ const owner = byPath.find(
99240
+ (target) => target.path === "." ? true : file.startsWith(`${target.path}/`)
99241
+ );
99242
+ if (!owner) return [];
99243
+ const clangModules = clangModulesByTarget.get(owner.name) ?? [];
99244
+ return owner.experimentalFeatures?.includes("BuiltinModule") ? [...clangModules, "Builtin"] : clangModules;
99245
+ };
99246
+ const missing2 = missingSwiftModules(
99247
+ input.files,
99248
+ /* @__PURE__ */ new Set([
99249
+ ...swiftAvailableModules(moduleRoot, toolchainBin),
99250
+ // a project without a manifest compiles as the template's one App target
99251
+ ...targets.length > 0 ? targets : ["App"],
99252
+ // a system target's clang module name need not match its target name
99253
+ ...swiftSystemLibrarySurface(input.files, parsed2).modules,
99254
+ ...Object.keys(input.binaryModules ?? {}),
99255
+ ...snapshot.nativeModules
99256
+ ]),
99257
+ providedByFile
99258
+ );
99259
+ if (missing2.size > 0)
99260
+ throw new SwiftMissingModulesError(
99261
+ await missingModulesMessage(packagePath, missing2)
99262
+ );
99145
99263
  };
99146
- const missing2 = missingSwiftModules(
99147
- input.files,
99148
- /* @__PURE__ */ new Set([
99149
- ...swiftAvailableModules(moduleRoot, toolchain.toolchainBin),
99150
- // a project without a manifest compiles as the template's one App target
99151
- ...targets.length > 0 ? targets : ["App"],
99152
- // a system target's clang module name need not match its target name
99153
- ...swiftSystemLibrarySurface(input.files, parsed2).modules,
99154
- ...Object.keys(input.binaryModules ?? {}),
99155
- ...snapshot.nativeModules
99156
- ]),
99157
- providedByFile
99158
- );
99159
- if (missing2.size > 0)
99160
- throw new SwiftMissingModulesError(await missingModulesMessage(packagePath, missing2));
99161
99264
  const artifact = await compileSwiftProjectUnit(input, {
99162
99265
  // the compile rewrites Sources/App in its root before swiftpm builds, and
99163
99266
  // a root lock orders every process using it, so two vites on one root
@@ -99167,7 +99270,9 @@ async function compile(packagePath, stamp, moduleRootOverride, hosted, snapshot,
99167
99270
  // incremental build across restarts.
99168
99271
  buildRoot: swiftBuildRoot(packagePath, moduleRoot),
99169
99272
  moduleRoot,
99170
- ...toolchain,
99273
+ release,
99274
+ resolveToolchain: () => swiftModuleToolchain(moduleRoot).toolchainBin,
99275
+ beforeCompile: verifyMissingModules,
99171
99276
  signal
99172
99277
  }).catch((error) => {
99173
99278
  const report = error instanceof Error ? swiftApiGapReport(error.message) : null;
@@ -99378,9 +99483,11 @@ function currentStamp(project2, moduleRoot) {
99378
99483
  );
99379
99484
  }
99380
99485
  function artifactFor(project2, entry, moduleRoot, signal = project2.signal) {
99381
- return withXcodeLayout(
99382
- project2.packagePath,
99383
- () => scopedArtifact(project2, entry, moduleRoot, signal)
99486
+ return withSwiftModuleDigestScope(
99487
+ () => withXcodeLayout(
99488
+ project2.packagePath,
99489
+ () => scopedArtifact(project2, entry, moduleRoot, signal)
99490
+ )
99384
99491
  );
99385
99492
  }
99386
99493
  function scopedArtifact(project2, entry, moduleRoot, signal) {
@@ -99441,6 +99548,48 @@ function scopedArtifact(project2, entry, moduleRoot, signal) {
99441
99548
  project2.building = { stamp, promise: fresh, signal };
99442
99549
  return fresh;
99443
99550
  }
99551
+ function readCachedSplitBinding(cacheDir6) {
99552
+ const receiptFile2 = import_node_path117.default.join(cacheDir6, "receipt.json");
99553
+ if (!import_node_fs114.default.existsSync(receiptFile2)) return null;
99554
+ try {
99555
+ const receipt = JSON.parse(import_node_fs114.default.readFileSync(receiptFile2, "utf8"));
99556
+ if (!receipt || typeof receipt !== "object" || !("digest" in receipt) || typeof receipt.digest !== "string" || !("later" in receipt) || !Array.isArray(receipt.later) || !receipt.later.every((item) => typeof item === "string"))
99557
+ return null;
99558
+ const binding = import_node_fs114.default.readFileSync(import_node_path117.default.join(cacheDir6, "binding.bin"));
99559
+ if ((0, import_node_crypto70.createHash)("sha256").update(binding).digest("hex") !== receipt.digest) return null;
99560
+ const later = receipt.later.map((sha2564, index) => {
99561
+ const bytes = import_node_fs114.default.readFileSync(import_node_path117.default.join(cacheDir6, `later-${index}.bin`));
99562
+ if ((0, import_node_crypto70.createHash)("sha256").update(bytes).digest("hex") !== sha2564)
99563
+ throw new SyntaxError("digest mismatch");
99564
+ return { sha256: sha2564, bytes };
99565
+ });
99566
+ return { digest: receipt.digest, binding, later };
99567
+ } catch {
99568
+ return null;
99569
+ }
99570
+ }
99571
+ function writeCachedSplitBinding(cacheDir6, digest3, binding, later) {
99572
+ const parent = import_node_path117.default.dirname(cacheDir6);
99573
+ import_node_fs114.default.mkdirSync(parent, { recursive: true });
99574
+ const staging = `${cacheDir6}.${process.pid}.${(0, import_node_crypto70.randomUUID)()}.tmp`;
99575
+ try {
99576
+ import_node_fs114.default.mkdirSync(staging, { recursive: true });
99577
+ import_node_fs114.default.writeFileSync(import_node_path117.default.join(staging, "binding.bin"), binding);
99578
+ for (let index = 0; index < later.length; index++)
99579
+ import_node_fs114.default.writeFileSync(import_node_path117.default.join(staging, `later-${index}.bin`), later[index].bytes);
99580
+ import_node_fs114.default.writeFileSync(
99581
+ import_node_path117.default.join(staging, "receipt.json"),
99582
+ JSON.stringify({ digest: digest3, later: later.map(({ sha256: sha2564 }) => sha2564) })
99583
+ );
99584
+ try {
99585
+ import_node_fs114.default.renameSync(staging, cacheDir6);
99586
+ } catch {
99587
+ if (!import_node_fs114.default.existsSync(cacheDir6)) throw new Error(`failed to store ${cacheDir6}`);
99588
+ }
99589
+ } finally {
99590
+ import_node_fs114.default.rmSync(staging, { recursive: true, force: true });
99591
+ }
99592
+ }
99444
99593
  async function splitSdkBinding(sdk2, splitKey, plan) {
99445
99594
  const key2 = `${sdk2.binding.sha256}:${splitKey}`;
99446
99595
  if (sdkSplitBindings.has(key2)) return;
@@ -99448,15 +99597,29 @@ async function splitSdkBinding(sdk2, splitKey, plan) {
99448
99597
  Promise.resolve().then(() => (init_swift_sdk_later_data(), swift_sdk_later_data_exports)),
99449
99598
  Promise.resolve().then(() => (init_swift_sdk_image(), swift_sdk_image_exports))
99450
99599
  ]);
99451
- const split = splitSwiftSdkLaterData2(
99452
- import_node_path117.default.dirname(swiftSdkImageFile2(sdk2.key)),
99453
- sdk2.binding.bytes,
99454
- plan
99455
- );
99600
+ const sdkDirectory = import_node_path117.default.dirname(swiftSdkImageFile2(sdk2.key));
99601
+ const planDigest = (0, import_node_crypto70.createHash)("sha256").update(plan).digest("hex");
99602
+ const cacheDir6 = import_node_path117.default.join(
99603
+ sdkDirectory,
99604
+ "split-bindings-v1",
99605
+ (0, import_node_crypto70.createHash)("sha256").update(`${sdk2.binding.sha256}\0${planDigest}`).digest("hex").slice(0, 32)
99606
+ );
99607
+ const cached2 = readCachedSplitBinding(cacheDir6);
99608
+ if (cached2) {
99609
+ sdkBindingFiles.set(cached2.digest, cached2.binding);
99610
+ for (const { sha256: sha2564, bytes } of cached2.later) sdkBindingFiles.set(sha2564, bytes);
99611
+ sdkSplitBindings.set(key2, cached2.digest);
99612
+ return;
99613
+ }
99614
+ const split = splitSwiftSdkLaterData2(sdkDirectory, sdk2.binding.bytes, plan);
99456
99615
  const digest3 = (0, import_node_crypto70.createHash)("sha256").update(split.binding).digest("hex");
99616
+ const later = split.later.map((bytes) => ({
99617
+ sha256: (0, import_node_crypto70.createHash)("sha256").update(bytes).digest("hex"),
99618
+ bytes
99619
+ }));
99620
+ writeCachedSplitBinding(cacheDir6, digest3, split.binding, later);
99457
99621
  sdkBindingFiles.set(digest3, split.binding);
99458
- for (const later of split.later)
99459
- sdkBindingFiles.set((0, import_node_crypto70.createHash)("sha256").update(later).digest("hex"), later);
99622
+ for (const { sha256: sha2564, bytes } of later) sdkBindingFiles.set(sha2564, bytes);
99460
99623
  sdkSplitBindings.set(key2, digest3);
99461
99624
  }
99462
99625
  function swiftSdkEntryAssets(origin, image, sdkDigest = image.sdk?.sha256) {
@@ -99546,15 +99709,15 @@ async function swiftArtifactAssets(artifact, { sdkUrl, sdkBindingUrl }) {
99546
99709
  }
99547
99710
  return assets2;
99548
99711
  }
99549
- var import_node_async_hooks3, import_node_child_process60, import_node_crypto70, import_node_fs114, import_node_os25, import_node_path117, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SDK_PATH, SDK_BINDING_PATH, SKIP_ROOT_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, SwiftMissingModulesError, swiftArtifactDigests, sharedProjects, projectScope, projects, sharedSourceEntries, sourceEntries, sharedXcodeProjects, xcodeProjects, preparedScriptInputs, emptyWasmAssembly, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, layoutScope, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, IOS_SDK_FRAMEWORKS, sdkStartupParts, sdkPieces2, sdkSplitBindings, sdkBindingFiles, servedSdkBinding;
99712
+ var import_node_async_hooks4, import_node_child_process60, import_node_crypto70, import_node_fs114, import_node_os26, import_node_path117, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SDK_PATH, SDK_BINDING_PATH, SKIP_ROOT_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, packageReadScopes, SwiftMissingModulesError, swiftArtifactDigests, sharedProjects, projectScope, projects, sharedSourceEntries, sourceEntries, sharedXcodeProjects, xcodeProjects, preparedScriptInputs, emptyWasmAssembly, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, layoutScope, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, IOS_SDK_FRAMEWORKS, sdkStartupParts, sdkPieces2, sdkSplitBindings, sdkBindingFiles, servedSdkBinding;
99550
99713
  var init_swift_host = __esm({
99551
99714
  "src/swift-host.ts"() {
99552
99715
  "use strict";
99553
- import_node_async_hooks3 = require("node:async_hooks");
99716
+ import_node_async_hooks4 = require("node:async_hooks");
99554
99717
  import_node_child_process60 = require("node:child_process");
99555
99718
  import_node_crypto70 = require("node:crypto");
99556
99719
  import_node_fs114 = __toESM(require("node:fs"), 1);
99557
- import_node_os25 = __toESM(require("node:os"), 1);
99720
+ import_node_os26 = __toESM(require("node:os"), 1);
99558
99721
  import_node_path117 = __toESM(require("node:path"), 1);
99559
99722
  init_pngHeader();
99560
99723
  init_nativeSdkBindingContract();
@@ -99584,6 +99747,7 @@ var init_swift_host = __esm({
99584
99747
  init_swift_packages();
99585
99748
  init_swift_pdf_raster();
99586
99749
  init_swift_sdk_image_wasm();
99750
+ init_swift_sdk_surface();
99587
99751
  init_swift_shipped_binaries();
99588
99752
  init_swift_source_file();
99589
99753
  init_swift_standin_config();
@@ -99604,11 +99768,12 @@ var init_swift_host = __esm({
99604
99768
  SKIP_ROOT_DIRS = /* @__PURE__ */ new Set(["dist", "types", "build", "ios", "android"]);
99605
99769
  NATIVE_DESCRIPTOR = ".one-native-source.json";
99606
99770
  NATIVE_GLUE = ".one-native-source.swift.txt";
99771
+ packageReadScopes = new import_node_async_hooks4.AsyncLocalStorage();
99607
99772
  SwiftMissingModulesError = class extends Error {
99608
99773
  };
99609
99774
  swiftArtifactDigests = /* @__PURE__ */ new WeakMap();
99610
99775
  sharedProjects = /* @__PURE__ */ new Map();
99611
- projectScope = new import_node_async_hooks3.AsyncLocalStorage();
99776
+ projectScope = new import_node_async_hooks4.AsyncLocalStorage();
99612
99777
  projects = () => projectScope.getStore()?.projects ?? sharedProjects;
99613
99778
  sharedSourceEntries = /* @__PURE__ */ new Map();
99614
99779
  sourceEntries = () => projectScope.getStore()?.sourceEntries ?? sharedSourceEntries;
@@ -99619,7 +99784,7 @@ var init_swift_host = __esm({
99619
99784
  XCODE_APP_DIR = "__app__";
99620
99785
  XCODE_FRAMEWORKS_DIR = "__frameworks__";
99621
99786
  XCODE_PACKAGES_DIR = SWIFT_REMOTE_PACKAGES_DIR;
99622
- layoutScope = new import_node_async_hooks3.AsyncLocalStorage();
99787
+ layoutScope = new import_node_async_hooks4.AsyncLocalStorage();
99623
99788
  HOSTED_LIMITS = {
99624
99789
  sourceBytes: MAX_SWIFT_COMPILE_SOURCE_BYTES,
99625
99790
  resources: MAX_SWIFT_COMPILE_RESOURCES,
@@ -105509,7 +105674,7 @@ function retainInstalledReactNativeDeclarations(snapshot, options2, skipped, cor
105509
105674
  async function prepareTurboCompileInput(options2) {
105510
105675
  await prepareTurboSourceDependencies(options2.reactNativeRoot);
105511
105676
  const key2 = (0, import_node_crypto73.createHash)("sha256").update(options2.providers.map(({ root }) => import_node_fs119.default.realpathSync(root)).join("\0")).update("\0").update(import_node_fs119.default.realpathSync(options2.moduleRoot)).digest("hex");
105512
- const scratch2 = import_node_path122.default.join(import_node_os26.default.tmpdir(), "peach-turbo-swift", key2);
105677
+ const scratch2 = import_node_path122.default.join(import_node_os27.default.tmpdir(), "peach-turbo-swift", key2);
105513
105678
  import_node_fs119.default.mkdirSync(scratch2, { recursive: true });
105514
105679
  const codegenDir = import_node_fs119.default.mkdtempSync(import_node_path122.default.join(scratch2, "codegen-"));
105515
105680
  const collection = await collectTurboSources({
@@ -105750,14 +105915,14 @@ async function compileTurboModule(options2) {
105750
105915
  collection
105751
105916
  };
105752
105917
  }
105753
- var import_node_crypto73, import_node_fs119, import_node_module15, import_node_os26, import_node_path122;
105918
+ var import_node_crypto73, import_node_fs119, import_node_module15, import_node_os27, import_node_path122;
105754
105919
  var init_turbo_compile = __esm({
105755
105920
  "src/turbo-compile.ts"() {
105756
105921
  "use strict";
105757
105922
  import_node_crypto73 = require("node:crypto");
105758
105923
  import_node_fs119 = __toESM(require("node:fs"), 1);
105759
105924
  import_node_module15 = require("node:module");
105760
- import_node_os26 = __toESM(require("node:os"), 1);
105925
+ import_node_os27 = __toESM(require("node:os"), 1);
105761
105926
  import_node_path122 = __toESM(require("node:path"), 1);
105762
105927
  init_native_app_identity_project();
105763
105928
  init_nitro_adapter();
@@ -106906,7 +107071,7 @@ async function prepareNitroCompileInput(options2) {
106906
107071
  );
106907
107072
  if (reactProviders.length > 0 || usesReactHeaders) {
106908
107073
  const nitroReactCodegenDir = import_node_fs123.default.mkdtempSync(
106909
- import_node_path126.default.join(import_node_os27.default.tmpdir(), "peach-nitro-react-")
107074
+ import_node_path126.default.join(import_node_os28.default.tmpdir(), "peach-nitro-react-")
106910
107075
  );
106911
107076
  let support;
106912
107077
  try {
@@ -106997,7 +107162,7 @@ async function prepareNitroCompileInput(options2) {
106997
107162
  const key2 = (0, import_node_crypto76.createHash)("sha256").update(
106998
107163
  collection.providers.map(({ root, hybridObjects }) => `${root}\0${hybridObjects.join(",")}`).join("\0")
106999
107164
  ).update("\0").update(import_node_fs123.default.realpathSync(options2.moduleRoot)).update("\0").update(options2.configuration).digest("hex");
107000
- const packagePath = import_node_path126.default.join(import_node_os27.default.tmpdir(), "peach-nitro-swift", key2, `p${process.pid}`);
107165
+ const packagePath = import_node_path126.default.join(import_node_os28.default.tmpdir(), "peach-nitro-swift", key2, `p${process.pid}`);
107001
107166
  const sharedLibrary = [...nativeLibraries.values()].find(
107002
107167
  (pod) => pod.sharedLibrary
107003
107168
  )?.sharedLibrary;
@@ -107050,13 +107215,13 @@ function nitrogenGeneratedSources(podDirectory) {
107050
107215
  ...sources(import_node_path126.default.join(generated, "ios"), /\.(h|hpp|c|cpp|mm|swift)$/)
107051
107216
  ];
107052
107217
  }
107053
- var import_node_crypto76, import_node_fs123, import_node_os27, import_node_path126, BUNDLED_CXX_NAMESPACES, REACT_INCLUDE_PATTERN, REACT_LINKING_PATTERN, REACT_VERSION_PATTERN, RN_HEADER_DIR_MAP, RN_COMMON_ROOTS;
107218
+ var import_node_crypto76, import_node_fs123, import_node_os28, import_node_path126, BUNDLED_CXX_NAMESPACES, REACT_INCLUDE_PATTERN, REACT_LINKING_PATTERN, REACT_VERSION_PATTERN, RN_HEADER_DIR_MAP, RN_COMMON_ROOTS;
107054
107219
  var init_nitro_compile = __esm({
107055
107220
  "src/nitro-compile.ts"() {
107056
107221
  "use strict";
107057
107222
  import_node_crypto76 = require("node:crypto");
107058
107223
  import_node_fs123 = __toESM(require("node:fs"), 1);
107059
- import_node_os27 = __toESM(require("node:os"), 1);
107224
+ import_node_os28 = __toESM(require("node:os"), 1);
107060
107225
  import_node_path126 = __toESM(require("node:path"), 1);
107061
107226
  init_answeredNativePackages();
107062
107227
  init_installed_native_libraries();
@@ -107314,7 +107479,7 @@ var init_nitro_superset = __esm({
107314
107479
  init_nitroContract();
107315
107480
  init_swift_standin_digest();
107316
107481
  NITRO_SUPERSET_ENTRY_NAME = "superset";
107317
- NITRO_COMPILER_DIGEST = true ? "792552c7293b0b18138700877b417617e7c7d5377e8dbb1b4830ccfc7fa12d93" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
107482
+ NITRO_COMPILER_DIGEST = true ? "f6a7a95d8b94acf3b85a06a8646dd3fa62a10b41bd72c1a91c9cfd465a4020e8" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
107318
107483
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
107319
107484
  nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
107320
107485
  published = /* @__PURE__ */ new Map();
@@ -108018,7 +108183,7 @@ var init_expo_eager_seam_contract = __esm({
108018
108183
 
108019
108184
  // src/expo-native-compiler-digest.ts
108020
108185
  function expoNativeCompilerDigestValue() {
108021
- return true ? "2be825804899df21358b1c725c460d2adeaab3da960104b6de6cd3b3ecf26ea5" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
108186
+ return true ? "b4e25c90e8991056f9eabb85f4bd74963cb974e51d846f32f7c48265169d029c" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
108022
108187
  }
108023
108188
  var import_node_crypto80;
108024
108189
  var init_expo_native_compiler_digest = __esm({
@@ -108577,14 +108742,14 @@ async function readExpoConfigAsync(projectRoot) {
108577
108742
  import_node_fs130.default.rmSync(directory2, { recursive: true, force: true });
108578
108743
  }
108579
108744
  }
108580
- var import_node_child_process63, import_node_fs130, import_node_module18, import_node_os28, import_node_path133, EXPO_CONFIG_SCRIPT, EXPO_CONFIG_TIMEOUT_MS, resultDirectory;
108745
+ var import_node_child_process63, import_node_fs130, import_node_module18, import_node_os29, import_node_path133, EXPO_CONFIG_SCRIPT, EXPO_CONFIG_TIMEOUT_MS, resultDirectory;
108581
108746
  var init_native_firebase_config = __esm({
108582
108747
  "src/native-firebase-config.ts"() {
108583
108748
  "use strict";
108584
108749
  import_node_child_process63 = require("node:child_process");
108585
108750
  import_node_fs130 = __toESM(require("node:fs"), 1);
108586
108751
  import_node_module18 = require("node:module");
108587
- import_node_os28 = __toESM(require("node:os"), 1);
108752
+ import_node_os29 = __toESM(require("node:os"), 1);
108588
108753
  import_node_path133 = __toESM(require("node:path"), 1);
108589
108754
  init_is_record();
108590
108755
  init_plist();
@@ -108606,7 +108771,7 @@ const result = JSON.stringify(getConfig(root, { skipSDKVersionRequirement: true
108606
108771
  if (Buffer.byteLength(result) > 1024 * 1024) throw new Error('Expo native configuration exceeds 1 MiB.');
108607
108772
  writeFileSync(process.argv[2], result, { mode: 0o600 });`;
108608
108773
  EXPO_CONFIG_TIMEOUT_MS = 3e4;
108609
- resultDirectory = () => import_node_fs130.default.mkdtempSync(import_node_path133.default.join(import_node_os28.default.tmpdir(), "peach-expo-config-"));
108774
+ resultDirectory = () => import_node_fs130.default.mkdtempSync(import_node_path133.default.join(import_node_os29.default.tmpdir(), "peach-expo-config-"));
108610
108775
  }
108611
108776
  });
108612
108777
 
@@ -111281,7 +111446,7 @@ function expoUnitAppPaths(unit2) {
111281
111446
  });
111282
111447
  }
111283
111448
  function expoSwiftPackage(appKey, name3) {
111284
- return import_node_path137.default.join(import_node_os29.default.tmpdir(), "peach-expo-swift", appKey, `p${process.pid}`, name3);
111449
+ return import_node_path137.default.join(import_node_os30.default.tmpdir(), "peach-expo-swift", appKey, `p${process.pid}`, name3);
111285
111450
  }
111286
111451
  function failureRecordPath(packagePath) {
111287
111452
  const app = import_node_path137.default.dirname(import_node_path137.default.dirname(packagePath));
@@ -111985,16 +112150,16 @@ async function compileExpoSwiftModulesTraced(root, base2, publishArtifact, optio
111985
112150
  throw failure2;
111986
112151
  }
111987
112152
  }
111988
- var import_node_async_hooks4, import_node_child_process65, import_node_crypto84, import_node_fs134, import_node_module21, import_node_os29, import_node_path137, import_node_url4, import_node_util18, run11, scriptEnv, EXPO_SWIFT_ENTRY, WITNESS_BATCH, traceStore, discoveryCache, preparedCache, savedFs, ignoredRoots, ownTemporaryRoots, EXPO_MODULE_SCAN_TIMEOUT_MS, preparedExpoSwift, openPreparations, ExpoSwiftLinkRefusal;
112153
+ var import_node_async_hooks5, import_node_child_process65, import_node_crypto84, import_node_fs134, import_node_module21, import_node_os30, import_node_path137, import_node_url4, import_node_util18, run11, scriptEnv, EXPO_SWIFT_ENTRY, WITNESS_BATCH, traceStore, discoveryCache, preparedCache, savedFs, ignoredRoots, ownTemporaryRoots, EXPO_MODULE_SCAN_TIMEOUT_MS, preparedExpoSwift, openPreparations, ExpoSwiftLinkRefusal;
111989
112154
  var init_expo_swift_host = __esm({
111990
112155
  "src/expo-swift-host.ts"() {
111991
112156
  "use strict";
111992
- import_node_async_hooks4 = require("node:async_hooks");
112157
+ import_node_async_hooks5 = require("node:async_hooks");
111993
112158
  import_node_child_process65 = require("node:child_process");
111994
112159
  import_node_crypto84 = require("node:crypto");
111995
112160
  import_node_fs134 = __toESM(require("node:fs"), 1);
111996
112161
  import_node_module21 = require("node:module");
111997
- import_node_os29 = __toESM(require("node:os"), 1);
112162
+ import_node_os30 = __toESM(require("node:os"), 1);
111998
112163
  import_node_path137 = __toESM(require("node:path"), 1);
111999
112164
  import_node_url4 = require("node:url");
112000
112165
  import_node_util18 = require("node:util");
@@ -112032,7 +112197,7 @@ var init_expo_swift_host = __esm({
112032
112197
  scriptEnv = { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: "1" };
112033
112198
  EXPO_SWIFT_ENTRY = "Sources/PeachExpoApp/PeachExpoEntry.swift";
112034
112199
  WITNESS_BATCH = 200;
112035
- traceStore = new import_node_async_hooks4.AsyncLocalStorage();
112200
+ traceStore = new import_node_async_hooks5.AsyncLocalStorage();
112036
112201
  discoveryCache = /* @__PURE__ */ new Map();
112037
112202
  preparedCache = /* @__PURE__ */ new Map();
112038
112203
  savedFs = null;
@@ -113617,7 +113782,7 @@ function extract(bytes, where) {
113617
113782
  const cached2 = pending.get(key2);
113618
113783
  if (cached2) return cached2;
113619
113784
  const request = (async () => {
113620
- const dest = import_node_path147.default.join(import_node_os30.default.tmpdir(), "peach-maven-sources", key2);
113785
+ const dest = import_node_path147.default.join(import_node_os31.default.tmpdir(), "peach-maven-sources", key2);
113621
113786
  const marker = import_node_path147.default.join(dest, ".complete");
113622
113787
  if (!import_node_fs143.default.existsSync(marker)) {
113623
113788
  const sources = zipSources(bytes, where);
@@ -113662,13 +113827,13 @@ function readSourcesJar(archive, where) {
113662
113827
  function readMavenSourcesArchive(archive) {
113663
113828
  return extract(readSourcesJar(archive, archive), archive);
113664
113829
  }
113665
- var import_node_crypto89, import_node_fs143, import_node_os30, import_node_path147, import_node_zlib9, pending, MAX_SOURCES_JAR_BYTES, MAX_SOURCE_ENTRY_BYTES, MAX_TOTAL_EXTRACTED_BYTES;
113830
+ var import_node_crypto89, import_node_fs143, import_node_os31, import_node_path147, import_node_zlib9, pending, MAX_SOURCES_JAR_BYTES, MAX_SOURCE_ENTRY_BYTES, MAX_TOTAL_EXTRACTED_BYTES;
113666
113831
  var init_kotlin_maven_sources = __esm({
113667
113832
  "src/kotlin-maven-sources.ts"() {
113668
113833
  "use strict";
113669
113834
  import_node_crypto89 = require("node:crypto");
113670
113835
  import_node_fs143 = __toESM(require("node:fs"), 1);
113671
- import_node_os30 = __toESM(require("node:os"), 1);
113836
+ import_node_os31 = __toESM(require("node:os"), 1);
113672
113837
  import_node_path147 = __toESM(require("node:path"), 1);
113673
113838
  import_node_zlib9 = require("node:zlib");
113674
113839
  pending = /* @__PURE__ */ new Map();
@@ -116242,7 +116407,7 @@ init_bundleAssets();
116242
116407
  init_expo_native_workspace();
116243
116408
 
116244
116409
  // src/host/staged-host-files.ts
116245
- var import_node_async_hooks5 = require("node:async_hooks");
116410
+ var import_node_async_hooks6 = require("node:async_hooks");
116246
116411
  var import_node_crypto92 = require("node:crypto");
116247
116412
  var import_node_fs148 = __toESM(require("node:fs"), 1);
116248
116413
  var import_node_path152 = __toESM(require("node:path"), 1);
@@ -116351,7 +116516,7 @@ function readPackageManifest() {
116351
116516
  var { routes, bundledFiles } = readPackageManifest();
116352
116517
 
116353
116518
  // src/host/staged-host-files.ts
116354
- var stagedCapture = new import_node_async_hooks5.AsyncLocalStorage();
116519
+ var stagedCapture = new import_node_async_hooks6.AsyncLocalStorage();
116355
116520
  async function captureStagedHostFiles(prepare3) {
116356
116521
  const names = /* @__PURE__ */ new Set();
116357
116522
  const value = await stagedCapture.run(names, prepare3);