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,10 +1,10 @@
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
  import {
3
3
  acquireSwiftRootReadHold,
4
4
  hasLiveSwiftRootReaders,
5
5
  retainSwiftRootReadHold,
6
6
  withSwiftRootLock
7
- } from "./chunk-FHYWKCOZ.mjs";
7
+ } from "./chunk-KOULWLTF.mjs";
8
8
  import {
9
9
  CORE_FOUNDATION_OVERLAY_GLOBALS,
10
10
  NATIVE_GRAPH_SDK_VERSION,
@@ -20,6 +20,9 @@ import {
20
20
  clearCaseInsensitiveHeaderOverlayCache,
21
21
  clearSwiftSdkPathsCache,
22
22
  emptyMacroEnvironment,
23
+ encodeWasmName,
24
+ encodeWasmNumber,
25
+ encodeWasmSigned,
23
26
  foundationOwnerOf,
24
27
  installVerifiedTarball,
25
28
  iosDeploymentMinimum,
@@ -27,8 +30,13 @@ import {
27
30
  nativelyDeclaredFunctions,
28
31
  objcEnumerations,
29
32
  objcSdkIntakeFlags,
33
+ readSLEB,
34
+ readULEB,
35
+ readWasmSection,
30
36
  rnxHomeDir,
31
37
  sdkObjCDeclarationOwners,
38
+ sha256Hex,
39
+ skipLEB,
32
40
  stripCCode,
33
41
  swiftBuildJobs,
34
42
  swiftCodeMask,
@@ -53,12 +61,13 @@ import {
53
61
  swiftSharedSdkRoot,
54
62
  swiftSharedSdkViewOptions,
55
63
  wasmMacroEnvironment,
64
+ wasmSections,
56
65
  weakenFoundationOverridesInArchive,
57
66
  withFrameworkCompanionImports,
58
67
  withoutImportedSdkEnumForwards,
59
68
  withoutSwiftDeclarations,
60
69
  writeBuildFile
61
- } from "./chunk-NJHTAVEI.mjs";
70
+ } from "./chunk-6BNEOOBT.mjs";
62
71
  import {
63
72
  SWIFT_AUTOLINK_LINKER,
64
73
  SWIFT_CACHE_HOLD_MARKER,
@@ -75,7 +84,7 @@ import {
75
84
  wasmThreadLinkFlags,
76
85
  windowAdmission,
77
86
  writeSwiftAutolinkLinker
78
- } from "./chunk-DPL3I4WY.mjs";
87
+ } from "./chunk-HWK2V6R4.mjs";
79
88
  import {
80
89
  SWIFT_BINARY_TREES_DIR,
81
90
  SWIFT_NATIVE_INPUT_ROOT,
@@ -90,7 +99,7 @@ import {
90
99
  isSwiftResourcePath,
91
100
  isSwiftSourceLinkGraph,
92
101
  swiftProjectFilesProblems
93
- } from "./chunk-IPX66HMP.mjs";
102
+ } from "./chunk-UBM772FD.mjs";
94
103
  import {
95
104
  OBJC_RESOURCE_ACCESSOR_BODY,
96
105
  OBJC_RESOURCE_ACCESSOR_HEADER,
@@ -113,23 +122,23 @@ import {
113
122
  swiftPackagePartition,
114
123
  swiftTargetModuleName,
115
124
  withoutGlogModuleMap
116
- } from "./chunk-FB27T2JY.mjs";
125
+ } from "./chunk-T7DTXCV5.mjs";
117
126
  import {
118
127
  rnxPublicBrand
119
- } from "./chunk-3UJO4NG3.mjs";
128
+ } from "./chunk-SNMGOZXQ.mjs";
120
129
  import {
121
130
  isRecord
122
- } from "./chunk-GMN43CNC.mjs";
131
+ } from "./chunk-VJSHIZ7J.mjs";
123
132
  import {
124
133
  __publicField
125
- } from "./chunk-Q42OLP7O.mjs";
134
+ } from "./chunk-LVEDBGWX.mjs";
126
135
 
127
136
  // src/swift-compile.ts
128
137
  import {
129
138
  spawn as spawn2,
130
139
  spawnSync as spawnSync3
131
140
  } from "node:child_process";
132
- import { createHash as createHash16, randomUUID as randomUUID4 } from "node:crypto";
141
+ import { createHash as createHash15, randomUUID as randomUUID4 } from "node:crypto";
133
142
  import {
134
143
  chmodSync as chmodSync4,
135
144
  copyFileSync as copyFileSync2,
@@ -2888,6 +2897,7 @@ var SWIFT_DIGEST_SOURCES = [
2888
2897
  "swift-objc-prebuilt-catalog.ts",
2889
2898
  "swift-toolchain.ts",
2890
2899
  "swift-shared-sdk.ts",
2900
+ "wasm-binary-sections.ts",
2891
2901
  "swift-distribution-mirror.ts",
2892
2902
  "swift-design-time.ts",
2893
2903
  "binaryen.lock.json",
@@ -4179,14 +4189,9 @@ import fs from "node:fs";
4179
4189
  import path6 from "node:path";
4180
4190
  var OBJC_RUNTIME_LOOKUP_SECTION = "peach_objc_runtime_lookup";
4181
4191
  var leb = (bytes, at) => {
4182
- let value = 0;
4183
- let scale = 1;
4184
- for (; ; ) {
4185
- const byte = bytes[at.offset++];
4186
- value += (byte & 127) * scale;
4187
- if (!(byte & 128)) return value;
4188
- scale *= 128;
4189
- }
4192
+ const [value, next] = readULEB(bytes, at.offset);
4193
+ at.offset = next;
4194
+ return value;
4190
4195
  };
4191
4196
  function objcRootInfo(bytes) {
4192
4197
  const at = { offset: 8 };
@@ -5092,63 +5097,6 @@ function takeGuestStartupData(wasm, address, length) {
5092
5097
  return { wasm: Buffer.concat(parts), bytes };
5093
5098
  }
5094
5099
 
5095
- // src/wasm-binary-sections.ts
5096
- function encodeWasmNumber(value) {
5097
- const bytes = [];
5098
- for (let rest = value; ; ) {
5099
- const byte = rest % 128;
5100
- rest = Math.floor(rest / 128);
5101
- if (rest === 0) return [...bytes, byte];
5102
- bytes.push(byte | 128);
5103
- }
5104
- }
5105
- function encodeWasmName(name) {
5106
- const bytes = new TextEncoder().encode(name);
5107
- return [...encodeWasmNumber(bytes.length), ...bytes];
5108
- }
5109
- function readWasmSection(bytes, start, end) {
5110
- let at = start;
5111
- const number3 = () => {
5112
- let value = 0;
5113
- for (let shift = 0; ; shift += 7) {
5114
- if (at >= end || shift > 63) throw new Error("invalid wasm integer");
5115
- const byte = bytes[at++];
5116
- value += (byte & 127) * 2 ** shift;
5117
- if (!(byte & 128)) return value;
5118
- }
5119
- };
5120
- return {
5121
- number: number3,
5122
- byte: () => {
5123
- if (at >= end) throw new Error("truncated wasm section");
5124
- return bytes[at++];
5125
- },
5126
- name: () => {
5127
- const length = number3();
5128
- at += length;
5129
- if (at > end) throw new Error("truncated wasm name");
5130
- return Buffer.from(bytes.buffer, bytes.byteOffset + at - length, length).toString();
5131
- },
5132
- position: () => at,
5133
- done: () => at === end
5134
- };
5135
- }
5136
- function wasmSections(bytes) {
5137
- if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
5138
- throw new Error("not a wasm module");
5139
- const found = [];
5140
- for (let at = 8; at < bytes.length; ) {
5141
- const header = readWasmSection(bytes, at, bytes.length);
5142
- const id = header.byte();
5143
- const size = header.number();
5144
- const start = header.position();
5145
- if (start + size > bytes.length) throw new Error("truncated wasm section");
5146
- found.push({ id, offset: at, start, end: start + size });
5147
- at = start + size;
5148
- }
5149
- return found;
5150
- }
5151
-
5152
5100
  // src/wasm-imports.ts
5153
5101
  function readWasmImports(bytes, section2, visit) {
5154
5102
  const input = readWasmSection(bytes, section2.start, section2.end);
@@ -5409,23 +5357,13 @@ function wasmReader(bytes, start) {
5409
5357
  const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
5410
5358
  let at = start;
5411
5359
  const u = () => {
5412
- let value = 0;
5413
- for (let shift = 0; ; shift += 7) {
5414
- const byte = bytes[at++];
5415
- value += (byte & 127) * 2 ** shift;
5416
- if (!(byte & 128)) return value;
5417
- }
5360
+ const [value, next] = readULEB(bytes, at);
5361
+ at = next;
5362
+ return value;
5418
5363
  };
5419
5364
  const s = () => {
5420
- let value = 0n;
5421
- let shift = 0n;
5422
- let byte = 0;
5423
- do {
5424
- byte = bytes[at++];
5425
- value |= BigInt(byte & 127) << shift;
5426
- shift += 7n;
5427
- } while (byte & 128);
5428
- if (byte & 64) value -= 1n << shift;
5365
+ const [value, next] = readSLEB(bytes, at);
5366
+ at = next;
5429
5367
  return value;
5430
5368
  };
5431
5369
  return {
@@ -5461,33 +5399,7 @@ function wasmSections2(bytes) {
5461
5399
  }
5462
5400
  return out;
5463
5401
  }
5464
- var uleb = (value) => {
5465
- const out = [];
5466
- do {
5467
- let byte = value % 128;
5468
- value = Math.floor(value / 128);
5469
- if (value) byte |= 128;
5470
- out.push(byte);
5471
- } while (value);
5472
- return out;
5473
- };
5474
- var sleb = (value) => {
5475
- const out = [];
5476
- for (; ; ) {
5477
- const byte = Number(value & 127n);
5478
- value >>= 7n;
5479
- if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
5480
- out.push(byte);
5481
- return out;
5482
- }
5483
- out.push(byte | 128);
5484
- }
5485
- };
5486
- var encodedName = (name) => {
5487
- const bytes = [...Buffer.from(name)];
5488
- return [...uleb(bytes.length), ...bytes];
5489
- };
5490
- var section = (id, payload) => Uint8Array.from([id, ...uleb(payload.length), ...payload]);
5402
+ var section = (id, payload) => Uint8Array.from([id, ...encodeWasmNumber(payload.length), ...payload]);
5491
5403
  function constant2(r) {
5492
5404
  const op = r.byte();
5493
5405
  if (op !== 65 && op !== 66) throw new Error(`sdk image constant op ${op}`);
@@ -5774,7 +5686,7 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
5774
5686
  else data[entry.name] = value;
5775
5687
  }
5776
5688
  if (entry.kind !== 0 && entry.kind !== 3 || host2.has(entry.name))
5777
- kept.push([...encodedName(entry.name), entry.kind, ...uleb(entry.index)]);
5689
+ kept.push([...encodeWasmName(entry.name), entry.kind, ...encodeWasmNumber(entry.index)]);
5778
5690
  }
5779
5691
  if (guestMap) {
5780
5692
  if (guestMap.code.length !== m.bodies.length)
@@ -5789,19 +5701,19 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
5789
5701
  const er = wasmReader(bytes, elements.start);
5790
5702
  const segments = er.u();
5791
5703
  const replaced = /* @__PURE__ */ new Map([
5792
- [4, [1, 112, 4, ...uleb(tableEnd + added.length)]],
5793
- [7, [...uleb(kept.length), ...kept.flat()]],
5704
+ [4, [1, 112, 4, ...encodeWasmNumber(tableEnd + added.length)]],
5705
+ [7, [...encodeWasmNumber(kept.length), ...kept.flat()]],
5794
5706
  [
5795
5707
  9,
5796
5708
  [
5797
- ...uleb(segments + 1),
5709
+ ...encodeWasmNumber(segments + 1),
5798
5710
  ...bytes.subarray(er.at, elements.end),
5799
5711
  0,
5800
5712
  66,
5801
- ...sleb(BigInt(tableEnd)),
5713
+ ...encodeWasmSigned(BigInt(tableEnd)),
5802
5714
  11,
5803
- ...uleb(added.length),
5804
- ...added.flatMap(uleb)
5715
+ ...encodeWasmNumber(added.length),
5716
+ ...added.flatMap(encodeWasmNumber)
5805
5717
  ]
5806
5718
  ]
5807
5719
  ]);
@@ -5907,33 +5819,33 @@ function codeOnlySdkImage(bytes, constructorMask) {
5907
5819
  if (drop) r.skip(1);
5908
5820
  gated.push(
5909
5821
  66,
5910
- ...sleb(BigInt(constructorMask + index++)),
5822
+ ...encodeWasmSigned(BigInt(constructorMask + index++)),
5911
5823
  45,
5912
5824
  0,
5913
5825
  0,
5914
5826
  4,
5915
5827
  64,
5916
5828
  16,
5917
- ...uleb(callee),
5829
+ ...encodeWasmNumber(callee),
5918
5830
  ...drop ? [26] : [],
5919
5831
  11
5920
5832
  );
5921
5833
  }
5922
5834
  if (index > SWIFT_SDK_CONSTRUCTOR_LIMIT)
5923
5835
  throw new Error(`${index} sdk constructors exceed the mask`);
5924
- gated.push(16, ...uleb(functionIndex("__peach_sdk_register")), 11);
5836
+ gated.push(16, ...encodeWasmNumber(functionIndex("__peach_sdk_register")), 11);
5925
5837
  bodies[constructors] = Uint8Array.from(gated);
5926
5838
  }
5927
- const codeParts = [Uint8Array.from(uleb(bodies.length))];
5928
- for (const body of bodies) codeParts.push(Uint8Array.from(uleb(body.length)), body);
5839
+ const codeParts = [Uint8Array.from(encodeWasmNumber(bodies.length))];
5840
+ for (const body of bodies) codeParts.push(Uint8Array.from(encodeWasmNumber(body.length)), body);
5929
5841
  const codeSize = codeParts.reduce((sum, part) => sum + part.length, 0);
5930
5842
  const tls = passiveSegments(bytes)[0];
5931
5843
  const out = [bytes.subarray(0, 8)];
5932
5844
  for (const s of m.sections) {
5933
5845
  if (s.id === 10) {
5934
- out.push(Uint8Array.from([10, ...uleb(codeSize)]));
5846
+ out.push(Uint8Array.from([10, ...encodeWasmNumber(codeSize)]));
5935
5847
  for (const part of codeParts) out.push(part);
5936
- } else if (s.id === 11) out.push(section(11, [1, 1, ...uleb(tls.length), ...tls]));
5848
+ } else if (s.id === 11) out.push(section(11, [1, 1, ...encodeWasmNumber(tls.length), ...tls]));
5937
5849
  else if (s.id === 12) out.push(section(12, [1]));
5938
5850
  else out.push(bytes.subarray(s.offset, s.end));
5939
5851
  }
@@ -6332,46 +6244,6 @@ function readArMembers(buf, includeBitcode = false) {
6332
6244
  }
6333
6245
 
6334
6246
  // src/swift-wasm-prune.ts
6335
- function sha256Hex(bytes) {
6336
- if (typeof Bun !== "undefined")
6337
- return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
6338
- return createHash2("sha256").update(bytes).digest("hex");
6339
- }
6340
- function readULEB(b, o) {
6341
- let res = 0;
6342
- let shift = 0;
6343
- let p = o;
6344
- while (true) {
6345
- const byte = b[p++];
6346
- res |= (byte & 127) << shift;
6347
- if ((byte & 128) === 0) break;
6348
- shift += 7;
6349
- }
6350
- return [res, p];
6351
- }
6352
- function readSLEB(b, o) {
6353
- let res = 0;
6354
- let shift = 0;
6355
- let p = o;
6356
- let byte = 0;
6357
- do {
6358
- byte = b[p++];
6359
- res |= (byte & 127) << shift;
6360
- shift += 7;
6361
- } while (byte & 128);
6362
- if (shift < 32 && byte & 64) res |= ~0 << shift;
6363
- return [res, p];
6364
- }
6365
- function encodeULEB(val) {
6366
- const out = [];
6367
- do {
6368
- let byte = val & 127;
6369
- val >>>= 7;
6370
- if (val !== 0) byte |= 128;
6371
- out.push(byte);
6372
- } while (val !== 0);
6373
- return out;
6374
- }
6375
6247
  var WIDE_DATA_RELOCS = /* @__PURE__ */ new Set([16, 19, 22, 27]);
6376
6248
  var ROOT_SEG_PREFIXES = [
6377
6249
  ".init_array",
@@ -6464,39 +6336,14 @@ function decodeRelocations(buf, sections) {
6464
6336
  for (let k = 0; k < sectionCount; k++, i++) {
6465
6337
  start[i] = length + cur - baseAt;
6466
6338
  const rType = buf[cur++];
6467
- let offset = buf[cur++];
6468
- if (offset >= 128) {
6469
- offset &= 127;
6470
- let shift = 7;
6471
- while (true) {
6472
- const byte = buf[cur++];
6473
- offset |= (byte & 127) << shift;
6474
- if (byte < 128) break;
6475
- shift += 7;
6476
- }
6477
- }
6478
- let symbol = buf[cur++];
6479
- if (symbol >= 128) {
6480
- symbol &= 127;
6481
- let shift = 7;
6482
- while (true) {
6483
- const byte = buf[cur++];
6484
- symbol |= (byte & 127) << shift;
6485
- if (byte < 128) break;
6486
- shift += 7;
6487
- }
6488
- }
6339
+ let offset;
6340
+ [offset, cur] = readULEB(buf, cur);
6341
+ let symbol;
6342
+ [symbol, cur] = readULEB(buf, cur);
6489
6343
  if (rType < 32 && (ADDEND_RELOC_MASK2 & 1 << rType) !== 0) {
6490
- let byte = buf[cur++];
6491
- let value = byte & 127;
6492
- let shift = 7;
6493
- while (byte >= 128) {
6494
- byte = buf[cur++];
6495
- value |= (byte & 127) << shift;
6496
- shift += 7;
6497
- }
6498
- if (shift < 32 && (byte & 64) !== 0) value |= ~0 << shift;
6499
- addend[i] = value;
6344
+ let value;
6345
+ [value, cur] = readSLEB(buf, cur);
6346
+ addend[i] = Number(BigInt.asIntN(32, value));
6500
6347
  }
6501
6348
  ro[i] = offset;
6502
6349
  rs[i] = symbol;
@@ -6613,8 +6460,7 @@ function patchSwiftrtObject(src) {
6613
6460
  }
6614
6461
  cur = c3;
6615
6462
  if (ADDEND_RELOCATIONS.has(rType)) {
6616
- const [, c4] = readSLEB(buf, cur);
6617
- cur = c4;
6463
+ cur = skipLEB(buf, cur);
6618
6464
  }
6619
6465
  }
6620
6466
  }
@@ -6628,25 +6474,14 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
6628
6474
  let pos = 8;
6629
6475
  let cur = 8;
6630
6476
  const readU = () => {
6631
- const b0 = buf[cur++];
6632
- if (b0 < 128) return b0;
6633
- let res = b0 & 127;
6634
- let shift = 7;
6635
- while (true) {
6636
- const byte = buf[cur++];
6637
- res |= (byte & 127) << shift;
6638
- if (byte < 128) return res;
6639
- shift += 7;
6640
- }
6477
+ const [res, next] = readULEB(buf, cur);
6478
+ cur = next;
6479
+ return res;
6641
6480
  };
6642
6481
  const skipU = () => {
6643
- while (buf[cur++] >= 128) {
6644
- }
6645
- };
6646
- const skipS = () => {
6647
- while (buf[cur++] >= 128) {
6648
- }
6482
+ cur = skipLEB(buf, cur);
6649
6483
  };
6484
+ const skipS = skipU;
6650
6485
  let numImportFuncs = 0;
6651
6486
  let importsDlsym = false;
6652
6487
  const importFuncNames = [];
@@ -7244,16 +7079,9 @@ function guestWasmSymbols(bytes) {
7244
7079
  const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
7245
7080
  let cur = 8;
7246
7081
  const readU = () => {
7247
- const b0 = bytes[cur++];
7248
- if (b0 < 128) return b0;
7249
- let res = b0 & 127;
7250
- let shift = 7;
7251
- while (true) {
7252
- const byte = bytes[cur++];
7253
- res |= (byte & 127) << shift;
7254
- if ((byte & 128) === 0) return res;
7255
- shift += 7;
7256
- }
7082
+ const [res, next] = readULEB(bytes, cur);
7083
+ cur = next;
7084
+ return res;
7257
7085
  };
7258
7086
  let importsDlsym = false;
7259
7087
  const importFuncNames = [];
@@ -8438,7 +8266,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
8438
8266
  zeroDataReloc(i);
8439
8267
  } else {
8440
8268
  const repl = firstLiveInSpecialSeg.get(segIdx);
8441
- const roBytes = encodeULEB(data.ro[i]);
8269
+ const roBytes = encodeWasmNumber(data.ro[i]);
8442
8270
  const out = new Uint8Array(1 + roBytes.length + repl.afterRo.length);
8443
8271
  out[0] = repl.rType;
8444
8272
  out.set(roBytes, 1);
@@ -8534,9 +8362,9 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
8534
8362
  }
8535
8363
  }
8536
8364
  if (entrySlices.length > 0) {
8537
- const cntBytes = Uint8Array.from(encodeULEB(entrySlices.length));
8365
+ const cntBytes = Uint8Array.from(encodeWasmNumber(entrySlices.length));
8538
8366
  const bodyLen = cntBytes.length + entrySlices.reduce((a, b) => a + b.length, 0);
8539
- const lenBytes = Uint8Array.from(encodeULEB(bodyLen));
8367
+ const lenBytes = Uint8Array.from(encodeWasmNumber(bodyLen));
8540
8368
  subChunks.push(Uint8Array.of(6), lenBytes, cntBytes);
8541
8369
  for (const entry of entrySlices) subChunks.push(entry);
8542
8370
  }
@@ -8593,17 +8421,17 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
8593
8421
  lp = subEnd;
8594
8422
  }
8595
8423
  const totalSubLen = subChunks.reduce((a, b) => a + b.length, 0);
8596
- outChunks.push(Uint8Array.of(0), Uint8Array.from(encodeULEB(totalSubLen)));
8424
+ outChunks.push(Uint8Array.of(0), Uint8Array.from(encodeWasmNumber(totalSubLen)));
8597
8425
  for (const chunk of subChunks) outChunks.push(chunk);
8598
8426
  } else if (name === "reloc.CODE") {
8599
8427
  const [, r1] = readULEB(buf, cp);
8600
8428
  const headerSlice = buf.subarray(p, r1);
8601
- const cntBytes = Uint8Array.from(encodeULEB(keptCodeRelocs.length));
8429
+ const cntBytes = Uint8Array.from(encodeWasmNumber(keptCodeRelocs.length));
8602
8430
  const relSlices = keptCodeRelocs.map((i) => relocationBytes(code, i));
8603
8431
  const totalLen = headerSlice.length + cntBytes.length + relSlices.reduce((a, b) => a + b.length, 0);
8604
8432
  outChunks.push(
8605
8433
  Uint8Array.of(0),
8606
- Uint8Array.from(encodeULEB(totalLen)),
8434
+ Uint8Array.from(encodeWasmNumber(totalLen)),
8607
8435
  headerSlice,
8608
8436
  cntBytes
8609
8437
  );
@@ -8611,11 +8439,11 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
8611
8439
  } else if (name === "reloc.DATA") {
8612
8440
  const [, r1] = readULEB(buf, cp);
8613
8441
  const headerSlice = buf.subarray(p, r1);
8614
- const cntBytes = Uint8Array.from(encodeULEB(keptDataRelocBytes.length));
8442
+ const cntBytes = Uint8Array.from(encodeWasmNumber(keptDataRelocBytes.length));
8615
8443
  const totalLen = headerSlice.length + cntBytes.length + keptDataRelocBytes.reduce((a, b) => a + b.length, 0);
8616
8444
  outChunks.push(
8617
8445
  Uint8Array.of(0),
8618
- Uint8Array.from(encodeULEB(totalLen)),
8446
+ Uint8Array.from(encodeWasmNumber(totalLen)),
8619
8447
  headerSlice,
8620
8448
  cntBytes
8621
8449
  );
@@ -8625,7 +8453,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
8625
8453
  const nameBytes = buf.subarray(p, cp);
8626
8454
  outChunks.push(
8627
8455
  Uint8Array.of(0),
8628
- Uint8Array.from(encodeULEB(nameBytes.length)),
8456
+ Uint8Array.from(encodeWasmNumber(nameBytes.length)),
8629
8457
  nameBytes
8630
8458
  );
8631
8459
  } else if (name.startsWith("reloc..debug_")) {
@@ -8633,7 +8461,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
8633
8461
  const headerSlice = buf.subarray(p, r1);
8634
8462
  outChunks.push(
8635
8463
  Uint8Array.of(0),
8636
- Uint8Array.from(encodeULEB(headerSlice.length + 1)),
8464
+ Uint8Array.from(encodeWasmNumber(headerSlice.length + 1)),
8637
8465
  headerSlice,
8638
8466
  Uint8Array.of(0)
8639
8467
  );
@@ -8886,16 +8714,13 @@ var ByteWriter = class {
8886
8714
  this.buf[this.pos++] = value;
8887
8715
  }
8888
8716
  uleb(value) {
8889
- this.ensure(10);
8890
- let pos = this.pos;
8891
- const buf = this.buf;
8892
- do {
8893
- let byte = value % 128;
8894
- value = Math.floor(value / 128);
8895
- if (value) byte |= 128;
8896
- buf[pos++] = byte;
8897
- } while (value);
8898
- this.pos = pos;
8717
+ if (value < 128) {
8718
+ this.byte(value);
8719
+ return;
8720
+ }
8721
+ const encoded = encodeWasmNumber(value);
8722
+ this.ensure(encoded.length);
8723
+ for (let i = 0; i < encoded.length; i++) this.buf[this.pos++] = encoded[i];
8899
8724
  }
8900
8725
  bytes(source, start = 0, end = source.length) {
8901
8726
  const len = end - start;
@@ -8917,34 +8742,11 @@ var ByteWriter = class {
8917
8742
  return this.buf.subarray(0, this.pos);
8918
8743
  }
8919
8744
  };
8920
- function readNumber(bytes, position) {
8921
- if (position < bytes.length) {
8922
- const first = bytes[position];
8923
- if (first < 128) return [first, position + 1];
8924
- }
8925
- let value = 0;
8926
- let shift = 0;
8927
- for (; ; ) {
8928
- if (position >= bytes.length || shift > 63) throw new Error("invalid wasm integer");
8929
- const byte = bytes[position++];
8930
- value += (byte & 127) * 2 ** shift;
8931
- if (!(byte & 128)) return [value, position];
8932
- shift += 7;
8933
- }
8934
- }
8935
8745
  function encodeNumber(value) {
8936
- if (value < 128) return Buffer.from([value]);
8937
- const bytes = [];
8938
- do {
8939
- let byte = value % 128;
8940
- value = Math.floor(value / 128);
8941
- if (value) byte |= 128;
8942
- bytes.push(byte);
8943
- } while (value);
8944
- return Buffer.from(bytes);
8746
+ return Buffer.from(encodeWasmNumber(value));
8945
8747
  }
8946
8748
  function readString(bytes, position) {
8947
- const [length, start] = readNumber(bytes, position);
8749
+ const [length, start] = readULEB(bytes, position);
8948
8750
  if (start + length > bytes.length) throw new Error("invalid wasm string");
8949
8751
  return [
8950
8752
  Buffer.from(bytes.buffer, bytes.byteOffset + start, length).toString("utf8"),
@@ -9273,13 +9075,13 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
9273
9075
  for (const subsection of subsections) {
9274
9076
  if (subsection.kind === 6 && objcLoader !== void 0) {
9275
9077
  const content = subsection.parts[0];
9276
- const [count, entriesStart] = readNumber(content, 0);
9078
+ const [count, entriesStart] = readULEB(content, 0);
9277
9079
  const initWriter = new ByteWriter(content.length + 16);
9278
9080
  initWriter.bytes(content, 0, entriesStart);
9279
9081
  let entryStart = entriesStart;
9280
9082
  for (let i = 0; i < count; i++) {
9281
- const [, symbolStart] = readNumber(content, entryStart);
9282
- const [symbol, entryEnd] = readNumber(content, symbolStart);
9083
+ const [, symbolStart] = readULEB(content, entryStart);
9084
+ const [symbol, entryEnd] = readULEB(content, symbolStart);
9283
9085
  if (symbol === objcLoader) {
9284
9086
  initWriter.uleb(1);
9285
9087
  initWriter.bytes(content, symbolStart, entryEnd);
@@ -9349,7 +9151,7 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
9349
9151
  if (position < bytes.length && bytes[position] < 128) {
9350
9152
  size = bytes[position++];
9351
9153
  } else {
9352
- const [val, next] = readNumber(bytes, position);
9154
+ const [val, next] = readULEB(bytes, position);
9353
9155
  size = val;
9354
9156
  position = next;
9355
9157
  }
@@ -10108,7 +9910,7 @@ function nameGuestImageAliases(wasm, symbols) {
10108
9910
  const parts = [wasm.subarray(0, 8)];
10109
9911
  let position = 8;
10110
9912
  while (position < wasm.length) {
10111
- const [size, start] = readNumber(wasm, position + 1);
9913
+ const [size, start] = readULEB(wasm, position + 1);
10112
9914
  const end = start + size;
10113
9915
  const custom = wasm[position] === 0 ? readString(wasm, start) : void 0;
10114
9916
  if (custom?.[0] !== "name") {
@@ -10119,17 +9921,17 @@ function nameGuestImageAliases(wasm, symbols) {
10119
9921
  const subsections = [encodedString("name")];
10120
9922
  let at = custom[1];
10121
9923
  while (at < end) {
10122
- const [subSize, subStart] = readNumber(wasm, at + 1);
9924
+ const [subSize, subStart] = readULEB(wasm, at + 1);
10123
9925
  const subEnd = subStart + subSize;
10124
9926
  if (wasm[at] !== 1) {
10125
9927
  subsections.push(wasm.subarray(at, subEnd));
10126
9928
  at = subEnd;
10127
9929
  continue;
10128
9930
  }
10129
- let [count, cursor] = readNumber(wasm, subStart);
9931
+ let [count, cursor] = readULEB(wasm, subStart);
10130
9932
  const entries2 = [encodeNumber(count)];
10131
9933
  for (; count > 0; count--) {
10132
- const [index, next] = readNumber(wasm, cursor);
9934
+ const [index, next] = readULEB(wasm, cursor);
10133
9935
  const [name, after] = readString(wasm, next);
10134
9936
  cursor = after;
10135
9937
  const symbol = symbols[Number(alias.exec(name)?.[1] ?? -1)];
@@ -10444,13 +10246,6 @@ function sha256Buffer(bytes) {
10444
10246
  return createHash5("sha256").update(bytes).digest();
10445
10247
  }
10446
10248
  var PACK_BYTES = 64 * 1024;
10447
- function uleb2(value) {
10448
- const bytes = [];
10449
- for (let rest = value; ; rest = Math.floor(rest / 128)) {
10450
- if (rest < 128) return [...bytes, rest];
10451
- bytes.push(rest % 128 | 128);
10452
- }
10453
- }
10454
10249
  function encodeGuestDyldTable(rows) {
10455
10250
  const encoded = rows.map((row) => ({ ...row, bytes: Buffer.from(row.name) })).sort((a, b) => Buffer.compare(a.bytes, b.bytes));
10456
10251
  const packs = [];
@@ -10463,7 +10258,7 @@ function encodeGuestDyldTable(rows) {
10463
10258
  value.writeBigUInt64LE(row.value);
10464
10259
  const bytes = Buffer.concat([
10465
10260
  row.bytes,
10466
- Buffer.from([0, ...uleb2(row.image), row.kind]),
10261
+ Buffer.from([0, ...encodeWasmNumber(row.image), row.kind]),
10467
10262
  value
10468
10263
  ]);
10469
10264
  if (!current.length) firsts.push(row.bytes);
@@ -10559,16 +10354,6 @@ async function mapLimit(items, limit, worker) {
10559
10354
  }
10560
10355
 
10561
10356
  // src/swift-guest-dyld-functions.ts
10562
- var uleb3 = (value) => {
10563
- const out = [];
10564
- do {
10565
- let byte = value % 128;
10566
- value = Math.floor(value / 128);
10567
- if (value) byte |= 128;
10568
- out.push(byte);
10569
- } while (value);
10570
- return out;
10571
- };
10572
10357
  var SECTION_ORDER = [1, 2, 3, 4, 5, 13, 6, 7, 8, 9, 12, 10, 11];
10573
10358
  function skipValueType(r) {
10574
10359
  const type = r.byte();
@@ -10613,8 +10398,8 @@ function readImports2(bytes, sections) {
10613
10398
  return { functions, table64 };
10614
10399
  }
10615
10400
  function vectorSection(id, count, parts) {
10616
- const body = Buffer.concat([Buffer.from(uleb3(count)), ...parts]);
10617
- return Buffer.concat([Buffer.from([id, ...uleb3(body.length)]), body]);
10401
+ const body = Buffer.concat([Buffer.from(encodeWasmNumber(count)), ...parts]);
10402
+ return Buffer.concat([Buffer.from([id, ...encodeWasmNumber(body.length)]), body]);
10618
10403
  }
10619
10404
  function rewriteSections(bytes, sections, changes) {
10620
10405
  const out = [bytes.subarray(0, 8)];
@@ -10675,9 +10460,9 @@ function appendLazyPlacement(bytes, functions, table) {
10675
10460
  vectorSection(2, count + 1, [
10676
10461
  found && header ? bytes.subarray(header.at, found.end) : new Uint8Array(),
10677
10462
  Buffer.from([
10678
- ...uleb3(module.length),
10463
+ ...encodeWasmNumber(module.length),
10679
10464
  ...module,
10680
- ...uleb3(name2.length),
10465
+ ...encodeWasmNumber(name2.length),
10681
10466
  ...name2,
10682
10467
  1,
10683
10468
  112,
@@ -10699,7 +10484,7 @@ function appendLazyPlacement(bytes, functions, table) {
10699
10484
  elements.splice(
10700
10485
  placementIndex,
10701
10486
  0,
10702
- Buffer.from([1, 0, ...uleb3(functions.length), ...functions.flatMap(uleb3)])
10487
+ Buffer.from([1, 0, ...encodeWasmNumber(functions.length), ...functions.flatMap(encodeWasmNumber)])
10703
10488
  );
10704
10489
  const place2 = imports.functions + declared.length;
10705
10490
  const instructions = [
@@ -10713,7 +10498,7 @@ function appendLazyPlacement(bytes, functions, table) {
10713
10498
  1,
10714
10499
  252,
10715
10500
  12,
10716
- ...uleb3(placementIndex),
10501
+ ...encodeWasmNumber(placementIndex),
10717
10502
  0,
10718
10503
  11
10719
10504
  ];
@@ -10734,14 +10519,14 @@ function appendLazyPlacement(bytes, functions, table) {
10734
10519
  3,
10735
10520
  vectorSection(3, declared.length + 1, [
10736
10521
  ...declared,
10737
- Buffer.from(uleb3(types.length))
10522
+ Buffer.from(encodeWasmNumber(types.length))
10738
10523
  ])
10739
10524
  ],
10740
10525
  [
10741
10526
  7,
10742
10527
  vectorSection(7, exports.length + 1, [
10743
10528
  ...exports,
10744
- Buffer.from([...uleb3(name.length), ...name, 0, ...uleb3(place2)])
10529
+ Buffer.from([...encodeWasmNumber(name.length), ...name, 0, ...encodeWasmNumber(place2)])
10745
10530
  ])
10746
10531
  ],
10747
10532
  [9, vectorSection(9, elements.length, elements)],
@@ -10749,7 +10534,7 @@ function appendLazyPlacement(bytes, functions, table) {
10749
10534
  10,
10750
10535
  vectorSection(10, bodies.length + 1, [
10751
10536
  ...bodies,
10752
- Buffer.from([...uleb3(instructions.length), ...instructions])
10537
+ Buffer.from([...encodeWasmNumber(instructions.length), ...instructions])
10753
10538
  ])
10754
10539
  ]
10755
10540
  ])
@@ -13677,7 +13462,6 @@ async function linkPrunedGuestImages(options) {
13677
13462
 
13678
13463
  // src/swift-guest-source-inputs.ts
13679
13464
  import { execFileSync as execFileSync6 } from "node:child_process";
13680
- import { createHash as createHash9 } from "node:crypto";
13681
13465
  import {
13682
13466
  existsSync as existsSync3,
13683
13467
  mkdirSync as mkdirSync3,
@@ -13775,13 +13559,8 @@ function clangBinaryStamp(file) {
13775
13559
  const stat = statSync2(file, { bigint: true });
13776
13560
  return [file, stat.size, stat.mtimeNs].join(":");
13777
13561
  }
13778
- function sha256Hex2(bytes) {
13779
- if (typeof Bun !== "undefined")
13780
- return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
13781
- return createHash9("sha256").update(bytes).digest("hex");
13782
- }
13783
13562
  function clangWrapperStamp(file) {
13784
- return sha256Hex2(readFileSync8(file));
13563
+ return sha256Hex(readFileSync8(file));
13785
13564
  }
13786
13565
  function clangArgsNeedCwd(args) {
13787
13566
  const pathFlags = /* @__PURE__ */ new Set([
@@ -13959,7 +13738,7 @@ function sourceGuestClangLinkOptions(options) {
13959
13738
  path11.join(options.buildDirectory, CLANG_TARGET_MODULE_WRAPPER)
13960
13739
  ))))
13961
13740
  throw new Error(`unsupported source object producer ${file}`);
13962
- const key = sha256Hex2(
13741
+ const key = sha256Hex(
13963
13742
  JSON.stringify([
13964
13743
  "clang-link-options/v2",
13965
13744
  clangArgsNeedCwd(command.args) ? process.cwd() : null,
@@ -13970,7 +13749,7 @@ function sourceGuestClangLinkOptions(options) {
13970
13749
  clangProducerStamp(file)
13971
13750
  ])
13972
13751
  );
13973
- const cacheFile = path11.join(cacheDirectory, sha256Hex2(file) + ".json");
13752
+ const cacheFile = path11.join(cacheDirectory, sha256Hex(file) + ".json");
13974
13753
  const cached = readClangLinkOptions(cacheFile, key);
13975
13754
  if (cached) {
13976
13755
  validateClangLinkOptions(cached);
@@ -14092,30 +13871,12 @@ function wasmAutolinkEntries(bytes, out) {
14092
13871
  const len = bytes.length;
14093
13872
  while (pos < len) {
14094
13873
  const id = bytes[pos++];
14095
- let sz = bytes[pos++];
14096
- if (sz >= 128) {
14097
- sz &= 127;
14098
- let shift = 7;
14099
- while (true) {
14100
- const b = bytes[pos++];
14101
- sz |= (b & 127) << shift;
14102
- if (b < 128) break;
14103
- shift += 7;
14104
- }
14105
- }
13874
+ let sz;
13875
+ [sz, pos] = readULEB(bytes, pos, len);
14106
13876
  const end = pos + sz;
14107
13877
  if (id === 0) {
14108
- let nLen = bytes[pos++];
14109
- if (nLen >= 128) {
14110
- nLen &= 127;
14111
- let shift = 7;
14112
- while (true) {
14113
- const b = bytes[pos++];
14114
- nLen |= (b & 127) << shift;
14115
- if (b < 128) break;
14116
- shift += 7;
14117
- }
14118
- }
13878
+ let nLen;
13879
+ [nLen, pos] = readULEB(bytes, pos, end);
14119
13880
  if (nLen === 24 && raw2.toString("ascii", pos, pos + 24) === ".swift1_autolink_entries") {
14120
13881
  const payload = raw2.toString("utf8", pos + 24, end);
14121
13882
  for (const entry of payload.split("\0")) {
@@ -14183,7 +13944,7 @@ function sourceGuestRuntimeLinks(options) {
14183
13944
  const file = path11.resolve(directory, alias.moduleMap);
14184
13945
  if (!file.startsWith(directory + path11.sep))
14185
13946
  throw new Error(`invalid framework module map ${alias.moduleMap}`);
14186
- if (createHash9("sha256").update(readFileSync8(file)).digest("hex") !== alias.moduleMapSha256)
13947
+ if (sha256Hex(readFileSync8(file)) !== alias.moduleMapSha256)
14187
13948
  throw new Error(`framework module map changed ${alias.moduleMap}`);
14188
13949
  sdkAliases.set(alias.name, {
14189
13950
  product: product.id,
@@ -14239,7 +14000,7 @@ function sourceGuestRuntimeLinks(options) {
14239
14000
  const map = path11.resolve(root, alias.moduleMap);
14240
14001
  if (!map.startsWith(root + path11.sep))
14241
14002
  throw new Error(`invalid framework module map ${alias.moduleMap}`);
14242
- if (createHash9("sha256").update(readFileSync8(map)).digest("hex") !== alias.moduleMapSha256)
14003
+ if (sha256Hex(readFileSync8(map)) !== alias.moduleMapSha256)
14243
14004
  throw new Error(`framework module map changed ${alias.moduleMap}`);
14244
14005
  frameworkAliases.set(alias.name, { kind: "package", targets: closure(alias.targets) });
14245
14006
  }
@@ -14414,10 +14175,10 @@ function removeProjectLinks(root) {
14414
14175
  }
14415
14176
 
14416
14177
  // src/swift-sdk-guest-lookups.ts
14417
- import { createHash as createHash10 } from "node:crypto";
14178
+ import { createHash as createHash9 } from "node:crypto";
14418
14179
  import { realpathSync as realpathSync4 } from "node:fs";
14419
14180
  import path13 from "node:path";
14420
- var sdkGuestObjectKey = (identity) => createHash10("sha256").update(identity).digest("hex").slice(0, 32);
14181
+ var sdkGuestObjectKey = (identity) => createHash9("sha256").update(identity).digest("hex").slice(0, 32);
14421
14182
  function swiftSdkGuestLookups(moduleRoot, sdkRoot, objects) {
14422
14183
  const catalogs = readGuestRuntimeCatalogs(sdkRoot, moduleRoot);
14423
14184
  const framework = frameworkRuntimeProductId(catalogs.framework.product);
@@ -14676,7 +14437,7 @@ async function compileGuestLink(options) {
14676
14437
  };
14677
14438
  const sdk = options.sdkImage;
14678
14439
  const sdkCallers = sdk.sdkInterface.guestCallers;
14679
- const sdkObjects = (await import("./swift-sdk-image-Y6XT7KI4.mjs")).readSwiftSdkManifestIndex(
14440
+ const sdkObjects = (await import("./swift-sdk-image-MIWPBZEN.mjs")).readSwiftSdkManifestIndex(
14680
14441
  sdk
14681
14442
  ).guestObjects;
14682
14443
  if (!sdkCallers || !sdkObjects)
@@ -14976,7 +14737,7 @@ async function compileGuestLink(options) {
14976
14737
  swiftAppModuleThunkSection,
14977
14738
  swiftSdkProjectionSpans,
14978
14739
  writeSwiftSdkAppLink
14979
- } = await import("./swift-sdk-app-module-P3BARE2W.mjs");
14740
+ } = await import("./swift-sdk-app-module-ZIN3LFLS.mjs");
14980
14741
  const project = options.project;
14981
14742
  const work = project ? mkdtempSync2(path14.join(directory, "app-module-")) : path14.join(directory, "app-module");
14982
14743
  if (project) chownSync(work, project.uid, project.gid);
@@ -15160,7 +14921,7 @@ async function compileGuestLink(options) {
15160
14921
  }
15161
14922
 
15162
14923
  // src/swift-header-compiler.ts
15163
- import { createHash as createHash11 } from "node:crypto";
14924
+ import { createHash as createHash10 } from "node:crypto";
15164
14925
  import {
15165
14926
  chmodSync as chmodSync3,
15166
14927
  existsSync as existsSync5,
@@ -15240,7 +15001,7 @@ function compilerCheckpoint(root, recipe, args, header) {
15240
15001
  }
15241
15002
  }
15242
15003
  if (objects === 0) return;
15243
- const digest = createHash11("sha256").update(recipe).update(JSON.stringify(args)).update(mapText);
15004
+ const digest = createHash10("sha256").update(recipe).update(JSON.stringify(args)).update(mapText);
15244
15005
  for (const flag of args) {
15245
15006
  if (!flag.startsWith("@")) continue;
15246
15007
  const response = flag.slice(1);
@@ -15480,7 +15241,7 @@ function swiftHeaderDependencies(root, files, targets, nativeTargets, producers,
15480
15241
 
15481
15242
  // src/swift-icu.ts
15482
15243
  import { execFile as execFile3 } from "node:child_process";
15483
- import { createHash as createHash12, randomUUID as randomUUID3 } from "node:crypto";
15244
+ import { createHash as createHash11, randomUUID as randomUUID3 } from "node:crypto";
15484
15245
  import { existsSync as existsSync6, readFileSync as readFileSync12 } from "node:fs";
15485
15246
  import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
15486
15247
  import os from "node:os";
@@ -15559,7 +15320,7 @@ var raw = /* @__PURE__ */ new Map();
15559
15320
  var assets = /* @__PURE__ */ new Map();
15560
15321
  var brotliMemoryCache = /* @__PURE__ */ new Map();
15561
15322
  async function cachedBrotli(bytes, quality, cacheKey) {
15562
- const key = cacheKey && /^[a-f0-9]{64}$/.test(cacheKey) ? cacheKey : createHash12("sha256").update(bytes).digest("hex");
15323
+ const key = cacheKey && /^[a-f0-9]{64}$/.test(cacheKey) ? cacheKey : createHash11("sha256").update(bytes).digest("hex");
15563
15324
  const cacheId = `${quality}:${key}`;
15564
15325
  const cached = brotliMemoryCache.get(cacheId);
15565
15326
  if (cached) return cached;
@@ -15615,7 +15376,7 @@ function swiftIcuAsset(toolchainBin, sdk) {
15615
15376
  JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]),
15616
15377
  async () => {
15617
15378
  const zipped = await deflate(await swiftIcuData(toolchainBin, sdk));
15618
- return { sha256: createHash12("sha256").update(zipped).digest("hex"), gzip: zipped };
15379
+ return { sha256: createHash11("sha256").update(zipped).digest("hex"), gzip: zipped };
15619
15380
  }
15620
15381
  );
15621
15382
  }
@@ -15662,36 +15423,22 @@ function archiveMember(archive, name) {
15662
15423
  throw new Error(`swift-icu: ${name} is not in the sdk's icu archive`);
15663
15424
  }
15664
15425
  function icuSegment(object2) {
15665
- let at = 8;
15666
- const leb2 = () => {
15667
- let result = 0;
15668
- let shift = 0;
15669
- let byte;
15670
- do {
15671
- byte = object2[at++];
15672
- result += (byte & 127) * 2 ** shift;
15673
- shift += 7;
15674
- } while (byte & 128);
15675
- return result;
15676
- };
15677
15426
  const found = [];
15678
- while (at < object2.length) {
15679
- const id = object2[at++];
15680
- const size = leb2();
15681
- const end = at + size;
15682
- if (id === 11) {
15683
- for (let count = leb2(); count > 0; count--) {
15684
- if (leb2() !== 0) throw new Error("swift-icu: unexpected data segment kind");
15685
- at++;
15686
- leb2();
15687
- at++;
15688
- const length = leb2();
15689
- const bytes = object2.subarray(at, at + length);
15690
- if (bytes[2] === 218 && bytes[3] === 39) found.push(bytes);
15691
- at += length;
15692
- }
15427
+ for (const section2 of wasmSections(object2)) {
15428
+ if (section2.id !== 11) continue;
15429
+ const reader = readWasmSection(object2, section2.start, section2.end);
15430
+ for (let count = reader.number(); count > 0; count--) {
15431
+ if (reader.number() !== 0)
15432
+ throw new Error("swift-icu: unexpected data segment kind");
15433
+ reader.byte();
15434
+ reader.number();
15435
+ reader.byte();
15436
+ const length = reader.number();
15437
+ const start = reader.position();
15438
+ const bytes = object2.subarray(start, start + length);
15439
+ if (bytes[2] === 218 && bytes[3] === 39) found.push(bytes);
15440
+ reader.skip(length);
15693
15441
  }
15694
- at = end;
15695
15442
  }
15696
15443
  if (found.length !== 1)
15697
15444
  throw new Error(`swift-icu: expected one icu data segment, found ${found.length}`);
@@ -15869,7 +15616,7 @@ function swiftObjCModuleMap(module, headers, submodules = /* @__PURE__ */ new Se
15869
15616
 
15870
15617
  // src/swift-objc-prebuilt.ts
15871
15618
  import { spawnSync as spawnSync2 } from "node:child_process";
15872
- import { createHash as createHash14 } from "node:crypto";
15619
+ import { createHash as createHash13 } from "node:crypto";
15873
15620
  import fs5 from "node:fs";
15874
15621
  import path19 from "node:path";
15875
15622
 
@@ -15924,13 +15671,13 @@ function rnxSelfInvocation() {
15924
15671
 
15925
15672
  // src/native-prebuilt.ts
15926
15673
  import { execFileSync as execFileSync9 } from "node:child_process";
15927
- import { createHash as createHash13 } from "node:crypto";
15674
+ import { createHash as createHash12 } from "node:crypto";
15928
15675
  import fs4 from "node:fs";
15929
15676
  import path18 from "node:path";
15930
15677
  var NATIVE_PREBUILT_ORIGIN = "https://r2.rnxsim.com";
15931
15678
  function nativeEntryKey(inputs) {
15932
15679
  const lines = Object.keys(inputs).sort().map((name) => `${name}\0${inputs[name]}`);
15933
- return createHash13("sha256").update(lines.join("\n")).digest("hex").slice(0, 32);
15680
+ return createHash12("sha256").update(lines.join("\n")).digest("hex").slice(0, 32);
15934
15681
  }
15935
15682
  var nativeEntryPrefix = (kind, name, key) => `native/${kind}/${name}/${key}`;
15936
15683
  var nativeEntryCache = (kind, name, key) => path18.join(cacheDir(), "native-prebuilt", kind, name, key);
@@ -15945,7 +15692,7 @@ function download(url, to) {
15945
15692
  return false;
15946
15693
  }
15947
15694
  }
15948
- var sha256 = (file) => createHash13("sha256").update(fs4.readFileSync(file)).digest("hex");
15695
+ var sha256 = (file) => createHash12("sha256").update(fs4.readFileSync(file)).digest("hex");
15949
15696
  function isEntryFile(file) {
15950
15697
  return isRecord(file) && typeof file.path === "string" && /^[^/\\]+$/.test(file.path) && file.path !== "." && file.path !== ".." && file.path !== "descriptor.json" && typeof file.sha256 === "string" && typeof file.size === "number";
15951
15698
  }
@@ -16008,7 +15755,7 @@ function swiftObjCPrebuiltCompiler(clang, root, sysroot, distribution, targets,
16008
15755
  );
16009
15756
  if (!modules.length) return [];
16010
15757
  const { executable, prefixArgs } = rnxSelfInvocation();
16011
- const compiler = createHash14("sha256").update(fs5.readFileSync(clang)).digest("hex");
15758
+ const compiler = createHash13("sha256").update(fs5.readFileSync(clang)).digest("hex");
16012
15759
  return [
16013
15760
  'case "$module" in',
16014
15761
  ` ${modules.join("|")}) exec ${[
@@ -16056,11 +15803,11 @@ function swiftReproducibleBuildFlags(roots) {
16056
15803
  }
16057
15804
 
16058
15805
  // src/swift-sdk-image-recipe.ts
16059
- import { createHash as createHash15 } from "node:crypto";
15806
+ import { createHash as createHash14 } from "node:crypto";
16060
15807
  var SWIFT_SDK_IMAGE_VERSION = 14;
16061
15808
  var SOURCE_SWIFT_FRAMEWORK_RECIPE = "swift-framework/v4";
16062
15809
  var swiftSdkImageScope = (scopedLookups) => scopedLookups ? "guest image scopes 9\n" : "unscoped constructor order 1\n";
16063
- var SWIFT_SDK_IMAGE_RECIPE = createHash15("sha256").update(`swift-sdk-image
15810
+ var SWIFT_SDK_IMAGE_RECIPE = createHash14("sha256").update(`swift-sdk-image
16064
15811
  ${SWIFT_SDK_IMAGE_VERSION}
16065
15812
  `).update(WASM_LOWER_IDENTITY).update(swiftSdkImageScope(false)).update(swiftSdkImageScope(true)).digest("hex").slice(0, 16);
16066
15813
 
@@ -16493,7 +16240,7 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal, lea
16493
16240
  }
16494
16241
  function swiftProjectBuildKey(moduleRoot, release) {
16495
16242
  const recipe = swiftDistributionAt(moduleRoot) ? "swift-framework/v2" : SOURCE_SWIFT_FRAMEWORK_RECIPE;
16496
- return createHash16("sha256").update(`${recipe}\0${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).update(swiftModuleDigest(moduleRoot)).digest("hex").slice(0, 32);
16243
+ return createHash15("sha256").update(`${recipe}\0${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).update(swiftModuleDigest(moduleRoot)).digest("hex").slice(0, 32);
16497
16244
  }
16498
16245
  var SYSTEM_MODULE_LIBRARIES = {
16499
16246
  "sqlite3.h": "sqlite3",
@@ -16865,7 +16612,7 @@ function distributionClangModuleOptions(root, modules) {
16865
16612
  function providedModulesPath(root, modules, excluded) {
16866
16613
  if (!excluded || excluded.size === 0) return modules;
16867
16614
  const entries2 = readdirSync4(modules).filter((entry) => !excluded.has(entry.replace(/\..*$/, ""))).sort();
16868
- const key = createHash16("sha256").update(JSON.stringify([modules, entries2])).update([...excluded].sort().join("\0")).digest("hex").slice(0, 16);
16615
+ const key = createHash15("sha256").update(JSON.stringify([modules, entries2])).update([...excluded].sort().join("\0")).digest("hex").slice(0, 16);
16869
16616
  const directory = path23.join(root, `.peach-modules-${key}`);
16870
16617
  const complete = path23.join(directory, ".complete");
16871
16618
  if (!existsSync9(complete)) {
@@ -16981,21 +16728,21 @@ var darwinRecordsRegion = (quoted2) => quoted2.length ? ["-Wl,--start-lib", ...q
16981
16728
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
16982
16729
  var MULTI_MANIFEST_VERSION = 76;
16983
16730
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
16984
- var compilerSourceDigest = true ? "1803ba36803a88ceeca92ee7b13baa39dde72fbb72df14659f0414084afaf5d7" : swiftCompilerSourceDigest(import.meta.dirname);
16731
+ var compilerSourceDigest = true ? "816651f27c8e6bad4746f2f90d840446903e3c4a2384095dcdf1c9ceb69ceba8" : swiftCompilerSourceDigest(import.meta.dirname);
16985
16732
  function swiftArtifactHash(input, release, moduleRoot) {
16986
16733
  return swiftCompileInputHash(input, release).update(swiftModuleDigest(moduleRoot)).digest("hex");
16987
16734
  }
16988
16735
  function swiftSdkArtifactHash(sourceHash, sdkImageKey) {
16989
- return createHash16("sha256").update(`${sourceHash}
16736
+ return createHash15("sha256").update(`${sourceHash}
16990
16737
  sdk module ${sdkImageKey}`).digest("hex");
16991
16738
  }
16992
16739
  function sha256Digest(value) {
16993
16740
  if (typeof Bun !== "undefined")
16994
16741
  return new Bun.CryptoHasher("sha256").update(value).digest();
16995
- return createHash16("sha256").update(value).digest();
16742
+ return createHash15("sha256").update(value).digest();
16996
16743
  }
16997
16744
  function swiftCompileInputHash(input, release) {
16998
- const hash = createHash16("sha256");
16745
+ const hash = createHash15("sha256");
16999
16746
  hash.update(`swift-compile
17000
16747
  ${release}
17001
16748
  `);
@@ -17207,7 +16954,7 @@ function emitSwiftPackageManifest(args) {
17207
16954
  ].join("\n") + "\n";
17208
16955
  distributionLinkPath = distributionLink.path.replace(
17209
16956
  /\.rsp$/,
17210
- `-${createHash16("sha256").update(list).digest("hex").slice(0, 12)}.rsp`
16957
+ `-${createHash15("sha256").update(list).digest("hex").slice(0, 12)}.rsp`
17211
16958
  );
17212
16959
  distributionLink.files.set(distributionLinkPath, list);
17213
16960
  }
@@ -17228,7 +16975,7 @@ function emitSwiftPackageManifest(args) {
17228
16975
  const endRun = () => {
17229
16976
  if (run2.length >= MODULE_MAP_RESPONSE_FILE_RUN) {
17230
16977
  const lines = run2.map((flag) => JSON.stringify(flag)).join("\n") + "\n";
17231
- const digest2 = createHash16("sha256").update(lines).digest("hex");
16978
+ const digest2 = createHash15("sha256").update(lines).digest("hex");
17232
16979
  const file2 = path23.join(args.root, ".peach-clang-arguments", `${digest2}.rsp`);
17233
16980
  args.files.set(file2, lines);
17234
16981
  flags.push(`@${file2}`);
@@ -17252,7 +16999,7 @@ function emitSwiftPackageManifest(args) {
17252
16999
  }
17253
17000
  endRun();
17254
17001
  const content = JSON.stringify(flags);
17255
- const digest = createHash16("sha256").update(content).digest("hex");
17002
+ const digest = createHash15("sha256").update(content).digest("hex");
17256
17003
  const file = path23.join(args.root, ".peach-manifest-arguments", `${digest}.json`);
17257
17004
  args.files.set(file, content);
17258
17005
  return `peachCompilerArguments(${JSON.stringify(file)})`;
@@ -17264,7 +17011,7 @@ function emitSwiftPackageManifest(args) {
17264
17011
  const macros = compactSwiftClangDefines(swiftClangSearchArguments(flags));
17265
17012
  const compact = args.coalescibleOverlays ? compactSwiftClangOverlays(macros, args.coalescibleOverlays) : macros;
17266
17013
  const content = compact.map((flag) => JSON.stringify(flag)).join("\n") + "\n";
17267
- const digest = createHash16("sha256").update(content).digest("hex");
17014
+ const digest = createHash15("sha256").update(content).digest("hex");
17268
17015
  const file = path23.join(args.root, ".peach-swift-arguments", `${digest}.rsp`);
17269
17016
  args.files.set(file, content);
17270
17017
  return JSON.stringify([`@${file}`]);
@@ -18967,7 +18714,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
18967
18714
  if (moduleContents !== originalContents)
18968
18715
  podHeaderOwnership.push([
18969
18716
  modulemap,
18970
- createHash16("sha256").update(moduleContents).digest("hex")
18717
+ createHash15("sha256").update(moduleContents).digest("hex")
18971
18718
  ]);
18972
18719
  const framework = nativeC && moduleMapTokens(moduleContents.toString())[0] === "framework" ? /^(.*)\/[^/]+\.framework\/Modules\/module\.modulemap$/.exec(modulemap) : null;
18973
18720
  const frameworkDirectory = framework ? path23.join(layout2.root, framework[1]) : void 0;
@@ -19031,7 +18778,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
19031
18778
  )
19032
18779
  ];
19033
18780
  const moduleFlag = perFile.some((flag) => flag.startsWith("-fmodule-name=")) ? [] : [`-fmodule-name=${swiftTargetModuleName(target.name)}`];
19034
- const identity = createHash16("sha256").update(
18781
+ const identity = createHash15("sha256").update(
19035
18782
  JSON.stringify([
19036
18783
  cxx,
19037
18784
  quoteDirs,
@@ -19395,7 +19142,7 @@ module ${moduleName}.Swift {
19395
19142
  ])
19396
19143
  rmSync7(cache, { recursive: true, force: true });
19397
19144
  files.set(frameworkSearchRecord, frameworkSearch);
19398
- const modulePlan = createHash16("sha256").update(
19145
+ const modulePlan = createHash15("sha256").update(
19399
19146
  swiftModuleInputFiles(moduleRoot).join("\n")
19400
19147
  );
19401
19148
  if (!distribution) {
@@ -19404,7 +19151,7 @@ module ${moduleName}.Swift {
19404
19151
  modulePlan.update(
19405
19152
  Object.keys(input.files).filter((file) => file.endsWith(".swift")).sort().join("\n")
19406
19153
  );
19407
- const resourcePlan = createHash16("sha256").update(
19154
+ const resourcePlan = createHash15("sha256").update(
19408
19155
  JSON.stringify(
19409
19156
  resourceTargets.filter((target) => target.resources).map((target) => [
19410
19157
  target.name,
@@ -19717,7 +19464,7 @@ ${entry}`);
19717
19464
  );
19718
19465
  for (const [target, data] of Object.entries(input.libraries ?? {})) {
19719
19466
  const bytes = Buffer.from(data, "base64");
19720
- const digest = createHash16("sha256").update(bytes).digest("hex");
19467
+ const digest = createHash15("sha256").update(bytes).digest("hex");
19721
19468
  if (input.binaryModules?.[target] && packageTargets.has(target)) {
19722
19469
  const objects = path23.join(
19723
19470
  layout2.root,
@@ -20415,19 +20162,19 @@ function readCompiledArtifact(directory, hash) {
20415
20162
  return null;
20416
20163
  const bytes = readFileSync13(path23.join(directory, "app.wasm"));
20417
20164
  const gzip2 = readFileSync13(path23.join(directory, "icu.gz"));
20418
- if (createHash16("sha256").update(bytes).digest("hex") !== receipt.wasm || createHash16("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length <= 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
20165
+ if (createHash15("sha256").update(bytes).digest("hex") !== receipt.wasm || createHash15("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length <= 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
20419
20166
  return null;
20420
20167
  if (!("sdk" in receipt)) return null;
20421
20168
  const image = receipt.sdk;
20422
20169
  if (!isRecord(image) || typeof image.key !== "string" || typeof image.sha256 !== "string" || typeof image.binding !== "string" || typeof image.liveSlots !== "string")
20423
20170
  return null;
20424
20171
  const binding = readFileSync13(path23.join(directory, "sdk-binding.bin"));
20425
- if (createHash16("sha256").update(binding).digest("hex") !== image.binding) return null;
20172
+ if (createHash15("sha256").update(binding).digest("hex") !== image.binding) return null;
20426
20173
  const liveSlots = readFileSync13(path23.join(directory, "sdk-live-slots.bin"));
20427
- if (createHash16("sha256").update(liveSlots).digest("hex") !== image.liveSlots)
20174
+ if (createHash15("sha256").update(liveSlots).digest("hex") !== image.liveSlots)
20428
20175
  return null;
20429
20176
  const appLink = typeof image.appLink === "string" ? readFileSync13(path23.join(directory, "app-link.json.gz")) : void 0;
20430
- if (appLink && createHash16("sha256").update(appLink).digest("hex") !== image.appLink)
20177
+ if (appLink && createHash15("sha256").update(appLink).digest("hex") !== image.appLink)
20431
20178
  return null;
20432
20179
  const sdk = {
20433
20180
  key: image.key,
@@ -20461,14 +20208,14 @@ function saveCompiledArtifact(root, artifact) {
20461
20208
  path23.join(pending, "artifact.json"),
20462
20209
  JSON.stringify({
20463
20210
  hash: artifact.hash,
20464
- wasm: createHash16("sha256").update(artifact.bytes).digest("hex"),
20211
+ wasm: createHash15("sha256").update(artifact.bytes).digest("hex"),
20465
20212
  icu: artifact.icu.sha256,
20466
20213
  sdk: artifact.sdk && {
20467
20214
  key: artifact.sdk.key,
20468
20215
  sha256: artifact.sdk.sha256,
20469
20216
  binding: artifact.sdk.binding.sha256,
20470
- appLink: appLink && createHash16("sha256").update(appLink).digest("hex"),
20471
- liveSlots: createHash16("sha256").update(artifact.sdk.binding.liveSlots).digest("hex")
20217
+ appLink: appLink && createHash15("sha256").update(appLink).digest("hex"),
20218
+ liveSlots: createHash15("sha256").update(artifact.sdk.binding.liveSlots).digest("hex")
20472
20219
  }
20473
20220
  })
20474
20221
  );
@@ -20850,7 +20597,7 @@ function frameworkHeaderContext(moduleRoot, products) {
20850
20597
  if (/\.(?:h|hh|hpp|hxx|inc|def|modulemap|apinotes)$/.test(rel)) files.push(rel);
20851
20598
  }
20852
20599
  }
20853
- return createHash16("sha256").update(JSON.stringify([[...products].sort(), files.sort()])).digest("hex");
20600
+ return createHash15("sha256").update(JSON.stringify([[...products].sort(), files.sort()])).digest("hex");
20854
20601
  }
20855
20602
  function shellQuote(value) {
20856
20603
  return `'${value.replaceAll("'", "'\\''")}'`;
@@ -20918,7 +20665,7 @@ async function buildFrameworkProducts(scratch, args, allowWrite) {
20918
20665
  const unoptimized = args.input.unoptimized === true;
20919
20666
  const sdkOptions = swiftCompileSdkOptions(args.moduleRoot, args.toolchainBin);
20920
20667
  const selectorOptions = swiftObjCSelectorOptions(args.moduleRoot);
20921
- const receiptKeyFor = (products) => createHash16("sha256").update(
20668
+ const receiptKeyFor = (products) => createHash15("sha256").update(
20922
20669
  JSON.stringify([
20923
20670
  "framework-products/v2",
20924
20671
  args.frameworkKey,
@@ -21495,7 +21242,7 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
21495
21242
  return stagedModule;
21496
21243
  }
21497
21244
  function swiftLinkStamp(args) {
21498
- const hash = createHash16("sha256");
21245
+ const hash = createHash15("sha256");
21499
21246
  hash.update(`swift-link/v1
21500
21247
  ${args.frameworkKey}
21501
21248
  `);
@@ -21606,7 +21353,7 @@ async function compileSwiftProjectOnce(sources, options) {
21606
21353
  const distribution = swiftDistributionAt(moduleRoot);
21607
21354
  const mirrorDistribution = options.linkOnly || options.project ? null : distribution;
21608
21355
  if (distribution) refreshSwiftCacheHold(moduleRoot);
21609
- const input = distribution && !options.intermediates ? (await import("./swift-package-prebuilt-NUAEDMSQ.mjs")).useSwiftPackagePrebuilts(
21356
+ const input = distribution && !options.intermediates ? (await import("./swift-package-prebuilt-MJSFHIOP.mjs")).useSwiftPackagePrebuilts(
21610
21357
  sources,
21611
21358
  moduleRoot,
21612
21359
  options.toolchainBin
@@ -21619,7 +21366,7 @@ async function compileSwiftProjectOnce(sources, options) {
21619
21366
  sources: path23.join(root, "Sources", "App"),
21620
21367
  multi: compileTargets(input).length > 0
21621
21368
  };
21622
- const sdkImage = options.linkOnly ? void 0 : await (await import("./swift-sdk-image-Y6XT7KI4.mjs")).buildSwiftSdkImage(
21369
+ const sdkImage = options.linkOnly ? void 0 : await (await import("./swift-sdk-image-MIWPBZEN.mjs")).buildSwiftSdkImage(
21623
21370
  moduleRoot,
21624
21371
  !!guestGraph,
21625
21372
  distribution ? [] : linkedFrameworkTargets(moduleRoot, input).imports,
@@ -21663,8 +21410,8 @@ async function compileSwiftProjectOnce(sources, options) {
21663
21410
  input.optimize === true,
21664
21411
  input.unoptimized === true
21665
21412
  ] : null;
21666
- const compatShape = compatShapeParts ? createHash16("sha256").update(JSON.stringify(compatShapeParts)).digest("hex").slice(0, 16) : "";
21667
- const exactShape = compatShapeParts ? createHash16("sha256").update(
21413
+ const compatShape = compatShapeParts ? createHash15("sha256").update(JSON.stringify(compatShapeParts)).digest("hex").slice(0, 16) : "";
21414
+ const exactShape = compatShapeParts ? createHash15("sha256").update(
21668
21415
  JSON.stringify([...compatShapeParts, Object.keys(input.files).sort()])
21669
21416
  ).digest("hex").slice(0, 16) : "";
21670
21417
  const buildShape = compatShapeParts ? `${exactShape}
@@ -22185,17 +21932,17 @@ ${compatShape}` : "";
22185
21932
  }
22186
21933
  const receipt = path23.join(
22187
21934
  checkpoints,
22188
- createHash16("sha256").update(target).digest("hex")
21935
+ createHash15("sha256").update(target).digest("hex")
22189
21936
  );
22190
21937
  const headers = producers.map(headerPaths);
22191
21938
  for (const header of headers)
22192
21939
  if (existsSync9(header.original)) publishHeader(header);
22193
21940
  const fingerprint = () => {
22194
- const digest = createHash16("sha256").update(recipe);
21941
+ const digest = createHash15("sha256").update(recipe);
22195
21942
  for (const { original, emitted } of headers) {
22196
21943
  if (!existsSync9(original) || !existsSync9(emitted)) return;
22197
21944
  digest.update(
22198
- createHash16("sha256").update(readFileSync13(emitted)).digest()
21945
+ createHash15("sha256").update(readFileSync13(emitted)).digest()
22199
21946
  );
22200
21947
  }
22201
21948
  return digest.digest("hex");
@@ -22358,7 +22105,7 @@ ${compatShape}` : "";
22358
22105
  });
22359
22106
  sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
22360
22107
  } else {
22361
- const { buildSwiftAppModule } = await import("./swift-sdk-app-module-P3BARE2W.mjs");
22108
+ const { buildSwiftAppModule } = await import("./swift-sdk-app-module-ZIN3LFLS.mjs");
22362
22109
  const binding = await buildSwiftAppModule({
22363
22110
  buildRoot: root2,
22364
22111
  toolchainBin: options.toolchainBin,