peachsim 0.1.2623 → 0.1.2625

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 (140) 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 +1023 -621
  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-E6V72TM2.mjs → acorn-SHZZDBSI.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-EIOVKQ2C.mjs → chunk-2LDG7OD4.mjs} +5 -5
  28. package/dist-lib/esm-chunks/{chunk-ISH6XB23.mjs → chunk-3XZGWT62.mjs} +1 -1
  29. package/dist-lib/esm-chunks/{chunk-Q7KCK4YO.mjs → chunk-6PZI7TYE.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-RLWITQ5C.mjs → chunk-7Z7YJ4FU.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-4GNQG2GT.mjs → chunk-A4R4YGFJ.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-GP3KL2GC.mjs → chunk-A66VNSO6.mjs} +565 -290
  33. package/dist-lib/esm-chunks/{chunk-XOAOND7F.mjs → chunk-DVMKYLDN.mjs} +9 -8
  34. package/dist-lib/esm-chunks/{chunk-IGB7TRLS.mjs → chunk-F4YHL4UM.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-4BJIJ3GP.mjs → chunk-JRU2VXUU.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-EI7CZDMR.mjs → chunk-JVEJLPJC.mjs} +2 -2
  37. package/dist-lib/esm-chunks/{chunk-UCW7ITXE.mjs → chunk-KA4AQDVF.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-RLWTJ6II.mjs → chunk-LJYNZ5HM.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-RBXTTEI6.mjs → chunk-M2FEKSK3.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-KPG4FUTY.mjs → chunk-OCCZJOSA.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-CXNXKUNJ.mjs → chunk-P542MMIN.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-NOM66H2G.mjs → chunk-Q5NI4L3Z.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-V2CHR3OI.mjs → chunk-R4FFTWPL.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-W3X7RP3H.mjs → chunk-RJWEWNAJ.mjs} +3 -3
  45. package/dist-lib/esm-chunks/{chunk-B5OQSD4B.mjs → chunk-RXXCTHJG.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-B4APPUTT.mjs → chunk-SRIRVPNX.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-6MNE57DC.mjs → chunk-ULHG6CND.mjs} +22 -13
  48. package/dist-lib/esm-chunks/{chunk-PAEJF2JP.mjs → chunk-W4HQINQ6.mjs} +4 -4
  49. package/dist-lib/esm-chunks/{chunk-RVM3WWST.mjs → chunk-XQBHCWS4.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-Q4ZATFEN.mjs → chunk-Z6AH6AQC.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{metro-layout-parser-OHVROLNJ.mjs → metro-layout-parser-GJHR7FCR.mjs} +3 -3
  52. package/dist-lib/esm-chunks/{swift-package-prebuilt-DRAUK6KR.mjs → swift-package-prebuilt-UVRGKTD4.mjs} +12 -12
  53. package/dist-lib/esm-chunks/{swift-sdk-app-module-U2M7CMKA.mjs → swift-sdk-app-module-U3MUJ7QD.mjs} +107 -20
  54. package/dist-lib/esm-chunks/{swift-sdk-image-ZHWSHCNI.mjs → swift-sdk-image-U4W7QMAT.mjs} +16 -18
  55. package/dist-lib/esm-chunks/{swift-sdk-image-producer-EOJUCK7N.mjs → swift-sdk-image-producer-TFFZDNRK.mjs} +5 -5
  56. package/dist-lib/expo-swift-bundle.cjs +918 -516
  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 +1025 -623
  61. package/dist-lib/host/fetch-proxy-handler.cjs +10 -9
  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 +33 -17
  75. package/dist-lib/native-app-identity-project.mjs +44 -29
  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 +69 -64
  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 +1062 -660
  95. package/dist-lib/swift-compile.cjs +708 -336
  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/package.json +1 -1
  123. package/src/bazel-project.ts +34 -18
  124. package/src/binaryen.lock.json +3 -3
  125. package/src/swift-compile.ts +8 -0
  126. package/src/swift-distribution-contract.ts +6 -1
  127. package/src/swift-distribution.lock.json +4 -2
  128. package/src/swift-guest-compile.ts +170 -160
  129. package/src/swift-guest-dyld-table.ts +22 -9
  130. package/src/swift-guest-link.ts +116 -42
  131. package/src/swift-guest-linked-spans.ts +63 -14
  132. package/src/swift-guest-projection-storage.ts +7 -6
  133. package/src/swift-guest-source-inputs.ts +35 -21
  134. package/src/swift-objc-compile.ts +1 -0
  135. package/src/swift-sdk-app-module.ts +118 -15
  136. package/src/swift-sdk-image-recipe.ts +20 -0
  137. package/src/swift-sdk-image-wasm.ts +119 -17
  138. package/src/swift-sdk-image.ts +6 -5
  139. package/src/swift-wasm-prune.ts +71 -41
  140. package/src/wasm-narrow-boundary.ts +31 -6
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2623 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2625 | (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;
@@ -17999,13 +17999,13 @@ var init_swift_standin_digest = __esm({
17999
17999
  ];
18000
18000
  RUNTIME_IMPORT = /(?:^|[;\n])[ \t]*(?:import|export)\s+(?!type(?:\s|\{))([\s\S]*?)\s+from\s*['"]([^'"]+)['"]|(?:^|[;\n])[ \t]*import\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
18001
18001
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS, STANDIN_DIGEST_EXCLUDED_FILES);
18002
- STANDIN_SOURCE_DIGEST = true ? "434280be603d7288671556bd3927e00632cd94beab9d58010000add5587f959b" : standinSourceDigest();
18002
+ STANDIN_SOURCE_DIGEST = true ? "c87e0b7f1ae69b2a4e76611266612d6218f81a3244e592800c02f78c4f8e48f6" : standinSourceDigest();
18003
18003
  }
18004
18004
  });
18005
18005
 
18006
18006
  // src/expo-native-compiler-digest.ts
18007
18007
  function expoNativeCompilerDigestValue() {
18008
- return true ? "9a5ff08be82d73a20a55678e521c09380974dc2204df641f1bd49dc8c06f1f83" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
18008
+ return true ? "a46618eade53d31c53a3c6377fc86635c03dbcfedd5e131d38b77d9fcc366623" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
18009
18009
  }
18010
18010
  var import_node_crypto17;
18011
18011
  var init_expo_native_compiler_digest = __esm({
@@ -22205,12 +22205,13 @@ function parseSwiftDistributionLock(value) {
22205
22205
  if (runtime === void 0) return void 0;
22206
22206
  if (!isRecord(runtime) || typeof runtime.source !== "string" || !/^[a-f0-9]{64}$/.test(runtime.source) || typeof runtime.url !== "string" || !/^https:\/\/[a-z0-9.-]+(?::\d+)?\/compile\/asset\/[a-f0-9]{64}$/.test(
22207
22207
  runtime.url
22208
- ) || runtime.dataPlan !== void 0 && (typeof runtime.dataPlan !== "string" || !/^[a-f0-9]{64}$/.test(runtime.dataPlan)))
22208
+ ) || runtime.dataPlan !== void 0 && (typeof runtime.dataPlan !== "string" || !/^[a-f0-9]{64}$/.test(runtime.dataPlan)) || runtime.recipe !== void 0 && (typeof runtime.recipe !== "string" || !/^[a-f0-9]{16}$/.test(runtime.recipe)))
22209
22209
  throw new Error("invalid shared SDK runtime publication in Swift distribution lock");
22210
22210
  return {
22211
22211
  source: runtime.source,
22212
22212
  url: runtime.url,
22213
- ...runtime.dataPlan && { dataPlan: runtime.dataPlan }
22213
+ ...runtime.dataPlan && { dataPlan: runtime.dataPlan },
22214
+ ...runtime.recipe && { recipe: runtime.recipe }
22214
22215
  };
22215
22216
  };
22216
22217
  const sdkRuntime = publication(value.sdkRuntime);
@@ -23241,6 +23242,15 @@ function guestLinkedSpans(map2, before, after, owners, sectionOwners = /* @__PUR
23241
23242
  const unchanged = before === after;
23242
23243
  const original = layout(before, !unchanged, !importsLayout);
23243
23244
  const optimized = unchanged ? original : layout(after, true, !importsLayout);
23245
+ if (extra?.optimizedDataSegments) {
23246
+ for (const segment2 of optimized.data) {
23247
+ extra.optimizedDataSegments.push({
23248
+ address: segment2.address,
23249
+ offset: segment2.bytes.byteOffset - after.byteOffset,
23250
+ length: segment2.bytes.length
23251
+ });
23252
+ }
23253
+ }
23244
23254
  const collectSymbols = extra?.collectSymbols;
23245
23255
  const trackedObject = extra?.trackedObject;
23246
23256
  const trackedObjectOwner = extra?.trackedObjectOwner;
@@ -23409,12 +23419,39 @@ function guestLinkedSpans(map2, before, after, owners, sectionOwners = /* @__PUR
23409
23419
  }
23410
23420
  return result;
23411
23421
  };
23422
+ const singleSegmentSlice = (module2, start, length) => {
23423
+ const segs = module2.dataByAddress;
23424
+ let low = 0;
23425
+ let high = segs.length;
23426
+ while (low < high) {
23427
+ const middle = low + high >> 1;
23428
+ if (segs[middle].maximumEnd <= start) low = middle + 1;
23429
+ else high = middle;
23430
+ }
23431
+ let found;
23432
+ const end = start + length;
23433
+ for (let index = low; index < segs.length; index++) {
23434
+ const segment2 = segs[index];
23435
+ if (segment2.address >= end) break;
23436
+ if (segment2.address + segment2.bytes.length > start) {
23437
+ if (found) return void 0;
23438
+ found = segment2;
23439
+ }
23440
+ }
23441
+ if (!found || found.address > start || found.address + found.bytes.length < end)
23442
+ return void 0;
23443
+ return found.bytes.subarray(start - found.address, end - found.address);
23444
+ };
23445
+ const sameDataAt = (start, length) => {
23446
+ const origSlice = singleSegmentSlice(original, start, length);
23447
+ const optSlice = origSlice ? singleSegmentSlice(optimized, start, length) : void 0;
23448
+ if (origSlice && optSlice) return Buffer.compare(origSlice, optSlice) === 0;
23449
+ return dataAt(original, start, length).equals(dataAt(optimized, start, length));
23450
+ };
23412
23451
  for (const span of spans) {
23413
23452
  if (span.address + span.length > original.memoryBytes || span.address + span.length > optimized.memoryBytes)
23414
23453
  throw new Error(`linked data lies outside guest memory at ${span.address}`);
23415
- if (!unchanged && !dataAt(original, span.address, span.length).equals(
23416
- dataAt(optimized, span.address, span.length)
23417
- ))
23454
+ if (!unchanged && !sameDataAt(span.address, span.length))
23418
23455
  throw new Error(`optimization changed linked data at ${span.address}`);
23419
23456
  }
23420
23457
  let previous;
@@ -23548,7 +23585,7 @@ function takeGuestStartupData(wasm, address, length) {
23548
23585
  const bytes = new Uint8Array(length);
23549
23586
  const emptied = /* @__PURE__ */ new Set();
23550
23587
  let covered = 0;
23551
- const result = Buffer.from(wasm);
23588
+ const patchedBody = Buffer.from(wasm.subarray(body[0], body[1]));
23552
23589
  for (const initializer of startupDataInitializers(wasm.subarray(...body))) {
23553
23590
  const end = initializer.address + initializer.length;
23554
23591
  if (end <= address || initializer.address >= address + length || !initializer.length)
@@ -23563,19 +23600,18 @@ function takeGuestStartupData(wasm, address, length) {
23563
23600
  covered += segment2.length;
23564
23601
  emptied.add(initializer.segment);
23565
23602
  const [at, immediateEnd] = initializer.lengthImmediate;
23566
- result.fill(128, body[0] + at, body[0] + immediateEnd - 1);
23567
- result[body[0] + immediateEnd - 1] = 0;
23603
+ patchedBody.fill(128, at, immediateEnd - 1);
23604
+ patchedBody[immediateEnd - 1] = 0;
23568
23605
  }
23569
23606
  if (covered !== length)
23570
23607
  throw new Error("guest startup data does not initialize the whole range");
23571
- const parts = [result.subarray(0, data[0])];
23572
- const payload = [result.subarray(data[1], segments[0].header)];
23608
+ const payload = [wasm.subarray(data[1], segments[0].header)];
23573
23609
  for (const [index, segment2] of segments.entries()) {
23574
23610
  if (!emptied.has(index)) {
23575
- payload.push(result.subarray(segment2.header, segment2.payload + segment2.length));
23611
+ payload.push(wasm.subarray(segment2.header, segment2.payload + segment2.length));
23576
23612
  continue;
23577
23613
  }
23578
- payload.push(result.subarray(segment2.header, segment2.sizeAt), Uint8Array.of(0));
23614
+ payload.push(wasm.subarray(segment2.header, segment2.sizeAt), Uint8Array.of(0));
23579
23615
  }
23580
23616
  const section2 = Buffer.concat(payload);
23581
23617
  const size2 = [];
@@ -23586,7 +23622,14 @@ function takeGuestStartupData(wasm, address, length) {
23586
23622
  }
23587
23623
  size2.push(rest % 128 | 128);
23588
23624
  }
23589
- parts.push(Uint8Array.of(11, ...size2), section2, result.subarray(data[2]));
23625
+ const parts = [
23626
+ wasm.subarray(0, body[0]),
23627
+ patchedBody,
23628
+ wasm.subarray(body[1], data[0]),
23629
+ Uint8Array.of(11, ...size2),
23630
+ section2,
23631
+ wasm.subarray(data[2])
23632
+ ];
23590
23633
  return { wasm: Buffer.concat(parts), bytes };
23591
23634
  }
23592
23635
  var import_node_fs43, import_node_string_decoder, constant;
@@ -23895,6 +23938,32 @@ function readImports(bytes, imports2) {
23895
23938
  }
23896
23939
  return { functionTypes, importedGlobals, memoryPages };
23897
23940
  }
23941
+ function countImportedFunctions(bytes, imports2) {
23942
+ let count = 0;
23943
+ if (!imports2) return count;
23944
+ const r = wasmReader(bytes, imports2.start);
23945
+ for (let n = r.u(); n > 0; n--) {
23946
+ r.skip(r.u());
23947
+ r.skip(r.u());
23948
+ const kind = r.byte();
23949
+ if (kind === 0) {
23950
+ r.u();
23951
+ count++;
23952
+ } else if (kind === 1) {
23953
+ r.byte();
23954
+ skipLimits(r);
23955
+ } else if (kind === 2) {
23956
+ skipLimits(r);
23957
+ } else if (kind === 3) {
23958
+ r.byte();
23959
+ r.byte();
23960
+ } else if (kind === 4) {
23961
+ r.byte();
23962
+ r.u();
23963
+ } else throw new Error(`unknown wasm import kind ${kind}`);
23964
+ }
23965
+ return count;
23966
+ }
23898
23967
  function* readFunctionNames(bytes, names) {
23899
23968
  for (const r = wasmReader(bytes, names.start); r.at < names.end; ) {
23900
23969
  const id = r.byte();
@@ -24262,28 +24331,73 @@ function codeOnlySdkImage(bytes, constructorMask) {
24262
24331
  return Buffer.concat(out);
24263
24332
  }
24264
24333
  function constructorKeys(map2, bytes) {
24265
- const m = readModule(bytes);
24266
24334
  const first = map2.code[0];
24267
- if (!first || !m.bodies.length) throw new Error("link has no code");
24268
- const prefixes = m.bodies.map(({ prefix }) => prefix);
24269
- const delta = prefixes[0] - first.offset;
24270
- const byOffset = new Map(map2.code.map((chunk) => [chunk.offset + delta, chunk]));
24335
+ if (!first) throw new Error("link has no code");
24336
+ const sections = wasmSections(bytes);
24337
+ const code = sections.find((s) => s.id === 10);
24338
+ if (!code) throw new Error("link has no code");
24271
24339
  const ctors = map2.code.find((chunk) => chunk.section === "__wasm_call_ctors");
24272
24340
  if (!ctors) throw new Error("link has no constructors");
24273
- const index = prefixes.indexOf(ctors.offset + delta);
24274
- if (index < 0) throw new Error("constructor function not found by map offset");
24275
- const body = m.bodies[index];
24276
- const r = wasmReader(bytes, body.start);
24341
+ const importedFuncs = countImportedFunctions(
24342
+ bytes,
24343
+ sections.find((s) => s.id === 2)
24344
+ );
24345
+ const codeReader = wasmReader(bytes, code.start);
24346
+ const bodyCount = codeReader.u();
24347
+ if (!bodyCount) throw new Error("link has no code");
24348
+ const prefixes = new Uint32Array(bodyCount);
24349
+ let delta = 0;
24350
+ let ctorPrefix = -1;
24351
+ let ctorStart = -1;
24352
+ let ctorEnd = -1;
24353
+ for (let i = 0; i < bodyCount; i++) {
24354
+ const prefix = codeReader.at;
24355
+ const size2 = codeReader.u();
24356
+ prefixes[i] = prefix;
24357
+ if (i === 0) {
24358
+ delta = prefix - first.offset;
24359
+ ctorPrefix = ctors.offset + delta;
24360
+ }
24361
+ if (prefix === ctorPrefix) {
24362
+ ctorStart = codeReader.at;
24363
+ ctorEnd = ctorStart + size2;
24364
+ }
24365
+ codeReader.skip(size2);
24366
+ }
24367
+ if (ctorStart < 0) throw new Error("constructor function not found by map offset");
24368
+ let sorted2 = true;
24369
+ for (let i = 1; i < map2.code.length; i++) {
24370
+ if (map2.code[i].offset < map2.code[i - 1].offset) {
24371
+ sorted2 = false;
24372
+ break;
24373
+ }
24374
+ }
24375
+ const byOffset = sorted2 ? void 0 : new Map(map2.code.map((chunk) => [chunk.offset + delta, chunk]));
24376
+ const findChunk = (targetPrefix) => {
24377
+ if (byOffset) return byOffset.get(targetPrefix);
24378
+ const targetOffset = targetPrefix - delta;
24379
+ let lo = 0;
24380
+ let hi = map2.code.length - 1;
24381
+ while (lo <= hi) {
24382
+ const mid = lo + hi >> 1;
24383
+ const offset = map2.code[mid].offset;
24384
+ if (offset < targetOffset) lo = mid + 1;
24385
+ else if (offset > targetOffset) hi = mid - 1;
24386
+ else return map2.code[mid];
24387
+ }
24388
+ return void 0;
24389
+ };
24390
+ const r = wasmReader(bytes, ctorStart);
24277
24391
  for (let n = r.u(); n > 0; n--) {
24278
24392
  r.u();
24279
24393
  r.byte();
24280
24394
  }
24281
24395
  const keys = [];
24282
- while (r.at < body.end) {
24396
+ while (r.at < ctorEnd) {
24283
24397
  const op = r.byte();
24284
24398
  if (op === 16) {
24285
- const callee = r.u() - m.importedFuncs;
24286
- const chunk = byOffset.get(prefixes[callee]);
24399
+ const callee = r.u() - importedFuncs;
24400
+ const chunk = callee >= 0 && callee < bodyCount ? findChunk(prefixes[callee]) : void 0;
24287
24401
  if (!chunk) throw new Error("constructor without a map chunk");
24288
24402
  keys.push(chunkKey(chunk, ""));
24289
24403
  } else if (op !== 26 && op !== 11) throw new Error(`constructor op ${op}`);
@@ -24366,7 +24480,10 @@ function relocationEdges(bytes, segmentAddress) {
24366
24480
  r.skip(r.u());
24367
24481
  }
24368
24482
  }
24369
- const importedFunctions = readModule(bytes).importedFuncs;
24483
+ const importedFunctions = countImportedFunctions(
24484
+ bytes,
24485
+ sections.find((s) => s.id === 2)
24486
+ );
24370
24487
  const data = [];
24371
24488
  const dataFunctions = [];
24372
24489
  const bodyCount = bodyStarts.length;
@@ -24480,9 +24597,30 @@ function strongDefinitions(bytes) {
24480
24597
  ).map((s) => s.name);
24481
24598
  }
24482
24599
  function unslottedFunctions(bytes) {
24483
- const m = readModule(bytes);
24484
- const slotted = new Set([...m.slots.keys()].filter((index) => index >= m.importedFuncs));
24485
- return m.bodies.length - slotted.size;
24600
+ const sections = wasmSections(bytes);
24601
+ const importedFuncs = countImportedFunctions(
24602
+ bytes,
24603
+ sections.find((s) => s.id === 2)
24604
+ );
24605
+ const code = sections.find((s) => s.id === 10);
24606
+ const definedFuncs = code ? wasmReader(bytes, code.start).u() : 0;
24607
+ const slotted = /* @__PURE__ */ new Set();
24608
+ const elements = sections.find((s) => s.id === 9);
24609
+ if (elements) {
24610
+ const r = wasmReader(bytes, elements.start);
24611
+ for (let n = r.u(); n > 0; n--) {
24612
+ const flags = r.u();
24613
+ if (flags !== 0 && flags !== 2) throw new Error(`sdk image element flags ${flags}`);
24614
+ if (flags === 2) r.u();
24615
+ constant2(r);
24616
+ if (flags === 2) r.byte();
24617
+ for (let i = 0, count = r.u(); i < count; i++) {
24618
+ const index = r.u();
24619
+ if (index >= importedFuncs) slotted.add(index);
24620
+ }
24621
+ }
24622
+ }
24623
+ return definedFuncs - slotted.size;
24486
24624
  }
24487
24625
  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;
24488
24626
  var init_swift_sdk_image_wasm = __esm({
@@ -24866,6 +25004,11 @@ var init_swiftRuntimeProductContract = __esm({
24866
25004
  });
24867
25005
 
24868
25006
  // src/swift-wasm-prune.ts
25007
+ function sha256Hex(bytes) {
25008
+ if (typeof Bun !== "undefined")
25009
+ return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
25010
+ return (0, import_node_crypto24.createHash)("sha256").update(bytes).digest("hex");
25011
+ }
24869
25012
  function readULEB2(b, o) {
24870
25013
  let res = 0;
24871
25014
  let shift = 0;
@@ -25618,6 +25761,42 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
25618
25761
  }
25619
25762
  }
25620
25763
  }
25764
+ const segObjCClasses = /* @__PURE__ */ new Map();
25765
+ for (let segIdx = 0; segIdx < sEnds.length; segIdx++) {
25766
+ const rangeStart = dataStart + sPayloadStarts[segIdx];
25767
+ const rangeEnd = dataStart + sEnds[segIdx];
25768
+ const sliceLen = rangeEnd - rangeStart;
25769
+ if (sliceLen < 4) continue;
25770
+ const slice = Buffer.from(rawBuf.buffer, rawBuf.byteOffset + rangeStart, sliceLen);
25771
+ let segPos = 0;
25772
+ let classes;
25773
+ while (segPos < sliceLen - 3) {
25774
+ const at = slice.indexOf("So", segPos);
25775
+ if (at < 0 || at >= sliceLen - 2) break;
25776
+ let digitEnd = at + 2;
25777
+ let length = 0;
25778
+ while (digitEnd < sliceLen) {
25779
+ const ch = slice[digitEnd];
25780
+ if (ch < 48 || ch > 57) break;
25781
+ length = length * 10 + (ch - 48);
25782
+ digitEnd++;
25783
+ }
25784
+ if (digitEnd === at + 2) {
25785
+ segPos = at + 2;
25786
+ continue;
25787
+ }
25788
+ segPos = digitEnd;
25789
+ const nameEnd = digitEnd + length;
25790
+ if (nameEnd >= sliceLen || slice[nameEnd] !== 67) continue;
25791
+ const symbol2 = `._OBJC_CLASS_${slice.toString("latin1", digitEnd, nameEnd)}`;
25792
+ if (!classes) {
25793
+ classes = [symbol2];
25794
+ segObjCClasses.set(segIdx, classes);
25795
+ } else if (!classes.includes(symbol2)) {
25796
+ classes.push(symbol2);
25797
+ }
25798
+ }
25799
+ }
25621
25800
  return {
25622
25801
  file,
25623
25802
  isDist,
@@ -25647,10 +25826,7 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
25647
25826
  objcCategoryTargets,
25648
25827
  rootFuncs,
25649
25828
  rootSegs,
25650
- segPayloadRanges: sEnds.map((end, i) => [
25651
- dataStart + sPayloadStarts[i],
25652
- dataStart + end
25653
- ])
25829
+ segObjCClasses
25654
25830
  };
25655
25831
  }
25656
25832
  function parseWasmObjectFile(file, isDist) {
@@ -26018,16 +26194,26 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
26018
26194
  transformations.set(file, {
26019
26195
  output,
26020
26196
  inputSha256,
26021
- outputSha256: (0, import_node_crypto24.createHash)("sha256").update(result).digest("hex"),
26197
+ outputSha256: sha256Hex(result),
26022
26198
  kind
26023
26199
  });
26024
26200
  };
26025
26201
  const distFiles = [];
26026
26202
  const distBaseNames = /* @__PURE__ */ new Set();
26027
26203
  const eagerFiles = [];
26204
+ const parsedBuildObjects = /* @__PURE__ */ new Map();
26028
26205
  const lazyBuildObjects = /* @__PURE__ */ new Map();
26029
26206
  const extraArchiveObjs = [];
26030
26207
  const objectBytes = /* @__PURE__ */ new Map();
26208
+ const archiveMembers = /* @__PURE__ */ new Map();
26209
+ const readArchiveMembers = (archive) => {
26210
+ let members2 = archiveMembers.get(archive);
26211
+ if (!members2) {
26212
+ members2 = readArMembers(new Uint8Array(import_node_fs44.default.readFileSync(archive)));
26213
+ archiveMembers.set(archive, members2);
26214
+ }
26215
+ return members2;
26216
+ };
26031
26217
  let inStartLib = false;
26032
26218
  let swiftrtOrigPath = "";
26033
26219
  for (const t of tokens2) {
@@ -26064,8 +26250,10 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
26064
26250
  break;
26065
26251
  }
26066
26252
  }
26067
- if (definesObjCClassOrCategory) eagerFiles.push(t);
26068
- else lazyBuildObjects.set(t, obj);
26253
+ if (definesObjCClassOrCategory) {
26254
+ parsedBuildObjects.set(t, obj);
26255
+ eagerFiles.push(t);
26256
+ } else lazyBuildObjects.set(t, obj);
26069
26257
  } else {
26070
26258
  eagerFiles.push(t);
26071
26259
  }
@@ -26073,7 +26261,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
26073
26261
  lazyBuildObjects.set(t, parseWasmObjectFile(t, false));
26074
26262
  }
26075
26263
  } else if (!inStartLib && t.endsWith(".a") && !t.endsWith("libclang_rt.builtins-wasm64.a") && import_node_fs44.default.existsSync(t)) {
26076
- const members2 = readArMembers(new Uint8Array(import_node_fs44.default.readFileSync(t)));
26264
+ const members2 = readArchiveMembers(t);
26077
26265
  for (const m of members2) {
26078
26266
  const object8 = parseWasmObjectBytes(`${t}(${m.name})`, m.bytes, false);
26079
26267
  extraArchiveObjs.push(object8);
@@ -26096,7 +26284,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
26096
26284
  );
26097
26285
  const archiveOverlapsDist = (archive) => {
26098
26286
  if (!import_node_fs44.default.existsSync(archive)) return false;
26099
- const members2 = readArMembers(new Uint8Array(import_node_fs44.default.readFileSync(archive)));
26287
+ const members2 = readArchiveMembers(archive);
26100
26288
  return members2.some((m) => distBaseNames.has(m.name));
26101
26289
  };
26102
26290
  for (const t of tokens2) {
@@ -26118,7 +26306,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
26118
26306
  import_node_path43.default.basename(archive)
26119
26307
  );
26120
26308
  const ordinals = /* @__PURE__ */ new Map();
26121
- for (const m of readArMembers(new Uint8Array(import_node_fs44.default.readFileSync(archive)))) {
26309
+ for (const m of readArchiveMembers(archive)) {
26122
26310
  const ordinal = (ordinals.get(m.name) ?? 0) + 1;
26123
26311
  ordinals.set(m.name, ordinal);
26124
26312
  if (distBaseNames.has(m.name) || writtenLeftovers.has(m.name)) continue;
@@ -26152,7 +26340,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
26152
26340
  recordTransformation(
26153
26341
  swiftrtOrigPath,
26154
26342
  patchedSwiftrtPath,
26155
- link ? (0, import_node_crypto24.createHash)("sha256").update(input).digest("hex") : "",
26343
+ link ? sha256Hex(input) : "",
26156
26344
  result,
26157
26345
  "swiftrt"
26158
26346
  );
@@ -26639,7 +26827,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
26639
26827
  }
26640
26828
  for (const f of eagerFiles) {
26641
26829
  const isDist = f.startsWith(distDir);
26642
- const obj = distObjs.get(f) ?? parseWasmObjectFile(f, isDist);
26830
+ const obj = distObjs.get(f) ?? parsedBuildObjects.get(f) ?? parseWasmObjectFile(f, isDist);
26643
26831
  extractObject(obj);
26644
26832
  if (isDist) {
26645
26833
  const base = import_node_path43.default.basename(f);
@@ -26689,32 +26877,9 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
26689
26877
  "$s10Foundation6BundleC22preferredLocalizations4fromSaySSGAF_tFZTf4nd_n"
26690
26878
  ]);
26691
26879
  const keepObjCClassesNamedInSegment = (obj, segIdx) => {
26692
- const range3 = obj.segPayloadRanges[segIdx];
26693
- if (!range3) return;
26694
- const [rangeStart, rangeEnd] = range3;
26695
- if (rangeEnd - rangeStart < 4) return;
26696
- let bytes = objectBytes.get(obj);
26697
- if (!bytes) objectBytes.set(obj, bytes = import_node_fs44.default.readFileSync(obj.file));
26698
- let pos = rangeStart;
26699
- while (pos < rangeEnd - 3) {
26700
- const at = bytes.indexOf("So", pos);
26701
- if (at < 0 || at >= rangeEnd - 2) break;
26702
- let digitEnd = at + 2;
26703
- let length = 0;
26704
- while (digitEnd < rangeEnd) {
26705
- const ch = bytes[digitEnd];
26706
- if (ch < 48 || ch > 57) break;
26707
- length = length * 10 + (ch - 48);
26708
- digitEnd++;
26709
- }
26710
- if (digitEnd === at + 2) {
26711
- pos = at + 2;
26712
- continue;
26713
- }
26714
- pos = digitEnd;
26715
- const nameEnd = digitEnd + length;
26716
- if (nameEnd >= rangeEnd || bytes[nameEnd] !== 67) continue;
26717
- const symbol2 = `._OBJC_CLASS_${bytes.toString("latin1", digitEnd, nameEnd)}`;
26880
+ const symbols = obj.segObjCClasses.get(segIdx);
26881
+ if (!symbols) return;
26882
+ for (const symbol2 of symbols) {
26718
26883
  for (const provider of lazyProviders.get(symbol2) ?? []) {
26719
26884
  eagerDynamicObjects.add(provider);
26720
26885
  extractObject(provider);
@@ -26810,7 +26975,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
26810
26975
  const cached2 = objectBytes.get(obj);
26811
26976
  const buf = cached2 ? new Uint8Array(cached2) : new Uint8Array(import_node_fs44.default.readFileSync(obj.file));
26812
26977
  const rawBuf = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
26813
- const inputSha256 = link ? (0, import_node_crypto24.createHash)("sha256").update(buf).digest("hex") : "";
26978
+ const inputSha256 = link ? sha256Hex(buf) : "";
26814
26979
  const fLive = liveFuncs.get(obj);
26815
26980
  const sLive = liveSegs.get(obj);
26816
26981
  const dLive = liveDataSyms.get(obj);
@@ -29064,13 +29229,34 @@ function dropWasmCustomSection(bytes, name3) {
29064
29229
  }
29065
29230
  return Buffer.concat(parts);
29066
29231
  }
29232
+ function writeWasmCustomSections(bytes, entries2) {
29233
+ if (entries2.length === 0) return Buffer.concat([bytes]);
29234
+ const replaced = new Set(entries2.map(([name3]) => name3));
29235
+ const parts = [];
29236
+ let sliceStart = 0;
29237
+ let sliceEnd = 8;
29238
+ for (const { id, start, end } of wasmSections2(bytes)) {
29239
+ if (id === 0 && replaced.has(readWasmSection(bytes, start, end).name())) {
29240
+ if (sliceEnd > sliceStart) parts.push(bytes.subarray(sliceStart, sliceEnd));
29241
+ sliceStart = end;
29242
+ sliceEnd = end;
29243
+ } else {
29244
+ sliceEnd = end;
29245
+ }
29246
+ }
29247
+ if (sliceEnd > sliceStart) parts.push(bytes.subarray(sliceStart, sliceEnd));
29248
+ for (const [name3, data] of entries2) {
29249
+ const nameBytes = Buffer.from(encodeWasmName(name3));
29250
+ parts.push(
29251
+ Buffer.from([0, ...encodeWasmNumber(nameBytes.length + data.length)]),
29252
+ nameBytes,
29253
+ data
29254
+ );
29255
+ }
29256
+ return Buffer.concat(parts);
29257
+ }
29067
29258
  function writeWasmCustomSection(bytes, name3, data) {
29068
- const section2 = Buffer.concat([Buffer.from(encodeWasmName(name3)), data]);
29069
- return Buffer.concat([
29070
- dropWasmCustomSection(bytes, name3),
29071
- Buffer.from([0, ...encodeWasmNumber(section2.length)]),
29072
- section2
29073
- ]);
29259
+ return writeWasmCustomSections(bytes, [[name3, data]]);
29074
29260
  }
29075
29261
  function readWasmMemory(bytes) {
29076
29262
  return readWasmMemoryAndTableImports(bytes, wasmSections2(bytes)).memory;
@@ -29342,6 +29528,16 @@ var init_wasm_narrow_boundary = __esm({
29342
29528
  });
29343
29529
 
29344
29530
  // src/swift-guest-dyld-table.ts
29531
+ function sha256Buffer(bytes) {
29532
+ if (typeof Bun !== "undefined")
29533
+ return Buffer.from(new Bun.CryptoHasher("sha256").update(bytes).digest());
29534
+ return (0, import_node_crypto27.createHash)("sha256").update(bytes).digest();
29535
+ }
29536
+ function sha256Hex2(bytes) {
29537
+ if (typeof Bun !== "undefined")
29538
+ return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
29539
+ return (0, import_node_crypto27.createHash)("sha256").update(bytes).digest("hex");
29540
+ }
29345
29541
  function uleb3(value) {
29346
29542
  const bytes = [];
29347
29543
  for (let rest = value; ; rest = Math.floor(rest / 128)) {
@@ -29376,7 +29572,7 @@ function encodeGuestDyldTable(rows) {
29376
29572
  }
29377
29573
  const file = Buffer.concat(packs);
29378
29574
  const header = Buffer.alloc(40 + packs.length * 8);
29379
- (0, import_node_crypto27.createHash)("sha256").update(file).digest().copy(header, 0);
29575
+ sha256Buffer(file).copy(header, 0);
29380
29576
  header.writeUInt32LE(file.length, 32);
29381
29577
  header.writeUInt32LE(packs.length, 36);
29382
29578
  let offset = 0;
@@ -29388,11 +29584,11 @@ function encodeGuestDyldTable(rows) {
29388
29584
  const names = firsts.flatMap((name3) => [name3, Buffer.of(0)]);
29389
29585
  return { index: Buffer.concat([header, ...names]), packs: file };
29390
29586
  }
29391
- function moveGuestDyldTable(map2, wasm, symbols, bindingValues = /* @__PURE__ */ new Map()) {
29587
+ function moveGuestDyldTable(map2, wasm, symbols, bindingValues = /* @__PURE__ */ new Map(), extraSections = []) {
29392
29588
  const range3 = guestDyldValueRange(map2);
29393
29589
  if (!range3) {
29394
29590
  if (symbols.length) throw new Error("link map has no dyld values");
29395
- return wasm;
29591
+ return extraSections.length ? writeWasmCustomSections(wasm, extraSections) : wasm;
29396
29592
  }
29397
29593
  if (range3.length !== symbols.length * 8)
29398
29594
  throw new Error("linked dyld values do not match the ledger rows");
@@ -29407,11 +29603,11 @@ function moveGuestDyldTable(map2, wasm, symbols, bindingValues = /* @__PURE__ */
29407
29603
  return binding === void 0 ? { name: name3, image, kind: 0, value: view.getBigUint64(index2 * 8, true) } : { name: name3, image, kind: 1, value: BigInt(binding) };
29408
29604
  });
29409
29605
  const { index, packs } = encodeGuestDyldTable(rows);
29410
- return writeWasmCustomSection(
29411
- writeWasmCustomSection(taken.wasm, NATIVE_DYLD_TABLE_SECTION, index),
29412
- NATIVE_DYLD_PACKS_SECTION,
29413
- packs
29414
- );
29606
+ return writeWasmCustomSections(taken.wasm, [
29607
+ [NATIVE_DYLD_TABLE_SECTION, index],
29608
+ [NATIVE_DYLD_PACKS_SECTION, packs],
29609
+ ...extraSections
29610
+ ]);
29415
29611
  }
29416
29612
  function guestDyldValueRange(map2) {
29417
29613
  const suffix = `:(${GUEST_DYLD_VALUES_SECTION})`;
@@ -29440,7 +29636,7 @@ function splitSwiftDyldTable(wasm) {
29440
29636
  const bytes = Buffer.from(packs);
29441
29637
  return {
29442
29638
  module: dropWasmCustomSection(wasm, NATIVE_DYLD_PACKS_SECTION),
29443
- table: { sha256: (0, import_node_crypto27.createHash)("sha256").update(bytes).digest("hex"), bytes }
29639
+ table: { sha256: sha256Hex2(bytes), bytes }
29444
29640
  };
29445
29641
  }
29446
29642
  var import_node_crypto27, import_node_zlib3, PACK_BYTES;
@@ -29976,6 +30172,7 @@ function finalizeGuestProjectionStorage(options2) {
29976
30172
  const owner = options2.owners.get(options2.projectionObject);
29977
30173
  if (owner === void 0) throw new Error("guest projection object has no image owner");
29978
30174
  const ranges = [];
30175
+ const data = [];
29979
30176
  const spans = guestLinkedSpans(
29980
30177
  options2.map,
29981
30178
  options2.linked,
@@ -29986,7 +30183,8 @@ function finalizeGuestProjectionStorage(options2) {
29986
30183
  {
29987
30184
  trackedObject: options2.projectionObject,
29988
30185
  trackedObjectOwner: owner,
29989
- trackedLinearSpans: ranges
30186
+ trackedLinearSpans: ranges,
30187
+ optimizedDataSegments: data
29990
30188
  }
29991
30189
  );
29992
30190
  const images = planGuestProjectionRegions(
@@ -29995,7 +30193,6 @@ function finalizeGuestProjectionStorage(options2) {
29995
30193
  options2.sdkSpans ? [...spans, ...options2.sdkSpans] : spans
29996
30194
  );
29997
30195
  const result = Buffer.from(options2.optimized);
29998
- const data = guestWasmDataSegments(options2.optimized, options2.sdkSpans === void 0);
29999
30196
  const locations = /* @__PURE__ */ new Map();
30000
30197
  const counts = /* @__PURE__ */ new Map();
30001
30198
  const uuids = /* @__PURE__ */ new Map();
@@ -30669,17 +30866,17 @@ var init_binaryen_lock = __esm({
30669
30866
  "linux-x64": {
30670
30867
  asset: "x86_64-linux",
30671
30868
  upstreamSha256: "195ddc94f9bc89f45abdabb0b9eea86023d727ba90eac8b35b80f2544fc30572",
30672
- sha256: "1024974f254c1c2edd738246ec6af5add16d3d36b5f58a94545febda3b33c869"
30869
+ sha256: "40062fb1ebbad7f04f361c1e3bb309dffb1d2318dd2e12235a0e7e820e18d6c9"
30673
30870
  },
30674
30871
  "linux-arm64": {
30675
30872
  asset: "aarch64-linux",
30676
30873
  upstreamSha256: "c58562417836c5d0493d89bdefc434933bdc097db641b483df86bcfa557a107f",
30677
- sha256: "7dedfc9f5cb32e75a28831f3b5aa053fd3e0bdd74f73dc4d1b1588947236daef"
30874
+ sha256: "d79b09d5b66f62f9e4bb691517b174b42bcdc0b7f40769d1993b7c565b0a54c7"
30678
30875
  },
30679
30876
  "darwin-arm64": {
30680
30877
  asset: "arm64-macos",
30681
30878
  upstreamSha256: "98aad827847af7ef990ed7098d885725c8e5b5aae75073403635617ae4e259aa",
30682
- sha256: "0b56e0a06b6a873877871537a120fd94e2121e67f4bce5f8b5252c47b615854a"
30879
+ sha256: "29342632a4fa52466c4feea846698fe5aa56ff46226a914d60b65b8735373d63"
30683
30880
  }
30684
30881
  }
30685
30882
  };
@@ -31173,6 +31370,7 @@ function outputPath(args) {
31173
31370
  }
31174
31371
  function withOutput(args, output, discovery) {
31175
31372
  const result = [];
31373
+ let stripsDebug = false;
31176
31374
  for (let i = 0; i < args.length; i++) {
31177
31375
  const arg = args[i];
31178
31376
  if (arg === "-o" || arg === "--output") {
@@ -31182,9 +31380,12 @@ function withOutput(args, output, discovery) {
31182
31380
  if (arg.startsWith("--output=")) continue;
31183
31381
  if (discovery && (arg.startsWith("--why-extract=") || arg.startsWith("--Map=")))
31184
31382
  continue;
31383
+ if (arg === "--strip-debug" || arg === "-S" || arg === "--strip-all" || arg === "-s")
31384
+ stripsDebug = true;
31185
31385
  result.push(arg);
31186
31386
  }
31187
31387
  if (discovery) result.push("--allow-multiple-definition");
31388
+ if (!stripsDebug) result.push("--strip-debug");
31188
31389
  result.push("-o", output);
31189
31390
  return result;
31190
31391
  }
@@ -31215,6 +31416,37 @@ async function linkGuestImages(options2) {
31215
31416
  }
31216
31417
  return import_node_fs49.default.readFileSync(trace, "utf8");
31217
31418
  };
31419
+ const runLinkAsync = async (name3, arguments_) => {
31420
+ const response = import_node_path47.default.join(directory2, `${name3}.rsp`);
31421
+ const trace = import_node_path47.default.join(directory2, `${name3}-inputs.txt`);
31422
+ import_node_fs49.default.writeFileSync(
31423
+ response,
31424
+ [...arguments_, "--trace"].map((argument2) => JSON.stringify(argument2)).join(" ")
31425
+ );
31426
+ const output = import_node_fs49.default.openSync(trace, "w");
31427
+ try {
31428
+ await new Promise((resolve3, reject) => {
31429
+ const child = (0, import_node_child_process25.spawn)(wasmLd, [`@${response}`], {
31430
+ stdio: ["ignore", output, "pipe"]
31431
+ });
31432
+ const stderr = [];
31433
+ child.stderr?.on("data", (chunk) => stderr.push(chunk));
31434
+ child.once("error", reject);
31435
+ child.once("close", (code, signal) => {
31436
+ if (code === 0) resolve3();
31437
+ else
31438
+ reject(
31439
+ new Error(
31440
+ `wasm-ld (${name3}) failed (${signal ?? code}): ${Buffer.concat(stderr).toString("utf8")}`
31441
+ )
31442
+ );
31443
+ });
31444
+ });
31445
+ } finally {
31446
+ import_node_fs49.default.closeSync(output);
31447
+ }
31448
+ return import_node_fs49.default.readFileSync(trace, "utf8");
31449
+ };
31218
31450
  const preselection = options2.projection && options2.preselectionDiscovery ? options2.preselectionDiscovery : void 0;
31219
31451
  let discoveryProjection;
31220
31452
  if (options2.projection) {
@@ -31444,6 +31676,7 @@ async function linkGuestImages(options2) {
31444
31676
  };
31445
31677
  const ledgerObjectPromise = compileLedgerAsync("ledger", ledger.llvmIR);
31446
31678
  const appLedgerObjectPromise = options2.onSplitInputs && ledger.appLLVMIR ? compileLedgerAsync("app-ledger", ledger.appLLVMIR) : void 0;
31679
+ let deferredFinalLink;
31447
31680
  try {
31448
31681
  const replacements = /* @__PURE__ */ new Map();
31449
31682
  const linkedOwners = /* @__PURE__ */ new Map();
@@ -31545,7 +31778,7 @@ async function linkGuestImages(options2) {
31545
31778
  });
31546
31779
  const finalOutput = import_node_path47.default.join(directory2, "final.wasm");
31547
31780
  const finalWhy = import_node_path47.default.join(directory2, "final-why-extract.txt");
31548
- const linkFinal = (projectionObject2, layoutMap) => runLink("final", [
31781
+ const finalLinkArgs = (projectionObject2, layoutMap) => [
31549
31782
  ...withOutput(finalArgs, finalOutput, false),
31550
31783
  ledgerObject,
31551
31784
  `@${lazyExports}`,
@@ -31553,10 +31786,38 @@ async function linkGuestImages(options2) {
31553
31786
  ...provider ? [`--undefined=${providerSymbol}`] : [],
31554
31787
  ...layoutMap ? [`--Map=${layoutMap}`] : [],
31555
31788
  `--why-extract=${finalWhy}`
31556
- ]);
31789
+ ];
31790
+ const linkFinal = (projectionObject2, layoutMap) => runLink("final", finalLinkArgs(projectionObject2, layoutMap));
31791
+ const finalizeFinalLink = (trace) => {
31792
+ const finalSelection = selectedGuestLinkInputs(
31793
+ remapGuestLinkPlan(plan, replacements),
31794
+ finalArgs,
31795
+ import_node_fs49.default.readFileSync(finalWhy, "utf8"),
31796
+ trace,
31797
+ finalArchives
31798
+ );
31799
+ const original = new Map(
31800
+ [...replacements].map(([before2, after2]) => [after2, before2])
31801
+ );
31802
+ const key2 = (item) => JSON.stringify([original.get(item.artifact) ?? item.artifact, item.member]);
31803
+ const before = new Set(selected.map(key2));
31804
+ const after = new Set(finalSelection.map(key2));
31805
+ const changed = [...before].filter((item) => !after.has(item));
31806
+ changed.push(...[...after].filter((item) => !before.has(item)));
31807
+ if (changed.length)
31808
+ throw new Error(
31809
+ `guest link selected different inputs after rewriting:
31810
+ ${changed.join("\n")}`
31811
+ );
31812
+ import_node_fs49.default.renameSync(finalOutput, outputPath(args));
31813
+ if (KEEP_WASM_NAMES)
31814
+ import_node_fs49.default.writeFileSync(
31815
+ outputPath(args),
31816
+ nameGuestImageAliases(import_node_fs49.default.readFileSync(outputPath(args)), plan.symbols)
31817
+ );
31818
+ };
31557
31819
  let projectionObject;
31558
31820
  let projectionStorage;
31559
- let finalTrace;
31560
31821
  if (options2.projection) {
31561
31822
  const projection = options2.projection;
31562
31823
  if (!plan.images.some((image) => image.id === projection.image))
@@ -31609,8 +31870,18 @@ async function linkGuestImages(options2) {
31609
31870
  [...projection.clangOptions, "-c", projectionSource, "-o", projectionObject],
31610
31871
  { stdio: "pipe" }
31611
31872
  );
31612
- finalTrace = linkFinal(projectionObject, callerMap ? void 0 : layoutMap);
31613
- if (sharedSdk) break;
31873
+ if (sharedSdk && options2.onFinalLink && options2.onSplitInputs && appLedgerObjectPromise) {
31874
+ deferredFinalLink = runLinkAsync(
31875
+ "final",
31876
+ finalLinkArgs(projectionObject, callerMap ? void 0 : layoutMap)
31877
+ ).then((trace) => finalizeFinalLink(trace));
31878
+ break;
31879
+ }
31880
+ const finalTrace = linkFinal(projectionObject, callerMap ? void 0 : layoutMap);
31881
+ if (sharedSdk) {
31882
+ finalizeFinalLink(finalTrace);
31883
+ break;
31884
+ }
31614
31885
  const wasm = import_node_fs49.default.readFileSync(finalOutput);
31615
31886
  const actual = guestProjectionRegionCounts(
31616
31887
  images.length,
@@ -31622,38 +31893,17 @@ async function linkGuestImages(options2) {
31622
31893
  sectionOwners
31623
31894
  )
31624
31895
  );
31625
- if (actual.every((count, index) => count <= capacities[index].regions)) break;
31896
+ if (actual.every((count, index) => count <= capacities[index].regions)) {
31897
+ finalizeFinalLink(finalTrace);
31898
+ break;
31899
+ }
31626
31900
  capacities = capacities.map((capacity, index) => ({
31627
31901
  ...capacity,
31628
31902
  regions: Math.max(actual[index], capacity.regions)
31629
31903
  }));
31630
31904
  }
31631
31905
  linkedOwners.set(projectionObject, projection.image);
31632
- } else finalTrace = linkFinal();
31633
- const finalSelection = selectedGuestLinkInputs(
31634
- remapGuestLinkPlan(plan, replacements),
31635
- finalArgs,
31636
- import_node_fs49.default.readFileSync(finalWhy, "utf8"),
31637
- finalTrace,
31638
- finalArchives
31639
- );
31640
- const original = new Map([...replacements].map(([before2, after2]) => [after2, before2]));
31641
- const key2 = (item) => JSON.stringify([original.get(item.artifact) ?? item.artifact, item.member]);
31642
- const before = new Set(selected.map(key2));
31643
- const after = new Set(finalSelection.map(key2));
31644
- const changed = [...before].filter((item) => !after.has(item));
31645
- changed.push(...[...after].filter((item) => !before.has(item)));
31646
- if (changed.length)
31647
- throw new Error(
31648
- `guest link selected different inputs after rewriting:
31649
- ${changed.join("\n")}`
31650
- );
31651
- import_node_fs49.default.renameSync(finalOutput, outputPath(args));
31652
- if (KEEP_WASM_NAMES)
31653
- import_node_fs49.default.writeFileSync(
31654
- outputPath(args),
31655
- nameGuestImageAliases(import_node_fs49.default.readFileSync(outputPath(args)), plan.symbols)
31656
- );
31906
+ } else finalizeFinalLink(linkFinal());
31657
31907
  if (projectionStorage && projectionObject)
31658
31908
  options2.projection.onReserved(projectionStorage, projectionObject);
31659
31909
  options2.onLinkedOwners?.(linkedOwners);
@@ -31689,11 +31939,13 @@ ${changed.join("\n")}`
31689
31939
  appDefinedSymbols
31690
31940
  });
31691
31941
  }
31942
+ if (deferredFinalLink) options2.onFinalLink?.(deferredFinalLink);
31692
31943
  return selected;
31693
31944
  } catch (error) {
31694
31945
  await Promise.allSettled([
31695
31946
  ledgerObjectPromise,
31696
- ...appLedgerObjectPromise ? [appLedgerObjectPromise] : []
31947
+ ...appLedgerObjectPromise ? [appLedgerObjectPromise] : [],
31948
+ ...deferredFinalLink ? [deferredFinalLink] : []
31697
31949
  ]);
31698
31950
  throw error;
31699
31951
  }
@@ -32325,6 +32577,7 @@ async function linkPrunedGuestImages(options2) {
32325
32577
  identities: aliasGuestLinkIdentities(identities, prepared.archives)
32326
32578
  };
32327
32579
  }
32580
+ let finalLinkDone;
32328
32581
  const selected = await linkCompleteGuestImages({
32329
32582
  plan,
32330
32583
  args: [...linkedArgs, `--Map=${options2.mapPath}`],
@@ -32338,6 +32591,9 @@ async function linkPrunedGuestImages(options2) {
32338
32591
  resolvePlan: options2.resolvePlan,
32339
32592
  sharedSdk: options2.sharedSdk,
32340
32593
  onSplitInputs: options2.onSplitInputs,
32594
+ onFinalLink: options2.deferFinalLink ? (done) => {
32595
+ finalLinkDone = done;
32596
+ } : void 0,
32341
32597
  onDyldRows: options2.onDyldRows,
32342
32598
  onLinkedOwners: (value) => {
32343
32599
  owners = value;
@@ -32351,7 +32607,8 @@ async function linkPrunedGuestImages(options2) {
32351
32607
  owners,
32352
32608
  generatedSectionOwners,
32353
32609
  sdk: sdk2,
32354
- mapPath: options2.mapPath
32610
+ mapPath: options2.mapPath,
32611
+ finalLinkDone
32355
32612
  };
32356
32613
  }
32357
32614
  var import_node_child_process25, import_node_fs49, import_node_path47, import_node_util6, execFileAsync, WASM_MAGIC, BITCODE_MAGIC;
@@ -32420,8 +32677,13 @@ function clangBinaryStamp(file) {
32420
32677
  const stat = (0, import_node_fs50.statSync)(file, { bigint: true });
32421
32678
  return [file, stat.size, stat.mtimeNs].join(":");
32422
32679
  }
32680
+ function sha256Hex3(bytes) {
32681
+ if (typeof Bun !== "undefined")
32682
+ return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
32683
+ return (0, import_node_crypto31.createHash)("sha256").update(bytes).digest("hex");
32684
+ }
32423
32685
  function clangWrapperStamp(file) {
32424
- return (0, import_node_crypto31.createHash)("sha256").update((0, import_node_fs50.readFileSync)(file)).digest("hex");
32686
+ return sha256Hex3((0, import_node_fs50.readFileSync)(file));
32425
32687
  }
32426
32688
  function clangArgsNeedCwd(args) {
32427
32689
  const pathFlags = /* @__PURE__ */ new Set([
@@ -32571,22 +32833,35 @@ function sourceGuestClangLinkOptions(options2) {
32571
32833
  "SOURCE_DATE_EPOCH"
32572
32834
  ].map((name3) => process.env[name3] ?? "");
32573
32835
  const replays = [];
32836
+ const realPathCache = /* @__PURE__ */ new Map();
32837
+ const cachedRealpath = (file) => {
32838
+ let resolved = realPathCache.get(file);
32839
+ if (resolved === void 0) {
32840
+ resolved = (0, import_node_fs50.realpathSync)(file);
32841
+ realPathCache.set(file, resolved);
32842
+ }
32843
+ return resolved;
32844
+ };
32845
+ const resolvedSwiftCompiler = cachedRealpath(options2.swiftCompiler);
32574
32846
  let clang;
32847
+ let clangWrapper;
32575
32848
  let clangStamp;
32576
32849
  let wrapperStamp;
32577
32850
  for (const file of wanted) {
32578
32851
  const command = commands.get(file);
32579
32852
  if (!command) throw new Error(`missing source object producer ${file}`);
32580
32853
  if (command.tool === "shell") {
32581
- if (!command.args.length || (0, import_node_fs50.realpathSync)(command.args[0]) !== (0, import_node_fs50.realpathSync)(options2.swiftCompiler))
32854
+ if (!command.args.length || cachedRealpath(command.args[0]) !== resolvedSwiftCompiler)
32582
32855
  throw new Error(`unsupported source object producer ${file}`);
32583
32856
  continue;
32584
32857
  }
32585
- const compiler = command.args[0] ? (0, import_node_fs50.realpathSync)(command.args[0]) : "";
32586
- clang ??= (0, import_node_fs50.realpathSync)(import_node_path48.default.join(options2.toolchainBin, "clang"));
32587
- if (command.tool !== "clang" || compiler !== clang && compiler !== (0, import_node_fs50.realpathSync)(import_node_path48.default.join(options2.buildDirectory, CLANG_TARGET_MODULE_WRAPPER)))
32858
+ const compiler = command.args[0] ? cachedRealpath(command.args[0]) : "";
32859
+ clang ??= cachedRealpath(import_node_path48.default.join(options2.toolchainBin, "clang"));
32860
+ if (command.tool !== "clang" || compiler !== clang && compiler !== (clangWrapper ??= cachedRealpath(
32861
+ import_node_path48.default.join(options2.buildDirectory, CLANG_TARGET_MODULE_WRAPPER)
32862
+ )))
32588
32863
  throw new Error(`unsupported source object producer ${file}`);
32589
- const key2 = (0, import_node_crypto31.createHash)("sha256").update(
32864
+ const key2 = sha256Hex3(
32590
32865
  JSON.stringify([
32591
32866
  "clang-link-options/v2",
32592
32867
  clangArgsNeedCwd(command.args) ? process.cwd() : null,
@@ -32596,11 +32871,8 @@ function sourceGuestClangLinkOptions(options2) {
32596
32871
  compiler === clang ? null : wrapperStamp ??= clangWrapperStamp(compiler),
32597
32872
  clangProducerStamp(file)
32598
32873
  ])
32599
- ).digest("hex");
32600
- const cacheFile = import_node_path48.default.join(
32601
- cacheDirectory,
32602
- (0, import_node_crypto31.createHash)("sha256").update(file).digest("hex") + ".json"
32603
32874
  );
32875
+ const cacheFile = import_node_path48.default.join(cacheDirectory, sha256Hex3(file) + ".json");
32604
32876
  const cached2 = readClangLinkOptions(cacheFile, key2);
32605
32877
  if (cached2) {
32606
32878
  validateClangLinkOptions(cached2);
@@ -37725,6 +37997,21 @@ var init_swift_root_lock = __esm({
37725
37997
  }
37726
37998
  });
37727
37999
 
38000
+ // src/swift-sdk-image-recipe.ts
38001
+ var import_node_crypto37, SWIFT_SDK_IMAGE_VERSION, swiftSdkImageScope, SWIFT_SDK_IMAGE_RECIPE;
38002
+ var init_swift_sdk_image_recipe = __esm({
38003
+ "src/swift-sdk-image-recipe.ts"() {
38004
+ "use strict";
38005
+ import_node_crypto37 = require("node:crypto");
38006
+ init_wasm_optimize();
38007
+ SWIFT_SDK_IMAGE_VERSION = 13;
38008
+ swiftSdkImageScope = (scopedLookups) => scopedLookups ? "guest image scopes 9\n" : "unscoped constructor order 1\n";
38009
+ SWIFT_SDK_IMAGE_RECIPE = (0, import_node_crypto37.createHash)("sha256").update(`swift-sdk-image
38010
+ ${SWIFT_SDK_IMAGE_VERSION}
38011
+ `).update(WASM_LOWER_IDENTITY).update(swiftSdkImageScope(false)).update(swiftSdkImageScope(true)).digest("hex").slice(0, 16);
38012
+ }
38013
+ });
38014
+
37728
38015
  // src/swift-sdk-image-producer.ts
37729
38016
  var swift_sdk_image_producer_exports = {};
37730
38017
  __export(swift_sdk_image_producer_exports, {
@@ -37765,7 +38052,7 @@ function applySwiftSdkProducerEnvironment(environment) {
37765
38052
  }
37766
38053
  }
37767
38054
  function writeSwiftSdkProducerResult(file, launchId, error) {
37768
- const temporary = `${file}.${(0, import_node_crypto37.randomUUID)()}`;
38055
+ const temporary = `${file}.${(0, import_node_crypto38.randomUUID)()}`;
37769
38056
  (0, import_node_fs59.writeFileSync)(temporary, JSON.stringify({ launchId, error: error ?? null }));
37770
38057
  (0, import_node_fs59.renameSync)(temporary, file);
37771
38058
  }
@@ -37877,7 +38164,7 @@ async function produceSwiftSdkImage(input) {
37877
38164
  }
37878
38165
  }
37879
38166
  const repo = import_node_path57.default.resolve(input.moduleRoot, "../..");
37880
- const launchId = (0, import_node_crypto37.randomUUID)();
38167
+ const launchId = (0, import_node_crypto38.randomUUID)();
37881
38168
  const directory3 = import_node_path57.default.join(root, launchId);
37882
38169
  const requestFile = import_node_path57.default.join(directory3, "request.json");
37883
38170
  const sessionFile2 = import_node_path57.default.join(directory3, "session");
@@ -37975,12 +38262,12 @@ async function produceSwiftSdkImage(input) {
37975
38262
  await (0, import_promises6.setTimeout)(2e3, void 0, { signal: input.signal });
37976
38263
  }
37977
38264
  }
37978
- var import_node_child_process33, import_node_crypto37, import_node_fs59, import_node_path57, import_promises6, import_node_util9, run3, environmentNames, launcher;
38265
+ var import_node_child_process33, import_node_crypto38, import_node_fs59, import_node_path57, import_promises6, import_node_util9, run3, environmentNames, launcher;
37979
38266
  var init_swift_sdk_image_producer = __esm({
37980
38267
  "src/swift-sdk-image-producer.ts"() {
37981
38268
  "use strict";
37982
38269
  import_node_child_process33 = require("node:child_process");
37983
- import_node_crypto37 = require("node:crypto");
38270
+ import_node_crypto38 = require("node:crypto");
37984
38271
  import_node_fs59 = require("node:fs");
37985
38272
  import_node_path57 = __toESM(require("node:path"), 1);
37986
38273
  import_promises6 = require("node:timers/promises");
@@ -38020,7 +38307,6 @@ __export(swift_sdk_image_exports, {
38020
38307
  SWIFT_SDK_APP_TABLE_BASE: () => SWIFT_SDK_APP_TABLE_BASE,
38021
38308
  SWIFT_SDK_IMAGE_BUNDLE: () => SWIFT_SDK_IMAGE_BUNDLE,
38022
38309
  SWIFT_SDK_IMAGE_FILES: () => SWIFT_SDK_IMAGE_FILES,
38023
- SWIFT_SDK_IMAGE_VERSION: () => SWIFT_SDK_IMAGE_VERSION,
38024
38310
  SWIFT_SDK_MEMORY_BASE: () => SWIFT_SDK_MEMORY_BASE,
38025
38311
  SWIFT_SDK_PIECE_FIELDS: () => SWIFT_SDK_PIECE_FIELDS,
38026
38312
  buildSwiftSdkImage: () => buildSwiftSdkImage,
@@ -38055,9 +38341,9 @@ function swiftSdkImageProducts(moduleRoot, frameworkImports2) {
38055
38341
  function swiftSdkImageKey(moduleRoot, scopedLookups = false, products = []) {
38056
38342
  const distribution = swiftDistributionAt(moduleRoot);
38057
38343
  const inputs2 = distribution ? swiftSdkDistributionInputs(distribution) : swiftModuleDigest(moduleRoot);
38058
- return (0, import_node_crypto38.createHash)("sha256").update(`swift-sdk-image
38344
+ return (0, import_node_crypto39.createHash)("sha256").update(`swift-sdk-image
38059
38345
  ${SWIFT_SDK_IMAGE_VERSION}
38060
- `).update(WASM_LOWER_IDENTITY).update(KEEP_WASM_NAMES ? "\nnames\n" : "\n").update(scopedLookups ? "guest image scopes 9\n" : "unscoped constructor order 1\n").update(inputs2).update(products.length === 0 ? "" : `
38346
+ `).update(WASM_LOWER_IDENTITY).update(KEEP_WASM_NAMES ? "\nnames\n" : "\n").update(swiftSdkImageScope(scopedLookups)).update(inputs2).update(products.length === 0 ? "" : `
38061
38347
  products ${products.join(" ")}`).digest("hex").slice(0, 32);
38062
38348
  }
38063
38349
  function swiftSdkImageEntry(key2, scopedLookups) {
@@ -38146,7 +38432,7 @@ async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkIm
38146
38432
  stage
38147
38433
  ]);
38148
38434
  const image = cached(stage, key2);
38149
- if (!image || (0, import_node_crypto38.createHash)("sha256").update((0, import_node_fs60.readFileSync)(image.image)).digest("hex") !== image.sha256)
38435
+ if (!image || (0, import_node_crypto39.createHash)("sha256").update((0, import_node_fs60.readFileSync)(image.image)).digest("hex") !== image.sha256)
38150
38436
  throw new Error(`invalid published Swift SDK image ${key2}`);
38151
38437
  (0, import_node_fs60.rmSync)(directory2, { recursive: true, force: true });
38152
38438
  (0, import_node_fs60.renameSync)(stage, directory2);
@@ -38355,6 +38641,7 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
38355
38641
  ].map((name3) => `--export=${name3}`),
38356
38642
  `@${import_node_path58.default.join(work, "exports.rsp")}`,
38357
38643
  "--gc-sections",
38644
+ "--strip-debug",
38358
38645
  // strings stay with their objects, so an app loads only the ones its pieces reference
38359
38646
  "-O0"
38360
38647
  ];
@@ -38415,7 +38702,7 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
38415
38702
  (0, import_node_fs60.writeFileSync)(import_node_path58.default.join(work, INTERFACE_FILE), JSON.stringify(sdkInterface));
38416
38703
  (0, import_node_fs60.writeFileSync)(
38417
38704
  import_node_path58.default.join(work, IMAGE_DIGEST),
38418
- (0, import_node_crypto38.createHash)("sha256").update(image).digest("hex")
38705
+ typeof Bun !== "undefined" ? new Bun.CryptoHasher("sha256").update(image).digest("hex") : (0, import_node_crypto39.createHash)("sha256").update(image).digest("hex")
38419
38706
  );
38420
38707
  if (swiftSdkImageKey(
38421
38708
  moduleRoot,
@@ -38684,12 +38971,12 @@ function readSwiftSdkManifest(image) {
38684
38971
  }));
38685
38972
  return setBoundedCache(cachedSdkManifests, cacheKey, { manifest, block: block2, segments });
38686
38973
  }
38687
- var import_node_child_process34, import_node_crypto38, import_node_fs60, import_node_path58, import_node_util10, run4, SWIFT_SDK_IMAGE_VERSION, SWIFT_SDK_APP_MEMORY_BASE, SWIFT_SDK_MEMORY_BASE, SWIFT_SDK_APP_TABLE_BASE, EMPTY_APP, IMAGE_TABLES, IMAGE_ENTRY, imageApp, IMAGE_FILE, IMAGE_DIGEST, swiftSdkImageFile, INTERFACE_FILE, MANIFEST_FILE, MANIFEST_DATA_FILE, SWIFT_SDK_IMAGE_FILES, SWIFT_SDK_IMAGE_BUNDLE, MAX_CACHED_SDK_IMAGES, cachedSdkInterfaces, cachedSdkManifestIndices, cachedSdkManifests, SWIFT_SDK_PIECE_FIELDS, MANIFEST_BLOCKS, isManifestBlock;
38974
+ var import_node_child_process34, import_node_crypto39, import_node_fs60, import_node_path58, import_node_util10, run4, SWIFT_SDK_APP_MEMORY_BASE, SWIFT_SDK_MEMORY_BASE, SWIFT_SDK_APP_TABLE_BASE, EMPTY_APP, IMAGE_TABLES, IMAGE_ENTRY, imageApp, IMAGE_FILE, IMAGE_DIGEST, swiftSdkImageFile, INTERFACE_FILE, MANIFEST_FILE, MANIFEST_DATA_FILE, SWIFT_SDK_IMAGE_FILES, SWIFT_SDK_IMAGE_BUNDLE, MAX_CACHED_SDK_IMAGES, cachedSdkInterfaces, cachedSdkManifestIndices, cachedSdkManifests, SWIFT_SDK_PIECE_FIELDS, MANIFEST_BLOCKS, isManifestBlock;
38688
38975
  var init_swift_sdk_image = __esm({
38689
38976
  "src/swift-sdk-image.ts"() {
38690
38977
  "use strict";
38691
38978
  import_node_child_process34 = require("node:child_process");
38692
- import_node_crypto38 = require("node:crypto");
38979
+ import_node_crypto39 = require("node:crypto");
38693
38980
  import_node_fs60 = require("node:fs");
38694
38981
  import_node_path58 = __toESM(require("node:path"), 1);
38695
38982
  import_node_util10 = require("node:util");
@@ -38701,13 +38988,13 @@ var init_swift_sdk_image = __esm({
38701
38988
  init_swift_root_lock();
38702
38989
  init_swift_sdk_guest_lookups();
38703
38990
  init_swift_sdk_image_map();
38991
+ init_swift_sdk_image_recipe();
38704
38992
  init_swift_sdk_image_wasm();
38705
38993
  init_swift_toolchain();
38706
38994
  init_swift_wasm_prune();
38707
38995
  init_swiftTargetContract();
38708
38996
  init_wasm_optimize();
38709
38997
  run4 = (0, import_node_util10.promisify)(import_node_child_process34.execFile);
38710
- SWIFT_SDK_IMAGE_VERSION = 13;
38711
38998
  SWIFT_SDK_APP_MEMORY_BASE = 8372224;
38712
38999
  SWIFT_SDK_MEMORY_BASE = 128 * 1024 * 1024;
38713
39000
  SWIFT_SDK_APP_TABLE_BASE = 524288;
@@ -38855,6 +39142,7 @@ __export(swift_sdk_app_module_exports, {
38855
39142
  readSwiftSdkUsage: () => readSwiftSdkUsage,
38856
39143
  selectSwiftSdkData: () => selectSwiftSdkData,
38857
39144
  swiftAppModuleInputs: () => swiftAppModuleInputs,
39145
+ swiftAppModuleThunkSection: () => swiftAppModuleThunkSection,
38858
39146
  swiftSdkProjectionSpans: () => swiftSdkProjectionSpans,
38859
39147
  writeSwiftSdkAppLink: () => writeSwiftSdkAppLink
38860
39148
  });
@@ -38906,9 +39194,12 @@ async function buildSwiftAppModule(options2) {
38906
39194
  linkage: link.linkage,
38907
39195
  usage
38908
39196
  });
38909
- (0, import_node_fs61.writeFileSync)(options2.output, finishSwiftAppModule((0, import_node_fs61.readFileSync)(options2.output)));
39197
+ finishSwiftAppModuleFile(options2.output);
38910
39198
  return binding;
38911
39199
  }
39200
+ function swiftAppModuleThunkSection(lowered) {
39201
+ return [NATIVE_SDK_THUNK_SECTION, sdkImportThunks(lowered)];
39202
+ }
38912
39203
  function finishSwiftAppModule(lowered) {
38913
39204
  return writeWasmCustomSection(
38914
39205
  lowered,
@@ -38916,6 +39207,73 @@ function finishSwiftAppModule(lowered) {
38916
39207
  sdkImportThunks(lowered)
38917
39208
  );
38918
39209
  }
39210
+ function finishSwiftAppModuleFile(file) {
39211
+ const fd = (0, import_node_fs61.openSync)(file, "r");
39212
+ let prefixEnd = 8;
39213
+ let hasExistingThunk = false;
39214
+ let prefix;
39215
+ try {
39216
+ const total = (0, import_node_fs61.fstatSync)(fd).size;
39217
+ const probe = Buffer.allocUnsafe(16);
39218
+ let offset = 8;
39219
+ while (offset < total) {
39220
+ const read = (0, import_node_fs61.readSync)(fd, probe, 0, Math.min(16, total - offset), offset);
39221
+ if (read < 2) break;
39222
+ const id = probe[0];
39223
+ let size2 = 0;
39224
+ let shift = 0;
39225
+ let at = 1;
39226
+ for (; ; ) {
39227
+ const byte = probe[at++];
39228
+ size2 += (byte & 127) * 2 ** shift;
39229
+ if (!(byte & 128)) break;
39230
+ shift += 7;
39231
+ }
39232
+ const start = offset + at;
39233
+ const next = start + size2;
39234
+ if (id === 1 || id === 2) prefixEnd = next;
39235
+ else if (id === 0) {
39236
+ const nameBuf = Buffer.allocUnsafe(Math.min(128, size2));
39237
+ const nRead = (0, import_node_fs61.readSync)(fd, nameBuf, 0, nameBuf.length, start);
39238
+ let nLen = 0;
39239
+ let nShift = 0;
39240
+ let nAt = 0;
39241
+ for (; ; ) {
39242
+ if (nAt >= nRead) break;
39243
+ const byte = nameBuf[nAt++];
39244
+ nLen += (byte & 127) * 2 ** nShift;
39245
+ if (!(byte & 128)) break;
39246
+ nShift += 7;
39247
+ }
39248
+ if (nAt + nLen <= nRead && nameBuf.toString("utf8", nAt, nAt + nLen) === NATIVE_SDK_THUNK_SECTION) {
39249
+ hasExistingThunk = true;
39250
+ break;
39251
+ }
39252
+ }
39253
+ offset = next;
39254
+ }
39255
+ if (!hasExistingThunk) {
39256
+ prefix = Buffer.allocUnsafe(prefixEnd);
39257
+ let filled = 0;
39258
+ while (filled < prefixEnd) {
39259
+ const n = (0, import_node_fs61.readSync)(fd, prefix, filled, prefixEnd - filled, filled);
39260
+ if (n <= 0) break;
39261
+ filled += n;
39262
+ }
39263
+ prefix = prefix.subarray(0, filled);
39264
+ }
39265
+ } finally {
39266
+ (0, import_node_fs61.closeSync)(fd);
39267
+ }
39268
+ if (hasExistingThunk || !prefix) {
39269
+ (0, import_node_fs61.writeFileSync)(file, finishSwiftAppModule((0, import_node_fs61.readFileSync)(file)));
39270
+ return;
39271
+ }
39272
+ const thunks = sdkImportThunks(prefix);
39273
+ const nameBytes = Buffer.from(encodedName2(NATIVE_SDK_THUNK_SECTION));
39274
+ const header = Buffer.from([0, ...uleb4(nameBytes.length + thunks.length)]);
39275
+ (0, import_node_fs61.appendFileSync)(file, Buffer.concat([header, nameBytes, thunks]));
39276
+ }
38919
39277
  function swiftAppModuleInputs(tokens2, buildRoot, sdkLibraries) {
38920
39278
  const owned = (token) => import_node_path59.default.resolve(token).startsWith(`${buildRoot}/`) && (!token.includes("/.peach-pruned-objs/") || token.endsWith("/swiftrt-patched.o"));
38921
39279
  const inputs2 = [];
@@ -39130,6 +39488,7 @@ async function linkSwiftAppModule(options2) {
39130
39488
  "--unresolved-symbols=ignore-all",
39131
39489
  "--import-undefined",
39132
39490
  "--emit-relocs",
39491
+ "--strip-debug",
39133
39492
  "--gc-sections",
39134
39493
  "--keep-section=target_features",
39135
39494
  "--error-limit=0",
@@ -39152,7 +39511,16 @@ async function linkSwiftAppModule(options2) {
39152
39511
  const skipPasses = options2.layoutMap ? ["duplicate-function-elimination"] : void 0;
39153
39512
  const sdkTableEnd = sdk2.sdkInterface.layout.tableEnd;
39154
39513
  const { loweringCache } = options2;
39155
- const loweringKey = loweringCache && (0, import_node_crypto39.createHash)("sha256").update(
39514
+ const loweringKey = loweringCache && (typeof Bun !== "undefined" ? new Bun.CryptoHasher("sha256").update(
39515
+ JSON.stringify([
39516
+ loweringCache.compilerDigest,
39517
+ optimize,
39518
+ skipPasses,
39519
+ sdkTableEnd,
39520
+ lazy,
39521
+ KEEP_WASM_NAMES
39522
+ ])
39523
+ ).update(bytes).digest("hex") : (0, import_node_crypto40.createHash)("sha256").update(
39156
39524
  JSON.stringify([
39157
39525
  loweringCache.compilerDigest,
39158
39526
  optimize,
@@ -39161,7 +39529,7 @@ async function linkSwiftAppModule(options2) {
39161
39529
  lazy,
39162
39530
  KEEP_WASM_NAMES
39163
39531
  ])
39164
- ).update(bytes).digest("hex");
39532
+ ).update(bytes).digest("hex"));
39165
39533
  return {
39166
39534
  linkage,
39167
39535
  async lower() {
@@ -39771,7 +40139,8 @@ function createSwiftSdkBinding(linkage, sdk2, usage, projection) {
39771
40139
  bindSwiftAppModule(linkage, sdk2),
39772
40140
  selectSwiftSdkData(sdk2, usage, linkage, projection)
39773
40141
  ]);
39774
- return { bytes, sha256: (0, import_node_crypto39.createHash)("sha256").update(bytes).digest("hex") };
40142
+ const sha2565 = typeof Bun !== "undefined" ? new Bun.CryptoHasher("sha256").update(bytes).digest("hex") : (0, import_node_crypto40.createHash)("sha256").update(bytes).digest("hex");
40143
+ return { bytes, sha256: sha2565 };
39775
40144
  }
39776
40145
  function readSwiftSdkUsage(mapFile, linkedFile, sdkObjects) {
39777
40146
  const map2 = readWasmLinkMap(mapFile, false);
@@ -40317,12 +40686,12 @@ function partitionParent(section2) {
40317
40686
  "__objc_class_refs"
40318
40687
  ].find((name3) => section2 === name3 || section2.startsWith(`${name3}.`));
40319
40688
  }
40320
- var import_node_child_process35, import_node_crypto39, 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;
40689
+ 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;
40321
40690
  var init_swift_sdk_app_module = __esm({
40322
40691
  "src/swift-sdk-app-module.ts"() {
40323
40692
  "use strict";
40324
40693
  import_node_child_process35 = require("node:child_process");
40325
- import_node_crypto39 = require("node:crypto");
40694
+ import_node_crypto40 = require("node:crypto");
40326
40695
  import_node_fs61 = require("node:fs");
40327
40696
  import_node_path59 = __toESM(require("node:path"), 1);
40328
40697
  import_node_util11 = require("node:util");
@@ -40527,6 +40896,7 @@ async function compileGuestLink(options2) {
40527
40896
  onSplitInputs: sdk2 ? (value) => {
40528
40897
  splitInputs = value;
40529
40898
  } : void 0,
40899
+ deferFinalLink: Boolean(sdk2),
40530
40900
  onDyldRows: (rows) => {
40531
40901
  lazyFunctions = rows.lazyFunctions;
40532
40902
  dyldSymbols = rows.dyldSymbols;
@@ -40795,156 +41165,164 @@ async function compileGuestLink(options2) {
40795
41165
  });
40796
41166
  if (!reserved2 || !projectionObject) throw new Error("guest projection was not reserved");
40797
41167
  if (sdk2) {
40798
- if (!splitInputs) throw new Error("guest link did not select shared SDK inputs");
40799
- const {
40800
- createSwiftSdkBinding: createSwiftSdkBinding2,
40801
- finishSwiftAppModule: finishSwiftAppModule2,
40802
- linkSwiftAppModule: linkSwiftAppModule2,
40803
- readSwiftSdkUsage: readSwiftSdkUsage2,
40804
- swiftSdkProjectionSpans: swiftSdkProjectionSpans2
40805
- } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
40806
- const project = options2.project;
40807
- const work = project ? (0, import_node_fs62.mkdtempSync)(import_node_path60.default.join(directory2, "app-module-")) : import_node_path60.default.join(directory2, "app-module");
40808
- if (project) (0, import_node_fs62.chownSync)(work, project.uid, project.gid);
40809
- else (0, import_node_fs62.mkdirSync)(work, { recursive: true });
40810
- const layoutMap = import_node_path60.default.join(work, "app.map");
40811
- const owners = new Map(splitInputs.appObjects).set(projectionObject, 0);
40812
- const sdkObjectKeys = /* @__PURE__ */ new Map();
40813
- const sdkObjectImages = /* @__PURE__ */ new Map();
40814
- const sdkProductImages = new Map(prepared?.sdkProducts.images);
40815
- for (const [file, { image, product, identity: identity2 }] of splitInputs.sdkObjects) {
40816
- const key2 = sdkGuestObjectKey(identity2);
40817
- sdkObjectKeys.set(file, key2);
40818
- sdkObjectImages.set(key2, image);
40819
- const priorImage = sdkProductImages.get(product);
40820
- if (priorImage !== void 0 && priorImage !== image)
40821
- throw new Error(`SDK product ${product} has several guest images`);
40822
- sdkProductImages.set(product, image);
40823
- }
40824
- const usage = readSwiftSdkUsage2(result.mapPath, options2.output, sdkObjectKeys);
40825
- const linkedModule = import_node_path60.default.join(work, "app.wasm");
40826
- const sdkSpans = swiftSdkProjectionSpans2(
40827
- sdk2,
40828
- (object8, product) => sdkObjectImages.get(object8) ?? sdkProductImages.get(product)
40829
- );
40830
- let storage = reserved2;
40831
- if (sdkSpans.length > 0) {
40832
- const sdkCounts = guestProjectionRegionCounts(storage.images.length, sdkSpans);
40833
- storage = reserveGuestProjectionStorage(
40834
- storage.images,
40835
- storage.capacities.map((capacity, index) => ({
40836
- ...capacity,
40837
- regions: capacity.regions + sdkCounts[index] + 16
40838
- }))
40839
- );
40840
- const projectionSource = import_node_path60.default.join(work, "projection.c");
40841
- (0, import_node_fs62.writeFileSync)(projectionSource, storage.source);
40842
- (0, import_node_child_process36.execFileSync)(
40843
- import_node_path60.default.join(options2.toolchainBin, "clang"),
40844
- [...clangOptions, "-c", projectionSource, "-o", projectionObject],
40845
- { stdio: "pipe" }
40846
- );
40847
- }
40848
- let precomputedSymbols;
40849
- if (splitInputs.appReferencedSymbols && splitInputs.appDefinedSymbols) {
40850
- const referenced = new Set(splitInputs.appReferencedSymbols);
40851
- const defined = new Set(splitInputs.appDefinedSymbols);
40852
- const projSyms = guestWasmSymbols((0, import_node_fs62.readFileSync)(projectionObject));
40853
- for (const name3 of projSyms.undefined) referenced.add(name3);
40854
- for (const name3 of projSyms.defined) defined.add(name3);
40855
- precomputedSymbols = { referenced, defined };
40856
- }
40857
- for (; ; ) {
40858
- const link = await linkSwiftAppModule2({
40859
- objects: [...owners.keys()],
40860
- lazyFunctions: splitInputs.lazyFunctions,
40861
- toolchainBin: options2.toolchainBin,
40862
- sdk: sdk2,
40863
- work,
40864
- output: options2.optimized,
40865
- optimize: options2.optimize,
40866
- layoutMap,
40867
- project,
40868
- precomputedSymbols,
40869
- loweringCache: project ? void 0 : {
40870
- file: import_node_path60.default.join(
40871
- options2.buildDirectory,
40872
- ".build",
40873
- "peach-app-module-lowered.wasm"
40874
- ),
40875
- compilerDigest: options2.compilerDigest
40876
- }
40877
- });
40878
- const map3 = (0, import_node_fs62.readFileSync)(
40879
- project ? projectOutputFile(work, layoutMap, project) : layoutMap,
40880
- "utf8"
40881
- );
40882
- const values = guestDyldValueRange(map3);
40883
- const bindingRows = /* @__PURE__ */ new Map();
40884
- const data = [];
40885
- for (let at = 0; at < link.linkage.data.length; at += 3) {
40886
- const address = link.linkage.data[at];
40887
- const size2 = link.linkage.data[at + 1];
40888
- const value = link.linkage.data[at + 2];
40889
- if (values && address >= values.address && address < values.address + values.length) {
40890
- if (size2 !== 8 || (address - values.address) % 8)
40891
- throw new Error("sdk binding splits a dyld value");
40892
- bindingRows.set((address - values.address) / 8, value);
40893
- } else data.push(address, size2, value);
40894
- }
40895
- const linked = (0, import_node_fs62.readFileSync)(
40896
- project ? projectOutputFile(work, linkedModule, project) : linkedModule
41168
+ try {
41169
+ if (!splitInputs) throw new Error("guest link did not select shared SDK inputs");
41170
+ const {
41171
+ createSwiftSdkBinding: createSwiftSdkBinding2,
41172
+ linkSwiftAppModule: linkSwiftAppModule2,
41173
+ readSwiftSdkUsage: readSwiftSdkUsage2,
41174
+ swiftAppModuleThunkSection: swiftAppModuleThunkSection2,
41175
+ swiftSdkProjectionSpans: swiftSdkProjectionSpans2
41176
+ } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
41177
+ const project = options2.project;
41178
+ const work = project ? (0, import_node_fs62.mkdtempSync)(import_node_path60.default.join(directory2, "app-module-")) : import_node_path60.default.join(directory2, "app-module");
41179
+ if (project) (0, import_node_fs62.chownSync)(work, project.uid, project.gid);
41180
+ else (0, import_node_fs62.mkdirSync)(work, { recursive: true });
41181
+ const layoutMap = import_node_path60.default.join(work, "app.map");
41182
+ let appProjectionObject = projectionObject;
41183
+ const owners = new Map(splitInputs.appObjects).set(appProjectionObject, 0);
41184
+ const sdkObjectKeys = /* @__PURE__ */ new Map();
41185
+ const sdkObjectImages = /* @__PURE__ */ new Map();
41186
+ const sdkProductImages = new Map(prepared?.sdkProducts.images);
41187
+ for (const [file, { image, product, identity: identity2 }] of splitInputs.sdkObjects) {
41188
+ const key2 = sdkGuestObjectKey(identity2);
41189
+ sdkObjectKeys.set(file, key2);
41190
+ sdkObjectImages.set(key2, image);
41191
+ const priorImage = sdkProductImages.get(product);
41192
+ if (priorImage !== void 0 && priorImage !== image)
41193
+ throw new Error(`SDK product ${product} has several guest images`);
41194
+ sdkProductImages.set(product, image);
41195
+ }
41196
+ const linkedModule = import_node_path60.default.join(work, "app.wasm");
41197
+ const sdkSpans = swiftSdkProjectionSpans2(
41198
+ sdk2,
41199
+ (object8, product) => sdkObjectImages.get(object8) ?? sdkProductImages.get(product)
40897
41200
  );
40898
- const required = guestProjectionRegionCounts(storage.images.length, [
40899
- ...guestLinkedSpans(map3, linked, linked, owners, splitInputs.appSections, true),
40900
- ...sdkSpans
40901
- ]);
40902
- if (storage.capacities.some(({ regions }, index) => required[index] > regions)) {
40903
- storage = reserveGuestProjectionStorage(
40904
- storage.images,
40905
- storage.capacities.map((capacity, index) => {
40906
- const count = required[index];
40907
- return count > capacity.regions ? { ...capacity, regions: Math.max(count, capacity.regions * 2) } : capacity;
40908
- })
40909
- );
41201
+ const compileAppProjection = (source) => {
40910
41202
  const projectionSource = import_node_path60.default.join(work, "projection.c");
40911
- (0, import_node_fs62.writeFileSync)(projectionSource, storage.source);
41203
+ const nextObject = import_node_path60.default.join(work, "projection.o");
41204
+ (0, import_node_fs62.writeFileSync)(projectionSource, source);
40912
41205
  (0, import_node_child_process36.execFileSync)(
40913
41206
  import_node_path60.default.join(options2.toolchainBin, "clang"),
40914
- [...clangOptions, "-c", projectionSource, "-o", projectionObject],
41207
+ [...clangOptions, "-c", projectionSource, "-o", nextObject],
40915
41208
  { stdio: "pipe" }
40916
41209
  );
40917
- continue;
41210
+ if (nextObject !== appProjectionObject) {
41211
+ owners.delete(appProjectionObject);
41212
+ appProjectionObject = nextObject;
41213
+ owners.set(appProjectionObject, 0);
41214
+ }
41215
+ };
41216
+ let storage = reserved2;
41217
+ if (sdkSpans.length > 0) {
41218
+ const sdkCounts = guestProjectionRegionCounts(storage.images.length, sdkSpans);
41219
+ storage = reserveGuestProjectionStorage(
41220
+ storage.images,
41221
+ storage.capacities.map((capacity, index) => ({
41222
+ ...capacity,
41223
+ regions: capacity.regions + sdkCounts[index] + 16
41224
+ }))
41225
+ );
41226
+ compileAppProjection(storage.source);
40918
41227
  }
40919
- options2.onStage("lowering the app image");
40920
- const lowerPromise = link.lower();
40921
- await new Promise((resolve3) => setImmediate(resolve3));
40922
- let binding;
40923
- try {
40924
- binding = createSwiftSdkBinding2({ ...link.linkage, data }, sdk2, usage);
40925
- } catch (error) {
40926
- await lowerPromise.catch(() => {
41228
+ let precomputedSymbols;
41229
+ if (splitInputs.appReferencedSymbols && splitInputs.appDefinedSymbols) {
41230
+ const referenced = new Set(splitInputs.appReferencedSymbols);
41231
+ const defined = new Set(splitInputs.appDefinedSymbols);
41232
+ const projSyms = guestWasmSymbols((0, import_node_fs62.readFileSync)(appProjectionObject));
41233
+ for (const name3 of projSyms.undefined) referenced.add(name3);
41234
+ for (const name3 of projSyms.defined) defined.add(name3);
41235
+ precomputedSymbols = { referenced, defined };
41236
+ }
41237
+ for (; ; ) {
41238
+ const link = await linkSwiftAppModule2({
41239
+ objects: [...owners.keys()],
41240
+ lazyFunctions: splitInputs.lazyFunctions,
41241
+ toolchainBin: options2.toolchainBin,
41242
+ sdk: sdk2,
41243
+ work,
41244
+ output: options2.optimized,
41245
+ optimize: options2.optimize,
41246
+ layoutMap,
41247
+ project,
41248
+ precomputedSymbols,
41249
+ loweringCache: project ? void 0 : {
41250
+ file: import_node_path60.default.join(
41251
+ options2.buildDirectory,
41252
+ ".build",
41253
+ "peach-app-module-lowered.wasm"
41254
+ ),
41255
+ compilerDigest: options2.compilerDigest
41256
+ }
40927
41257
  });
40928
- throw error;
41258
+ const map3 = (0, import_node_fs62.readFileSync)(
41259
+ project ? projectOutputFile(work, layoutMap, project) : layoutMap,
41260
+ "utf8"
41261
+ );
41262
+ const values = guestDyldValueRange(map3);
41263
+ const bindingRows = /* @__PURE__ */ new Map();
41264
+ const data = [];
41265
+ for (let at = 0; at < link.linkage.data.length; at += 3) {
41266
+ const address = link.linkage.data[at];
41267
+ const size2 = link.linkage.data[at + 1];
41268
+ const value = link.linkage.data[at + 2];
41269
+ if (values && address >= values.address && address < values.address + values.length) {
41270
+ if (size2 !== 8 || (address - values.address) % 8)
41271
+ throw new Error("sdk binding splits a dyld value");
41272
+ bindingRows.set((address - values.address) / 8, value);
41273
+ } else data.push(address, size2, value);
41274
+ }
41275
+ const linked = (0, import_node_fs62.readFileSync)(
41276
+ project ? projectOutputFile(work, linkedModule, project) : linkedModule
41277
+ );
41278
+ const required = guestProjectionRegionCounts(storage.images.length, [
41279
+ ...guestLinkedSpans(map3, linked, linked, owners, splitInputs.appSections, true),
41280
+ ...sdkSpans
41281
+ ]);
41282
+ if (storage.capacities.some(({ regions }, index) => required[index] > regions)) {
41283
+ storage = reserveGuestProjectionStorage(
41284
+ storage.images,
41285
+ storage.capacities.map((capacity, index) => {
41286
+ const count = required[index];
41287
+ return count > capacity.regions ? { ...capacity, regions: Math.max(count, capacity.regions * 2) } : capacity;
41288
+ })
41289
+ );
41290
+ compileAppProjection(storage.source);
41291
+ continue;
41292
+ }
41293
+ options2.onStage("lowering the app image");
41294
+ const lowerPromise = link.lower();
41295
+ await new Promise((resolve3) => setImmediate(resolve3));
41296
+ let binding;
41297
+ try {
41298
+ if (result.finalLinkDone) await result.finalLinkDone;
41299
+ const usage = readSwiftSdkUsage2(result.mapPath, options2.output, sdkObjectKeys);
41300
+ binding = createSwiftSdkBinding2({ ...link.linkage, data }, sdk2, usage);
41301
+ } catch (error) {
41302
+ await Promise.allSettled([lowerPromise]);
41303
+ throw error;
41304
+ }
41305
+ await lowerPromise;
41306
+ const finalized = finalizeGuestProjectionStorage({
41307
+ map: map3,
41308
+ linked,
41309
+ optimized: (0, import_node_fs62.readFileSync)(options2.optimized),
41310
+ owners,
41311
+ sectionOwners: splitInputs.appSections,
41312
+ projectionObject: appProjectionObject,
41313
+ reserved: storage,
41314
+ sdkSpans
41315
+ });
41316
+ (0, import_node_fs62.writeFileSync)(
41317
+ options2.optimized,
41318
+ moveGuestDyldTable(map3, finalized.wasm, splitInputs.dyldSymbols, bindingRows, [
41319
+ swiftAppModuleThunkSection2(finalized.wasm)
41320
+ ])
41321
+ );
41322
+ return binding;
40929
41323
  }
40930
- await lowerPromise;
40931
- const finalized = finalizeGuestProjectionStorage({
40932
- map: map3,
40933
- linked,
40934
- optimized: (0, import_node_fs62.readFileSync)(options2.optimized),
40935
- owners,
40936
- sectionOwners: splitInputs.appSections,
40937
- projectionObject,
40938
- reserved: storage,
40939
- sdkSpans
40940
- });
40941
- (0, import_node_fs62.writeFileSync)(
40942
- options2.optimized,
40943
- finishSwiftAppModule2(
40944
- moveGuestDyldTable(map3, finalized.wasm, splitInputs.dyldSymbols, bindingRows)
40945
- )
40946
- );
40947
- return binding;
41324
+ } finally {
41325
+ if (result.finalLinkDone) await Promise.allSettled([result.finalLinkDone]);
40948
41326
  }
40949
41327
  }
40950
41328
  options2.onStage("lowering the app image");
@@ -41019,7 +41397,7 @@ function compilerCheckpoint(root, recipe2, args, header) {
41019
41397
  }
41020
41398
  if (!objects.length) return;
41021
41399
  const outputs = [module2, header, map2[""].dependencies, ...objects];
41022
- const digest2 = (0, import_node_crypto40.createHash)("sha256").update(recipe2).update(JSON.stringify(args)).update(mapText);
41400
+ const digest2 = (0, import_node_crypto41.createHash)("sha256").update(recipe2).update(JSON.stringify(args)).update(mapText);
41023
41401
  for (const flag of args) {
41024
41402
  if (!flag.startsWith("@")) continue;
41025
41403
  const response = flag.slice(1);
@@ -41113,11 +41491,11 @@ async function withSwiftHeaderCompiler(root, toolchainBin, recipe2, producers, b
41113
41491
  (0, import_node_fs63.rmSync)(directory2, { recursive: true, force: true });
41114
41492
  }
41115
41493
  }
41116
- var import_node_crypto40, import_node_fs63, import_node_http, import_node_path61, SWIFT_HEADER_COMPILER_WRAPPER, argument, client;
41494
+ var import_node_crypto41, import_node_fs63, import_node_http, import_node_path61, SWIFT_HEADER_COMPILER_WRAPPER, argument, client;
41117
41495
  var init_swift_header_compiler = __esm({
41118
41496
  "src/swift-header-compiler.ts"() {
41119
41497
  "use strict";
41120
- import_node_crypto40 = require("node:crypto");
41498
+ import_node_crypto41 = require("node:crypto");
41121
41499
  import_node_fs63 = require("node:fs");
41122
41500
  import_node_http = require("node:http");
41123
41501
  import_node_path61 = __toESM(require("node:path"), 1);
@@ -41400,7 +41778,7 @@ function swiftIcuAsset(toolchainBin, sdk2) {
41400
41778
  JSON.stringify([toolchainBin, sdk2, swiftSdkOptions()]),
41401
41779
  async () => {
41402
41780
  const zipped = await deflate(await swiftIcuData(toolchainBin, sdk2));
41403
- return { sha256: (0, import_node_crypto41.createHash)("sha256").update(zipped).digest("hex"), gzip: zipped };
41781
+ return { sha256: (0, import_node_crypto42.createHash)("sha256").update(zipped).digest("hex"), gzip: zipped };
41404
41782
  }
41405
41783
  );
41406
41784
  }
@@ -41502,7 +41880,7 @@ function swiftIcuPacked(icu) {
41502
41880
  )
41503
41881
  );
41504
41882
  await (0, import_promises7.mkdir)(import_node_path63.default.dirname(file), { recursive: true });
41505
- const tmp = `${file}.${(0, import_node_crypto41.randomUUID)()}.tmp`;
41883
+ const tmp = `${file}.${(0, import_node_crypto42.randomUUID)()}.tmp`;
41506
41884
  await (0, import_promises7.writeFile)(tmp, packed);
41507
41885
  await (0, import_promises7.rename)(tmp, file);
41508
41886
  return packed;
@@ -41515,12 +41893,12 @@ async function swiftIcuBundleAsset(icu) {
41515
41893
  contentType: "application/octet-stream"
41516
41894
  };
41517
41895
  }
41518
- var import_node_child_process37, import_node_crypto41, import_node_fs64, import_promises7, import_node_os14, import_node_path63, import_node_util12, import_node_zlib5, run6, deflate, compressBrotli, inflateGzip, ARCHIVE, MEMBER, raw, assets, packedFiles;
41896
+ var import_node_child_process37, import_node_crypto42, import_node_fs64, import_promises7, import_node_os14, import_node_path63, import_node_util12, import_node_zlib5, run6, deflate, compressBrotli, inflateGzip, ARCHIVE, MEMBER, raw, assets, packedFiles;
41519
41897
  var init_swift_icu = __esm({
41520
41898
  "src/swift-icu.ts"() {
41521
41899
  "use strict";
41522
41900
  import_node_child_process37 = require("node:child_process");
41523
- import_node_crypto41 = require("node:crypto");
41901
+ import_node_crypto42 = require("node:crypto");
41524
41902
  import_node_fs64 = require("node:fs");
41525
41903
  import_promises7 = require("node:fs/promises");
41526
41904
  import_node_os14 = __toESM(require("node:os"), 1);
@@ -41772,7 +42150,7 @@ function swiftObjCPrebuiltCompiler(clang, root, sysroot, distribution, targets,
41772
42150
  );
41773
42151
  if (!modules.length) return [];
41774
42152
  const { executable, prefixArgs } = rnxSelfInvocation();
41775
- const compiler = (0, import_node_crypto42.createHash)("sha256").update(import_node_fs66.default.readFileSync(clang)).digest("hex");
42153
+ const compiler = (0, import_node_crypto43.createHash)("sha256").update(import_node_fs66.default.readFileSync(clang)).digest("hex");
41776
42154
  return [
41777
42155
  'case "$module" in',
41778
42156
  ` ${modules.join("|")}) exec ${[
@@ -41790,12 +42168,12 @@ function swiftObjCPrebuiltCompiler(clang, root, sysroot, distribution, targets,
41790
42168
  "esac"
41791
42169
  ];
41792
42170
  }
41793
- var import_node_child_process39, import_node_crypto42, import_node_fs66, import_node_path65, quote2;
42171
+ var import_node_child_process39, import_node_crypto43, import_node_fs66, import_node_path65, quote2;
41794
42172
  var init_swift_objc_prebuilt = __esm({
41795
42173
  "src/swift-objc-prebuilt.ts"() {
41796
42174
  "use strict";
41797
42175
  import_node_child_process39 = require("node:child_process");
41798
- import_node_crypto42 = require("node:crypto");
42176
+ import_node_crypto43 = require("node:crypto");
41799
42177
  import_node_fs66 = __toESM(require("node:fs"), 1);
41800
42178
  import_node_path65 = __toESM(require("node:path"), 1);
41801
42179
  init_internal_child_contract();
@@ -42148,7 +42526,7 @@ function swiftPackagePrebuiltEntries(input, moduleRoot, toolchainBin) {
42148
42526
  ([file, source]) => !/\.(?:swift|c|h|inc|modulemap)$/.test(file) || file.endsWith(".swift") && swiftImportNames(source, available2).some((name4) => !available2.has(name4))
42149
42527
  ))
42150
42528
  return [];
42151
- const hash = (0, import_node_crypto43.createHash)("sha256");
42529
+ const hash = (0, import_node_crypto44.createHash)("sha256");
42152
42530
  for (const entry of files2.sort(
42153
42531
  ([left], [right]) => left < right ? -1 : left > right ? 1 : 0
42154
42532
  ))
@@ -42215,11 +42593,11 @@ function useSwiftPackagePrebuilts(input, moduleRoot, toolchainBin) {
42215
42593
  }
42216
42594
  return resolved;
42217
42595
  }
42218
- var import_node_crypto43, import_node_fs69, import_node_path69, PACKAGE_RECIPE;
42596
+ var import_node_crypto44, import_node_fs69, import_node_path69, PACKAGE_RECIPE;
42219
42597
  var init_swift_package_prebuilt = __esm({
42220
42598
  "src/swift-package-prebuilt.ts"() {
42221
42599
  "use strict";
42222
- import_node_crypto43 = require("node:crypto");
42600
+ import_node_crypto44 = require("node:crypto");
42223
42601
  import_node_fs69 = __toESM(require("node:fs"), 1);
42224
42602
  import_node_path69 = __toESM(require("node:path"), 1);
42225
42603
  init_native_prebuilt();
@@ -42379,7 +42757,7 @@ function swiftObjCSelectorOptions(moduleRoot) {
42379
42757
  `;
42380
42758
  if (!(0, import_node_fs70.existsSync)(map2) || (0, import_node_fs70.readFileSync)(map2, "utf8") !== content) {
42381
42759
  (0, import_node_fs70.mkdirSync)(import_node_path70.default.dirname(map2), { recursive: true });
42382
- const partial = `${map2}.${(0, import_node_crypto44.randomUUID)()}`;
42760
+ const partial = `${map2}.${(0, import_node_crypto45.randomUUID)()}`;
42383
42761
  (0, import_node_fs70.writeFileSync)(partial, content);
42384
42762
  (0, import_node_fs70.renameSync)(partial, map2);
42385
42763
  }
@@ -42407,7 +42785,7 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal, lea
42407
42785
  return { libraries, executables };
42408
42786
  }
42409
42787
  function swiftProjectBuildKey(moduleRoot, release) {
42410
- return (0, import_node_crypto44.createHash)("sha256").update(`swift-framework/v2\0${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).update(swiftModuleDigest(moduleRoot)).digest("hex").slice(0, 32);
42788
+ return (0, import_node_crypto45.createHash)("sha256").update(`swift-framework/v2\0${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).update(swiftModuleDigest(moduleRoot)).digest("hex").slice(0, 32);
42411
42789
  }
42412
42790
  function sameStringList(left, right) {
42413
42791
  if (left === right) return true;
@@ -42655,7 +43033,7 @@ function distributionClangModuleOptions(root, modules) {
42655
43033
  function providedModulesPath(root, modules, excluded) {
42656
43034
  if (!excluded || excluded.size === 0) return modules;
42657
43035
  const entries2 = (0, import_node_fs70.readdirSync)(modules).filter((entry) => !excluded.has(entry.replace(/\..*$/, ""))).sort();
42658
- const key2 = (0, import_node_crypto44.createHash)("sha256").update(JSON.stringify([modules, entries2])).update([...excluded].sort().join("\0")).digest("hex").slice(0, 16);
43036
+ const key2 = (0, import_node_crypto45.createHash)("sha256").update(JSON.stringify([modules, entries2])).update([...excluded].sort().join("\0")).digest("hex").slice(0, 16);
42659
43037
  const directory2 = import_node_path70.default.join(root, `.peach-modules-${key2}`);
42660
43038
  const complete = import_node_path70.default.join(directory2, ".complete");
42661
43039
  if (!(0, import_node_fs70.existsSync)(complete)) {
@@ -42737,10 +43115,10 @@ function swiftTargetDependencies(files2, targets, frameworks = OPTIONAL_FRAMEWOR
42737
43115
  function sha256Digest(value) {
42738
43116
  if (typeof Bun !== "undefined")
42739
43117
  return new Bun.CryptoHasher("sha256").update(value).digest();
42740
- return (0, import_node_crypto44.createHash)("sha256").update(value).digest();
43118
+ return (0, import_node_crypto45.createHash)("sha256").update(value).digest();
42741
43119
  }
42742
43120
  function swiftCompileInputHash(input, release) {
42743
- const hash = (0, import_node_crypto44.createHash)("sha256");
43121
+ const hash = (0, import_node_crypto45.createHash)("sha256");
42744
43122
  hash.update(`swift-compile
42745
43123
  ${release}
42746
43124
  `);
@@ -42947,7 +43325,7 @@ function emitSwiftPackageManifest(args) {
42947
43325
  ].join("\n") + "\n";
42948
43326
  distributionLinkPath = distributionLink.path.replace(
42949
43327
  /\.rsp$/,
42950
- `-${(0, import_node_crypto44.createHash)("sha256").update(list2).digest("hex").slice(0, 12)}.rsp`
43328
+ `-${(0, import_node_crypto45.createHash)("sha256").update(list2).digest("hex").slice(0, 12)}.rsp`
42951
43329
  );
42952
43330
  distributionLink.files.set(distributionLinkPath, list2);
42953
43331
  }
@@ -42968,7 +43346,7 @@ function emitSwiftPackageManifest(args) {
42968
43346
  const endRun = () => {
42969
43347
  if (run12.length >= MODULE_MAP_RESPONSE_FILE_RUN) {
42970
43348
  const lines = run12.map((flag) => JSON.stringify(flag)).join("\n") + "\n";
42971
- const digest3 = (0, import_node_crypto44.createHash)("sha256").update(lines).digest("hex");
43349
+ const digest3 = (0, import_node_crypto45.createHash)("sha256").update(lines).digest("hex");
42972
43350
  const file2 = import_node_path70.default.join(args.root, ".peach-clang-arguments", `${digest3}.rsp`);
42973
43351
  args.files.set(file2, lines);
42974
43352
  flags.push(`@${file2}`);
@@ -42992,7 +43370,7 @@ function emitSwiftPackageManifest(args) {
42992
43370
  }
42993
43371
  endRun();
42994
43372
  const content = JSON.stringify(flags);
42995
- const digest2 = (0, import_node_crypto44.createHash)("sha256").update(content).digest("hex");
43373
+ const digest2 = (0, import_node_crypto45.createHash)("sha256").update(content).digest("hex");
42996
43374
  const file = import_node_path70.default.join(args.root, ".peach-manifest-arguments", `${digest2}.json`);
42997
43375
  args.files.set(file, content);
42998
43376
  return `peachCompilerArguments(${JSON.stringify(file)})`;
@@ -43004,7 +43382,7 @@ function emitSwiftPackageManifest(args) {
43004
43382
  const macros = compactSwiftClangDefines(swiftClangSearchArguments(flags));
43005
43383
  const compact = args.coalescibleOverlays ? compactSwiftClangOverlays(macros, args.coalescibleOverlays) : macros;
43006
43384
  const content = compact.map((flag) => JSON.stringify(flag)).join("\n") + "\n";
43007
- const digest2 = (0, import_node_crypto44.createHash)("sha256").update(content).digest("hex");
43385
+ const digest2 = (0, import_node_crypto45.createHash)("sha256").update(content).digest("hex");
43008
43386
  const file = import_node_path70.default.join(args.root, ".peach-swift-arguments", `${digest2}.rsp`);
43009
43387
  args.files.set(file, content);
43010
43388
  return JSON.stringify([`@${file}`]);
@@ -44593,7 +44971,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
44593
44971
  )
44594
44972
  ];
44595
44973
  const moduleFlag = perFile.some((flag) => flag.startsWith("-fmodule-name=")) ? [] : [`-fmodule-name=${swiftTargetModuleName(target.name)}`];
44596
- const identity2 = (0, import_node_crypto44.createHash)("sha256").update(
44974
+ const identity2 = (0, import_node_crypto45.createHash)("sha256").update(
44597
44975
  JSON.stringify([
44598
44976
  cxx,
44599
44977
  quoteDirs,
@@ -44956,7 +45334,7 @@ module ${moduleName}.Swift {
44956
45334
  ])
44957
45335
  (0, import_node_fs70.rmSync)(cache, { recursive: true, force: true });
44958
45336
  files2.set(frameworkSearchRecord, frameworkSearch);
44959
- const modulePlan = (0, import_node_crypto44.createHash)("sha256").update(
45337
+ const modulePlan = (0, import_node_crypto45.createHash)("sha256").update(
44960
45338
  swiftModuleInputFiles(moduleRoot).join("\n")
44961
45339
  );
44962
45340
  if (!distribution) {
@@ -44965,7 +45343,7 @@ module ${moduleName}.Swift {
44965
45343
  modulePlan.update(
44966
45344
  Object.keys(input.files).filter((file) => file.endsWith(".swift")).sort().join("\n")
44967
45345
  );
44968
- const resourcePlan = (0, import_node_crypto44.createHash)("sha256").update(
45346
+ const resourcePlan = (0, import_node_crypto45.createHash)("sha256").update(
44969
45347
  JSON.stringify(
44970
45348
  resourceTargets.filter((target) => target.resources).map((target) => [
44971
45349
  target.name,
@@ -45273,7 +45651,7 @@ ${entry}`);
45273
45651
  );
45274
45652
  for (const [target, data] of Object.entries(input.libraries ?? {})) {
45275
45653
  const bytes = Buffer.from(data, "base64");
45276
- const digest2 = (0, import_node_crypto44.createHash)("sha256").update(bytes).digest("hex");
45654
+ const digest2 = (0, import_node_crypto45.createHash)("sha256").update(bytes).digest("hex");
45277
45655
  if (input.binaryModules?.[target] && packageTargets.has(target)) {
45278
45656
  const objects = import_node_path70.default.join(
45279
45657
  layout2.root,
@@ -45925,7 +46303,7 @@ function readCompiledArtifact(directory2, hash) {
45925
46303
  return null;
45926
46304
  const bytes = (0, import_node_fs70.readFileSync)(import_node_path70.default.join(directory2, "app.wasm"));
45927
46305
  const gzip2 = (0, import_node_fs70.readFileSync)(import_node_path70.default.join(directory2, "icu.gz"));
45928
- if ((0, import_node_crypto44.createHash)("sha256").update(bytes).digest("hex") !== receipt.wasm || (0, import_node_crypto44.createHash)("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length <= 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
46306
+ if ((0, import_node_crypto45.createHash)("sha256").update(bytes).digest("hex") !== receipt.wasm || (0, import_node_crypto45.createHash)("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length <= 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
45929
46307
  return null;
45930
46308
  let sdk2;
45931
46309
  if ("sdk" in receipt) {
@@ -45933,7 +46311,7 @@ function readCompiledArtifact(directory2, hash) {
45933
46311
  if (!isRecord(image) || typeof image.key !== "string" || typeof image.sha256 !== "string" || typeof image.binding !== "string")
45934
46312
  return null;
45935
46313
  const binding = (0, import_node_fs70.readFileSync)(import_node_path70.default.join(directory2, "sdk-binding.bin"));
45936
- if ((0, import_node_crypto44.createHash)("sha256").update(binding).digest("hex") !== image.binding)
46314
+ if ((0, import_node_crypto45.createHash)("sha256").update(binding).digest("hex") !== image.binding)
45937
46315
  return null;
45938
46316
  sdk2 = {
45939
46317
  key: image.key,
@@ -45961,7 +46339,7 @@ function saveCompiledArtifact(root, artifact) {
45961
46339
  import_node_path70.default.join(pending, "artifact.json"),
45962
46340
  JSON.stringify({
45963
46341
  hash: artifact.hash,
45964
- wasm: (0, import_node_crypto44.createHash)("sha256").update(artifact.bytes).digest("hex"),
46342
+ wasm: (0, import_node_crypto45.createHash)("sha256").update(artifact.bytes).digest("hex"),
45965
46343
  icu: artifact.icu.sha256,
45966
46344
  sdk: artifact.sdk && {
45967
46345
  key: artifact.sdk.key,
@@ -46310,7 +46688,7 @@ async function buildFrameworkProducts(scratch2, args) {
46310
46688
  const unoptimized = args.input.unoptimized === true;
46311
46689
  const sdkOptions = swiftCompileSdkOptions(args.moduleRoot, args.toolchainBin);
46312
46690
  const selectorOptions = swiftObjCSelectorOptions(args.moduleRoot);
46313
- const receiptKey = (0, import_node_crypto44.createHash)("sha256").update(
46691
+ const receiptKey = (0, import_node_crypto45.createHash)("sha256").update(
46314
46692
  JSON.stringify([
46315
46693
  "framework-products/v2",
46316
46694
  args.frameworkKey,
@@ -46374,6 +46752,10 @@ async function buildFrameworkProducts(scratch2, args) {
46374
46752
  // every framework target when callers alternate --cores.
46375
46753
  "-Xswiftc",
46376
46754
  "-gnone",
46755
+ "-Xcc",
46756
+ "-g0",
46757
+ "-Xcxx",
46758
+ "-g0",
46377
46759
  "-Xswiftc",
46378
46760
  "-num-threads",
46379
46761
  "-Xswiftc",
@@ -46473,7 +46855,7 @@ async function buildFrameworkProducts(scratch2, args) {
46473
46855
  const archiveBase = import_node_path70.default.join(scratch2, "products-lib");
46474
46856
  (0, import_node_fs70.mkdirSync)(archiveBase, { recursive: true });
46475
46857
  const archiveRoot = import_node_path70.default.join(archiveBase, receiptKey);
46476
- const stagedArchiveRoot = `${archiveRoot}.tmp-${process.pid}-${(0, import_node_crypto44.randomUUID)()}`;
46858
+ const stagedArchiveRoot = `${archiveRoot}.tmp-${process.pid}-${(0, import_node_crypto45.randomUUID)()}`;
46477
46859
  const stagedArchive = import_node_path70.default.join(stagedArchiveRoot, "lib");
46478
46860
  (0, import_node_fs70.mkdirSync)(stagedArchive, { recursive: true });
46479
46861
  const archived = /* @__PURE__ */ new Map();
@@ -46516,7 +46898,7 @@ ${args.frameworkKey}`,
46516
46898
  const receiptsDir = import_node_path70.default.join(scratch2, "products-ready");
46517
46899
  (0, import_node_fs70.mkdirSync)(receiptsDir, { recursive: true });
46518
46900
  const receiptFile2 = import_node_path70.default.join(receiptsDir, `${receiptKey}.json`);
46519
- const partialReceipt = `${receiptFile2}.${process.pid}.${(0, import_node_crypto44.randomUUID)()}`;
46901
+ const partialReceipt = `${receiptFile2}.${process.pid}.${(0, import_node_crypto45.randomUUID)()}`;
46520
46902
  (0, import_node_fs70.writeFileSync)(
46521
46903
  partialReceipt,
46522
46904
  JSON.stringify({
@@ -46688,7 +47070,7 @@ function mirrorTree2(source, target, skip) {
46688
47070
  if (existing?.isFile() && existing.size === stat.size && (existing.mtimeMs === stat.mtimeMs || (0, import_node_fs70.readFileSync)(from).equals((0, import_node_fs70.readFileSync)(to))))
46689
47071
  continue;
46690
47072
  if (existing) (0, import_node_fs70.rmSync)(to, { recursive: true, force: true });
46691
- const partial = `${to}.${(0, import_node_crypto44.randomUUID)()}`;
47073
+ const partial = `${to}.${(0, import_node_crypto45.randomUUID)()}`;
46692
47074
  (0, import_node_fs70.copyFileSync)(from, partial);
46693
47075
  if (stat.mtimeMs > Date.now()) (0, import_node_fs70.utimesSync)(partial, stat.atime, stat.mtime);
46694
47076
  (0, import_node_fs70.renameSync)(partial, to);
@@ -46748,7 +47130,7 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
46748
47130
  return stagedModule;
46749
47131
  }
46750
47132
  function swiftLinkStamp(args) {
46751
- const hash = (0, import_node_crypto44.createHash)("sha256");
47133
+ const hash = (0, import_node_crypto45.createHash)("sha256");
46752
47134
  hash.update(`swift-link/v1
46753
47135
  ${args.frameworkKey}
46754
47136
  `);
@@ -46876,7 +47258,7 @@ async function compileSwiftProjectOnce(sources, options2) {
46876
47258
  const inputHash = swiftCompileInputHash(input, options2.release);
46877
47259
  const moduleDigest = swiftModuleDigest(moduleRoot);
46878
47260
  const sourceHash = inputHash.copy().update(moduleDigest).digest("hex");
46879
- const hash = sdkImage ? (0, import_node_crypto44.createHash)("sha256").update(`${sourceHash}
47261
+ const hash = sdkImage ? (0, import_node_crypto45.createHash)("sha256").update(`${sourceHash}
46880
47262
  sdk module ${sdkImage.key}`).digest("hex") : sourceHash;
46881
47263
  const frameworkKey = swiftProjectBuildKey(moduleRoot, options2.release);
46882
47264
  const sharedRoot = import_node_path70.default.join(swiftCacheDir(), "swift-projects", hash);
@@ -46973,7 +47355,7 @@ ${cap}` : "";
46973
47355
  }
46974
47356
  const baseRoot = root;
46975
47357
  const canPoolBuildRoot = !options2.intermediates && !options2.project && !options2.linkOnly && import_node_path70.default.basename(import_node_path70.default.dirname(baseRoot)) === "swift-builds";
46976
- const buildShape = canPoolBuildRoot ? (0, import_node_crypto44.createHash)("sha256").update(
47358
+ const buildShape = canPoolBuildRoot ? (0, import_node_crypto45.createHash)("sha256").update(
46977
47359
  JSON.stringify([
46978
47360
  frameworkKey,
46979
47361
  Boolean(sdkImage),
@@ -47264,6 +47646,10 @@ ${cap}` : "";
47264
47646
  // fan-out under high -j.
47265
47647
  "-Xswiftc",
47266
47648
  "-gnone",
47649
+ "-Xcc",
47650
+ "-g0",
47651
+ "-Xcxx",
47652
+ "-g0",
47267
47653
  ...incrementalPreview ? [] : [
47268
47654
  "-Xswiftc",
47269
47655
  "-num-threads",
@@ -47458,17 +47844,17 @@ ${cap}` : "";
47458
47844
  }
47459
47845
  const receipt = import_node_path70.default.join(
47460
47846
  checkpoints,
47461
- (0, import_node_crypto44.createHash)("sha256").update(target).digest("hex")
47847
+ (0, import_node_crypto45.createHash)("sha256").update(target).digest("hex")
47462
47848
  );
47463
47849
  const headers = producers.map(headerPaths);
47464
47850
  for (const header of headers)
47465
47851
  if ((0, import_node_fs70.existsSync)(header.original)) publishHeader(header);
47466
47852
  const fingerprint = () => {
47467
- const digest2 = (0, import_node_crypto44.createHash)("sha256").update(recipe2);
47853
+ const digest2 = (0, import_node_crypto45.createHash)("sha256").update(recipe2);
47468
47854
  for (const { original, emitted } of headers) {
47469
47855
  if (!(0, import_node_fs70.existsSync)(original) || !(0, import_node_fs70.existsSync)(emitted)) return;
47470
47856
  digest2.update(
47471
- (0, import_node_crypto44.createHash)("sha256").update((0, import_node_fs70.readFileSync)(emitted)).digest()
47857
+ (0, import_node_crypto45.createHash)("sha256").update((0, import_node_fs70.readFileSync)(emitted)).digest()
47472
47858
  );
47473
47859
  }
47474
47860
  return digest2.digest("hex");
@@ -47681,12 +48067,12 @@ ${cap}` : "";
47681
48067
  options2.signal
47682
48068
  );
47683
48069
  }
47684
- var import_node_child_process41, import_node_crypto44, import_node_fs70, import_node_os16, import_node_path70, v6, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_COMPILER_ENV_KEYS, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, lastPartition, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, CLANG_DISTRIBUTION_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, MODULE_MAP_RESPONSE_FILE_RUN, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, cPredefineTable, cPredefineCache, HIDDEN_UNITS, FIRST_WINS_PAIRS, LAST_WINS_PAIRS, VALUE_FLAGS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, frameworkProductsReceiptSchema, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN, SWIFT_FRAMEWORK_SLOT_RELEASE, SWIFT_BUILD_ROOT_SLOTS, SWIFT_BUILD_ROOT_SHAPE;
48070
+ var import_node_child_process41, import_node_crypto45, import_node_fs70, import_node_os16, import_node_path70, v6, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_COMPILER_ENV_KEYS, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, lastPartition, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, CLANG_DISTRIBUTION_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, MODULE_MAP_RESPONSE_FILE_RUN, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, cPredefineTable, cPredefineCache, HIDDEN_UNITS, FIRST_WINS_PAIRS, LAST_WINS_PAIRS, VALUE_FLAGS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, frameworkProductsReceiptSchema, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN, SWIFT_FRAMEWORK_SLOT_RELEASE, SWIFT_BUILD_ROOT_SLOTS, SWIFT_BUILD_ROOT_SHAPE;
47685
48071
  var init_swift_compile = __esm({
47686
48072
  "src/swift-compile.ts"() {
47687
48073
  "use strict";
47688
48074
  import_node_child_process41 = require("node:child_process");
47689
- import_node_crypto44 = require("node:crypto");
48075
+ import_node_crypto45 = require("node:crypto");
47690
48076
  import_node_fs70 = require("node:fs");
47691
48077
  import_node_os16 = __toESM(require("node:os"), 1);
47692
48078
  import_node_path70 = __toESM(require("node:path"), 1);
@@ -47914,7 +48300,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
47914
48300
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
47915
48301
  MULTI_MANIFEST_VERSION = 76;
47916
48302
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
47917
- compilerSourceDigest = true ? "67e8f8e0e47047534254dae36e13cda1c7694fb49b1d92c2d01a9e386dc59e59" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
48303
+ compilerSourceDigest = true ? "169122685e250113f128b79efc78f9868f581da36ab083c174056ab99b87b629" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
47918
48304
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
47919
48305
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
47920
48306
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -48030,7 +48416,7 @@ async function podPrepareEnvironment(base) {
48030
48416
  if (process.platform !== "linux") return base;
48031
48417
  const { root, toolchainBin } = await resolveSwiftModule();
48032
48418
  const { sysroot, resources } = swiftSdkPaths(root, toolchainBin);
48033
- const key2 = (0, import_node_crypto45.createHash)("sha256").update(XCRUN).update(CLANG).digest("hex").slice(0, 16);
48419
+ const key2 = (0, import_node_crypto46.createHash)("sha256").update(XCRUN).update(CLANG).digest("hex").slice(0, 16);
48034
48420
  const directory2 = import_node_path71.default.join(cacheDir(), "pod-tools", key2);
48035
48421
  if (!import_node_fs71.default.existsSync(directory2)) {
48036
48422
  import_node_fs71.default.mkdirSync(import_node_path71.default.dirname(directory2), { recursive: true });
@@ -48071,11 +48457,11 @@ async function podPrepareEnvironment(base) {
48071
48457
  PEACH_POD_RESOURCES: resources
48072
48458
  };
48073
48459
  }
48074
- var import_node_crypto45, import_node_fs71, import_node_path71, XCRUN, CLANG;
48460
+ var import_node_crypto46, import_node_fs71, import_node_path71, XCRUN, CLANG;
48075
48461
  var init_pod_prepare_toolchain = __esm({
48076
48462
  "src/pod-prepare-toolchain.ts"() {
48077
48463
  "use strict";
48078
- import_node_crypto45 = require("node:crypto");
48464
+ import_node_crypto46 = require("node:crypto");
48079
48465
  import_node_fs71 = __toESM(require("node:fs"), 1);
48080
48466
  import_node_path71 = __toESM(require("node:path"), 1);
48081
48467
  init_home_paths();
@@ -48161,10 +48547,10 @@ async function podSourceRoot(spec, prepareEnv) {
48161
48547
  `${name3}: unrecognized ${strategy} source options ${unrecognized.join(", ")}`
48162
48548
  );
48163
48549
  const base = import_node_path72.default.join(rnxHomeDir(), "pod-sources");
48164
- const digest2 = (0, import_node_crypto46.createHash)("sha256").update(canonicalJson(source)).digest("hex").slice(0, 16);
48550
+ const digest2 = (0, import_node_crypto47.createHash)("sha256").update(canonicalJson(source)).digest("hex").slice(0, 16);
48165
48551
  const root = import_node_path72.default.join(base, name3, `${String(spec.version)}-${digest2}`);
48166
48552
  if (import_node_fs72.default.existsSync(root)) return root;
48167
- const stage = import_node_path72.default.join(base, ".staging", (0, import_node_crypto46.randomUUID)());
48553
+ const stage = import_node_path72.default.join(base, ".staging", (0, import_node_crypto47.randomUUID)());
48168
48554
  import_node_fs72.default.mkdirSync(stage, { recursive: true });
48169
48555
  try {
48170
48556
  if (strategy === "git") await downloadGit(name3, url, options2, stage);
@@ -48339,7 +48725,7 @@ async function downloadFile(pod, url, headers, file, algorithm) {
48339
48725
  }
48340
48726
  if (!response?.ok || !response.body)
48341
48727
  throw new Error(`${pod}: GET ${url} failed with HTTP ${response?.status ?? "error"}`);
48342
- const hash = algorithm ? (0, import_node_crypto46.createHash)(algorithm) : null;
48728
+ const hash = algorithm ? (0, import_node_crypto47.createHash)(algorithm) : null;
48343
48729
  const handle = await import_node_fs72.default.promises.open(file, "w");
48344
48730
  try {
48345
48731
  const reader = response.body.getReader();
@@ -48596,12 +48982,12 @@ function cleanInstalledPod(spec, root, used) {
48596
48982
  (node) => used.filter((entry) => entry.specs.includes(node.name)).map((entry) => entry.platform)
48597
48983
  );
48598
48984
  }
48599
- var import_node_child_process42, import_node_crypto46, import_node_fs72, import_node_os17, import_node_path72, COCOAPODS_VERSION, USER_AGENT, PLATFORMS, HEADER_EXTENSIONS, SOURCE_EXTENSIONS2, SOURCE_FILES_PATTERN, STRATEGIES, OPTIONS, ARCHIVE_TYPES, object5, RETRY_STATUSES, chomp, stringList, bracketEnd, escapeRegex;
48985
+ var import_node_child_process42, import_node_crypto47, import_node_fs72, import_node_os17, import_node_path72, COCOAPODS_VERSION, USER_AGENT, PLATFORMS, HEADER_EXTENSIONS, SOURCE_EXTENSIONS2, SOURCE_FILES_PATTERN, STRATEGIES, OPTIONS, ARCHIVE_TYPES, object5, RETRY_STATUSES, chomp, stringList, bracketEnd, escapeRegex;
48600
48986
  var init_pod_sources = __esm({
48601
48987
  "src/pod-sources.ts"() {
48602
48988
  "use strict";
48603
48989
  import_node_child_process42 = require("node:child_process");
48604
- import_node_crypto46 = require("node:crypto");
48990
+ import_node_crypto47 = require("node:crypto");
48605
48991
  import_node_fs72 = __toESM(require("node:fs"), 1);
48606
48992
  import_node_os17 = __toESM(require("node:os"), 1);
48607
48993
  import_node_path72 = __toESM(require("node:path"), 1);
@@ -55855,7 +56241,7 @@ function specRepo(url, refresh) {
55855
56241
  const dir = import_node_path73.default.join(
55856
56242
  cacheDir(),
55857
56243
  "cocoapods-repos",
55858
- (0, import_node_crypto47.createHash)("sha256").update(url).digest("hex").slice(0, 16)
56244
+ (0, import_node_crypto48.createHash)("sha256").update(url).digest("hex").slice(0, 16)
55859
56245
  );
55860
56246
  if (!import_node_fs73.default.existsSync(import_node_path73.default.join(dir, ".git"))) {
55861
56247
  const staged = `${dir}.${process.pid}`;
@@ -55885,7 +56271,7 @@ function podDir(repo, name3) {
55885
56271
  const specs = import_node_fs73.default.existsSync(import_node_path73.default.join(repo, "Specs")) ? import_node_path73.default.join(repo, "Specs") : repo;
55886
56272
  const metadata = import_node_path73.default.join(repo, "CocoaPods-version.yml");
55887
56273
  const lengths = import_node_fs73.default.existsSync(metadata) ? browser_default.parse(import_node_fs73.default.readFileSync(metadata, "utf8"))?.prefix_lengths : void 0;
55888
- const hash = (0, import_node_crypto47.createHash)("md5").update(name3).digest("hex");
56274
+ const hash = (0, import_node_crypto48.createHash)("md5").update(name3).digest("hex");
55889
56275
  let at = 0;
55890
56276
  const shards2 = (Array.isArray(lengths) ? lengths : []).map((length) => {
55891
56277
  if (typeof length !== "number")
@@ -55918,17 +56304,17 @@ async function sourceSpecificationFile(source, name3, version2) {
55918
56304
  if (!file) throw new Error(`${source} lists ${name3} ${version2} without a podspec`);
55919
56305
  return file;
55920
56306
  }
55921
- var import_node_child_process43, import_node_crypto47, import_node_fs73, import_node_path73, shard, shards, TRUNK_SOURCES, refreshed, specRepoKey;
56307
+ var import_node_child_process43, import_node_crypto48, import_node_fs73, import_node_path73, shard, shards, TRUNK_SOURCES, refreshed, specRepoKey;
55922
56308
  var init_cocoapods_trunk = __esm({
55923
56309
  "src/cocoapods-trunk.ts"() {
55924
56310
  "use strict";
55925
56311
  import_node_child_process43 = require("node:child_process");
55926
- import_node_crypto47 = require("node:crypto");
56312
+ import_node_crypto48 = require("node:crypto");
55927
56313
  import_node_fs73 = __toESM(require("node:fs"), 1);
55928
56314
  import_node_path73 = __toESM(require("node:path"), 1);
55929
56315
  init_browser();
55930
56316
  init_home_paths();
55931
- shard = (name3) => (0, import_node_crypto47.createHash)("md5").update(name3).digest("hex").slice(0, 3).split("");
56317
+ shard = (name3) => (0, import_node_crypto48.createHash)("md5").update(name3).digest("hex").slice(0, 3).split("");
55932
56318
  shards = /* @__PURE__ */ new Map();
55933
56319
  TRUNK_SOURCES = /* @__PURE__ */ new Set([
55934
56320
  "trunk",
@@ -65875,6 +66261,11 @@ end
65875
66261
  });
65876
66262
 
65877
66263
  // src/bazel-project.ts
66264
+ function sha256Hex4(bytes) {
66265
+ if (typeof Bun !== "undefined")
66266
+ return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
66267
+ return (0, import_node_crypto49.createHash)("sha256").update(bytes).digest("hex");
66268
+ }
65878
66269
  function isBazelPackage(input) {
65879
66270
  return /^BUILD(?:\.bazel)?$/.test(import_node_path83.default.basename(input)) && import_node_fs82.default.statSync(input).isFile();
65880
66271
  }
@@ -65904,7 +66295,7 @@ function bazelBinary(root) {
65904
66295
  const expected = (0, import_node_child_process44.execFileSync)("curl", ["-fsSL", `${url}.sha256`], {
65905
66296
  encoding: "utf8"
65906
66297
  }).split(/\s/)[0];
65907
- const actual = (0, import_node_crypto48.createHash)("sha256").update(import_node_fs82.default.readFileSync(partial)).digest("hex");
66298
+ const actual = (0, import_node_crypto49.createHash)("sha256").update(import_node_fs82.default.readFileSync(partial)).digest("hex");
65908
66299
  if (actual !== expected) {
65909
66300
  import_node_fs82.default.rmSync(partial, { force: true });
65910
66301
  throw new Error(`${url} digest ${actual} differs from its release ${expected}`);
@@ -65934,7 +66325,7 @@ function parseRule(raw2) {
65934
66325
  };
65935
66326
  }
65936
66327
  function graphInputsDigest(root) {
65937
- const hash = (0, import_node_crypto48.createHash)("sha256");
66328
+ const hash = (0, import_node_crypto49.createHash)("sha256");
65938
66329
  const visit3 = (dir) => {
65939
66330
  for (const entry of import_node_fs82.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
65940
66331
  if (entry.name.startsWith(".") || entry.name.startsWith("bazel-")) continue;
@@ -65967,7 +66358,7 @@ function bazelGraph(root, label, configuration) {
65967
66358
  const cached2 = graphs.get(key2);
65968
66359
  if (cached2) return cached2;
65969
66360
  const flags = configurationFlags(configuration);
65970
- const digest2 = (0, import_node_crypto48.createHash)("sha256").update(JSON.stringify([GRAPH_FORMAT, label, flags, QUERIED_RULES])).update(graphInputsDigest(root)).digest("hex").slice(0, 24);
66361
+ const digest2 = (0, import_node_crypto49.createHash)("sha256").update(JSON.stringify([GRAPH_FORMAT, label, flags, QUERIED_RULES])).update(graphInputsDigest(root)).digest("hex").slice(0, 24);
65971
66362
  const file = import_node_path83.default.join(root, ".build", "peach-bazel", `graph-${digest2}.json`);
65972
66363
  const bazel = bazelBinary(root);
65973
66364
  const run12 = (args) => (0, import_node_child_process44.execFileSync)(bazel, args, {
@@ -66441,6 +66832,18 @@ ${published2.map(
66441
66832
  `bazel application has ${missing.length} unbuilt inputs: ${missing.slice(0, 5).map((file) => import_node_path83.default.relative(root, file)).join(", ")}`
66442
66833
  );
66443
66834
  const archives = /* @__PURE__ */ new Map();
66835
+ let outputOwner;
66836
+ const ownerOfOutput = (file) => {
66837
+ if (!outputOwner) {
66838
+ outputOwner = /* @__PURE__ */ new Map();
66839
+ for (const item of graph.rules.values())
66840
+ for (const output of item.outputs) {
66841
+ const outputPath2 = files2.path(output);
66842
+ if (!outputOwner.has(outputPath2)) outputOwner.set(outputPath2, item);
66843
+ }
66844
+ }
66845
+ return outputOwner.get(file);
66846
+ };
66444
66847
  for (const rule of order) {
66445
66848
  for (const dep of rule.attrs.get("deps")?.list ?? []) {
66446
66849
  const owner = ruleOf(dep, rule.label);
@@ -66458,9 +66861,7 @@ ${published2.map(
66458
66861
  for (const raw2 of rule.attrs.get("srcs")?.list ?? []) {
66459
66862
  const label2 = canonicalLabel(raw2, rule.label);
66460
66863
  for (const archive of files2.expand([raw2], rule.label).filter((file) => file.endsWith(".a"))) {
66461
- const owner = [...graph.rules.values()].find(
66462
- (item) => item.outputs.some((output) => files2.path(output) === archive)
66463
- );
66864
+ const owner = ownerOfOutput(archive);
66464
66865
  const key2 = owner?.label ?? label2;
66465
66866
  const entry = archives.get(key2) ?? {
66466
66867
  library: import_node_path83.default.basename(archive),
@@ -66486,6 +66887,13 @@ ${published2.map(
66486
66887
  )
66487
66888
  )
66488
66889
  );
66890
+ const matchesAppInclude = (name3) => {
66891
+ if (appIncludes.has(name3)) return true;
66892
+ for (let slash = name3.indexOf("/"); slash >= 0; slash = name3.indexOf("/", slash + 1)) {
66893
+ if (appIncludes.has(name3.slice(slash + 1))) return true;
66894
+ }
66895
+ return false;
66896
+ };
66489
66897
  let generatedBy;
66490
66898
  const generators = () => {
66491
66899
  if (!generatedBy) {
@@ -66566,9 +66974,7 @@ ${published2.map(
66566
66974
  [...linkers].filter((rule) => rule.attrs.get("module_name")?.value).flatMap((rule) => files2.expand(rule.attrs.get("hdrs")?.list ?? [], rule.label))
66567
66975
  );
66568
66976
  const entries2 = headers.filter(
66569
- (header) => imported.has(header.file) || [...appIncludes].some(
66570
- (include) => header.name === include || header.name.endsWith(`/${include}`)
66571
- )
66977
+ (header) => imported.has(header.file) || matchesAppInclude(header.name)
66572
66978
  );
66573
66979
  const bundle = import_node_path83.default.join(products, "archives", `${name3}.xcframework`);
66574
66980
  const slice = import_node_path83.default.join(bundle, "ios-arm64-simulator");
@@ -66614,14 +67020,9 @@ ${published2.map(
66614
67020
  ]
66615
67021
  )
66616
67022
  ]);
66617
- const digest2 = (0, import_node_crypto48.createHash)("sha256").update(
66618
- JSON.stringify(
66619
- [...contents2].map(([file, bytes]) => [
66620
- file,
66621
- (0, import_node_crypto48.createHash)("sha256").update(bytes).digest("hex")
66622
- ])
66623
- )
66624
- ).digest("hex");
67023
+ const digest2 = sha256Hex4(
67024
+ JSON.stringify([...contents2].map(([file, bytes]) => [file, sha256Hex4(bytes)]))
67025
+ );
66625
67026
  const stamp = import_node_path83.default.join(bundle, ".peach-digest");
66626
67027
  if (!import_node_fs82.default.existsSync(stamp) || import_node_fs82.default.readFileSync(stamp, "utf8") !== digest2) {
66627
67028
  import_node_fs82.default.rmSync(bundle, { recursive: true, force: true });
@@ -66781,12 +67182,12 @@ function shellTokens(options2) {
66781
67182
  return words2;
66782
67183
  });
66783
67184
  }
66784
- var import_node_child_process44, import_node_crypto48, import_node_fs82, import_node_os18, import_node_path83, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER4, PRODUCTS, graphs, CLANG_CONFIGURATION_FLAGS, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
67185
+ var import_node_child_process44, import_node_crypto49, import_node_fs82, import_node_os18, import_node_path83, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER4, PRODUCTS, graphs, CLANG_CONFIGURATION_FLAGS, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
66785
67186
  var init_bazel_project = __esm({
66786
67187
  "src/bazel-project.ts"() {
66787
67188
  "use strict";
66788
67189
  import_node_child_process44 = require("node:child_process");
66789
- import_node_crypto48 = require("node:crypto");
67190
+ import_node_crypto49 = require("node:crypto");
66790
67191
  import_node_fs82 = __toESM(require("node:fs"), 1);
66791
67192
  import_node_os18 = __toESM(require("node:os"), 1);
66792
67193
  import_node_path83 = __toESM(require("node:path"), 1);
@@ -67681,7 +68082,7 @@ async function swiftBinaryModules(binary2) {
67681
68082
  if (!binary2.url) return localSwiftBinaryModules(binary2.dir);
67682
68083
  const cached2 = import_node_path84.default.join(
67683
68084
  cacheDir3,
67684
- `${(0, import_node_crypto49.createHash)("sha256").update(`${binary2.url}\0${binary2.checksum ?? ""}`).digest("hex").slice(0, 32)}.json`
68085
+ `${(0, import_node_crypto50.createHash)("sha256").update(`${binary2.url}\0${binary2.checksum ?? ""}`).digest("hex").slice(0, 32)}.json`
67685
68086
  );
67686
68087
  if (import_node_fs83.default.existsSync(cached2)) {
67687
68088
  const value = JSON.parse(import_node_fs83.default.readFileSync(cached2, "utf8"));
@@ -67693,11 +68094,11 @@ async function swiftBinaryModules(binary2) {
67693
68094
  import_node_fs83.default.writeFileSync(cached2, JSON.stringify(modules));
67694
68095
  return modules;
67695
68096
  }
67696
- var import_node_crypto49, import_node_fs83, import_node_path84, cacheDir3;
68097
+ var import_node_crypto50, import_node_fs83, import_node_path84, cacheDir3;
67697
68098
  var init_swift_binary_modules = __esm({
67698
68099
  "src/swift-binary-modules.ts"() {
67699
68100
  "use strict";
67700
- import_node_crypto49 = require("node:crypto");
68101
+ import_node_crypto50 = require("node:crypto");
67701
68102
  import_node_fs83 = __toESM(require("node:fs"), 1);
67702
68103
  import_node_path84 = __toESM(require("node:path"), 1);
67703
68104
  init_home_paths();
@@ -67707,11 +68108,11 @@ var init_swift_binary_modules = __esm({
67707
68108
  });
67708
68109
 
67709
68110
  // src/swift-coverage/provenance.ts
67710
- var import_node_crypto50, import_node_fs84, import_node_path85, swiftCoverageProvenance;
68111
+ var import_node_crypto51, import_node_fs84, import_node_path85, swiftCoverageProvenance;
67711
68112
  var init_provenance = __esm({
67712
68113
  "src/swift-coverage/provenance.ts"() {
67713
68114
  "use strict";
67714
- import_node_crypto50 = require("node:crypto");
68115
+ import_node_crypto51 = require("node:crypto");
67715
68116
  import_node_fs84 = require("node:fs");
67716
68117
  import_node_path85 = require("node:path");
67717
68118
  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":"32bf10d6f3396dd1a20ff6d415499a5990ec2550c63306fd9ef071bdf4a58f1e","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"c72b724fc497e4cf603c355f86eb3c07c929ad299758cffbc6ff88ed241654c6","xcode-project.ts":"e30510099ee19d34de62d8ae859df53f77594a4ab105fdb5bcd7e005ec9689ca","xcode-target-members.ts":"96f6a9f5567a4fbd9806252229b35b9a451a112b20f70f8c20189ffd428815fd","xcode-json-project.ts":"df6d6db28e0c8cfdf1f480e1e32d35f12c9cf1936642d5dda923889fb18a8fd6","openstep-plist.ts":"da11f86885ef1e25979ad989f332195c113c4b7a43f108e8d36646973430b81b"}') : swiftCoverageSourceDigests((0, import_node_path85.join)(__sootsim_import_meta_dirname, ".."));
@@ -68808,16 +69209,16 @@ function assetSymbolText(plan, root) {
68808
69209
  if (source.status === "unknown") throw new Error(source.reason);
68809
69210
  return source.text;
68810
69211
  }
68811
- var import_node_crypto51, import_node_fs86, import_node_path87, sha2562, unprovenAssetSettings, assetSymbolSettingKeys, provenOtherAssetFlags, symbolTexts;
69212
+ var import_node_crypto52, import_node_fs86, import_node_path87, sha2562, unprovenAssetSettings, assetSymbolSettingKeys, provenOtherAssetFlags, symbolTexts;
68812
69213
  var init_xcode_assets = __esm({
68813
69214
  "src/swift-coverage/xcode-assets.ts"() {
68814
69215
  "use strict";
68815
- import_node_crypto51 = require("node:crypto");
69216
+ import_node_crypto52 = require("node:crypto");
68816
69217
  import_node_fs86 = require("node:fs");
68817
69218
  import_node_path87 = require("node:path");
68818
69219
  init_provenance();
68819
69220
  init_xcode_asset_symbols();
68820
- sha2562 = (bytes) => (0, import_node_crypto51.createHash)("sha256").update(bytes).digest("hex");
69221
+ sha2562 = (bytes) => (0, import_node_crypto52.createHash)("sha256").update(bytes).digest("hex");
68821
69222
  unprovenAssetSettings = [
68822
69223
  "ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_FRAMEWORKS",
68823
69224
  "ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_WARNINGS",
@@ -69413,7 +69814,7 @@ function normalizedEnums(input) {
69413
69814
  }
69414
69815
  function localizationIdentifier(field, key2) {
69415
69816
  const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
69416
- const digest2 = (0, import_node_crypto52.createHash)("sha256").update(JSON.stringify([...field, key2])).digest();
69817
+ const digest2 = (0, import_node_crypto53.createHash)("sha256").update(JSON.stringify([...field, key2])).digest();
69417
69818
  return Array.from(
69418
69819
  digest2.subarray(0, 6),
69419
69820
  (byte) => alphabet[byte % alphabet.length]
@@ -69738,12 +70139,12 @@ function writeIntentDefinition(input, prefix) {
69738
70139
  lines.push("</plist>", "");
69739
70140
  return lines.join("\n");
69740
70141
  }
69741
- var import_strict4, import_node_crypto52, typeMetadata, initializeMetadata, widgetArraySizes, defaultReasonMessages;
70142
+ var import_strict4, import_node_crypto53, typeMetadata, initializeMetadata, widgetArraySizes, defaultReasonMessages;
69742
70143
  var init_metadata = __esm({
69743
70144
  "src/intent-definition/metadata.ts"() {
69744
70145
  "use strict";
69745
70146
  import_strict4 = __toESM(require("node:assert/strict"), 1);
69746
- import_node_crypto52 = require("node:crypto");
70147
+ import_node_crypto53 = require("node:crypto");
69747
70148
  init_fields();
69748
70149
  init_hash_input();
69749
70150
  init_siphash();
@@ -70452,7 +70853,7 @@ function preparePortableIntent(definition2, derivedDirectory, prefix, language,
70452
70853
  if (prefix) identifier(prefix);
70453
70854
  if (module2) identifier(module2);
70454
70855
  const source = import_node_fs87.default.readFileSync(definition2);
70455
- const key2 = (0, import_node_crypto53.createHash)("sha256").update(
70856
+ const key2 = (0, import_node_crypto54.createHash)("sha256").update(
70456
70857
  JSON.stringify([intentCompilerRevision, definition2, prefix, language, module2])
70457
70858
  ).update("\0").update(source).digest("hex");
70458
70859
  const cache = import_node_path88.default.join(derivedDirectory, "IntentDefinitions");
@@ -70492,11 +70893,11 @@ function preparePortableIntent(definition2, derivedDirectory, prefix, language,
70492
70893
  import_node_fs87.default.rmSync(stage, { recursive: true, force: true });
70493
70894
  }
70494
70895
  }
70495
- var import_node_crypto53, import_node_fs87, import_node_path88, intentCompilerRevision;
70896
+ var import_node_crypto54, import_node_fs87, import_node_path88, intentCompilerRevision;
70496
70897
  var init_xcode_intents = __esm({
70497
70898
  "src/xcode-intents.ts"() {
70498
70899
  "use strict";
70499
- import_node_crypto53 = require("node:crypto");
70900
+ import_node_crypto54 = require("node:crypto");
70500
70901
  import_node_fs87 = __toESM(require("node:fs"), 1);
70501
70902
  import_node_path88 = __toESM(require("node:path"), 1);
70502
70903
  init_fields();
@@ -71190,7 +71591,7 @@ function loadProject(xcodeproj) {
71190
71591
  if (!projectFile)
71191
71592
  throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
71192
71593
  const source = import_node_fs88.default.readFileSync(projectFile, "utf8");
71193
- const digest2 = (0, import_node_crypto54.createHash)("sha256").update(source).digest("hex");
71594
+ const digest2 = (0, import_node_crypto55.createHash)("sha256").update(source).digest("hex");
71194
71595
  const cached2 = loaded2.get(projectFile);
71195
71596
  if (cached2?.digest === digest2) return cached2.project;
71196
71597
  const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
@@ -71242,7 +71643,7 @@ function xcodeInstallationIdentity() {
71242
71643
  if (!selected) return null;
71243
71644
  const directory2 = import_node_path90.default.extname(selected) === ".app" ? import_node_path90.default.join(selected, "Contents", "Developer") : selected;
71244
71645
  const versionFile = `${directory2}/../version.plist`;
71245
- const version2 = import_node_fs88.default.existsSync(versionFile) ? (0, import_node_crypto54.createHash)("sha256").update(import_node_fs88.default.readFileSync(versionFile)).digest("hex") : null;
71646
+ const version2 = import_node_fs88.default.existsSync(versionFile) ? (0, import_node_crypto55.createHash)("sha256").update(import_node_fs88.default.readFileSync(versionFile)).digest("hex") : null;
71246
71647
  return { directory: directory2, version: version2 };
71247
71648
  }
71248
71649
  function defaultConfiguration(project) {
@@ -71710,7 +72111,7 @@ function targetMembers(ref, settings, options2, settingKeys, projectInputs) {
71710
72111
  );
71711
72112
  });
71712
72113
  }
71713
- const signature2 = (0, import_node_crypto54.createHash)("sha256").update(
72114
+ const signature2 = (0, import_node_crypto55.createHash)("sha256").update(
71714
72115
  JSON.stringify([phase, [...settingKeys].map((key3) => [key3, settings(key3)])])
71715
72116
  );
71716
72117
  for (const file of inputFiles) {
@@ -71865,7 +72266,7 @@ ${output}`
71865
72266
  const inputs2 = JSON.stringify([
71866
72267
  1,
71867
72268
  args,
71868
- (0, import_node_crypto54.createHash)("sha256").update(import_node_fs88.default.readFileSync(file)).digest("hex")
72269
+ (0, import_node_crypto55.createHash)("sha256").update(import_node_fs88.default.readFileSync(file)).digest("hex")
71869
72270
  ]);
71870
72271
  const developer = settings("DEVELOPER_DIR");
71871
72272
  const cached2 = import_node_fs88.default.existsSync(output) && import_node_fs88.default.existsSync(stamp) ? import_node_fs88.default.readFileSync(stamp, "utf8").split("\n") : [];
@@ -73185,12 +73586,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
73185
73586
  cocoapods
73186
73587
  };
73187
73588
  }
73188
- var import_node_child_process45, import_node_crypto54, import_node_fs88, import_node_module8, import_node_path90, 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, workspaceResolvedFile, SwiftPackageResolutionRequired;
73589
+ var import_node_child_process45, import_node_crypto55, import_node_fs88, import_node_module8, import_node_path90, 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, workspaceResolvedFile, SwiftPackageResolutionRequired;
73189
73590
  var init_xcode_project = __esm({
73190
73591
  "src/xcode-project.ts"() {
73191
73592
  "use strict";
73192
73593
  import_node_child_process45 = require("node:child_process");
73193
- import_node_crypto54 = require("node:crypto");
73594
+ import_node_crypto55 = require("node:crypto");
73194
73595
  import_node_fs88 = __toESM(require("node:fs"), 1);
73195
73596
  import_node_module8 = require("node:module");
73196
73597
  import_node_path90 = __toESM(require("node:path"), 1);
@@ -73380,8 +73781,8 @@ async function walkWorkspaceInputs(app, everyByte, sourceOnly, podsEnvironment)
73380
73781
  );
73381
73782
  const appRelative = import_node_path91.default.relative(root, app);
73382
73783
  const manifest = JSON.parse(import_node_fs89.default.readFileSync(import_node_path91.default.join(root, "package.json"), "utf8"));
73383
- const hash = (0, import_node_crypto55.createHash)("sha256");
73384
- const native = (0, import_node_crypto55.createHash)("sha256");
73784
+ const hash = (0, import_node_crypto56.createHash)("sha256");
73785
+ const native = (0, import_node_crypto56.createHash)("sha256");
73385
73786
  const nativeDirectories = localPackageDirectories(root, app);
73386
73787
  const versionFree = new Set(
73387
73788
  nativeDirectories.filter((directory2) => directory2 !== appRelative && directory2 !== "").filter(
@@ -73465,7 +73866,7 @@ async function walkWorkspaceInputs(app, everyByte, sourceOnly, podsEnvironment)
73465
73866
  unread.slice(start, start + 32).map(async ({ file, content }) => {
73466
73867
  const bytes = await import_node_fs89.default.promises.readFile(file);
73467
73868
  content.size = bytes.length;
73468
- content.digest = (0, import_node_crypto55.createHash)("sha256").update(bytes).digest("hex");
73869
+ content.digest = (0, import_node_crypto56.createHash)("sha256").update(bytes).digest("hex");
73469
73870
  fileDigests.set(file, content);
73470
73871
  })
73471
73872
  );
@@ -74012,7 +74413,7 @@ function stageCachedQuickCryptoOpenSsl(app) {
74012
74413
  const sha2565 = /openssl_sha256\s*=\s*"([0-9a-f]{64})"/.exec(podspec)?.[1];
74013
74414
  if (!sha2565) return;
74014
74415
  const archive = import_node_path91.default.join(cacheDir(), "pod-archives", `${sha2565}.zip`);
74015
- if (!import_node_fs89.default.existsSync(archive) || (0, import_node_crypto55.createHash)("sha256").update(import_node_fs89.default.readFileSync(archive)).digest("hex") !== sha2565)
74416
+ if (!import_node_fs89.default.existsSync(archive) || (0, import_node_crypto56.createHash)("sha256").update(import_node_fs89.default.readFileSync(archive)).digest("hex") !== sha2565)
74016
74417
  return;
74017
74418
  import_node_fs89.default.rmSync(opensslDir, { recursive: true, force: true });
74018
74419
  import_node_fs89.default.mkdirSync(opensslDir, { recursive: true });
@@ -74050,12 +74451,12 @@ ${failedOutputLine(command, cwd, bytes)}`
74050
74451
  });
74051
74452
  });
74052
74453
  }
74053
- var import_node_child_process46, import_node_crypto55, import_node_fs89, import_node_module9, import_node_os19, import_node_path91, import_node_util13, isolatedGitEnv, 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;
74454
+ var import_node_child_process46, import_node_crypto56, import_node_fs89, import_node_module9, import_node_os19, import_node_path91, import_node_util13, isolatedGitEnv, 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;
74054
74455
  var init_expo_native_workspace = __esm({
74055
74456
  "src/expo-native-workspace.ts"() {
74056
74457
  "use strict";
74057
74458
  import_node_child_process46 = require("node:child_process");
74058
- import_node_crypto55 = require("node:crypto");
74459
+ import_node_crypto56 = require("node:crypto");
74059
74460
  import_node_fs89 = __toESM(require("node:fs"), 1);
74060
74461
  import_node_module9 = require("node:module");
74061
74462
  import_node_os19 = __toESM(require("node:os"), 1);
@@ -74128,7 +74529,7 @@ function run() {
74128
74529
 
74129
74530
  // src/expo-discovery-cache.ts
74130
74531
  function peachPin() {
74131
- return (0, import_node_crypto56.createHash)("sha256").update(
74532
+ return (0, import_node_crypto57.createHash)("sha256").update(
74132
74533
  `${FORMAT}\0${expoNativeCompilerDigestValue()}\0${swiftNativePin().distribution.id}\0`
74133
74534
  ).update(JSON.stringify([...EXPO_EAGER_NATIVE_VIEWS])).update(JSON.stringify([...peachAnsweredNativePackages()].sort())).digest("hex");
74134
74535
  }
@@ -74142,7 +74543,7 @@ function stable(value) {
74142
74543
  }
74143
74544
  async function expoDiscoveryKey(options2) {
74144
74545
  const { root, hash } = await hashExpoWorkspace(options2.appRoot, options2.signal);
74145
- 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");
74546
+ 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");
74146
74547
  return { key: key2, root };
74147
74548
  }
74148
74549
  function expoDiscoveryCacheDir() {
@@ -74213,7 +74614,7 @@ function readExpoDiscovery(key2) {
74213
74614
  if (typeof parsed2.archive !== "string" || !isDigest(parsed2.archive)) return void 0;
74214
74615
  const archive = import_node_path92.default.join(expoDiscoveryCacheDir(), "blobs", `${parsed2.archive}.zst`);
74215
74616
  const bytes = import_node_fs90.default.readFileSync(archive);
74216
- if ((0, import_node_crypto56.createHash)("sha256").update(bytes).digest("hex") !== parsed2.archive)
74617
+ if ((0, import_node_crypto57.createHash)("sha256").update(bytes).digest("hex") !== parsed2.archive)
74217
74618
  return void 0;
74218
74619
  const bodies = (0, import_node_zlib6.zstdDecompressSync)(bytes);
74219
74620
  const decoded = /* @__PURE__ */ new Map();
@@ -74287,7 +74688,7 @@ function stampedFileHash(file) {
74287
74688
  const stamp = [stat.dev, stat.ino, stat.size, stat.mtimeNs, stat.ctimeNs].join(":");
74288
74689
  const cached2 = fileHashes.get(file);
74289
74690
  if (cached2?.stamp === stamp) return cached2.checksum;
74290
- const checksum = (0, import_node_crypto56.createHash)("sha256").update(import_node_fs90.default.readFileSync(file)).digest("hex");
74691
+ const checksum = (0, import_node_crypto57.createHash)("sha256").update(import_node_fs90.default.readFileSync(file)).digest("hex");
74291
74692
  fileHashes.set(file, { stamp, checksum });
74292
74693
  fileHashesChanged = true;
74293
74694
  return checksum;
@@ -74296,7 +74697,7 @@ function saveFileHashes() {
74296
74697
  if (!fileHashesChanged) return;
74297
74698
  fileHashesChanged = false;
74298
74699
  const target = fileHashesPath();
74299
- const temporary = `${target}.${process.pid}.${(0, import_node_crypto56.randomUUID)()}.tmp`;
74700
+ const temporary = `${target}.${process.pid}.${(0, import_node_crypto57.randomUUID)()}.tmp`;
74300
74701
  try {
74301
74702
  import_node_fs90.default.mkdirSync(import_node_path92.default.dirname(target), { recursive: true });
74302
74703
  import_node_fs90.default.writeFileSync(
@@ -74351,7 +74752,7 @@ function frameworkDigest(directory2, signal) {
74351
74752
  if (target !== root && !target.startsWith(`${root}${import_node_path92.default.sep}`))
74352
74753
  throw new Error(`framework link escapes its tree: ${relative3}`);
74353
74754
  }
74354
- return (0, import_node_crypto56.createHash)("sha256").update(JSON.stringify([...entries2])).digest("hex");
74755
+ return (0, import_node_crypto57.createHash)("sha256").update(JSON.stringify([...entries2])).digest("hex");
74355
74756
  }
74356
74757
  function rewritePreparedPaths(options2) {
74357
74758
  const { units, sourceRoot, preparedRoot, signal } = options2;
@@ -74372,7 +74773,7 @@ function rewritePreparedPaths(options2) {
74372
74773
  return null;
74373
74774
  }
74374
74775
  if (!preparedBytes.equals(sourceBytes)) return null;
74375
- dependencies[sourceFile] = (0, import_node_crypto56.createHash)("sha256").update(sourceBytes).digest("hex");
74776
+ dependencies[sourceFile] = (0, import_node_crypto57.createHash)("sha256").update(sourceBytes).digest("hex");
74376
74777
  verifiedFiles.set(preparedFile, sourceFile);
74377
74778
  return sourceFile;
74378
74779
  };
@@ -74449,7 +74850,7 @@ function rewritePreparedPaths(options2) {
74449
74850
  portableDir = import_node_path92.default.join(parent, import_node_path92.default.basename(dir));
74450
74851
  if (!import_node_fs90.default.existsSync(portableDir)) {
74451
74852
  import_node_fs90.default.mkdirSync(parent, { recursive: true });
74452
- const tmp = import_node_path92.default.join(parent, `.${process.pid}.${(0, import_node_crypto56.randomUUID)()}.tmp`);
74853
+ const tmp = import_node_path92.default.join(parent, `.${process.pid}.${(0, import_node_crypto57.randomUUID)()}.tmp`);
74453
74854
  try {
74454
74855
  import_node_fs90.default.cpSync(dir, tmp, { recursive: true, verbatimSymlinks: true });
74455
74856
  if (frameworkDigest(tmp, signal) !== preparedDigest)
@@ -74478,7 +74879,7 @@ function writeExpoDiscovery(options2) {
74478
74879
  try {
74479
74880
  const dir = expoDiscoveryCacheDir();
74480
74881
  import_node_fs90.default.mkdirSync(dir, { recursive: true });
74481
- const tmp = import_node_path92.default.join(dir, `.${options2.key}.${process.pid}.${(0, import_node_crypto56.randomUUID)()}.tmp`);
74882
+ const tmp = import_node_path92.default.join(dir, `.${options2.key}.${process.pid}.${(0, import_node_crypto57.randomUUID)()}.tmp`);
74482
74883
  if (options2.units === null) {
74483
74884
  import_node_fs90.default.writeFileSync(
74484
74885
  tmp,
@@ -74541,8 +74942,8 @@ function writeExpoDiscovery(options2) {
74541
74942
  }
74542
74943
  );
74543
74944
  const contents2 = (0, import_node_zlib6.zstdCompressSync)(Buffer.concat(chunks, size2));
74544
- const archive = (0, import_node_crypto56.createHash)("sha256").update(contents2).digest("hex");
74545
- const temporary = import_node_path92.default.join(blobDir, "." + (0, import_node_crypto56.randomUUID)() + ".tmp");
74945
+ const archive = (0, import_node_crypto57.createHash)("sha256").update(contents2).digest("hex");
74946
+ const temporary = import_node_path92.default.join(blobDir, "." + (0, import_node_crypto57.randomUUID)() + ".tmp");
74546
74947
  try {
74547
74948
  import_node_fs90.default.writeFileSync(temporary, contents2);
74548
74949
  import_node_fs90.default.renameSync(temporary, import_node_path92.default.join(blobDir, `${archive}.zst`));
@@ -74569,11 +74970,11 @@ function writeExpoDiscovery(options2) {
74569
74970
  return error instanceof Error ? error.message : String(error);
74570
74971
  }
74571
74972
  }
74572
- var import_node_crypto56, import_node_fs90, import_node_path92, import_node_zlib6, FORMAT, EXPIRY_MS, ORPHAN_TEMPORARY_MS, strings2, stringRecord, isDigest, digestRecord, isBodyOffset, isBodyOffsets, sourceLocationLine, fileHashes, fileHashesLoaded, fileHashesChanged, MISSING_TREE;
74973
+ var import_node_crypto57, import_node_fs90, import_node_path92, import_node_zlib6, FORMAT, EXPIRY_MS, ORPHAN_TEMPORARY_MS, strings2, stringRecord, isDigest, digestRecord, isBodyOffset, isBodyOffsets, sourceLocationLine, fileHashes, fileHashesLoaded, fileHashesChanged, MISSING_TREE;
74573
74974
  var init_expo_discovery_cache = __esm({
74574
74975
  "src/expo-discovery-cache.ts"() {
74575
74976
  "use strict";
74576
- import_node_crypto56 = require("node:crypto");
74977
+ import_node_crypto57 = require("node:crypto");
74577
74978
  import_node_fs90 = __toESM(require("node:fs"), 1);
74578
74979
  import_node_path92 = __toESM(require("node:path"), 1);
74579
74980
  import_node_zlib6 = require("node:zlib");
@@ -74994,7 +75395,7 @@ function hashPackageTree(root, options2) {
74994
75395
  }
74995
75396
  };
74996
75397
  walk4(root, "");
74997
- const hash = (0, import_node_crypto57.createHash)("sha256");
75398
+ const hash = (0, import_node_crypto58.createHash)("sha256");
74998
75399
  return (async () => {
74999
75400
  for (let start = 0; start < files2.length; start += READ_AHEAD) {
75000
75401
  const batch = files2.slice(start, start + READ_AHEAD);
@@ -75009,11 +75410,11 @@ function packageTreeDigest(root) {
75009
75410
  compareNames: (left, right) => left.localeCompare(right)
75010
75411
  });
75011
75412
  }
75012
- var import_node_crypto57, import_node_fs93, import_promises8, import_node_path95, READ_AHEAD;
75413
+ var import_node_crypto58, import_node_fs93, import_promises8, import_node_path95, READ_AHEAD;
75013
75414
  var init_package_tree_digest = __esm({
75014
75415
  "src/package-tree-digest.ts"() {
75015
75416
  "use strict";
75016
- import_node_crypto57 = require("node:crypto");
75417
+ import_node_crypto58 = require("node:crypto");
75017
75418
  import_node_fs93 = require("node:fs");
75018
75419
  import_promises8 = require("node:fs/promises");
75019
75420
  import_node_path95 = require("node:path");
@@ -75093,7 +75494,7 @@ async function expoNativeInputs(appRoot) {
75093
75494
  "swift-pin": JSON.stringify(swiftNativePin()),
75094
75495
  answered: JSON.stringify([...peachAnsweredNativePackages()].sort()),
75095
75496
  "pods-environment": JSON.stringify(reactNativePodsEnvironment()),
75096
- fingerprint: (0, import_node_crypto58.createHash)("sha256").update(lines.sort().join("\n")).digest("hex")
75497
+ fingerprint: (0, import_node_crypto59.createHash)("sha256").update(lines.sort().join("\n")).digest("hex")
75097
75498
  },
75098
75499
  packages
75099
75500
  };
@@ -75199,7 +75600,7 @@ async function prebuiltAppTarget(appRoot, signal, dependencies = "lockfile") {
75199
75600
  }
75200
75601
  function servedExpoSwift(appRoot, entry, app) {
75201
75602
  if (!entry.expoSwift) return null;
75202
- const rootId = `${(0, import_node_crypto58.createHash)("sha256").update(import_node_fs94.default.realpathSync(appRoot)).digest("hex")}/Expo`;
75603
+ const rootId = `${(0, import_node_crypto59.createHash)("sha256").update(import_node_fs94.default.realpathSync(appRoot)).digest("hex")}/Expo`;
75203
75604
  if (app.infoPlist === null) throw new Error("the prebuilt app target has no Info.plist");
75204
75605
  const installed = installedInfoPlist(app.infoPlist, entry.infoPlist);
75205
75606
  const infoPlist2 = Buffer.from(installed).toString("base64");
@@ -75227,11 +75628,11 @@ async function prebuiltExpoSwiftResult(appRoot, entry, signal) {
75227
75628
  await prebuiltAppTarget(appRoot, signal, "installed")
75228
75629
  );
75229
75630
  }
75230
- var import_node_crypto58, import_node_fs94, import_node_module12, import_node_path96, import_node_util14, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published, lookups, answers;
75631
+ var import_node_crypto59, import_node_fs94, import_node_module12, import_node_path96, import_node_util14, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published, lookups, answers;
75231
75632
  var init_expo_native_prebuilt = __esm({
75232
75633
  "src/expo-native-prebuilt.ts"() {
75233
75634
  "use strict";
75234
- import_node_crypto58 = require("node:crypto");
75635
+ import_node_crypto59 = require("node:crypto");
75235
75636
  import_node_fs94 = __toESM(require("node:fs"), 1);
75236
75637
  import_node_module12 = require("node:module");
75237
75638
  import_node_path96 = __toESM(require("node:path"), 1);
@@ -75293,7 +75694,7 @@ function watchNativeInputs(root) {
75293
75694
  (0, import_node_timers.clearTimeout)(expiry);
75294
75695
  for (const watcher of watchers) watcher.close();
75295
75696
  }
75296
- const inputs2 = { expiry, revision: (0, import_node_crypto59.randomUUID)() };
75697
+ const inputs2 = { expiry, revision: (0, import_node_crypto60.randomUUID)() };
75297
75698
  const watch = (directory2, recursive, name3) => {
75298
75699
  const watcher = import_node_fs95.default.watch(
75299
75700
  directory2,
@@ -75334,11 +75735,11 @@ function watchNativeInputs(root) {
75334
75735
  watchedInputs.set(workspace, inputs2);
75335
75736
  return inputs2;
75336
75737
  }
75337
- var import_node_crypto59, import_node_fs95, import_node_path97, import_node_timers, setTimeoutNode, RETENTION_MS, watchedInputs, NativePreparation;
75738
+ var import_node_crypto60, import_node_fs95, import_node_path97, import_node_timers, setTimeoutNode, RETENTION_MS, watchedInputs, NativePreparation;
75338
75739
  var init_native_preparation = __esm({
75339
75740
  "src/native-preparation.ts"() {
75340
75741
  "use strict";
75341
- import_node_crypto59 = require("node:crypto");
75742
+ import_node_crypto60 = require("node:crypto");
75342
75743
  import_node_fs95 = __toESM(require("node:fs"), 1);
75343
75744
  import_node_path97 = __toESM(require("node:path"), 1);
75344
75745
  import_node_timers = require("node:timers");
@@ -75518,7 +75919,7 @@ function nativeStaticLibraryEntry(recipe2, compiler, sdk2, distribution) {
75518
75919
  return { name: recipe2.name, inputs: inputs2, key: nativeEntryKey(inputs2) };
75519
75920
  }
75520
75921
  function nativeStaticLibraryRecipe(bytes) {
75521
- const digest2 = (0, import_node_crypto60.createHash)("sha256").update(bytes).digest("hex");
75922
+ const digest2 = (0, import_node_crypto61.createHash)("sha256").update(bytes).digest("hex");
75522
75923
  return NATIVE_STATIC_LIBRARY_RECIPES.find((item) => item.nativeSha256 === digest2);
75523
75924
  }
75524
75925
  function nativeStaticLibrary(file, recipe2, moduleRoot) {
@@ -75561,7 +75962,7 @@ function isRustSymbol(name3, demangled) {
75561
75962
  function rustStaticLibrary(file, moduleRoot) {
75562
75963
  const toolchain = swiftModuleToolchain(moduleRoot);
75563
75964
  const bytes = import_node_fs97.default.readFileSync(file);
75564
- const key2 = (0, import_node_crypto60.createHash)("sha256").update("rust-c-abi-v4\0").update(toolchain.release).update("\0").update(bytes).digest("hex");
75965
+ const key2 = (0, import_node_crypto61.createHash)("sha256").update("rust-c-abi-v4\0").update(toolchain.release).update("\0").update(bytes).digest("hex");
75565
75966
  const directory2 = import_node_path99.default.join(cacheDir(), "native-archives", key2);
75566
75967
  const archive = import_node_path99.default.join(directory2, "library.a");
75567
75968
  if (import_node_fs97.default.existsSync(archive)) return archive;
@@ -75590,7 +75991,7 @@ function rustStaticLibrary(file, moduleRoot) {
75590
75991
  const members2 = readArMembers(bytes, true);
75591
75992
  const seen = /* @__PURE__ */ new Set();
75592
75993
  const unique2 = members2.filter(({ name: name3, bytes: bytes2 }) => {
75593
- const identity2 = name3 + "\0" + (0, import_node_crypto60.createHash)("sha256").update(bytes2).digest("hex");
75994
+ const identity2 = name3 + "\0" + (0, import_node_crypto61.createHash)("sha256").update(bytes2).digest("hex");
75594
75995
  if (seen.has(identity2)) return false;
75595
75996
  seen.add(identity2);
75596
75997
  return true;
@@ -75637,14 +76038,14 @@ function rustStaticLibrary(file, moduleRoot) {
75637
76038
  function combineNativeStaticLibraries(files2, moduleRoot) {
75638
76039
  if (files2.length === 1) return files2[0];
75639
76040
  const toolchain = swiftModuleToolchain(moduleRoot);
75640
- const hash = (0, import_node_crypto60.createHash)("sha256").update(toolchain.release);
76041
+ const hash = (0, import_node_crypto61.createHash)("sha256").update(toolchain.release);
75641
76042
  for (const file of files2)
75642
76043
  hash.update("\0").update(import_node_path99.default.basename(file)).update("\0").update(import_node_fs97.default.readFileSync(file));
75643
76044
  const directory2 = import_node_path99.default.join(cacheDir(), "native-archives", hash.digest("hex"));
75644
76045
  const archive = import_node_path99.default.join(directory2, "combined.a");
75645
76046
  if (import_node_fs97.default.existsSync(archive)) return archive;
75646
76047
  import_node_fs97.default.mkdirSync(directory2, { recursive: true });
75647
- const temporary = import_node_path99.default.join(directory2, `combined-${(0, import_node_crypto60.randomUUID)()}.a`);
76048
+ const temporary = import_node_path99.default.join(directory2, `combined-${(0, import_node_crypto61.randomUUID)()}.a`);
75648
76049
  try {
75649
76050
  (0, import_node_child_process48.execFileSync)(import_node_path99.default.join(toolchain.toolchainBin, "llvm-ar"), [
75650
76051
  "qcsDL",
@@ -75657,12 +76058,12 @@ function combineNativeStaticLibraries(files2, moduleRoot) {
75657
76058
  }
75658
76059
  return archive;
75659
76060
  }
75660
- 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;
76061
+ 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;
75661
76062
  var init_native_static_libraries = __esm({
75662
76063
  "src/native-static-libraries.ts"() {
75663
76064
  "use strict";
75664
76065
  import_node_child_process48 = require("node:child_process");
75665
- import_node_crypto60 = require("node:crypto");
76066
+ import_node_crypto61 = require("node:crypto");
75666
76067
  import_node_fs97 = __toESM(require("node:fs"), 1);
75667
76068
  import_node_path99 = __toESM(require("node:path"), 1);
75668
76069
  init_home_paths();
@@ -76267,13 +76668,13 @@ var init_swift_wasm64_wamr = __esm({
76267
76668
 
76268
76669
  // src/swift-wasm64-native-source.ts
76269
76670
  function deriveSource(file, bytes, backport) {
76270
- if (!backport || (0, import_node_crypto61.createHash)("sha256").update(bytes).digest("hex") !== backport.originalSha256)
76671
+ if (!backport || (0, import_node_crypto62.createHash)("sha256").update(bytes).digest("hex") !== backport.originalSha256)
76271
76672
  return null;
76272
76673
  const source = bytes.toString("utf8");
76273
76674
  const derived = Buffer.from(
76274
76675
  "rewrite" in backport ? backport.rewrite(source) : source.replace(backport.before, backport.after)
76275
76676
  );
76276
- if ((0, import_node_crypto61.createHash)("sha256").update(derived).digest("hex") !== backport.derivedSha256)
76677
+ if ((0, import_node_crypto62.createHash)("sha256").update(derived).digest("hex") !== backport.derivedSha256)
76277
76678
  throw new Error(`Native source derivation differs: ${file}`);
76278
76679
  return {
76279
76680
  bytes: derived,
@@ -76292,11 +76693,11 @@ function deriveWasm64NativeSource(file, bytes) {
76292
76693
  sourceDerivations.get(name3) ?? headerDerivations.get(name3)
76293
76694
  );
76294
76695
  }
76295
- var import_node_crypto61, import_node_path101, webrtcUnknownArchitecture, boringsslWordSize2, wamrCommit, headerDerivations, sourceDerivations;
76696
+ var import_node_crypto62, import_node_path101, webrtcUnknownArchitecture, boringsslWordSize2, wamrCommit, headerDerivations, sourceDerivations;
76296
76697
  var init_swift_wasm64_native_source = __esm({
76297
76698
  "src/swift-wasm64-native-source.ts"() {
76298
76699
  "use strict";
76299
- import_node_crypto61 = require("node:crypto");
76700
+ import_node_crypto62 = require("node:crypto");
76300
76701
  import_node_path101 = __toESM(require("node:path"), 1);
76301
76702
  init_swift_wasm64_wamr();
76302
76703
  init_swiftWasm64ConfigContract();
@@ -76756,7 +77157,7 @@ var init_genrule_library_builds = __esm({
76756
77157
  function nativeFrameworkCompiler(moduleRoot, toolchainBin, directory2) {
76757
77158
  const distribution = swiftDistributionAt(moduleRoot);
76758
77159
  const sdk2 = swiftSdkPaths(moduleRoot, toolchainBin);
76759
- const identity2 = (0, import_node_crypto62.createHash)("sha256").update(
77160
+ const identity2 = (0, import_node_crypto63.createHash)("sha256").update(
76760
77161
  JSON.stringify([
76761
77162
  distribution?.id,
76762
77163
  distribution?.link,
@@ -76782,7 +77183,7 @@ function nativeFrameworkCompiler(moduleRoot, toolchainBin, directory2) {
76782
77183
  for (const alias of product.frameworkAliases) {
76783
77184
  if (alias.wasmSdkId !== distribution.wasmSdkId || alias.wasmSdkChecksum !== distribution.wasmSdkChecksum)
76784
77185
  throw new Error(`framework SDK identity differs for ${alias.name}`);
76785
- 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)
77186
+ 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)
76786
77187
  throw new Error(`framework module map changed ${alias.moduleMap}`);
76787
77188
  const selected = /* @__PURE__ */ new Set();
76788
77189
  const reach = (name3) => {
@@ -76823,7 +77224,7 @@ function nativeFrameworkCompiler(moduleRoot, toolchainBin, directory2) {
76823
77224
  for (const alias of owner.frameworkAliases) {
76824
77225
  if (frameworkResponses[alias.name])
76825
77226
  throw new Error(`ambiguous declared framework ${alias.name}`);
76826
- 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)
77227
+ 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)
76827
77228
  throw new Error(`framework module map changed ${alias.moduleMap}`);
76828
77229
  const file = import_node_path103.default.join(root, `${alias.name}.rsp`);
76829
77230
  import_node_fs100.default.writeFileSync(file, aliasArtifacts.map(quote3).join("\n") + "\n");
@@ -76917,11 +77318,11 @@ exec ${shellQuote(configuration.compiler)} "$@"
76917
77318
  };
76918
77319
  return { cc: compiler("clang"), cxx: compiler("clang++"), identity: identity2 };
76919
77320
  }
76920
- var import_node_crypto62, import_node_fs100, import_node_path103, v7;
77321
+ var import_node_crypto63, import_node_fs100, import_node_path103, v7;
76921
77322
  var init_native_framework_compiler = __esm({
76922
77323
  "src/native-framework-compiler.ts"() {
76923
77324
  "use strict";
76924
- import_node_crypto62 = require("node:crypto");
77325
+ import_node_crypto63 = require("node:crypto");
76925
77326
  import_node_fs100 = __toESM(require("node:fs"), 1);
76926
77327
  import_node_path103 = __toESM(require("node:path"), 1);
76927
77328
  v7 = __toESM(require("peachsim/vendor/valibot"), 1);
@@ -76942,7 +77343,7 @@ function processAlive(pid) {
76942
77343
  }
76943
77344
  function tryAcquireNumberedLock(directory2, detail = "") {
76944
77345
  (0, import_node_fs101.mkdirSync)(directory2, { recursive: true });
76945
- const claim = (0, import_node_path104.join)(directory2, `claim-${process.pid}-${(0, import_node_crypto63.randomUUID)()}`);
77346
+ const claim = (0, import_node_path104.join)(directory2, `claim-${process.pid}-${(0, import_node_crypto64.randomUUID)()}`);
76946
77347
  for (; ; ) {
76947
77348
  const numbers = (0, import_node_fs101.readdirSync)(directory2).filter((name3) => /^\d+$/.test(name3)).map(Number);
76948
77349
  const top = Math.max(-1, ...numbers);
@@ -76981,11 +77382,11 @@ ${detail}` : ""}`);
76981
77382
  };
76982
77383
  }
76983
77384
  }
76984
- var import_node_crypto63, import_node_fs101, import_node_path104, errorCode2;
77385
+ var import_node_crypto64, import_node_fs101, import_node_path104, errorCode2;
76985
77386
  var init_numbered_lock = __esm({
76986
77387
  "src/numbered-lock.ts"() {
76987
77388
  "use strict";
76988
- import_node_crypto63 = require("node:crypto");
77389
+ import_node_crypto64 = require("node:crypto");
76989
77390
  import_node_fs101 = require("node:fs");
76990
77391
  import_node_path104 = require("node:path");
76991
77392
  errorCode2 = (error) => error instanceof Error && "code" in error ? error.code : void 0;
@@ -77012,7 +77413,7 @@ function llvmIdentity(toolchainBin, release) {
77012
77413
  ] : ["clang", "wasm-ld", "llvm-ar", "llvm-nm", "llvm-strip"].map(
77013
77414
  (name3) => swiftFileChecksum(import_node_path105.default.join(toolchainBin, name3))
77014
77415
  );
77015
- const identity2 = (0, import_node_crypto64.createHash)("sha256").update(JSON.stringify(components)).digest("hex");
77416
+ const identity2 = (0, import_node_crypto65.createHash)("sha256").update(JSON.stringify(components)).digest("hex");
77016
77417
  toolIdentities.set(toolchainBin, identity2);
77017
77418
  return identity2;
77018
77419
  }
@@ -77020,7 +77421,7 @@ function cSdkIdentity(sysroot, resourceDir, frameworks) {
77020
77421
  const key2 = JSON.stringify([sysroot, resourceDir, frameworks]);
77021
77422
  const cached2 = sysrootIdentities.get(key2);
77022
77423
  if (cached2) return cached2;
77023
- const hash = (0, import_node_crypto64.createHash)("sha256");
77424
+ const hash = (0, import_node_crypto65.createHash)("sha256");
77024
77425
  const add = (root, relative3) => {
77025
77426
  const file = import_node_path105.default.join(root, relative3);
77026
77427
  const stat = import_node_fs102.default.statSync(file, { throwIfNoEntry: false });
@@ -77055,7 +77456,7 @@ function frameworkProbeIdentity(moduleRoot, toolchainBin) {
77055
77456
  import_node_fs102.default.readFileSync(import_node_path105.default.join(moduleRoot, SWIFT_FRAMEWORK_PRODUCT_FILE), "utf8")
77056
77457
  )
77057
77458
  );
77058
- const hash = (0, import_node_crypto64.createHash)("sha256").update(
77459
+ const hash = (0, import_node_crypto65.createHash)("sha256").update(
77059
77460
  JSON.stringify([
77060
77461
  headers,
77061
77462
  distribution.link,
@@ -77065,7 +77466,7 @@ function frameworkProbeIdentity(moduleRoot, toolchainBin) {
77065
77466
  ])
77066
77467
  );
77067
77468
  const objects = distribution.objects.map((file) => [file, distribution.files[file]]);
77068
- const objectKey = (0, import_node_crypto64.createHash)("sha256").update(JSON.stringify(objects)).digest("hex");
77469
+ const objectKey = (0, import_node_crypto65.createHash)("sha256").update(JSON.stringify(objects)).digest("hex");
77069
77470
  const cache = import_node_path105.default.join(cacheDir4, "framework-symbols-by-object", objectKey);
77070
77471
  if (!import_node_fs102.default.existsSync(cache)) {
77071
77472
  import_node_fs102.default.mkdirSync(import_node_path105.default.dirname(cache), { recursive: true });
@@ -77100,7 +77501,7 @@ function frameworkProbeIdentity(moduleRoot, toolchainBin) {
77100
77501
  const digest2 = import_node_path105.default.join(temporary, "digest");
77101
77502
  import_node_fs102.default.writeFileSync(
77102
77503
  digest2,
77103
- (0, import_node_crypto64.createHash)("sha256").update(symbols.sort().join("\n")).digest("hex")
77504
+ (0, import_node_crypto65.createHash)("sha256").update(symbols.sort().join("\n")).digest("hex")
77104
77505
  );
77105
77506
  import_node_fs102.default.renameSync(digest2, cache);
77106
77507
  } finally {
@@ -77155,7 +77556,7 @@ function buildable(declaration) {
77155
77556
  return builderOf(declaration) !== null && declaration.dependencies.every(buildable);
77156
77557
  }
77157
77558
  function declarationInputs(declaration, builder, toolchain, dependencyKeys) {
77158
- const hash = (0, import_node_crypto64.createHash)("sha256");
77559
+ const hash = (0, import_node_crypto65.createHash)("sha256");
77159
77560
  const files2 = declaration.sources.filter(
77160
77561
  (source) => !source.generator && !source.file.split(import_node_path105.default.sep).includes(".git")
77161
77562
  ).map((source) => import_node_path105.default.relative(declaration.packageDir, source.file));
@@ -77289,12 +77690,12 @@ function genruleArchive(declaration, library, moduleRoot) {
77289
77690
  }
77290
77691
  return combined;
77291
77692
  }
77292
- var import_node_child_process51, import_node_crypto64, import_node_fs102, import_node_os21, import_node_path105, v8, BUILDERS, cacheDir4, toolIdentities, sysrootIdentities, GENRULE_RECIPE, GENRULE_BUNDLE;
77693
+ var import_node_child_process51, import_node_crypto65, import_node_fs102, import_node_os21, import_node_path105, v8, BUILDERS, cacheDir4, toolIdentities, sysrootIdentities, GENRULE_RECIPE, GENRULE_BUNDLE;
77293
77694
  var init_genrule_archives = __esm({
77294
77695
  "src/genrule-archives.ts"() {
77295
77696
  "use strict";
77296
77697
  import_node_child_process51 = require("node:child_process");
77297
- import_node_crypto64 = require("node:crypto");
77698
+ import_node_crypto65 = require("node:crypto");
77298
77699
  import_node_fs102 = __toESM(require("node:fs"), 1);
77299
77700
  import_node_os21 = __toESM(require("node:os"), 1);
77300
77701
  import_node_path105 = __toESM(require("node:path"), 1);
@@ -77402,7 +77803,7 @@ function privateSentrySlice(entry, moduleRoot) {
77402
77803
  function nativeSwiftSlice(standin, moduleRoot, generator, configured, artifact) {
77403
77804
  if (standin.module !== SENTRY_SWIFT_SLICE.name) return standin;
77404
77805
  const native = simulatorNativeLibrary(artifact());
77405
- if (!native || (0, import_node_crypto65.createHash)("sha256").update(import_node_fs103.default.readFileSync(native.file)).digest("hex") !== SENTRY_SWIFT_SLICE.nativeSha256)
77806
+ if (!native || (0, import_node_crypto66.createHash)("sha256").update(import_node_fs103.default.readFileSync(native.file)).digest("hex") !== SENTRY_SWIFT_SLICE.nativeSha256)
77406
77807
  return standin;
77407
77808
  if (configured)
77408
77809
  throw new Error(
@@ -77460,12 +77861,12 @@ function nativeSwiftSlice(standin, moduleRoot, generator, configured, artifact)
77460
77861
  }
77461
77862
  };
77462
77863
  }
77463
- var import_node_child_process52, import_node_crypto65, import_node_fs103, import_node_os22, import_node_path106, SENTRY_SWIFT_SLICE;
77864
+ var import_node_child_process52, import_node_crypto66, import_node_fs103, import_node_os22, import_node_path106, SENTRY_SWIFT_SLICE;
77464
77865
  var init_native_swift_slices = __esm({
77465
77866
  "src/native-swift-slices.ts"() {
77466
77867
  "use strict";
77467
77868
  import_node_child_process52 = require("node:child_process");
77468
- import_node_crypto65 = require("node:crypto");
77869
+ import_node_crypto66 = require("node:crypto");
77469
77870
  import_node_fs103 = __toESM(require("node:fs"), 1);
77470
77871
  import_node_os22 = __toESM(require("node:os"), 1);
77471
77872
  import_node_path106 = __toESM(require("node:path"), 1);
@@ -78273,7 +78674,7 @@ function treeDigest2(root) {
78273
78674
  }).join("\n");
78274
78675
  const memo2 = digests.get(`tree\0${root}`);
78275
78676
  if (memo2?.stamp === stamp) return memo2.digest;
78276
- const hash = (0, import_node_crypto66.createHash)("sha256");
78677
+ const hash = (0, import_node_crypto67.createHash)("sha256");
78277
78678
  for (const name3 of names) {
78278
78679
  hash.update(`${name3}\0`);
78279
78680
  hash.update(import_node_fs107.default.readFileSync(import_node_path109.default.join(root, name3)));
@@ -78320,7 +78721,7 @@ function swiftBinaryFramework(binary2) {
78320
78721
  const found3 = locateXcframework(import_node_path109.default.join(dir, "tree"));
78321
78722
  if (found3) return { dir: found3, digest: stored.sha };
78322
78723
  }
78323
- const sha2 = (0, import_node_crypto66.createHash)("sha256").update(import_node_fs107.default.readFileSync(binary2.dir)).digest("hex");
78724
+ const sha2 = (0, import_node_crypto67.createHash)("sha256").update(import_node_fs107.default.readFileSync(binary2.dir)).digest("hex");
78324
78725
  if (sha2 !== stored?.sha || !locateXcframework(import_node_path109.default.join(dir, "tree"))) {
78325
78726
  import_node_fs107.default.rmSync(dir, { recursive: true, force: true });
78326
78727
  import_node_fs107.default.mkdirSync(import_node_path109.default.join(dir, "tree"), { recursive: true });
@@ -78332,7 +78733,7 @@ function swiftBinaryFramework(binary2) {
78332
78733
  return { dir: found2, digest: sha2 };
78333
78734
  }
78334
78735
  if (stored && import_node_fs107.default.existsSync(archive)) {
78335
- const sha2 = (0, import_node_crypto66.createHash)("sha256").update(import_node_fs107.default.readFileSync(archive)).digest("hex");
78736
+ const sha2 = (0, import_node_crypto67.createHash)("sha256").update(import_node_fs107.default.readFileSync(archive)).digest("hex");
78336
78737
  if (sha2 !== expected)
78337
78738
  throw new Error(`archive checksum ${sha2} is not the declared checksum ${expected}`);
78338
78739
  const found2 = locateXcframework(import_node_path109.default.join(dir, "tree"));
@@ -78341,7 +78742,7 @@ function swiftBinaryFramework(binary2) {
78341
78742
  import_node_fs107.default.rmSync(dir, { recursive: true, force: true });
78342
78743
  import_node_fs107.default.mkdirSync(import_node_path109.default.join(dir, "tree"), { recursive: true });
78343
78744
  exec("curl", ["-fsSL", "--retry", "2", "-o", archive, binary2.url]);
78344
- const sha = (0, import_node_crypto66.createHash)("sha256").update(import_node_fs107.default.readFileSync(archive)).digest("hex");
78745
+ const sha = (0, import_node_crypto67.createHash)("sha256").update(import_node_fs107.default.readFileSync(archive)).digest("hex");
78345
78746
  if (sha !== expected) {
78346
78747
  import_node_fs107.default.rmSync(dir, { recursive: true, force: true });
78347
78748
  throw new Error(`archive checksum ${sha} is not the declared checksum ${expected}`);
@@ -78466,7 +78867,7 @@ function binaryHeaderSearchPaths(binary2, root, workspaceRoot2, declaredFramewor
78466
78867
  });
78467
78868
  }
78468
78869
  }
78469
- const declaredDigest = (0, import_node_crypto66.createHash)("sha256");
78870
+ const declaredDigest = (0, import_node_crypto67.createHash)("sha256");
78470
78871
  for (const framework of providedFrameworks)
78471
78872
  declaredDigest.update(`provided/${import_node_path109.default.relative(artifact.dir, framework)}\0`);
78472
78873
  for (const [framework, { declared: names, imports: imports2, sdkHeader }] of declared)
@@ -78536,7 +78937,7 @@ function binaryHeaderSearchPaths(binary2, root, workspaceRoot2, declaredFramewor
78536
78937
  import_node_fs107.default.copyFileSync(surface.modulemap, modulemap);
78537
78938
  }
78538
78939
  }
78539
- const contents2 = (0, import_node_crypto66.createHash)("sha256");
78940
+ const contents2 = (0, import_node_crypto67.createHash)("sha256");
78540
78941
  for (const framework of providedFrameworks.filter((item) => !declared.has(item))) {
78541
78942
  const modulemap = import_node_path109.default.join(
78542
78943
  pending,
@@ -79951,7 +80352,7 @@ function crateSourceRoots(manifest, searchRoot) {
79951
80352
  return roots;
79952
80353
  }
79953
80354
  function crateSourceDigest(manifest, searchRoot) {
79954
- const hash = (0, import_node_crypto66.createHash)("sha256");
80355
+ const hash = (0, import_node_crypto67.createHash)("sha256");
79955
80356
  const walk4 = (dir, root) => {
79956
80357
  for (const entry of import_node_fs107.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
79957
80358
  const full = import_node_path109.default.join(dir, entry.name);
@@ -80398,7 +80799,7 @@ function standinGenerationInputs(binaries, toolchain, configuredBehavior = {}, s
80398
80799
  ...swiftSources.flags,
80399
80800
  ...swiftSources.sources.flatMap((source) => [
80400
80801
  source,
80401
- (0, import_node_crypto66.createHash)("sha256").update(import_node_fs107.default.readFileSync(import_node_path109.default.join(binary2.dir, source))).digest("hex")
80802
+ (0, import_node_crypto67.createHash)("sha256").update(import_node_fs107.default.readFileSync(import_node_path109.default.join(binary2.dir, source))).digest("hex")
80402
80803
  ])
80403
80804
  );
80404
80805
  continue;
@@ -80434,7 +80835,7 @@ function standinGenerationInputs(binaries, toolchain, configuredBehavior = {}, s
80434
80835
  );
80435
80836
  }
80436
80837
  }
80437
- return (0, import_node_crypto66.createHash)("sha256").update(parts.join("\0")).digest("hex");
80838
+ return (0, import_node_crypto67.createHash)("sha256").update(parts.join("\0")).digest("hex");
80438
80839
  }
80439
80840
  function missingArtifactGap(binary2) {
80440
80841
  if (swiftBinaryOnDisk(binary2)) return null;
@@ -80516,7 +80917,7 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
80516
80917
  return NO_IMPORTABLE_SURFACE;
80517
80918
  }
80518
80919
  const configured = new Map(Object.entries(behavior));
80519
- const hash = (0, import_node_crypto66.createHash)("sha256").update(
80920
+ const hash = (0, import_node_crypto67.createHash)("sha256").update(
80520
80921
  standinGenerationInputs([binary2], toolchain, behavior)
80521
80922
  );
80522
80923
  hash.update(digest2);
@@ -80756,7 +81157,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
80756
81157
  );
80757
81158
  if (binary2.moduleSources !== void 0)
80758
81159
  frameworkInputs.push(
80759
- `${binary2.target}\0${(0, import_node_crypto66.createHash)("sha256").update(
81160
+ `${binary2.target}\0${(0, import_node_crypto67.createHash)("sha256").update(
80760
81161
  [iosSdkId(), ...swiftSources.flags, ...swiftSources.sources, ...texts].join(
80761
81162
  "\0"
80762
81163
  )
@@ -80797,7 +81198,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
80797
81198
  import_node_fs107.default.mkdirSync(sourceFrameworks);
80798
81199
  const frameworks = {
80799
81200
  dirs: [...frameworkDirs, sourceFrameworks].sort(),
80800
- digest: (0, import_node_crypto66.createHash)("sha256").update(frameworkInputs.sort().join("\0")).digest("hex"),
81201
+ digest: (0, import_node_crypto67.createHash)("sha256").update(frameworkInputs.sort().join("\0")).digest("hex"),
80801
81202
  surfaces: frameworkSurfaces
80802
81203
  };
80803
81204
  const siblings = new Map(
@@ -80916,12 +81317,12 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
80916
81317
  import_node_fs107.default.rmSync(modules, { recursive: true, force: true });
80917
81318
  }
80918
81319
  }
80919
- 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;
81320
+ 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;
80920
81321
  var init_swift_standins = __esm({
80921
81322
  "src/swift-standins.ts"() {
80922
81323
  "use strict";
80923
81324
  import_node_child_process54 = require("node:child_process");
80924
- import_node_crypto66 = require("node:crypto");
81325
+ import_node_crypto67 = require("node:crypto");
80925
81326
  import_node_fs107 = __toESM(require("node:fs"), 1);
80926
81327
  import_node_path109 = __toESM(require("node:path"), 1);
80927
81328
  init_forked_script_contract();
@@ -80951,7 +81352,7 @@ var init_swift_standins = __esm({
80951
81352
  init_swiftTargetContract();
80952
81353
  TRIPLE = SWIFT_WASM_TRIPLE;
80953
81354
  cacheDir5 = import_node_path109.default.join(cacheDir(), "swift-standins");
80954
- key = (...parts) => (0, import_node_crypto66.createHash)("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
81355
+ key = (...parts) => (0, import_node_crypto67.createHash)("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
80955
81356
  digests = /* @__PURE__ */ new Map();
80956
81357
  isBinaryLibraryFile = (file) => /\.(?:a|dylib|o|tbd)$/i.test(file);
80957
81358
  OBJC_IMPORT = /#\s*(?:import|include)\s*[<"](?:[\w+-]+\/)?([\w+.-]+\.h)[>"]/g;
@@ -81111,10 +81512,10 @@ function compiledFrameworkImports(app, products) {
81111
81512
  }
81112
81513
  return imports2;
81113
81514
  }
81114
- function sha256Hex(bytes) {
81515
+ function sha256Hex5(bytes) {
81115
81516
  if (typeof Bun !== "undefined")
81116
81517
  return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
81117
- return (0, import_node_crypto67.createHash)("sha256").update(bytes).digest("hex");
81518
+ return (0, import_node_crypto68.createHash)("sha256").update(bytes).digest("hex");
81118
81519
  }
81119
81520
  function regularFileStamp(file) {
81120
81521
  const stat = import_node_fs108.default.lstatSync(file, { bigint: true, throwIfNoEntry: false });
@@ -81129,7 +81530,7 @@ function verifyRetainedFile(work, file, hash, stamps) {
81129
81530
  if (typeof expectedStamp === "string" && regularFileStamp(resolved) === expectedStamp)
81130
81531
  return true;
81131
81532
  if (!import_node_fs108.default.existsSync(resolved)) return false;
81132
- return sha256Hex(readPackageFile(work, resolved, Infinity)) === hash;
81533
+ return sha256Hex5(readPackageFile(work, resolved, Infinity)) === hash;
81133
81534
  }
81134
81535
  function recordRetainedStamps(work, files2) {
81135
81536
  const stamps = {};
@@ -81146,7 +81547,7 @@ function cachedBinaryFileDigest(file) {
81146
81547
  const memory = binaryFileDigests.get(real);
81147
81548
  if (memory?.stamp === stamp) return memory.digest;
81148
81549
  const dir = import_node_path110.default.join(cacheDir(), "swift-binary-digests");
81149
- const record4 = import_node_path110.default.join(dir, `${sha256Hex(real)}.json`);
81550
+ const record4 = import_node_path110.default.join(dir, `${sha256Hex5(real)}.json`);
81150
81551
  if (import_node_fs108.default.existsSync(record4)) {
81151
81552
  const saved = JSON.parse(import_node_fs108.default.readFileSync(record4, "utf8"));
81152
81553
  if (isRecord(saved) && saved.stamp === stamp && typeof saved.digest === "string") {
@@ -81154,10 +81555,10 @@ function cachedBinaryFileDigest(file) {
81154
81555
  return saved.digest;
81155
81556
  }
81156
81557
  }
81157
- const digest2 = sha256Hex(import_node_fs108.default.readFileSync(real));
81558
+ const digest2 = sha256Hex5(import_node_fs108.default.readFileSync(real));
81158
81559
  binaryFileDigests.set(real, { stamp, digest: digest2 });
81159
81560
  import_node_fs108.default.mkdirSync(dir, { recursive: true });
81160
- const partial = `${record4}.${process.pid}.${(0, import_node_crypto67.randomUUID)()}`;
81561
+ const partial = `${record4}.${process.pid}.${(0, import_node_crypto68.randomUUID)()}`;
81161
81562
  import_node_fs108.default.writeFileSync(partial, JSON.stringify({ stamp, digest: digest2 }));
81162
81563
  import_node_fs108.default.renameSync(partial, record4);
81163
81564
  return digest2;
@@ -81689,7 +82090,7 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
81689
82090
  const staged = withFrameworkCompanionImports(original);
81690
82091
  if (staged !== original) sources.set(file, Buffer.from(staged));
81691
82092
  }
81692
- const digest2 = sha256Hex;
82093
+ const digest2 = sha256Hex5;
81693
82094
  const providers = /* @__PURE__ */ new Map();
81694
82095
  for (const target of targets) {
81695
82096
  if (!supplied.has(target.moduleName)) continue;
@@ -82045,7 +82446,7 @@ async function prepareXcodeNativeInputs(app, binaries, moduleRoot, purpose) {
82045
82446
  products
82046
82447
  );
82047
82448
  const checkouts = remoteSwiftCheckouts(app.rootDir);
82048
- const digest2 = sha256Hex;
82449
+ const digest2 = sha256Hex5;
82049
82450
  const inputs2 = Object.fromEntries(
82050
82451
  [...sources].map(([file, bytes]) => [file, digest2(bytes)])
82051
82452
  );
@@ -82327,6 +82728,7 @@ async function prepareXcodeNativeInputs(app, binaries, moduleRoot, purpose) {
82327
82728
  ...flags,
82328
82729
  ...target.prefix ? ["-include", staged(target.prefix)] : [],
82329
82730
  "-Os",
82731
+ ...purpose === "objects" ? ["-g0"] : [],
82330
82732
  "-c",
82331
82733
  staged(file),
82332
82734
  "-o",
@@ -82426,12 +82828,12 @@ ${reported.trimEnd() || `Clang exited with status ${result.status}`}`;
82426
82828
  import_node_fs108.default.closeSync(descriptor);
82427
82829
  }
82428
82830
  }
82429
- var import_node_child_process55, import_node_crypto67, import_node_fs108, import_node_path110, SwiftObjCCompilationError, isDirectory4, isSdkInclude, FRAMEWORK_IMPORT, OWN_IMPORT, binaryFileDigests, objcInputSnapshots;
82831
+ var import_node_child_process55, import_node_crypto68, import_node_fs108, import_node_path110, SwiftObjCCompilationError, isDirectory4, isSdkInclude, FRAMEWORK_IMPORT, OWN_IMPORT, binaryFileDigests, objcInputSnapshots;
82430
82832
  var init_swift_objc_compile = __esm({
82431
82833
  "src/swift-objc-compile.ts"() {
82432
82834
  "use strict";
82433
82835
  import_node_child_process55 = require("node:child_process");
82434
- import_node_crypto67 = require("node:crypto");
82836
+ import_node_crypto68 = require("node:crypto");
82435
82837
  import_node_fs108 = __toESM(require("node:fs"), 1);
82436
82838
  import_node_path110 = __toESM(require("node:path"), 1);
82437
82839
  init_mapLimit();
@@ -86469,11 +86871,11 @@ function coreDataModelDirectories(files2) {
86469
86871
  }
86470
86872
  return [...models].sort();
86471
86873
  }
86472
- var import_node_crypto68, import_node_fs112, import_node_path114, attributeTypes, deleteRules, EXTERNAL_BINARY, PRESERVE_AFTER_DELETION, yes, common, uid, NULL, classChains, KeyedArchive, sha2563;
86874
+ var import_node_crypto69, import_node_fs112, import_node_path114, attributeTypes, deleteRules, EXTERNAL_BINARY, PRESERVE_AFTER_DELETION, yes, common, uid, NULL, classChains, KeyedArchive, sha2563;
86473
86875
  var init_core_data_model = __esm({
86474
86876
  "src/core-data-model.ts"() {
86475
86877
  "use strict";
86476
- import_node_crypto68 = require("node:crypto");
86878
+ import_node_crypto69 = require("node:crypto");
86477
86879
  import_node_fs112 = require("node:fs");
86478
86880
  import_node_path114 = __toESM(require("node:path"), 1);
86479
86881
  init_core_data_entity_classes();
@@ -86592,7 +86994,7 @@ var init_core_data_model = __esm({
86592
86994
  });
86593
86995
  }
86594
86996
  };
86595
- sha2563 = (...parts) => (0, import_node_crypto68.createHash)("sha256").update(
86997
+ sha2563 = (...parts) => (0, import_node_crypto69.createHash)("sha256").update(
86596
86998
  Buffer.concat(
86597
86999
  parts.map(
86598
87000
  (part) => Array.isArray(part) ? Buffer.from(part) : Buffer.from(part)
@@ -88784,7 +89186,7 @@ async function buildRiveRuntimeDependencies(checkout, moduleRoot) {
88784
89186
  ];
88785
89187
  const objc = [...swiftObjCRuntimeFlags, "-fobjc-exceptions"];
88786
89188
  const xcode = (0, import_node_child_process57.execFileSync)("xcodebuild", ["-version"], { encoding: "utf8" });
88787
- const key2 = (0, import_node_crypto69.createHash)("sha256").update(
89189
+ const key2 = (0, import_node_crypto70.createHash)("sha256").update(
88788
89190
  JSON.stringify([
88789
89191
  RECIPE,
88790
89192
  (0, import_node_child_process57.execFileSync)("git", ["-C", runtime, "rev-parse", "HEAD"], {
@@ -88995,12 +89397,12 @@ exec ${quote3(import_node_path115.default.join(toolchainBin, "llvm-ar"))} rcs "$
88995
89397
  );
88996
89398
  return directory2;
88997
89399
  }
88998
- var import_node_child_process57, import_node_crypto69, import_node_fs113, import_node_os23, import_node_path115, import_promises10, RECIPE, CONFIG, RUNTIME_LIBRARIES;
89400
+ var import_node_child_process57, import_node_crypto70, import_node_fs113, import_node_os23, import_node_path115, import_promises10, RECIPE, CONFIG, RUNTIME_LIBRARIES;
88999
89401
  var init_rive_runtime_dependencies = __esm({
89000
89402
  "src/rive-runtime-dependencies.ts"() {
89001
89403
  "use strict";
89002
89404
  import_node_child_process57 = require("node:child_process");
89003
- import_node_crypto69 = require("node:crypto");
89405
+ import_node_crypto70 = require("node:crypto");
89004
89406
  import_node_fs113 = __toESM(require("node:fs"), 1);
89005
89407
  import_node_os23 = __toESM(require("node:os"), 1);
89006
89408
  import_node_path115 = __toESM(require("node:path"), 1);
@@ -89857,7 +90259,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
89857
90259
  (binary2) => binary2.publicHeaders === void 0 && binary2.placeholder === void 0 && swiftBinaryOnDisk(binary2) && binaryHeaderSearchPaths(binary2, staged, app.rootDir).headers.length === 1
89858
90260
  ))
89859
90261
  return [...binaries];
89860
- const hash = (0, import_node_crypto70.createHash)("sha256");
90262
+ const hash = (0, import_node_crypto71.createHash)("sha256");
89861
90263
  hash.update(
89862
90264
  JSON.stringify([
89863
90265
  inputs2.targets,
@@ -90066,12 +90468,12 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
90066
90468
  );
90067
90469
  return result;
90068
90470
  }
90069
- var import_node_child_process59, import_node_crypto70, import_node_fs115, import_node_path117, cachedInputs;
90471
+ var import_node_child_process59, import_node_crypto71, import_node_fs115, import_node_path117, cachedInputs;
90070
90472
  var init_swift_cxx_reachable = __esm({
90071
90473
  "src/swift-cxx-reachable.ts"() {
90072
90474
  "use strict";
90073
90475
  import_node_child_process59 = require("node:child_process");
90074
- import_node_crypto70 = require("node:crypto");
90476
+ import_node_crypto71 = require("node:crypto");
90075
90477
  import_node_fs115 = __toESM(require("node:fs"), 1);
90076
90478
  import_node_path117 = __toESM(require("node:path"), 1);
90077
90479
  init_is_record();
@@ -90269,7 +90671,7 @@ function nativeSourceDescriptor(packagePath) {
90269
90671
  function swiftArtifactContentDigest(bytes) {
90270
90672
  let digest2 = swiftArtifactDigests.get(bytes);
90271
90673
  if (!digest2) {
90272
- digest2 = (0, import_node_crypto71.createHash)("sha256").update(bytes).digest("hex");
90674
+ digest2 = (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex");
90273
90675
  swiftArtifactDigests.set(bytes, digest2);
90274
90676
  }
90275
90677
  return digest2;
@@ -90397,7 +90799,7 @@ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
90397
90799
  const clang = import_node_path119.default.join(toolchainBin, "clang");
90398
90800
  const empty = (binary2, file) => {
90399
90801
  const source = import_node_path119.default.join(binary2.dir, file);
90400
- const key2 = (0, import_node_crypto71.createHash)("sha256").update(
90802
+ const key2 = (0, import_node_crypto72.createHash)("sha256").update(
90401
90803
  JSON.stringify([
90402
90804
  clang,
90403
90805
  sdk2.sysroot,
@@ -90442,7 +90844,7 @@ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
90442
90844
  return new Set(portable.flat());
90443
90845
  }
90444
90846
  async function swiftPackages(entry, app) {
90445
- const stamp = (file) => import_node_fs117.default.existsSync(file) ? (0, import_node_crypto71.createHash)("sha256").update(import_node_fs117.default.readFileSync(file)).digest("hex") : null;
90847
+ 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;
90446
90848
  const owners = [...app.frameworks, app].map((target) => ({
90447
90849
  module: target.moduleName,
90448
90850
  products: target.packageProducts ?? []
@@ -91606,7 +92008,7 @@ async function buildSwiftResourceTable(project, baseUrl, inputs2) {
91606
92008
  const source = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(
91607
92009
  bytes
91608
92010
  );
91609
- const sha2565 = (0, import_node_crypto71.createHash)("sha256").update(bytes).digest("hex");
92011
+ const sha2565 = (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex");
91610
92012
  const bundle = swiftResourceBundleForFile(bundles, key2);
91611
92013
  if (!bundle && inputs2["Package.swift"])
91612
92014
  throw new Error(`metal source ${key2} has no resource target bundle`);
@@ -91629,7 +92031,7 @@ async function buildSwiftResourceTable(project, baseUrl, inputs2) {
91629
92031
  const bytes = readPackageFile2(project.packagePath, disk, limits.imageBytes);
91630
92032
  pdfs.set(file, {
91631
92033
  file: disk,
91632
- sha256: (0, import_node_crypto71.createHash)("sha256").update(bytes).digest("hex")
92034
+ sha256: (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex")
91633
92035
  });
91634
92036
  }
91635
92037
  const pdfRasters = rasterizePdfFiles([...pdfs.values()], limits);
@@ -91675,7 +92077,7 @@ async function buildSwiftResourceTable(project, baseUrl, inputs2) {
91675
92077
  throw new Error("swift image pack exceeds the compile service caps");
91676
92078
  }
91677
92079
  imageBytes += bytes.length;
91678
- const hash = (0, import_node_crypto71.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
92080
+ const hash = (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
91679
92081
  const bundle = table[bundlePath] ?? /* @__PURE__ */ Object.create(null);
91680
92082
  const pixelSize = ext === ".png" ? readPngDimensions(bytes) : null;
91681
92083
  const variant2 = {
@@ -91982,7 +92384,7 @@ function updateSwiftConfigStamp(hash, packagePath) {
91982
92384
  hash.update(JSON.stringify(gates.map((name3) => swiftWasm64PlatformGates[name3])));
91983
92385
  }
91984
92386
  function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
91985
- const hash = (0, import_node_crypto71.createHash)("sha256");
92387
+ const hash = (0, import_node_crypto72.createHash)("sha256");
91986
92388
  hash.update(packagePath);
91987
92389
  updateSwiftConfigStamp(hash, packagePath);
91988
92390
  const libraries = projects().get(packagePath)?.libraries;
@@ -92011,7 +92413,7 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
92011
92413
  return hash.digest("hex").slice(0, 16);
92012
92414
  }
92013
92415
  function sourceContentStamp(packagePath, moduleRootOverride) {
92014
- const hash = (0, import_node_crypto71.createHash)("sha256");
92416
+ const hash = (0, import_node_crypto72.createHash)("sha256");
92015
92417
  hash.update(compilerSourceDigest);
92016
92418
  updateSwiftConfigStamp(hash, packagePath);
92017
92419
  const libraries = projects().get(packagePath)?.libraries;
@@ -92043,7 +92445,7 @@ function moduleStamp(packagePath, moduleRootOverride, hosted) {
92043
92445
  (root) => import_node_fs117.default.existsSync(import_node_path119.default.join(root, "toolchain.json"))
92044
92446
  );
92045
92447
  if (!moduleRoot) return "";
92046
- const hash = (0, import_node_crypto71.createHash)("sha256");
92448
+ const hash = (0, import_node_crypto72.createHash)("sha256");
92047
92449
  hash.update(moduleRoot);
92048
92450
  for (const relative3 of swiftModuleInputFiles(moduleRoot)) {
92049
92451
  hash.update(relative3);
@@ -92053,7 +92455,7 @@ function moduleStamp(packagePath, moduleRootOverride, hosted) {
92053
92455
  }
92054
92456
  function otherInputs(input, standalone) {
92055
92457
  const { files: _files, ...rest } = input;
92056
- return (0, import_node_crypto71.createHash)("sha256").update(JSON.stringify({ ...rest, standalone })).digest("hex");
92458
+ return (0, import_node_crypto72.createHash)("sha256").update(JSON.stringify({ ...rest, standalone })).digest("hex");
92057
92459
  }
92058
92460
  function icuUrl(origin, artifact) {
92059
92461
  return "url" in artifact.icu ? artifact.icu.url : `${origin}${ICU_PATH}${swiftIcuAddress(artifact.icu)}`;
@@ -92068,7 +92470,7 @@ function standinLibraries(binaries, standins, rootDir, toolchain, rustWasm64) {
92068
92470
  for (const standin of standins) {
92069
92471
  if (!standin.prebuilt) continue;
92070
92472
  const bytes = Buffer.from(standin.prebuilt.library, "base64");
92071
- const digest2 = (0, import_node_crypto71.createHash)("sha256").update(bytes).digest("hex");
92473
+ const digest2 = (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex");
92072
92474
  const dir = import_node_path119.default.join(swiftCacheDir(), "native-archives", digest2);
92073
92475
  import_node_fs117.default.mkdirSync(dir, { recursive: true });
92074
92476
  const library = import_node_path119.default.join(dir, `lib${standin.module}.a`);
@@ -92410,7 +92812,7 @@ function swiftBuildRoot(packagePath, moduleRoot) {
92410
92812
  return import_node_path119.default.join(
92411
92813
  swiftCacheDir(),
92412
92814
  "swift-builds",
92413
- (0, import_node_crypto71.createHash)("sha256").update(`${compilerKey}\0${buildKeyPath}`).digest("hex").slice(0, 16)
92815
+ (0, import_node_crypto72.createHash)("sha256").update(`${compilerKey}\0${buildKeyPath}`).digest("hex").slice(0, 16)
92414
92816
  );
92415
92817
  }
92416
92818
  function installedWorkspaceInput(packagePath, entry, moduleRoot) {
@@ -92711,7 +93113,7 @@ async function fetchSwiftDyldTable(moduleUrl, module2, signal) {
92711
93113
  const response = await fetch(url, { signal });
92712
93114
  if (!response.ok) throw new Error(`swift compile: ${url} answered ${response.status}`);
92713
93115
  const bytes = Buffer.from(await response.arrayBuffer());
92714
- if (bytes.length !== byteLength || (0, import_node_crypto71.createHash)("sha256").update(bytes).digest("hex") !== sha2565)
93116
+ if (bytes.length !== byteLength || (0, import_node_crypto72.createHash)("sha256").update(bytes).digest("hex") !== sha2565)
92715
93117
  throw new Error(`swift compile: ${url} does not match its module's index`);
92716
93118
  return { dyldTable: { sha256: sha2565, bytes } };
92717
93119
  }
@@ -92790,13 +93192,13 @@ function swiftArtifactIsAvailable(origin, url, hash) {
92790
93192
  (project) => project.artifacts.some((artifact) => artifact.hash === hash)
92791
93193
  );
92792
93194
  }
92793
- var import_node_async_hooks2, import_node_child_process61, import_node_crypto71, import_node_fs117, import_node_os25, import_node_path119, ARTIFACT_PATH, RESOURCE_PATH, ICU_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;
93195
+ var import_node_async_hooks2, import_node_child_process61, import_node_crypto72, import_node_fs117, import_node_os25, import_node_path119, ARTIFACT_PATH, RESOURCE_PATH, ICU_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;
92794
93196
  var init_swift_host = __esm({
92795
93197
  "src/swift-host.ts"() {
92796
93198
  "use strict";
92797
93199
  import_node_async_hooks2 = require("node:async_hooks");
92798
93200
  import_node_child_process61 = require("node:child_process");
92799
- import_node_crypto71 = require("node:crypto");
93201
+ import_node_crypto72 = require("node:crypto");
92800
93202
  import_node_fs117 = __toESM(require("node:fs"), 1);
92801
93203
  import_node_os25 = __toESM(require("node:os"), 1);
92802
93204
  import_node_path119 = __toESM(require("node:path"), 1);
@@ -93026,7 +93428,7 @@ function hashTree(root) {
93026
93428
  for (const entry of import_node_fs120.default.readdirSync(root, { recursive: true, withFileTypes: true })) {
93027
93429
  if (!entry.isFile()) continue;
93028
93430
  const file = import_node_path122.default.join(entry.parentPath, entry.name);
93029
- hashes[import_node_path122.default.relative(root, file).split(import_node_path122.default.sep).join("/")] = (0, import_node_crypto72.createHash)("sha256").update(import_node_fs120.default.readFileSync(file)).digest("hex");
93431
+ 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");
93030
93432
  }
93031
93433
  return Object.fromEntries(Object.entries(hashes).sort(([a], [b]) => a < b ? -1 : 1));
93032
93434
  }
@@ -93076,12 +93478,12 @@ async function runInstalledTurboCodegen(appRoot, outDir, signal) {
93076
93478
  files: hashTree(generatedRoot)
93077
93479
  };
93078
93480
  }
93079
- var import_node_child_process62, import_node_crypto72, import_node_fs120, import_node_module15, import_node_path122, import_node_util16, run10, RENDERER_PODS, RENDERER_PODS_VERSIONED, COMPILED_SOURCE, LEGACY_BRIDGE_DEV_SUPPORT, LEGACY_BRIDGE_PODS, LEGACY_BRIDGE_PODS_VERSIONED;
93481
+ var import_node_child_process62, import_node_crypto73, import_node_fs120, import_node_module15, import_node_path122, import_node_util16, run10, RENDERER_PODS, RENDERER_PODS_VERSIONED, COMPILED_SOURCE, LEGACY_BRIDGE_DEV_SUPPORT, LEGACY_BRIDGE_PODS, LEGACY_BRIDGE_PODS_VERSIONED;
93080
93482
  var init_turbo_codegen_intake = __esm({
93081
93483
  "src/turbo-codegen-intake.ts"() {
93082
93484
  "use strict";
93083
93485
  import_node_child_process62 = require("node:child_process");
93084
- import_node_crypto72 = require("node:crypto");
93486
+ import_node_crypto73 = require("node:crypto");
93085
93487
  import_node_fs120 = __toESM(require("node:fs"), 1);
93086
93488
  import_node_module15 = require("node:module");
93087
93489
  import_node_path122 = __toESM(require("node:path"), 1);
@@ -96960,11 +97362,11 @@ extern "C" __attribute__((export_name("peach_fabric_component_names"))) const ch
96960
97362
  }
96961
97363
  `;
96962
97364
  }
96963
- var import_node_crypto73, import_node_fs121, 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, sha2564, podspecList, versionParts, iosOf, JS_CALL_INVOKER, FABRIC_HOST_INCLUDES, FABRIC_HOST_PAPER_INCLUDES, PAPER_UIKIT_BRIDGE_SWIFT;
97365
+ var import_node_crypto74, import_node_fs121, 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, sha2564, podspecList, versionParts, iosOf, JS_CALL_INVOKER, FABRIC_HOST_INCLUDES, FABRIC_HOST_PAPER_INCLUDES, PAPER_UIKIT_BRIDGE_SWIFT;
96964
97366
  var init_turbo_source = __esm({
96965
97367
  "src/turbo-source.ts"() {
96966
97368
  "use strict";
96967
- import_node_crypto73 = require("node:crypto");
97369
+ import_node_crypto74 = require("node:crypto");
96968
97370
  import_node_fs121 = __toESM(require("node:fs"), 1);
96969
97371
  import_node_path123 = __toESM(require("node:path"), 1);
96970
97372
  init_cocoapods_trunk();
@@ -97090,7 +97492,7 @@ var init_turbo_source = __esm({
97090
97492
  REACT_NATIVE_BARE_HEADER_DIRS = [
97091
97493
  "ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager"
97092
97494
  ];
97093
- sha2564 = (data) => (0, import_node_crypto73.createHash)("sha256").update(data).digest("hex");
97495
+ sha2564 = (data) => (0, import_node_crypto74.createHash)("sha256").update(data).digest("hex");
97094
97496
  podspecList = podspecAttribute;
97095
97497
  versionParts = (version2) => version2.split(/[.-]/).map((p) => Number(p) || 0);
97096
97498
  iosOf = (member) => object7(member.ios) ? member.ios : null;
@@ -97851,11 +98253,11 @@ function collectTurboCompileInput(collection, runtime, iosDeploymentTarget, depe
97851
98253
  resources: { ...dependencies?.resources, ...collection.resources }
97852
98254
  };
97853
98255
  }
97854
- var import_node_crypto74, import_node_fs122, import_node_module16, import_node_os26, import_node_path124;
98256
+ var import_node_crypto75, import_node_fs122, import_node_module16, import_node_os26, import_node_path124;
97855
98257
  var init_turbo_compile = __esm({
97856
98258
  "src/turbo-compile.ts"() {
97857
98259
  "use strict";
97858
- import_node_crypto74 = require("node:crypto");
98260
+ import_node_crypto75 = require("node:crypto");
97859
98261
  import_node_fs122 = __toESM(require("node:fs"), 1);
97860
98262
  import_node_module16 = require("node:module");
97861
98263
  import_node_os26 = __toESM(require("node:os"), 1);
@@ -98072,8 +98474,8 @@ function reactNativeCoreEntry(reactNativeRoot, moduleRoot, mode) {
98072
98474
  );
98073
98475
  if (!isRecord(manifest) || typeof manifest.version !== "string")
98074
98476
  throw new Error(`${reactNativeRoot}: react-native has no version`);
98075
- const headers = (0, import_node_crypto75.createHash)("sha256");
98076
- const sources = (0, import_node_crypto75.createHash)("sha256");
98477
+ const headers = (0, import_node_crypto76.createHash)("sha256");
98478
+ const sources = (0, import_node_crypto76.createHash)("sha256");
98077
98479
  const walk4 = (relative3) => {
98078
98480
  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)) {
98079
98481
  if (file.name === "node_modules" || file.name.startsWith(".")) continue;
@@ -98140,11 +98542,11 @@ async function prebuiltReactNativeCore(project, reactNativeRoot, moduleRoot, mod
98140
98542
  throw new Error(`React Native core ${entry.key} does not match its descriptor`);
98141
98543
  return readReactNativeCore(JSON.parse(import_node_fs124.default.readFileSync(file, "utf8")));
98142
98544
  }
98143
- var import_node_crypto75, import_node_fs124, import_node_module17, import_node_path126, import_node_util17, recipe, strings4, building;
98545
+ var import_node_crypto76, import_node_fs124, import_node_module17, import_node_path126, import_node_util17, recipe, strings4, building;
98144
98546
  var init_react_native_core = __esm({
98145
98547
  "src/react-native-core.ts"() {
98146
98548
  "use strict";
98147
- import_node_crypto75 = require("node:crypto");
98549
+ import_node_crypto76 = require("node:crypto");
98148
98550
  import_node_fs124 = __toESM(require("node:fs"), 1);
98149
98551
  import_node_module17 = require("node:module");
98150
98552
  import_node_path126 = __toESM(require("node:path"), 1);
@@ -98169,7 +98571,7 @@ function exportedNames(moduleRoot, name3) {
98169
98571
  const modules = import_node_path127.default.join(moduleRoot, "modules");
98170
98572
  const module2 = import_node_path127.default.join(modules, `${name3}.swiftmodule`);
98171
98573
  if (!import_node_fs125.default.existsSync(module2)) return /* @__PURE__ */ new Set();
98172
- const key2 = (0, import_node_crypto76.createHash)("sha256").update(import_node_fs125.default.readFileSync(module2)).digest("hex");
98574
+ const key2 = (0, import_node_crypto77.createHash)("sha256").update(import_node_fs125.default.readFileSync(module2)).digest("hex");
98173
98575
  const directory2 = import_node_path127.default.join(swiftCacheDir(), "swift-public-names");
98174
98576
  const receipt = import_node_path127.default.join(directory2, `${key2}.json`);
98175
98577
  if (import_node_fs125.default.existsSync(receipt)) {
@@ -98252,12 +98654,12 @@ function clangTypeOwnership(moduleRoot, module2) {
98252
98654
  }
98253
98655
  );
98254
98656
  }
98255
- var import_node_child_process64, import_node_crypto76, import_node_fs125, import_node_path127, blockTypedef, enumTypedef, enumConstant, swiftPrivate;
98657
+ var import_node_child_process64, import_node_crypto77, import_node_fs125, import_node_path127, blockTypedef, enumTypedef, enumConstant, swiftPrivate;
98256
98658
  var init_swift_clang_type_ownership = __esm({
98257
98659
  "src/swift-clang-type-ownership.ts"() {
98258
98660
  "use strict";
98259
98661
  import_node_child_process64 = require("node:child_process");
98260
- import_node_crypto76 = require("node:crypto");
98662
+ import_node_crypto77 = require("node:crypto");
98261
98663
  import_node_fs125 = __toESM(require("node:fs"), 1);
98262
98664
  import_node_path127 = __toESM(require("node:path"), 1);
98263
98665
  init_is_record();
@@ -99900,7 +100302,7 @@ function targetSettings2(units) {
99900
100302
  }
99901
100303
  function oneSDKStamp(oneSDK) {
99902
100304
  if (!oneSDK) return "";
99903
- const hash = (0, import_node_crypto77.createHash)("sha256");
100305
+ const hash = (0, import_node_crypto78.createHash)("sha256");
99904
100306
  for (const files2 of [oneSDK.targets, oneSDK.entry])
99905
100307
  for (const [name3, source] of [...files2].sort(([a], [b]) => a.localeCompare(b)))
99906
100308
  hash.update(`${name3}\0${source}\0`);
@@ -99951,7 +100353,7 @@ ${bridgeModules.length ? "import React\n" : ""}${oneSDK ? "import One\nimport On
99951
100353
  `;
99952
100354
  }
99953
100355
  function expoSwiftPreparedKey(base, units, reactProviderStamp) {
99954
- const hash = (0, import_node_crypto77.createHash)("sha256");
100356
+ const hash = (0, import_node_crypto78.createHash)("sha256");
99955
100357
  hash.update(base);
99956
100358
  hash.update(reactProviderStamp);
99957
100359
  for (const unit2 of units) {
@@ -100325,8 +100727,8 @@ async function compileExpoSwiftModulesTraced(root, base, publishArtifact, option
100325
100727
  }
100326
100728
  return provider;
100327
100729
  })() : void 0;
100328
- const reactProviderStamp = reactProvider ? (0, import_node_crypto77.createHash)("sha256").update(JSON.stringify(reactProvider)).digest("hex") : "";
100329
- const key2 = (0, import_node_crypto77.createHash)("sha256").update(import_node_fs126.default.realpathSync(root)).digest("hex");
100730
+ const reactProviderStamp = reactProvider ? (0, import_node_crypto78.createHash)("sha256").update(JSON.stringify(reactProvider)).digest("hex") : "";
100731
+ const key2 = (0, import_node_crypto78.createHash)("sha256").update(import_node_fs126.default.realpathSync(root)).digest("hex");
100330
100732
  const unitContentStamp = (unit2) => sourceContentStamp(expoSwiftPackage(key2, unit2.moduleId), module2.root) + (unit2.reactNativeProvider ? `:${reactProviderStamp}` : "");
100331
100733
  const failures = /* @__PURE__ */ new Map();
100332
100734
  const failureRecords = /* @__PURE__ */ new Map();
@@ -100668,13 +101070,13 @@ async function compileExpoSwiftModulesTraced(root, base, publishArtifact, option
100668
101070
  throw failure2;
100669
101071
  }
100670
101072
  }
100671
- var import_node_async_hooks3, import_node_child_process65, import_node_crypto77, import_node_fs126, import_node_module18, import_node_os27, 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;
101073
+ var import_node_async_hooks3, import_node_child_process65, import_node_crypto78, import_node_fs126, import_node_module18, import_node_os27, 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;
100672
101074
  var init_expo_swift_host = __esm({
100673
101075
  "src/expo-swift-host.ts"() {
100674
101076
  "use strict";
100675
101077
  import_node_async_hooks3 = require("node:async_hooks");
100676
101078
  import_node_child_process65 = require("node:child_process");
100677
- import_node_crypto77 = require("node:crypto");
101079
+ import_node_crypto78 = require("node:crypto");
100678
101080
  import_node_fs126 = __toESM(require("node:fs"), 1);
100679
101081
  import_node_module18 = require("node:module");
100680
101082
  import_node_os27 = __toESM(require("node:os"), 1);