peachsim 0.1.2589 → 0.1.2591

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 (139) 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 +1490 -534
  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-6FUOY6FX.mjs → acorn-EMX4WZ72.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-33SCXU3Y.mjs → chunk-4QHHRGO4.mjs} +1 -1
  28. package/dist-lib/esm-chunks/{chunk-Y4PV4HZB.mjs → chunk-7627LKJK.mjs} +1 -1
  29. package/dist-lib/esm-chunks/{chunk-M4KUWGU3.mjs → chunk-AKKHSVJ4.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-MKSOJCRT.mjs → chunk-EGKH2L6J.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-5EFD2VBY.mjs → chunk-ILWFGZWW.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-57FFWABF.mjs → chunk-J676B57D.mjs} +5 -5
  33. package/dist-lib/esm-chunks/{chunk-JLOJZF2Y.mjs → chunk-JHXDM3YU.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-464CBA5U.mjs → chunk-MC6NMYWY.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-CRIYVOMB.mjs → chunk-NX23AMX4.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-EAIFG4MQ.mjs → chunk-Q4NA6PUR.mjs} +3 -3
  37. package/dist-lib/esm-chunks/{chunk-47K4QPVA.mjs → chunk-QBMFX3J2.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-FQQ2DMXS.mjs → chunk-RKQZGWX2.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-5QWQDXXD.mjs → chunk-SOAYP72T.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-XTKKROVU.mjs → chunk-TFG4LZ5T.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-KFHCRS5K.mjs → chunk-UIVXVMS5.mjs} +2 -2
  42. package/dist-lib/esm-chunks/{chunk-BSAAJR25.mjs → chunk-UYJXLDCG.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-FMWEI6OI.mjs → chunk-VD27WNCT.mjs} +4 -4
  44. package/dist-lib/esm-chunks/{chunk-3VNUC4DT.mjs → chunk-VF5WVB3D.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-WQ73RKJY.mjs → chunk-VRVXRZI4.mjs} +5 -5
  46. package/dist-lib/esm-chunks/{chunk-L3OSVIGA.mjs → chunk-VYZ5DC3M.mjs} +1359 -487
  47. package/dist-lib/esm-chunks/{chunk-I22LAVD5.mjs → chunk-YR6DNV76.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-PUBH3EXI.mjs → chunk-ZL5N6ENT.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{metro-layout-parser-T5QIJTEV.mjs → metro-layout-parser-ANKZARNW.mjs} +3 -3
  50. package/dist-lib/esm-chunks/{swift-package-prebuilt-AWTZHPDM.mjs → swift-package-prebuilt-4N5CXBOZ.mjs} +10 -10
  51. package/dist-lib/esm-chunks/{swift-sdk-app-module-MGTJTVKU.mjs → swift-sdk-app-module-5IUSRXYA.mjs} +151 -67
  52. package/dist-lib/esm-chunks/{swift-sdk-image-JABGF3ZR.mjs → swift-sdk-image-7T2LMQS5.mjs} +14 -14
  53. package/dist-lib/esm-chunks/{swift-sdk-image-producer-RJRJ3EFU.mjs → swift-sdk-image-producer-7QJ3BF6E.mjs} +4 -4
  54. package/dist-lib/expo-swift-bundle.cjs +1489 -533
  55. package/dist-lib/expo-swift-metadata.cjs +1 -1
  56. package/dist-lib/expo-swift-metadata.mjs +7 -7
  57. package/dist-lib/home-paths.cjs +1 -1
  58. package/dist-lib/host/bridge-host.cjs +1518 -557
  59. package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
  60. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  61. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  62. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  63. package/dist-lib/host/websocket-proxy.cjs +1 -1
  64. package/dist-lib/index.cjs +1 -1
  65. package/dist-lib/kotlin-host.cjs +1 -1
  66. package/dist-lib/menu.cjs +1 -1
  67. package/dist-lib/menu.mjs +3 -3
  68. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  69. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  70. package/dist-lib/metro-production-bundle.cjs +1 -1
  71. package/dist-lib/metro-production-bundle.mjs +4 -4
  72. package/dist-lib/native-app-identity-project.cjs +2 -2
  73. package/dist-lib/native-app-identity-project.mjs +16 -16
  74. package/dist-lib/native-app-identity.cjs +1 -1
  75. package/dist-lib/native-app-identity.mjs +6 -6
  76. package/dist-lib/native-firebase-metadata.cjs +1 -1
  77. package/dist-lib/native-firebase-metadata.mjs +3 -3
  78. package/dist-lib/pdfium-raster.cjs +1 -1
  79. package/dist-lib/pdfium-raster.mjs +2 -2
  80. package/dist-lib/plist.cjs +1 -1
  81. package/dist-lib/plist.mjs +3 -3
  82. package/dist-lib/profiles.cjs +1 -1
  83. package/dist-lib/public-brand.cjs +1 -1
  84. package/dist-lib/public-origins-lib-esm.json +81 -81
  85. package/dist-lib/public-origins-lib.json +69 -69
  86. package/dist-lib/react-native-host-modules.cjs +1 -1
  87. package/dist-lib/react-native-host-modules.mjs +2 -2
  88. package/dist-lib/reap-browser.cjs +1 -1
  89. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  90. package/dist-lib/sdk.cjs +1 -1
  91. package/dist-lib/sdk.mjs +8 -8
  92. package/dist-lib/skills.cjs +1520 -559
  93. package/dist-lib/swift-compile.cjs +1486 -530
  94. package/dist-lib/swift-compile.mjs +10 -10
  95. package/dist-lib/swift-package.cjs +1 -1
  96. package/dist-lib/swift-package.mjs +3 -3
  97. package/dist-lib/swift-submit.cjs +1 -1
  98. package/dist-lib/swift-submit.mjs +6 -6
  99. package/dist-lib/swift-svg-raster.cjs +1 -1
  100. package/dist-lib/swift-svg-raster.mjs +2 -2
  101. package/dist-lib/swift-toolchain.cjs +1 -1
  102. package/dist-lib/swift.cjs +1 -1
  103. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  104. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  105. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  106. package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
  107. package/dist-lib/vendor/acorn.cjs +1 -1
  108. package/dist-lib/vendor/bplist-parser.cjs +1 -1
  109. package/dist-lib/vendor/ignore.cjs +1 -1
  110. package/dist-lib/vendor/magic-string.cjs +1 -1
  111. package/dist-lib/vendor/plist.cjs +1 -1
  112. package/dist-lib/vendor/smol-toml.cjs +1 -1
  113. package/dist-lib/vendor/stream-json.cjs +1 -1
  114. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  115. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  116. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  117. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  118. package/dist-lib/vendor/sucrase.cjs +1 -1
  119. package/dist-lib/vendor/terser.cjs +1 -1
  120. package/dist-lib/vendor/valibot.cjs +1 -1
  121. package/dist-lib/vendor/ws.cjs +1 -1
  122. package/dist-lib/vendor/zod.cjs +1 -1
  123. package/dist-lib/worklet-executable.cjs +1 -1
  124. package/dist-lib/worklet-executable.mjs +3 -3
  125. package/kotlin/sdk.tar.gz +0 -0
  126. package/package.json +1 -1
  127. package/src/swift-guest-compile.ts +43 -10
  128. package/src/swift-guest-dyld-table.ts +9 -2
  129. package/src/swift-guest-image-ledger.ts +403 -208
  130. package/src/swift-guest-link.ts +258 -113
  131. package/src/swift-guest-linked-spans.ts +217 -28
  132. package/src/swift-guest-manifest.ts +24 -13
  133. package/src/swift-guest-projection-storage.ts +6 -8
  134. package/src/swift-guest-projection.ts +7 -6
  135. package/src/swift-guest-source-inputs.ts +158 -30
  136. package/src/swift-sdk-app-module.ts +146 -59
  137. package/src/swift-sdk-image-map.ts +137 -35
  138. package/src/swift-wasm-prune.ts +263 -85
  139. package/src/swiftGuestImageContract.ts +1 -1
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2589 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2591 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/swift-package.ts
4
4
  function swiftManifestSettings(target) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2589 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2591 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/bridge-contract.ts
4
4
  var REFUSED_PERFORM_STEP_TYPES = [
@@ -1,5 +1,5 @@
1
- /*! peach v0.1.2589 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
- import "./chunk-33SCXU3Y.mjs";
1
+ /*! peach v0.1.2591 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+ import "./chunk-4QHHRGO4.mjs";
3
3
 
4
4
  // src/metro-layout-parser.ts
5
5
  var whitespace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/y;
@@ -8,7 +8,7 @@ var lineBreak = /[\r\n\u2028\u2029]/;
8
8
  var metroLayoutParser;
9
9
  async function loadMetroLayoutParser() {
10
10
  if (metroLayoutParser) return metroLayoutParser;
11
- const { Parser } = await import("./acorn-6FUOY6FX.mjs");
11
+ const { Parser } = await import("./acorn-EMX4WZ72.mjs");
12
12
  metroLayoutParser = Parser.extend(
13
13
  (Base) => {
14
14
  const parseFunctionBody = Reflect.get(Base.prototype, "parseFunctionBody");
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2589 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2591 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  compileTargets,
4
4
  fetchNativeEntry,
@@ -6,19 +6,19 @@ import {
6
6
  swiftAvailableModules,
7
7
  swiftDistributionAt,
8
8
  swiftImportNames
9
- } from "./chunk-L3OSVIGA.mjs";
10
- import "./chunk-5EFD2VBY.mjs";
9
+ } from "./chunk-VYZ5DC3M.mjs";
10
+ import "./chunk-ILWFGZWW.mjs";
11
11
  import {
12
12
  SWIFT_REMOTE_PACKAGES_DIR
13
- } from "./chunk-5QWQDXXD.mjs";
13
+ } from "./chunk-SOAYP72T.mjs";
14
14
  import {
15
15
  manifestCalls
16
- } from "./chunk-I22LAVD5.mjs";
17
- import "./chunk-464CBA5U.mjs";
18
- import "./chunk-JLOJZF2Y.mjs";
19
- import "./chunk-XTKKROVU.mjs";
20
- import "./chunk-MKSOJCRT.mjs";
21
- import "./chunk-33SCXU3Y.mjs";
16
+ } from "./chunk-YR6DNV76.mjs";
17
+ import "./chunk-MC6NMYWY.mjs";
18
+ import "./chunk-JHXDM3YU.mjs";
19
+ import "./chunk-TFG4LZ5T.mjs";
20
+ import "./chunk-EGKH2L6J.mjs";
21
+ import "./chunk-4QHHRGO4.mjs";
22
22
 
23
23
  // src/swift-package-prebuilt.ts
24
24
  import { createHash } from "node:crypto";
@@ -1,14 +1,14 @@
1
- /*! peach v0.1.2589 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2591 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  SWIFT_SDK_APP_MEMORY_BASE,
4
4
  SWIFT_SDK_APP_TABLE_BASE,
5
5
  SWIFT_SDK_MEMORY_BASE,
6
6
  SWIFT_SDK_PIECE_FIELDS,
7
7
  readSwiftSdkManifest
8
- } from "./chunk-WQ73RKJY.mjs";
9
- import "./chunk-57FFWABF.mjs";
10
- import "./chunk-Y4PV4HZB.mjs";
11
- import "./chunk-3VNUC4DT.mjs";
8
+ } from "./chunk-VRVXRZI4.mjs";
9
+ import "./chunk-J676B57D.mjs";
10
+ import "./chunk-7627LKJK.mjs";
11
+ import "./chunk-VF5WVB3D.mjs";
12
12
  import {
13
13
  ADDEND_RELOCATIONS,
14
14
  KEEP_WASM_NAMES,
@@ -36,17 +36,17 @@ import {
36
36
  wasmReader,
37
37
  wasmSections,
38
38
  writeWasmCustomSection
39
- } from "./chunk-L3OSVIGA.mjs";
39
+ } from "./chunk-VYZ5DC3M.mjs";
40
40
  import {
41
41
  SWIFT_WASM_TRIPLE
42
- } from "./chunk-5EFD2VBY.mjs";
43
- import "./chunk-5QWQDXXD.mjs";
44
- import "./chunk-I22LAVD5.mjs";
45
- import "./chunk-464CBA5U.mjs";
46
- import "./chunk-JLOJZF2Y.mjs";
47
- import "./chunk-XTKKROVU.mjs";
48
- import "./chunk-MKSOJCRT.mjs";
49
- import "./chunk-33SCXU3Y.mjs";
42
+ } from "./chunk-ILWFGZWW.mjs";
43
+ import "./chunk-SOAYP72T.mjs";
44
+ import "./chunk-YR6DNV76.mjs";
45
+ import "./chunk-MC6NMYWY.mjs";
46
+ import "./chunk-JHXDM3YU.mjs";
47
+ import "./chunk-TFG4LZ5T.mjs";
48
+ import "./chunk-EGKH2L6J.mjs";
49
+ import "./chunk-4QHHRGO4.mjs";
50
50
 
51
51
  // src/swift-sdk-app-module.ts
52
52
  import { execFile } from "node:child_process";
@@ -211,15 +211,18 @@ async function compileSdkForwarders(inputs, sdk, toolchainBin, output, project,
211
211
  index++;
212
212
  }
213
213
  const errno = tls.errno;
214
+ let declaredErrno = false;
214
215
  for (const name of referenced) {
215
216
  const offset = tls[name];
216
217
  if (offset === void 0 || defined.has(name)) continue;
217
218
  if (errno === void 0 || signatures.__errno_location !== ":j")
218
219
  throw new Error("the sdk image has no errno to find its thread block by");
219
- if (!lines.some((line) => line.startsWith("char *__peach_errno(")))
220
+ if (!declaredErrno) {
221
+ declaredErrno = true;
220
222
  lines.push(
221
223
  `__attribute__((import_module("env"), import_name("__errno_location"))) char *__peach_errno(void);`
222
224
  );
225
+ }
223
226
  lines.push(
224
227
  `__attribute__((weak)) _Thread_local char t${index} __asm__(${literal(name)});`,
225
228
  `__attribute__((used)) long long h${index}(void) __asm__(${literal(SDK_TLS_HELPER + name)});`,
@@ -638,6 +641,20 @@ function resolveSdkReferences(source, sdk, forwarders) {
638
641
  symbols.filter((symbol) => symbol.kind === 0 && symbol.name.startsWith(SDK_TLS_HELPER)).map((symbol) => [symbol.name.slice(SDK_TLS_HELPER.length), symbol.index])
639
642
  );
640
643
  const segments = guestWasmDataSegments(bytes, false);
644
+ const segmentsByOffset = [...segments].sort((a, b) => a.offset - b.offset);
645
+ const segmentNameSet = new Set(segmentNames);
646
+ const findSegmentByOffset = (at, size) => {
647
+ let lo = 0;
648
+ let hi = segmentsByOffset.length - 1;
649
+ while (lo <= hi) {
650
+ const mid = lo + hi >> 1;
651
+ const entry = segmentsByOffset[mid];
652
+ if (at < entry.offset) hi = mid - 1;
653
+ else if (at >= entry.offset + entry.length) lo = mid + 1;
654
+ else return at + size <= entry.offset + entry.length ? entry : void 0;
655
+ }
656
+ return void 0;
657
+ };
641
658
  const tdata = segmentNames.indexOf(".tdata");
642
659
  const tlsTemplate = tdata < 0 ? void 0 : passiveSegments(bytes)[tdata];
643
660
  const tlsStart = tlsTemplate && tlsTemplate.byteOffset - bytes.byteOffset;
@@ -702,7 +719,7 @@ function resolveSdkReferences(source, sdk, forwarders) {
702
719
  const encoding = width.width;
703
720
  if (kind === "address" && target.id === 11 && encoding === "u64" && addend === 0n) {
704
721
  const section = OBJC_SECTION_BOUNDARY.exec(name)?.[1];
705
- if (section && !segmentNames.includes(section)) {
722
+ if (section && !segmentNameSet.has(section)) {
706
723
  bytes.fill(0, at, at + 8);
707
724
  continue;
708
725
  }
@@ -714,9 +731,7 @@ function resolveSdkReferences(source, sdk, forwarders) {
714
731
  if (tlsStart !== void 0 && at >= tlsStart && at < tlsStart + tlsTemplate.length)
715
732
  linkage.tls.push(at - tlsStart, size, value);
716
733
  else {
717
- const segment = segments.find(
718
- (entry) => at >= entry.offset && at + size <= entry.offset + entry.length
719
- );
734
+ const segment = findSegmentByOffset(at, size);
720
735
  if (!segment)
721
736
  throw new Error(`Swift SDK relocation has no load address for ${name}`);
722
737
  linkage.data.push(segment.address + at - segment.offset, size, value);
@@ -760,15 +775,29 @@ function resolveSdkReferences(source, sdk, forwarders) {
760
775
  }
761
776
  }
762
777
  }
763
- const entries = imports.map((entry) => {
778
+ const encodedNameBuf = (name) => {
779
+ const raw = Buffer.from(name, "utf8");
780
+ const len = uleb(raw.length);
781
+ const out = Buffer.allocUnsafe(len.length + raw.length);
782
+ for (let i = 0; i < len.length; i++) out[i] = len[i];
783
+ raw.copy(out, len.length);
784
+ return out;
785
+ };
786
+ const importParts = [];
787
+ let importEntryCount = imports.length + 1;
788
+ for (const entry of imports) {
764
789
  const slot = entry.kind === 0 && entry.module === "env" ? functionSlots.get(entry.name) : void 0;
765
- return [
766
- ...encodedName(slot === void 0 ? entry.module : NATIVE_SDK_IMPORT_MODULE),
767
- ...encodedName(slot === void 0 ? entry.name : String(slot)),
768
- ...bytes.subarray(entry.start, entry.end)
769
- ];
770
- });
771
- entries.push([...encodedName("env"), ...encodedName("__stack_pointer"), 3, 126, 1]);
790
+ importParts.push(
791
+ encodedNameBuf(slot === void 0 ? entry.module : NATIVE_SDK_IMPORT_MODULE),
792
+ encodedNameBuf(slot === void 0 ? entry.name : String(slot)),
793
+ bytes.subarray(entry.start, entry.end)
794
+ );
795
+ }
796
+ importParts.push(
797
+ encodedNameBuf("env"),
798
+ encodedNameBuf("__stack_pointer"),
799
+ Buffer.from([3, 126, 1])
800
+ );
772
801
  const tags = sections.find((section) => section.id === 13);
773
802
  if (tags) {
774
803
  const r = wasmReader(bytes, tags.start);
@@ -783,15 +812,18 @@ function resolveSdkReferences(source, sdk, forwarders) {
783
812
  throw new Error(
784
813
  `Swift app defines an exception tag the sdk does not own: ${name}`
785
814
  );
786
- entries.push([
787
- ...encodedName("env"),
788
- ...encodedName(name),
789
- 4,
790
- ...bytes.subarray(start, r.at)
791
- ]);
815
+ importParts.push(
816
+ encodedNameBuf("env"),
817
+ encodedNameBuf(name),
818
+ Buffer.from([4]),
819
+ bytes.subarray(start, r.at)
820
+ );
821
+ importEntryCount++;
792
822
  }
793
823
  }
794
- const globals = [];
824
+ const globalParts = [
825
+ Buffer.from(uleb(globalCount - 1 + syntheticGlobals.length))
826
+ ];
795
827
  for (let index = 0; index < globalCount; index++) {
796
828
  const start = gr.at;
797
829
  const type = gr.byte();
@@ -803,12 +835,12 @@ function resolveSdkReferences(source, sdk, forwarders) {
803
835
  if (gr.byte() !== 11) throw new Error("app global initializer has no end");
804
836
  if (index === 0) continue;
805
837
  const value = got.get(index);
806
- if (value === void 0) globals.push(...bytes.subarray(start, gr.at));
807
- else globals.push(type, 1, type === 126 ? 66 : 65, 0, 11);
838
+ if (value === void 0) globalParts.push(bytes.subarray(start, gr.at));
839
+ else globalParts.push(Buffer.from([type, 1, type === 126 ? 66 : 65, 0, 11]));
808
840
  }
809
841
  for (const type of syntheticGlobals) {
810
842
  const zero = type === 125 ? [67, 0, 0, 0, 0] : type === 124 ? [68, 0, 0, 0, 0, 0, 0, 0, 0] : [type === 126 ? 66 : 65, 0];
811
- globals.push(type, 1, ...zero, 11);
843
+ globalParts.push(Buffer.from([type, 1, ...zero, 11]));
812
844
  }
813
845
  const exportSection = sections.find((s) => s.id === 7);
814
846
  if (!exportSection) throw new Error("app link has no exports");
@@ -831,24 +863,21 @@ function resolveSdkReferences(source, sdk, forwarders) {
831
863
  throw new Error("Swift app exceeds its reserved static memory range");
832
864
  }
833
865
  }
866
+ const exportParts = [
867
+ Buffer.from(uleb(exportCount + 1 + got.size)),
868
+ bytes.subarray(originalExportsStart, exportSection.end)
869
+ ];
870
+ for (const [index, value] of got) {
871
+ exportParts.push(
872
+ encodedNameBuf(`${NATIVE_SDK_GLOBAL_PREFIX}${value}.${index}`),
873
+ Buffer.from([3, ...uleb(index)])
874
+ );
875
+ }
876
+ exportParts.push(encodedNameBuf("__indirect_function_table"), Buffer.from([1, 0]));
834
877
  const replaced = /* @__PURE__ */ new Map([
835
- [2, [...uleb(entries.length), ...entries.flat()]],
836
- [6, [...uleb(globalCount - 1 + syntheticGlobals.length), ...globals]],
837
- [
838
- 7,
839
- [
840
- ...uleb(exportCount + 1 + got.size),
841
- ...bytes.subarray(originalExportsStart, exportSection.end),
842
- ...[...got].flatMap(([index, value]) => [
843
- ...encodedName(`${NATIVE_SDK_GLOBAL_PREFIX}${value}.${index}`),
844
- 3,
845
- ...uleb(index)
846
- ]),
847
- ...encodedName("__indirect_function_table"),
848
- 1,
849
- 0
850
- ]
851
- ]
878
+ [2, Buffer.concat([Buffer.from(uleb(importEntryCount)), ...importParts])],
879
+ [6, Buffer.concat(globalParts)],
880
+ [7, Buffer.concat(exportParts)]
852
881
  ]);
853
882
  const rebuiltCode = expanded.length ? expandSdkRelocations(
854
883
  bytes,
@@ -860,9 +889,13 @@ function resolveSdkReferences(source, sdk, forwarders) {
860
889
  if (s === tags || s.name === "linking" || s.name?.startsWith("reloc.") || s.name === ".swift1_autolink_entries")
861
890
  continue;
862
891
  const payload = replaced.get(s.id);
863
- parts.push(
864
- s.id === 10 && rebuiltCode ? rebuiltCode : payload ? Uint8Array.from([s.id, ...uleb(payload.length), ...payload]) : bytes.subarray(s.offset, s.end)
865
- );
892
+ if (s.id === 10 && rebuiltCode) {
893
+ parts.push(rebuiltCode);
894
+ } else if (payload) {
895
+ parts.push(Buffer.from([s.id, ...uleb(payload.length)]), payload);
896
+ } else {
897
+ parts.push(bytes.subarray(s.offset, s.end));
898
+ }
866
899
  }
867
900
  return { bytes: Buffer.concat(parts), linkage };
868
901
  }
@@ -970,6 +1003,49 @@ function readSwiftSdkUsage(mapFile, linkedFile, sdkObjects) {
970
1003
  constructors: [...new Set(constructorKeys(map, readFileSync(linkedFile)))]
971
1004
  };
972
1005
  }
1006
+ function swiftSdkProjectionSpans(sdk, imageFor) {
1007
+ const { manifest, block } = readSwiftSdkManifest(sdk);
1008
+ const guestObjects = manifest.guestObjects;
1009
+ if (!guestObjects) return [];
1010
+ const { strings } = manifest;
1011
+ const fields = block("pieces");
1012
+ const ordered = [];
1013
+ for (let i = 0; i < fields.length; i += SWIFT_SDK_PIECE_FIELDS) {
1014
+ const size = fields[i + 1];
1015
+ if (!size) continue;
1016
+ ordered.push({
1017
+ address: fields[i],
1018
+ size,
1019
+ object: strings[fields[i + 3]]
1020
+ });
1021
+ }
1022
+ ordered.sort((a, b) => a.address - b.address);
1023
+ const imageOf = (object) => {
1024
+ const product = guestObjects[object]?.product;
1025
+ return product === void 0 ? void 0 : imageFor(object, product);
1026
+ };
1027
+ const spans = [];
1028
+ for (let index = 0; index < ordered.length; index++) {
1029
+ const { object, address, size } = ordered[index];
1030
+ const image = imageOf(object);
1031
+ if (image === void 0) continue;
1032
+ let next = index + 1;
1033
+ while (next < ordered.length && ordered[next].address < address + size) next++;
1034
+ const end = ordered[next]?.address ?? address + size;
1035
+ spans.push({ image, space: "linear-memory", address, length: end - address });
1036
+ }
1037
+ const functionKeys = block("functions");
1038
+ const slots = block("functionSlots");
1039
+ for (let index = 0; index < functionKeys.length; index++) {
1040
+ const slot = slots[index];
1041
+ if (!slot) continue;
1042
+ const key = strings[functionKeys[index]];
1043
+ const image = imageOf(key.slice(0, key.indexOf(":")));
1044
+ if (image !== void 0)
1045
+ spans.push({ image, space: "function-table", address: slot, length: 1 });
1046
+ }
1047
+ return spans;
1048
+ }
973
1049
  function selectSwiftSdkData(sdk, usage, linkage, projection) {
974
1050
  const { manifest, block, segments } = readSwiftSdkManifest(sdk);
975
1051
  const { strings } = manifest;
@@ -992,15 +1068,24 @@ function selectSwiftSdkData(sdk, usage, linkage, projection) {
992
1068
  });
993
1069
  }
994
1070
  const memory = new Map(segments.map((segment) => [segment.name, segment]));
995
- const read = (address2, size) => {
1071
+ let lastSegment = segments[0];
1072
+ const segmentAt = (address2, size) => {
1073
+ if (lastSegment && address2 >= lastSegment.address && address2 + size <= lastSegment.address + lastSegment.data.length)
1074
+ return lastSegment;
996
1075
  for (const segment of segments)
997
- if (address2 >= segment.address && address2 + size <= segment.address + segment.data.length)
998
- return segment.data.subarray(
999
- address2 - segment.address,
1000
- address2 - segment.address + size
1001
- );
1076
+ if (address2 >= segment.address && address2 + size <= segment.address + segment.data.length) {
1077
+ lastSegment = segment;
1078
+ return segment;
1079
+ }
1002
1080
  return void 0;
1003
1081
  };
1082
+ const read = (address2, size) => {
1083
+ const segment = segmentAt(address2, size);
1084
+ return segment?.data.subarray(
1085
+ address2 - segment.address,
1086
+ address2 - segment.address + size
1087
+ );
1088
+ };
1004
1089
  const appSectionsByObject = /* @__PURE__ */ new Map();
1005
1090
  const appSections = /* @__PURE__ */ new Set();
1006
1091
  const appSymbols = /* @__PURE__ */ new Set();
@@ -1106,9 +1191,7 @@ function selectSwiftSdkData(sdk, usage, linkage, projection) {
1106
1191
  const classAddress = Number(
1107
1192
  new DataView(field.buffer, field.byteOffset, 8).getBigUint64(0, true)
1108
1193
  );
1109
- const segment = segments.find(
1110
- ({ address: address3, data }) => classAddress >= address3 && classAddress < address3 + data.length
1111
- );
1194
+ const segment = segmentAt(classAddress, 1);
1112
1195
  if (!segment) continue;
1113
1196
  const start = classAddress - segment.address;
1114
1197
  const end = segment.data.indexOf(0, start);
@@ -1316,7 +1399,7 @@ function selectSwiftSdkData(sdk, usage, linkage, projection) {
1316
1399
  if (current)
1317
1400
  runs.push({
1318
1401
  address: current.address,
1319
- bytes: Uint8Array.from(Buffer.concat(current.parts))
1402
+ bytes: Buffer.concat(current.parts)
1320
1403
  });
1321
1404
  };
1322
1405
  for (const piece of loaded) {
@@ -1457,5 +1540,6 @@ export {
1457
1540
  readSwiftSdkUsage,
1458
1541
  selectSwiftSdkData,
1459
1542
  swiftAppModuleInputs,
1543
+ swiftSdkProjectionSpans,
1460
1544
  writeSwiftSdkAppLink
1461
1545
  };
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2589 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2591 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  SWIFT_SDK_APP_MEMORY_BASE,
4
4
  SWIFT_SDK_APP_TABLE_BASE,
@@ -15,19 +15,19 @@ import {
15
15
  swiftSdkImageFile,
16
16
  swiftSdkImageKey,
17
17
  swiftSdkImageProducts
18
- } from "./chunk-WQ73RKJY.mjs";
19
- import "./chunk-57FFWABF.mjs";
20
- import "./chunk-Y4PV4HZB.mjs";
21
- import "./chunk-3VNUC4DT.mjs";
22
- import "./chunk-L3OSVIGA.mjs";
23
- import "./chunk-5EFD2VBY.mjs";
24
- import "./chunk-5QWQDXXD.mjs";
25
- import "./chunk-I22LAVD5.mjs";
26
- import "./chunk-464CBA5U.mjs";
27
- import "./chunk-JLOJZF2Y.mjs";
28
- import "./chunk-XTKKROVU.mjs";
29
- import "./chunk-MKSOJCRT.mjs";
30
- import "./chunk-33SCXU3Y.mjs";
18
+ } from "./chunk-VRVXRZI4.mjs";
19
+ import "./chunk-J676B57D.mjs";
20
+ import "./chunk-7627LKJK.mjs";
21
+ import "./chunk-VF5WVB3D.mjs";
22
+ import "./chunk-VYZ5DC3M.mjs";
23
+ import "./chunk-ILWFGZWW.mjs";
24
+ import "./chunk-SOAYP72T.mjs";
25
+ import "./chunk-YR6DNV76.mjs";
26
+ import "./chunk-MC6NMYWY.mjs";
27
+ import "./chunk-JHXDM3YU.mjs";
28
+ import "./chunk-TFG4LZ5T.mjs";
29
+ import "./chunk-EGKH2L6J.mjs";
30
+ import "./chunk-4QHHRGO4.mjs";
31
31
  export {
32
32
  SWIFT_SDK_APP_MEMORY_BASE,
33
33
  SWIFT_SDK_APP_TABLE_BASE,
@@ -1,13 +1,13 @@
1
- /*! peach v0.1.2589 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2591 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  swiftCacheDir,
4
4
  windowAdmission,
5
5
  withSwiftRootLock
6
- } from "./chunk-5EFD2VBY.mjs";
6
+ } from "./chunk-ILWFGZWW.mjs";
7
7
  import {
8
8
  isRecord
9
- } from "./chunk-MKSOJCRT.mjs";
10
- import "./chunk-33SCXU3Y.mjs";
9
+ } from "./chunk-EGKH2L6J.mjs";
10
+ import "./chunk-4QHHRGO4.mjs";
11
11
 
12
12
  // src/swift-sdk-image-producer.ts
13
13
  import { execFile, execFileSync } from "node:child_process";