peachsim 0.1.2682 → 0.1.2683

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/cli/commands/package.ts +7 -1
  2. package/dist-lib/agent-daemon-client.cjs +1 -1
  3. package/dist-lib/agent-events.cjs +1 -1
  4. package/dist-lib/attached-projects.cjs +1 -1
  5. package/dist-lib/auth/shared-session.cjs +1 -1
  6. package/dist-lib/backend-origin.cjs +1 -1
  7. package/dist-lib/beta.cjs +1 -1
  8. package/dist-lib/beta.mjs +2 -2
  9. package/dist-lib/bridge-constants.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.mjs +5 -5
  12. package/dist-lib/bridge-contract.cjs +1 -1
  13. package/dist-lib/bridge-contract.mjs +3 -3
  14. package/dist-lib/bundle-channel.cjs +505 -598
  15. package/dist-lib/capture-contract.cjs +1 -1
  16. package/dist-lib/capture-contract.mjs +3 -3
  17. package/dist-lib/cloud-contract.cjs +1 -1
  18. package/dist-lib/cloud-contract.mjs +3 -3
  19. package/dist-lib/cloud-test-args.cjs +1 -1
  20. package/dist-lib/cloud-test-args.mjs +2 -2
  21. package/dist-lib/cloud.cjs +1 -1
  22. package/dist-lib/cloud.mjs +7 -7
  23. package/dist-lib/config.cjs +1 -1
  24. package/dist-lib/config.mjs +5 -5
  25. package/dist-lib/detox/index.cjs +15 -5
  26. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  27. package/dist-lib/esm-chunks/{acorn-V7B4X5PR.mjs → acorn-IKX32JM5.mjs} +3 -3
  28. package/dist-lib/esm-chunks/{chunk-GNZDVDDX.mjs → chunk-2I4ZO225.mjs} +6 -6
  29. package/dist-lib/esm-chunks/{chunk-AXBK3CA4.mjs → chunk-4QC7XPTA.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-UTI6VCYT.mjs → chunk-5SA2UPEO.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-Y6WPXDCC.mjs → chunk-5SZETTJV.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-R2WPUKVT.mjs → chunk-73CUMN63.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-X37OP27I.mjs → chunk-7LXBDQQH.mjs} +678 -790
  34. package/dist-lib/esm-chunks/{chunk-LV55WJFQ.mjs → chunk-AYSUZBC3.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-EK36QRGX.mjs → chunk-BC4OWNHZ.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-KYIRROKJ.mjs → chunk-BXFBASQX.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-BJHQOPWO.mjs → chunk-CQ4J5VV3.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-YKGS4NSG.mjs → chunk-DG7RT7A7.mjs} +5 -5
  39. package/dist-lib/esm-chunks/{chunk-3UQZATB5.mjs → chunk-EZ64444V.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-SZ5UPZE4.mjs → chunk-HEN6NPXJ.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-DU3VOY6S.mjs → chunk-HLISQIRP.mjs} +6 -6
  42. package/dist-lib/esm-chunks/{chunk-IOLISFIO.mjs → chunk-JTBC65YO.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-3VAFU4BM.mjs → chunk-JVSMJ5IO.mjs} +4 -4
  44. package/dist-lib/esm-chunks/{chunk-EC5RY4HR.mjs → chunk-LGV6BWY5.mjs} +2 -2
  45. package/dist-lib/esm-chunks/{chunk-64UA6DQO.mjs → chunk-OGWPMZSB.mjs} +3 -3
  46. package/dist-lib/esm-chunks/{chunk-Z6R2HZIH.mjs → chunk-OTWOI3OW.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-VTJTOL53.mjs → chunk-QEV3YRKL.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-6PSNFREM.mjs → chunk-RNZ65XZE.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-5SWSDDXC.mjs → chunk-S4OXEZXM.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-ZYD227CX.mjs → chunk-UYWI2SM5.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{chunk-PE7HDZNI.mjs → chunk-WBAH2CS4.mjs} +1 -1
  52. package/dist-lib/esm-chunks/{metro-layout-parser-5RTSOQCS.mjs → metro-layout-parser-6IOBG67O.mjs} +3 -3
  53. package/dist-lib/esm-chunks/{swift-package-prebuilt-EH5JIX6L.mjs → swift-package-prebuilt-NBARV44W.mjs} +12 -12
  54. package/dist-lib/esm-chunks/{swift-sdk-app-module-VHAOCBXW.mjs → swift-sdk-app-module-5K76OLA6.mjs} +16 -16
  55. package/dist-lib/esm-chunks/{swift-sdk-image-3NCWCGQZ.mjs → swift-sdk-image-WJMMMWZH.mjs} +16 -16
  56. package/dist-lib/esm-chunks/{swift-sdk-image-producer-5S4IKSJ2.mjs → swift-sdk-image-producer-M23OLZGS.mjs} +5 -5
  57. package/dist-lib/expo-swift-bundle.cjs +495 -593
  58. package/dist-lib/expo-swift-metadata.cjs +1 -1
  59. package/dist-lib/expo-swift-metadata.mjs +7 -7
  60. package/dist-lib/home-paths.cjs +1 -1
  61. package/dist-lib/host/bridge-host.cjs +620 -715
  62. package/dist-lib/host/fetch-proxy-handler.cjs +22 -24
  63. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  64. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  65. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  66. package/dist-lib/host/websocket-proxy.cjs +1 -1
  67. package/dist-lib/index.cjs +1 -1
  68. package/dist-lib/kotlin-host.cjs +1 -1
  69. package/dist-lib/menu.cjs +1 -1
  70. package/dist-lib/menu.mjs +3 -3
  71. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  72. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  73. package/dist-lib/metro-production-bundle.cjs +1 -1
  74. package/dist-lib/metro-production-bundle.mjs +4 -4
  75. package/dist-lib/native-app-identity-project.cjs +1 -1
  76. package/dist-lib/native-app-identity-project.mjs +15 -15
  77. package/dist-lib/native-app-identity.cjs +1 -1
  78. package/dist-lib/native-app-identity.mjs +6 -6
  79. package/dist-lib/native-firebase-metadata.cjs +1 -1
  80. package/dist-lib/native-firebase-metadata.mjs +3 -3
  81. package/dist-lib/pdfium-raster.cjs +1 -1
  82. package/dist-lib/pdfium-raster.mjs +2 -2
  83. package/dist-lib/plist.cjs +1 -1
  84. package/dist-lib/plist.mjs +3 -3
  85. package/dist-lib/profiles.cjs +1 -1
  86. package/dist-lib/public-brand.cjs +1 -1
  87. package/dist-lib/public-origins-lib-esm.json +87 -87
  88. package/dist-lib/public-origins-lib.json +76 -76
  89. package/dist-lib/react-native-host-modules.cjs +1 -1
  90. package/dist-lib/react-native-host-modules.mjs +2 -2
  91. package/dist-lib/reap-browser.cjs +1 -1
  92. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  93. package/dist-lib/sdk.cjs +1 -1
  94. package/dist-lib/sdk.mjs +8 -8
  95. package/dist-lib/skills.cjs +622 -717
  96. package/dist-lib/swift-compile.cjs +502 -618
  97. package/dist-lib/swift-compile.mjs +12 -12
  98. package/dist-lib/swift-package.cjs +1 -1
  99. package/dist-lib/swift-package.mjs +3 -3
  100. package/dist-lib/swift-submit.cjs +1 -1
  101. package/dist-lib/swift-submit.mjs +6 -6
  102. package/dist-lib/swift-svg-raster.cjs +1 -1
  103. package/dist-lib/swift-svg-raster.mjs +2 -2
  104. package/dist-lib/swift-toolchain.cjs +1 -1
  105. package/dist-lib/swift.cjs +1 -1
  106. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  107. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  108. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  109. package/dist-lib/vendor/acorn.cjs +1 -1
  110. package/dist-lib/vendor/magic-string.cjs +1 -1
  111. package/dist-lib/vendor/stream-json.cjs +1 -1
  112. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  113. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  114. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  115. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  116. package/dist-lib/vendor/sucrase.cjs +1 -1
  117. package/dist-lib/vendor/terser.cjs +1 -1
  118. package/dist-lib/vendor/valibot.cjs +1 -1
  119. package/dist-lib/vendor/ws.cjs +1 -1
  120. package/dist-lib/vendor/zod.cjs +1 -1
  121. package/dist-lib/worklet-executable.cjs +1 -1
  122. package/dist-lib/worklet-executable.mjs +3 -3
  123. package/dist-types/packages/peach-engine/src/engine/image-fetch.d.ts +1 -0
  124. package/package.json +1 -1
  125. package/runtime-companion.json +1 -1
  126. package/src/native-bundles.ts +7 -1
  127. package/src/native-package-slice.ts +28 -12
  128. package/src/nitro-bundle.ts +1 -0
  129. package/src/nitro-compile.ts +8 -2
  130. package/src/nitroContract.ts +35 -14
  131. package/src/one-sdk-bundle.ts +2 -2
  132. package/src/swift-compile.ts +25 -131
  133. package/src/swift-guest-compile.ts +184 -218
  134. package/src/swift-host.ts +13 -23
  135. package/src/swift-submit.ts +0 -2
  136. package/src/turbo-bundle.ts +2 -2
  137. package/src/turbo-compile.ts +0 -1
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2682 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2683 | (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;
@@ -2706,7 +2706,7 @@ var init_process_liveness = __esm({
2706
2706
  var runtime_companion_default;
2707
2707
  var init_runtime_companion = __esm({
2708
2708
  "runtime-companion.json"() {
2709
- runtime_companion_default = { abi: 1, sha256: "7a60ab959af99bebbcef81dda2fe962c6eeb694ec491218da2b3b923a7e8e7a9", file: "node/cli-7a60ab959af99bebbcef81dda2fe962c6eeb694ec491218da2b3b923a7e8e7a9.cjs" };
2709
+ runtime_companion_default = { abi: 1, sha256: "bb9524e625cd512d01d73897b153245e31293be34ceb91264e1524b688f9f844", file: "node/cli-bb9524e625cd512d01d73897b153245e31293be34ceb91264e1524b688f9f844.cjs" };
2710
2710
  }
2711
2711
  });
2712
2712
 
@@ -6175,7 +6175,7 @@ var init_swift_objc_sdk_tree = __esm({
6175
6175
 
6176
6176
  // src/swift-compiler-digest.ts
6177
6177
  function swiftArchiveCompilerDigestValue() {
6178
- return true ? "7ec504e1047ea0f31b14e25b8958c42fd1e55cb9c121db3f05e4dead6ef226eb" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname, "archive");
6178
+ return true ? "c304a2da11e2e676fe221d87209a1136a730fd7ea4bf5d094065fd377480ecef" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname, "archive");
6179
6179
  }
6180
6180
  var import_node_crypto10, import_node_fs25, import_node_path25, SWIFT_DIGEST_SOURCES, LINKED_IMAGE_SOURCES, SWIFT_ARCHIVE_DIGEST_SOURCES;
6181
6181
  var init_swift_compiler_digest = __esm({
@@ -6326,7 +6326,7 @@ var init_swift_standin_digest = __esm({
6326
6326
 
6327
6327
  // src/expo-native-compiler-digest.ts
6328
6328
  function expoNativeCompilerDigestValue() {
6329
- return true ? "dd69e490ecc79ee83e8cba98c4532818a62e9b0e93c21113e2d6c21ec60d8eee" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
6329
+ return true ? "13d332cac87de68ec66d60f9bb7b02f5fbfb1cf35a281ec222570bd0562878cd" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
6330
6330
  }
6331
6331
  var import_node_crypto12;
6332
6332
  var init_expo_native_compiler_digest = __esm({
@@ -27329,9 +27329,6 @@ var init_retired_cache_directory = __esm({
27329
27329
  });
27330
27330
 
27331
27331
  // src/swift-compile-budget.ts
27332
- function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
27333
- return SWIFT_LOCK_WAIT_TIMEOUT_MS + (compileTimeoutMs ?? SWIFT_COMPILE_TIMEOUT_MS) + SWIFT_TRANSPORT_MARGIN_MS;
27334
- }
27335
27332
  async function withSwiftCompileBudget(compileTimeoutMs, signal, work) {
27336
27333
  const deadline = new AbortController();
27337
27334
  const combined = signal ? AbortSignal.any([signal, deadline.signal]) : deadline.signal;
@@ -27371,13 +27368,12 @@ async function withSwiftCompileBudget(compileTimeoutMs, signal, work) {
27371
27368
  clearTimeout(timer);
27372
27369
  }
27373
27370
  }
27374
- var SWIFT_COMPILE_TIMEOUT_MS, SWIFT_LOCK_WAIT_TIMEOUT_MS, SWIFT_TRANSPORT_MARGIN_MS;
27371
+ var SWIFT_COMPILE_TIMEOUT_MS, SWIFT_LOCK_WAIT_TIMEOUT_MS;
27375
27372
  var init_swift_compile_budget = __esm({
27376
27373
  "src/swift-compile-budget.ts"() {
27377
27374
  "use strict";
27378
27375
  SWIFT_COMPILE_TIMEOUT_MS = 18e5;
27379
27376
  SWIFT_LOCK_WAIT_TIMEOUT_MS = 36e5;
27380
- SWIFT_TRANSPORT_MARGIN_MS = 3e5;
27381
27377
  }
27382
27378
  });
27383
27379
 
@@ -33612,397 +33608,6 @@ var init_swift_guest_archive = __esm({
33612
33608
  }
33613
33609
  });
33614
33610
 
33615
- // ../peach-kit/src/nativeWasmContract.ts
33616
- var NATIVE_IMAGE_SECTION, NATIVE_TABLE_ABI, NATIVE_TABLE_IMPORT_MODULE, NATIVE_TABLE_ADAPT_IMPORT, NATIVE_DYLD_FUNCTION_IMPORT, NATIVE_DYLD_PLACE_EXPORT, NATIVE_DYLD_SECTION, NATIVE_LAZY_IMPORT_MODULE, NATIVE_SDK_IMPORT_MODULE, NATIVE_SDK_THUNK_SECTION, NATIVE_LAZY_SLOT_IMPORT, NATIVE_LAZY_SECTION, NATIVE_LAZY_DIGEST_BYTES, NATIVE_LAZY_PART_BYTES, NATIVE_LAZY_MAX_PARTS, NATIVE_PROFILE_SECTION, NATIVE_PROFILE_IMPORT, NATIVE_PROFILE_MEMORY, NATIVE_PROFILE_DUMP, NATIVE_PROFILE_ENDPOINT, SWIFT_ARTIFACT_SHA256_HEADER, NATIVE_TABLE_RESERVE_SLOTS;
33617
- var init_nativeWasmContract = __esm({
33618
- "../peach-kit/src/nativeWasmContract.ts"() {
33619
- "use strict";
33620
- NATIVE_IMAGE_SECTION = "peach.native-image-v1";
33621
- NATIVE_TABLE_ABI = "peach-native-table-v1";
33622
- NATIVE_TABLE_IMPORT_MODULE = "peach_thread";
33623
- NATIVE_TABLE_ADAPT_IMPORT = "adapt_function";
33624
- NATIVE_DYLD_FUNCTION_IMPORT = "dyld_function";
33625
- NATIVE_DYLD_PLACE_EXPORT = "__peach_dyld_place";
33626
- NATIVE_DYLD_SECTION = "peach.lazy-dyld-v1";
33627
- NATIVE_LAZY_IMPORT_MODULE = "peach_lazy";
33628
- NATIVE_SDK_IMPORT_MODULE = "peach_sdk";
33629
- NATIVE_SDK_THUNK_SECTION = "peach.sdk-thunks";
33630
- NATIVE_LAZY_SLOT_IMPORT = "load_slot";
33631
- NATIVE_LAZY_SECTION = "peach.lazy-code-v2";
33632
- NATIVE_LAZY_DIGEST_BYTES = 32;
33633
- NATIVE_LAZY_PART_BYTES = NATIVE_LAZY_DIGEST_BYTES + 4;
33634
- NATIVE_LAZY_MAX_PARTS = 65535;
33635
- NATIVE_PROFILE_SECTION = "peach.startup-profile-v1";
33636
- NATIVE_PROFILE_IMPORT = "peach_profile";
33637
- NATIVE_PROFILE_MEMORY = "profile-data";
33638
- NATIVE_PROFILE_DUMP = "__write_profile";
33639
- NATIVE_PROFILE_ENDPOINT = "/__peach/swift-startup-profile";
33640
- SWIFT_ARTIFACT_SHA256_HEADER = "x-peach-swift-sha256";
33641
- NATIVE_TABLE_RESERVE_SLOTS = 4096;
33642
- }
33643
- });
33644
-
33645
- // src/swift-guest-dyld-functions.ts
33646
- function skipValueType(r) {
33647
- const type = r.byte();
33648
- if (type === 99 || type === 100) r.s();
33649
- }
33650
- function readImports2(bytes, sections) {
33651
- let functions = 0;
33652
- let table64;
33653
- const imports2 = sections.find((s) => s.id === 2);
33654
- if (imports2) {
33655
- const r = wasmReader(bytes, imports2.start);
33656
- for (let n = r.u(); n > 0; n--) {
33657
- r.name();
33658
- r.name();
33659
- const kind = r.byte();
33660
- if (kind === 0) {
33661
- functions++;
33662
- r.u();
33663
- } else if (kind === 1 || kind === 2) {
33664
- if (kind === 1) skipValueType(r);
33665
- const flags = r.u();
33666
- r.u();
33667
- if (flags & 1) r.u();
33668
- if (kind === 1) table64 ??= (flags & 4) !== 0;
33669
- } else if (kind === 3) {
33670
- skipValueType(r);
33671
- r.byte();
33672
- } else if (kind === 4) {
33673
- r.byte();
33674
- r.u();
33675
- } else throw new Error(`unsupported wasm import kind ${kind}`);
33676
- }
33677
- }
33678
- const tables = sections.find((s) => s.id === 4);
33679
- if (table64 === void 0 && tables) {
33680
- const r = wasmReader(bytes, tables.start);
33681
- if (r.u()) {
33682
- skipValueType(r);
33683
- table64 = (r.u() & 4) !== 0;
33684
- }
33685
- }
33686
- return { functions, table64 };
33687
- }
33688
- function hasFunctionTable(bytes) {
33689
- return readImports2(bytes, wasmSections(bytes)).table64 !== void 0;
33690
- }
33691
- function primaryFunctionTable(bytes) {
33692
- const sections = wasmSections(bytes);
33693
- const { table64 } = readImports2(bytes, sections);
33694
- const exported = entries(
33695
- bytes,
33696
- sections.find((s) => s.id === 7),
33697
- readExport
33698
- ).find((entry) => {
33699
- const r = wasmReader(entry, 0);
33700
- r.name();
33701
- return r.byte() === 1;
33702
- });
33703
- if (table64 === void 0 || !exported)
33704
- throw new Error("native primary exports no function table");
33705
- return { name: wasmReader(exported, 0).name(), table64 };
33706
- }
33707
- function vectorSection(id, count, parts2) {
33708
- const body = Buffer.concat([Buffer.from(uleb2(count)), ...parts2]);
33709
- return Buffer.concat([Buffer.from([id, ...uleb2(body.length)]), body]);
33710
- }
33711
- function rewriteSections(bytes, sections, changes) {
33712
- const out = [bytes.subarray(0, 8)];
33713
- const pending2 = new Map(changes);
33714
- const flushBefore = (id) => {
33715
- for (const [missing2, section2] of pending2) {
33716
- if (SECTION_ORDER.indexOf(missing2) >= SECTION_ORDER.indexOf(id)) continue;
33717
- if (section2) out.push(section2);
33718
- pending2.delete(missing2);
33719
- }
33720
- };
33721
- for (const s of sections) {
33722
- if (s.id !== 0) flushBefore(s.id);
33723
- if (!pending2.has(s.id)) {
33724
- out.push(bytes.subarray(s.offset, s.end));
33725
- continue;
33726
- }
33727
- const section2 = pending2.get(s.id);
33728
- pending2.delete(s.id);
33729
- if (section2) out.push(section2);
33730
- }
33731
- for (const section2 of pending2.values()) if (section2) out.push(section2);
33732
- return Buffer.concat(out);
33733
- }
33734
- function entries(bytes, section2, entry) {
33735
- if (!section2) return [];
33736
- const r = wasmReader(bytes, section2.start);
33737
- const out = [];
33738
- for (let n = r.u(); n > 0; n--) {
33739
- const begin = r.at;
33740
- entry(r);
33741
- out.push(bytes.subarray(begin, r.at));
33742
- }
33743
- if (r.at !== section2.end) throw new Error(`invalid wasm section ${section2.id}`);
33744
- return out;
33745
- }
33746
- function appendLazyPlacement(bytes, functions, table) {
33747
- const sections = wasmSections(bytes);
33748
- const section2 = (id) => sections.find((s) => s.id === id);
33749
- const imports2 = readImports2(bytes, sections);
33750
- const changes = /* @__PURE__ */ new Map();
33751
- let table64 = imports2.table64;
33752
- if (table64 === void 0) {
33753
- if (!table) throw new Error("native image has no function table");
33754
- table64 = table.table64;
33755
- const found2 = section2(2);
33756
- const header = found2 && wasmReader(bytes, found2.start);
33757
- const count = header ? header.u() : 0;
33758
- const module2 = Buffer.from("primary");
33759
- const name4 = Buffer.from(table.name);
33760
- changes.set(
33761
- 2,
33762
- vectorSection(2, count + 1, [
33763
- found2 && header ? bytes.subarray(header.at, found2.end) : new Uint8Array(),
33764
- Buffer.from([
33765
- ...uleb2(module2.length),
33766
- ...module2,
33767
- ...uleb2(name4.length),
33768
- ...name4,
33769
- 1,
33770
- 112,
33771
- table64 ? 4 : 0,
33772
- 0
33773
- ])
33774
- ])
33775
- );
33776
- }
33777
- const types2 = entries(bytes, section2(1), (r) => {
33778
- if (r.byte() !== 96) throw new Error("native image has a non-function type");
33779
- for (let side = 0; side < 2; side++) for (let n = r.u(); n > 0; n--) skipValueType(r);
33780
- });
33781
- const declared = entries(bytes, section2(3), (r) => r.u());
33782
- const bodies = entries(bytes, section2(10), (r) => r.skip(r.u()));
33783
- const exports2 = entries(bytes, section2(7), readExport);
33784
- const elements = entries(bytes, section2(9), skipElementSegment);
33785
- const placementIndex = lastTableElement(elements) + 1;
33786
- elements.splice(
33787
- placementIndex,
33788
- 0,
33789
- Buffer.from([1, 0, ...uleb2(functions.length), ...functions.flatMap(uleb2)])
33790
- );
33791
- const place2 = imports2.functions + declared.length;
33792
- const instructions = [
33793
- 0,
33794
- 32,
33795
- 1,
33796
- ...table64 ? [173] : [],
33797
- 32,
33798
- 0,
33799
- 65,
33800
- 1,
33801
- 252,
33802
- 12,
33803
- ...uleb2(placementIndex),
33804
- 0,
33805
- 11
33806
- ];
33807
- const name3 = Buffer.from(NATIVE_DYLD_PLACE_EXPORT);
33808
- return rewriteSections(
33809
- bytes,
33810
- sections,
33811
- new Map([
33812
- ...changes,
33813
- [
33814
- 1,
33815
- vectorSection(1, types2.length + 1, [
33816
- ...types2,
33817
- Buffer.from([96, 2, 127, 127, 0])
33818
- ])
33819
- ],
33820
- [
33821
- 3,
33822
- vectorSection(3, declared.length + 1, [
33823
- ...declared,
33824
- Buffer.from(uleb2(types2.length))
33825
- ])
33826
- ],
33827
- [
33828
- 7,
33829
- vectorSection(7, exports2.length + 1, [
33830
- ...exports2,
33831
- Buffer.from([...uleb2(name3.length), ...name3, 0, ...uleb2(place2)])
33832
- ])
33833
- ],
33834
- [9, vectorSection(9, elements.length, elements)],
33835
- [
33836
- 10,
33837
- vectorSection(10, bodies.length + 1, [
33838
- ...bodies,
33839
- Buffer.from([...uleb2(instructions.length), ...instructions])
33840
- ])
33841
- ]
33842
- ])
33843
- );
33844
- }
33845
- function skipConstant(r) {
33846
- for (let op = r.byte(); op !== 11; op = r.byte()) {
33847
- if (op === 65 || op === 66) r.s();
33848
- else if (op === 35 || op === 210) r.u();
33849
- else if (op === 208) r.s();
33850
- else if (![106, 107, 108, 124, 125, 126].includes(op))
33851
- throw new Error(`unsupported constant expression op ${op}`);
33852
- }
33853
- }
33854
- function skipElementSegment(r) {
33855
- const flags = r.u();
33856
- if (flags > 7) throw new Error(`unsupported element segment flags ${flags}`);
33857
- if ((flags & 3) === 2) r.u();
33858
- if (!(flags & 1)) skipConstant(r);
33859
- if (flags & 3) skipValueType(r);
33860
- for (let count = r.u(); count > 0; count--)
33861
- if (flags & 4) skipConstant(r);
33862
- else r.u();
33863
- }
33864
- function takeLazyPlacement(bytes) {
33865
- const sections = wasmSections(bytes);
33866
- const section2 = (id) => sections.find((s) => s.id === id);
33867
- const exports2 = entries(bytes, section2(7), readExport);
33868
- const placeExport = exports2.find(
33869
- (entry) => exportName(entry) === NATIVE_DYLD_PLACE_EXPORT
33870
- );
33871
- if (!placeExport) return void 0;
33872
- const imports2 = readImports2(bytes, sections);
33873
- const declared = entries(bytes, section2(3), (r2) => r2.u());
33874
- const bodies = entries(bytes, section2(10), (r2) => r2.skip(r2.u()));
33875
- const p = wasmReader(placeExport, 0);
33876
- p.name();
33877
- if (p.byte() !== 0 || p.u() !== imports2.functions + declared.length - 1)
33878
- throw new Error(`${NATIVE_DYLD_PLACE_EXPORT} is not the last function`);
33879
- const elements = entries(bytes, section2(9), skipElementSegment);
33880
- const placementIndex = lastTableElement(elements);
33881
- const placement = elements[placementIndex];
33882
- if (!placement) throw new Error("lazy function placement has no element segment");
33883
- const r = wasmReader(placement, 0);
33884
- if (r.u() !== 1 || r.byte() !== 0)
33885
- throw new Error("lazy function segment is not a passive function list");
33886
- const functions = [];
33887
- for (let count = r.u(); count > 0; count--) functions.push(r.u());
33888
- elements.splice(placementIndex, 1);
33889
- const kept = exports2.filter((entry) => entry !== placeExport);
33890
- return {
33891
- bytes: rewriteSections(
33892
- bytes,
33893
- sections,
33894
- /* @__PURE__ */ new Map([
33895
- [3, vectorSection(3, declared.length - 1, declared.slice(0, -1))],
33896
- [7, vectorSection(7, kept.length, kept)],
33897
- [9, elements.length ? vectorSection(9, elements.length, elements) : null],
33898
- [10, vectorSection(10, bodies.length - 1, bodies.slice(0, -1))]
33899
- ])
33900
- ),
33901
- functions
33902
- };
33903
- }
33904
- function placeGuestLazyFunctions(bytes, lazy) {
33905
- const sections = wasmSections(bytes);
33906
- const lazyIndex = new Map(lazy.map((name3, index) => [name3, index]));
33907
- const functions = new Array(lazy.length);
33908
- let found2 = 0;
33909
- const kept = entries(
33910
- bytes,
33911
- sections.find((s) => s.id === 7),
33912
- readExport
33913
- ).filter((entry) => {
33914
- const r = wasmReader(entry, 0);
33915
- const position = lazyIndex.get(r.name());
33916
- const kind = r.byte();
33917
- if (kind !== 0 || position === void 0) return true;
33918
- functions[position] = r.u();
33919
- found2++;
33920
- return false;
33921
- });
33922
- if (found2 !== lazy.length)
33923
- throw new Error("guest link lost a lazy dlsym function export");
33924
- return appendLazyPlacement(
33925
- rewriteSections(bytes, sections, /* @__PURE__ */ new Map([[7, vectorSection(7, kept.length, kept)]])),
33926
- functions
33927
- );
33928
- }
33929
- function guestLazyExports(lazy) {
33930
- return lazy.map((name3) => JSON.stringify(`--export=${name3}`)).join("\n");
33931
- }
33932
- function nameLazyFunctions(bytes, functions) {
33933
- const sections = wasmSections(bytes);
33934
- const { functions: imported } = readImports2(bytes, sections);
33935
- const custom = sections.find((s) => s.id === 0 && s.name === "name");
33936
- const subsections = [];
33937
- const names = /* @__PURE__ */ new Map();
33938
- if (custom) {
33939
- const r = wasmReader(bytes, custom.start);
33940
- while (r.at < custom.end) {
33941
- const id = r.byte();
33942
- const size2 = r.u();
33943
- const body = bytes.subarray(r.at, r.at + size2);
33944
- r.skip(size2);
33945
- if (id !== 1) {
33946
- subsections.push({ id, body });
33947
- continue;
33948
- }
33949
- const f = wasmReader(body, 0);
33950
- for (let n = f.u(); n > 0; n--) {
33951
- const index = f.u();
33952
- const start = f.at;
33953
- f.skip(f.u());
33954
- names.set(index, body.subarray(start, f.at));
33955
- }
33956
- }
33957
- }
33958
- for (const index of functions) {
33959
- if (names.has(index)) continue;
33960
- const name3 = Buffer.from(String(index - imported));
33961
- names.set(index, Buffer.from([...uleb2(name3.length), ...name3]));
33962
- }
33963
- const ordered = [...names].sort(([a], [b]) => a - b);
33964
- const functionNames = Buffer.concat([
33965
- Buffer.from(uleb2(ordered.length)),
33966
- ...ordered.flatMap(([index, name3]) => [Buffer.from(uleb2(index)), name3])
33967
- ]);
33968
- const content = [...subsections, { id: 1, body: functionNames }].sort((a, b) => a.id - b.id).flatMap(({ id, body }) => [Buffer.from([id, ...uleb2(body.length)]), body]);
33969
- const label = Buffer.from("name");
33970
- const payload = Buffer.concat([
33971
- Buffer.from([...uleb2(label.length), ...label]),
33972
- ...content
33973
- ]);
33974
- const out = [bytes.subarray(0, 8)];
33975
- for (const s of sections) if (s !== custom) out.push(bytes.subarray(s.offset, s.end));
33976
- out.push(Buffer.from([0, ...uleb2(payload.length)]), payload);
33977
- return Buffer.concat(out);
33978
- }
33979
- var uleb2, SECTION_ORDER, readExport, lastTableElement, exportName;
33980
- var init_swift_guest_dyld_functions = __esm({
33981
- "src/swift-guest-dyld-functions.ts"() {
33982
- "use strict";
33983
- init_nativeWasmContract();
33984
- init_swift_sdk_image_wasm();
33985
- uleb2 = (value) => {
33986
- const out = [];
33987
- do {
33988
- let byte = value % 128;
33989
- value = Math.floor(value / 128);
33990
- if (value) byte |= 128;
33991
- out.push(byte);
33992
- } while (value);
33993
- return out;
33994
- };
33995
- SECTION_ORDER = [1, 2, 3, 4, 5, 13, 6, 7, 8, 9, 12, 10, 11];
33996
- readExport = (r) => {
33997
- r.name();
33998
- r.byte();
33999
- r.u();
34000
- };
34001
- lastTableElement = (segments) => segments.findLastIndex((segment2) => (segment2[0] & 3) !== 3);
34002
- exportName = (entry) => wasmReader(entry, 0).name();
34003
- }
34004
- });
34005
-
34006
33611
  // ../peach-kit/src/nativeDyldTableContract.ts
34007
33612
  function nativeDyldName(bytes) {
34008
33613
  let name3 = "";
@@ -34053,6 +33658,36 @@ var init_nativeDyldTableContract = __esm({
34053
33658
  }
34054
33659
  });
34055
33660
 
33661
+ // ../peach-kit/src/nativeWasmContract.ts
33662
+ var NATIVE_IMAGE_SECTION, NATIVE_TABLE_ABI, NATIVE_TABLE_IMPORT_MODULE, NATIVE_TABLE_ADAPT_IMPORT, NATIVE_DYLD_FUNCTION_IMPORT, NATIVE_DYLD_PLACE_EXPORT, NATIVE_DYLD_SECTION, NATIVE_LAZY_IMPORT_MODULE, NATIVE_SDK_IMPORT_MODULE, NATIVE_SDK_THUNK_SECTION, NATIVE_LAZY_SLOT_IMPORT, NATIVE_LAZY_SECTION, NATIVE_LAZY_DIGEST_BYTES, NATIVE_LAZY_PART_BYTES, NATIVE_LAZY_MAX_PARTS, NATIVE_PROFILE_SECTION, NATIVE_PROFILE_IMPORT, NATIVE_PROFILE_MEMORY, NATIVE_PROFILE_DUMP, NATIVE_PROFILE_ENDPOINT, SWIFT_ARTIFACT_SHA256_HEADER, NATIVE_TABLE_RESERVE_SLOTS;
33663
+ var init_nativeWasmContract = __esm({
33664
+ "../peach-kit/src/nativeWasmContract.ts"() {
33665
+ "use strict";
33666
+ NATIVE_IMAGE_SECTION = "peach.native-image-v1";
33667
+ NATIVE_TABLE_ABI = "peach-native-table-v1";
33668
+ NATIVE_TABLE_IMPORT_MODULE = "peach_thread";
33669
+ NATIVE_TABLE_ADAPT_IMPORT = "adapt_function";
33670
+ NATIVE_DYLD_FUNCTION_IMPORT = "dyld_function";
33671
+ NATIVE_DYLD_PLACE_EXPORT = "__peach_dyld_place";
33672
+ NATIVE_DYLD_SECTION = "peach.lazy-dyld-v1";
33673
+ NATIVE_LAZY_IMPORT_MODULE = "peach_lazy";
33674
+ NATIVE_SDK_IMPORT_MODULE = "peach_sdk";
33675
+ NATIVE_SDK_THUNK_SECTION = "peach.sdk-thunks";
33676
+ NATIVE_LAZY_SLOT_IMPORT = "load_slot";
33677
+ NATIVE_LAZY_SECTION = "peach.lazy-code-v2";
33678
+ NATIVE_LAZY_DIGEST_BYTES = 32;
33679
+ NATIVE_LAZY_PART_BYTES = NATIVE_LAZY_DIGEST_BYTES + 4;
33680
+ NATIVE_LAZY_MAX_PARTS = 65535;
33681
+ NATIVE_PROFILE_SECTION = "peach.startup-profile-v1";
33682
+ NATIVE_PROFILE_IMPORT = "peach_profile";
33683
+ NATIVE_PROFILE_MEMORY = "profile-data";
33684
+ NATIVE_PROFILE_DUMP = "__write_profile";
33685
+ NATIVE_PROFILE_ENDPOINT = "/__peach/swift-startup-profile";
33686
+ SWIFT_ARTIFACT_SHA256_HEADER = "x-peach-swift-sha256";
33687
+ NATIVE_TABLE_RESERVE_SLOTS = 4096;
33688
+ }
33689
+ });
33690
+
34056
33691
  // src/swift-guest-image-ledger.ts
34057
33692
  function readNumber(bytes, position) {
34058
33693
  if (position < bytes.length) {
@@ -35898,7 +35533,7 @@ function sha256Hex3(bytes) {
35898
35533
  return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
35899
35534
  return (0, import_node_crypto33.createHash)("sha256").update(bytes).digest("hex");
35900
35535
  }
35901
- function uleb3(value) {
35536
+ function uleb2(value) {
35902
35537
  const bytes = [];
35903
35538
  for (let rest = value; ; rest = Math.floor(rest / 128)) {
35904
35539
  if (rest < 128) return [...bytes, rest];
@@ -35917,7 +35552,7 @@ function encodeGuestDyldTable(rows) {
35917
35552
  value.writeBigUInt64LE(row.value);
35918
35553
  const bytes = Buffer.concat([
35919
35554
  row.bytes,
35920
- Buffer.from([0, ...uleb3(row.image), row.kind]),
35555
+ Buffer.from([0, ...uleb2(row.image), row.kind]),
35921
35556
  value
35922
35557
  ]);
35923
35558
  if (!current2.length) firsts.push(row.bytes);
@@ -36039,6 +35674,367 @@ var init_mapLimit = __esm({
36039
35674
  }
36040
35675
  });
36041
35676
 
35677
+ // src/swift-guest-dyld-functions.ts
35678
+ function skipValueType(r) {
35679
+ const type = r.byte();
35680
+ if (type === 99 || type === 100) r.s();
35681
+ }
35682
+ function readImports2(bytes, sections) {
35683
+ let functions = 0;
35684
+ let table64;
35685
+ const imports2 = sections.find((s) => s.id === 2);
35686
+ if (imports2) {
35687
+ const r = wasmReader(bytes, imports2.start);
35688
+ for (let n = r.u(); n > 0; n--) {
35689
+ r.name();
35690
+ r.name();
35691
+ const kind = r.byte();
35692
+ if (kind === 0) {
35693
+ functions++;
35694
+ r.u();
35695
+ } else if (kind === 1 || kind === 2) {
35696
+ if (kind === 1) skipValueType(r);
35697
+ const flags = r.u();
35698
+ r.u();
35699
+ if (flags & 1) r.u();
35700
+ if (kind === 1) table64 ??= (flags & 4) !== 0;
35701
+ } else if (kind === 3) {
35702
+ skipValueType(r);
35703
+ r.byte();
35704
+ } else if (kind === 4) {
35705
+ r.byte();
35706
+ r.u();
35707
+ } else throw new Error(`unsupported wasm import kind ${kind}`);
35708
+ }
35709
+ }
35710
+ const tables = sections.find((s) => s.id === 4);
35711
+ if (table64 === void 0 && tables) {
35712
+ const r = wasmReader(bytes, tables.start);
35713
+ if (r.u()) {
35714
+ skipValueType(r);
35715
+ table64 = (r.u() & 4) !== 0;
35716
+ }
35717
+ }
35718
+ return { functions, table64 };
35719
+ }
35720
+ function hasFunctionTable(bytes) {
35721
+ return readImports2(bytes, wasmSections(bytes)).table64 !== void 0;
35722
+ }
35723
+ function primaryFunctionTable(bytes) {
35724
+ const sections = wasmSections(bytes);
35725
+ const { table64 } = readImports2(bytes, sections);
35726
+ const exported = entries(
35727
+ bytes,
35728
+ sections.find((s) => s.id === 7),
35729
+ readExport
35730
+ ).find((entry) => {
35731
+ const r = wasmReader(entry, 0);
35732
+ r.name();
35733
+ return r.byte() === 1;
35734
+ });
35735
+ if (table64 === void 0 || !exported)
35736
+ throw new Error("native primary exports no function table");
35737
+ return { name: wasmReader(exported, 0).name(), table64 };
35738
+ }
35739
+ function vectorSection(id, count, parts2) {
35740
+ const body = Buffer.concat([Buffer.from(uleb3(count)), ...parts2]);
35741
+ return Buffer.concat([Buffer.from([id, ...uleb3(body.length)]), body]);
35742
+ }
35743
+ function rewriteSections(bytes, sections, changes) {
35744
+ const out = [bytes.subarray(0, 8)];
35745
+ const pending2 = new Map(changes);
35746
+ const flushBefore = (id) => {
35747
+ for (const [missing2, section2] of pending2) {
35748
+ if (SECTION_ORDER.indexOf(missing2) >= SECTION_ORDER.indexOf(id)) continue;
35749
+ if (section2) out.push(section2);
35750
+ pending2.delete(missing2);
35751
+ }
35752
+ };
35753
+ for (const s of sections) {
35754
+ if (s.id !== 0) flushBefore(s.id);
35755
+ if (!pending2.has(s.id)) {
35756
+ out.push(bytes.subarray(s.offset, s.end));
35757
+ continue;
35758
+ }
35759
+ const section2 = pending2.get(s.id);
35760
+ pending2.delete(s.id);
35761
+ if (section2) out.push(section2);
35762
+ }
35763
+ for (const section2 of pending2.values()) if (section2) out.push(section2);
35764
+ return Buffer.concat(out);
35765
+ }
35766
+ function entries(bytes, section2, entry) {
35767
+ if (!section2) return [];
35768
+ const r = wasmReader(bytes, section2.start);
35769
+ const out = [];
35770
+ for (let n = r.u(); n > 0; n--) {
35771
+ const begin = r.at;
35772
+ entry(r);
35773
+ out.push(bytes.subarray(begin, r.at));
35774
+ }
35775
+ if (r.at !== section2.end) throw new Error(`invalid wasm section ${section2.id}`);
35776
+ return out;
35777
+ }
35778
+ function appendLazyPlacement(bytes, functions, table) {
35779
+ const sections = wasmSections(bytes);
35780
+ const section2 = (id) => sections.find((s) => s.id === id);
35781
+ const imports2 = readImports2(bytes, sections);
35782
+ const changes = /* @__PURE__ */ new Map();
35783
+ let table64 = imports2.table64;
35784
+ if (table64 === void 0) {
35785
+ if (!table) throw new Error("native image has no function table");
35786
+ table64 = table.table64;
35787
+ const found2 = section2(2);
35788
+ const header = found2 && wasmReader(bytes, found2.start);
35789
+ const count = header ? header.u() : 0;
35790
+ const module2 = Buffer.from("primary");
35791
+ const name4 = Buffer.from(table.name);
35792
+ changes.set(
35793
+ 2,
35794
+ vectorSection(2, count + 1, [
35795
+ found2 && header ? bytes.subarray(header.at, found2.end) : new Uint8Array(),
35796
+ Buffer.from([
35797
+ ...uleb3(module2.length),
35798
+ ...module2,
35799
+ ...uleb3(name4.length),
35800
+ ...name4,
35801
+ 1,
35802
+ 112,
35803
+ table64 ? 4 : 0,
35804
+ 0
35805
+ ])
35806
+ ])
35807
+ );
35808
+ }
35809
+ const types2 = entries(bytes, section2(1), (r) => {
35810
+ if (r.byte() !== 96) throw new Error("native image has a non-function type");
35811
+ for (let side = 0; side < 2; side++) for (let n = r.u(); n > 0; n--) skipValueType(r);
35812
+ });
35813
+ const declared = entries(bytes, section2(3), (r) => r.u());
35814
+ const bodies = entries(bytes, section2(10), (r) => r.skip(r.u()));
35815
+ const exports2 = entries(bytes, section2(7), readExport);
35816
+ const elements = entries(bytes, section2(9), skipElementSegment);
35817
+ const placementIndex = lastTableElement(elements) + 1;
35818
+ elements.splice(
35819
+ placementIndex,
35820
+ 0,
35821
+ Buffer.from([1, 0, ...uleb3(functions.length), ...functions.flatMap(uleb3)])
35822
+ );
35823
+ const place2 = imports2.functions + declared.length;
35824
+ const instructions = [
35825
+ 0,
35826
+ 32,
35827
+ 1,
35828
+ ...table64 ? [173] : [],
35829
+ 32,
35830
+ 0,
35831
+ 65,
35832
+ 1,
35833
+ 252,
35834
+ 12,
35835
+ ...uleb3(placementIndex),
35836
+ 0,
35837
+ 11
35838
+ ];
35839
+ const name3 = Buffer.from(NATIVE_DYLD_PLACE_EXPORT);
35840
+ return rewriteSections(
35841
+ bytes,
35842
+ sections,
35843
+ new Map([
35844
+ ...changes,
35845
+ [
35846
+ 1,
35847
+ vectorSection(1, types2.length + 1, [
35848
+ ...types2,
35849
+ Buffer.from([96, 2, 127, 127, 0])
35850
+ ])
35851
+ ],
35852
+ [
35853
+ 3,
35854
+ vectorSection(3, declared.length + 1, [
35855
+ ...declared,
35856
+ Buffer.from(uleb3(types2.length))
35857
+ ])
35858
+ ],
35859
+ [
35860
+ 7,
35861
+ vectorSection(7, exports2.length + 1, [
35862
+ ...exports2,
35863
+ Buffer.from([...uleb3(name3.length), ...name3, 0, ...uleb3(place2)])
35864
+ ])
35865
+ ],
35866
+ [9, vectorSection(9, elements.length, elements)],
35867
+ [
35868
+ 10,
35869
+ vectorSection(10, bodies.length + 1, [
35870
+ ...bodies,
35871
+ Buffer.from([...uleb3(instructions.length), ...instructions])
35872
+ ])
35873
+ ]
35874
+ ])
35875
+ );
35876
+ }
35877
+ function skipConstant(r) {
35878
+ for (let op = r.byte(); op !== 11; op = r.byte()) {
35879
+ if (op === 65 || op === 66) r.s();
35880
+ else if (op === 35 || op === 210) r.u();
35881
+ else if (op === 208) r.s();
35882
+ else if (![106, 107, 108, 124, 125, 126].includes(op))
35883
+ throw new Error(`unsupported constant expression op ${op}`);
35884
+ }
35885
+ }
35886
+ function skipElementSegment(r) {
35887
+ const flags = r.u();
35888
+ if (flags > 7) throw new Error(`unsupported element segment flags ${flags}`);
35889
+ if ((flags & 3) === 2) r.u();
35890
+ if (!(flags & 1)) skipConstant(r);
35891
+ if (flags & 3) skipValueType(r);
35892
+ for (let count = r.u(); count > 0; count--)
35893
+ if (flags & 4) skipConstant(r);
35894
+ else r.u();
35895
+ }
35896
+ function takeLazyPlacement(bytes) {
35897
+ const sections = wasmSections(bytes);
35898
+ const section2 = (id) => sections.find((s) => s.id === id);
35899
+ const exports2 = entries(bytes, section2(7), readExport);
35900
+ const placeExport = exports2.find(
35901
+ (entry) => exportName(entry) === NATIVE_DYLD_PLACE_EXPORT
35902
+ );
35903
+ if (!placeExport) return void 0;
35904
+ const imports2 = readImports2(bytes, sections);
35905
+ const declared = entries(bytes, section2(3), (r2) => r2.u());
35906
+ const bodies = entries(bytes, section2(10), (r2) => r2.skip(r2.u()));
35907
+ const p = wasmReader(placeExport, 0);
35908
+ p.name();
35909
+ if (p.byte() !== 0 || p.u() !== imports2.functions + declared.length - 1)
35910
+ throw new Error(`${NATIVE_DYLD_PLACE_EXPORT} is not the last function`);
35911
+ const elements = entries(bytes, section2(9), skipElementSegment);
35912
+ const placementIndex = lastTableElement(elements);
35913
+ const placement = elements[placementIndex];
35914
+ if (!placement) throw new Error("lazy function placement has no element segment");
35915
+ const r = wasmReader(placement, 0);
35916
+ if (r.u() !== 1 || r.byte() !== 0)
35917
+ throw new Error("lazy function segment is not a passive function list");
35918
+ const functions = [];
35919
+ for (let count = r.u(); count > 0; count--) functions.push(r.u());
35920
+ elements.splice(placementIndex, 1);
35921
+ const kept = exports2.filter((entry) => entry !== placeExport);
35922
+ return {
35923
+ bytes: rewriteSections(
35924
+ bytes,
35925
+ sections,
35926
+ /* @__PURE__ */ new Map([
35927
+ [3, vectorSection(3, declared.length - 1, declared.slice(0, -1))],
35928
+ [7, vectorSection(7, kept.length, kept)],
35929
+ [9, elements.length ? vectorSection(9, elements.length, elements) : null],
35930
+ [10, vectorSection(10, bodies.length - 1, bodies.slice(0, -1))]
35931
+ ])
35932
+ ),
35933
+ functions
35934
+ };
35935
+ }
35936
+ function placeGuestLazyFunctions(bytes, lazy) {
35937
+ const sections = wasmSections(bytes);
35938
+ const lazyIndex = new Map(lazy.map((name3, index) => [name3, index]));
35939
+ const functions = new Array(lazy.length);
35940
+ let found2 = 0;
35941
+ const kept = entries(
35942
+ bytes,
35943
+ sections.find((s) => s.id === 7),
35944
+ readExport
35945
+ ).filter((entry) => {
35946
+ const r = wasmReader(entry, 0);
35947
+ const position = lazyIndex.get(r.name());
35948
+ const kind = r.byte();
35949
+ if (kind !== 0 || position === void 0) return true;
35950
+ functions[position] = r.u();
35951
+ found2++;
35952
+ return false;
35953
+ });
35954
+ if (found2 !== lazy.length)
35955
+ throw new Error("guest link lost a lazy dlsym function export");
35956
+ return appendLazyPlacement(
35957
+ rewriteSections(bytes, sections, /* @__PURE__ */ new Map([[7, vectorSection(7, kept.length, kept)]])),
35958
+ functions
35959
+ );
35960
+ }
35961
+ function guestLazyExports(lazy) {
35962
+ return lazy.map((name3) => JSON.stringify(`--export=${name3}`)).join("\n");
35963
+ }
35964
+ function nameLazyFunctions(bytes, functions) {
35965
+ const sections = wasmSections(bytes);
35966
+ const { functions: imported } = readImports2(bytes, sections);
35967
+ const custom = sections.find((s) => s.id === 0 && s.name === "name");
35968
+ const subsections = [];
35969
+ const names = /* @__PURE__ */ new Map();
35970
+ if (custom) {
35971
+ const r = wasmReader(bytes, custom.start);
35972
+ while (r.at < custom.end) {
35973
+ const id = r.byte();
35974
+ const size2 = r.u();
35975
+ const body = bytes.subarray(r.at, r.at + size2);
35976
+ r.skip(size2);
35977
+ if (id !== 1) {
35978
+ subsections.push({ id, body });
35979
+ continue;
35980
+ }
35981
+ const f = wasmReader(body, 0);
35982
+ for (let n = f.u(); n > 0; n--) {
35983
+ const index = f.u();
35984
+ const start = f.at;
35985
+ f.skip(f.u());
35986
+ names.set(index, body.subarray(start, f.at));
35987
+ }
35988
+ }
35989
+ }
35990
+ for (const index of functions) {
35991
+ if (names.has(index)) continue;
35992
+ const name3 = Buffer.from(String(index - imported));
35993
+ names.set(index, Buffer.from([...uleb3(name3.length), ...name3]));
35994
+ }
35995
+ const ordered = [...names].sort(([a], [b]) => a - b);
35996
+ const functionNames = Buffer.concat([
35997
+ Buffer.from(uleb3(ordered.length)),
35998
+ ...ordered.flatMap(([index, name3]) => [Buffer.from(uleb3(index)), name3])
35999
+ ]);
36000
+ const content = [...subsections, { id: 1, body: functionNames }].sort((a, b) => a.id - b.id).flatMap(({ id, body }) => [Buffer.from([id, ...uleb3(body.length)]), body]);
36001
+ const label = Buffer.from("name");
36002
+ const payload = Buffer.concat([
36003
+ Buffer.from([...uleb3(label.length), ...label]),
36004
+ ...content
36005
+ ]);
36006
+ const out = [bytes.subarray(0, 8)];
36007
+ for (const s of sections) if (s !== custom) out.push(bytes.subarray(s.offset, s.end));
36008
+ out.push(Buffer.from([0, ...uleb3(payload.length)]), payload);
36009
+ return Buffer.concat(out);
36010
+ }
36011
+ var uleb3, SECTION_ORDER, readExport, lastTableElement, exportName;
36012
+ var init_swift_guest_dyld_functions = __esm({
36013
+ "src/swift-guest-dyld-functions.ts"() {
36014
+ "use strict";
36015
+ init_nativeWasmContract();
36016
+ init_swift_sdk_image_wasm();
36017
+ uleb3 = (value) => {
36018
+ const out = [];
36019
+ do {
36020
+ let byte = value % 128;
36021
+ value = Math.floor(value / 128);
36022
+ if (value) byte |= 128;
36023
+ out.push(byte);
36024
+ } while (value);
36025
+ return out;
36026
+ };
36027
+ SECTION_ORDER = [1, 2, 3, 4, 5, 13, 6, 7, 8, 9, 12, 10, 11];
36028
+ readExport = (r) => {
36029
+ r.name();
36030
+ r.byte();
36031
+ r.u();
36032
+ };
36033
+ lastTableElement = (segments) => segments.findLastIndex((segment2) => (segment2[0] & 3) !== 3);
36034
+ exportName = (entry) => wasmReader(entry, 0).name();
36035
+ }
36036
+ });
36037
+
36042
36038
  // src/swift-guest-link-plan.ts
36043
36039
  function selectedGuestInputImage(artifact, member) {
36044
36040
  if (artifact.kind === "object" !== (member === null))
@@ -47211,9 +47207,11 @@ async function compileGuestLink(options2) {
47211
47207
  return [...source, ...runtime].sort((a, b) => a.image - b.image);
47212
47208
  };
47213
47209
  const sdk2 = options2.sdkImage;
47214
- const sdkCallers = sdk2?.sdkInterface.guestCallers;
47215
- const sdkObjects = sdk2 ? (await Promise.resolve().then(() => (init_swift_sdk_image(), swift_sdk_image_exports))).readSwiftSdkManifestIndex(sdk2).guestObjects : void 0;
47216
- if (sdk2 && (!sdkCallers || !sdkObjects))
47210
+ const sdkCallers = sdk2.sdkInterface.guestCallers;
47211
+ const sdkObjects = (await Promise.resolve().then(() => (init_swift_sdk_image(), swift_sdk_image_exports))).readSwiftSdkManifestIndex(
47212
+ sdk2
47213
+ ).guestObjects;
47214
+ if (!sdkCallers || !sdkObjects)
47217
47215
  throw new Error("the SDK image has no guest link manifest");
47218
47216
  const result = await linkPrunedGuestImages({
47219
47217
  buildDirectory: options2.buildDirectory,
@@ -47226,14 +47224,14 @@ async function compileGuestLink(options2) {
47226
47224
  ledgerDataImage: 0,
47227
47225
  framework: catalogs.framework,
47228
47226
  sdkProducts: null,
47229
- sharedSdk: sdkCallers && sdkObjects ? {
47227
+ sharedSdk: {
47230
47228
  callers: sdkCallers,
47231
47229
  hasContainingObject: (identity2) => sdkObjects[sdkGuestObjectKey(identity2)] !== void 0
47232
- } : void 0,
47233
- onSplitInputs: sdk2 ? (value) => {
47230
+ },
47231
+ onSplitInputs: (value) => {
47234
47232
  splitInputs = value;
47235
- } : void 0,
47236
- deferFinalLink: Boolean(sdk2),
47233
+ },
47234
+ deferFinalLink: true,
47237
47235
  onDyldRows: (rows) => {
47238
47236
  lazyFunctions = rows.lazyFunctions;
47239
47237
  dyldSymbols = rows.dyldSymbols;
@@ -47501,191 +47499,165 @@ async function compileGuestLink(options2) {
47501
47499
  }
47502
47500
  });
47503
47501
  if (!reserved2 || !projectionObject) throw new Error("guest projection was not reserved");
47504
- if (sdk2) {
47505
- try {
47506
- if (!splitInputs) throw new Error("guest link did not select shared SDK inputs");
47507
- const {
47508
- createSwiftSdkBinding: createSwiftSdkBinding2,
47509
- linkSwiftAppModule: linkSwiftAppModule2,
47510
- readSwiftSdkUsage: readSwiftSdkUsage2,
47511
- swiftAppModuleThunkSection: swiftAppModuleThunkSection2,
47512
- swiftSdkProjectionSpans: swiftSdkProjectionSpans2
47513
- } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
47514
- const project2 = options2.project;
47515
- const work = project2 ? (0, import_node_fs75.mkdtempSync)(import_node_path75.default.join(directory2, "app-module-")) : import_node_path75.default.join(directory2, "app-module");
47516
- if (project2) (0, import_node_fs75.chownSync)(work, project2.uid, project2.gid);
47517
- else (0, import_node_fs75.mkdirSync)(work, { recursive: true });
47518
- const layoutMap = import_node_path75.default.join(work, "app.map");
47519
- let appProjectionObject = projectionObject;
47520
- const owners = new Map(splitInputs.appObjects).set(appProjectionObject, 0);
47521
- const sdkObjectKeys = /* @__PURE__ */ new Map();
47522
- const sdkObjectImages = /* @__PURE__ */ new Map();
47523
- const sdkProductImages = new Map(prepared?.sdkProducts.images);
47524
- for (const [file, { image, product, identity: identity2 }] of splitInputs.sdkObjects) {
47525
- const key2 = sdkGuestObjectKey(identity2);
47526
- sdkObjectKeys.set(file, key2);
47527
- sdkObjectImages.set(key2, image);
47528
- const priorImage = sdkProductImages.get(product);
47529
- if (priorImage !== void 0 && priorImage !== image)
47530
- throw new Error(`SDK product ${product} has several guest images`);
47531
- sdkProductImages.set(product, image);
47532
- }
47533
- const linkedModule = import_node_path75.default.join(work, "app.wasm");
47534
- const sdkSpans = swiftSdkProjectionSpans2(
47535
- sdk2,
47536
- (object9, product) => sdkObjectImages.get(object9) ?? sdkProductImages.get(product)
47537
- );
47538
- const compileAppProjection = (source) => {
47539
- const projectionSource = import_node_path75.default.join(work, "projection.c");
47540
- const nextObject = import_node_path75.default.join(work, "projection.o");
47541
- (0, import_node_fs75.writeFileSync)(projectionSource, source);
47542
- (0, import_node_child_process39.execFileSync)(
47543
- import_node_path75.default.join(options2.toolchainBin, "clang"),
47544
- [...clangOptions, "-c", projectionSource, "-o", nextObject],
47545
- { stdio: "pipe" }
47546
- );
47547
- if (nextObject !== appProjectionObject) {
47548
- owners.delete(appProjectionObject);
47549
- appProjectionObject = nextObject;
47550
- owners.set(appProjectionObject, 0);
47502
+ try {
47503
+ if (!splitInputs) throw new Error("guest link did not select shared SDK inputs");
47504
+ const {
47505
+ createSwiftSdkBinding: createSwiftSdkBinding2,
47506
+ linkSwiftAppModule: linkSwiftAppModule2,
47507
+ readSwiftSdkUsage: readSwiftSdkUsage2,
47508
+ swiftAppModuleThunkSection: swiftAppModuleThunkSection2,
47509
+ swiftSdkProjectionSpans: swiftSdkProjectionSpans2
47510
+ } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
47511
+ const project2 = options2.project;
47512
+ const work = project2 ? (0, import_node_fs75.mkdtempSync)(import_node_path75.default.join(directory2, "app-module-")) : import_node_path75.default.join(directory2, "app-module");
47513
+ if (project2) (0, import_node_fs75.chownSync)(work, project2.uid, project2.gid);
47514
+ else (0, import_node_fs75.mkdirSync)(work, { recursive: true });
47515
+ const layoutMap = import_node_path75.default.join(work, "app.map");
47516
+ let appProjectionObject = projectionObject;
47517
+ const owners = new Map(splitInputs.appObjects).set(appProjectionObject, 0);
47518
+ const sdkObjectKeys = /* @__PURE__ */ new Map();
47519
+ const sdkObjectImages = /* @__PURE__ */ new Map();
47520
+ const sdkProductImages = new Map(prepared?.sdkProducts.images);
47521
+ for (const [file, { image, product, identity: identity2 }] of splitInputs.sdkObjects) {
47522
+ const key2 = sdkGuestObjectKey(identity2);
47523
+ sdkObjectKeys.set(file, key2);
47524
+ sdkObjectImages.set(key2, image);
47525
+ const priorImage = sdkProductImages.get(product);
47526
+ if (priorImage !== void 0 && priorImage !== image)
47527
+ throw new Error(`SDK product ${product} has several guest images`);
47528
+ sdkProductImages.set(product, image);
47529
+ }
47530
+ const linkedModule = import_node_path75.default.join(work, "app.wasm");
47531
+ const sdkSpans = swiftSdkProjectionSpans2(
47532
+ sdk2,
47533
+ (object9, product) => sdkObjectImages.get(object9) ?? sdkProductImages.get(product)
47534
+ );
47535
+ const compileAppProjection = (source) => {
47536
+ const projectionSource = import_node_path75.default.join(work, "projection.c");
47537
+ const nextObject = import_node_path75.default.join(work, "projection.o");
47538
+ (0, import_node_fs75.writeFileSync)(projectionSource, source);
47539
+ (0, import_node_child_process39.execFileSync)(
47540
+ import_node_path75.default.join(options2.toolchainBin, "clang"),
47541
+ [...clangOptions, "-c", projectionSource, "-o", nextObject],
47542
+ { stdio: "pipe" }
47543
+ );
47544
+ if (nextObject !== appProjectionObject) {
47545
+ owners.delete(appProjectionObject);
47546
+ appProjectionObject = nextObject;
47547
+ owners.set(appProjectionObject, 0);
47548
+ }
47549
+ };
47550
+ let storage = reserved2;
47551
+ if (sdkSpans.length > 0) {
47552
+ const sdkCounts = guestProjectionRegionCounts(storage.images.length, sdkSpans);
47553
+ storage = reserveGuestProjectionStorage(
47554
+ storage.images,
47555
+ storage.capacities.map((capacity, index) => ({
47556
+ ...capacity,
47557
+ regions: capacity.regions + sdkCounts[index] + 16
47558
+ }))
47559
+ );
47560
+ compileAppProjection(storage.source);
47561
+ }
47562
+ let precomputedSymbols;
47563
+ if (splitInputs.appReferencedSymbols && splitInputs.appDefinedSymbols) {
47564
+ const referenced = new Set(splitInputs.appReferencedSymbols);
47565
+ const defined = new Set(splitInputs.appDefinedSymbols);
47566
+ const projSyms = guestWasmSymbols((0, import_node_fs75.readFileSync)(appProjectionObject));
47567
+ for (const name3 of projSyms.undefined) referenced.add(name3);
47568
+ for (const name3 of projSyms.defined) defined.add(name3);
47569
+ precomputedSymbols = { referenced, defined };
47570
+ }
47571
+ for (; ; ) {
47572
+ const link = await linkSwiftAppModule2({
47573
+ objects: [...owners.keys()],
47574
+ lazyFunctions: splitInputs.lazyFunctions,
47575
+ toolchainBin: options2.toolchainBin,
47576
+ sdk: sdk2,
47577
+ work,
47578
+ output: options2.optimized,
47579
+ optimize: options2.optimize,
47580
+ layoutMap,
47581
+ project: project2,
47582
+ precomputedSymbols,
47583
+ loweringCache: project2 ? void 0 : {
47584
+ file: import_node_path75.default.join(
47585
+ options2.buildDirectory,
47586
+ ".build",
47587
+ "peach-app-module-lowered.wasm"
47588
+ ),
47589
+ compilerDigest: options2.compilerDigest
47551
47590
  }
47552
- };
47553
- let storage = reserved2;
47554
- if (sdkSpans.length > 0) {
47555
- const sdkCounts = guestProjectionRegionCounts(storage.images.length, sdkSpans);
47591
+ });
47592
+ const map2 = (0, import_node_fs75.readFileSync)(
47593
+ project2 ? projectOutputFile(work, layoutMap, project2) : layoutMap,
47594
+ "utf8"
47595
+ );
47596
+ const values = guestDyldValueRange(map2);
47597
+ const bindingRows = /* @__PURE__ */ new Map();
47598
+ const data = [];
47599
+ for (let at = 0; at < link.linkage.data.length; at += 3) {
47600
+ const address = link.linkage.data[at];
47601
+ const size2 = link.linkage.data[at + 1];
47602
+ const value = link.linkage.data[at + 2];
47603
+ if (values && address >= values.address && address < values.address + values.length) {
47604
+ if (size2 !== 8 || (address - values.address) % 8)
47605
+ throw new Error("sdk binding splits a dyld value");
47606
+ bindingRows.set((address - values.address) / 8, value);
47607
+ } else data.push(address, size2, value);
47608
+ }
47609
+ const linked = (0, import_node_fs75.readFileSync)(
47610
+ project2 ? projectOutputFile(work, linkedModule, project2) : linkedModule
47611
+ );
47612
+ const required = guestProjectionRegionCounts(storage.images.length, [
47613
+ ...guestLinkedSpans(map2, linked, linked, owners, splitInputs.appSections, true),
47614
+ ...sdkSpans
47615
+ ]);
47616
+ if (storage.capacities.some(({ regions }, index) => required[index] > regions)) {
47556
47617
  storage = reserveGuestProjectionStorage(
47557
47618
  storage.images,
47558
- storage.capacities.map((capacity, index) => ({
47559
- ...capacity,
47560
- regions: capacity.regions + sdkCounts[index] + 16
47561
- }))
47619
+ storage.capacities.map((capacity, index) => {
47620
+ const count = required[index];
47621
+ return count > capacity.regions ? { ...capacity, regions: Math.max(count, capacity.regions * 2) } : capacity;
47622
+ })
47562
47623
  );
47563
47624
  compileAppProjection(storage.source);
47625
+ continue;
47564
47626
  }
47565
- let precomputedSymbols;
47566
- if (splitInputs.appReferencedSymbols && splitInputs.appDefinedSymbols) {
47567
- const referenced = new Set(splitInputs.appReferencedSymbols);
47568
- const defined = new Set(splitInputs.appDefinedSymbols);
47569
- const projSyms = guestWasmSymbols((0, import_node_fs75.readFileSync)(appProjectionObject));
47570
- for (const name3 of projSyms.undefined) referenced.add(name3);
47571
- for (const name3 of projSyms.defined) defined.add(name3);
47572
- precomputedSymbols = { referenced, defined };
47573
- }
47574
- for (; ; ) {
47575
- const link = await linkSwiftAppModule2({
47576
- objects: [...owners.keys()],
47577
- lazyFunctions: splitInputs.lazyFunctions,
47578
- toolchainBin: options2.toolchainBin,
47579
- sdk: sdk2,
47580
- work,
47581
- output: options2.optimized,
47582
- optimize: options2.optimize,
47583
- layoutMap,
47584
- project: project2,
47585
- precomputedSymbols,
47586
- loweringCache: project2 ? void 0 : {
47587
- file: import_node_path75.default.join(
47588
- options2.buildDirectory,
47589
- ".build",
47590
- "peach-app-module-lowered.wasm"
47591
- ),
47592
- compilerDigest: options2.compilerDigest
47593
- }
47594
- });
47595
- const map3 = (0, import_node_fs75.readFileSync)(
47596
- project2 ? projectOutputFile(work, layoutMap, project2) : layoutMap,
47597
- "utf8"
47598
- );
47599
- const values = guestDyldValueRange(map3);
47600
- const bindingRows = /* @__PURE__ */ new Map();
47601
- const data = [];
47602
- for (let at = 0; at < link.linkage.data.length; at += 3) {
47603
- const address = link.linkage.data[at];
47604
- const size2 = link.linkage.data[at + 1];
47605
- const value = link.linkage.data[at + 2];
47606
- if (values && address >= values.address && address < values.address + values.length) {
47607
- if (size2 !== 8 || (address - values.address) % 8)
47608
- throw new Error("sdk binding splits a dyld value");
47609
- bindingRows.set((address - values.address) / 8, value);
47610
- } else data.push(address, size2, value);
47611
- }
47612
- const linked = (0, import_node_fs75.readFileSync)(
47613
- project2 ? projectOutputFile(work, linkedModule, project2) : linkedModule
47614
- );
47615
- const required = guestProjectionRegionCounts(storage.images.length, [
47616
- ...guestLinkedSpans(map3, linked, linked, owners, splitInputs.appSections, true),
47617
- ...sdkSpans
47618
- ]);
47619
- if (storage.capacities.some(({ regions }, index) => required[index] > regions)) {
47620
- storage = reserveGuestProjectionStorage(
47621
- storage.images,
47622
- storage.capacities.map((capacity, index) => {
47623
- const count = required[index];
47624
- return count > capacity.regions ? { ...capacity, regions: Math.max(count, capacity.regions * 2) } : capacity;
47625
- })
47626
- );
47627
- compileAppProjection(storage.source);
47628
- continue;
47629
- }
47630
- options2.onStage("lowering the app image");
47631
- const lowerPromise = link.lower();
47632
- await new Promise((resolve11) => setImmediate(resolve11));
47633
- let binding;
47634
- try {
47635
- if (result.finalLinkDone) await result.finalLinkDone;
47636
- const usage = readSwiftSdkUsage2(result.mapPath, options2.output, sdkObjectKeys);
47637
- binding = createSwiftSdkBinding2({ ...link.linkage, data }, sdk2, usage);
47638
- } catch (error) {
47639
- await Promise.allSettled([lowerPromise]);
47640
- throw error;
47641
- }
47642
- await lowerPromise;
47643
- const finalized = finalizeGuestProjectionStorage({
47644
- map: map3,
47645
- linked,
47646
- optimized: (0, import_node_fs75.readFileSync)(options2.optimized),
47647
- owners,
47648
- sectionOwners: splitInputs.appSections,
47649
- projectionObject: appProjectionObject,
47650
- reserved: storage,
47651
- sdkSpans
47652
- });
47653
- (0, import_node_fs75.writeFileSync)(
47654
- options2.optimized,
47655
- moveGuestDyldTable(map3, finalized.wasm, splitInputs.dyldSymbols, bindingRows, [
47656
- swiftAppModuleThunkSection2(finalized.wasm)
47657
- ])
47658
- );
47659
- return binding;
47627
+ options2.onStage("lowering the app image");
47628
+ const lowerPromise = link.lower();
47629
+ await new Promise((resolve11) => setImmediate(resolve11));
47630
+ let binding;
47631
+ try {
47632
+ if (result.finalLinkDone) await result.finalLinkDone;
47633
+ const usage = readSwiftSdkUsage2(result.mapPath, options2.output, sdkObjectKeys);
47634
+ binding = createSwiftSdkBinding2({ ...link.linkage, data }, sdk2, usage);
47635
+ } catch (error) {
47636
+ await Promise.allSettled([lowerPromise]);
47637
+ throw error;
47660
47638
  }
47661
- } finally {
47662
- if (result.finalLinkDone) await Promise.allSettled([result.finalLinkDone]);
47639
+ await lowerPromise;
47640
+ const finalized = finalizeGuestProjectionStorage({
47641
+ map: map2,
47642
+ linked,
47643
+ optimized: (0, import_node_fs75.readFileSync)(options2.optimized),
47644
+ owners,
47645
+ sectionOwners: splitInputs.appSections,
47646
+ projectionObject: appProjectionObject,
47647
+ reserved: storage,
47648
+ sdkSpans
47649
+ });
47650
+ (0, import_node_fs75.writeFileSync)(
47651
+ options2.optimized,
47652
+ moveGuestDyldTable(map2, finalized.wasm, splitInputs.dyldSymbols, bindingRows, [
47653
+ swiftAppModuleThunkSection2(finalized.wasm)
47654
+ ])
47655
+ );
47656
+ return binding;
47663
47657
  }
47658
+ } finally {
47659
+ if (result.finalLinkDone) await Promise.allSettled([result.finalLinkDone]);
47664
47660
  }
47665
- options2.onStage("lowering the app image");
47666
- await lowerWasm(options2.output, options2.optimized, {
47667
- optimize: options2.optimize,
47668
- skipPasses: ["duplicate-function-elimination"],
47669
- wideExports: lazyFunctions
47670
- });
47671
- if (lazyFunctions.length)
47672
- (0, import_node_fs75.writeFileSync)(
47673
- options2.optimized,
47674
- placeGuestLazyFunctions((0, import_node_fs75.readFileSync)(options2.optimized), lazyFunctions)
47675
- );
47676
- const map2 = (0, import_node_fs75.readFileSync)(result.mapPath, "utf8");
47677
- let optimized = (0, import_node_fs75.readFileSync)(options2.optimized);
47678
- if (/ __peach_guest_images$/m.test(map2))
47679
- optimized = finalizeGuestProjectionStorage({
47680
- map: map2,
47681
- linked: (0, import_node_fs75.readFileSync)(options2.output),
47682
- optimized,
47683
- owners: result.owners,
47684
- sectionOwners: result.generatedSectionOwners,
47685
- projectionObject,
47686
- reserved: reserved2
47687
- }).wasm;
47688
- (0, import_node_fs75.writeFileSync)(options2.optimized, moveGuestDyldTable(map2, optimized, dyldSymbols));
47689
47661
  }
47690
47662
  var import_node_child_process39, import_node_fs75, import_node_path75;
47691
47663
  var init_swift_guest_compile = __esm({
@@ -47695,7 +47667,6 @@ var init_swift_guest_compile = __esm({
47695
47667
  import_node_fs75 = require("node:fs");
47696
47668
  import_node_path75 = __toESM(require("node:path"), 1);
47697
47669
  init_swift_guest_archive();
47698
- init_swift_guest_dyld_functions();
47699
47670
  init_swift_guest_dyld_table();
47700
47671
  init_swift_guest_link();
47701
47672
  init_swift_guest_linked_spans();
@@ -47709,7 +47680,6 @@ var init_swift_guest_compile = __esm({
47709
47680
  init_swift_toolchain();
47710
47681
  init_swift_wasm_prune();
47711
47682
  init_swiftTargetContract();
47712
- init_wasm_optimize();
47713
47683
  }
47714
47684
  });
47715
47685
 
@@ -52659,20 +52629,17 @@ function readCompiledArtifact(directory2, hash) {
52659
52629
  const gzip2 = (0, import_node_fs82.readFileSync)(import_node_path84.default.join(directory2, "icu.gz"));
52660
52630
  if ((0, import_node_crypto50.createHash)("sha256").update(bytes).digest("hex") !== receipt.wasm || (0, import_node_crypto50.createHash)("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length <= 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
52661
52631
  return null;
52662
- let sdk2;
52663
- if ("sdk" in receipt) {
52664
- const image = receipt.sdk;
52665
- if (!isRecord(image) || typeof image.key !== "string" || typeof image.sha256 !== "string" || typeof image.binding !== "string")
52666
- return null;
52667
- const binding = (0, import_node_fs82.readFileSync)(import_node_path84.default.join(directory2, "sdk-binding.bin"));
52668
- if ((0, import_node_crypto50.createHash)("sha256").update(binding).digest("hex") !== image.binding)
52669
- return null;
52670
- sdk2 = {
52671
- key: image.key,
52672
- sha256: image.sha256,
52673
- binding: { bytes: binding, sha256: image.binding }
52674
- };
52675
- }
52632
+ if (!("sdk" in receipt)) return null;
52633
+ const image = receipt.sdk;
52634
+ if (!isRecord(image) || typeof image.key !== "string" || typeof image.sha256 !== "string" || typeof image.binding !== "string")
52635
+ return null;
52636
+ const binding = (0, import_node_fs82.readFileSync)(import_node_path84.default.join(directory2, "sdk-binding.bin"));
52637
+ if ((0, import_node_crypto50.createHash)("sha256").update(binding).digest("hex") !== image.binding) return null;
52638
+ const sdk2 = {
52639
+ key: image.key,
52640
+ sha256: image.sha256,
52641
+ binding: { bytes: binding, sha256: image.binding }
52642
+ };
52676
52643
  return { hash, bytes, icu: { sha256: receipt.icu, gzip: gzip2 }, sdk: sdk2 };
52677
52644
  } catch (error) {
52678
52645
  if (error instanceof SyntaxError || error instanceof Error && "code" in error && error.code === "ENOENT")
@@ -53603,13 +53570,12 @@ async function compileSwiftProjectOnce(sources, options2) {
53603
53570
  sources: import_node_path84.default.join(root, "Sources", "App"),
53604
53571
  multi: compileTargets(input).length > 0
53605
53572
  };
53606
- const sdkModule = options2.sdkModule && !options2.linkOnly;
53607
- const sdkImage = sdkModule ? await (await Promise.resolve().then(() => (init_swift_sdk_image(), swift_sdk_image_exports))).buildSwiftSdkImage(
53573
+ const sdkImage = options2.linkOnly ? void 0 : await (await Promise.resolve().then(() => (init_swift_sdk_image(), swift_sdk_image_exports))).buildSwiftSdkImage(
53608
53574
  moduleRoot,
53609
53575
  !!guestGraph,
53610
53576
  distribution ? [] : linkedFrameworkTargets(moduleRoot, input).imports,
53611
53577
  { signal: options2.signal }
53612
- ) : void 0;
53578
+ );
53613
53579
  const inputHash = swiftCompileInputHash(input, options2.release);
53614
53580
  const moduleDigest = swiftModuleDigest(moduleRoot);
53615
53581
  const sourceHash = inputHash.copy().update(moduleDigest).digest("hex");
@@ -53640,79 +53606,10 @@ sdk module ${sdkImage.key}`).digest("hex") : sourceHash;
53640
53606
  return retain(root, previous);
53641
53607
  }
53642
53608
  }
53643
- if (!options2.intermediates && !sdkImage && process.platform === "darwin" && process.env.TM_SESSION && !windowAdmission() && process.env.CI !== "true" && moduleRoot === sourceSwiftCheckout() && !swiftDistributionAt(moduleRoot)) {
53644
- const requestRoot = (0, import_node_fs82.mkdtempSync)(`${root}.builder-request-`);
53645
- const output = import_node_path84.default.join(requestRoot, "output");
53646
- const request = import_node_path84.default.join(requestRoot, "request.json");
53647
- (0, import_node_fs82.writeFileSync)(
53648
- request,
53649
- JSON.stringify({
53650
- input,
53651
- hash,
53652
- release: options2.release,
53653
- timeoutMs: options2.timeoutMs,
53654
- // framework sources and compiler inputs own the shared object tree;
53655
- // unrelated app edits reuse it without retaining stale private ABI.
53656
- buildKey: frameworkKey
53657
- })
53658
- );
53659
- try {
53660
- const repo = import_node_path84.default.resolve(moduleRoot, "../..");
53661
- const timeout = swiftBuilderHopTimeoutMs(options2.timeoutMs);
53662
- report("requesting builder admission or cached result");
53663
- await runCompiler(
53664
- "bun",
53665
- [
53666
- import_node_path84.default.join(repo, "scripts/build/swift-project.ts"),
53667
- "--request",
53668
- request,
53669
- "--output",
53670
- output
53671
- ],
53672
- {
53673
- cwd: repo,
53674
- timeout,
53675
- maxBuffer: 64 * 1024 * 1024,
53676
- signal: options2.signal
53677
- },
53678
- true
53679
- ).catch((error) => {
53680
- if (options2.signal?.aborted) throw error;
53681
- const output2 = outputOf(error);
53682
- if (!(error instanceof Error) || Reflect.get(error, "exitCode") !== 124)
53683
- throw new Error(output2, { cause: error });
53684
- const prefix = `[swift-project ${hash.slice(0, 16)}] `;
53685
- const lines = output2.split("\n");
53686
- const stage = lines.findLast((line) => line.startsWith(prefix))?.slice(prefix.length);
53687
- const cap = lines.find(
53688
- (line) => line.startsWith("[remote] outer deadline leaves ")
53689
- );
53690
- const deadline = cap ? `
53691
- ${cap}` : "";
53692
- throw new Error(
53693
- `Swift builder deadline expired during ${stage ?? "builder preparation"} (requested ${Math.ceil(timeout / 1e3)}s for the builder hop).${deadline}`,
53694
- { cause: error }
53695
- );
53696
- });
53697
- const artifact = readCompiledArtifact(output, hash);
53698
- if (!artifact) {
53699
- throw new Error(
53700
- "swift-compile: builder artifact source, digest or wasm header is invalid"
53701
- );
53702
- }
53703
- saveCompiledArtifact(root, artifact);
53704
- saveSharedArtifact(sharedRoot, artifact);
53705
- report("builder artifact verified");
53706
- return retain(root, artifact);
53707
- } finally {
53708
- (0, import_node_fs82.rmSync)(requestRoot, { recursive: true, force: true });
53709
- }
53710
- }
53711
53609
  const baseRoot = root;
53712
53610
  const canPoolBuildRoot = !options2.intermediates && !options2.project && !options2.linkOnly && import_node_path84.default.basename(import_node_path84.default.dirname(baseRoot)) === "swift-builds";
53713
53611
  const compatShapeParts = canPoolBuildRoot ? [
53714
53612
  frameworkKey,
53715
- Boolean(sdkImage),
53716
53613
  compileTargets(input).map((target) => target.name).sort(),
53717
53614
  input.oneModule === true,
53718
53615
  input.optimize === true,
@@ -54350,7 +54247,8 @@ ${compatShape}` : "";
54350
54247
  }
54351
54248
  const output = options2.project ? projectOutputFile(root2, linked, options2.project) : linked;
54352
54249
  const optimized = `${output}.optimized`;
54353
- if (sdkImage && options2.project) (0, import_node_fs82.rmSync)(optimized, { force: true });
54250
+ if (!sdkImage) throw new Error("swift-compile: missing shared SDK image");
54251
+ if (options2.project) (0, import_node_fs82.rmSync)(optimized, { force: true });
54354
54252
  let sdkAsset;
54355
54253
  stage("linking the app image");
54356
54254
  if (guestGraph) {
@@ -54379,9 +54277,8 @@ ${compatShape}` : "";
54379
54277
  jobs: swiftBuildJobs(),
54380
54278
  onStage: stage
54381
54279
  });
54382
- if (sdkImage && binding)
54383
- sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
54384
- } else if (sdkImage) {
54280
+ sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
54281
+ } else {
54385
54282
  const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
54386
54283
  const binding = await buildSwiftAppModule2({
54387
54284
  buildRoot: root2,
@@ -54399,19 +54296,7 @@ ${compatShape}` : "";
54399
54296
  }
54400
54297
  });
54401
54298
  sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
54402
- } else {
54403
- const bytes = (0, import_node_fs82.readFileSync)(output);
54404
- const ordered = orderObjCConstructors(bytes);
54405
- if (ordered !== bytes) (0, import_node_fs82.writeFileSync)(output, ordered);
54406
- stage("lowering the app image");
54407
- await lowerWasm(output, optimized, { optimize: input.optimize === true });
54408
54299
  }
54409
- if (!sdkImage)
54410
- await runCompiler(
54411
- import_node_path84.default.join(options2.toolchainBin, "llvm-objcopy"),
54412
- ["--remove-section=.swift1_autolink_entries", optimized],
54413
- buildOptions
54414
- );
54415
54300
  const artifact = {
54416
54301
  hash,
54417
54302
  bytes: (0, import_node_fs82.readFileSync)(optimized),
@@ -54471,7 +54356,6 @@ var init_swift_compile = __esm({
54471
54356
  init_swift_project_user();
54472
54357
  init_swift_reproducible();
54473
54358
  init_swift_root_lock();
54474
- init_swift_sdk_image_wasm();
54475
54359
  init_swift_sdk_surface();
54476
54360
  init_swift_shared_sdk();
54477
54361
  init_swift_source_closure();
@@ -54666,7 +54550,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
54666
54550
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
54667
54551
  MULTI_MANIFEST_VERSION = 76;
54668
54552
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
54669
- compilerSourceDigest = true ? "229f789297c5cb8e33a042e23ad3c1df20450a712a02dd0b50d2e78bc8ed3de6" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
54553
+ compilerSourceDigest = true ? "dcd0189f8bf1a7fc415f2c92825f8b3bbc2089ae9697ffcb50cc9a7e65e99990" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
54670
54554
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
54671
54555
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
54672
54556
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -82181,6 +82065,23 @@ function readCompiledMetadata(label, value, readPackage, names) {
82181
82065
  );
82182
82066
  return { platform: "ios", packages, url, hash, icuUrl: icuUrl2, bundleFiles };
82183
82067
  }
82068
+ function readSdkEntryMetadata(label, value) {
82069
+ const sdkUrl = Reflect.get(value, "sdkUrl");
82070
+ const sdkBindingUrl = Reflect.get(value, "sdkBindingUrl");
82071
+ if (sdkUrl === void 0 && sdkBindingUrl === void 0) return {};
82072
+ if (typeof sdkUrl === "string" && sdkUrl && typeof sdkBindingUrl === "string" && sdkBindingUrl)
82073
+ return { sdkUrl, sdkBindingUrl };
82074
+ throw new Error(`invalid ${label} SDK binding metadata`);
82075
+ }
82076
+ function readNitroMetadata(value) {
82077
+ const metadata = readCompiledMetadata(
82078
+ "Nitro",
82079
+ value,
82080
+ readNitroPackage,
82081
+ (entry) => entry.hybridObjects
82082
+ );
82083
+ return metadata && { ...metadata, ...readSdkEntryMetadata("Nitro", Object(value)) };
82084
+ }
82184
82085
  function readTurboMetadata(value) {
82185
82086
  if (value === null || value === void 0) return null;
82186
82087
  if (typeof value !== "object" || Array.isArray(value) || Reflect.get(value, "platform") !== NITRO_GUEST_PLATFORM)
@@ -82214,11 +82115,13 @@ function readTurboMetadata(value) {
82214
82115
  readCompiledPackage,
82215
82116
  () => []
82216
82117
  );
82217
- const sdk2 = sdkUrl === void 0 && sdkBindingUrl === void 0 ? {} : typeof sdkUrl === "string" && sdkUrl && typeof sdkBindingUrl === "string" && sdkBindingUrl ? { sdkUrl, sdkBindingUrl } : null;
82218
- if (sdk2 === null) throw new Error("invalid TurboModule SDK binding metadata");
82219
- return metadata && { ...metadata, ...sdk2, ...unavailable2 ? { unavailable: unavailable2 } : {} };
82118
+ return metadata && {
82119
+ ...metadata,
82120
+ ...readSdkEntryMetadata("TurboModule", value),
82121
+ ...unavailable2 ? { unavailable: unavailable2 } : {}
82122
+ };
82220
82123
  }
82221
- var NITRO_GUEST_PLATFORM, readNitroMetadata;
82124
+ var NITRO_GUEST_PLATFORM;
82222
82125
  var init_nitroContract = __esm({
82223
82126
  "src/nitroContract.ts"() {
82224
82127
  "use strict";
@@ -82226,7 +82129,6 @@ var init_nitroContract = __esm({
82226
82129
  init_is_record();
82227
82130
  init_swiftContract();
82228
82131
  NITRO_GUEST_PLATFORM = "ios";
82229
- readNitroMetadata = (value) => readCompiledMetadata("Nitro", value, readNitroPackage, (entry) => entry.hybridObjects);
82230
82132
  }
82231
82133
  });
82232
82134
 
@@ -102843,7 +102745,6 @@ function linkedModuleRoots(packagePath) {
102843
102745
  return [...roots].sort();
102844
102746
  }
102845
102747
  function updateSwiftConfigStamp(hash, packagePath) {
102846
- if (projects().get(packagePath)?.standalone) hash.update("standalone");
102847
102748
  const config = xcodeProjects().get(packagePath);
102848
102749
  hash.update(JSON.stringify(config?.behavior ?? {}));
102849
102750
  const gates = config?.swiftWasm64?.platformGates;
@@ -102920,9 +102821,9 @@ function moduleStamp(packagePath, moduleRootOverride, hosted) {
102920
102821
  }
102921
102822
  return hash.digest("hex");
102922
102823
  }
102923
- function otherInputs(input, standalone) {
102824
+ function otherInputs(input) {
102924
102825
  const { files: _files, ...rest } = input;
102925
- return (0, import_node_crypto82.createHash)("sha256").update(JSON.stringify({ ...rest, standalone })).digest("hex");
102826
+ return (0, import_node_crypto82.createHash)("sha256").update(JSON.stringify(rest)).digest("hex");
102926
102827
  }
102927
102828
  function icuUrl(origin, artifact) {
102928
102829
  return "url" in artifact.icu ? artifact.icu.url : `${origin}${ICU_PATH}${swiftIcuAddress(artifact.icu)}`;
@@ -103126,7 +103027,6 @@ async function packageSnapshot(project2, entry, moduleRoot) {
103126
103027
  return {
103127
103028
  files: files2,
103128
103029
  oneModule: project2.oneModule,
103129
- standalone: project2.standalone === true,
103130
103030
  binaryModules: {
103131
103031
  ...project2.binaryModules,
103132
103032
  ...Object.fromEntries(
@@ -103338,7 +103238,7 @@ async function compile(packagePath, stamp, moduleRootOverride, hosted, snapshot,
103338
103238
  const input = snapshotCompileInput(snapshot);
103339
103239
  const compiled = {
103340
103240
  files: input.files,
103341
- inputs: otherInputs(input, snapshot.standalone),
103241
+ inputs: otherInputs(input),
103342
103242
  module: moduleStamp(packagePath, moduleRootOverride, false)
103343
103243
  };
103344
103244
  const parsed2 = compileTargets(input);
@@ -103386,8 +103286,6 @@ async function compile(packagePath, stamp, moduleRootOverride, hosted, snapshot,
103386
103286
  buildRoot: swiftBuildRoot(packagePath, moduleRoot),
103387
103287
  moduleRoot,
103388
103288
  ...toolchain,
103389
- // the preview loads an app module beside the shared sdk image
103390
- sdkModule: !snapshot.standalone && (input.sourceLinkGraph !== void 0 || swiftApplicationEntry(input.entry, input.files[input.entry] ?? "")),
103391
103289
  signal
103392
103290
  }).catch((error) => {
103393
103291
  const report = error instanceof Error ? swiftApiGapReport(error.message) : null;
@@ -103536,8 +103434,7 @@ async function compileRemote(packagePath, snapshot, hosted, ownerSignal) {
103536
103434
  resources: snapshot.bundleFiles.files,
103537
103435
  images: snapshot.resources.images,
103538
103436
  entry: snapshot.entry,
103539
- packageId: descriptor?.packageId ?? swiftPackageId(packagePath),
103540
- sdkModule: !snapshot.standalone
103437
+ packageId: descriptor?.packageId ?? swiftPackageId(packagePath)
103541
103438
  },
103542
103439
  origin,
103543
103440
  signal,
@@ -103629,7 +103526,7 @@ function scopedArtifact(project2, entry, moduleRoot, signal) {
103629
103526
  const compiled = project2.artifact?.compiled;
103630
103527
  if (project2.artifact && compiled && compiled.module === moduleStamp(project2.packagePath, moduleRoot, false)) {
103631
103528
  const input = snapshotCompileInput(snapshot);
103632
- const values = otherInputs(input, snapshot.standalone) === compiled.inputs ? designTimeValues(compiled.files, input.files) : null;
103529
+ const values = otherInputs(input) === compiled.inputs ? designTimeValues(compiled.files, input.files) : null;
103633
103530
  if (values) return { ...project2.artifact, stamp, designTimeValues: values };
103634
103531
  }
103635
103532
  return compile(
@@ -103767,7 +103664,10 @@ async function swiftPackageMetadata(packagePath, packageName2, moduleRoot, origi
103767
103664
  defaultView: mains.length === 1
103768
103665
  } : void 0
103769
103666
  });
103770
- if (mains.length === 0) return metadata(origin, artifact);
103667
+ if (mains.length === 0) {
103668
+ await prepareSwiftSdkEntryAssets(origin, artifact);
103669
+ return metadata(origin, artifact);
103670
+ }
103771
103671
  const publishedSdk = artifact.sdk && publishedSwiftSdk(artifact.sdk.sha256);
103772
103672
  const sdkDigest = artifact.sdk && !publishedSdk ? await swiftSdkStartup(
103773
103673
  artifact.sdk,
@@ -110592,7 +110492,6 @@ async function compileTurboModule(options2) {
110592
110492
  );
110593
110493
  const project2 = projectFor(packagePath);
110594
110494
  project2.oneModule = false;
110595
- project2.standalone = true;
110596
110495
  project2.libraries = input.libraries;
110597
110496
  project2.binaryModules = input.binaryModules;
110598
110497
  project2.optimize = input.optimize;
@@ -110948,7 +110847,7 @@ var init_react_native_core = __esm({
110948
110847
  init_swift_distribution();
110949
110848
  init_swift_package();
110950
110849
  init_swiftContract();
110951
- recipe = true ? "db2c81d6628055a561c22667b098e4686f9d8924ffb229c4c7d9e15a25182502" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
110850
+ recipe = true ? "d4161f11b10bfff3f21f57ca2352bf31c30f364e15fd7e1c385311c10033fa89" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
110952
110851
  strings4 = (value) => isRecord(value) && Object.values(value).every((item) => typeof item === "string");
110953
110852
  building = /* @__PURE__ */ new Map();
110954
110853
  }
@@ -113717,6 +113616,7 @@ var init_native_package_slice = __esm({
113717
113616
  init_native_prebuilt();
113718
113617
  init_swift_compile();
113719
113618
  init_swift_distribution();
113619
+ init_swift_host();
113720
113620
  init_swift_icu();
113721
113621
  init_swift_native_pin();
113722
113622
  init_swift_package();
@@ -126291,7 +126191,12 @@ function collectNitroCompileInput(collection, adapter, dependencies, iosDeployme
126291
126191
  ].join("\n") : [
126292
126192
  ...swift ? ["@_spi(Peach) import PeachFoundation"] : [],
126293
126193
  ...imports2.map((name3) => `import ${name3}`),
126294
- ...swift ? ["PeachHostDriver.installExecutor()"] : [],
126194
+ ...swift ? [
126195
+ '@_expose(wasm, "peach_nitro_swift_host")',
126196
+ '@_cdecl("peach_nitro_swift_host")',
126197
+ "public func _peachNitroSwiftHost() {}",
126198
+ "PeachHostDriver.installExecutor()"
126199
+ ] : [],
126295
126200
  ...register,
126296
126201
  ""
126297
126202
  ].join("\n");
@@ -126862,7 +126767,6 @@ async function compileNitroModule(options2) {
126862
126767
  );
126863
126768
  const project2 = projectFor(packagePath);
126864
126769
  project2.oneModule = false;
126865
- project2.standalone = true;
126866
126770
  project2.libraries = input.libraries;
126867
126771
  project2.binaryModules = input.binaryModules;
126868
126772
  project2.optimize = input.optimize;
@@ -127111,7 +127015,7 @@ var init_nitro_superset = __esm({
127111
127015
  init_nitroContract();
127112
127016
  init_swift_standin_digest();
127113
127017
  NITRO_SUPERSET_ENTRY_NAME = "superset";
127114
- NITRO_COMPILER_DIGEST = true ? "744976c15724422db8f3bc8d1fdfdcf68c3f91b185210a50951930d2ea18c38e" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
127018
+ NITRO_COMPILER_DIGEST = true ? "9303a53709842e0a9107912bfca87f4a1731cfc09b9d252fac03c156eabf3836" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
127115
127019
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
127116
127020
  nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
127117
127021
  published3 = /* @__PURE__ */ new Map();
@@ -127182,6 +127086,7 @@ async function compileNitroApp(appRoot, origin, configure, moduleRoot, shared =
127182
127086
  views
127183
127087
  })),
127184
127088
  url: `${origin}/__peach/swift/${artifact.hash}.wasm`,
127089
+ ...await prepareSwiftSdkEntryAssets(origin, artifact),
127185
127090
  hash: artifact.hash,
127186
127091
  icuUrl: icuUrl(origin, artifact),
127187
127092
  bundleFiles: artifact.package.bundleFiles.files
@@ -127502,12 +127407,12 @@ let package = Package(name: "OneSDKGuest", targets: [
127502
127407
  );
127503
127408
  const project2 = projectFor(packagePath);
127504
127409
  project2.oneModule = false;
127505
- project2.standalone = true;
127506
127410
  project2.optimize = optimize;
127507
127411
  project2.unoptimized = !optimize;
127508
127412
  const artifact = await artifactFor(project2, "Sources/App/App.swift", moduleRoot);
127509
127413
  const metadata = {
127510
127414
  url: `${origin}/__peach/swift/${artifact.hash}.wasm`,
127415
+ ...await prepareSwiftSdkEntryAssets(origin, artifact),
127511
127416
  hash: artifact.hash,
127512
127417
  icuUrl: icuUrl(origin, artifact),
127513
127418
  rootId: `one-sdk-${artifact.hash.slice(0, 16)}`,
@@ -127625,7 +127530,7 @@ async function compileTurboApp(appRoot, origin, moduleRoot, iosTarget, prepareRe
127625
127530
  url: `${origin}/__peach/swift/${artifact.hash}.wasm`,
127626
127531
  hash: artifact.hash,
127627
127532
  icuUrl: icuUrl(origin, artifact),
127628
- ...swiftSdkEntryAssets(origin, artifact),
127533
+ ...await prepareSwiftSdkEntryAssets(origin, artifact),
127629
127534
  bundleFiles: artifact.package.bundleFiles.files,
127630
127535
  ...unavailable2.length > 0 ? { unavailable: unavailable2 } : {}
127631
127536
  }