peachsim 0.1.2590 → 0.1.2592

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 (144) 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 +4184 -3613
  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 +2 -2
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/esm-chunks/{acorn-65FNEARV.mjs → acorn-67PU73QE.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-X2EKFONU.mjs → chunk-5FTHILIE.mjs} +1 -1
  28. package/dist-lib/esm-chunks/{chunk-ADKUIQXX.mjs → chunk-6DB5FR7S.mjs} +1 -1
  29. package/dist-lib/esm-chunks/{chunk-WPDY5IAD.mjs → chunk-CF3MTPMY.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-RGC2JNCL.mjs → chunk-D4LYKRRB.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-EFKDUMB5.mjs → chunk-DFF5XZ5M.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-2GUB5OLB.mjs → chunk-EHRSWFTD.mjs} +3 -3
  33. package/dist-lib/esm-chunks/{chunk-NZY4GOG5.mjs → chunk-EITX573K.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-SLPXTLBK.mjs → chunk-EWHA6X3Z.mjs} +5 -5
  35. package/dist-lib/esm-chunks/{chunk-BZS5SIYK.mjs → chunk-FYXXFYML.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-JG4AANWA.mjs → chunk-GQ3EO2UV.mjs} +107 -6
  37. package/dist-lib/esm-chunks/{chunk-N2II5SRJ.mjs → chunk-GY6TE4B4.mjs} +4 -4
  38. package/dist-lib/esm-chunks/{chunk-HZTK7TP5.mjs → chunk-KDI5YYQ6.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-4VCRUQ36.mjs → chunk-L5T3HBPO.mjs} +973 -549
  40. package/dist-lib/esm-chunks/{chunk-SRFKOU76.mjs → chunk-M4QLI2SY.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-OZJ66CXY.mjs → chunk-PITO2NI2.mjs} +2 -2
  42. package/dist-lib/esm-chunks/{chunk-5GNGHM5B.mjs → chunk-QSFWBVUO.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-YPPH6F77.mjs → chunk-R3WTQB5J.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-XE3VHAU2.mjs → chunk-RV4ACE6R.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-GBD26EBV.mjs → chunk-SW4PSSTF.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-V5TTEXYO.mjs → chunk-TJZPNFVF.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-WYDRQRJL.mjs → chunk-XSQH4R5E.mjs} +48 -15
  48. package/dist-lib/esm-chunks/{chunk-462CWTWI.mjs → chunk-XZ3FX3HW.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{metro-layout-parser-CRI3GMCM.mjs → metro-layout-parser-EX65MARK.mjs} +3 -3
  50. package/dist-lib/esm-chunks/{swift-package-prebuilt-5XDZ2HZZ.mjs → swift-package-prebuilt-3BPDQVA7.mjs} +10 -10
  51. package/dist-lib/esm-chunks/{swift-sdk-app-module-6H3G6AXD.mjs → swift-sdk-app-module-CRX6E3TR.mjs} +151 -67
  52. package/dist-lib/esm-chunks/{swift-sdk-image-WAC7GG2R.mjs → swift-sdk-image-EJD5TPQH.mjs} +14 -14
  53. package/dist-lib/esm-chunks/{swift-sdk-image-producer-B3L27QTG.mjs → swift-sdk-image-producer-QAZOSLTZ.mjs} +4 -4
  54. package/dist-lib/expo-swift-bundle.cjs +3555 -2987
  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 +5981 -4986
  59. package/dist-lib/host/fetch-proxy-handler.cjs +310 -298
  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 +238 -223
  73. package/dist-lib/native-app-identity-project.mjs +17 -17
  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 +73 -71
  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 +6603 -5608
  93. package/dist-lib/swift-compile.cjs +1363 -778
  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 +12 -6
  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/dist-types/packages/peach-engine/src/engine/native-node-queries.d.ts +1 -0
  126. package/kotlin/sdk.tar.gz +0 -0
  127. package/package.json +1 -1
  128. package/runtime-companion.json +1 -1
  129. package/src/native-bundles.ts +2 -0
  130. package/src/one-native-controls-package.ts +141 -31
  131. package/src/one-sdk/source.ts +2 -1
  132. package/src/oneSdkContract.ts +13 -2
  133. package/src/swift-compile.ts +301 -48
  134. package/src/swift-guest-compile.ts +41 -8
  135. package/src/swift-guest-link.ts +3 -0
  136. package/src/swift-guest-source-inputs.ts +158 -30
  137. package/src/swift-host.ts +88 -16
  138. package/src/swift-reproducible.ts +16 -2
  139. package/src/swift-root-lock.ts +77 -5
  140. package/src/swift-sdk-app-module.ts +146 -59
  141. package/src/swift-sdk-image.ts +53 -10
  142. package/src/swift-startup-split.ts +65 -27
  143. package/src/swift-toolchain.ts +16 -5
  144. package/src/wasm-lazy-split.ts +46 -40
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/launchMetadataContract.ts
4
4
  var LAUNCH_METADATA_QUERY_PARAM = "launchMetadata";
@@ -1,8 +1,8 @@
1
- /*! peach v0.1.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  __commonJS,
4
4
  __toESM
5
- } from "./chunk-NZY4GOG5.mjs";
5
+ } from "./chunk-EITX573K.mjs";
6
6
 
7
7
  // ../../node_modules/@xmldom/xmldom/lib/conventions.js
8
8
  var require_conventions = __commonJS({
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/swiftContract.ts
4
4
  function isSwiftSourceLinkGraph(value) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // ../contrast-runtime-delivery/src/version.ts
4
4
  function isValidRuntimeVersion(value) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/bridge-contract.ts
4
4
  var REFUSED_PERFORM_STEP_TYPES = [
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (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.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // ../peach-globals/src/swiftDiscoveryContract.ts
4
4
  var SWIFT_PACKAGE_PATH = "/__peach/swift-package/";
@@ -1,7 +1,7 @@
1
- /*! peach v0.1.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  swiftModuleToolchain
4
- } from "./chunk-SLPXTLBK.mjs";
4
+ } from "./chunk-EWHA6X3Z.mjs";
5
5
  import {
6
6
  DARWIN_RECORDS_PREFIX,
7
7
  KEEP_WASM_NAMES,
@@ -31,13 +31,13 @@ import {
31
31
  swiftSdkPaths,
32
32
  unslottedFunctions,
33
33
  wasmSections
34
- } from "./chunk-4VCRUQ36.mjs";
34
+ } from "./chunk-L5T3HBPO.mjs";
35
35
  import {
36
36
  SWIFT_WASM_TRIPLE,
37
37
  sourceSwiftCheckout,
38
38
  swiftCacheDir,
39
39
  withSwiftRootLock
40
- } from "./chunk-JG4AANWA.mjs";
40
+ } from "./chunk-GQ3EO2UV.mjs";
41
41
 
42
42
  // src/swift-sdk-image.ts
43
43
  import { execFile } from "node:child_process";
@@ -49,6 +49,7 @@ import {
49
49
  readFileSync,
50
50
  renameSync,
51
51
  rmSync,
52
+ statSync,
52
53
  writeFileSync
53
54
  } from "node:fs";
54
55
  import path from "node:path";
@@ -171,18 +172,40 @@ function swiftSdkImageEntry(key, scopedLookups) {
171
172
  key: nativeEntryKey(inputs)
172
173
  };
173
174
  }
175
+ var MAX_CACHED_SDK_IMAGES = 4;
176
+ var cachedSdkInterfaces = /* @__PURE__ */ new Map();
177
+ var cachedSdkManifestIndices = /* @__PURE__ */ new Map();
178
+ var cachedSdkManifests = /* @__PURE__ */ new Map();
179
+ function setBoundedCache(cache, key, value) {
180
+ cache.delete(key);
181
+ cache.set(key, value);
182
+ while (cache.size > MAX_CACHED_SDK_IMAGES) {
183
+ const oldest = cache.keys().next().value;
184
+ if (oldest !== void 0) cache.delete(oldest);
185
+ }
186
+ return value;
187
+ }
174
188
  function cached(directory, key) {
175
- const sdkInterface = path.join(directory, INTERFACE_FILE);
189
+ const sdkInterfacePath = path.join(directory, INTERFACE_FILE);
176
190
  const image = path.join(directory, IMAGE_FILE);
177
191
  const address = path.join(directory, IMAGE_DIGEST);
178
- if (!existsSync(image) || !existsSync(address) || !existsSync(sdkInterface) || !existsSync(path.join(directory, MANIFEST_FILE)) || !existsSync(path.join(directory, MANIFEST_DATA_FILE)))
192
+ if (!existsSync(image) || !existsSync(address) || !existsSync(sdkInterfacePath) || !existsSync(path.join(directory, MANIFEST_FILE)) || !existsSync(path.join(directory, MANIFEST_DATA_FILE)))
179
193
  return void 0;
194
+ const sha256 = readFileSync(address, "utf8");
195
+ const cacheKey = `${directory}\0${sha256}`;
196
+ let loadedInterface;
180
197
  return {
181
198
  key,
182
199
  directory,
183
200
  image,
184
- sha256: readFileSync(address, "utf8"),
185
- sdkInterface: JSON.parse(readFileSync(sdkInterface, "utf8"))
201
+ sha256,
202
+ get sdkInterface() {
203
+ if (loadedInterface) return loadedInterface;
204
+ const memo = cachedSdkInterfaces.get(cacheKey);
205
+ if (memo) return loadedInterface = memo;
206
+ const parsed = JSON.parse(readFileSync(sdkInterfacePath, "utf8"));
207
+ return loadedInterface = setBoundedCache(cachedSdkInterfaces, cacheKey, parsed);
208
+ }
186
209
  };
187
210
  }
188
211
  async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkImports = [], options) {
@@ -192,7 +215,7 @@ async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkIm
192
215
  const existing = cached(directory, key);
193
216
  if (existing) return existing;
194
217
  if (!options?.producer && !swiftDistributionAt(moduleRoot) && path.resolve(moduleRoot) === sourceSwiftCheckout() && process.platform === "linux" && process.env.TM_SESSION) {
195
- const { produceSwiftSdkImage } = await import("./swift-sdk-image-producer-B3L27QTG.mjs");
218
+ const { produceSwiftSdkImage } = await import("./swift-sdk-image-producer-QAZOSLTZ.mjs");
196
219
  await produceSwiftSdkImage({
197
220
  moduleRoot,
198
221
  key,
@@ -711,16 +734,26 @@ function writeSdkManifest(work, map, linked, finished, withRelocs, functionSlots
711
734
  writeFileSync(path.join(work, MANIFEST_FILE), JSON.stringify(manifest));
712
735
  }
713
736
  function readSwiftSdkManifestIndex(image) {
714
- const manifest = JSON.parse(
715
- readFileSync(path.join(image.directory, MANIFEST_FILE), "utf8")
716
- );
737
+ const manifestPath = path.join(image.directory, MANIFEST_FILE);
738
+ const stat = statSync(manifestPath, { bigint: true });
739
+ const cacheKey = `${manifestPath}\0${stat.size}:${stat.mtimeNs}`;
740
+ const memo = cachedSdkManifestIndices.get(cacheKey);
741
+ if (memo) return memo;
742
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
717
743
  if (manifest.version !== SWIFT_SDK_IMAGE_VERSION)
718
744
  throw new Error(`sdk manifest version ${manifest.version}`);
719
- return manifest;
745
+ return setBoundedCache(cachedSdkManifestIndices, cacheKey, manifest);
720
746
  }
721
747
  function readSwiftSdkManifest(image) {
748
+ const manifestPath = path.join(image.directory, MANIFEST_FILE);
749
+ const dataPath = path.join(image.directory, MANIFEST_DATA_FILE);
750
+ const mStat = statSync(manifestPath, { bigint: true });
751
+ const dStat = statSync(dataPath, { bigint: true });
752
+ const cacheKey = `${image.directory}\0${mStat.size}:${mStat.mtimeNs}\0${dStat.size}:${dStat.mtimeNs}`;
753
+ const memo = cachedSdkManifests.get(cacheKey);
754
+ if (memo) return memo;
722
755
  const manifest = readSwiftSdkManifestIndex(image);
723
- const data = readFileSync(path.join(image.directory, MANIFEST_DATA_FILE));
756
+ const data = readFileSync(dataPath);
724
757
  const words = new Uint32Array(data.buffer, data.byteOffset, manifest.segmentBytes / 4);
725
758
  const blocks = /* @__PURE__ */ new Map();
726
759
  let at = 0;
@@ -734,7 +767,7 @@ function readSwiftSdkManifest(image) {
734
767
  ...segment,
735
768
  data: data.subarray(segment.bytes, segment.bytes + segment.length)
736
769
  }));
737
- return { manifest, block, segments };
770
+ return setBoundedCache(cachedSdkManifests, cacheKey, { manifest, block, segments });
738
771
  }
739
772
  var MANIFEST_BLOCKS = [
740
773
  "pieces",
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // ../peach-globals/src/bundle-global-footer.ts
4
4
  function findBundleFooter(source, prefix) {
@@ -1,5 +1,5 @@
1
- /*! peach v0.1.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
- import "./chunk-NZY4GOG5.mjs";
1
+ /*! peach v0.1.2592 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+ import "./chunk-EITX573K.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-65FNEARV.mjs");
11
+ const { Parser } = await import("./acorn-67PU73QE.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.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (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-4VCRUQ36.mjs";
10
- import "./chunk-JG4AANWA.mjs";
9
+ } from "./chunk-L5T3HBPO.mjs";
10
+ import "./chunk-GQ3EO2UV.mjs";
11
11
  import {
12
12
  SWIFT_REMOTE_PACKAGES_DIR
13
- } from "./chunk-5GNGHM5B.mjs";
13
+ } from "./chunk-QSFWBVUO.mjs";
14
14
  import {
15
15
  manifestCalls
16
- } from "./chunk-GBD26EBV.mjs";
17
- import "./chunk-RGC2JNCL.mjs";
18
- import "./chunk-ADKUIQXX.mjs";
19
- import "./chunk-YPPH6F77.mjs";
20
- import "./chunk-WPDY5IAD.mjs";
21
- import "./chunk-NZY4GOG5.mjs";
16
+ } from "./chunk-SW4PSSTF.mjs";
17
+ import "./chunk-D4LYKRRB.mjs";
18
+ import "./chunk-6DB5FR7S.mjs";
19
+ import "./chunk-R3WTQB5J.mjs";
20
+ import "./chunk-CF3MTPMY.mjs";
21
+ import "./chunk-EITX573K.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.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (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-WYDRQRJL.mjs";
9
- import "./chunk-SLPXTLBK.mjs";
10
- import "./chunk-SRFKOU76.mjs";
11
- import "./chunk-V5TTEXYO.mjs";
8
+ } from "./chunk-XSQH4R5E.mjs";
9
+ import "./chunk-EWHA6X3Z.mjs";
10
+ import "./chunk-M4QLI2SY.mjs";
11
+ import "./chunk-TJZPNFVF.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-4VCRUQ36.mjs";
39
+ } from "./chunk-L5T3HBPO.mjs";
40
40
  import {
41
41
  SWIFT_WASM_TRIPLE
42
- } from "./chunk-JG4AANWA.mjs";
43
- import "./chunk-5GNGHM5B.mjs";
44
- import "./chunk-GBD26EBV.mjs";
45
- import "./chunk-RGC2JNCL.mjs";
46
- import "./chunk-ADKUIQXX.mjs";
47
- import "./chunk-YPPH6F77.mjs";
48
- import "./chunk-WPDY5IAD.mjs";
49
- import "./chunk-NZY4GOG5.mjs";
42
+ } from "./chunk-GQ3EO2UV.mjs";
43
+ import "./chunk-QSFWBVUO.mjs";
44
+ import "./chunk-SW4PSSTF.mjs";
45
+ import "./chunk-D4LYKRRB.mjs";
46
+ import "./chunk-6DB5FR7S.mjs";
47
+ import "./chunk-R3WTQB5J.mjs";
48
+ import "./chunk-CF3MTPMY.mjs";
49
+ import "./chunk-EITX573K.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.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (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-WYDRQRJL.mjs";
19
- import "./chunk-SLPXTLBK.mjs";
20
- import "./chunk-SRFKOU76.mjs";
21
- import "./chunk-V5TTEXYO.mjs";
22
- import "./chunk-4VCRUQ36.mjs";
23
- import "./chunk-JG4AANWA.mjs";
24
- import "./chunk-5GNGHM5B.mjs";
25
- import "./chunk-GBD26EBV.mjs";
26
- import "./chunk-RGC2JNCL.mjs";
27
- import "./chunk-ADKUIQXX.mjs";
28
- import "./chunk-YPPH6F77.mjs";
29
- import "./chunk-WPDY5IAD.mjs";
30
- import "./chunk-NZY4GOG5.mjs";
18
+ } from "./chunk-XSQH4R5E.mjs";
19
+ import "./chunk-EWHA6X3Z.mjs";
20
+ import "./chunk-M4QLI2SY.mjs";
21
+ import "./chunk-TJZPNFVF.mjs";
22
+ import "./chunk-L5T3HBPO.mjs";
23
+ import "./chunk-GQ3EO2UV.mjs";
24
+ import "./chunk-QSFWBVUO.mjs";
25
+ import "./chunk-SW4PSSTF.mjs";
26
+ import "./chunk-D4LYKRRB.mjs";
27
+ import "./chunk-6DB5FR7S.mjs";
28
+ import "./chunk-R3WTQB5J.mjs";
29
+ import "./chunk-CF3MTPMY.mjs";
30
+ import "./chunk-EITX573K.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.2590 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2592 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  swiftCacheDir,
4
4
  windowAdmission,
5
5
  withSwiftRootLock
6
- } from "./chunk-JG4AANWA.mjs";
6
+ } from "./chunk-GQ3EO2UV.mjs";
7
7
  import {
8
8
  isRecord
9
- } from "./chunk-WPDY5IAD.mjs";
10
- import "./chunk-NZY4GOG5.mjs";
9
+ } from "./chunk-CF3MTPMY.mjs";
10
+ import "./chunk-EITX573K.mjs";
11
11
 
12
12
  // src/swift-sdk-image-producer.ts
13
13
  import { execFile, execFileSync } from "node:child_process";