peachsim 0.1.2777 → 0.1.2779

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 (154) 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 +669 -840
  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-M5O633NZ.mjs → acorn-SCZ56W4Q.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-NJHTAVEI.mjs → chunk-6BNEOOBT.mjs} +124 -18
  28. package/dist-lib/esm-chunks/{chunk-LB2X5KYV.mjs → chunk-7VWBLM73.mjs} +1 -1
  29. package/dist-lib/esm-chunks/{chunk-V2I633CU.mjs → chunk-DX5V3733.mjs} +4 -4
  30. package/dist-lib/esm-chunks/{chunk-THHP5XKD.mjs → chunk-E56EZ3QT.mjs} +3 -3
  31. package/dist-lib/esm-chunks/{chunk-TRSHEQVJ.mjs → chunk-FNQXQNQK.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-WSHBJUCP.mjs → chunk-H2V3ZZTO.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-OVCIWUV2.mjs → chunk-H6JAFCAZ.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-ZKPBT6FD.mjs → chunk-HMFIO57I.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-DPL3I4WY.mjs → chunk-HWK2V6R4.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-OSESKVWT.mjs → chunk-KAMO4C4X.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-TONCJKKR.mjs → chunk-KFDP4372.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-FHYWKCOZ.mjs → chunk-KOULWLTF.mjs} +2 -2
  39. package/dist-lib/esm-chunks/{chunk-Q42OLP7O.mjs → chunk-LVEDBGWX.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-RX3WDTYI.mjs → chunk-MJXJYVF5.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-GISUEYXO.mjs → chunk-MK4VAM4G.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-AGWZKA24.mjs → chunk-Q6XMYYNV.mjs} +168 -421
  43. package/dist-lib/esm-chunks/{chunk-KCSUAVJQ.mjs → chunk-SFTGQN5D.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-Q53QPYEU.mjs → chunk-SM5MJSQP.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-3UJO4NG3.mjs → chunk-SNMGOZXQ.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-OLCLLGZF.mjs → chunk-SZI5IZ76.mjs} +5 -5
  47. package/dist-lib/esm-chunks/{chunk-FB27T2JY.mjs → chunk-T7DTXCV5.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-IPX66HMP.mjs → chunk-UBM772FD.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-GMN43CNC.mjs → chunk-VJSHIZ7J.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-GSTVX33B.mjs → chunk-Z42YJEC4.mjs} +36 -14
  51. package/dist-lib/esm-chunks/{metro-layout-parser-PFRFHGDY.mjs → metro-layout-parser-7S5M3EG6.mjs} +3 -3
  52. package/dist-lib/esm-chunks/{swift-package-prebuilt-NUAEDMSQ.mjs → swift-package-prebuilt-MJSFHIOP.mjs} +12 -12
  53. package/dist-lib/esm-chunks/{swift-sdk-app-module-P3BARE2W.mjs → swift-sdk-app-module-ZIN3LFLS.mjs} +47 -69
  54. package/dist-lib/esm-chunks/{swift-sdk-image-Y6XT7KI4.mjs → swift-sdk-image-MIWPBZEN.mjs} +16 -16
  55. package/dist-lib/esm-chunks/{swift-sdk-image-producer-DYR47O6H.mjs → swift-sdk-image-producer-OTH543HF.mjs} +5 -5
  56. package/dist-lib/expo-swift-bundle.cjs +592 -763
  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 +735 -901
  61. package/dist-lib/host/fetch-proxy-handler.cjs +117 -93
  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 +20 -15
  75. package/dist-lib/native-app-identity-project.mjs +27 -32
  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 +87 -86
  87. package/dist-lib/public-origins-lib.json +77 -70
  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 +774 -940
  95. package/dist-lib/swift-compile.cjs +376 -525
  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/core-abi/web/sceneClientContract.d.ts +0 -6
  123. package/dist-types/packages/peach-engine/src/components/native-ui/webview-frame-bridge.d.ts +0 -3
  124. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +15 -2
  125. package/dist-types/packages/peach-engine/src/render-worker/worklet-wire.d.ts +10 -1
  126. package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +0 -4
  127. package/package.json +1 -1
  128. package/src/bazel-project.ts +2 -6
  129. package/src/build-cache.ts +3 -2
  130. package/src/sha256.ts +8 -0
  131. package/src/swift-compiler-digest.ts +1 -0
  132. package/src/swift-coverage/indexing.ts +3 -4
  133. package/src/swift-coverage/package.ts +1 -4
  134. package/src/swift-coverage/reader.ts +1 -4
  135. package/src/swift-coverage/source.ts +1 -4
  136. package/src/swift-coverage/xcode-assets.ts +1 -4
  137. package/src/swift-coverage/xcode-bridging.ts +1 -4
  138. package/src/swift-coverage/xcode-packages.ts +1 -4
  139. package/src/swift-coverage/xcode-strings.ts +1 -4
  140. package/src/swift-coverage/xcode.ts +1 -4
  141. package/src/swift-guest-dyld-functions.ts +1 -11
  142. package/src/swift-guest-dyld-table.ts +3 -15
  143. package/src/swift-guest-image-ledger.ts +9 -35
  144. package/src/swift-guest-source-inputs.ts +8 -37
  145. package/src/swift-icu.ts +15 -28
  146. package/src/swift-link-roots.ts +4 -8
  147. package/src/swift-objc-compile.ts +2 -7
  148. package/src/swift-sdk-app-module.ts +5 -27
  149. package/src/swift-sdk-image-wasm.ts +12 -41
  150. package/src/swift-sdk-image.ts +50 -12
  151. package/src/swift-shared-sdk.ts +1 -13
  152. package/src/swift-wasm-archive.ts +6 -11
  153. package/src/swift-wasm-prune.ts +25 -109
  154. package/src/wasm-binary-sections.ts +61 -7
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2777 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2779 | (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;
@@ -3679,15 +3679,15 @@ function nitroDependencyReader(reactNativeVersion, reactNativeRoot) {
3679
3679
  if (!Buffer.from(text7).equals(bytes))
3680
3680
  throw new Error(`Nitro dependency header is not UTF-8: ${source}`);
3681
3681
  const backport = dependency.backport?.file === relative3 ? dependency.backport : void 0;
3682
- let sha2565 = original;
3682
+ let sha2564 = original;
3683
3683
  if (backport) {
3684
3684
  if (original !== backport.originalSha256)
3685
3685
  throw new Error(`${dependency.name} backport original differs: ${relative3}`);
3686
3686
  if (!text7.includes(backport.before))
3687
3687
  throw new Error(`${dependency.name} backport anchor missing: ${relative3}`);
3688
3688
  text7 = text7.replace(backport.before, backport.after);
3689
- sha2565 = (0, import_node_crypto5.createHash)("sha256").update(text7).digest("hex");
3690
- if (sha2565 !== backport.derivedSha256)
3689
+ sha2564 = (0, import_node_crypto5.createHash)("sha256").update(text7).digest("hex");
3690
+ if (sha2564 !== backport.derivedSha256)
3691
3691
  throw new Error(`${dependency.name} backport derived source differs: ${relative3}`);
3692
3692
  }
3693
3693
  return {
@@ -3695,7 +3695,7 @@ function nitroDependencyReader(reactNativeVersion, reactNativeRoot) {
3695
3695
  name: dependency.name,
3696
3696
  source,
3697
3697
  text: text7,
3698
- sha256: sha2565,
3698
+ sha256: sha2564,
3699
3699
  ...backport && {
3700
3700
  derivation: {
3701
3701
  upstreamCommit: backport.upstreamCommit,
@@ -11620,10 +11620,10 @@ function swiftNativePin() {
11620
11620
  }
11621
11621
  return pin;
11622
11622
  }
11623
- function publishedSwiftSdk(sha2565) {
11623
+ function publishedSwiftSdk(sha2564) {
11624
11624
  const { sdkRuntime, sdkGuestRuntime } = swiftNativePin().distribution;
11625
11625
  return [sdkRuntime, sdkGuestRuntime].find(
11626
- (publication) => publication?.source === sha2565
11626
+ (publication) => publication?.source === sha2564
11627
11627
  );
11628
11628
  }
11629
11629
  var pin;
@@ -19579,7 +19579,7 @@ var init_react_native_core_digest = __esm({
19579
19579
 
19580
19580
  // src/swift-compiler-digest.ts
19581
19581
  function swiftArchiveCompilerDigestValue() {
19582
- return true ? "dafa6520c0bcd0e852437835ad9626e824b1e758db5c163a7de2f7fc70ac67ee" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname, "archive");
19582
+ return true ? "b4b2fc7face997792991900efb229414642f042031ba789c00a1d17e542756e3" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname, "archive");
19583
19583
  }
19584
19584
  var import_node_crypto16, import_node_fs32, import_node_path31, SWIFT_DIGEST_SOURCES, LINKED_IMAGE_SOURCES, SWIFT_ARCHIVE_DIGEST_SOURCES;
19585
19585
  var init_swift_compiler_digest = __esm({
@@ -19608,6 +19608,7 @@ var init_swift_compiler_digest = __esm({
19608
19608
  "swift-objc-prebuilt-catalog.ts",
19609
19609
  "swift-toolchain.ts",
19610
19610
  "swift-shared-sdk.ts",
19611
+ "wasm-binary-sections.ts",
19611
19612
  "swift-distribution-mirror.ts",
19612
19613
  "swift-design-time.ts",
19613
19614
  "binaryen.lock.json",
@@ -19725,13 +19726,13 @@ var init_swift_standin_digest = __esm({
19725
19726
  ];
19726
19727
  RUNTIME_IMPORT = /(?:^|[;\n])[ \t]*(?:import|export)\s+(?!type(?:\s|\{))([\s\S]*?)\s+from\s*['"]([^'"]+)['"]|(?:^|[;\n])[ \t]*import\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
19727
19728
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS, STANDIN_DIGEST_EXCLUDED_FILES);
19728
- STANDIN_SOURCE_DIGEST = true ? "c2d1c024e059538977fdd0666278d52ec2116aafae79fe0e8b1cda82a5981f3b" : standinSourceDigest();
19729
+ STANDIN_SOURCE_DIGEST = true ? "6f991ca933bc6ae43f06c18cb2029ff3209de583afa4457105e7452437c20f01" : standinSourceDigest();
19729
19730
  }
19730
19731
  });
19731
19732
 
19732
19733
  // src/expo-native-compiler-digest.ts
19733
19734
  function expoNativeCompilerDigestValue() {
19734
- return true ? "c9950c3dbdb6ca5891145f8c4133c9b62e89b35f62d9343e8d7ef410cda838f5" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
19735
+ return true ? "5217c97f9f40e75420d8af715a312e49984d9ec52582e3c5d6209439c3cb70f4" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
19735
19736
  }
19736
19737
  var import_node_crypto18;
19737
19738
  var init_expo_native_compiler_digest = __esm({
@@ -22948,6 +22949,111 @@ var init_swift_objc_runtime = __esm({
22948
22949
  }
22949
22950
  });
22950
22951
 
22952
+ // src/wasm-binary-sections.ts
22953
+ function encodeWasmNumber(value) {
22954
+ const bytes = [];
22955
+ for (let rest = value; ; ) {
22956
+ const byte = rest % 128;
22957
+ rest = Math.floor(rest / 128);
22958
+ if (rest === 0) return [...bytes, byte];
22959
+ bytes.push(byte | 128);
22960
+ }
22961
+ }
22962
+ function encodeWasmSigned(value) {
22963
+ const out = [];
22964
+ for (; ; ) {
22965
+ const byte = Number(value & 127n);
22966
+ value >>= 7n;
22967
+ if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
22968
+ out.push(byte);
22969
+ return out;
22970
+ }
22971
+ out.push(byte | 128);
22972
+ }
22973
+ }
22974
+ function encodeWasmName(name3) {
22975
+ const bytes = new TextEncoder().encode(name3);
22976
+ return [...encodeWasmNumber(bytes.length), ...bytes];
22977
+ }
22978
+ function readULEB(bytes, offset, end = bytes.length) {
22979
+ if (offset < end) {
22980
+ const first = bytes[offset];
22981
+ if (first < 128) return [first, offset + 1];
22982
+ }
22983
+ let value = 0;
22984
+ for (let shift = 0; ; shift += 7) {
22985
+ if (offset >= end || shift > 63) throw new Error("invalid wasm integer");
22986
+ const byte = bytes[offset++];
22987
+ value += (byte & 127) * 2 ** shift;
22988
+ if (!(byte & 128)) return [value, offset];
22989
+ }
22990
+ }
22991
+ function readSLEB(bytes, offset, end = bytes.length) {
22992
+ let value = 0n;
22993
+ let shift = 0n;
22994
+ let byte = 0;
22995
+ do {
22996
+ if (offset >= end || shift > 70n) throw new Error("invalid wasm integer");
22997
+ byte = bytes[offset++];
22998
+ value |= BigInt(byte & 127) << shift;
22999
+ shift += 7n;
23000
+ } while (byte & 128);
23001
+ if (byte & 64) value -= 1n << shift;
23002
+ return [value, offset];
23003
+ }
23004
+ function skipLEB(bytes, offset) {
23005
+ while ((bytes[offset++] & 128) !== 0) {
23006
+ }
23007
+ return offset;
23008
+ }
23009
+ function readWasmSection(bytes, start, end) {
23010
+ let at = start;
23011
+ const number3 = () => {
23012
+ const [value, next] = readULEB(bytes, at, end);
23013
+ at = next;
23014
+ return value;
23015
+ };
23016
+ return {
23017
+ number: number3,
23018
+ byte: () => {
23019
+ if (at >= end) throw new Error("truncated wasm section");
23020
+ return bytes[at++];
23021
+ },
23022
+ name: () => {
23023
+ const length = number3();
23024
+ at += length;
23025
+ if (at > end) throw new Error("truncated wasm name");
23026
+ return Buffer.from(bytes.buffer, bytes.byteOffset + at - length, length).toString();
23027
+ },
23028
+ skip: (length) => {
23029
+ at += length;
23030
+ if (at > end) throw new Error("truncated wasm section");
23031
+ },
23032
+ position: () => at,
23033
+ done: () => at === end
23034
+ };
23035
+ }
23036
+ function wasmSections(bytes) {
23037
+ if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
23038
+ throw new Error("not a wasm module");
23039
+ const found = [];
23040
+ for (let at = 8; at < bytes.length; ) {
23041
+ const header = readWasmSection(bytes, at, bytes.length);
23042
+ const id = header.byte();
23043
+ const size2 = header.number();
23044
+ const start = header.position();
23045
+ if (start + size2 > bytes.length) throw new Error("truncated wasm section");
23046
+ found.push({ id, offset: at, start, end: start + size2 });
23047
+ at = start + size2;
23048
+ }
23049
+ return found;
23050
+ }
23051
+ var init_wasm_binary_sections = __esm({
23052
+ "src/wasm-binary-sections.ts"() {
23053
+ "use strict";
23054
+ }
23055
+ });
23056
+
22951
23057
  // src/swift-shared-sdk.ts
22952
23058
  function swiftSharedSdkSourceRoot(moduleRoot, distribution) {
22953
23059
  return import_node_path38.default.resolve(moduleRoot, distribution ? "sdk/ios" : "../peachsim/sdk/ios");
@@ -22998,18 +23104,6 @@ function swiftSharedSdkFlags(moduleRoot, distribution) {
22998
23104
  import_node_path38.default.join(root, "usr/include")
22999
23105
  ];
23000
23106
  }
23001
- function readULEB(b, o) {
23002
- let res = 0;
23003
- let shift = 0;
23004
- let p = o;
23005
- while (true) {
23006
- const byte = b[p++];
23007
- res |= (byte & 127) << shift;
23008
- if ((byte & 128) === 0) break;
23009
- shift += 7;
23010
- }
23011
- return [res, p];
23012
- }
23013
23107
  function weakenFoundationSymbolsInWasmObj(buf) {
23014
23108
  let pos = 8;
23015
23109
  while (pos < buf.length) {
@@ -23374,6 +23468,7 @@ var init_swift_shared_sdk = __esm({
23374
23468
  import_node_path38 = __toESM(require("node:path"), 1);
23375
23469
  init_swift_toolchain();
23376
23470
  init_swiftTargetContract();
23471
+ init_wasm_binary_sections();
23377
23472
  SWIFT_DISTRIBUTION_MIRROR_RECORD = ".peach-mirror.json";
23378
23473
  distributionHeaderRoots = /* @__PURE__ */ new Map();
23379
23474
  WEAKEN_FOUNDATION_SYMS = /* @__PURE__ */ new Set([
@@ -24355,6 +24450,21 @@ var init_swift_foundation = __esm({
24355
24450
  }
24356
24451
  });
24357
24452
 
24453
+ // src/sha256.ts
24454
+ function sha256Hex2(input) {
24455
+ if (typeof Bun !== "undefined") {
24456
+ return new Bun.CryptoHasher("sha256").update(input).digest("hex");
24457
+ }
24458
+ return (0, import_node_crypto25.createHash)("sha256").update(input).digest("hex");
24459
+ }
24460
+ var import_node_crypto25;
24461
+ var init_sha256 = __esm({
24462
+ "src/sha256.ts"() {
24463
+ "use strict";
24464
+ import_node_crypto25 = require("node:crypto");
24465
+ }
24466
+ });
24467
+
24358
24468
  // src/swift-guest-source-plan.ts
24359
24469
  function swiftPackageLinkage(target) {
24360
24470
  const linkage = target.machOType === "staticlib" ? "static" : target.machOType === "mh_dylib" ? "dynamic" : null;
@@ -24765,16 +24875,12 @@ var init_swift_link_roots = __esm({
24765
24875
  "use strict";
24766
24876
  import_node_fs43 = __toESM(require("node:fs"), 1);
24767
24877
  import_node_path42 = __toESM(require("node:path"), 1);
24878
+ init_wasm_binary_sections();
24768
24879
  OBJC_RUNTIME_LOOKUP_SECTION = "peach_objc_runtime_lookup";
24769
24880
  leb = (bytes, at) => {
24770
- let value = 0;
24771
- let scale = 1;
24772
- for (; ; ) {
24773
- const byte = bytes[at.offset++];
24774
- value += (byte & 127) * scale;
24775
- if (!(byte & 128)) return value;
24776
- scale *= 128;
24777
- }
24881
+ const [value, next] = readULEB(bytes, at.offset);
24882
+ at.offset = next;
24883
+ return value;
24778
24884
  };
24779
24885
  rootsByDistribution = /* @__PURE__ */ new Map();
24780
24886
  }
@@ -25603,68 +25709,6 @@ var init_swift_guest_linked_spans = __esm({
25603
25709
  }
25604
25710
  });
25605
25711
 
25606
- // src/wasm-binary-sections.ts
25607
- function encodeWasmNumber(value) {
25608
- const bytes = [];
25609
- for (let rest = value; ; ) {
25610
- const byte = rest % 128;
25611
- rest = Math.floor(rest / 128);
25612
- if (rest === 0) return [...bytes, byte];
25613
- bytes.push(byte | 128);
25614
- }
25615
- }
25616
- function encodeWasmName(name3) {
25617
- const bytes = new TextEncoder().encode(name3);
25618
- return [...encodeWasmNumber(bytes.length), ...bytes];
25619
- }
25620
- function readWasmSection(bytes, start, end) {
25621
- let at = start;
25622
- const number3 = () => {
25623
- let value = 0;
25624
- for (let shift = 0; ; shift += 7) {
25625
- if (at >= end || shift > 63) throw new Error("invalid wasm integer");
25626
- const byte = bytes[at++];
25627
- value += (byte & 127) * 2 ** shift;
25628
- if (!(byte & 128)) return value;
25629
- }
25630
- };
25631
- return {
25632
- number: number3,
25633
- byte: () => {
25634
- if (at >= end) throw new Error("truncated wasm section");
25635
- return bytes[at++];
25636
- },
25637
- name: () => {
25638
- const length = number3();
25639
- at += length;
25640
- if (at > end) throw new Error("truncated wasm name");
25641
- return Buffer.from(bytes.buffer, bytes.byteOffset + at - length, length).toString();
25642
- },
25643
- position: () => at,
25644
- done: () => at === end
25645
- };
25646
- }
25647
- function wasmSections(bytes) {
25648
- if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
25649
- throw new Error("not a wasm module");
25650
- const found = [];
25651
- for (let at = 8; at < bytes.length; ) {
25652
- const header = readWasmSection(bytes, at, bytes.length);
25653
- const id = header.byte();
25654
- const size2 = header.number();
25655
- const start = header.position();
25656
- if (start + size2 > bytes.length) throw new Error("truncated wasm section");
25657
- found.push({ id, offset: at, start, end: start + size2 });
25658
- at = start + size2;
25659
- }
25660
- return found;
25661
- }
25662
- var init_wasm_binary_sections = __esm({
25663
- "src/wasm-binary-sections.ts"() {
25664
- "use strict";
25665
- }
25666
- });
25667
-
25668
25712
  // src/wasm-imports.ts
25669
25713
  function readWasmImports(bytes, section2, visit3) {
25670
25714
  const input = readWasmSection(bytes, section2.start, section2.end);
@@ -25948,23 +25992,13 @@ function wasmReader(bytes, start) {
25948
25992
  const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
25949
25993
  let at = start;
25950
25994
  const u = () => {
25951
- let value = 0;
25952
- for (let shift = 0; ; shift += 7) {
25953
- const byte = bytes[at++];
25954
- value += (byte & 127) * 2 ** shift;
25955
- if (!(byte & 128)) return value;
25956
- }
25995
+ const [value, next] = readULEB(bytes, at);
25996
+ at = next;
25997
+ return value;
25957
25998
  };
25958
25999
  const s = () => {
25959
- let value = 0n;
25960
- let shift = 0n;
25961
- let byte = 0;
25962
- do {
25963
- byte = bytes[at++];
25964
- value |= BigInt(byte & 127) << shift;
25965
- shift += 7n;
25966
- } while (byte & 128);
25967
- if (byte & 64) value -= 1n << shift;
26000
+ const [value, next] = readSLEB(bytes, at);
26001
+ at = next;
25968
26002
  return value;
25969
26003
  };
25970
26004
  return {
@@ -26269,7 +26303,7 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
26269
26303
  else data[entry.name] = value;
26270
26304
  }
26271
26305
  if (entry.kind !== 0 && entry.kind !== 3 || host2.has(entry.name))
26272
- kept.push([...encodedName(entry.name), entry.kind, ...uleb(entry.index)]);
26306
+ kept.push([...encodeWasmName(entry.name), entry.kind, ...encodeWasmNumber(entry.index)]);
26273
26307
  }
26274
26308
  if (guestMap) {
26275
26309
  if (guestMap.code.length !== m.bodies.length)
@@ -26284,19 +26318,19 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
26284
26318
  const er = wasmReader(bytes, elements.start);
26285
26319
  const segments = er.u();
26286
26320
  const replaced = /* @__PURE__ */ new Map([
26287
- [4, [1, 112, 4, ...uleb(tableEnd + added.length)]],
26288
- [7, [...uleb(kept.length), ...kept.flat()]],
26321
+ [4, [1, 112, 4, ...encodeWasmNumber(tableEnd + added.length)]],
26322
+ [7, [...encodeWasmNumber(kept.length), ...kept.flat()]],
26289
26323
  [
26290
26324
  9,
26291
26325
  [
26292
- ...uleb(segments + 1),
26326
+ ...encodeWasmNumber(segments + 1),
26293
26327
  ...bytes.subarray(er.at, elements.end),
26294
26328
  0,
26295
26329
  66,
26296
- ...sleb(BigInt(tableEnd)),
26330
+ ...encodeWasmSigned(BigInt(tableEnd)),
26297
26331
  11,
26298
- ...uleb(added.length),
26299
- ...added.flatMap(uleb)
26332
+ ...encodeWasmNumber(added.length),
26333
+ ...added.flatMap(encodeWasmNumber)
26300
26334
  ]
26301
26335
  ]
26302
26336
  ]);
@@ -26402,33 +26436,33 @@ function codeOnlySdkImage(bytes, constructorMask) {
26402
26436
  if (drop) r.skip(1);
26403
26437
  gated.push(
26404
26438
  66,
26405
- ...sleb(BigInt(constructorMask + index++)),
26439
+ ...encodeWasmSigned(BigInt(constructorMask + index++)),
26406
26440
  45,
26407
26441
  0,
26408
26442
  0,
26409
26443
  4,
26410
26444
  64,
26411
26445
  16,
26412
- ...uleb(callee),
26446
+ ...encodeWasmNumber(callee),
26413
26447
  ...drop ? [26] : [],
26414
26448
  11
26415
26449
  );
26416
26450
  }
26417
26451
  if (index > SWIFT_SDK_CONSTRUCTOR_LIMIT)
26418
26452
  throw new Error(`${index} sdk constructors exceed the mask`);
26419
- gated.push(16, ...uleb(functionIndex("__peach_sdk_register")), 11);
26453
+ gated.push(16, ...encodeWasmNumber(functionIndex("__peach_sdk_register")), 11);
26420
26454
  bodies[constructors] = Uint8Array.from(gated);
26421
26455
  }
26422
- const codeParts = [Uint8Array.from(uleb(bodies.length))];
26423
- for (const body of bodies) codeParts.push(Uint8Array.from(uleb(body.length)), body);
26456
+ const codeParts = [Uint8Array.from(encodeWasmNumber(bodies.length))];
26457
+ for (const body of bodies) codeParts.push(Uint8Array.from(encodeWasmNumber(body.length)), body);
26424
26458
  const codeSize = codeParts.reduce((sum, part) => sum + part.length, 0);
26425
26459
  const tls = passiveSegments(bytes)[0];
26426
26460
  const out = [bytes.subarray(0, 8)];
26427
26461
  for (const s of m.sections) {
26428
26462
  if (s.id === 10) {
26429
- out.push(Uint8Array.from([10, ...uleb(codeSize)]));
26463
+ out.push(Uint8Array.from([10, ...encodeWasmNumber(codeSize)]));
26430
26464
  for (const part of codeParts) out.push(part);
26431
- } else if (s.id === 11) out.push(section(11, [1, 1, ...uleb(tls.length), ...tls]));
26465
+ } else if (s.id === 11) out.push(section(11, [1, 1, ...encodeWasmNumber(tls.length), ...tls]));
26432
26466
  else if (s.id === 12) out.push(section(12, [1]));
26433
26467
  else out.push(bytes.subarray(s.offset, s.end));
26434
26468
  }
@@ -26745,39 +26779,14 @@ function unslottedFunctions(bytes) {
26745
26779
  }
26746
26780
  return definedFuncs - slotted.size;
26747
26781
  }
26748
- var uleb, sleb, encodedName, section, PROCESS_EXPORTS, SWIFT_SDK_CONSTRUCTOR_LIMIT, FUNCTION_RELOCATIONS, MEMORY_RELOCATIONS, ADDEND_RELOCATIONS, FUNCTION_RELOC_MASK, MEMORY_RELOC_MASK, ADDEND_RELOC_MASK;
26782
+ var section, PROCESS_EXPORTS, SWIFT_SDK_CONSTRUCTOR_LIMIT, FUNCTION_RELOCATIONS, MEMORY_RELOCATIONS, ADDEND_RELOCATIONS, FUNCTION_RELOC_MASK, MEMORY_RELOC_MASK, ADDEND_RELOC_MASK;
26749
26783
  var init_swift_sdk_image_wasm = __esm({
26750
26784
  "src/swift-sdk-image-wasm.ts"() {
26751
26785
  "use strict";
26752
26786
  init_swift_sdk_image_map();
26753
26787
  init_swiftSdkLinkContract();
26754
- uleb = (value) => {
26755
- const out = [];
26756
- do {
26757
- let byte = value % 128;
26758
- value = Math.floor(value / 128);
26759
- if (value) byte |= 128;
26760
- out.push(byte);
26761
- } while (value);
26762
- return out;
26763
- };
26764
- sleb = (value) => {
26765
- const out = [];
26766
- for (; ; ) {
26767
- const byte = Number(value & 127n);
26768
- value >>= 7n;
26769
- if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
26770
- out.push(byte);
26771
- return out;
26772
- }
26773
- out.push(byte | 128);
26774
- }
26775
- };
26776
- encodedName = (name3) => {
26777
- const bytes = [...Buffer.from(name3)];
26778
- return [...uleb(bytes.length), ...bytes];
26779
- };
26780
- section = (id, payload) => Uint8Array.from([id, ...uleb(payload.length), ...payload]);
26788
+ init_wasm_binary_sections();
26789
+ section = (id, payload) => Uint8Array.from([id, ...encodeWasmNumber(payload.length), ...payload]);
26781
26790
  PROCESS_EXPORTS = [
26782
26791
  "_initialize",
26783
26792
  "__wasm_call_ctors",
@@ -26882,20 +26891,12 @@ function localizeDefinedWasmSymbols(bytes, names) {
26882
26891
  const output = new Uint8Array(bytes);
26883
26892
  let cur = 8;
26884
26893
  const readU = () => {
26885
- const b0 = bytes[cur++];
26886
- if (b0 < 128) return b0;
26887
- let res = b0 & 127;
26888
- let shift = 7;
26889
- while (true) {
26890
- const byte = bytes[cur++];
26891
- res |= (byte & 127) << shift;
26892
- if ((byte & 128) === 0) return res;
26893
- shift += 7;
26894
- }
26894
+ const [res, next] = readULEB(bytes, cur);
26895
+ cur = next;
26896
+ return res;
26895
26897
  };
26896
26898
  const skipU = () => {
26897
- while ((bytes[cur++] & 128) !== 0) {
26898
- }
26899
+ cur = skipLEB(bytes, cur);
26899
26900
  };
26900
26901
  const importFuncNames = [];
26901
26902
  const importGlobalNames = [];
@@ -27002,50 +27003,11 @@ function localizeDefinedWasmSymbols(bytes, names) {
27002
27003
  var init_swift_wasm_archive = __esm({
27003
27004
  "src/swift-wasm-archive.ts"() {
27004
27005
  "use strict";
27006
+ init_wasm_binary_sections();
27005
27007
  }
27006
27008
  });
27007
27009
 
27008
27010
  // src/swift-wasm-prune.ts
27009
- function sha256Hex2(bytes) {
27010
- if (typeof Bun !== "undefined")
27011
- return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
27012
- return (0, import_node_crypto25.createHash)("sha256").update(bytes).digest("hex");
27013
- }
27014
- function readULEB2(b, o) {
27015
- let res = 0;
27016
- let shift = 0;
27017
- let p = o;
27018
- while (true) {
27019
- const byte = b[p++];
27020
- res |= (byte & 127) << shift;
27021
- if ((byte & 128) === 0) break;
27022
- shift += 7;
27023
- }
27024
- return [res, p];
27025
- }
27026
- function readSLEB(b, o) {
27027
- let res = 0;
27028
- let shift = 0;
27029
- let p = o;
27030
- let byte = 0;
27031
- do {
27032
- byte = b[p++];
27033
- res |= (byte & 127) << shift;
27034
- shift += 7;
27035
- } while (byte & 128);
27036
- if (shift < 32 && byte & 64) res |= ~0 << shift;
27037
- return [res, p];
27038
- }
27039
- function encodeULEB(val) {
27040
- const out = [];
27041
- do {
27042
- let byte = val & 127;
27043
- val >>>= 7;
27044
- if (val !== 0) byte |= 128;
27045
- out.push(byte);
27046
- } while (val !== 0);
27047
- return out;
27048
- }
27049
27011
  function isRootSegName(name3) {
27050
27012
  for (const pref of ROOT_SEG_PREFIXES) {
27051
27013
  if (name3 === pref || name3.startsWith(`${pref}.`)) return true;
@@ -27071,39 +27033,14 @@ function decodeRelocations(buf, sections) {
27071
27033
  for (let k = 0; k < sectionCount; k++, i++) {
27072
27034
  start[i] = length + cur - baseAt;
27073
27035
  const rType = buf[cur++];
27074
- let offset = buf[cur++];
27075
- if (offset >= 128) {
27076
- offset &= 127;
27077
- let shift = 7;
27078
- while (true) {
27079
- const byte = buf[cur++];
27080
- offset |= (byte & 127) << shift;
27081
- if (byte < 128) break;
27082
- shift += 7;
27083
- }
27084
- }
27085
- let symbol2 = buf[cur++];
27086
- if (symbol2 >= 128) {
27087
- symbol2 &= 127;
27088
- let shift = 7;
27089
- while (true) {
27090
- const byte = buf[cur++];
27091
- symbol2 |= (byte & 127) << shift;
27092
- if (byte < 128) break;
27093
- shift += 7;
27094
- }
27095
- }
27036
+ let offset;
27037
+ [offset, cur] = readULEB(buf, cur);
27038
+ let symbol2;
27039
+ [symbol2, cur] = readULEB(buf, cur);
27096
27040
  if (rType < 32 && (ADDEND_RELOC_MASK2 & 1 << rType) !== 0) {
27097
- let byte = buf[cur++];
27098
- let value = byte & 127;
27099
- let shift = 7;
27100
- while (byte >= 128) {
27101
- byte = buf[cur++];
27102
- value |= (byte & 127) << shift;
27103
- shift += 7;
27104
- }
27105
- if (shift < 32 && (byte & 64) !== 0) value |= ~0 << shift;
27106
- addend[i] = value;
27041
+ let value;
27042
+ [value, cur] = readSLEB(buf, cur);
27043
+ addend[i] = Number(BigInt.asIntN(32, value));
27107
27044
  }
27108
27045
  ro[i] = offset;
27109
27046
  rs[i] = symbol2;
@@ -27138,36 +27075,36 @@ function patchSwiftrtObject(src) {
27138
27075
  let pos = 8;
27139
27076
  while (pos < buf.length) {
27140
27077
  const id = buf[pos++];
27141
- const [sz, p] = readULEB2(buf, pos);
27078
+ const [sz, p] = readULEB(buf, pos);
27142
27079
  const end = p + sz;
27143
27080
  if (id === 0) {
27144
- const [nLen, np] = readULEB2(buf, p);
27081
+ const [nLen, np] = readULEB(buf, p);
27145
27082
  const name3 = Buffer.from(buf.subarray(np, np + nLen)).toString("utf8");
27146
27083
  const cp = np + nLen;
27147
27084
  if (name3 === "linking") {
27148
- let [, lp] = readULEB2(buf, cp);
27085
+ let [, lp] = readULEB(buf, cp);
27149
27086
  while (lp < end) {
27150
27087
  const subId = buf[lp++];
27151
- const [subLen, sp] = readULEB2(buf, lp);
27088
+ const [subLen, sp] = readULEB(buf, lp);
27152
27089
  const subEnd = sp + subLen;
27153
27090
  if (subId === 8) {
27154
- let [cnt, cur] = readULEB2(buf, sp);
27091
+ let [cnt, cur] = readULEB(buf, sp);
27155
27092
  for (let i = 0; i < cnt; i++) {
27156
27093
  const kind = buf[cur++];
27157
27094
  const flPos = cur;
27158
- const [fl, c2] = readULEB2(buf, cur);
27095
+ const [fl, c2] = readULEB(buf, cur);
27159
27096
  cur = c2;
27160
27097
  const isUndef = (fl & 16) !== 0;
27161
27098
  const isExplicitName = (fl & 64) !== 0;
27162
27099
  if (kind === 0 || kind === 2 || kind === 4 || kind === 5) {
27163
- const [, c3] = readULEB2(buf, cur);
27100
+ const [, c3] = readULEB(buf, cur);
27164
27101
  cur = c3;
27165
27102
  if (!isUndef || isExplicitName) {
27166
- const [sLen, c4] = readULEB2(buf, cur);
27103
+ const [sLen, c4] = readULEB(buf, cur);
27167
27104
  cur = c4 + sLen;
27168
27105
  }
27169
27106
  } else if (kind === 1) {
27170
- const [sLen, c3] = readULEB2(buf, cur);
27107
+ const [sLen, c3] = readULEB(buf, cur);
27171
27108
  const sName = Buffer.from(buf.subarray(c3, c3 + sLen)).toString("utf8");
27172
27109
  if (sName === "_ZN12_GLOBAL__N_18sectionsE") fallbackSymIdx = i;
27173
27110
  for (const prefix of ["__start_", "__stop_"]) {
@@ -27179,13 +27116,13 @@ function patchSwiftrtObject(src) {
27179
27116
  }
27180
27117
  cur = c3 + sLen;
27181
27118
  if (!isUndef) {
27182
- const [, c4] = readULEB2(buf, cur);
27183
- const [, c5] = readULEB2(buf, c4);
27184
- const [, c6] = readULEB2(buf, c5);
27119
+ const [, c4] = readULEB(buf, cur);
27120
+ const [, c5] = readULEB(buf, c4);
27121
+ const [, c6] = readULEB(buf, c5);
27185
27122
  cur = c6;
27186
27123
  }
27187
27124
  } else if (kind === 3) {
27188
- const [, c3] = readULEB2(buf, cur);
27125
+ const [, c3] = readULEB(buf, cur);
27189
27126
  cur = c3;
27190
27127
  }
27191
27128
  }
@@ -27199,26 +27136,25 @@ function patchSwiftrtObject(src) {
27199
27136
  pos = 8;
27200
27137
  while (pos < buf.length) {
27201
27138
  const id = buf[pos++];
27202
- const [sz, p] = readULEB2(buf, pos);
27139
+ const [sz, p] = readULEB(buf, pos);
27203
27140
  const end = p + sz;
27204
27141
  if (id === 0) {
27205
- const [nLen, np] = readULEB2(buf, p);
27142
+ const [nLen, np] = readULEB(buf, p);
27206
27143
  const name3 = Buffer.from(buf.subarray(np, np + nLen)).toString("utf8");
27207
27144
  const cp = np + nLen;
27208
27145
  if (name3 === "reloc.CODE") {
27209
- const [, r1] = readULEB2(buf, cp);
27210
- let [cnt, cur] = readULEB2(buf, r1);
27146
+ const [, r1] = readULEB(buf, cp);
27147
+ let [cnt, cur] = readULEB(buf, r1);
27211
27148
  for (let i = 0; i < cnt; i++) {
27212
27149
  const rType = buf[cur++];
27213
- const [, c2] = readULEB2(buf, cur);
27214
- const [rs, c3] = readULEB2(buf, c2);
27150
+ const [, c2] = readULEB(buf, cur);
27151
+ const [rs, c3] = readULEB(buf, c2);
27215
27152
  if (neutralizedSyms.has(rs) && c3 - c2 === 1) {
27216
27153
  buf[c2] = fallbackSymIdx;
27217
27154
  }
27218
27155
  cur = c3;
27219
27156
  if (ADDEND_RELOCATIONS.has(rType)) {
27220
- const [, c4] = readSLEB(buf, cur);
27221
- cur = c4;
27157
+ cur = skipLEB(buf, cur);
27222
27158
  }
27223
27159
  }
27224
27160
  }
@@ -27232,25 +27168,14 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
27232
27168
  let pos = 8;
27233
27169
  let cur = 8;
27234
27170
  const readU = () => {
27235
- const b0 = buf[cur++];
27236
- if (b0 < 128) return b0;
27237
- let res = b0 & 127;
27238
- let shift = 7;
27239
- while (true) {
27240
- const byte = buf[cur++];
27241
- res |= (byte & 127) << shift;
27242
- if (byte < 128) return res;
27243
- shift += 7;
27244
- }
27171
+ const [res, next] = readULEB(buf, cur);
27172
+ cur = next;
27173
+ return res;
27245
27174
  };
27246
27175
  const skipU = () => {
27247
- while (buf[cur++] >= 128) {
27248
- }
27249
- };
27250
- const skipS = () => {
27251
- while (buf[cur++] >= 128) {
27252
- }
27176
+ cur = skipLEB(buf, cur);
27253
27177
  };
27178
+ const skipS = skipU;
27254
27179
  let numImportFuncs = 0;
27255
27180
  let importsDlsym = false;
27256
27181
  const importFuncNames = [];
@@ -27848,16 +27773,9 @@ function guestWasmSymbols(bytes) {
27848
27773
  const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
27849
27774
  let cur = 8;
27850
27775
  const readU = () => {
27851
- const b0 = bytes[cur++];
27852
- if (b0 < 128) return b0;
27853
- let res = b0 & 127;
27854
- let shift = 7;
27855
- while (true) {
27856
- const byte = bytes[cur++];
27857
- res |= (byte & 127) << shift;
27858
- if ((byte & 128) === 0) return res;
27859
- shift += 7;
27860
- }
27776
+ const [res, next] = readULEB(bytes, cur);
27777
+ cur = next;
27778
+ return res;
27861
27779
  };
27862
27780
  let importsDlsym = false;
27863
27781
  const importFuncNames = [];
@@ -28047,7 +27965,7 @@ function swiftPrunedSdkObjectOrigins(sdk2, args, rewritten) {
28047
27965
  }
28048
27966
  function ensureUnpackedSdkObjects(sdkWasiDir) {
28049
27967
  const archives = import_node_fs45.default.readdirSync(sdkWasiDir).filter((file) => file.endsWith(".a")).sort();
28050
- const hash = (0, import_node_crypto25.createHash)("sha256");
27968
+ const hash = (0, import_node_crypto26.createHash)("sha256");
28051
27969
  for (const archive of archives) {
28052
27970
  hash.update(archive + "\0");
28053
27971
  hash.update(swiftFileChecksum(import_node_path44.default.join(sdkWasiDir, archive)));
@@ -28998,7 +28916,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
28998
28916
  if (!deadSpecialSegs.has(sIdx)) continue;
28999
28917
  if (!isSpecialSegRelocLive(obj, obj.segNames[sIdx], data.rs[i])) continue;
29000
28918
  const first = relocationBytes(data, i);
29001
- const [, afterRoOff] = readULEB2(first, 1);
28919
+ const [, afterRoOff] = readULEB(first, 1);
29002
28920
  firstLiveInSpecialSeg.set(sIdx, {
29003
28921
  rType: first[0],
29004
28922
  afterRo: first.subarray(afterRoOff)
@@ -29028,7 +28946,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
29028
28946
  zeroDataReloc(i);
29029
28947
  } else {
29030
28948
  const repl = firstLiveInSpecialSeg.get(segIdx);
29031
- const roBytes = encodeULEB(data.ro[i]);
28949
+ const roBytes = encodeWasmNumber(data.ro[i]);
29032
28950
  const out = new Uint8Array(1 + roBytes.length + repl.afterRo.length);
29033
28951
  out[0] = repl.rType;
29034
28952
  out.set(roBytes, 1);
@@ -29067,34 +28985,34 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
29067
28985
  while (pos < buf.length) {
29068
28986
  const secStart = pos;
29069
28987
  const id = buf[pos++];
29070
- const [sz, p] = readULEB2(buf, pos);
28988
+ const [sz, p] = readULEB(buf, pos);
29071
28989
  const end = p + sz;
29072
28990
  if (id === 0) {
29073
- const [nLen, np] = readULEB2(buf, p);
28991
+ const [nLen, np] = readULEB(buf, p);
29074
28992
  const name3 = rawBuf.toString("utf8", np, np + nLen);
29075
28993
  const cp = np + nLen;
29076
28994
  if (name3 === "linking") {
29077
- const [, lpStart] = readULEB2(buf, cp);
28995
+ const [, lpStart] = readULEB(buf, cp);
29078
28996
  const subChunks = [buf.subarray(p, lpStart)];
29079
28997
  let lp = lpStart;
29080
28998
  while (lp < end) {
29081
28999
  const subStart = lp;
29082
29000
  const subId = buf[lp++];
29083
- const [subLen, sp] = readULEB2(buf, lp);
29001
+ const [subLen, sp] = readULEB(buf, lp);
29084
29002
  const subEnd = sp + subLen;
29085
29003
  if (subId === 5) {
29086
29004
  const subCopy = new Uint8Array(buf.subarray(subStart, subEnd));
29087
- let [cnt, cur] = readULEB2(buf, sp);
29005
+ let [cnt, cur] = readULEB(buf, sp);
29088
29006
  for (let i = 0; i < cnt; i++) {
29089
- const [sLen, s2] = readULEB2(buf, cur);
29007
+ const [sLen, s2] = readULEB(buf, cur);
29090
29008
  const segName = obj.segNames[i];
29091
29009
  const repl = RECORD_SEGS.get(segName);
29092
29010
  const isSpecial = repl !== void 0;
29093
29011
  if (deadSpecialSegs.has(i) && repl !== void 0)
29094
29012
  subCopy.set(Buffer.from(repl, "utf8"), s2 - subStart);
29095
29013
  cur = s2 + sLen;
29096
- const [, s3] = readULEB2(buf, cur);
29097
- const [segFl, s4] = readULEB2(buf, s3);
29014
+ const [, s3] = readULEB(buf, cur);
29015
+ const [segFl, s4] = readULEB(buf, s3);
29098
29016
  const sFlLen = s4 - s3;
29099
29017
  const keepRetain = isSpecial ? !deadSpecialSegs.has(i) : isRootSegName(segName) && !segName.startsWith(".init_array") && sLive[i] === 1;
29100
29018
  const newSegFl = keepRetain ? segFl | 4 : segFl & ~4;
@@ -29108,12 +29026,12 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
29108
29026
  }
29109
29027
  subChunks.push(subCopy);
29110
29028
  } else if (subId === 6) {
29111
- let [cnt, cur] = readULEB2(buf, sp);
29029
+ let [cnt, cur] = readULEB(buf, sp);
29112
29030
  const entrySlices = [];
29113
29031
  for (let i = 0; i < cnt; i++) {
29114
29032
  const eStart = cur;
29115
- const [, s2] = readULEB2(buf, cur);
29116
- const [symIdx, s3] = readULEB2(buf, s2);
29033
+ const [, s2] = readULEB(buf, cur);
29034
+ const [symIdx, s3] = readULEB(buf, s2);
29117
29035
  cur = s3;
29118
29036
  if (obj.symKind[symIdx] === 0 && obj.symElemIdx[symIdx] >= obj.numImportFuncs) {
29119
29037
  if (fLive[obj.symElemIdx[symIdx] - obj.numImportFuncs] === 1) {
@@ -29124,19 +29042,19 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
29124
29042
  }
29125
29043
  }
29126
29044
  if (entrySlices.length > 0) {
29127
- const cntBytes = Uint8Array.from(encodeULEB(entrySlices.length));
29045
+ const cntBytes = Uint8Array.from(encodeWasmNumber(entrySlices.length));
29128
29046
  const bodyLen = cntBytes.length + entrySlices.reduce((a, b) => a + b.length, 0);
29129
- const lenBytes = Uint8Array.from(encodeULEB(bodyLen));
29047
+ const lenBytes = Uint8Array.from(encodeWasmNumber(bodyLen));
29130
29048
  subChunks.push(Uint8Array.of(6), lenBytes, cntBytes);
29131
29049
  for (const entry of entrySlices) subChunks.push(entry);
29132
29050
  }
29133
29051
  } else if (subId === 8) {
29134
29052
  const subCopy = new Uint8Array(buf.subarray(subStart, subEnd));
29135
- let [cnt, cur] = readULEB2(buf, sp);
29053
+ let [cnt, cur] = readULEB(buf, sp);
29136
29054
  for (let i = 0; i < cnt; i++) {
29137
29055
  const kind = buf[cur++];
29138
29056
  const flOffset = cur - subStart;
29139
- const [fl, c2] = readULEB2(buf, cur);
29057
+ const [fl, c2] = readULEB(buf, cur);
29140
29058
  cur = c2;
29141
29059
  const isUndef = (fl & 16) !== 0;
29142
29060
  const isExplicitName = (fl & 64) !== 0;
@@ -29156,23 +29074,23 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
29156
29074
  subCopy[flOffset + 1] = 0;
29157
29075
  }
29158
29076
  if (kind === 0 || kind === 2 || kind === 4 || kind === 5) {
29159
- const [, c3] = readULEB2(buf, cur);
29077
+ const [, c3] = readULEB(buf, cur);
29160
29078
  cur = c3;
29161
29079
  if (!isUndef || isExplicitName) {
29162
- const [sLen, c4] = readULEB2(buf, cur);
29080
+ const [sLen, c4] = readULEB(buf, cur);
29163
29081
  cur = c4 + sLen;
29164
29082
  }
29165
29083
  } else if (kind === 1) {
29166
- const [sLen, c3] = readULEB2(buf, cur);
29084
+ const [sLen, c3] = readULEB(buf, cur);
29167
29085
  cur = c3 + sLen;
29168
29086
  if (!isUndef) {
29169
- const [, c4] = readULEB2(buf, cur);
29170
- const [, c5] = readULEB2(buf, c4);
29171
- const [, c6] = readULEB2(buf, c5);
29087
+ const [, c4] = readULEB(buf, cur);
29088
+ const [, c5] = readULEB(buf, c4);
29089
+ const [, c6] = readULEB(buf, c5);
29172
29090
  cur = c6;
29173
29091
  }
29174
29092
  } else if (kind === 3) {
29175
- const [, c3] = readULEB2(buf, cur);
29093
+ const [, c3] = readULEB(buf, cur);
29176
29094
  cur = c3;
29177
29095
  }
29178
29096
  }
@@ -29183,29 +29101,29 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
29183
29101
  lp = subEnd;
29184
29102
  }
29185
29103
  const totalSubLen = subChunks.reduce((a, b) => a + b.length, 0);
29186
- outChunks.push(Uint8Array.of(0), Uint8Array.from(encodeULEB(totalSubLen)));
29104
+ outChunks.push(Uint8Array.of(0), Uint8Array.from(encodeWasmNumber(totalSubLen)));
29187
29105
  for (const chunk of subChunks) outChunks.push(chunk);
29188
29106
  } else if (name3 === "reloc.CODE") {
29189
- const [, r1] = readULEB2(buf, cp);
29107
+ const [, r1] = readULEB(buf, cp);
29190
29108
  const headerSlice = buf.subarray(p, r1);
29191
- const cntBytes = Uint8Array.from(encodeULEB(keptCodeRelocs.length));
29109
+ const cntBytes = Uint8Array.from(encodeWasmNumber(keptCodeRelocs.length));
29192
29110
  const relSlices = keptCodeRelocs.map((i) => relocationBytes(code, i));
29193
29111
  const totalLen = headerSlice.length + cntBytes.length + relSlices.reduce((a, b) => a + b.length, 0);
29194
29112
  outChunks.push(
29195
29113
  Uint8Array.of(0),
29196
- Uint8Array.from(encodeULEB(totalLen)),
29114
+ Uint8Array.from(encodeWasmNumber(totalLen)),
29197
29115
  headerSlice,
29198
29116
  cntBytes
29199
29117
  );
29200
29118
  for (const relocation of relSlices) outChunks.push(relocation);
29201
29119
  } else if (name3 === "reloc.DATA") {
29202
- const [, r1] = readULEB2(buf, cp);
29120
+ const [, r1] = readULEB(buf, cp);
29203
29121
  const headerSlice = buf.subarray(p, r1);
29204
- const cntBytes = Uint8Array.from(encodeULEB(keptDataRelocBytes.length));
29122
+ const cntBytes = Uint8Array.from(encodeWasmNumber(keptDataRelocBytes.length));
29205
29123
  const totalLen = headerSlice.length + cntBytes.length + keptDataRelocBytes.reduce((a, b) => a + b.length, 0);
29206
29124
  outChunks.push(
29207
29125
  Uint8Array.of(0),
29208
- Uint8Array.from(encodeULEB(totalLen)),
29126
+ Uint8Array.from(encodeWasmNumber(totalLen)),
29209
29127
  headerSlice,
29210
29128
  cntBytes
29211
29129
  );
@@ -29215,15 +29133,15 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
29215
29133
  const nameBytes = buf.subarray(p, cp);
29216
29134
  outChunks.push(
29217
29135
  Uint8Array.of(0),
29218
- Uint8Array.from(encodeULEB(nameBytes.length)),
29136
+ Uint8Array.from(encodeWasmNumber(nameBytes.length)),
29219
29137
  nameBytes
29220
29138
  );
29221
29139
  } else if (name3.startsWith("reloc..debug_")) {
29222
- const [, r1] = readULEB2(buf, cp);
29140
+ const [, r1] = readULEB(buf, cp);
29223
29141
  const headerSlice = buf.subarray(p, r1);
29224
29142
  outChunks.push(
29225
29143
  Uint8Array.of(0),
29226
- Uint8Array.from(encodeULEB(headerSlice.length + 1)),
29144
+ Uint8Array.from(encodeWasmNumber(headerSlice.length + 1)),
29227
29145
  headerSlice,
29228
29146
  Uint8Array.of(0)
29229
29147
  );
@@ -29336,15 +29254,16 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
29336
29254
  );
29337
29255
  import_node_fs45.default.rmSync(rspPath, { force: true });
29338
29256
  }
29339
- var import_node_child_process22, import_node_crypto25, import_node_fs45, import_node_path44, v3, WIDE_DATA_RELOCS, ROOT_SEG_PREFIXES, RECORD_SEGS, PARTITIONED_SEGS, PRUNED_SDK_ARCHIVES, OMIT_SDK_LIB_FLAGS, NEUTRALIZED_SWIFTRT_SECTIONS, ADDEND_RELOC_MASK2, relocationBytes, parsedObjectCache, PARSED_ROOTS, SWIFTUI_WRAPPER_HOST_PROTOCOLS, SWIFT_PRUNED_LINK_MAP, SWIFT_PRUNED_LINK_RESPONSE;
29257
+ var import_node_child_process22, import_node_crypto26, import_node_fs45, import_node_path44, v3, WIDE_DATA_RELOCS, ROOT_SEG_PREFIXES, RECORD_SEGS, PARTITIONED_SEGS, PRUNED_SDK_ARCHIVES, OMIT_SDK_LIB_FLAGS, NEUTRALIZED_SWIFTRT_SECTIONS, ADDEND_RELOC_MASK2, relocationBytes, parsedObjectCache, PARSED_ROOTS, SWIFTUI_WRAPPER_HOST_PROTOCOLS, SWIFT_PRUNED_LINK_MAP, SWIFT_PRUNED_LINK_RESPONSE;
29340
29258
  var init_swift_wasm_prune = __esm({
29341
29259
  "src/swift-wasm-prune.ts"() {
29342
29260
  "use strict";
29343
29261
  import_node_child_process22 = require("node:child_process");
29344
- import_node_crypto25 = require("node:crypto");
29262
+ import_node_crypto26 = require("node:crypto");
29345
29263
  import_node_fs45 = __toESM(require("node:fs"), 1);
29346
29264
  import_node_path44 = __toESM(require("node:path"), 1);
29347
29265
  v3 = __toESM(require("peachsim/vendor/valibot"), 1);
29266
+ init_sha256();
29348
29267
  init_swift_guest_source_plan();
29349
29268
  init_swift_link_roots();
29350
29269
  init_swift_resource_class_names();
@@ -29352,6 +29271,7 @@ var init_swift_wasm_prune = __esm({
29352
29271
  init_swift_toolchain();
29353
29272
  init_swift_wasm_archive();
29354
29273
  init_swiftRuntimeProductContract();
29274
+ init_wasm_binary_sections();
29355
29275
  WIDE_DATA_RELOCS = /* @__PURE__ */ new Set([16, 19, 22, 27]);
29356
29276
  ROOT_SEG_PREFIXES = [
29357
29277
  ".init_array",
@@ -29458,7 +29378,7 @@ function aliasGuestArchive(options2) {
29458
29378
  alias,
29459
29379
  name: member.name,
29460
29380
  ordinal,
29461
- sha256: (0, import_node_crypto26.createHash)("sha256").update(member.bytes).digest("hex")
29381
+ sha256: (0, import_node_crypto27.createHash)("sha256").update(member.bytes).digest("hex")
29462
29382
  };
29463
29383
  });
29464
29384
  const response = import_node_path45.default.join(options2.directory, "members.rsp");
@@ -29471,7 +29391,7 @@ function aliasGuestArchive(options2) {
29471
29391
  (0, import_node_child_process23.execFileSync)(options2.llvmAr, ["rcsD", archive, `@${response}`], { stdio: "pipe" });
29472
29392
  const rewritten = readArMembers((0, import_node_fs46.readFileSync)(archive));
29473
29393
  if (rewritten.length !== members2.length || rewritten.some(
29474
- (member, index) => member.name !== members2[index].alias || (0, import_node_crypto26.createHash)("sha256").update(member.bytes).digest("hex") !== members2[index].sha256
29394
+ (member, index) => member.name !== members2[index].alias || (0, import_node_crypto27.createHash)("sha256").update(member.bytes).digest("hex") !== members2[index].sha256
29475
29395
  ))
29476
29396
  throw new Error(`guest archive changed members ${options2.archive}`);
29477
29397
  return { source: options2.archive, archive, members: members2 };
@@ -29531,12 +29451,12 @@ function aliasGuestLinkIdentities(identities, archives) {
29531
29451
  }
29532
29452
  return result;
29533
29453
  }
29534
- var import_node_child_process23, import_node_crypto26, import_node_fs46, import_node_path45;
29454
+ var import_node_child_process23, import_node_crypto27, import_node_fs46, import_node_path45;
29535
29455
  var init_swift_guest_archive = __esm({
29536
29456
  "src/swift-guest-archive.ts"() {
29537
29457
  "use strict";
29538
29458
  import_node_child_process23 = require("node:child_process");
29539
- import_node_crypto26 = require("node:crypto");
29459
+ import_node_crypto27 = require("node:crypto");
29540
29460
  import_node_fs46 = require("node:fs");
29541
29461
  import_node_path45 = __toESM(require("node:path"), 1);
29542
29462
  init_swift_wasm_prune();
@@ -29550,15 +29470,15 @@ function nativeDyldName(bytes) {
29550
29470
  name3 += String.fromCharCode(...bytes.subarray(start, start + 4096));
29551
29471
  return name3;
29552
29472
  }
29553
- function nativeDyldTablePath(primary, sha2565) {
29473
+ function nativeDyldTablePath(primary, sha2564) {
29554
29474
  const prefix = primary.slice(0, primary.lastIndexOf("/") + 1);
29555
- return prefix + sha2565 + (primary.endsWith(".wasm") ? ".dyld" : "");
29475
+ return prefix + sha2564 + (primary.endsWith(".wasm") ? ".dyld" : "");
29556
29476
  }
29557
29477
  function readNativeDyldTableIndex(section2) {
29558
29478
  const bytes = new Uint8Array(section2);
29559
29479
  const view = new DataView(section2);
29560
29480
  if (bytes.length < 40) throw new Error("native dyld table index is truncated");
29561
- const sha2565 = Array.from(
29481
+ const sha2564 = Array.from(
29562
29482
  bytes.subarray(0, 32),
29563
29483
  (byte) => byte.toString(16).padStart(2, "0")
29564
29484
  ).join("");
@@ -29582,7 +29502,7 @@ function readNativeDyldTableIndex(section2) {
29582
29502
  at = end + 1;
29583
29503
  }
29584
29504
  if (at !== bytes.length) throw new Error("native dyld table index has trailing bytes");
29585
- return { sha256: sha2565, byteLength, packs, firsts };
29505
+ return { sha256: sha2564, byteLength, packs, firsts };
29586
29506
  }
29587
29507
  var NATIVE_DYLD_TABLE_SECTION, NATIVE_DYLD_PACKS_SECTION;
29588
29508
  var init_nativeDyldTableContract = __esm({
@@ -29615,34 +29535,11 @@ var init_nativeWasmContract = __esm({
29615
29535
  });
29616
29536
 
29617
29537
  // src/swift-guest-image-ledger.ts
29618
- function readNumber(bytes, position) {
29619
- if (position < bytes.length) {
29620
- const first = bytes[position];
29621
- if (first < 128) return [first, position + 1];
29622
- }
29623
- let value = 0;
29624
- let shift = 0;
29625
- for (; ; ) {
29626
- if (position >= bytes.length || shift > 63) throw new Error("invalid wasm integer");
29627
- const byte = bytes[position++];
29628
- value += (byte & 127) * 2 ** shift;
29629
- if (!(byte & 128)) return [value, position];
29630
- shift += 7;
29631
- }
29632
- }
29633
29538
  function encodeNumber(value) {
29634
- if (value < 128) return Buffer.from([value]);
29635
- const bytes = [];
29636
- do {
29637
- let byte = value % 128;
29638
- value = Math.floor(value / 128);
29639
- if (value) byte |= 128;
29640
- bytes.push(byte);
29641
- } while (value);
29642
- return Buffer.from(bytes);
29539
+ return Buffer.from(encodeWasmNumber(value));
29643
29540
  }
29644
29541
  function readString(bytes, position) {
29645
- const [length, start] = readNumber(bytes, position);
29542
+ const [length, start] = readULEB(bytes, position);
29646
29543
  if (start + length > bytes.length) throw new Error("invalid wasm string");
29647
29544
  return [
29648
29545
  Buffer.from(bytes.buffer, bytes.byteOffset + start, length).toString("utf8"),
@@ -29968,13 +29865,13 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
29968
29865
  for (const subsection of subsections) {
29969
29866
  if (subsection.kind === 6 && objcLoader !== void 0) {
29970
29867
  const content = subsection.parts[0];
29971
- const [count, entriesStart] = readNumber(content, 0);
29868
+ const [count, entriesStart] = readULEB(content, 0);
29972
29869
  const initWriter = new ByteWriter(content.length + 16);
29973
29870
  initWriter.bytes(content, 0, entriesStart);
29974
29871
  let entryStart = entriesStart;
29975
29872
  for (let i = 0; i < count; i++) {
29976
- const [, symbolStart] = readNumber(content, entryStart);
29977
- const [symbol2, entryEnd] = readNumber(content, symbolStart);
29873
+ const [, symbolStart] = readULEB(content, entryStart);
29874
+ const [symbol2, entryEnd] = readULEB(content, symbolStart);
29978
29875
  if (symbol2 === objcLoader) {
29979
29876
  initWriter.uleb(1);
29980
29877
  initWriter.bytes(content, symbolStart, entryEnd);
@@ -30044,7 +29941,7 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
30044
29941
  if (position < bytes.length && bytes[position] < 128) {
30045
29942
  size2 = bytes[position++];
30046
29943
  } else {
30047
- const [val, next] = readNumber(bytes, position);
29944
+ const [val, next] = readULEB(bytes, position);
30048
29945
  size2 = val;
30049
29946
  position = next;
30050
29947
  }
@@ -30544,7 +30441,7 @@ function createGuestImageLedger(input) {
30544
30441
  const digest2 = ({ object: object8 }) => {
30545
30442
  let value = digests2.get(object8);
30546
30443
  if (value === void 0) {
30547
- value = (0, import_node_crypto27.createHash)("sha256").update(objects2.get(object8).bytes).digest("hex");
30444
+ value = (0, import_node_crypto28.createHash)("sha256").update(objects2.get(object8).bytes).digest("hex");
30548
30445
  digests2.set(object8, value);
30549
30446
  }
30550
30447
  return value;
@@ -30759,7 +30656,7 @@ done:
30759
30656
  attributes #0 = { "wasm-import-module"="${NATIVE_TABLE_IMPORT_MODULE}" "wasm-import-name"="${NATIVE_DYLD_FUNCTION_IMPORT}" }`;
30760
30657
  }
30761
30658
  function sdkGuestCallerId(product) {
30762
- const hash = (0, import_node_crypto27.createHash)("sha256").update(product).digest().readUInt32LE(0);
30659
+ const hash = (0, import_node_crypto28.createHash)("sha256").update(product).digest().readUInt32LE(0);
30763
30660
  return (hash | 2147483648) >>> 0;
30764
30661
  }
30765
30662
  function sdkGuestSymbolName(product, name3) {
@@ -30800,7 +30697,7 @@ function nameGuestImageAliases(wasm, symbols) {
30800
30697
  const parts = [wasm.subarray(0, 8)];
30801
30698
  let position = 8;
30802
30699
  while (position < wasm.length) {
30803
- const [size2, start] = readNumber(wasm, position + 1);
30700
+ const [size2, start] = readULEB(wasm, position + 1);
30804
30701
  const end = start + size2;
30805
30702
  const custom = wasm[position] === 0 ? readString(wasm, start) : void 0;
30806
30703
  if (custom?.[0] !== "name") {
@@ -30811,17 +30708,17 @@ function nameGuestImageAliases(wasm, symbols) {
30811
30708
  const subsections = [encodedString("name")];
30812
30709
  let at = custom[1];
30813
30710
  while (at < end) {
30814
- const [subSize, subStart] = readNumber(wasm, at + 1);
30711
+ const [subSize, subStart] = readULEB(wasm, at + 1);
30815
30712
  const subEnd = subStart + subSize;
30816
30713
  if (wasm[at] !== 1) {
30817
30714
  subsections.push(wasm.subarray(at, subEnd));
30818
30715
  at = subEnd;
30819
30716
  continue;
30820
30717
  }
30821
- let [count, cursor] = readNumber(wasm, subStart);
30718
+ let [count, cursor] = readULEB(wasm, subStart);
30822
30719
  const entries2 = [encodeNumber(count)];
30823
30720
  for (; count > 0; count--) {
30824
- const [index, next] = readNumber(wasm, cursor);
30721
+ const [index, next] = readULEB(wasm, cursor);
30825
30722
  const [name3, after] = readString(wasm, next);
30826
30723
  cursor = after;
30827
30724
  const symbol2 = symbols[Number(alias.exec(name3)?.[1] ?? -1)];
@@ -30837,14 +30734,15 @@ function nameGuestImageAliases(wasm, symbols) {
30837
30734
  }
30838
30735
  return Buffer.concat(parts);
30839
30736
  }
30840
- var import_node_crypto27, ByteWriter, OBJC_INIT_RECORD, TABLE_INDEX_RELOCATIONS, sha256PairHex, GUEST_DYLD_VALUES_SECTION, GUEST_LAZY_FUNCTION_BASE, SDK_DYLD_RESOLVER;
30737
+ var import_node_crypto28, ByteWriter, OBJC_INIT_RECORD, TABLE_INDEX_RELOCATIONS, sha256PairHex, GUEST_DYLD_VALUES_SECTION, GUEST_LAZY_FUNCTION_BASE, SDK_DYLD_RESOLVER;
30841
30738
  var init_swift_guest_image_ledger = __esm({
30842
30739
  "src/swift-guest-image-ledger.ts"() {
30843
30740
  "use strict";
30844
- import_node_crypto27 = require("node:crypto");
30741
+ import_node_crypto28 = require("node:crypto");
30845
30742
  init_nativeWasmContract();
30846
30743
  init_swift_sdk_image_wasm();
30847
30744
  init_swiftSdkLinkContract();
30745
+ init_wasm_binary_sections();
30848
30746
  ByteWriter = class {
30849
30747
  buf;
30850
30748
  pos = 0;
@@ -30865,16 +30763,13 @@ var init_swift_guest_image_ledger = __esm({
30865
30763
  this.buf[this.pos++] = value;
30866
30764
  }
30867
30765
  uleb(value) {
30868
- this.ensure(10);
30869
- let pos = this.pos;
30870
- const buf = this.buf;
30871
- do {
30872
- let byte = value % 128;
30873
- value = Math.floor(value / 128);
30874
- if (value) byte |= 128;
30875
- buf[pos++] = byte;
30876
- } while (value);
30877
- this.pos = pos;
30766
+ if (value < 128) {
30767
+ this.byte(value);
30768
+ return;
30769
+ }
30770
+ const encoded = encodeWasmNumber(value);
30771
+ this.ensure(encoded.length);
30772
+ for (let i = 0; i < encoded.length; i++) this.buf[this.pos++] = encoded[i];
30878
30773
  }
30879
30774
  bytes(source, start = 0, end = source.length) {
30880
30775
  const len = end - start;
@@ -30898,7 +30793,7 @@ var init_swift_guest_image_ledger = __esm({
30898
30793
  };
30899
30794
  OBJC_INIT_RECORD = ".objc_init";
30900
30795
  TABLE_INDEX_RELOCATIONS = /* @__PURE__ */ new Set([1, 2, 12, 18, 19, 24]);
30901
- sha256PairHex = typeof Bun !== "undefined" ? (first, second) => new Bun.CryptoHasher("sha256").update(first).update("\0").update(second).digest("hex") : (first, second) => (0, import_node_crypto27.createHash)("sha256").update(first).update("\0").update(second).digest("hex");
30796
+ sha256PairHex = typeof Bun !== "undefined" ? (first, second) => new Bun.CryptoHasher("sha256").update(first).update("\0").update(second).digest("hex") : (first, second) => (0, import_node_crypto28.createHash)("sha256").update(first).update("\0").update(second).digest("hex");
30902
30797
  GUEST_DYLD_VALUES_SECTION = "peach_dyld_values";
30903
30798
  GUEST_LAZY_FUNCTION_BASE = 2 ** 32;
30904
30799
  SDK_DYLD_RESOLVER = "__peach_sdk_dyld_resolve";
@@ -31224,19 +31119,7 @@ var init_wasm_narrow_boundary = __esm({
31224
31119
  function sha256Buffer(bytes) {
31225
31120
  if (typeof Bun !== "undefined")
31226
31121
  return Buffer.from(new Bun.CryptoHasher("sha256").update(bytes).digest());
31227
- return (0, import_node_crypto28.createHash)("sha256").update(bytes).digest();
31228
- }
31229
- function sha256Hex3(bytes) {
31230
- if (typeof Bun !== "undefined")
31231
- return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
31232
- return (0, import_node_crypto28.createHash)("sha256").update(bytes).digest("hex");
31233
- }
31234
- function uleb2(value) {
31235
- const bytes = [];
31236
- for (let rest = value; ; rest = Math.floor(rest / 128)) {
31237
- if (rest < 128) return [...bytes, rest];
31238
- bytes.push(rest % 128 | 128);
31239
- }
31122
+ return (0, import_node_crypto29.createHash)("sha256").update(bytes).digest();
31240
31123
  }
31241
31124
  function encodeGuestDyldTable(rows) {
31242
31125
  const encoded = rows.map((row) => ({ ...row, bytes: Buffer.from(row.name) })).sort((a, b) => Buffer.compare(a.bytes, b.bytes));
@@ -31250,7 +31133,7 @@ function encodeGuestDyldTable(rows) {
31250
31133
  value.writeBigUInt64LE(row.value);
31251
31134
  const bytes = Buffer.concat([
31252
31135
  row.bytes,
31253
- Buffer.from([0, ...uleb2(row.image), row.kind]),
31136
+ Buffer.from([0, ...encodeWasmNumber(row.image), row.kind]),
31254
31137
  value
31255
31138
  ]);
31256
31139
  if (!current2.length) firsts.push(row.bytes);
@@ -31320,8 +31203,8 @@ function guestDyldValueRange(map2) {
31320
31203
  function swiftDyldTableReference(modulePath, module2) {
31321
31204
  const section2 = readWasmCustomSection(module2, NATIVE_DYLD_TABLE_SECTION);
31322
31205
  if (!section2 || readWasmCustomSection(module2, NATIVE_DYLD_PACKS_SECTION)) return;
31323
- const { sha256: sha2565, byteLength } = readNativeDyldTableIndex(Uint8Array.from(section2).buffer);
31324
- return { path: nativeDyldTablePath(modulePath, sha2565), sha256: sha2565, byteLength };
31206
+ const { sha256: sha2564, byteLength } = readNativeDyldTableIndex(Uint8Array.from(section2).buffer);
31207
+ return { path: nativeDyldTablePath(modulePath, sha2564), sha256: sha2564, byteLength };
31325
31208
  }
31326
31209
  function splitSwiftDyldTable(wasm) {
31327
31210
  const packs = readWasmCustomSection(wasm, NATIVE_DYLD_PACKS_SECTION);
@@ -31329,18 +31212,20 @@ function splitSwiftDyldTable(wasm) {
31329
31212
  const bytes = Buffer.from(packs);
31330
31213
  return {
31331
31214
  module: dropWasmCustomSection(wasm, NATIVE_DYLD_PACKS_SECTION),
31332
- table: { sha256: sha256Hex3(bytes), bytes }
31215
+ table: { sha256: sha256Hex2(bytes), bytes }
31333
31216
  };
31334
31217
  }
31335
- var import_node_crypto28, import_node_zlib3, PACK_BYTES;
31218
+ var import_node_crypto29, import_node_zlib3, PACK_BYTES;
31336
31219
  var init_swift_guest_dyld_table = __esm({
31337
31220
  "src/swift-guest-dyld-table.ts"() {
31338
31221
  "use strict";
31339
- import_node_crypto28 = require("node:crypto");
31222
+ import_node_crypto29 = require("node:crypto");
31340
31223
  import_node_zlib3 = require("node:zlib");
31341
31224
  init_nativeDyldTableContract();
31225
+ init_sha256();
31342
31226
  init_swift_guest_image_ledger();
31343
31227
  init_swift_guest_linked_spans();
31228
+ init_wasm_binary_sections();
31344
31229
  init_wasm_narrow_boundary();
31345
31230
  PACK_BYTES = 64 * 1024;
31346
31231
  }
@@ -31416,8 +31301,8 @@ function readImports2(bytes, sections) {
31416
31301
  return { functions, table64 };
31417
31302
  }
31418
31303
  function vectorSection(id, count, parts) {
31419
- const body = Buffer.concat([Buffer.from(uleb3(count)), ...parts]);
31420
- return Buffer.concat([Buffer.from([id, ...uleb3(body.length)]), body]);
31304
+ const body = Buffer.concat([Buffer.from(encodeWasmNumber(count)), ...parts]);
31305
+ return Buffer.concat([Buffer.from([id, ...encodeWasmNumber(body.length)]), body]);
31421
31306
  }
31422
31307
  function rewriteSections(bytes, sections, changes) {
31423
31308
  const out = [bytes.subarray(0, 8)];
@@ -31473,9 +31358,9 @@ function appendLazyPlacement(bytes, functions, table) {
31473
31358
  vectorSection(2, count + 1, [
31474
31359
  found && header ? bytes.subarray(header.at, found.end) : new Uint8Array(),
31475
31360
  Buffer.from([
31476
- ...uleb3(module2.length),
31361
+ ...encodeWasmNumber(module2.length),
31477
31362
  ...module2,
31478
- ...uleb3(name4.length),
31363
+ ...encodeWasmNumber(name4.length),
31479
31364
  ...name4,
31480
31365
  1,
31481
31366
  112,
@@ -31497,7 +31382,7 @@ function appendLazyPlacement(bytes, functions, table) {
31497
31382
  elements.splice(
31498
31383
  placementIndex,
31499
31384
  0,
31500
- Buffer.from([1, 0, ...uleb3(functions.length), ...functions.flatMap(uleb3)])
31385
+ Buffer.from([1, 0, ...encodeWasmNumber(functions.length), ...functions.flatMap(encodeWasmNumber)])
31501
31386
  );
31502
31387
  const place2 = imports2.functions + declared.length;
31503
31388
  const instructions = [
@@ -31511,7 +31396,7 @@ function appendLazyPlacement(bytes, functions, table) {
31511
31396
  1,
31512
31397
  252,
31513
31398
  12,
31514
- ...uleb3(placementIndex),
31399
+ ...encodeWasmNumber(placementIndex),
31515
31400
  0,
31516
31401
  11
31517
31402
  ];
@@ -31532,14 +31417,14 @@ function appendLazyPlacement(bytes, functions, table) {
31532
31417
  3,
31533
31418
  vectorSection(3, declared.length + 1, [
31534
31419
  ...declared,
31535
- Buffer.from(uleb3(types2.length))
31420
+ Buffer.from(encodeWasmNumber(types2.length))
31536
31421
  ])
31537
31422
  ],
31538
31423
  [
31539
31424
  7,
31540
31425
  vectorSection(7, exports2.length + 1, [
31541
31426
  ...exports2,
31542
- Buffer.from([...uleb3(name3.length), ...name3, 0, ...uleb3(place2)])
31427
+ Buffer.from([...encodeWasmNumber(name3.length), ...name3, 0, ...encodeWasmNumber(place2)])
31543
31428
  ])
31544
31429
  ],
31545
31430
  [9, vectorSection(9, elements.length, elements)],
@@ -31547,7 +31432,7 @@ function appendLazyPlacement(bytes, functions, table) {
31547
31432
  10,
31548
31433
  vectorSection(10, bodies.length + 1, [
31549
31434
  ...bodies,
31550
- Buffer.from([...uleb3(instructions.length), ...instructions])
31435
+ Buffer.from([...encodeWasmNumber(instructions.length), ...instructions])
31551
31436
  ])
31552
31437
  ]
31553
31438
  ])
@@ -31600,22 +31485,13 @@ function placeGuestLazyFunctions(bytes, lazy) {
31600
31485
  function guestLazyExports(lazy) {
31601
31486
  return lazy.map((name3) => JSON.stringify(`--export=${name3}`)).join("\n");
31602
31487
  }
31603
- var uleb3, SECTION_ORDER, readExport, lastTableElement;
31488
+ var SECTION_ORDER, readExport, lastTableElement;
31604
31489
  var init_swift_guest_dyld_functions = __esm({
31605
31490
  "src/swift-guest-dyld-functions.ts"() {
31606
31491
  "use strict";
31607
31492
  init_nativeWasmContract();
31608
31493
  init_swift_sdk_image_wasm();
31609
- uleb3 = (value) => {
31610
- const out = [];
31611
- do {
31612
- let byte = value % 128;
31613
- value = Math.floor(value / 128);
31614
- if (value) byte |= 128;
31615
- out.push(byte);
31616
- } while (value);
31617
- return out;
31618
- };
31494
+ init_wasm_binary_sections();
31619
31495
  SECTION_ORDER = [1, 2, 3, 4, 5, 13, 6, 7, 8, 9, 12, 10, 11];
31620
31496
  readExport = (r) => {
31621
31497
  r.name();
@@ -31681,7 +31557,7 @@ function selectedGuestManifestInputs(plan, selection, identities, readSelected)
31681
31557
  throw new Error(
31682
31558
  `selected member has no original identity: ${item.artifact}(${item.member})`
31683
31559
  );
31684
- if (origin && (0, import_node_crypto29.createHash)("sha256").update(bytes).digest("hex") !== origin.sha256)
31560
+ if (origin && (0, import_node_crypto30.createHash)("sha256").update(bytes).digest("hex") !== origin.sha256)
31685
31561
  throw new Error(
31686
31562
  `selected member differs from original: ${item.artifact}(${item.member})`
31687
31563
  );
@@ -31728,7 +31604,7 @@ function createGuestImageManifest(image) {
31728
31604
  cpuType: -1,
31729
31605
  cpuSubtype: 0
31730
31606
  };
31731
- const digest2 = (0, import_node_crypto29.createHash)("sha256");
31607
+ const digest2 = (0, import_node_crypto30.createHash)("sha256");
31732
31608
  const sizeBuf = Buffer.allocUnsafe(8);
31733
31609
  const add = (bytes) => {
31734
31610
  sizeBuf.writeBigUInt64BE(BigInt(bytes.byteLength));
@@ -31770,11 +31646,11 @@ function createGuestImageManifest(image) {
31770
31646
  regions: image.regions
31771
31647
  };
31772
31648
  }
31773
- var import_node_crypto29, import_node_fs47, framedLinkOptionsCache;
31649
+ var import_node_crypto30, import_node_fs47, framedLinkOptionsCache;
31774
31650
  var init_swift_guest_manifest = __esm({
31775
31651
  "src/swift-guest-manifest.ts"() {
31776
31652
  "use strict";
31777
- import_node_crypto29 = require("node:crypto");
31653
+ import_node_crypto30 = require("node:crypto");
31778
31654
  import_node_fs47 = require("node:fs");
31779
31655
  init_swift_guest_link_plan();
31780
31656
  init_swift_wasm_prune();
@@ -32240,11 +32116,11 @@ var init_swift_guest_projection_storage = __esm({
32240
32116
  function frameworkRuntimeProductId(product) {
32241
32117
  return `swift-package/${product.packageName}/${product.product.name}`;
32242
32118
  }
32243
- var import_node_crypto30, v4, packageSchema;
32119
+ var import_node_crypto31, v4, packageSchema;
32244
32120
  var init_swift_runtime_products = __esm({
32245
32121
  "src/swift-runtime-products.ts"() {
32246
32122
  "use strict";
32247
- import_node_crypto30 = require("node:crypto");
32123
+ import_node_crypto31 = require("node:crypto");
32248
32124
  v4 = __toESM(require("peachsim/vendor/valibot"), 1);
32249
32125
  init_is_record();
32250
32126
  packageSchema = v4.object({
@@ -32275,7 +32151,7 @@ function canonicalArchivePath(file) {
32275
32151
  function sdkArtifactBytes(root, artifact) {
32276
32152
  const file = import_node_path46.default.resolve(root, artifact.path);
32277
32153
  const linked = (0, import_node_fs48.readFileSync)(file);
32278
- const hash = (bytes) => (0, import_node_crypto31.createHash)("sha256").update(bytes).digest("hex");
32154
+ const hash = (bytes) => (0, import_node_crypto32.createHash)("sha256").update(bytes).digest("hex");
32279
32155
  if (hash(linked) === artifact.sha256) return { source: linked, linked };
32280
32156
  if (artifact.kind !== "archive" || artifact.path !== `${SWIFT_SDK_PRODUCT_DIRECTORY}/libFoundation.a`)
32281
32157
  throw new Error(`SDK product artifact changed ${file}`);
@@ -32301,9 +32177,9 @@ function indexSdkMembers(bytes) {
32301
32177
  );
32302
32178
  }
32303
32179
  function verifySdkObjectTransform(source, linked, sourceSha256, transformation) {
32304
- if ((0, import_node_crypto31.createHash)("sha256").update(source).digest("hex") !== sourceSha256 || transformation.inputSha256 !== sourceSha256)
32180
+ if ((0, import_node_crypto32.createHash)("sha256").update(source).digest("hex") !== sourceSha256 || transformation.inputSha256 !== sourceSha256)
32305
32181
  throw new Error("SDK object transform input changed");
32306
- if ((0, import_node_crypto31.createHash)("sha256").update(linked).digest("hex") !== transformation.outputSha256 || transformation.kind === "swiftrt" && !Buffer.from(patchSwiftrtObject(source)).equals(linked))
32182
+ if ((0, import_node_crypto32.createHash)("sha256").update(linked).digest("hex") !== transformation.outputSha256 || transformation.kind === "swiftrt" && !Buffer.from(patchSwiftrtObject(source)).equals(linked))
32307
32183
  throw new Error("SDK object transform output changed");
32308
32184
  }
32309
32185
  function readGuestRuntimeCatalogs(sdkRoot, distributionRoot) {
@@ -32583,7 +32459,7 @@ function guestSdkProductLinkArtifacts(products, sdk2, inputs2, linkedArchives, r
32583
32459
  const digest2 = (file) => {
32584
32460
  let value = hashes.get(file);
32585
32461
  if (!value) {
32586
- value = (0, import_node_crypto31.createHash)("sha256").update((0, import_node_fs48.readFileSync)(file)).digest("hex");
32462
+ value = (0, import_node_crypto32.createHash)("sha256").update((0, import_node_fs48.readFileSync)(file)).digest("hex");
32587
32463
  hashes.set(file, value);
32588
32464
  }
32589
32465
  return value;
@@ -32651,9 +32527,9 @@ function guestSdkProductLinkArtifacts(products, sdk2, inputs2, linkedArchives, r
32651
32527
  if (input.member) {
32652
32528
  if (original.kind !== "archive")
32653
32529
  throw new Error(`SDK input member has no archive ${originalFile}`);
32654
- const { name: name3, ordinal, sha256: sha2565 } = input.member;
32530
+ const { name: name3, ordinal, sha256: sha2564 } = input.member;
32655
32531
  const member = original.members.find(
32656
- (entry) => entry.name === name3 && entry.ordinal === ordinal && entry.sha256 === sha2565
32532
+ (entry) => entry.name === name3 && entry.ordinal === ordinal && entry.sha256 === sha2564
32657
32533
  );
32658
32534
  let records = archiveMembers.get(originalFile);
32659
32535
  if (!records) {
@@ -32661,7 +32537,7 @@ function guestSdkProductLinkArtifacts(products, sdk2, inputs2, linkedArchives, r
32661
32537
  archiveMembers.set(originalFile, records);
32662
32538
  }
32663
32539
  const bytes = records.filter((entry) => entry.name === name3)[ordinal - 1]?.bytes;
32664
- if (!member || !bytes || (0, import_node_crypto31.createHash)("sha256").update(bytes).digest("hex") !== sha2565)
32540
+ if (!member || !bytes || (0, import_node_crypto32.createHash)("sha256").update(bytes).digest("hex") !== sha2564)
32665
32541
  throw new Error(`SDK input member changed ${originalFile}(${name3})`);
32666
32542
  } else if (original.kind !== "object")
32667
32543
  throw new Error(`SDK object input has no member ${originalFile}`);
@@ -32690,7 +32566,7 @@ function guestSdkProductLinkArtifacts(products, sdk2, inputs2, linkedArchives, r
32690
32566
  const member = members2.get(key2);
32691
32567
  const source = indexed.source.get(key2);
32692
32568
  const linked2 = indexed.linked.get(key2);
32693
- if (!member || !source || !linked2 || (0, import_node_crypto31.createHash)("sha256").update(source).digest("hex") !== member.sha256 || (0, import_node_crypto31.createHash)("sha256").update(linked2).digest("hex") !== digest2(origin.original))
32569
+ if (!member || !source || !linked2 || (0, import_node_crypto32.createHash)("sha256").update(source).digest("hex") !== member.sha256 || (0, import_node_crypto32.createHash)("sha256").update(linked2).digest("hex") !== digest2(origin.original))
32694
32570
  throw new Error(`SDK member differs from source product ${origin.original}`);
32695
32571
  add({
32696
32572
  path: origin.original,
@@ -32755,7 +32631,7 @@ function guestAliasedSdkArchiveArtifacts(options2) {
32755
32631
  const key2 = JSON.stringify([member.name, member.ordinal]);
32756
32632
  const bytes = sourceMembers[index].get(key2);
32757
32633
  const linked = viewMembers[index].get(key2);
32758
- return bytes !== void 0 && linked !== void 0 && (0, import_node_crypto31.createHash)("sha256").update(bytes).digest("hex") === entry.sha256 && (0, import_node_crypto31.createHash)("sha256").update(linked).digest("hex") === member.sha256;
32634
+ return bytes !== void 0 && linked !== void 0 && (0, import_node_crypto32.createHash)("sha256").update(bytes).digest("hex") === entry.sha256 && (0, import_node_crypto32.createHash)("sha256").update(linked).digest("hex") === member.sha256;
32759
32635
  }) ? [product2.id] : []
32760
32636
  )
32761
32637
  );
@@ -32788,11 +32664,11 @@ function guestAliasedSdkArchiveArtifacts(options2) {
32788
32664
  }
32789
32665
  return result;
32790
32666
  }
32791
- var import_node_crypto31, import_node_fs48, import_node_path46, v5, SDK_CONTAINING_IMAGE;
32667
+ var import_node_crypto32, import_node_fs48, import_node_path46, v5, SDK_CONTAINING_IMAGE;
32792
32668
  var init_swift_guest_runtime_plan = __esm({
32793
32669
  "src/swift-guest-runtime-plan.ts"() {
32794
32670
  "use strict";
32795
- import_node_crypto31 = require("node:crypto");
32671
+ import_node_crypto32 = require("node:crypto");
32796
32672
  import_node_fs48 = require("node:fs");
32797
32673
  import_node_path46 = __toESM(require("node:path"), 1);
32798
32674
  v5 = __toESM(require("peachsim/vendor/valibot"), 1);
@@ -34628,13 +34504,8 @@ function clangBinaryStamp(file) {
34628
34504
  const stat = (0, import_node_fs51.statSync)(file, { bigint: true });
34629
34505
  return [file, stat.size, stat.mtimeNs].join(":");
34630
34506
  }
34631
- function sha256Hex4(bytes) {
34632
- if (typeof Bun !== "undefined")
34633
- return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
34634
- return (0, import_node_crypto32.createHash)("sha256").update(bytes).digest("hex");
34635
- }
34636
34507
  function clangWrapperStamp(file) {
34637
- return sha256Hex4((0, import_node_fs51.readFileSync)(file));
34508
+ return sha256Hex2((0, import_node_fs51.readFileSync)(file));
34638
34509
  }
34639
34510
  function clangArgsNeedCwd(args) {
34640
34511
  const pathFlags = /* @__PURE__ */ new Set([
@@ -34812,7 +34683,7 @@ function sourceGuestClangLinkOptions(options2) {
34812
34683
  import_node_path49.default.join(options2.buildDirectory, CLANG_TARGET_MODULE_WRAPPER)
34813
34684
  )))
34814
34685
  throw new Error(`unsupported source object producer ${file}`);
34815
- const key2 = sha256Hex4(
34686
+ const key2 = sha256Hex2(
34816
34687
  JSON.stringify([
34817
34688
  "clang-link-options/v2",
34818
34689
  clangArgsNeedCwd(command.args) ? process.cwd() : null,
@@ -34823,7 +34694,7 @@ function sourceGuestClangLinkOptions(options2) {
34823
34694
  clangProducerStamp(file)
34824
34695
  ])
34825
34696
  );
34826
- const cacheFile = import_node_path49.default.join(cacheDirectory, sha256Hex4(file) + ".json");
34697
+ const cacheFile = import_node_path49.default.join(cacheDirectory, sha256Hex2(file) + ".json");
34827
34698
  const cached2 = readClangLinkOptions(cacheFile, key2);
34828
34699
  if (cached2) {
34829
34700
  validateClangLinkOptions(cached2);
@@ -34945,30 +34816,12 @@ function wasmAutolinkEntries(bytes, out) {
34945
34816
  const len = bytes.length;
34946
34817
  while (pos < len) {
34947
34818
  const id = bytes[pos++];
34948
- let sz = bytes[pos++];
34949
- if (sz >= 128) {
34950
- sz &= 127;
34951
- let shift = 7;
34952
- while (true) {
34953
- const b = bytes[pos++];
34954
- sz |= (b & 127) << shift;
34955
- if (b < 128) break;
34956
- shift += 7;
34957
- }
34958
- }
34819
+ let sz;
34820
+ [sz, pos] = readULEB(bytes, pos, len);
34959
34821
  const end = pos + sz;
34960
34822
  if (id === 0) {
34961
- let nLen = bytes[pos++];
34962
- if (nLen >= 128) {
34963
- nLen &= 127;
34964
- let shift = 7;
34965
- while (true) {
34966
- const b = bytes[pos++];
34967
- nLen |= (b & 127) << shift;
34968
- if (b < 128) break;
34969
- shift += 7;
34970
- }
34971
- }
34823
+ let nLen;
34824
+ [nLen, pos] = readULEB(bytes, pos, end);
34972
34825
  if (nLen === 24 && raw2.toString("ascii", pos, pos + 24) === ".swift1_autolink_entries") {
34973
34826
  const payload = raw2.toString("utf8", pos + 24, end);
34974
34827
  for (const entry of payload.split("\0")) {
@@ -35036,7 +34889,7 @@ function sourceGuestRuntimeLinks(options2) {
35036
34889
  const file = import_node_path49.default.resolve(directory2, alias.moduleMap);
35037
34890
  if (!file.startsWith(directory2 + import_node_path49.default.sep))
35038
34891
  throw new Error(`invalid framework module map ${alias.moduleMap}`);
35039
- if ((0, import_node_crypto32.createHash)("sha256").update((0, import_node_fs51.readFileSync)(file)).digest("hex") !== alias.moduleMapSha256)
34892
+ if (sha256Hex2((0, import_node_fs51.readFileSync)(file)) !== alias.moduleMapSha256)
35040
34893
  throw new Error(`framework module map changed ${alias.moduleMap}`);
35041
34894
  sdkAliases.set(alias.name, {
35042
34895
  product: product.id,
@@ -35092,7 +34945,7 @@ function sourceGuestRuntimeLinks(options2) {
35092
34945
  const map2 = import_node_path49.default.resolve(root, alias.moduleMap);
35093
34946
  if (!map2.startsWith(root + import_node_path49.default.sep))
35094
34947
  throw new Error(`invalid framework module map ${alias.moduleMap}`);
35095
- if ((0, import_node_crypto32.createHash)("sha256").update((0, import_node_fs51.readFileSync)(map2)).digest("hex") !== alias.moduleMapSha256)
34948
+ if (sha256Hex2((0, import_node_fs51.readFileSync)(map2)) !== alias.moduleMapSha256)
35096
34949
  throw new Error(`framework module map changed ${alias.moduleMap}`);
35097
34950
  frameworkAliases.set(alias.name, { kind: "package", targets: closure(alias.targets) });
35098
34951
  }
@@ -35193,18 +35046,19 @@ function logicalGuestLinkOptions(args, identities, roots) {
35193
35046
  }
35194
35047
  return output;
35195
35048
  }
35196
- var import_node_child_process26, import_node_crypto32, import_node_fs51, import_node_path49, CLANG_TARGET_MODULE_WRAPPER, PARALLEL_REPLAY;
35049
+ var import_node_child_process26, import_node_fs51, import_node_path49, CLANG_TARGET_MODULE_WRAPPER, PARALLEL_REPLAY;
35197
35050
  var init_swift_guest_source_inputs = __esm({
35198
35051
  "src/swift-guest-source-inputs.ts"() {
35199
35052
  "use strict";
35200
35053
  import_node_child_process26 = require("node:child_process");
35201
- import_node_crypto32 = require("node:crypto");
35202
35054
  import_node_fs51 = require("node:fs");
35203
35055
  import_node_path49 = __toESM(require("node:path"), 1);
35204
35056
  init_forked_script_contract();
35057
+ init_sha256();
35205
35058
  init_swift_guest_source_plan();
35206
35059
  init_swift_runtime_products();
35207
35060
  init_swift_wasm_prune();
35061
+ init_wasm_binary_sections();
35208
35062
  CLANG_TARGET_MODULE_WRAPPER = ".peach-clang";
35209
35063
  PARALLEL_REPLAY = `
35210
35064
  const { spawn } = require('node:child_process')
@@ -40157,6 +40011,10 @@ ${SWIFT_SDK_IMAGE_VERSION}
40157
40011
  `).update(inputs2).update(products.length === 0 ? "" : `
40158
40012
  products ${products.join(" ")}`).digest("hex").slice(0, 32);
40159
40013
  }
40014
+ function swiftSdkImageVariantKey(baseKey, required) {
40015
+ if (!required.length) return baseKey;
40016
+ return (0, import_node_crypto39.createHash)("sha256").update(baseKey).update(JSON.stringify(required)).digest("hex").slice(0, 32);
40017
+ }
40160
40018
  function swiftSdkImageEntry(key2, scopedLookups) {
40161
40019
  const inputs2 = { image: key2 };
40162
40020
  return {
@@ -40186,15 +40044,15 @@ function cached(directory2, key2) {
40186
40044
  return void 0;
40187
40045
  }
40188
40046
  }
40189
- function sdkImageAt(directory2, key2, sha2565) {
40047
+ function sdkImageAt(directory2, key2, sha2564) {
40190
40048
  refreshSwiftCacheHold(directory2);
40191
- const cacheKey = `${directory2}\0${sha2565}`;
40049
+ const cacheKey = `${directory2}\0${sha2564}`;
40192
40050
  let loadedInterface;
40193
40051
  return {
40194
40052
  key: key2,
40195
40053
  directory: directory2,
40196
40054
  image: import_node_path58.default.join(directory2, IMAGE_FILE),
40197
- sha256: sha2565,
40055
+ sha256: sha2564,
40198
40056
  get sdkInterface() {
40199
40057
  if (loadedInterface) return loadedInterface;
40200
40058
  const memo2 = cachedSdkInterfaces.get(cacheKey);
@@ -40208,11 +40066,24 @@ function sdkImageAt(directory2, key2, sha2565) {
40208
40066
  }
40209
40067
  async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkImports2 = [], options2) {
40210
40068
  const { imports: imports2, products } = swiftSdkImageProducts(moduleRoot, frameworkImports2);
40211
- const key2 = swiftSdkImageKey(moduleRoot, scopedLookups, products);
40212
- const directory2 = import_node_path58.default.join(swiftCacheDir(), "swift-sdk-images", key2);
40069
+ const images = import_node_path58.default.join(swiftCacheDir(), "swift-sdk-images");
40070
+ const baseKey = swiftSdkImageKey(moduleRoot, scopedLookups, products);
40071
+ const required = [...new Set(options2?.requiredGuestSymbols)].sort();
40072
+ const base = cached(import_node_path58.default.join(images, baseKey), baseKey);
40073
+ if (base) {
40074
+ if (!required.length) return base;
40075
+ const { functions, data, tls } = base.sdkInterface;
40076
+ if (required.every(
40077
+ (name3) => functions[name3] !== void 0 || data[name3] !== void 0 || tls[name3] !== void 0
40078
+ ))
40079
+ return base;
40080
+ }
40081
+ const key2 = swiftSdkImageVariantKey(baseKey, required);
40082
+ const directory2 = import_node_path58.default.join(images, key2);
40213
40083
  const existing = cached(directory2, key2);
40214
40084
  if (existing) return existing;
40215
- if (!options2?.producer && !swiftDistributionAt(moduleRoot) && import_node_path58.default.resolve(moduleRoot) === sourceSwiftCheckout() && process.platform === "linux" && process.env.TM_SESSION) {
40085
+ const distribution = swiftDistributionAt(moduleRoot);
40086
+ if (!options2?.producer && !required.length && !distribution && import_node_path58.default.resolve(moduleRoot) === sourceSwiftCheckout() && process.platform === "linux" && process.env.TM_SESSION) {
40216
40087
  const { produceSwiftSdkImage: produceSwiftSdkImage2 } = await Promise.resolve().then(() => (init_swift_sdk_image_producer(), swift_sdk_image_producer_exports));
40217
40088
  await produceSwiftSdkImage2({
40218
40089
  moduleRoot,
@@ -40233,7 +40104,7 @@ async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkIm
40233
40104
  return cached(directory2, key2) ?? withSwiftRootLock(directory2, async () => {
40234
40105
  const previous = cached(directory2, key2);
40235
40106
  if (previous) return previous;
40236
- if (swiftDistributionAt(moduleRoot)) {
40107
+ if (distribution && !required.length) {
40237
40108
  const entry = swiftSdkImageEntry(key2, scopedLookups);
40238
40109
  const fetched = fetchNativeEntry("sdk-image", entry.name, entry.key);
40239
40110
  if (fetched) {
@@ -40270,6 +40141,7 @@ async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkIm
40270
40141
  work,
40271
40142
  scopedLookups,
40272
40143
  imports2,
40144
+ required,
40273
40145
  releaseFrameworks
40274
40146
  )
40275
40147
  );
@@ -40278,7 +40150,7 @@ async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkIm
40278
40150
  }
40279
40151
  });
40280
40152
  }
40281
- async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLookups, imports2, releaseFrameworks) {
40153
+ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLookups, imports2, required, releaseFrameworks) {
40282
40154
  (0, import_node_fs60.rmSync)(work, { recursive: true, force: true });
40283
40155
  (0, import_node_fs60.mkdirSync)(work, { recursive: true });
40284
40156
  const toolchain = swiftModuleToolchain(moduleRoot);
@@ -40439,7 +40311,10 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
40439
40311
  const quote3 = (value) => JSON.stringify(value);
40440
40312
  (0, import_node_fs60.writeFileSync)(
40441
40313
  import_node_path58.default.join(work, "exports.rsp"),
40442
- [...defined].map((name3) => quote3(`--export-if-defined=${name3}`)).join("\n")
40314
+ [
40315
+ ...[...defined].map((name3) => quote3(`--export-if-defined=${name3}`)),
40316
+ ...required.filter((name3) => !defined.has(name3)).map((name3) => quote3(`--export=${name3}`))
40317
+ ].join("\n")
40443
40318
  );
40444
40319
  const guestServices = import_node_path58.default.join(work, "peach-guest-services.allow");
40445
40320
  (0, import_node_fs60.writeFileSync)(guestServices, peachGuestServiceAllowlist);
@@ -40530,11 +40405,12 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
40530
40405
  import_node_path58.default.join(work, IMAGE_DIGEST),
40531
40406
  typeof Bun !== "undefined" ? new Bun.CryptoHasher("sha256").update(image).digest("hex") : (0, import_node_crypto39.createHash)("sha256").update(image).digest("hex")
40532
40407
  );
40533
- if (swiftSdkImageKey(
40408
+ const baseKey = swiftSdkImageKey(
40534
40409
  moduleRoot,
40535
40410
  scopedLookups,
40536
40411
  swiftSdkImageProducts(moduleRoot, imports2).products
40537
- ) !== key2)
40412
+ );
40413
+ if (swiftSdkImageVariantKey(baseKey, required) !== key2)
40538
40414
  throw new Error("Swift SDK image inputs changed during compilation");
40539
40415
  for (const name3 of (0, import_node_fs60.readdirSync)(work))
40540
40416
  if (!SWIFT_SDK_IMAGE_FILES.includes(name3))
@@ -40945,12 +40821,12 @@ function encodeNativeSdkLater(later) {
40945
40821
  const view = new DataView(bytes.buffer);
40946
40822
  view.setUint32(0, files2.length, true);
40947
40823
  let at = 4;
40948
- for (const { sha256: sha2565, byteLength } of files2) {
40949
- if (!/^[a-f0-9]{64}$/.test(sha2565))
40824
+ for (const { sha256: sha2564, byteLength } of files2) {
40825
+ if (!/^[a-f0-9]{64}$/.test(sha2564))
40950
40826
  throw new Error("Swift SDK later data needs a sha256 digest");
40951
40827
  if (!byteLength) throw new Error("Swift SDK later data file is empty");
40952
40828
  for (let i = 0; i < LATER_DIGEST_BYTES; i++)
40953
- bytes[at + i] = Number.parseInt(sha2565.slice(i * 2, i * 2 + 2), 16);
40829
+ bytes[at + i] = Number.parseInt(sha2564.slice(i * 2, i * 2 + 2), 16);
40954
40830
  view.setUint32(at + LATER_DIGEST_BYTES, byteLength, true);
40955
40831
  at += LATER_DIGEST_BYTES + 4;
40956
40832
  }
@@ -40975,13 +40851,13 @@ function decodeNativeSdkLater(trailer) {
40975
40851
  const files2 = [];
40976
40852
  for (let file = 0; file < count; file++) {
40977
40853
  if (at + LATER_DIGEST_BYTES + 4 > trailer.byteLength) throw truncated();
40978
- const sha2565 = Array.from(
40854
+ const sha2564 = Array.from(
40979
40855
  trailer.subarray(at, at + LATER_DIGEST_BYTES),
40980
40856
  (byte) => byte.toString(16).padStart(2, "0")
40981
40857
  ).join("");
40982
40858
  const byteLength = view.getUint32(at + LATER_DIGEST_BYTES, true);
40983
40859
  if (!byteLength) throw new Error("Swift SDK binding names empty later data");
40984
- files2.push({ sha256: sha2565, byteLength });
40860
+ files2.push({ sha256: sha2564, byteLength });
40985
40861
  at += LATER_DIGEST_BYTES + 4;
40986
40862
  }
40987
40863
  if (!files2.length || at + 4 > trailer.byteLength) throw truncated();
@@ -41216,8 +41092,8 @@ function finishSwiftAppModuleFile(file) {
41216
41092
  return;
41217
41093
  }
41218
41094
  const thunks = sdkImportThunks(prefix);
41219
- const nameBytes = Buffer.from(encodedName2(NATIVE_SDK_THUNK_SECTION));
41220
- const header = Buffer.from([0, ...uleb4(nameBytes.length + thunks.length)]);
41095
+ const nameBytes = Buffer.from(encodeWasmName(NATIVE_SDK_THUNK_SECTION));
41096
+ const header = Buffer.from([0, ...encodeWasmNumber(nameBytes.length + thunks.length)]);
41221
41097
  (0, import_node_fs61.appendFileSync)(file, Buffer.concat([header, nameBytes, thunks]));
41222
41098
  }
41223
41099
  function swiftAppModuleInputs(tokens2, buildRoot, sdkLibraries) {
@@ -41569,17 +41445,17 @@ function sdkImportThunks(bytes) {
41569
41445
  for (const { type } of imports2)
41570
41446
  if (!typeIndex.has(type)) typeIndex.set(type, typeIndex.size + 1);
41571
41447
  const loaderType = [96, 1, 127, 0];
41572
- const vector = (items2) => [...uleb4(items2.length), ...items2.flat()];
41573
- const sectionBytes = (id, body) => [id, ...uleb4(body.length), ...body];
41448
+ const vector = (items2) => [...encodeWasmNumber(items2.length), ...items2.flat()];
41449
+ const sectionBytes = (id, body) => [id, ...encodeWasmNumber(body.length), ...body];
41574
41450
  const slotGlobals = imports2.map(({ slot }) => [
41575
- ...encodedName2(NATIVE_SDK_IMPORT_MODULE),
41576
- ...encodedName2(String(slot)),
41451
+ ...encodeWasmName(NATIVE_SDK_IMPORT_MODULE),
41452
+ ...encodeWasmName(String(slot)),
41577
41453
  3,
41578
41454
  127,
41579
41455
  0
41580
41456
  ]);
41581
41457
  const bodies = imports2.map(({ type }, index) => {
41582
- const slotValue = [35, ...uleb4(index)];
41458
+ const slotValue = [35, ...encodeWasmNumber(index)];
41583
41459
  const code = [
41584
41460
  0,
41585
41461
  ...slotValue,
@@ -41592,14 +41468,14 @@ function sdkImportThunks(bytes) {
41592
41468
  16,
41593
41469
  0,
41594
41470
  11,
41595
- ...Array.from({ length: params[type] }, (_, i) => [32, ...uleb4(i)]).flat(),
41471
+ ...Array.from({ length: params[type] }, (_, i) => [32, ...encodeWasmNumber(i)]).flat(),
41596
41472
  ...slotValue,
41597
41473
  17,
41598
- ...uleb4(typeIndex.get(type)),
41474
+ ...encodeWasmNumber(typeIndex.get(type)),
41599
41475
  0,
41600
41476
  11
41601
41477
  ];
41602
- return [...uleb4(code.length), ...code];
41478
+ return [...encodeWasmNumber(code.length), ...code];
41603
41479
  });
41604
41480
  return Uint8Array.from([
41605
41481
  0,
@@ -41617,21 +41493,21 @@ function sdkImportThunks(bytes) {
41617
41493
  ...sectionBytes(
41618
41494
  2,
41619
41495
  vector([
41620
- [...encodedName2("env"), ...encodedName2("__indirect_function_table"), 1, ...table],
41496
+ [...encodeWasmName("env"), ...encodeWasmName("__indirect_function_table"), 1, ...table],
41621
41497
  [
41622
- ...encodedName2(NATIVE_LAZY_IMPORT_MODULE),
41623
- ...encodedName2(NATIVE_LAZY_SLOT_IMPORT),
41498
+ ...encodeWasmName(NATIVE_LAZY_IMPORT_MODULE),
41499
+ ...encodeWasmName(NATIVE_LAZY_SLOT_IMPORT),
41624
41500
  0,
41625
41501
  0
41626
41502
  ],
41627
41503
  ...slotGlobals
41628
41504
  ])
41629
41505
  ),
41630
- ...sectionBytes(3, vector(imports2.map(({ type }) => uleb4(typeIndex.get(type))))),
41506
+ ...sectionBytes(3, vector(imports2.map(({ type }) => encodeWasmNumber(typeIndex.get(type))))),
41631
41507
  ...sectionBytes(
41632
41508
  7,
41633
41509
  vector(
41634
- imports2.map(({ slot }, i) => [...encodedName2(String(slot)), 0, ...uleb4(i + 1)])
41510
+ imports2.map(({ slot }, i) => [...encodeWasmName(String(slot)), 0, ...encodeWasmNumber(i + 1)])
41635
41511
  )
41636
41512
  ),
41637
41513
  ...sectionBytes(10, vector(bodies))
@@ -41751,7 +41627,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
41751
41627
  syntheticGlobals.push(type);
41752
41628
  got.set(index, value);
41753
41629
  }
41754
- return [35, ...uleb4(index)];
41630
+ return [35, ...encodeWasmNumber(index)];
41755
41631
  };
41756
41632
  const tlsHelpers = new Map(
41757
41633
  symbols.filter((symbol2) => symbol2.kind === 0 && symbol2.name.startsWith(SDK_TLS_HELPER)).map((symbol2) => [symbol2.name.slice(SDK_TLS_HELPER.length), symbol2.index])
@@ -41803,7 +41679,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
41803
41679
  const code = [16];
41804
41680
  for (let i = 0, rest = helper; i < 5; i++, rest >>>= 7)
41805
41681
  code.push(i < 4 ? rest & 127 | 128 : rest & 127);
41806
- if (addend) code.push(66, ...sleb2(addend), 124);
41682
+ if (addend) code.push(66, ...encodeWasmSigned(addend), 124);
41807
41683
  patchCode(at2, 11, code);
41808
41684
  continue;
41809
41685
  }
@@ -41877,7 +41753,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
41877
41753
  syntheticGlobals.push(valueType);
41878
41754
  scratchGlobals.set(valueType, scratch2);
41879
41755
  }
41880
- const index = uleb4(scratch2);
41756
+ const index = encodeWasmNumber(scratch2);
41881
41757
  patchCode(at - 2, 12, [
41882
41758
  36,
41883
41759
  ...index,
@@ -41893,7 +41769,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
41893
41769
  }
41894
41770
  const encodedNameBuf = (name3) => {
41895
41771
  const raw2 = Buffer.from(name3, "utf8");
41896
- const len = uleb4(raw2.length);
41772
+ const len = encodeWasmNumber(raw2.length);
41897
41773
  const out = Buffer.allocUnsafe(len.length + raw2.length);
41898
41774
  for (let i = 0; i < len.length; i++) out[i] = len[i];
41899
41775
  raw2.copy(out, len.length);
@@ -41938,7 +41814,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
41938
41814
  }
41939
41815
  }
41940
41816
  const globalParts = [
41941
- Buffer.from(uleb4(globalCount - 1 + syntheticGlobals.length))
41817
+ Buffer.from(encodeWasmNumber(globalCount - 1 + syntheticGlobals.length))
41942
41818
  ];
41943
41819
  for (let index = 0; index < globalCount; index++) {
41944
41820
  const start = gr.at;
@@ -41983,18 +41859,18 @@ function resolveSdkReferences(source, sdk2, forwarders) {
41983
41859
  }
41984
41860
  }
41985
41861
  const exportParts = [
41986
- Buffer.from(uleb4(exportCount + 1 + got.size)),
41862
+ Buffer.from(encodeWasmNumber(exportCount + 1 + got.size)),
41987
41863
  bytes.subarray(originalExportsStart, exportSection.end)
41988
41864
  ];
41989
41865
  for (const [index, value] of got) {
41990
41866
  exportParts.push(
41991
41867
  encodedNameBuf(`${NATIVE_SDK_GLOBAL_PREFIX}${value}.${index}`),
41992
- Buffer.from([3, ...uleb4(index)])
41868
+ Buffer.from([3, ...encodeWasmNumber(index)])
41993
41869
  );
41994
41870
  }
41995
41871
  exportParts.push(encodedNameBuf("__indirect_function_table"), Buffer.from([1, 0]));
41996
41872
  const replaced = /* @__PURE__ */ new Map([
41997
- [2, Buffer.concat([Buffer.from(uleb4(importEntryCount)), ...importParts])],
41873
+ [2, Buffer.concat([Buffer.from(encodeWasmNumber(importEntryCount)), ...importParts])],
41998
41874
  [6, Buffer.concat(globalParts)],
41999
41875
  [7, Buffer.concat(exportParts)]
42000
41876
  ]);
@@ -42011,7 +41887,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
42011
41887
  if (s.id === 10 && rebuiltCode) {
42012
41888
  parts.push(rebuiltCode);
42013
41889
  } else if (payload) {
42014
- parts.push(Buffer.from([s.id, ...uleb4(payload.length)]), payload);
41890
+ parts.push(Buffer.from([s.id, ...encodeWasmNumber(payload.length)]), payload);
42015
41891
  } else {
42016
41892
  parts.push(bytes.subarray(s.offset, s.end));
42017
41893
  }
@@ -42027,7 +41903,7 @@ function expandSdkRelocations(bytes, section2, patches) {
42027
41903
  patches.sort((a, b) => a.at - b.at);
42028
41904
  const r = wasmReader(bytes, section2.start);
42029
41905
  const count = r.u();
42030
- const payload = [Uint8Array.from(uleb4(count))];
41906
+ const payload = [Uint8Array.from(encodeWasmNumber(count))];
42031
41907
  let next = 0;
42032
41908
  for (let i = 0; i < count; i++) {
42033
41909
  const start = r.at;
@@ -42047,7 +41923,7 @@ function expandSdkRelocations(bytes, section2, patches) {
42047
41923
  }
42048
41924
  parts.push(bytes.subarray(at, end));
42049
41925
  payload.push(
42050
- Uint8Array.from(uleb4(parts.reduce((size3, part) => size3 + part.length, 0))),
41926
+ Uint8Array.from(encodeWasmNumber(parts.reduce((size3, part) => size3 + part.length, 0))),
42051
41927
  ...parts
42052
41928
  );
42053
41929
  }
@@ -42056,7 +41932,7 @@ function expandSdkRelocations(bytes, section2, patches) {
42056
41932
  if (next !== patches.length || r.at !== section2.end)
42057
41933
  throw new Error("Swift SDK code relocations exceed the code section");
42058
41934
  return Buffer.concat([
42059
- Uint8Array.from([10, ...uleb4(payload.reduce((size2, part) => size2 + part.length, 0))]),
41935
+ Uint8Array.from([10, ...encodeWasmNumber(payload.reduce((size2, part) => size2 + part.length, 0))]),
42060
41936
  ...payload
42061
41937
  ]);
42062
41938
  }
@@ -42168,8 +42044,8 @@ function createSwiftSdkBinding(linkage, sdk2, usage, projection) {
42168
42044
  const binding = bindSwiftAppModule(linkage, sdk2);
42169
42045
  const { data, liveSlots } = selectSwiftSdkData(sdk2, usage, linkage, projection);
42170
42046
  const bytes = Buffer.concat([binding, data]);
42171
- const sha2565 = typeof Bun !== "undefined" ? new Bun.CryptoHasher("sha256").update(bytes).digest("hex") : (0, import_node_crypto40.createHash)("sha256").update(bytes).digest("hex");
42172
- return { bytes, sha256: sha2565, liveSlots };
42047
+ const sha2564 = typeof Bun !== "undefined" ? new Bun.CryptoHasher("sha256").update(bytes).digest("hex") : (0, import_node_crypto40.createHash)("sha256").update(bytes).digest("hex");
42048
+ return { bytes, sha256: sha2564, liveSlots };
42173
42049
  }
42174
42050
  function readSwiftSdkUsage(mapFile, linkedFile, sdkObjects) {
42175
42051
  const map2 = readWasmLinkMap(mapFile, false);
@@ -42748,7 +42624,7 @@ function partitionParent(section2) {
42748
42624
  "__objc_class_refs"
42749
42625
  ].find((name3) => section2 === name3 || section2.startsWith(`${name3}.`));
42750
42626
  }
42751
- var import_node_child_process35, import_node_crypto40, import_node_fs61, import_node_path59, import_node_util11, import_node_zlib4, run5, RELOCATION_WIDTHS, GLOBAL_INDEX, TLS_SLEB64, SDK_TLS_HELPER, SDK_TLS_DELTA, OBJC_SECTION_BOUNDARY, uleb4, sleb2, encodedName2, SCANNED, RUN_GAP;
42627
+ var import_node_child_process35, import_node_crypto40, import_node_fs61, import_node_path59, import_node_util11, import_node_zlib4, run5, RELOCATION_WIDTHS, GLOBAL_INDEX, TLS_SLEB64, SDK_TLS_HELPER, SDK_TLS_DELTA, OBJC_SECTION_BOUNDARY, SCANNED, RUN_GAP;
42752
42628
  var init_swift_sdk_app_module = __esm({
42753
42629
  "src/swift-sdk-app-module.ts"() {
42754
42630
  "use strict";
@@ -42771,6 +42647,7 @@ var init_swift_sdk_app_module = __esm({
42771
42647
  init_swift_wasm_prune();
42772
42648
  init_swiftSdkLinkContract();
42773
42649
  init_swiftTargetContract();
42650
+ init_wasm_binary_sections();
42774
42651
  init_wasm_narrow_boundary();
42775
42652
  init_wasm_optimize();
42776
42653
  run5 = (0, import_node_util11.promisify)(import_node_child_process35.execFile);
@@ -42791,32 +42668,6 @@ var init_swift_sdk_app_module = __esm({
42791
42668
  SDK_TLS_HELPER = "__peach_sdk_tls.";
42792
42669
  SDK_TLS_DELTA = "__peach_sdk_tls_delta.";
42793
42670
  OBJC_SECTION_BOUNDARY = /^__(?:start|stop)_(__objc_(?:selectors|classes|class_refs|cats|protocols|protocol_refs|class_aliases|constant_string))$/;
42794
- uleb4 = (value) => {
42795
- const out = [];
42796
- do {
42797
- let byte = value % 128;
42798
- value = Math.floor(value / 128);
42799
- if (value) byte |= 128;
42800
- out.push(byte);
42801
- } while (value);
42802
- return out;
42803
- };
42804
- sleb2 = (value) => {
42805
- const out = [];
42806
- for (; ; ) {
42807
- const byte = Number(value & 127n);
42808
- value >>= 7n;
42809
- if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
42810
- out.push(byte);
42811
- return out;
42812
- }
42813
- out.push(byte | 128);
42814
- }
42815
- };
42816
- encodedName2 = (name3) => {
42817
- const bytes = [...Buffer.from(name3)];
42818
- return [...uleb4(bytes.length), ...bytes];
42819
- };
42820
42671
  SCANNED = /* @__PURE__ */ new Set([
42821
42672
  "swift5_protocols",
42822
42673
  "swift5_protocol_conformances",
@@ -43907,36 +43758,22 @@ function archiveMember(archive, name3) {
43907
43758
  throw new Error(`swift-icu: ${name3} is not in the sdk's icu archive`);
43908
43759
  }
43909
43760
  function icuSegment(object8) {
43910
- let at = 8;
43911
- const leb2 = () => {
43912
- let result = 0;
43913
- let shift = 0;
43914
- let byte;
43915
- do {
43916
- byte = object8[at++];
43917
- result += (byte & 127) * 2 ** shift;
43918
- shift += 7;
43919
- } while (byte & 128);
43920
- return result;
43921
- };
43922
43761
  const found = [];
43923
- while (at < object8.length) {
43924
- const id = object8[at++];
43925
- const size2 = leb2();
43926
- const end = at + size2;
43927
- if (id === 11) {
43928
- for (let count = leb2(); count > 0; count--) {
43929
- if (leb2() !== 0) throw new Error("swift-icu: unexpected data segment kind");
43930
- at++;
43931
- leb2();
43932
- at++;
43933
- const length = leb2();
43934
- const bytes = object8.subarray(at, at + length);
43935
- if (bytes[2] === 218 && bytes[3] === 39) found.push(bytes);
43936
- at += length;
43937
- }
43762
+ for (const section2 of wasmSections(object8)) {
43763
+ if (section2.id !== 11) continue;
43764
+ const reader = readWasmSection(object8, section2.start, section2.end);
43765
+ for (let count = reader.number(); count > 0; count--) {
43766
+ if (reader.number() !== 0)
43767
+ throw new Error("swift-icu: unexpected data segment kind");
43768
+ reader.byte();
43769
+ reader.number();
43770
+ reader.byte();
43771
+ const length = reader.number();
43772
+ const start = reader.position();
43773
+ const bytes = object8.subarray(start, start + length);
43774
+ if (bytes[2] === 218 && bytes[3] === 39) found.push(bytes);
43775
+ reader.skip(length);
43938
43776
  }
43939
- at = end;
43940
43777
  }
43941
43778
  if (found.length !== 1)
43942
43779
  throw new Error(`swift-icu: expected one icu data segment, found ${found.length}`);
@@ -43990,6 +43827,7 @@ var init_swift_icu = __esm({
43990
43827
  init_icuData();
43991
43828
  init_swift_toolchain();
43992
43829
  init_swiftTargetContract();
43830
+ init_wasm_binary_sections();
43993
43831
  run6 = (0, import_node_util12.promisify)(import_node_child_process37.execFile);
43994
43832
  deflate = (0, import_node_util12.promisify)(import_node_zlib5.gzip);
43995
43833
  compressBrotli = (0, import_node_util12.promisify)(import_node_zlib5.brotliCompress);
@@ -50695,7 +50533,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
50695
50533
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
50696
50534
  MULTI_MANIFEST_VERSION = 76;
50697
50535
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
50698
- compilerSourceDigest = true ? "1803ba36803a88ceeca92ee7b13baa39dde72fbb72df14659f0414084afaf5d7" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
50536
+ compilerSourceDigest = true ? "816651f27c8e6bad4746f2f90d840446903e3c4a2384095dcdf1c9ceb69ceba8" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
50699
50537
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
50700
50538
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
50701
50539
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -68939,11 +68777,6 @@ end
68939
68777
  });
68940
68778
 
68941
68779
  // src/bazel-project.ts
68942
- function sha256Hex5(bytes) {
68943
- if (typeof Bun !== "undefined")
68944
- return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
68945
- return (0, import_node_crypto49.createHash)("sha256").update(bytes).digest("hex");
68946
- }
68947
68780
  function isBazelPackage(input) {
68948
68781
  return /^BUILD(?:\.bazel)?$/.test(import_node_path83.default.basename(input)) && import_node_fs82.default.statSync(input).isFile();
68949
68782
  }
@@ -68973,7 +68806,7 @@ function bazelBinary(root) {
68973
68806
  const expected = (0, import_node_child_process44.execFileSync)("curl", ["-fsSL", `${url}.sha256`], {
68974
68807
  encoding: "utf8"
68975
68808
  }).split(/\s/)[0];
68976
- const actual = (0, import_node_crypto49.createHash)("sha256").update(import_node_fs82.default.readFileSync(partial)).digest("hex");
68809
+ const actual = sha256Hex2(import_node_fs82.default.readFileSync(partial));
68977
68810
  if (actual !== expected) {
68978
68811
  import_node_fs82.default.rmSync(partial, { force: true });
68979
68812
  throw new Error(`${url} digest ${actual} differs from its release ${expected}`);
@@ -69698,8 +69531,8 @@ ${published3.map(
69698
69531
  ]
69699
69532
  )
69700
69533
  ]);
69701
- const digest2 = sha256Hex5(
69702
- JSON.stringify([...contents2].map(([file, bytes]) => [file, sha256Hex5(bytes)]))
69534
+ const digest2 = sha256Hex2(
69535
+ JSON.stringify([...contents2].map(([file, bytes]) => [file, sha256Hex2(bytes)]))
69703
69536
  );
69704
69537
  const stamp = import_node_path83.default.join(bundle, ".peach-digest");
69705
69538
  if (!import_node_fs82.default.existsSync(stamp) || import_node_fs82.default.readFileSync(stamp, "utf8") !== digest2) {
@@ -69871,6 +69704,7 @@ var init_bazel_project = __esm({
69871
69704
  import_node_path83 = __toESM(require("node:path"), 1);
69872
69705
  init_is_record();
69873
69706
  init_plist();
69707
+ init_sha256();
69874
69708
  LIBRARY_RULES = /* @__PURE__ */ new Set(["swift_library", "objc_library", "cc_library"]);
69875
69709
  QUERIED_RULES = [
69876
69710
  "swift_library",
@@ -70793,7 +70627,7 @@ var init_provenance = __esm({
70793
70627
  import_node_crypto51 = require("node:crypto");
70794
70628
  import_node_fs84 = require("node:fs");
70795
70629
  import_node_path85 = require("node:path");
70796
- swiftCoverageProvenance = true ? JSON.parse('{"swift-coverage/indexdump.ts":"0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412","swift-coverage/indexing.ts":"633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272","swift-coverage/types.ts":"bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1","swift-coverage/source.ts":"c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee","swift-coverage/package.ts":"1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b","swift-coverage/xcode.ts":"d6a3228567a46c6d5280895383093889d9b868958a117881061bdd74729a225f","swift-coverage/xcode-assets.ts":"d98d6294b359528f7733b26db6f80f554782354faa235605f9562be4ad98b8a3","swift-coverage/xcode-asset-symbols.ts":"1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671","swift-coverage/xcode-bridging.ts":"33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11","swift-coverage/xcode-packages.ts":"5c83f56357d880243ab485b260d23abd0094583ffa2287dac6e9e7eb18c3673d","swift-coverage/xcode-strings.ts":"facdbeb9de6bb12da4ab4954553edfaadd0e486f1181443138be70c3d8396236","swift-coverage/reader.ts":"da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"523fdfffc0cff95c8df7beeca437622a07d4fd666f0bb22b0ff67d14c42a7b10","swift-package.ts":"05c6cf101fbc944f6684a70db0a9c5aede846b2f0482a6b4a5a0abed737d4658","swift-source-file.ts":"8becce5e73b76a61d9d202c1ecfb39b1238e9bbf0e77841f1c51c98fa9ac7bd3","swift-toolchain.ts":"cc32d16a0a3539e97447f853dd876b6b9240d544f5e0f21852c5a8333968e8a5","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"c72b724fc497e4cf603c355f86eb3c07c929ad299758cffbc6ff88ed241654c6","xcode-project.ts":"d140088a94d032e28788e18bf11499965e0c626255fd904538764ededcf1d751","xcode-target-members.ts":"2379e6d411c5d63fa65ddc24c4e4fc8bfcd001b5be109b694c848fe62908db86","xcode-json-project.ts":"df6d6db28e0c8cfdf1f480e1e32d35f12c9cf1936642d5dda923889fb18a8fd6","openstep-plist.ts":"da11f86885ef1e25979ad989f332195c113c4b7a43f108e8d36646973430b81b"}') : swiftCoverageSourceDigests((0, import_node_path85.join)(__sootsim_import_meta_dirname, ".."));
70630
+ swiftCoverageProvenance = true ? JSON.parse('{"swift-coverage/indexdump.ts":"0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412","swift-coverage/indexing.ts":"839661007eb801f3e3ec055a1f00c0e8b7a3d3be7f4bf1fc389ee6b5c2a290a6","swift-coverage/types.ts":"bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1","swift-coverage/source.ts":"2c235d7947d94c8a9f84b305f5453da8647c5c9f8180a38c59631868685b8723","swift-coverage/package.ts":"0f595bd55bcbd22bb337395f175d2aba23624d60f44d3309a61929629cc9b200","swift-coverage/xcode.ts":"059dd3b47d1ce4fe43acef97277c64b57507399866725a2144289eaa6ef8c1d4","swift-coverage/xcode-assets.ts":"a9314d1de1df0ce639a4402b66f89f8b20537f3fdadf0b7cf7355e6ac5b09f54","swift-coverage/xcode-asset-symbols.ts":"1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671","swift-coverage/xcode-bridging.ts":"b7f31dd9c3c554bd69bff75cc9985a11032a394b405acc4b82be8f140a2a8676","swift-coverage/xcode-packages.ts":"d6b3d7fb1f5e32b4b08727927b794030d2f1285c7e3c41d7e8ab2e244a3d8c36","swift-coverage/xcode-strings.ts":"ef711d2a9039a08eb7d407546018ab22aafb0e883a65fc838bf864f5c5c9f85b","swift-coverage/reader.ts":"2562d668fd959c4ae3d24b765d3281b8d03251e8de65ec62bda305ba79f7d8c3","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"523fdfffc0cff95c8df7beeca437622a07d4fd666f0bb22b0ff67d14c42a7b10","swift-package.ts":"05c6cf101fbc944f6684a70db0a9c5aede846b2f0482a6b4a5a0abed737d4658","swift-source-file.ts":"8becce5e73b76a61d9d202c1ecfb39b1238e9bbf0e77841f1c51c98fa9ac7bd3","swift-toolchain.ts":"cc32d16a0a3539e97447f853dd876b6b9240d544f5e0f21852c5a8333968e8a5","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"c72b724fc497e4cf603c355f86eb3c07c929ad299758cffbc6ff88ed241654c6","xcode-project.ts":"d140088a94d032e28788e18bf11499965e0c626255fd904538764ededcf1d751","xcode-target-members.ts":"2379e6d411c5d63fa65ddc24c4e4fc8bfcd001b5be109b694c848fe62908db86","xcode-json-project.ts":"df6d6db28e0c8cfdf1f480e1e32d35f12c9cf1936642d5dda923889fb18a8fd6","openstep-plist.ts":"da11f86885ef1e25979ad989f332195c113c4b7a43f108e8d36646973430b81b"}') : swiftCoverageSourceDigests((0, import_node_path85.join)(__sootsim_import_meta_dirname, ".."));
70797
70631
  }
70798
70632
  });
70799
70633
 
@@ -71785,12 +71619,12 @@ function catalogDigest(directory2) {
71785
71619
  const path121 = (0, import_node_path87.join)(dir, entry.name);
71786
71620
  if (entry.isDirectory()) walk4(path121);
71787
71621
  else if (entry.isFile() && (0, import_node_fs86.statSync)(path121).size <= 64 * 1024 * 1024)
71788
- hashes.push([(0, import_node_path87.relative)(directory2, path121), sha2562((0, import_node_fs86.readFileSync)(path121))]);
71622
+ hashes.push([(0, import_node_path87.relative)(directory2, path121), sha256Hex2((0, import_node_fs86.readFileSync)(path121))]);
71789
71623
  else throw new Error(`Unsupported asset catalog entry: ${path121}`);
71790
71624
  }
71791
71625
  };
71792
71626
  walk4(directory2);
71793
- return sha2562(JSON.stringify(hashes));
71627
+ return sha256Hex2(JSON.stringify(hashes));
71794
71628
  }
71795
71629
  function symbolSource(plan, root) {
71796
71630
  const key2 = JSON.stringify([root, plan]);
@@ -71887,16 +71721,15 @@ function assetSymbolText(plan, root) {
71887
71721
  if (source.status === "unknown") throw new Error(source.reason);
71888
71722
  return source.text;
71889
71723
  }
71890
- var import_node_crypto52, import_node_fs86, import_node_path87, sha2562, unprovenAssetSettings, assetSymbolSettingKeys, provenOtherAssetFlags, symbolTexts;
71724
+ var import_node_fs86, import_node_path87, unprovenAssetSettings, assetSymbolSettingKeys, provenOtherAssetFlags, symbolTexts;
71891
71725
  var init_xcode_assets = __esm({
71892
71726
  "src/swift-coverage/xcode-assets.ts"() {
71893
71727
  "use strict";
71894
- import_node_crypto52 = require("node:crypto");
71895
71728
  import_node_fs86 = require("node:fs");
71896
71729
  import_node_path87 = require("node:path");
71730
+ init_sha256();
71897
71731
  init_provenance();
71898
71732
  init_xcode_asset_symbols();
71899
- sha2562 = (bytes) => (0, import_node_crypto52.createHash)("sha256").update(bytes).digest("hex");
71900
71733
  unprovenAssetSettings = [
71901
71734
  "ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_FRAMEWORKS",
71902
71735
  "ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_WARNINGS",
@@ -72578,7 +72411,7 @@ function normalizedEnums(input) {
72578
72411
  }
72579
72412
  function localizationIdentifier(field, key2) {
72580
72413
  const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
72581
- const digest2 = (0, import_node_crypto53.createHash)("sha256").update(JSON.stringify([...field, key2])).digest();
72414
+ const digest2 = (0, import_node_crypto52.createHash)("sha256").update(JSON.stringify([...field, key2])).digest();
72582
72415
  return Array.from(
72583
72416
  digest2.subarray(0, 6),
72584
72417
  (byte) => alphabet[byte % alphabet.length]
@@ -72903,12 +72736,12 @@ function writeIntentDefinition(input, prefix) {
72903
72736
  lines.push("</plist>", "");
72904
72737
  return lines.join("\n");
72905
72738
  }
72906
- var import_strict4, import_node_crypto53, typeMetadata, initializeMetadata, widgetArraySizes, defaultReasonMessages;
72739
+ var import_strict4, import_node_crypto52, typeMetadata, initializeMetadata, widgetArraySizes, defaultReasonMessages;
72907
72740
  var init_metadata = __esm({
72908
72741
  "src/intent-definition/metadata.ts"() {
72909
72742
  "use strict";
72910
72743
  import_strict4 = __toESM(require("node:assert/strict"), 1);
72911
- import_node_crypto53 = require("node:crypto");
72744
+ import_node_crypto52 = require("node:crypto");
72912
72745
  init_fields();
72913
72746
  init_hash_input();
72914
72747
  init_siphash();
@@ -73617,7 +73450,7 @@ function preparePortableIntent(definition2, derivedDirectory, prefix, language,
73617
73450
  if (prefix) identifier(prefix);
73618
73451
  if (module2) identifier(module2);
73619
73452
  const source = import_node_fs88.default.readFileSync(definition2);
73620
- const key2 = (0, import_node_crypto54.createHash)("sha256").update(
73453
+ const key2 = (0, import_node_crypto53.createHash)("sha256").update(
73621
73454
  JSON.stringify([intentCompilerRevision, definition2, prefix, language, module2])
73622
73455
  ).update("\0").update(source).digest("hex");
73623
73456
  const cache = import_node_path89.default.join(derivedDirectory, "IntentDefinitions");
@@ -73657,11 +73490,11 @@ function preparePortableIntent(definition2, derivedDirectory, prefix, language,
73657
73490
  import_node_fs88.default.rmSync(stage, { recursive: true, force: true });
73658
73491
  }
73659
73492
  }
73660
- var import_node_crypto54, import_node_fs88, import_node_path89, intentCompilerRevision;
73493
+ var import_node_crypto53, import_node_fs88, import_node_path89, intentCompilerRevision;
73661
73494
  var init_xcode_intents = __esm({
73662
73495
  "src/xcode-intents.ts"() {
73663
73496
  "use strict";
73664
- import_node_crypto54 = require("node:crypto");
73497
+ import_node_crypto53 = require("node:crypto");
73665
73498
  import_node_fs88 = __toESM(require("node:fs"), 1);
73666
73499
  import_node_path89 = __toESM(require("node:path"), 1);
73667
73500
  init_fields();
@@ -74363,7 +74196,7 @@ function loadProject(xcodeproj) {
74363
74196
  if (!projectFile)
74364
74197
  throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
74365
74198
  const source = import_node_fs89.default.readFileSync(projectFile, "utf8");
74366
- const digest2 = (0, import_node_crypto55.createHash)("sha256").update(source).digest("hex");
74199
+ const digest2 = (0, import_node_crypto54.createHash)("sha256").update(source).digest("hex");
74367
74200
  const cached2 = loaded2.get(projectFile);
74368
74201
  if (cached2?.digest === digest2) return cached2.project;
74369
74202
  const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
@@ -74415,7 +74248,7 @@ function xcodeInstallationIdentity() {
74415
74248
  if (!selected) return null;
74416
74249
  const directory2 = import_node_path91.default.extname(selected) === ".app" ? import_node_path91.default.join(selected, "Contents", "Developer") : selected;
74417
74250
  const versionFile = `${directory2}/../version.plist`;
74418
- const version2 = import_node_fs89.default.existsSync(versionFile) ? (0, import_node_crypto55.createHash)("sha256").update(import_node_fs89.default.readFileSync(versionFile)).digest("hex") : null;
74251
+ const version2 = import_node_fs89.default.existsSync(versionFile) ? (0, import_node_crypto54.createHash)("sha256").update(import_node_fs89.default.readFileSync(versionFile)).digest("hex") : null;
74419
74252
  return { directory: directory2, version: version2 };
74420
74253
  }
74421
74254
  function defaultConfiguration(project2) {
@@ -74899,7 +74732,7 @@ function targetMembers(ref, settings, options2, settingKeys, projectInputs) {
74899
74732
  );
74900
74733
  });
74901
74734
  }
74902
- const signature2 = (0, import_node_crypto55.createHash)("sha256").update(
74735
+ const signature2 = (0, import_node_crypto54.createHash)("sha256").update(
74903
74736
  JSON.stringify([phase, [...settingKeys].map((key3) => [key3, settings(key3)])])
74904
74737
  );
74905
74738
  for (const file of inputFiles) {
@@ -75054,7 +74887,7 @@ ${output}`
75054
74887
  const inputs2 = JSON.stringify([
75055
74888
  1,
75056
74889
  args,
75057
- (0, import_node_crypto55.createHash)("sha256").update(import_node_fs89.default.readFileSync(file)).digest("hex")
74890
+ (0, import_node_crypto54.createHash)("sha256").update(import_node_fs89.default.readFileSync(file)).digest("hex")
75058
74891
  ]);
75059
74892
  const developer = settings("DEVELOPER_DIR");
75060
74893
  const cached2 = import_node_fs89.default.existsSync(output) && import_node_fs89.default.existsSync(stamp) ? import_node_fs89.default.readFileSync(stamp, "utf8").split("\n") : [];
@@ -76564,12 +76397,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
76564
76397
  cocoapods
76565
76398
  };
76566
76399
  }
76567
- var import_node_child_process45, import_node_crypto55, import_node_fs89, import_node_module8, import_node_path91, XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET, runScriptTimeoutMs, CXX_STANDARD_ALIASES, PRE_CXX20_STANDARDS, APPLICATION, APP_EXTENSION, RESOURCE_BUNDLE, PRODUCT_MACH_O_TYPES, FRAMEWORK_PRODUCTS, HEADER_FILE, MODULE_PRODUCTS, CONDITIONS, isDirectory3, loaded2, developerDir, preparedSourcePhases, isPodsProject, targetRefs, NativeAppTargetSelectionError, workspaceResolvedFile, SwiftPackageResolutionRequired;
76400
+ var import_node_child_process45, import_node_crypto54, import_node_fs89, import_node_module8, import_node_path91, XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET, runScriptTimeoutMs, CXX_STANDARD_ALIASES, PRE_CXX20_STANDARDS, APPLICATION, APP_EXTENSION, RESOURCE_BUNDLE, PRODUCT_MACH_O_TYPES, FRAMEWORK_PRODUCTS, HEADER_FILE, MODULE_PRODUCTS, CONDITIONS, isDirectory3, loaded2, developerDir, preparedSourcePhases, isPodsProject, targetRefs, NativeAppTargetSelectionError, workspaceResolvedFile, SwiftPackageResolutionRequired;
76568
76401
  var init_xcode_project = __esm({
76569
76402
  "src/xcode-project.ts"() {
76570
76403
  "use strict";
76571
76404
  import_node_child_process45 = require("node:child_process");
76572
- import_node_crypto55 = require("node:crypto");
76405
+ import_node_crypto54 = require("node:crypto");
76573
76406
  import_node_fs89 = __toESM(require("node:fs"), 1);
76574
76407
  import_node_module8 = require("node:module");
76575
76408
  import_node_path91 = __toESM(require("node:path"), 1);
@@ -76778,8 +76611,8 @@ async function walkWorkspaceInputs(app, everyByte, sourceOnly, podsEnvironment)
76778
76611
  );
76779
76612
  const appRelative = import_node_path92.default.relative(root, app);
76780
76613
  const manifest = JSON.parse(import_node_fs90.default.readFileSync(import_node_path92.default.join(root, "package.json"), "utf8"));
76781
- const hash = (0, import_node_crypto56.createHash)("sha256");
76782
- const native = (0, import_node_crypto56.createHash)("sha256");
76614
+ const hash = (0, import_node_crypto55.createHash)("sha256");
76615
+ const native = (0, import_node_crypto55.createHash)("sha256");
76783
76616
  const nativeDirectories = localPackageDirectories(root, app);
76784
76617
  const versionFree = new Set(
76785
76618
  nativeDirectories.filter((directory2) => directory2 !== appRelative && directory2 !== "").filter(
@@ -76863,7 +76696,7 @@ async function walkWorkspaceInputs(app, everyByte, sourceOnly, podsEnvironment)
76863
76696
  unread.slice(start, start + 32).map(async ({ file, content }) => {
76864
76697
  const bytes = await import_node_fs90.default.promises.readFile(file);
76865
76698
  content.size = bytes.length;
76866
- content.digest = (0, import_node_crypto56.createHash)("sha256").update(bytes).digest("hex");
76699
+ content.digest = (0, import_node_crypto55.createHash)("sha256").update(bytes).digest("hex");
76867
76700
  fileDigests.set(file, content);
76868
76701
  })
76869
76702
  );
@@ -77416,10 +77249,10 @@ function stageCachedQuickCryptoOpenSsl(app) {
77416
77249
  const opensslDir = import_node_path92.default.join(packageDir, "ios", "openssl");
77417
77250
  if (import_node_fs90.default.existsSync(import_node_path92.default.join(opensslDir, "quickcrypto_openssl_prefix.h"))) return;
77418
77251
  const podspec = import_node_fs90.default.readFileSync(import_node_path92.default.join(packageDir, "QuickCrypto.podspec"), "utf8");
77419
- const sha2565 = /openssl_sha256\s*=\s*"([0-9a-f]{64})"/.exec(podspec)?.[1];
77420
- if (!sha2565) return;
77421
- const archive = import_node_path92.default.join(cacheDir(), "pod-archives", `${sha2565}.zip`);
77422
- if (!import_node_fs90.default.existsSync(archive) || (0, import_node_crypto56.createHash)("sha256").update(import_node_fs90.default.readFileSync(archive)).digest("hex") !== sha2565)
77252
+ const sha2564 = /openssl_sha256\s*=\s*"([0-9a-f]{64})"/.exec(podspec)?.[1];
77253
+ if (!sha2564) return;
77254
+ const archive = import_node_path92.default.join(cacheDir(), "pod-archives", `${sha2564}.zip`);
77255
+ if (!import_node_fs90.default.existsSync(archive) || (0, import_node_crypto55.createHash)("sha256").update(import_node_fs90.default.readFileSync(archive)).digest("hex") !== sha2564)
77423
77256
  return;
77424
77257
  import_node_fs90.default.rmSync(opensslDir, { recursive: true, force: true });
77425
77258
  import_node_fs90.default.mkdirSync(opensslDir, { recursive: true });
@@ -77457,12 +77290,12 @@ ${failedOutputLine(command, cwd, bytes)}`
77457
77290
  });
77458
77291
  });
77459
77292
  }
77460
- var import_node_child_process46, import_node_crypto56, import_node_fs90, import_node_module9, import_node_os20, import_node_path92, import_node_util13, isolatedGitEnv, EXACT_VERSION, NATIVE_CONFIG_FILE, NATIVE_SOURCE_FILE2, fileDigests, NATIVE_PACKAGE_ENTRY, hashing, KEPT_WORKSPACES, WORKSPACE_GRACE_MS, ABANDONED_WORKSPACE_MS, RETIRED_PREFIX2, preparing, watches, current, CLONE_ENTRIES;
77293
+ var import_node_child_process46, import_node_crypto55, import_node_fs90, import_node_module9, import_node_os20, import_node_path92, import_node_util13, isolatedGitEnv, EXACT_VERSION, NATIVE_CONFIG_FILE, NATIVE_SOURCE_FILE2, fileDigests, NATIVE_PACKAGE_ENTRY, hashing, KEPT_WORKSPACES, WORKSPACE_GRACE_MS, ABANDONED_WORKSPACE_MS, RETIRED_PREFIX2, preparing, watches, current, CLONE_ENTRIES;
77461
77294
  var init_expo_native_workspace = __esm({
77462
77295
  "src/expo-native-workspace.ts"() {
77463
77296
  "use strict";
77464
77297
  import_node_child_process46 = require("node:child_process");
77465
- import_node_crypto56 = require("node:crypto");
77298
+ import_node_crypto55 = require("node:crypto");
77466
77299
  import_node_fs90 = __toESM(require("node:fs"), 1);
77467
77300
  import_node_module9 = require("node:module");
77468
77301
  import_node_os20 = __toESM(require("node:os"), 1);
@@ -77536,7 +77369,7 @@ function run() {
77536
77369
 
77537
77370
  // src/expo-discovery-cache.ts
77538
77371
  function peachPin() {
77539
- return (0, import_node_crypto57.createHash)("sha256").update(
77372
+ return (0, import_node_crypto56.createHash)("sha256").update(
77540
77373
  `${FORMAT}\0${expoNativeCompilerDigestValue()}\0${swiftNativePin().distribution.id}\0`
77541
77374
  ).update(JSON.stringify([...EXPO_EAGER_NATIVE_VIEWS])).update(JSON.stringify([...peachAnsweredNativePackages()].sort())).digest("hex");
77542
77375
  }
@@ -77550,7 +77383,7 @@ function stable(value) {
77550
77383
  }
77551
77384
  async function expoDiscoveryKey(options2) {
77552
77385
  const { root, hash } = await hashExpoWorkspace(options2.appRoot, options2.signal);
77553
- const key2 = (0, import_node_crypto57.createHash)("sha256").update(`${peachPin()}\0${hash}\0`).update(`${stable(JSON.parse(options2.searchText))}\0`).update(`${stable(options2.configuration)}\0`).update(stable(JSON.parse(options2.resolveText))).digest("hex");
77386
+ const key2 = (0, import_node_crypto56.createHash)("sha256").update(`${peachPin()}\0${hash}\0`).update(`${stable(JSON.parse(options2.searchText))}\0`).update(`${stable(options2.configuration)}\0`).update(stable(JSON.parse(options2.resolveText))).digest("hex");
77554
77387
  return { key: key2, root };
77555
77388
  }
77556
77389
  function expoDiscoveryCacheDir() {
@@ -77621,7 +77454,7 @@ function readExpoDiscovery(key2) {
77621
77454
  if (typeof parsed2.archive !== "string" || !isDigest(parsed2.archive)) return void 0;
77622
77455
  const archive = import_node_path93.default.join(expoDiscoveryCacheDir(), "blobs", `${parsed2.archive}.zst`);
77623
77456
  const bytes = import_node_fs91.default.readFileSync(archive);
77624
- if ((0, import_node_crypto57.createHash)("sha256").update(bytes).digest("hex") !== parsed2.archive)
77457
+ if ((0, import_node_crypto56.createHash)("sha256").update(bytes).digest("hex") !== parsed2.archive)
77625
77458
  return void 0;
77626
77459
  const bodies = (0, import_node_zlib6.zstdDecompressSync)(bytes);
77627
77460
  const decoded = /* @__PURE__ */ new Map();
@@ -77695,7 +77528,7 @@ function stampedFileHash(file) {
77695
77528
  const stamp = [stat.dev, stat.ino, stat.size, stat.mtimeNs, stat.ctimeNs].join(":");
77696
77529
  const cached2 = fileHashes.get(file);
77697
77530
  if (cached2?.stamp === stamp) return cached2.checksum;
77698
- const checksum = (0, import_node_crypto57.createHash)("sha256").update(import_node_fs91.default.readFileSync(file)).digest("hex");
77531
+ const checksum = (0, import_node_crypto56.createHash)("sha256").update(import_node_fs91.default.readFileSync(file)).digest("hex");
77699
77532
  fileHashes.set(file, { stamp, checksum });
77700
77533
  fileHashesChanged = true;
77701
77534
  return checksum;
@@ -77704,7 +77537,7 @@ function saveFileHashes() {
77704
77537
  if (!fileHashesChanged) return;
77705
77538
  fileHashesChanged = false;
77706
77539
  const target = fileHashesPath();
77707
- const temporary = `${target}.${process.pid}.${(0, import_node_crypto57.randomUUID)()}.tmp`;
77540
+ const temporary = `${target}.${process.pid}.${(0, import_node_crypto56.randomUUID)()}.tmp`;
77708
77541
  try {
77709
77542
  import_node_fs91.default.mkdirSync(import_node_path93.default.dirname(target), { recursive: true });
77710
77543
  import_node_fs91.default.writeFileSync(
@@ -77759,7 +77592,7 @@ function frameworkDigest(directory2, signal) {
77759
77592
  if (target !== root && !target.startsWith(`${root}${import_node_path93.default.sep}`))
77760
77593
  throw new Error(`framework link escapes its tree: ${relative3}`);
77761
77594
  }
77762
- return (0, import_node_crypto57.createHash)("sha256").update(JSON.stringify([...entries2])).digest("hex");
77595
+ return (0, import_node_crypto56.createHash)("sha256").update(JSON.stringify([...entries2])).digest("hex");
77763
77596
  }
77764
77597
  function rewritePreparedPaths(options2) {
77765
77598
  const { units, sourceRoot, preparedRoot, signal } = options2;
@@ -77780,7 +77613,7 @@ function rewritePreparedPaths(options2) {
77780
77613
  return null;
77781
77614
  }
77782
77615
  if (!preparedBytes.equals(sourceBytes)) return null;
77783
- dependencies[sourceFile] = (0, import_node_crypto57.createHash)("sha256").update(sourceBytes).digest("hex");
77616
+ dependencies[sourceFile] = (0, import_node_crypto56.createHash)("sha256").update(sourceBytes).digest("hex");
77784
77617
  verifiedFiles.set(preparedFile, sourceFile);
77785
77618
  return sourceFile;
77786
77619
  };
@@ -77857,7 +77690,7 @@ function rewritePreparedPaths(options2) {
77857
77690
  portableDir = import_node_path93.default.join(parent, import_node_path93.default.basename(dir));
77858
77691
  if (!import_node_fs91.default.existsSync(portableDir)) {
77859
77692
  import_node_fs91.default.mkdirSync(parent, { recursive: true });
77860
- const tmp = import_node_path93.default.join(parent, `.${process.pid}.${(0, import_node_crypto57.randomUUID)()}.tmp`);
77693
+ const tmp = import_node_path93.default.join(parent, `.${process.pid}.${(0, import_node_crypto56.randomUUID)()}.tmp`);
77861
77694
  try {
77862
77695
  import_node_fs91.default.cpSync(dir, tmp, { recursive: true, verbatimSymlinks: true });
77863
77696
  if (frameworkDigest(tmp, signal) !== preparedDigest)
@@ -77886,7 +77719,7 @@ function writeExpoDiscovery(options2) {
77886
77719
  try {
77887
77720
  const dir = expoDiscoveryCacheDir();
77888
77721
  import_node_fs91.default.mkdirSync(dir, { recursive: true });
77889
- const tmp = import_node_path93.default.join(dir, `.${options2.key}.${process.pid}.${(0, import_node_crypto57.randomUUID)()}.tmp`);
77722
+ const tmp = import_node_path93.default.join(dir, `.${options2.key}.${process.pid}.${(0, import_node_crypto56.randomUUID)()}.tmp`);
77890
77723
  if (options2.units === null) {
77891
77724
  import_node_fs91.default.writeFileSync(
77892
77725
  tmp,
@@ -77949,8 +77782,8 @@ function writeExpoDiscovery(options2) {
77949
77782
  }
77950
77783
  );
77951
77784
  const contents2 = (0, import_node_zlib6.zstdCompressSync)(Buffer.concat(chunks, size2));
77952
- const archive = (0, import_node_crypto57.createHash)("sha256").update(contents2).digest("hex");
77953
- const temporary = import_node_path93.default.join(blobDir, "." + (0, import_node_crypto57.randomUUID)() + ".tmp");
77785
+ const archive = (0, import_node_crypto56.createHash)("sha256").update(contents2).digest("hex");
77786
+ const temporary = import_node_path93.default.join(blobDir, "." + (0, import_node_crypto56.randomUUID)() + ".tmp");
77954
77787
  try {
77955
77788
  import_node_fs91.default.writeFileSync(temporary, contents2);
77956
77789
  import_node_fs91.default.renameSync(temporary, import_node_path93.default.join(blobDir, `${archive}.zst`));
@@ -77977,11 +77810,11 @@ function writeExpoDiscovery(options2) {
77977
77810
  return error instanceof Error ? error.message : String(error);
77978
77811
  }
77979
77812
  }
77980
- var import_node_crypto57, import_node_fs91, import_node_path93, import_node_zlib6, FORMAT, EXPIRY_MS, ORPHAN_TEMPORARY_MS, strings2, stringRecord, isDigest, digestRecord, isBodyOffset, isBodyOffsets, sourceLocationLine, fileHashes, fileHashesLoaded, fileHashesChanged, MISSING_TREE;
77813
+ var import_node_crypto56, import_node_fs91, import_node_path93, import_node_zlib6, FORMAT, EXPIRY_MS, ORPHAN_TEMPORARY_MS, strings2, stringRecord, isDigest, digestRecord, isBodyOffset, isBodyOffsets, sourceLocationLine, fileHashes, fileHashesLoaded, fileHashesChanged, MISSING_TREE;
77981
77814
  var init_expo_discovery_cache = __esm({
77982
77815
  "src/expo-discovery-cache.ts"() {
77983
77816
  "use strict";
77984
- import_node_crypto57 = require("node:crypto");
77817
+ import_node_crypto56 = require("node:crypto");
77985
77818
  import_node_fs91 = __toESM(require("node:fs"), 1);
77986
77819
  import_node_path93 = __toESM(require("node:path"), 1);
77987
77820
  import_node_zlib6 = require("node:zlib");
@@ -78451,7 +78284,7 @@ function hashPackageTree(root, options2) {
78451
78284
  }
78452
78285
  };
78453
78286
  walk4(root, "");
78454
- const hash = (0, import_node_crypto58.createHash)("sha256");
78287
+ const hash = (0, import_node_crypto57.createHash)("sha256");
78455
78288
  return (async () => {
78456
78289
  for (let start = 0; start < files2.length; start += READ_AHEAD) {
78457
78290
  const batch = files2.slice(start, start + READ_AHEAD);
@@ -78466,11 +78299,11 @@ function packageTreeDigest(root) {
78466
78299
  compareNames: (left, right) => left.localeCompare(right)
78467
78300
  });
78468
78301
  }
78469
- var import_node_crypto58, import_node_fs94, import_promises9, import_node_path96, READ_AHEAD;
78302
+ var import_node_crypto57, import_node_fs94, import_promises9, import_node_path96, READ_AHEAD;
78470
78303
  var init_package_tree_digest = __esm({
78471
78304
  "src/package-tree-digest.ts"() {
78472
78305
  "use strict";
78473
- import_node_crypto58 = require("node:crypto");
78306
+ import_node_crypto57 = require("node:crypto");
78474
78307
  import_node_fs94 = require("node:fs");
78475
78308
  import_promises9 = require("node:fs/promises");
78476
78309
  import_node_path96 = require("node:path");
@@ -78550,7 +78383,7 @@ async function expoNativeInputs(appRoot) {
78550
78383
  "swift-pin": JSON.stringify(swiftNativePin()),
78551
78384
  answered: JSON.stringify([...peachAnsweredNativePackages()].sort()),
78552
78385
  "pods-environment": JSON.stringify(reactNativePodsEnvironment()),
78553
- fingerprint: (0, import_node_crypto59.createHash)("sha256").update(lines.sort().join("\n")).digest("hex")
78386
+ fingerprint: (0, import_node_crypto58.createHash)("sha256").update(lines.sort().join("\n")).digest("hex")
78554
78387
  },
78555
78388
  packages
78556
78389
  };
@@ -78656,7 +78489,7 @@ async function prebuiltAppTarget(appRoot, signal, dependencies = "lockfile") {
78656
78489
  }
78657
78490
  function servedExpoSwift(appRoot, entry, app) {
78658
78491
  if (!entry.expoSwift) return null;
78659
- const rootId = `${(0, import_node_crypto59.createHash)("sha256").update(import_node_fs95.default.realpathSync(appRoot)).digest("hex")}/Expo`;
78492
+ const rootId = `${(0, import_node_crypto58.createHash)("sha256").update(import_node_fs95.default.realpathSync(appRoot)).digest("hex")}/Expo`;
78660
78493
  if (app.infoPlist === null) throw new Error("the prebuilt app target has no Info.plist");
78661
78494
  const installed = installedInfoPlist(app.infoPlist, entry.infoPlist);
78662
78495
  const infoPlist2 = Buffer.from(installed).toString("base64");
@@ -78684,11 +78517,11 @@ async function prebuiltExpoSwiftResult(appRoot, entry, signal) {
78684
78517
  await prebuiltAppTarget(appRoot, signal, "installed")
78685
78518
  );
78686
78519
  }
78687
- var import_node_crypto59, import_node_fs95, import_node_module12, import_node_path97, import_node_util14, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published, lookups, answers;
78520
+ var import_node_crypto58, import_node_fs95, import_node_module12, import_node_path97, import_node_util14, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published, lookups, answers;
78688
78521
  var init_expo_native_prebuilt = __esm({
78689
78522
  "src/expo-native-prebuilt.ts"() {
78690
78523
  "use strict";
78691
- import_node_crypto59 = require("node:crypto");
78524
+ import_node_crypto58 = require("node:crypto");
78692
78525
  import_node_fs95 = __toESM(require("node:fs"), 1);
78693
78526
  import_node_module12 = require("node:module");
78694
78527
  import_node_path97 = __toESM(require("node:path"), 1);
@@ -78750,7 +78583,7 @@ function watchNativeInputs(root) {
78750
78583
  (0, import_node_timers.clearTimeout)(expiry);
78751
78584
  for (const watcher of watchers) watcher.close();
78752
78585
  }
78753
- const inputs2 = { expiry, revision: (0, import_node_crypto60.randomUUID)() };
78586
+ const inputs2 = { expiry, revision: (0, import_node_crypto59.randomUUID)() };
78754
78587
  const watch = (directory2, recursive, name3) => {
78755
78588
  const watcher = import_node_fs96.default.watch(
78756
78589
  directory2,
@@ -78791,11 +78624,11 @@ function watchNativeInputs(root) {
78791
78624
  watchedInputs.set(workspace, inputs2);
78792
78625
  return inputs2;
78793
78626
  }
78794
- var import_node_crypto60, import_node_fs96, import_node_path98, import_node_timers, setTimeoutNode, RETENTION_MS, watchedInputs, NativePreparation;
78627
+ var import_node_crypto59, import_node_fs96, import_node_path98, import_node_timers, setTimeoutNode, RETENTION_MS, watchedInputs, NativePreparation;
78795
78628
  var init_native_preparation = __esm({
78796
78629
  "src/native-preparation.ts"() {
78797
78630
  "use strict";
78798
- import_node_crypto60 = require("node:crypto");
78631
+ import_node_crypto59 = require("node:crypto");
78799
78632
  import_node_fs96 = __toESM(require("node:fs"), 1);
78800
78633
  import_node_path98 = __toESM(require("node:path"), 1);
78801
78634
  import_node_timers = require("node:timers");
@@ -78894,7 +78727,7 @@ function nativeStaticLibraryEntry(recipe2, compiler, sdk2, distribution) {
78894
78727
  return { name: recipe2.name, inputs: inputs2, key: nativeEntryKey(inputs2) };
78895
78728
  }
78896
78729
  function nativeStaticLibraryRecipe(bytes) {
78897
- const digest2 = (0, import_node_crypto61.createHash)("sha256").update(bytes).digest("hex");
78730
+ const digest2 = (0, import_node_crypto60.createHash)("sha256").update(bytes).digest("hex");
78898
78731
  return NATIVE_STATIC_LIBRARY_RECIPES.find((item) => item.nativeSha256 === digest2);
78899
78732
  }
78900
78733
  function nativeStaticLibrary(file, recipe2, moduleRoot) {
@@ -78937,7 +78770,7 @@ function isRustSymbol(name3, demangled) {
78937
78770
  function rustStaticLibrary(file, moduleRoot) {
78938
78771
  const toolchain = swiftModuleToolchain(moduleRoot);
78939
78772
  const bytes = import_node_fs97.default.readFileSync(file);
78940
- const key2 = (0, import_node_crypto61.createHash)("sha256").update("rust-c-abi-v4\0").update(toolchain.release).update("\0").update(bytes).digest("hex");
78773
+ const key2 = (0, import_node_crypto60.createHash)("sha256").update("rust-c-abi-v4\0").update(toolchain.release).update("\0").update(bytes).digest("hex");
78941
78774
  const directory2 = import_node_path99.default.join(cacheDir(), "native-archives", key2);
78942
78775
  const archive = import_node_path99.default.join(directory2, "library.a");
78943
78776
  if (import_node_fs97.default.existsSync(archive)) return archive;
@@ -78966,7 +78799,7 @@ function rustStaticLibrary(file, moduleRoot) {
78966
78799
  const members2 = readArMembers(bytes, true);
78967
78800
  const seen = /* @__PURE__ */ new Set();
78968
78801
  const unique2 = members2.filter(({ name: name3, bytes: bytes2 }) => {
78969
- const identity2 = name3 + "\0" + (0, import_node_crypto61.createHash)("sha256").update(bytes2).digest("hex");
78802
+ const identity2 = name3 + "\0" + (0, import_node_crypto60.createHash)("sha256").update(bytes2).digest("hex");
78970
78803
  if (seen.has(identity2)) return false;
78971
78804
  seen.add(identity2);
78972
78805
  return true;
@@ -79013,14 +78846,14 @@ function rustStaticLibrary(file, moduleRoot) {
79013
78846
  function combineNativeStaticLibraries(files2, moduleRoot) {
79014
78847
  if (files2.length === 1) return files2[0];
79015
78848
  const toolchain = swiftModuleToolchain(moduleRoot);
79016
- const hash = (0, import_node_crypto61.createHash)("sha256").update(toolchain.release);
78849
+ const hash = (0, import_node_crypto60.createHash)("sha256").update(toolchain.release);
79017
78850
  for (const file of files2)
79018
78851
  hash.update("\0").update(import_node_path99.default.basename(file)).update("\0").update(import_node_fs97.default.readFileSync(file));
79019
78852
  const directory2 = import_node_path99.default.join(cacheDir(), "native-archives", hash.digest("hex"));
79020
78853
  const archive = import_node_path99.default.join(directory2, "combined.a");
79021
78854
  if (import_node_fs97.default.existsSync(archive)) return archive;
79022
78855
  import_node_fs97.default.mkdirSync(directory2, { recursive: true });
79023
- const temporary = import_node_path99.default.join(directory2, `combined-${(0, import_node_crypto61.randomUUID)()}.a`);
78856
+ const temporary = import_node_path99.default.join(directory2, `combined-${(0, import_node_crypto60.randomUUID)()}.a`);
79024
78857
  try {
79025
78858
  (0, import_node_child_process48.execFileSync)(import_node_path99.default.join(toolchain.toolchainBin, "llvm-ar"), [
79026
78859
  "qcsDL",
@@ -79033,12 +78866,12 @@ function combineNativeStaticLibraries(files2, moduleRoot) {
79033
78866
  }
79034
78867
  return archive;
79035
78868
  }
79036
- var import_node_child_process48, import_node_crypto61, import_node_fs97, import_node_path99, WEBRTC_NATIVE_FRAMEWORK, SIGNAL_WEBRTC_NATIVE_FRAMEWORK, WEBRTC_NATIVE_FRAMEWORK_RECIPES, NATIVE_STATIC_LIBRARY_RECIPES;
78869
+ var import_node_child_process48, import_node_crypto60, import_node_fs97, import_node_path99, WEBRTC_NATIVE_FRAMEWORK, SIGNAL_WEBRTC_NATIVE_FRAMEWORK, WEBRTC_NATIVE_FRAMEWORK_RECIPES, NATIVE_STATIC_LIBRARY_RECIPES;
79037
78870
  var init_native_static_libraries = __esm({
79038
78871
  "src/native-static-libraries.ts"() {
79039
78872
  "use strict";
79040
78873
  import_node_child_process48 = require("node:child_process");
79041
- import_node_crypto61 = require("node:crypto");
78874
+ import_node_crypto60 = require("node:crypto");
79042
78875
  import_node_fs97 = __toESM(require("node:fs"), 1);
79043
78876
  import_node_path99 = __toESM(require("node:path"), 1);
79044
78877
  init_home_paths();
@@ -79650,13 +79483,13 @@ var init_swift_wasm64_wamr = __esm({
79650
79483
 
79651
79484
  // src/swift-wasm64-native-source.ts
79652
79485
  function deriveSource(file, bytes, backport) {
79653
- if (!backport || (0, import_node_crypto62.createHash)("sha256").update(bytes).digest("hex") !== backport.originalSha256)
79486
+ if (!backport || (0, import_node_crypto61.createHash)("sha256").update(bytes).digest("hex") !== backport.originalSha256)
79654
79487
  return null;
79655
79488
  const source = bytes.toString("utf8");
79656
79489
  const derived = Buffer.from(
79657
79490
  "rewrite" in backport ? backport.rewrite(source) : source.replace(backport.before, backport.after)
79658
79491
  );
79659
- if ((0, import_node_crypto62.createHash)("sha256").update(derived).digest("hex") !== backport.derivedSha256)
79492
+ if ((0, import_node_crypto61.createHash)("sha256").update(derived).digest("hex") !== backport.derivedSha256)
79660
79493
  throw new Error(`Native source derivation differs: ${file}`);
79661
79494
  return {
79662
79495
  bytes: derived,
@@ -79675,11 +79508,11 @@ function deriveWasm64NativeSource(file, bytes) {
79675
79508
  sourceDerivations.get(name3) ?? headerDerivations.get(name3)
79676
79509
  );
79677
79510
  }
79678
- var import_node_crypto62, import_node_path101, webrtcUnknownArchitecture, boringsslWordSize2, wamrCommit, headerDerivations, sourceDerivations;
79511
+ var import_node_crypto61, import_node_path101, webrtcUnknownArchitecture, boringsslWordSize2, wamrCommit, headerDerivations, sourceDerivations;
79679
79512
  var init_swift_wasm64_native_source = __esm({
79680
79513
  "src/swift-wasm64-native-source.ts"() {
79681
79514
  "use strict";
79682
- import_node_crypto62 = require("node:crypto");
79515
+ import_node_crypto61 = require("node:crypto");
79683
79516
  import_node_path101 = __toESM(require("node:path"), 1);
79684
79517
  init_swift_wasm64_wamr();
79685
79518
  init_swiftWasm64ConfigContract();
@@ -80139,7 +79972,7 @@ var init_genrule_library_builds = __esm({
80139
79972
  function nativeFrameworkCompiler(moduleRoot, toolchainBin, directory2) {
80140
79973
  const distribution = swiftDistributionAt(moduleRoot);
80141
79974
  const sdk2 = swiftSdkPaths(moduleRoot, toolchainBin);
80142
- const identity2 = (0, import_node_crypto63.createHash)("sha256").update(
79975
+ const identity2 = (0, import_node_crypto62.createHash)("sha256").update(
80143
79976
  JSON.stringify([
80144
79977
  distribution?.id,
80145
79978
  distribution?.link,
@@ -80165,7 +79998,7 @@ function nativeFrameworkCompiler(moduleRoot, toolchainBin, directory2) {
80165
79998
  for (const alias of product.frameworkAliases) {
80166
79999
  if (alias.wasmSdkId !== distribution.wasmSdkId || alias.wasmSdkChecksum !== distribution.wasmSdkChecksum)
80167
80000
  throw new Error(`framework SDK identity differs for ${alias.name}`);
80168
- if ((0, import_node_crypto63.createHash)("sha256").update(import_node_fs100.default.readFileSync(import_node_path103.default.join(moduleRoot, alias.moduleMap))).digest("hex") !== alias.moduleMapSha256)
80001
+ if ((0, import_node_crypto62.createHash)("sha256").update(import_node_fs100.default.readFileSync(import_node_path103.default.join(moduleRoot, alias.moduleMap))).digest("hex") !== alias.moduleMapSha256)
80169
80002
  throw new Error(`framework module map changed ${alias.moduleMap}`);
80170
80003
  const selected = /* @__PURE__ */ new Set();
80171
80004
  const reach = (name3) => {
@@ -80206,7 +80039,7 @@ function nativeFrameworkCompiler(moduleRoot, toolchainBin, directory2) {
80206
80039
  for (const alias of owner.frameworkAliases) {
80207
80040
  if (frameworkResponses[alias.name])
80208
80041
  throw new Error(`ambiguous declared framework ${alias.name}`);
80209
- if ((0, import_node_crypto63.createHash)("sha256").update(import_node_fs100.default.readFileSync(import_node_path103.default.join(sdkRoot, alias.moduleMap))).digest("hex") !== alias.moduleMapSha256)
80042
+ if ((0, import_node_crypto62.createHash)("sha256").update(import_node_fs100.default.readFileSync(import_node_path103.default.join(sdkRoot, alias.moduleMap))).digest("hex") !== alias.moduleMapSha256)
80210
80043
  throw new Error(`framework module map changed ${alias.moduleMap}`);
80211
80044
  const file = import_node_path103.default.join(root, `${alias.name}.rsp`);
80212
80045
  import_node_fs100.default.writeFileSync(file, aliasArtifacts.map(quote3).join("\n") + "\n");
@@ -80300,11 +80133,11 @@ exec ${shellQuote2(configuration.compiler)} "$@"
80300
80133
  };
80301
80134
  return { cc: compiler("clang"), cxx: compiler("clang++"), identity: identity2 };
80302
80135
  }
80303
- var import_node_crypto63, import_node_fs100, import_node_path103, v7;
80136
+ var import_node_crypto62, import_node_fs100, import_node_path103, v7;
80304
80137
  var init_native_framework_compiler = __esm({
80305
80138
  "src/native-framework-compiler.ts"() {
80306
80139
  "use strict";
80307
- import_node_crypto63 = require("node:crypto");
80140
+ import_node_crypto62 = require("node:crypto");
80308
80141
  import_node_fs100 = __toESM(require("node:fs"), 1);
80309
80142
  import_node_path103 = __toESM(require("node:path"), 1);
80310
80143
  v7 = __toESM(require("peachsim/vendor/valibot"), 1);
@@ -80325,7 +80158,7 @@ function processAlive(pid) {
80325
80158
  }
80326
80159
  function tryAcquireNumberedLock(directory2, detail = "") {
80327
80160
  (0, import_node_fs101.mkdirSync)(directory2, { recursive: true });
80328
- const claim = (0, import_node_path104.join)(directory2, `claim-${process.pid}-${(0, import_node_crypto64.randomUUID)()}`);
80161
+ const claim = (0, import_node_path104.join)(directory2, `claim-${process.pid}-${(0, import_node_crypto63.randomUUID)()}`);
80329
80162
  for (; ; ) {
80330
80163
  const numbers = (0, import_node_fs101.readdirSync)(directory2).filter((name3) => /^\d+$/.test(name3)).map(Number);
80331
80164
  const top = Math.max(-1, ...numbers);
@@ -80364,11 +80197,11 @@ ${detail}` : ""}`);
80364
80197
  };
80365
80198
  }
80366
80199
  }
80367
- var import_node_crypto64, import_node_fs101, import_node_path104, errorCode2;
80200
+ var import_node_crypto63, import_node_fs101, import_node_path104, errorCode2;
80368
80201
  var init_numbered_lock = __esm({
80369
80202
  "src/numbered-lock.ts"() {
80370
80203
  "use strict";
80371
- import_node_crypto64 = require("node:crypto");
80204
+ import_node_crypto63 = require("node:crypto");
80372
80205
  import_node_fs101 = require("node:fs");
80373
80206
  import_node_path104 = require("node:path");
80374
80207
  errorCode2 = (error) => error instanceof Error && "code" in error ? error.code : void 0;
@@ -80395,7 +80228,7 @@ function llvmIdentity(toolchainBin, release) {
80395
80228
  ] : ["clang", "wasm-ld", "llvm-ar", "llvm-nm", "llvm-strip"].map(
80396
80229
  (name3) => swiftFileChecksum(import_node_path105.default.join(toolchainBin, name3))
80397
80230
  );
80398
- const identity2 = (0, import_node_crypto65.createHash)("sha256").update(JSON.stringify(components)).digest("hex");
80231
+ const identity2 = (0, import_node_crypto64.createHash)("sha256").update(JSON.stringify(components)).digest("hex");
80399
80232
  toolIdentities.set(toolchainBin, identity2);
80400
80233
  return identity2;
80401
80234
  }
@@ -80403,7 +80236,7 @@ function cSdkIdentity(sysroot, resourceDir, frameworks) {
80403
80236
  const key2 = JSON.stringify([sysroot, resourceDir, frameworks]);
80404
80237
  const cached2 = sysrootIdentities.get(key2);
80405
80238
  if (cached2) return cached2;
80406
- const hash = (0, import_node_crypto65.createHash)("sha256");
80239
+ const hash = (0, import_node_crypto64.createHash)("sha256");
80407
80240
  const add = (root, relative3) => {
80408
80241
  const file = import_node_path105.default.join(root, relative3);
80409
80242
  const stat = import_node_fs102.default.statSync(file, { throwIfNoEntry: false });
@@ -80438,7 +80271,7 @@ function frameworkProbeIdentity(moduleRoot, toolchainBin) {
80438
80271
  import_node_fs102.default.readFileSync(import_node_path105.default.join(moduleRoot, SWIFT_FRAMEWORK_PRODUCT_FILE), "utf8")
80439
80272
  )
80440
80273
  );
80441
- const hash = (0, import_node_crypto65.createHash)("sha256").update(
80274
+ const hash = (0, import_node_crypto64.createHash)("sha256").update(
80442
80275
  JSON.stringify([
80443
80276
  headers,
80444
80277
  distribution.link,
@@ -80448,7 +80281,7 @@ function frameworkProbeIdentity(moduleRoot, toolchainBin) {
80448
80281
  ])
80449
80282
  );
80450
80283
  const objects = distribution.objects.map((file) => [file, distribution.files[file]]);
80451
- const objectKey = (0, import_node_crypto65.createHash)("sha256").update(JSON.stringify(objects)).digest("hex");
80284
+ const objectKey = (0, import_node_crypto64.createHash)("sha256").update(JSON.stringify(objects)).digest("hex");
80452
80285
  const cache = import_node_path105.default.join(cacheDir4, "framework-symbols-by-object", objectKey);
80453
80286
  if (!import_node_fs102.default.existsSync(cache)) {
80454
80287
  import_node_fs102.default.mkdirSync(import_node_path105.default.dirname(cache), { recursive: true });
@@ -80483,7 +80316,7 @@ function frameworkProbeIdentity(moduleRoot, toolchainBin) {
80483
80316
  const digest2 = import_node_path105.default.join(temporary, "digest");
80484
80317
  import_node_fs102.default.writeFileSync(
80485
80318
  digest2,
80486
- (0, import_node_crypto65.createHash)("sha256").update(symbols.sort().join("\n")).digest("hex")
80319
+ (0, import_node_crypto64.createHash)("sha256").update(symbols.sort().join("\n")).digest("hex")
80487
80320
  );
80488
80321
  import_node_fs102.default.renameSync(digest2, cache);
80489
80322
  } finally {
@@ -80538,7 +80371,7 @@ function buildable(declaration) {
80538
80371
  return builderOf(declaration) !== null && declaration.dependencies.every(buildable);
80539
80372
  }
80540
80373
  function declarationInputs(declaration, builder, toolchain, dependencyKeys) {
80541
- const hash = (0, import_node_crypto65.createHash)("sha256");
80374
+ const hash = (0, import_node_crypto64.createHash)("sha256");
80542
80375
  const files2 = declaration.sources.filter(
80543
80376
  (source) => !source.generator && !source.file.split(import_node_path105.default.sep).includes(".git")
80544
80377
  ).map((source) => import_node_path105.default.relative(declaration.packageDir, source.file));
@@ -80672,12 +80505,12 @@ function genruleArchive(declaration, library, moduleRoot) {
80672
80505
  }
80673
80506
  return combined;
80674
80507
  }
80675
- var import_node_child_process51, import_node_crypto65, import_node_fs102, import_node_os22, import_node_path105, v8, BUILDERS, cacheDir4, toolIdentities, sysrootIdentities, GENRULE_RECIPE, GENRULE_BUNDLE;
80508
+ var import_node_child_process51, import_node_crypto64, import_node_fs102, import_node_os22, import_node_path105, v8, BUILDERS, cacheDir4, toolIdentities, sysrootIdentities, GENRULE_RECIPE, GENRULE_BUNDLE;
80676
80509
  var init_genrule_archives = __esm({
80677
80510
  "src/genrule-archives.ts"() {
80678
80511
  "use strict";
80679
80512
  import_node_child_process51 = require("node:child_process");
80680
- import_node_crypto65 = require("node:crypto");
80513
+ import_node_crypto64 = require("node:crypto");
80681
80514
  import_node_fs102 = __toESM(require("node:fs"), 1);
80682
80515
  import_node_os22 = __toESM(require("node:os"), 1);
80683
80516
  import_node_path105 = __toESM(require("node:path"), 1);
@@ -80785,7 +80618,7 @@ function privateSentrySlice(entry, moduleRoot) {
80785
80618
  function nativeSwiftSlice(standin, moduleRoot, generator, configured, artifact) {
80786
80619
  if (standin.module !== SENTRY_SWIFT_SLICE.name) return standin;
80787
80620
  const native = simulatorNativeLibrary(artifact());
80788
- if (!native || (0, import_node_crypto66.createHash)("sha256").update(import_node_fs103.default.readFileSync(native.file)).digest("hex") !== SENTRY_SWIFT_SLICE.nativeSha256)
80621
+ if (!native || (0, import_node_crypto65.createHash)("sha256").update(import_node_fs103.default.readFileSync(native.file)).digest("hex") !== SENTRY_SWIFT_SLICE.nativeSha256)
80789
80622
  return standin;
80790
80623
  if (configured)
80791
80624
  throw new Error(
@@ -80843,12 +80676,12 @@ function nativeSwiftSlice(standin, moduleRoot, generator, configured, artifact)
80843
80676
  }
80844
80677
  };
80845
80678
  }
80846
- var import_node_child_process52, import_node_crypto66, import_node_fs103, import_node_os23, import_node_path106, SENTRY_SWIFT_SLICE;
80679
+ var import_node_child_process52, import_node_crypto65, import_node_fs103, import_node_os23, import_node_path106, SENTRY_SWIFT_SLICE;
80847
80680
  var init_native_swift_slices = __esm({
80848
80681
  "src/native-swift-slices.ts"() {
80849
80682
  "use strict";
80850
80683
  import_node_child_process52 = require("node:child_process");
80851
- import_node_crypto66 = require("node:crypto");
80684
+ import_node_crypto65 = require("node:crypto");
80852
80685
  import_node_fs103 = __toESM(require("node:fs"), 1);
80853
80686
  import_node_os23 = __toESM(require("node:os"), 1);
80854
80687
  import_node_path106 = __toESM(require("node:path"), 1);
@@ -81656,7 +81489,7 @@ function treeDigest2(root) {
81656
81489
  }).join("\n");
81657
81490
  const memo2 = digests.get(`tree\0${root}`);
81658
81491
  if (memo2?.stamp === stamp) return memo2.digest;
81659
- const hash = (0, import_node_crypto67.createHash)("sha256");
81492
+ const hash = (0, import_node_crypto66.createHash)("sha256");
81660
81493
  for (const name3 of names) {
81661
81494
  hash.update(`${name3}\0`);
81662
81495
  hash.update(import_node_fs107.default.readFileSync(import_node_path109.default.join(root, name3)));
@@ -81703,7 +81536,7 @@ function swiftBinaryFramework(binary2) {
81703
81536
  const found3 = locateXcframework(import_node_path109.default.join(dir, "tree"));
81704
81537
  if (found3) return { dir: found3, digest: stored.sha };
81705
81538
  }
81706
- const sha2 = (0, import_node_crypto67.createHash)("sha256").update(import_node_fs107.default.readFileSync(binary2.dir)).digest("hex");
81539
+ const sha2 = (0, import_node_crypto66.createHash)("sha256").update(import_node_fs107.default.readFileSync(binary2.dir)).digest("hex");
81707
81540
  if (sha2 !== stored?.sha || !locateXcframework(import_node_path109.default.join(dir, "tree"))) {
81708
81541
  import_node_fs107.default.rmSync(dir, { recursive: true, force: true });
81709
81542
  import_node_fs107.default.mkdirSync(import_node_path109.default.join(dir, "tree"), { recursive: true });
@@ -81715,7 +81548,7 @@ function swiftBinaryFramework(binary2) {
81715
81548
  return { dir: found2, digest: sha2 };
81716
81549
  }
81717
81550
  if (stored && import_node_fs107.default.existsSync(archive)) {
81718
- const sha2 = (0, import_node_crypto67.createHash)("sha256").update(import_node_fs107.default.readFileSync(archive)).digest("hex");
81551
+ const sha2 = (0, import_node_crypto66.createHash)("sha256").update(import_node_fs107.default.readFileSync(archive)).digest("hex");
81719
81552
  if (sha2 !== expected)
81720
81553
  throw new Error(`archive checksum ${sha2} is not the declared checksum ${expected}`);
81721
81554
  const found2 = locateXcframework(import_node_path109.default.join(dir, "tree"));
@@ -81724,7 +81557,7 @@ function swiftBinaryFramework(binary2) {
81724
81557
  import_node_fs107.default.rmSync(dir, { recursive: true, force: true });
81725
81558
  import_node_fs107.default.mkdirSync(import_node_path109.default.join(dir, "tree"), { recursive: true });
81726
81559
  exec("curl", ["-fsSL", "--retry", "2", "-o", archive, binary2.url]);
81727
- const sha = (0, import_node_crypto67.createHash)("sha256").update(import_node_fs107.default.readFileSync(archive)).digest("hex");
81560
+ const sha = (0, import_node_crypto66.createHash)("sha256").update(import_node_fs107.default.readFileSync(archive)).digest("hex");
81728
81561
  if (sha !== expected) {
81729
81562
  import_node_fs107.default.rmSync(dir, { recursive: true, force: true });
81730
81563
  throw new Error(`archive checksum ${sha} is not the declared checksum ${expected}`);
@@ -81849,7 +81682,7 @@ function binaryHeaderSearchPaths(binary2, root, workspaceRoot2, declaredFramewor
81849
81682
  });
81850
81683
  }
81851
81684
  }
81852
- const declaredDigest = (0, import_node_crypto67.createHash)("sha256");
81685
+ const declaredDigest = (0, import_node_crypto66.createHash)("sha256");
81853
81686
  for (const framework of providedFrameworks)
81854
81687
  declaredDigest.update(`provided/${import_node_path109.default.relative(artifact.dir, framework)}\0`);
81855
81688
  for (const [framework, { declared: names, imports: imports2, sdkHeader }] of declared)
@@ -81919,7 +81752,7 @@ function binaryHeaderSearchPaths(binary2, root, workspaceRoot2, declaredFramewor
81919
81752
  import_node_fs107.default.copyFileSync(surface.modulemap, modulemap);
81920
81753
  }
81921
81754
  }
81922
- const contents2 = (0, import_node_crypto67.createHash)("sha256");
81755
+ const contents2 = (0, import_node_crypto66.createHash)("sha256");
81923
81756
  for (const framework of providedFrameworks.filter((item) => !declared.has(item))) {
81924
81757
  const modulemap = import_node_path109.default.join(
81925
81758
  pending,
@@ -83334,7 +83167,7 @@ function crateSourceRoots(manifest, searchRoot) {
83334
83167
  return roots;
83335
83168
  }
83336
83169
  function crateSourceDigest(manifest, searchRoot) {
83337
- const hash = (0, import_node_crypto67.createHash)("sha256");
83170
+ const hash = (0, import_node_crypto66.createHash)("sha256");
83338
83171
  const walk4 = (dir, root) => {
83339
83172
  for (const entry of import_node_fs107.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
83340
83173
  const full = import_node_path109.default.join(dir, entry.name);
@@ -83781,7 +83614,7 @@ function standinGenerationInputs(binaries, toolchain, configuredBehavior = {}, s
83781
83614
  ...swiftSources.flags,
83782
83615
  ...swiftSources.sources.flatMap((source) => [
83783
83616
  source,
83784
- (0, import_node_crypto67.createHash)("sha256").update(import_node_fs107.default.readFileSync(import_node_path109.default.join(binary2.dir, source))).digest("hex")
83617
+ (0, import_node_crypto66.createHash)("sha256").update(import_node_fs107.default.readFileSync(import_node_path109.default.join(binary2.dir, source))).digest("hex")
83785
83618
  ])
83786
83619
  );
83787
83620
  continue;
@@ -83817,7 +83650,7 @@ function standinGenerationInputs(binaries, toolchain, configuredBehavior = {}, s
83817
83650
  );
83818
83651
  }
83819
83652
  }
83820
- return (0, import_node_crypto67.createHash)("sha256").update(parts.join("\0")).digest("hex");
83653
+ return (0, import_node_crypto66.createHash)("sha256").update(parts.join("\0")).digest("hex");
83821
83654
  }
83822
83655
  function missingArtifactGap(binary2) {
83823
83656
  if (swiftBinaryOnDisk(binary2)) return null;
@@ -83899,7 +83732,7 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
83899
83732
  return NO_IMPORTABLE_SURFACE;
83900
83733
  }
83901
83734
  const configured = new Map(Object.entries(behavior));
83902
- const hash = (0, import_node_crypto67.createHash)("sha256").update(
83735
+ const hash = (0, import_node_crypto66.createHash)("sha256").update(
83903
83736
  standinGenerationInputs([binary2], toolchain, behavior)
83904
83737
  );
83905
83738
  hash.update(digest2);
@@ -84139,7 +83972,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
84139
83972
  );
84140
83973
  if (binary2.moduleSources !== void 0)
84141
83974
  frameworkInputs.push(
84142
- `${binary2.target}\0${(0, import_node_crypto67.createHash)("sha256").update(
83975
+ `${binary2.target}\0${(0, import_node_crypto66.createHash)("sha256").update(
84143
83976
  [iosSdkId(), ...swiftSources.flags, ...swiftSources.sources, ...texts].join(
84144
83977
  "\0"
84145
83978
  )
@@ -84180,7 +84013,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
84180
84013
  import_node_fs107.default.mkdirSync(sourceFrameworks);
84181
84014
  const frameworks = {
84182
84015
  dirs: [...frameworkDirs, sourceFrameworks].sort(),
84183
- digest: (0, import_node_crypto67.createHash)("sha256").update(frameworkInputs.sort().join("\0")).digest("hex"),
84016
+ digest: (0, import_node_crypto66.createHash)("sha256").update(frameworkInputs.sort().join("\0")).digest("hex"),
84184
84017
  surfaces: frameworkSurfaces
84185
84018
  };
84186
84019
  const siblings = new Map(
@@ -84299,12 +84132,12 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
84299
84132
  import_node_fs107.default.rmSync(modules, { recursive: true, force: true });
84300
84133
  }
84301
84134
  }
84302
- var import_node_child_process54, import_node_crypto67, import_node_fs107, import_node_path109, TRIPLE, cacheDir5, key, digests, isBinaryLibraryFile, OBJC_IMPORT, files, OBJC, NO_IMPORTABLE_SURFACE, OBJC_ATTRIBUTE, TYPE_DECLARATION, OPTIONAL_REQUIREMENT, WASM_EH_FLAGS, OBJC_UNREPRESENTABLE, INERT_VALUE, identChar, RUST_TARGET, UNSEARCHED, RUST_TOOLCHAIN, built;
84135
+ var import_node_child_process54, import_node_crypto66, import_node_fs107, import_node_path109, TRIPLE, cacheDir5, key, digests, isBinaryLibraryFile, OBJC_IMPORT, files, OBJC, NO_IMPORTABLE_SURFACE, OBJC_ATTRIBUTE, TYPE_DECLARATION, OPTIONAL_REQUIREMENT, WASM_EH_FLAGS, OBJC_UNREPRESENTABLE, INERT_VALUE, identChar, RUST_TARGET, UNSEARCHED, RUST_TOOLCHAIN, built;
84303
84136
  var init_swift_standins = __esm({
84304
84137
  "src/swift-standins.ts"() {
84305
84138
  "use strict";
84306
84139
  import_node_child_process54 = require("node:child_process");
84307
- import_node_crypto67 = require("node:crypto");
84140
+ import_node_crypto66 = require("node:crypto");
84308
84141
  import_node_fs107 = __toESM(require("node:fs"), 1);
84309
84142
  import_node_path109 = __toESM(require("node:path"), 1);
84310
84143
  init_forked_script_contract();
@@ -84334,7 +84167,7 @@ var init_swift_standins = __esm({
84334
84167
  init_swiftTargetContract();
84335
84168
  TRIPLE = SWIFT_WASM_TRIPLE;
84336
84169
  cacheDir5 = import_node_path109.default.join(cacheDir(), "swift-standins");
84337
- key = (...parts) => (0, import_node_crypto67.createHash)("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
84170
+ key = (...parts) => (0, import_node_crypto66.createHash)("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
84338
84171
  digests = /* @__PURE__ */ new Map();
84339
84172
  isBinaryLibraryFile = (file) => /\.(?:a|dylib|o|tbd)$/i.test(file);
84340
84173
  OBJC_IMPORT = /#\s*(?:import|include)\s*[<"](?:[\w+-]+\/)?([\w+.-]+\.h)[>"]/g;
@@ -84494,11 +84327,6 @@ function compiledFrameworkImports(app, products) {
84494
84327
  }
84495
84328
  return imports2;
84496
84329
  }
84497
- function sha256Hex6(bytes) {
84498
- if (typeof Bun !== "undefined")
84499
- return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
84500
- return (0, import_node_crypto68.createHash)("sha256").update(bytes).digest("hex");
84501
- }
84502
84330
  function regularFileStamp(file) {
84503
84331
  const stat = import_node_fs108.default.lstatSync(file, { bigint: true, throwIfNoEntry: false });
84504
84332
  if (!stat || !stat.isFile()) return null;
@@ -84512,7 +84340,7 @@ function verifyRetainedFile(work, file, hash, stamps) {
84512
84340
  if (typeof expectedStamp === "string" && regularFileStamp(resolved) === expectedStamp)
84513
84341
  return true;
84514
84342
  if (!import_node_fs108.default.existsSync(resolved)) return false;
84515
- return sha256Hex6(readPackageFile(work, resolved, Infinity)) === hash;
84343
+ return sha256Hex2(readPackageFile(work, resolved, Infinity)) === hash;
84516
84344
  }
84517
84345
  function recordRetainedStamps(work, files2) {
84518
84346
  const stamps = {};
@@ -84529,7 +84357,7 @@ function cachedBinaryFileDigest(file) {
84529
84357
  const memory = binaryFileDigests.get(real);
84530
84358
  if (memory?.stamp === stamp) return memory.digest;
84531
84359
  const dir = import_node_path110.default.join(swiftCacheDir(), "swift-binary-digests");
84532
- const record5 = import_node_path110.default.join(dir, `${sha256Hex6(real)}.json`);
84360
+ const record5 = import_node_path110.default.join(dir, `${sha256Hex2(real)}.json`);
84533
84361
  if (import_node_fs108.default.existsSync(record5)) {
84534
84362
  const saved = JSON.parse(import_node_fs108.default.readFileSync(record5, "utf8"));
84535
84363
  if (isRecord(saved) && saved.stamp === stamp && typeof saved.digest === "string") {
@@ -84537,10 +84365,10 @@ function cachedBinaryFileDigest(file) {
84537
84365
  return saved.digest;
84538
84366
  }
84539
84367
  }
84540
- const digest2 = sha256Hex6(import_node_fs108.default.readFileSync(real));
84368
+ const digest2 = sha256Hex2(import_node_fs108.default.readFileSync(real));
84541
84369
  binaryFileDigests.set(real, { stamp, digest: digest2 });
84542
84370
  import_node_fs108.default.mkdirSync(dir, { recursive: true });
84543
- const partial = `${record5}.${process.pid}.${(0, import_node_crypto68.randomUUID)()}`;
84371
+ const partial = `${record5}.${process.pid}.${(0, import_node_crypto67.randomUUID)()}`;
84544
84372
  import_node_fs108.default.writeFileSync(partial, JSON.stringify({ stamp, digest: digest2 }));
84545
84373
  import_node_fs108.default.renameSync(partial, record5);
84546
84374
  return digest2;
@@ -85078,7 +84906,7 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
85078
84906
  const staged = withFrameworkCompanionImports(original);
85079
84907
  if (staged !== original) sources.set(file, Buffer.from(staged));
85080
84908
  }
85081
- const digest2 = sha256Hex6;
84909
+ const digest2 = sha256Hex2;
85082
84910
  const providers = /* @__PURE__ */ new Map();
85083
84911
  for (const target of targets) {
85084
84912
  if (!supplied.has(target.moduleName)) continue;
@@ -85434,7 +85262,7 @@ async function prepareXcodeNativeInputs(app, binaries, moduleRoot, purpose) {
85434
85262
  products
85435
85263
  );
85436
85264
  const checkouts = remoteSwiftCheckouts(app.rootDir);
85437
- const digest2 = sha256Hex6;
85265
+ const digest2 = sha256Hex2;
85438
85266
  const inputs2 = Object.fromEntries(
85439
85267
  [...sources].map(([file, bytes]) => [file, digest2(bytes)])
85440
85268
  );
@@ -85816,16 +85644,17 @@ ${reported.trimEnd() || `Clang exited with status ${result.status}`}`;
85816
85644
  import_node_fs108.default.closeSync(descriptor);
85817
85645
  }
85818
85646
  }
85819
- var import_node_child_process55, import_node_crypto68, import_node_fs108, import_node_path110, SwiftObjCCompilationError, isDirectory4, isSdkInclude, FRAMEWORK_IMPORT, OWN_IMPORT, binaryFileDigests, objcInputSnapshots;
85647
+ var import_node_child_process55, import_node_crypto67, import_node_fs108, import_node_path110, SwiftObjCCompilationError, isDirectory4, isSdkInclude, FRAMEWORK_IMPORT, OWN_IMPORT, binaryFileDigests, objcInputSnapshots;
85820
85648
  var init_swift_objc_compile = __esm({
85821
85649
  "src/swift-objc-compile.ts"() {
85822
85650
  "use strict";
85823
85651
  import_node_child_process55 = require("node:child_process");
85824
- import_node_crypto68 = require("node:crypto");
85652
+ import_node_crypto67 = require("node:crypto");
85825
85653
  import_node_fs108 = __toESM(require("node:fs"), 1);
85826
85654
  import_node_path110 = __toESM(require("node:path"), 1);
85827
85655
  init_mapLimit();
85828
85656
  init_is_record();
85657
+ init_sha256();
85829
85658
  init_swift_objc_import();
85830
85659
  init_swift_objc_runtime();
85831
85660
  init_swift_objc_standin();
@@ -89894,19 +89723,19 @@ function u32(value) {
89894
89723
  }
89895
89724
  function propertyHash(property) {
89896
89725
  const transient = property.kind === "attribute" && property.transient;
89897
- const base = sha2563(
89726
+ const base = sha2562(
89898
89727
  property.name,
89899
89728
  [(property.optional ? 1 : 0) | (transient ? 2 : 0), 0],
89900
89729
  property.modifier ?? ""
89901
89730
  );
89902
89731
  if (property.kind === "attribute")
89903
- return sha2563(
89732
+ return sha2562(
89904
89733
  base,
89905
89734
  u32(property.type),
89906
89735
  property.type === 1e3 && property.flags & EXTERNAL_BINARY ? [1] : [],
89907
89736
  property.flags & PRESERVE_AFTER_DELETION ? [1] : []
89908
89737
  );
89909
- return sha2563(
89738
+ return sha2562(
89910
89739
  base,
89911
89740
  property.destination,
89912
89741
  property.inverse ?? "",
@@ -89921,7 +89750,7 @@ function entityHashes(model) {
89921
89750
  ...item.parent === null ? [] : allProperties(byName2.get(item.parent)),
89922
89751
  ...item.properties
89923
89752
  ];
89924
- const hash = (item) => sha2563(
89753
+ const hash = (item) => sha2562(
89925
89754
  item.name,
89926
89755
  [item.abstract ? 1 : 0],
89927
89756
  item.parent === null ? [] : hash(byName2.get(item.parent)),
@@ -89949,7 +89778,7 @@ function compileCoreDataModel(directory2) {
89949
89778
  files2[`${name3}.momd/${version2}.mom`] = archiveModel(model);
89950
89779
  const entities = entityHashes(model);
89951
89780
  hashes[version2] = Object.fromEntries(entities);
89952
- checksums[version2] = sha2563(...entities.map(([, hash]) => hash)).toString("base64");
89781
+ checksums[version2] = sha2562(...entities.map(([, hash]) => hash)).toString("base64");
89953
89782
  }
89954
89783
  const named = (0, import_node_fs112.existsSync)(import_node_path114.default.join(directory2, ".xccurrentversion")) ? {
89955
89784
  NSManagedObjectModel_CurrentVersionName: import_node_path114.default.basename(
@@ -89972,11 +89801,11 @@ function coreDataModelDirectories(files2) {
89972
89801
  }
89973
89802
  return [...models].sort();
89974
89803
  }
89975
- var import_node_crypto69, import_node_fs112, import_node_path114, attributeTypes, deleteRules, EXTERNAL_BINARY, PRESERVE_AFTER_DELETION, yes, common, uid, NULL, classChains, KeyedArchive, sha2563;
89804
+ var import_node_crypto68, import_node_fs112, import_node_path114, attributeTypes, deleteRules, EXTERNAL_BINARY, PRESERVE_AFTER_DELETION, yes, common, uid, NULL, classChains, KeyedArchive, sha2562;
89976
89805
  var init_core_data_model = __esm({
89977
89806
  "src/core-data-model.ts"() {
89978
89807
  "use strict";
89979
- import_node_crypto69 = require("node:crypto");
89808
+ import_node_crypto68 = require("node:crypto");
89980
89809
  import_node_fs112 = require("node:fs");
89981
89810
  import_node_path114 = __toESM(require("node:path"), 1);
89982
89811
  init_core_data_entity_classes();
@@ -90095,7 +89924,7 @@ var init_core_data_model = __esm({
90095
89924
  });
90096
89925
  }
90097
89926
  };
90098
- sha2563 = (...parts) => (0, import_node_crypto69.createHash)("sha256").update(
89927
+ sha2562 = (...parts) => (0, import_node_crypto68.createHash)("sha256").update(
90099
89928
  Buffer.concat(
90100
89929
  parts.map(
90101
89930
  (part) => Array.isArray(part) ? Buffer.from(part) : Buffer.from(part)
@@ -92287,7 +92116,7 @@ async function buildRiveRuntimeDependencies(checkout, moduleRoot) {
92287
92116
  ];
92288
92117
  const objc = [...swiftObjCRuntimeFlags, "-fobjc-exceptions"];
92289
92118
  const xcode = (0, import_node_child_process57.execFileSync)("xcodebuild", ["-version"], { encoding: "utf8" });
92290
- const key2 = (0, import_node_crypto70.createHash)("sha256").update(
92119
+ const key2 = (0, import_node_crypto69.createHash)("sha256").update(
92291
92120
  JSON.stringify([
92292
92121
  RECIPE,
92293
92122
  (0, import_node_child_process57.execFileSync)("git", ["-C", runtime, "rev-parse", "HEAD"], {
@@ -92498,12 +92327,12 @@ exec ${quote3(import_node_path115.default.join(toolchainBin, "llvm-ar"))} rcs "$
92498
92327
  );
92499
92328
  return directory2;
92500
92329
  }
92501
- var import_node_child_process57, import_node_crypto70, import_node_fs113, import_node_os24, import_node_path115, import_promises11, RECIPE, CONFIG, RUNTIME_LIBRARIES;
92330
+ var import_node_child_process57, import_node_crypto69, import_node_fs113, import_node_os24, import_node_path115, import_promises11, RECIPE, CONFIG, RUNTIME_LIBRARIES;
92502
92331
  var init_rive_runtime_dependencies = __esm({
92503
92332
  "src/rive-runtime-dependencies.ts"() {
92504
92333
  "use strict";
92505
92334
  import_node_child_process57 = require("node:child_process");
92506
- import_node_crypto70 = require("node:crypto");
92335
+ import_node_crypto69 = require("node:crypto");
92507
92336
  import_node_fs113 = __toESM(require("node:fs"), 1);
92508
92337
  import_node_os24 = __toESM(require("node:os"), 1);
92509
92338
  import_node_path115 = __toESM(require("node:path"), 1);
@@ -93360,7 +93189,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
93360
93189
  (binary2) => binary2.publicHeaders === void 0 && binary2.placeholder === void 0 && swiftBinaryOnDisk(binary2) && binaryHeaderSearchPaths(binary2, staged, app.rootDir).headers.length === 1
93361
93190
  ))
93362
93191
  return [...binaries];
93363
- const hash = (0, import_node_crypto71.createHash)("sha256");
93192
+ const hash = (0, import_node_crypto70.createHash)("sha256");
93364
93193
  hash.update(
93365
93194
  JSON.stringify([
93366
93195
  inputs2.targets,
@@ -93569,12 +93398,12 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
93569
93398
  );
93570
93399
  return result;
93571
93400
  }
93572
- var import_node_child_process59, import_node_crypto71, import_node_fs115, import_node_path117, cachedInputs;
93401
+ var import_node_child_process59, import_node_crypto70, import_node_fs115, import_node_path117, cachedInputs;
93573
93402
  var init_swift_cxx_reachable = __esm({
93574
93403
  "src/swift-cxx-reachable.ts"() {
93575
93404
  "use strict";
93576
93405
  import_node_child_process59 = require("node:child_process");
93577
- import_node_crypto71 = require("node:crypto");
93406
+ import_node_crypto70 = require("node:crypto");
93578
93407
  import_node_fs115 = __toESM(require("node:fs"), 1);
93579
93408
  import_node_path117 = __toESM(require("node:path"), 1);
93580
93409
  init_is_record();
@@ -93595,15 +93424,15 @@ function rasterizePdfFiles(inputs2, { imageBytes, imageTotalBytes } = { imageByt
93595
93424
  const pending = /* @__PURE__ */ new Map();
93596
93425
  const renderer = process.platform === "darwin" ? "30774891a9db216d" : "pdfium-1";
93597
93426
  const cache = swiftCacheDir();
93598
- const cached2 = (sha2565) => import_node_path118.default.join(cache, `swift-pdf-png-${renderer}-${sha2565}.png`);
93427
+ const cached2 = (sha2564) => import_node_path118.default.join(cache, `swift-pdf-png-${renderer}-${sha2564}.png`);
93599
93428
  let remainingBytes = imageTotalBytes;
93600
- const record5 = ({ file, sha256: sha2565 }, bytes) => {
93429
+ const record5 = ({ file, sha256: sha2564 }, bytes) => {
93601
93430
  if (bytes.length > imageBytes)
93602
93431
  throw new Error(`swift image ${file} raster exceeds the per-image cap`);
93603
93432
  remainingBytes -= bytes.length;
93604
93433
  if (remainingBytes < 0)
93605
93434
  throw new Error("swift image pack exceeds the compile service caps");
93606
- rendered.set(sha2565, bytes);
93435
+ rendered.set(sha2564, bytes);
93607
93436
  };
93608
93437
  for (const input of inputs2) {
93609
93438
  if (rendered.has(input.sha256) || pending.has(input.sha256)) continue;
@@ -94065,7 +93894,7 @@ function fetchSwiftSdkDataPlan({ url, dataPlan }) {
94065
93894
  if (!response.ok)
94066
93895
  throw new Error(`Swift SDK data plan ${address} answered ${response.status}`);
94067
93896
  const bytes = Buffer.from(await response.arrayBuffer());
94068
- if ((0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex") !== dataPlan)
93897
+ if ((0, import_node_crypto71.createHash)("sha256").update(bytes).digest("hex") !== dataPlan)
94069
93898
  throw new Error(`Swift SDK data plan ${address} failed its digest check`);
94070
93899
  return bytes;
94071
93900
  });
@@ -94170,7 +93999,7 @@ function splitSwiftSdkLaterData(directory2, binding, plan) {
94170
93999
  encode(now),
94171
94000
  encodeNativeSdkLater({
94172
94001
  files: later.map((bytes) => ({
94173
- sha256: (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex"),
94002
+ sha256: (0, import_node_crypto71.createHash)("sha256").update(bytes).digest("hex"),
94174
94003
  byteLength: bytes.length
94175
94004
  })),
94176
94005
  ...needs && {
@@ -94186,11 +94015,11 @@ function splitSwiftSdkLaterData(directory2, binding, plan) {
94186
94015
  later
94187
94016
  };
94188
94017
  }
94189
- var import_node_crypto72, ADDRESS_REACH, sdkPieces, firstAtOrAfter, pieceAt, LATER_GROUP_BYTES, MAX_LATER_GROUPS, publishedPlans;
94018
+ var import_node_crypto71, ADDRESS_REACH, sdkPieces, firstAtOrAfter, pieceAt, LATER_GROUP_BYTES, MAX_LATER_GROUPS, publishedPlans;
94190
94019
  var init_swift_sdk_later_data = __esm({
94191
94020
  "src/swift-sdk-later-data.ts"() {
94192
94021
  "use strict";
94193
- import_node_crypto72 = require("node:crypto");
94022
+ import_node_crypto71 = require("node:crypto");
94194
94023
  init_nativeSdkBindingContract();
94195
94024
  init_nativeWasmContract();
94196
94025
  init_swift_sdk_image();
@@ -94242,7 +94071,7 @@ function nativeSourceDescriptor(packagePath) {
94242
94071
  function swiftArtifactContentDigest(bytes) {
94243
94072
  let digest2 = swiftArtifactDigests.get(bytes);
94244
94073
  if (!digest2) {
94245
- digest2 = (0, import_node_crypto73.createHash)("sha256").update(bytes).digest("hex");
94074
+ digest2 = (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex");
94246
94075
  swiftArtifactDigests.set(bytes, digest2);
94247
94076
  }
94248
94077
  return digest2;
@@ -94370,7 +94199,7 @@ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
94370
94199
  const clang = import_node_path119.default.join(toolchainBin, "clang");
94371
94200
  const empty = (binary2, file) => {
94372
94201
  const source = import_node_path119.default.join(binary2.dir, file);
94373
- const key2 = (0, import_node_crypto73.createHash)("sha256").update(
94202
+ const key2 = (0, import_node_crypto72.createHash)("sha256").update(
94374
94203
  JSON.stringify([
94375
94204
  clang,
94376
94205
  sdk2.sysroot,
@@ -94415,7 +94244,7 @@ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
94415
94244
  return new Set(portable.flat());
94416
94245
  }
94417
94246
  async function swiftPackages(entry, app) {
94418
- const stamp = (file) => import_node_fs117.default.existsSync(file) ? (0, import_node_crypto73.createHash)("sha256").update(import_node_fs117.default.readFileSync(file)).digest("hex") : null;
94247
+ const stamp = (file) => import_node_fs117.default.existsSync(file) ? (0, import_node_crypto72.createHash)("sha256").update(import_node_fs117.default.readFileSync(file)).digest("hex") : null;
94419
94248
  const owners = [...app.frameworks, app].map((target) => ({
94420
94249
  module: target.moduleName,
94421
94250
  products: target.packageProducts ?? []
@@ -95584,18 +95413,18 @@ async function buildSwiftResourceTable(project2, baseUrl, inputs2) {
95584
95413
  const source = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(
95585
95414
  bytes
95586
95415
  );
95587
- const sha2565 = (0, import_node_crypto73.createHash)("sha256").update(bytes).digest("hex");
95416
+ const sha2564 = (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex");
95588
95417
  const bundle = swiftResourceBundleForFile(bundles, key2);
95589
95418
  if (!bundle && inputs2["Package.swift"])
95590
95419
  throw new Error(`metal source ${key2} has no resource target bundle`);
95591
95420
  metalSources[key2] = {
95592
- sha256: sha2565,
95593
- url: `${baseUrl}${RESOURCE_PATH}${sha2565}.metal`,
95421
+ sha256: sha2564,
95422
+ url: `${baseUrl}${RESOURCE_PATH}${sha2564}.metal`,
95594
95423
  bundlePath: bundle?.path ?? "."
95595
95424
  };
95596
95425
  metalUploads[key2] = source;
95597
95426
  watched.push(file);
95598
- registered.set(`${sha2565}.metal`, { bytes, contentType: "text/plain; charset=utf-8" });
95427
+ registered.set(`${sha2564}.metal`, { bytes, contentType: "text/plain; charset=utf-8" });
95599
95428
  }
95600
95429
  const pdfs = /* @__PURE__ */ new Map();
95601
95430
  for (const { file } of found) {
@@ -95607,7 +95436,7 @@ async function buildSwiftResourceTable(project2, baseUrl, inputs2) {
95607
95436
  const bytes = readPackageFile2(project2.packagePath, disk, limits.imageBytes);
95608
95437
  pdfs.set(file, {
95609
95438
  file: disk,
95610
- sha256: (0, import_node_crypto73.createHash)("sha256").update(bytes).digest("hex")
95439
+ sha256: (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex")
95611
95440
  });
95612
95441
  }
95613
95442
  const pdfRasters = rasterizePdfFiles([...pdfs.values()], limits);
@@ -95653,7 +95482,7 @@ async function buildSwiftResourceTable(project2, baseUrl, inputs2) {
95653
95482
  throw new Error("swift image pack exceeds the compile service caps");
95654
95483
  }
95655
95484
  imageBytes += bytes.length;
95656
- const hash = (0, import_node_crypto73.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
95485
+ const hash = (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
95657
95486
  const bundle = table[bundlePath] ?? /* @__PURE__ */ Object.create(null);
95658
95487
  const pixelSize = ext === ".png" ? readPngDimensions(bytes) : null;
95659
95488
  const variant2 = {
@@ -95959,7 +95788,7 @@ function updateSwiftConfigStamp(hash, packagePath) {
95959
95788
  hash.update(JSON.stringify(gates.map((name3) => swiftWasm64PlatformGates[name3])));
95960
95789
  }
95961
95790
  function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
95962
- const hash = (0, import_node_crypto73.createHash)("sha256");
95791
+ const hash = (0, import_node_crypto72.createHash)("sha256");
95963
95792
  hash.update(packagePath);
95964
95793
  updateSwiftConfigStamp(hash, packagePath);
95965
95794
  const libraries = projects().get(packagePath)?.libraries;
@@ -95988,7 +95817,7 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
95988
95817
  return hash.digest("hex").slice(0, 16);
95989
95818
  }
95990
95819
  function sourceContentStamp(packagePath, moduleRootOverride) {
95991
- const hash = (0, import_node_crypto73.createHash)("sha256");
95820
+ const hash = (0, import_node_crypto72.createHash)("sha256");
95992
95821
  hash.update(compilerSourceDigest);
95993
95822
  updateSwiftConfigStamp(hash, packagePath);
95994
95823
  const libraries = projects().get(packagePath)?.libraries;
@@ -96020,7 +95849,7 @@ function moduleStamp(packagePath, moduleRootOverride, hosted) {
96020
95849
  (root) => import_node_fs117.default.existsSync(import_node_path119.default.join(root, "toolchain.json"))
96021
95850
  );
96022
95851
  if (!moduleRoot) return "";
96023
- const hash = (0, import_node_crypto73.createHash)("sha256");
95852
+ const hash = (0, import_node_crypto72.createHash)("sha256");
96024
95853
  hash.update(moduleRoot);
96025
95854
  for (const relative3 of swiftModuleInputFiles(moduleRoot)) {
96026
95855
  hash.update(relative3);
@@ -96030,7 +95859,7 @@ function moduleStamp(packagePath, moduleRootOverride, hosted) {
96030
95859
  }
96031
95860
  function otherInputs(input) {
96032
95861
  const { files: _files, ...rest } = input;
96033
- return (0, import_node_crypto73.createHash)("sha256").update(JSON.stringify(rest)).digest("hex");
95862
+ return (0, import_node_crypto72.createHash)("sha256").update(JSON.stringify(rest)).digest("hex");
96034
95863
  }
96035
95864
  function icuUrl(origin, artifact) {
96036
95865
  return "url" in artifact.icu ? artifact.icu.url : `${origin}${ICU_PATH}${swiftIcuAddress(artifact.icu)}`;
@@ -96045,7 +95874,7 @@ function standinLibraries(binaries, standins, rootDir, toolchain, rustWasm64) {
96045
95874
  for (const standin of standins) {
96046
95875
  if (!standin.prebuilt) continue;
96047
95876
  const bytes = Buffer.from(standin.prebuilt.library, "base64");
96048
- const digest2 = (0, import_node_crypto73.createHash)("sha256").update(bytes).digest("hex");
95877
+ const digest2 = (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex");
96049
95878
  const dir = import_node_path119.default.join(swiftCacheDir(), "native-archives", digest2);
96050
95879
  import_node_fs117.default.mkdirSync(dir, { recursive: true });
96051
95880
  const library = import_node_path119.default.join(dir, `lib${standin.module}.a`);
@@ -96393,7 +96222,7 @@ function swiftBuildRoot(packagePath, moduleRoot) {
96393
96222
  return import_node_path119.default.join(
96394
96223
  swiftCacheDir(),
96395
96224
  "swift-builds",
96396
- (0, import_node_crypto73.createHash)("sha256").update(`${compilerKey}\0${buildKeyPath}`).digest("hex").slice(0, 16)
96225
+ (0, import_node_crypto72.createHash)("sha256").update(`${compilerKey}\0${buildKeyPath}`).digest("hex").slice(0, 16)
96397
96226
  );
96398
96227
  }
96399
96228
  function installedWorkspaceInput(packagePath, entry, moduleRoot) {
@@ -96687,14 +96516,14 @@ async function fetchSwiftDyldTable(moduleUrl, module2, signal) {
96687
96516
  const url = new URL(moduleUrl);
96688
96517
  const table = swiftDyldTableReference(url.pathname, module2);
96689
96518
  if (!table) return {};
96690
- const { sha256: sha2565, byteLength } = table;
96519
+ const { sha256: sha2564, byteLength } = table;
96691
96520
  url.pathname = table.path;
96692
96521
  const response = await fetch(url, { signal });
96693
96522
  if (!response.ok) throw new Error(`swift compile: ${url} answered ${response.status}`);
96694
96523
  const bytes = Buffer.from(await response.arrayBuffer());
96695
- if (bytes.length !== byteLength || (0, import_node_crypto73.createHash)("sha256").update(bytes).digest("hex") !== sha2565)
96524
+ if (bytes.length !== byteLength || (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex") !== sha2564)
96696
96525
  throw new Error(`swift compile: ${url} does not match its module's index`);
96697
- return { dyldTable: { sha256: sha2565, bytes } };
96526
+ return { dyldTable: { sha256: sha2564, bytes } };
96698
96527
  }
96699
96528
  function currentStamp(project2, moduleRoot) {
96700
96529
  return withXcodeLayout(
@@ -96778,10 +96607,10 @@ async function splitSdkBinding(sdk2, splitKey, plan) {
96778
96607
  sdk2.binding.bytes,
96779
96608
  plan
96780
96609
  );
96781
- const digest2 = (0, import_node_crypto73.createHash)("sha256").update(split.binding).digest("hex");
96610
+ const digest2 = (0, import_node_crypto72.createHash)("sha256").update(split.binding).digest("hex");
96782
96611
  sdkBindingFiles.set(digest2, split.binding);
96783
96612
  for (const later of split.later)
96784
- sdkBindingFiles.set((0, import_node_crypto73.createHash)("sha256").update(later).digest("hex"), later);
96613
+ sdkBindingFiles.set((0, import_node_crypto72.createHash)("sha256").update(later).digest("hex"), later);
96785
96614
  sdkSplitBindings.set(key2, digest2);
96786
96615
  }
96787
96616
  function swiftSdkEntryAssets(origin, image, sdkDigest = image.sdk?.sha256) {
@@ -96856,10 +96685,10 @@ async function swiftArtifactAssets(artifact, { sdkUrl, sdkBindingUrl }) {
96856
96685
  const later = decodeNativeSdkBinding(
96857
96686
  bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength)
96858
96687
  ).later;
96859
- for (const { sha256: sha2565 } of later?.files ?? []) {
96860
- const laterBytes = sdkBindingFiles.get(sha2565);
96861
- if (!laterBytes) throw new Error(`swift sdk later data ${sha2565} is not served`);
96862
- assets2.set(`${SDK_BINDING_PATH}${sha2565}.bin`, {
96688
+ for (const { sha256: sha2564 } of later?.files ?? []) {
96689
+ const laterBytes = sdkBindingFiles.get(sha2564);
96690
+ if (!laterBytes) throw new Error(`swift sdk later data ${sha2564} is not served`);
96691
+ assets2.set(`${SDK_BINDING_PATH}${sha2564}.bin`, {
96863
96692
  bytes: laterBytes,
96864
96693
  contentType: "application/octet-stream"
96865
96694
  });
@@ -96871,13 +96700,13 @@ async function swiftArtifactAssets(artifact, { sdkUrl, sdkBindingUrl }) {
96871
96700
  }
96872
96701
  return assets2;
96873
96702
  }
96874
- var import_node_async_hooks3, import_node_child_process61, import_node_crypto73, import_node_fs117, import_node_os26, import_node_path119, 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;
96703
+ var import_node_async_hooks3, import_node_child_process61, import_node_crypto72, import_node_fs117, import_node_os26, import_node_path119, 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;
96875
96704
  var init_swift_host = __esm({
96876
96705
  "src/swift-host.ts"() {
96877
96706
  "use strict";
96878
96707
  import_node_async_hooks3 = require("node:async_hooks");
96879
96708
  import_node_child_process61 = require("node:child_process");
96880
- import_node_crypto73 = require("node:crypto");
96709
+ import_node_crypto72 = require("node:crypto");
96881
96710
  import_node_fs117 = __toESM(require("node:fs"), 1);
96882
96711
  import_node_os26 = __toESM(require("node:os"), 1);
96883
96712
  import_node_path119 = __toESM(require("node:path"), 1);
@@ -97634,7 +97463,7 @@ function hashTree(root) {
97634
97463
  for (const entry of import_node_fs120.default.readdirSync(root, { recursive: true, withFileTypes: true })) {
97635
97464
  if (!entry.isFile()) continue;
97636
97465
  const file = import_node_path122.default.join(entry.parentPath, entry.name);
97637
- hashes[import_node_path122.default.relative(root, file).split(import_node_path122.default.sep).join("/")] = (0, import_node_crypto74.createHash)("sha256").update(import_node_fs120.default.readFileSync(file)).digest("hex");
97466
+ hashes[import_node_path122.default.relative(root, file).split(import_node_path122.default.sep).join("/")] = (0, import_node_crypto73.createHash)("sha256").update(import_node_fs120.default.readFileSync(file)).digest("hex");
97638
97467
  }
97639
97468
  return Object.fromEntries(Object.entries(hashes).sort(([a], [b]) => a < b ? -1 : 1));
97640
97469
  }
@@ -97684,12 +97513,12 @@ async function runInstalledTurboCodegen(appRoot, outDir, signal) {
97684
97513
  files: hashTree(generatedRoot)
97685
97514
  };
97686
97515
  }
97687
- var import_node_child_process62, import_node_crypto74, import_node_fs120, import_node_module15, import_node_path122, import_node_util16, run10, RENDERER_DEPENDENCY_PODS, RENDERER_PODS, RENDERER_PODS_VERSIONED, COMPILED_SOURCE, LEGACY_BRIDGE_DEV_SUPPORT, LEGACY_BRIDGE_PODS, LEGACY_BRIDGE_PODS_VERSIONED;
97516
+ var import_node_child_process62, import_node_crypto73, import_node_fs120, import_node_module15, import_node_path122, import_node_util16, run10, RENDERER_DEPENDENCY_PODS, RENDERER_PODS, RENDERER_PODS_VERSIONED, COMPILED_SOURCE, LEGACY_BRIDGE_DEV_SUPPORT, LEGACY_BRIDGE_PODS, LEGACY_BRIDGE_PODS_VERSIONED;
97688
97517
  var init_turbo_codegen_intake = __esm({
97689
97518
  "src/turbo-codegen-intake.ts"() {
97690
97519
  "use strict";
97691
97520
  import_node_child_process62 = require("node:child_process");
97692
- import_node_crypto74 = require("node:crypto");
97521
+ import_node_crypto73 = require("node:crypto");
97693
97522
  import_node_fs120 = __toESM(require("node:fs"), 1);
97694
97523
  import_node_module15 = require("node:module");
97695
97524
  import_node_path122 = __toESM(require("node:path"), 1);
@@ -98762,7 +98591,7 @@ async function collectTurboSources(options2) {
98762
98591
  );
98763
98592
  const installedHeaders = /* @__PURE__ */ new Map();
98764
98593
  const targetPath = (name3) => `Sources/${name3}`;
98765
- const providerTarget = (name3) => `TurboPackage_${sha2564(name3).slice(0, 16)}`;
98594
+ const providerTarget = (name3) => `TurboPackage_${sha2563(name3).slice(0, 16)}`;
98766
98595
  const folly = readFollyConfig(reactNative.root);
98767
98596
  const baseDefines = [
98768
98597
  options2.configuration === "Debug" ? "DEBUG=1" : "NDEBUG",
@@ -98906,7 +98735,7 @@ async function collectTurboSources(options2) {
98906
98735
  if (!Buffer.from(text7).equals(bytes))
98907
98736
  throw new Error(`TurboModule source is not UTF-8: ${disk}`);
98908
98737
  add(key2, text7);
98909
- result.sources.push({ file: key2, source: disk, sha256: sha2564(bytes) });
98738
+ result.sources.push({ file: key2, source: disk, sha256: sha2563(bytes) });
98910
98739
  pending.push({ key: key2, targetName, label, root, relative: relative3 });
98911
98740
  return key2;
98912
98741
  };
@@ -99719,13 +99548,13 @@ async function collectTurboSources(options2) {
99719
99548
  let decoratorHasPerformanceLogger = false;
99720
99549
  let managerHasDevMenuDecorator = false;
99721
99550
  if (fabric) objc = true;
99722
- for (const { relative: relative3, source, text: text7, sha256: sha2565, configured } of glogSources()) {
99551
+ for (const { relative: relative3, source, text: text7, sha256: sha2564, configured } of glogSources()) {
99723
99552
  const key2 = `${core}/dependencies/glog/${relative3}`;
99724
99553
  add(key2, text7);
99725
99554
  result.sources.push({
99726
99555
  file: key2,
99727
99556
  source,
99728
- sha256: sha2565,
99557
+ sha256: sha2564,
99729
99558
  ...configured && { configured }
99730
99559
  });
99731
99560
  if (relative3.startsWith("src/glog/"))
@@ -102008,11 +101837,11 @@ extern "C" __attribute__((export_name("peach_fabric_component_names"))) const ch
102008
101837
  }
102009
101838
  `;
102010
101839
  }
102011
- var import_node_crypto75, import_node_fs121, import_node_module16, import_node_path123, TURBO_CORE_TARGET, TURBO_FMT_TARGET, TURBO_ENTRY_HEADER, TURBO_CORE_PUBLIC_HEADERS, REGISTRATION, CODEGEN_OBJC, UNIT, HEADER5, OBJC2, OBJC_TURBO, OBJC_BRIDGE, OBJC_REGISTERED, REACT_NATIVE_UNITS, REACT_NATIVE_INCLUDE_ROOTS, REACT_NATIVE_OBJC_UNITS, REACT_NATIVE_OBJC_VERSIONED_UNITS, REACT_NATIVE_HEADER_DIRS, REACT_NATIVE_BARE_HEADER_DIRS, DECLARED_MODULE_NAME, EXPORTED_MODULE, sha2564, podspecList, reactNativePods, reactNativePod, versionParts, iosOf, JS_CALL_INVOKER, FABRIC_SHADOW_HANDLE_HOST, FABRIC_HOST_INCLUDES, FABRIC_HOST_PAPER_INCLUDES, PAPER_UIKIT_BRIDGE_SWIFT;
101840
+ var import_node_crypto74, import_node_fs121, import_node_module16, import_node_path123, TURBO_CORE_TARGET, TURBO_FMT_TARGET, TURBO_ENTRY_HEADER, TURBO_CORE_PUBLIC_HEADERS, REGISTRATION, CODEGEN_OBJC, UNIT, HEADER5, OBJC2, OBJC_TURBO, OBJC_BRIDGE, OBJC_REGISTERED, REACT_NATIVE_UNITS, REACT_NATIVE_INCLUDE_ROOTS, REACT_NATIVE_OBJC_UNITS, REACT_NATIVE_OBJC_VERSIONED_UNITS, REACT_NATIVE_HEADER_DIRS, REACT_NATIVE_BARE_HEADER_DIRS, DECLARED_MODULE_NAME, EXPORTED_MODULE, sha2563, podspecList, reactNativePods, reactNativePod, versionParts, iosOf, JS_CALL_INVOKER, FABRIC_SHADOW_HANDLE_HOST, FABRIC_HOST_INCLUDES, FABRIC_HOST_PAPER_INCLUDES, PAPER_UIKIT_BRIDGE_SWIFT;
102012
101841
  var init_turbo_source = __esm({
102013
101842
  "src/turbo-source.ts"() {
102014
101843
  "use strict";
102015
- import_node_crypto75 = require("node:crypto");
101844
+ import_node_crypto74 = require("node:crypto");
102016
101845
  import_node_fs121 = __toESM(require("node:fs"), 1);
102017
101846
  import_node_module16 = require("node:module");
102018
101847
  import_node_path123 = __toESM(require("node:path"), 1);
@@ -102142,7 +101971,7 @@ var init_turbo_source = __esm({
102142
101971
  ];
102143
101972
  DECLARED_MODULE_NAME = /\bName\(\s*"(\w+)"\s*\)/g;
102144
101973
  EXPORTED_MODULE = /\bRCT_(?:EXPORT_MODULE(?:_NO_LOAD)?|EXTERN_MODULE)\s*\(\s*(\w*)/g;
102145
- sha2564 = (data) => (0, import_node_crypto75.createHash)("sha256").update(data).digest("hex");
101974
+ sha2563 = (data) => (0, import_node_crypto74.createHash)("sha256").update(data).digest("hex");
102146
101975
  podspecList = podspecAttribute;
102147
101976
  reactNativePods = /* @__PURE__ */ new Set([
102148
101977
  "React",
@@ -102977,11 +102806,11 @@ function collectTurboCompileInput(collection, runtime, iosDeploymentTarget, depe
102977
102806
  resources: { ...dependencies?.resources, ...collection.resources }
102978
102807
  };
102979
102808
  }
102980
- var import_node_crypto76, import_node_fs122, import_node_module17, import_node_os27, import_node_path124;
102809
+ var import_node_crypto75, import_node_fs122, import_node_module17, import_node_os27, import_node_path124;
102981
102810
  var init_turbo_compile = __esm({
102982
102811
  "src/turbo-compile.ts"() {
102983
102812
  "use strict";
102984
- import_node_crypto76 = require("node:crypto");
102813
+ import_node_crypto75 = require("node:crypto");
102985
102814
  import_node_fs122 = __toESM(require("node:fs"), 1);
102986
102815
  import_node_module17 = require("node:module");
102987
102816
  import_node_os27 = __toESM(require("node:os"), 1);
@@ -103181,8 +103010,8 @@ function reactNativeCoreEntry(reactNativeRoot, moduleRoot, mode) {
103181
103010
  );
103182
103011
  if (!isRecord(manifest) || typeof manifest.version !== "string")
103183
103012
  throw new Error(`${reactNativeRoot}: react-native has no version`);
103184
- const headers = (0, import_node_crypto77.createHash)("sha256");
103185
- const sources = (0, import_node_crypto77.createHash)("sha256");
103013
+ const headers = (0, import_node_crypto76.createHash)("sha256");
103014
+ const sources = (0, import_node_crypto76.createHash)("sha256");
103186
103015
  const walk4 = (relative3) => {
103187
103016
  for (const file of import_node_fs124.default.readdirSync(import_node_path126.default.join(reactNativeRoot, relative3), { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
103188
103017
  if (file.name === "node_modules" || file.name.startsWith(".")) continue;
@@ -103289,7 +103118,7 @@ function linkReactNativeCore(collection, core, moduleRoot) {
103289
103118
  const file = import_node_path126.default.join(
103290
103119
  cacheDir(),
103291
103120
  "native-archives",
103292
- `${(0, import_node_crypto77.createHash)("sha256").update(data).digest("hex")}.a`
103121
+ `${(0, import_node_crypto76.createHash)("sha256").update(data).digest("hex")}.a`
103293
103122
  );
103294
103123
  import_node_fs124.default.mkdirSync(import_node_path126.default.dirname(file), { recursive: true });
103295
103124
  if (!import_node_fs124.default.existsSync(file)) import_node_fs124.default.writeFileSync(file, Buffer.from(data, "base64"));
@@ -103299,11 +103128,11 @@ function linkReactNativeCore(collection, core, moduleRoot) {
103299
103128
  }
103300
103129
  }
103301
103130
  }
103302
- var import_node_crypto77, import_node_fs124, import_node_module18, import_node_path126, import_node_util17, recipe, strings4, building;
103131
+ var import_node_crypto76, import_node_fs124, import_node_module18, import_node_path126, import_node_util17, recipe, strings4, building;
103303
103132
  var init_react_native_core = __esm({
103304
103133
  "src/react-native-core.ts"() {
103305
103134
  "use strict";
103306
- import_node_crypto77 = require("node:crypto");
103135
+ import_node_crypto76 = require("node:crypto");
103307
103136
  import_node_fs124 = __toESM(require("node:fs"), 1);
103308
103137
  import_node_module18 = require("node:module");
103309
103138
  import_node_path126 = __toESM(require("node:path"), 1);
@@ -103329,7 +103158,7 @@ function exportedNames(moduleRoot, name3) {
103329
103158
  const modules = import_node_path127.default.join(moduleRoot, "modules");
103330
103159
  const module2 = import_node_path127.default.join(modules, `${name3}.swiftmodule`);
103331
103160
  if (!import_node_fs125.default.existsSync(module2)) return /* @__PURE__ */ new Set();
103332
- const key2 = (0, import_node_crypto78.createHash)("sha256").update(import_node_fs125.default.readFileSync(module2)).digest("hex");
103161
+ const key2 = (0, import_node_crypto77.createHash)("sha256").update(import_node_fs125.default.readFileSync(module2)).digest("hex");
103333
103162
  const directory2 = import_node_path127.default.join(swiftCacheDir(), "swift-public-names");
103334
103163
  const receipt = import_node_path127.default.join(directory2, `${key2}.json`);
103335
103164
  if (import_node_fs125.default.existsSync(receipt)) {
@@ -103412,12 +103241,12 @@ function clangTypeOwnership(moduleRoot, module2) {
103412
103241
  }
103413
103242
  );
103414
103243
  }
103415
- var import_node_child_process64, import_node_crypto78, import_node_fs125, import_node_path127, blockTypedef, enumTypedef, enumConstant, swiftPrivate;
103244
+ var import_node_child_process64, import_node_crypto77, import_node_fs125, import_node_path127, blockTypedef, enumTypedef, enumConstant, swiftPrivate;
103416
103245
  var init_swift_clang_type_ownership = __esm({
103417
103246
  "src/swift-clang-type-ownership.ts"() {
103418
103247
  "use strict";
103419
103248
  import_node_child_process64 = require("node:child_process");
103420
- import_node_crypto78 = require("node:crypto");
103249
+ import_node_crypto77 = require("node:crypto");
103421
103250
  import_node_fs125 = __toESM(require("node:fs"), 1);
103422
103251
  import_node_path127 = __toESM(require("node:path"), 1);
103423
103252
  init_is_record();
@@ -105085,7 +104914,7 @@ function targetSettings2(units) {
105085
104914
  }
105086
104915
  function oneSDKStamp(oneSDK) {
105087
104916
  if (!oneSDK) return "";
105088
- const hash = (0, import_node_crypto79.createHash)("sha256");
104917
+ const hash = (0, import_node_crypto78.createHash)("sha256");
105089
104918
  for (const files2 of [oneSDK.targets, oneSDK.entry])
105090
104919
  for (const [name3, source] of [...files2].sort(([a], [b]) => a.localeCompare(b)))
105091
104920
  hash.update(`${name3}\0${source}\0`);
@@ -105136,7 +104965,7 @@ ${bridgeModules.length ? "import React\n" : ""}${oneSDK ? "import One\nimport On
105136
104965
  `;
105137
104966
  }
105138
104967
  function expoSwiftPreparedKey(base, units, reactProviderStamp) {
105139
- const hash = (0, import_node_crypto79.createHash)("sha256");
104968
+ const hash = (0, import_node_crypto78.createHash)("sha256");
105140
104969
  hash.update(base);
105141
104970
  hash.update(reactProviderStamp);
105142
104971
  for (const unit2 of units) {
@@ -105509,8 +105338,8 @@ async function compileExpoSwiftModulesTraced(root, base, publishArtifact, option
105509
105338
  }
105510
105339
  return provider;
105511
105340
  })() : void 0;
105512
- const reactProviderStamp = reactProvider ? (0, import_node_crypto79.createHash)("sha256").update(JSON.stringify(reactProvider)).digest("hex") : "";
105513
- const key2 = (0, import_node_crypto79.createHash)("sha256").update(import_node_fs126.default.realpathSync(root)).digest("hex");
105341
+ const reactProviderStamp = reactProvider ? (0, import_node_crypto78.createHash)("sha256").update(JSON.stringify(reactProvider)).digest("hex") : "";
105342
+ const key2 = (0, import_node_crypto78.createHash)("sha256").update(import_node_fs126.default.realpathSync(root)).digest("hex");
105514
105343
  const unitContentStamp = (unit2) => sourceContentStamp(expoSwiftPackage(key2, unit2.moduleId), module2.root) + (unit2.reactNativeProvider ? `:${reactProviderStamp}` : "");
105515
105344
  const failures = /* @__PURE__ */ new Map();
105516
105345
  const failureRecords = /* @__PURE__ */ new Map();
@@ -105804,7 +105633,7 @@ async function compileExpoSwiftModulesTraced(root, base, publishArtifact, option
105804
105633
  await check2(part[0]);
105805
105634
  continue;
105806
105635
  }
105807
- const name3 = (0, import_node_crypto79.createHash)("sha256").update(part.map((unit2) => unit2.moduleId).join("\0")).digest("hex").slice(0, 16);
105636
+ const name3 = (0, import_node_crypto78.createHash)("sha256").update(part.map((unit2) => unit2.moduleId).join("\0")).digest("hex").slice(0, 16);
105808
105637
  report(`linking ${part.length} namespaces to isolate failures`);
105809
105638
  try {
105810
105639
  const built2 = await link(part, `isolate-${name3}`);
@@ -105877,13 +105706,13 @@ async function compileExpoSwiftModulesTraced(root, base, publishArtifact, option
105877
105706
  throw failure2;
105878
105707
  }
105879
105708
  }
105880
- var import_node_async_hooks4, import_node_child_process65, import_node_crypto79, import_node_fs126, import_node_module19, import_node_os28, import_node_path128, 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;
105709
+ var import_node_async_hooks4, import_node_child_process65, import_node_crypto78, import_node_fs126, import_node_module19, import_node_os28, import_node_path128, 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;
105881
105710
  var init_expo_swift_host = __esm({
105882
105711
  "src/expo-swift-host.ts"() {
105883
105712
  "use strict";
105884
105713
  import_node_async_hooks4 = require("node:async_hooks");
105885
105714
  import_node_child_process65 = require("node:child_process");
105886
- import_node_crypto79 = require("node:crypto");
105715
+ import_node_crypto78 = require("node:crypto");
105887
105716
  import_node_fs126 = __toESM(require("node:fs"), 1);
105888
105717
  import_node_module19 = require("node:module");
105889
105718
  import_node_os28 = __toESM(require("node:os"), 1);
@@ -105939,11 +105768,11 @@ var init_expo_swift_host = __esm({
105939
105768
  });
105940
105769
 
105941
105770
  // src/nitro-compiler-digest.ts
105942
- var import_node_crypto82, import_node_fs129, import_node_path131;
105771
+ var import_node_crypto81, import_node_fs129, import_node_path131;
105943
105772
  var init_nitro_compiler_digest = __esm({
105944
105773
  "src/nitro-compiler-digest.ts"() {
105945
105774
  "use strict";
105946
- import_node_crypto82 = require("node:crypto");
105775
+ import_node_crypto81 = require("node:crypto");
105947
105776
  import_node_fs129 = require("node:fs");
105948
105777
  import_node_path131 = __toESM(require("node:path"), 1);
105949
105778
  init_swift_compiler_digest();
@@ -106081,7 +105910,7 @@ var init_nitro_superset = __esm({
106081
105910
  init_nitroContract();
106082
105911
  init_swift_standin_digest();
106083
105912
  NITRO_SUPERSET_ENTRY_NAME = "superset";
106084
- NITRO_COMPILER_DIGEST = true ? "474b8b30de1650e72f19b75c50a0db7090ddaffdf79752b283fb389946014fa7" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
105913
+ NITRO_COMPILER_DIGEST = true ? "379ef4bc3caf96c52a4ffe7df50670f16d8db945bfbc90e1513bff35258d8b6f" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
106085
105914
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
106086
105915
  nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
106087
105916
  published2 = /* @__PURE__ */ new Map();
@@ -106142,7 +105971,7 @@ async function selectCompiledNitroProviders(appRoot, answered = peachAnsweredNat
106142
105971
  }
106143
105972
 
106144
105973
  // src/nitro-compile.ts
106145
- var import_node_crypto81 = require("node:crypto");
105974
+ var import_node_crypto80 = require("node:crypto");
106146
105975
  var import_node_fs128 = __toESM(require("node:fs"), 1);
106147
105976
  var import_node_os29 = __toESM(require("node:os"), 1);
106148
105977
  var import_node_path130 = __toESM(require("node:path"), 1);
@@ -106163,7 +105992,7 @@ init_swift_package();
106163
105992
  init_swift_source_file();
106164
105993
 
106165
105994
  // src/swift-source-pods.ts
106166
- var import_node_crypto80 = require("node:crypto");
105995
+ var import_node_crypto79 = require("node:crypto");
106167
105996
  var import_node_fs127 = __toESM(require("node:fs"), 1);
106168
105997
  var import_node_path129 = __toESM(require("node:path"), 1);
106169
105998
  init_browser();
@@ -106206,11 +106035,11 @@ async function trunkSpecification(lockFile, root, version2, checksum) {
106206
106035
  "specifications",
106207
106036
  `${checksum}.json`
106208
106037
  );
106209
- const sha1 = (value) => (0, import_node_crypto80.createHash)("sha1").update(value).digest("hex");
106038
+ const sha1 = (value) => (0, import_node_crypto79.createHash)("sha1").update(value).digest("hex");
106210
106039
  let text7;
106211
106040
  if (import_node_fs127.default.existsSync(file)) text7 = import_node_fs127.default.readFileSync(file, "utf8");
106212
106041
  else {
106213
- const shard2 = (0, import_node_crypto80.createHash)("md5").update(root).digest("hex").slice(0, 3).split("").join("/");
106042
+ const shard2 = (0, import_node_crypto79.createHash)("md5").update(root).digest("hex").slice(0, 3).split("").join("/");
106214
106043
  const specPath = `Specs/${shard2}/${root}/${version2}/${root}.podspec.json`;
106215
106044
  const response = await fetch(`https://cdn.cocoapods.org/${specPath}`);
106216
106045
  if (!response.ok)
@@ -106339,7 +106168,7 @@ async function collectSwiftSourcePods(lockFile, modules, moduleRoot, headerModul
106339
106168
  "end",
106340
106169
  ""
106341
106170
  ].join("\n");
106342
- const key2 = (0, import_node_crypto80.createHash)("sha256").update(project).update(podfile).update(JSON.stringify([...selected].sort(([a], [b]) => a.localeCompare(b)))).update(
106171
+ const key2 = (0, import_node_crypto79.createHash)("sha256").update(project).update(podfile).update(JSON.stringify([...selected].sort(([a], [b]) => a.localeCompare(b)))).update(
106343
106172
  JSON.stringify(
106344
106173
  Object.entries(specificationChecksums).sort(([a], [b]) => a.localeCompare(b))
106345
106174
  )
@@ -107106,7 +106935,7 @@ async function prepareNitroCompileInput(options2) {
107106
106935
  input.libraries ??= {};
107107
106936
  input.libraries[nitroProviderTarget({ name: name3 })] = library;
107108
106937
  }
107109
- const key2 = (0, import_node_crypto81.createHash)("sha256").update(
106938
+ const key2 = (0, import_node_crypto80.createHash)("sha256").update(
107110
106939
  collection.providers.map(({ root, hybridObjects }) => `${root}\0${hybridObjects.join(",")}`).join("\0")
107111
106940
  ).update("\0").update(import_node_fs128.default.realpathSync(options2.moduleRoot)).update("\0").update(options2.configuration).digest("hex");
107112
106941
  const packagePath = import_node_path130.default.join(import_node_os29.default.tmpdir(), "peach-nitro-swift", key2, `p${process.pid}`);