peachsim 0.1.1886 → 0.1.1887

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 (90) hide show
  1. package/cli/native-input.ts +1 -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 +1 -1
  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 +1 -1
  12. package/dist-lib/bridge-contract.cjs +1 -1
  13. package/dist-lib/bridge-contract.mjs +1 -1
  14. package/dist-lib/bundle-channel.cjs +206 -82
  15. package/dist-lib/capture-contract.cjs +1 -1
  16. package/dist-lib/capture-contract.mjs +1 -1
  17. package/dist-lib/cloud-contract.cjs +1 -1
  18. package/dist-lib/cloud-contract.mjs +1 -1
  19. package/dist-lib/cloud-test-args.cjs +1 -1
  20. package/dist-lib/cloud-test-args.mjs +1 -1
  21. package/dist-lib/cloud.cjs +1 -1
  22. package/dist-lib/cloud.mjs +1 -1
  23. package/dist-lib/config.cjs +1 -1
  24. package/dist-lib/config.mjs +1 -1
  25. package/dist-lib/detox/index.cjs +1 -1
  26. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  27. package/dist-lib/expo-swift-bundle.cjs +136 -42
  28. package/dist-lib/expo-swift-metadata.cjs +1 -1
  29. package/dist-lib/expo-swift-metadata.mjs +1 -1
  30. package/dist-lib/home-paths.cjs +1 -1
  31. package/dist-lib/host/bridge-host.cjs +146 -23
  32. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  33. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  34. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  35. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  36. package/dist-lib/host/websocket-proxy.cjs +1 -1
  37. package/dist-lib/index.cjs +15 -2
  38. package/dist-lib/jump-to-source-babel.cjs +1 -1
  39. package/dist-lib/jump-to-source-native.cjs +1 -1
  40. package/dist-lib/kotlin-host.cjs +1 -1
  41. package/dist-lib/menu.cjs +1 -1
  42. package/dist-lib/menu.mjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  45. package/dist-lib/metro-production-bundle.cjs +1 -1
  46. package/dist-lib/metro-production-bundle.mjs +1 -1
  47. package/dist-lib/metro.cjs +15 -2
  48. package/dist-lib/native-app-identity-project.cjs +15 -2
  49. package/dist-lib/native-app-identity-project.mjs +22 -3
  50. package/dist-lib/native-app-identity.cjs +1 -1
  51. package/dist-lib/native-app-identity.mjs +1 -1
  52. package/dist-lib/native-firebase-metadata.cjs +1 -1
  53. package/dist-lib/native-firebase-metadata.mjs +1 -1
  54. package/dist-lib/pdfium-raster.cjs +1 -1
  55. package/dist-lib/pdfium-raster.mjs +1 -1
  56. package/dist-lib/plist.cjs +1 -1
  57. package/dist-lib/plist.mjs +1 -1
  58. package/dist-lib/profiles.cjs +1 -1
  59. package/dist-lib/public-brand.cjs +1 -1
  60. package/dist-lib/public-origins-lib-esm.json +27 -24
  61. package/dist-lib/public-origins-lib.json +70 -53
  62. package/dist-lib/react-native-host-modules.cjs +1 -1
  63. package/dist-lib/react-native-host-modules.mjs +1 -1
  64. package/dist-lib/reap-browser.cjs +1 -1
  65. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  66. package/dist-lib/sdk.cjs +1 -1
  67. package/dist-lib/sdk.mjs +1 -1
  68. package/dist-lib/skills.cjs +170 -31
  69. package/dist-lib/swift-compile.cjs +100 -12
  70. package/dist-lib/swift-compile.mjs +104 -11
  71. package/dist-lib/swift-package.cjs +1 -1
  72. package/dist-lib/swift-package.mjs +1 -1
  73. package/dist-lib/swift-submit.cjs +2 -2
  74. package/dist-lib/swift-submit.mjs +2 -2
  75. package/dist-lib/swift-toolchain.cjs +1 -1
  76. package/dist-lib/swift.cjs +1 -1
  77. package/dist-lib/vite-swift.cjs +116 -18
  78. package/dist-lib/vite.cjs +1 -1
  79. package/dist-lib/worklet-executable.cjs +1 -1
  80. package/dist-lib/worklet-executable.mjs +1 -1
  81. package/package.json +1 -1
  82. package/src/expo-swift-bundle.ts +2 -7
  83. package/src/nitro-bundle.ts +7 -10
  84. package/src/podspec-sources.ts +20 -0
  85. package/src/swift-compile.ts +10 -5
  86. package/src/swift-host.ts +32 -19
  87. package/src/swift-icu.ts +60 -18
  88. package/src/swift-submit.ts +3 -1
  89. package/src/turbo-bundle.ts +1 -1
  90. package/src/turbo-codegen-intake.ts +10 -3
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1886 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1887 | (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 __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1886 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1887 | (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.1886 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1887 | (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 __defProp = Object.defineProperty;
@@ -86,7 +86,7 @@ var MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES = 8 * 1024 * 1024;
86
86
  var MAX_SWIFT_COMPILE_IMAGES = 256;
87
87
  var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
88
88
  var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
89
- var SWIFT_HOST_ABI = 68;
89
+ var SWIFT_HOST_ABI = 69;
90
90
  var POLL_INTERVAL_MS = 1500;
91
91
  function swiftNativeEntry(native, file) {
92
92
  return {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1886 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1887 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/is-record.ts
4
4
  function isRecord(value) {
@@ -40,7 +40,7 @@ var MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES = 8 * 1024 * 1024;
40
40
  var MAX_SWIFT_COMPILE_IMAGES = 256;
41
41
  var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
42
42
  var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
43
- var SWIFT_HOST_ABI = 68;
43
+ var SWIFT_HOST_ABI = 69;
44
44
  var POLL_INTERVAL_MS = 1500;
45
45
  function swiftNativeEntry(native, file) {
46
46
  return {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1886 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1887 | (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;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1886 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1887 | (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 __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1886 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1887 | (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;
@@ -14697,6 +14697,68 @@ var import_node_os6 = __toESM(require("node:os"), 1);
14697
14697
  var import_node_path17 = __toESM(require("node:path"), 1);
14698
14698
  var import_node_util2 = require("node:util");
14699
14699
  var import_node_zlib = require("node:zlib");
14700
+
14701
+ // ../sootsim-swift/src/icuData.ts
14702
+ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
14703
+
14704
+ // ../peach-compat/src/stubs/wasm-memory.ts
14705
+ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
14706
+
14707
+ // ../sootsim-swift/src/icuData.ts
14708
+ var PACK_BYTES = 64 * 1024;
14709
+ var MAGIC = 1430473040;
14710
+ var VERSION = 1;
14711
+ var SWIFT_ICU_PACKED = `picu${VERSION}`;
14712
+ function swiftIcuLayout(head, blobBytes) {
14713
+ const view = new DataView(head.buffer, head.byteOffset, head.byteLength);
14714
+ const toc = view.getUint16(0, true);
14715
+ if (head[2] !== 218 || head[3] !== 39)
14716
+ throw new Error("swift icu data has no icu header");
14717
+ const count = view.getUint32(toc, true);
14718
+ const names = [];
14719
+ const offsets = new Uint32Array(count + 1);
14720
+ const decoder = new TextDecoder("latin1");
14721
+ for (let index = 0; index < count; index++) {
14722
+ const name3 = toc + view.getUint32(toc + 4 + index * 8, true);
14723
+ offsets[index] = toc + view.getUint32(toc + 8 + index * 8, true);
14724
+ names.push(decoder.decode(head.subarray(name3, head.indexOf(0, name3))));
14725
+ }
14726
+ offsets[count] = blobBytes;
14727
+ const packOf = new Uint32Array(count);
14728
+ const packs = [];
14729
+ for (let index = 0; index < count; index++) {
14730
+ const last = packs[packs.length - 1];
14731
+ if (last && offsets[index + 1] - last[0] <= PACK_BYTES) last[1] = offsets[index + 1];
14732
+ else packs.push([offsets[index], offsets[index + 1]]);
14733
+ packOf[index] = packs.length - 1;
14734
+ }
14735
+ return { headBytes: offsets[0], names, packOf, packs };
14736
+ }
14737
+ function swiftIcuPack(blob, deflate2) {
14738
+ const layout2 = swiftIcuLayout(blob, blob.byteLength);
14739
+ const parts = [
14740
+ deflate2(blob.subarray(0, layout2.headBytes)),
14741
+ ...layout2.packs.map(([start, end]) => deflate2(blob.subarray(start, end)))
14742
+ ];
14743
+ const index = new DataView(new ArrayBuffer(16 + parts.length * 4));
14744
+ index.setUint32(0, MAGIC, true);
14745
+ index.setUint32(4, VERSION, true);
14746
+ index.setUint32(8, blob.byteLength, true);
14747
+ index.setUint32(12, layout2.packs.length, true);
14748
+ parts.forEach((part, at2) => index.setUint32(16 + at2 * 4, part.byteLength, true));
14749
+ const packed = new Uint8Array(
14750
+ index.byteLength + parts.reduce((total, part) => total + part.byteLength, 0)
14751
+ );
14752
+ packed.set(new Uint8Array(index.buffer));
14753
+ let at = index.byteLength;
14754
+ for (const part of parts) {
14755
+ packed.set(part, at);
14756
+ at += part.byteLength;
14757
+ }
14758
+ return packed;
14759
+ }
14760
+
14761
+ // src/swift-icu.ts
14700
14762
  var run = (0, import_node_util2.promisify)(import_node_child_process15.execFile);
14701
14763
  var deflate = (0, import_node_util2.promisify)(import_node_zlib.gzip);
14702
14764
  var compressBrotli = (0, import_node_util2.promisify)(import_node_zlib.brotliCompress);
@@ -14737,9 +14799,6 @@ async function cachedBrotli(bytes, quality, cacheKey) {
14737
14799
  function brotliCompressQ4(bytes, cacheKey) {
14738
14800
  return cachedBrotli(bytes, 4, cacheKey);
14739
14801
  }
14740
- async function swiftIcuBrotliQ4(icu) {
14741
- return brotliMemoryCache.get(`4:${icu.sha256}`) ?? brotliCompressQ4(await inflateGzip(icu.gzip), icu.sha256);
14742
- }
14743
14802
  async function memo(cache, key2, load2) {
14744
14803
  const cached = cache.get(key2);
14745
14804
  if (cached !== void 0) return cached;
@@ -14842,6 +14901,33 @@ function icuSegment(object4) {
14842
14901
  throw new Error(`swift-icu: expected one icu data segment, found ${found.length}`);
14843
14902
  return found[0];
14844
14903
  }
14904
+ function swiftIcuAddress(icu) {
14905
+ return `${icu.sha256}.${SWIFT_ICU_PACKED}`;
14906
+ }
14907
+ var packedFiles = /* @__PURE__ */ new Map();
14908
+ function swiftIcuPacked(icu) {
14909
+ return memo(packedFiles, icu.sha256, async () => {
14910
+ const file = import_node_path17.default.join(
14911
+ import_node_os6.default.homedir(),
14912
+ ".peach",
14913
+ "cache",
14914
+ "swift-brotli",
14915
+ swiftIcuAddress(icu)
14916
+ );
14917
+ if ((0, import_node_fs17.existsSync)(file)) return (0, import_promises3.readFile)(file);
14918
+ const packed = Buffer.from(
14919
+ swiftIcuPack(
14920
+ await inflateGzip(icu.gzip),
14921
+ (bytes) => (0, import_node_zlib.deflateRawSync)(bytes, { level: 9 })
14922
+ )
14923
+ );
14924
+ await (0, import_promises3.mkdir)(import_node_path17.default.dirname(file), { recursive: true });
14925
+ const tmp = `${file}.${(0, import_node_crypto10.randomUUID)()}.tmp`;
14926
+ await (0, import_promises3.writeFile)(tmp, packed);
14927
+ await (0, import_promises3.rename)(tmp, file);
14928
+ return packed;
14929
+ });
14930
+ }
14845
14931
 
14846
14932
  // src/swift-link-roots.ts
14847
14933
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
@@ -16290,12 +16376,14 @@ var executableLinkFlags = (root) => ` "-Xclang-linker", "-O0",
16290
16376
  "-Xlinker", "-lsetjmp",
16291
16377
  "-Xlinker", "--export-table",
16292
16378
  "-Xlinker", "--growable-table",
16379
+ "-Xlinker", "--wrap=swift_udata_open",
16380
+ "-Xlinker", "--wrap=swift_udata_openChoice",
16293
16381
  `;
16294
16382
  var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quoted, "-Wl,--end-lib"] : [];
16295
16383
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
16296
16384
  var MULTI_MANIFEST_VERSION = 66;
16297
16385
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
16298
- var compilerSourceDigest = true ? "a3a3606aced607c5458fcb143386bc40e87f886a19f283b511374ac04ba02293" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
16386
+ var compilerSourceDigest = true ? "d46232537a993bc7418818ab7d2dc159518328882280b8b4bfd459cffd910921" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
16299
16387
  function swiftArtifactHash(input, release, moduleRoot) {
16300
16388
  const hash = (0, import_node_crypto12.createHash)("sha256");
16301
16389
  hash.update(`swift-compile
@@ -28588,7 +28676,7 @@ var MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES = 8 * 1024 * 1024;
28588
28676
  var MAX_SWIFT_COMPILE_IMAGES = 256;
28589
28677
  var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
28590
28678
  var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
28591
- var SWIFT_HOST_ABI = 68;
28679
+ var SWIFT_HOST_ABI = 69;
28592
28680
  var POLL_INTERVAL_MS = 1500;
28593
28681
  function swiftNativeEntry(native, file) {
28594
28682
  return {
@@ -29428,7 +29516,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
29428
29516
  return hash.digest("hex");
29429
29517
  }
29430
29518
  var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
29431
- var STANDIN_SOURCE_DIGEST = true ? "90cf6a7c52efb9dc2256de1e8db220ebfeaccb64f6b7661fd2380ceba5f70d78" : standinSourceDigest();
29519
+ var STANDIN_SOURCE_DIGEST = true ? "2340b1684e4aa046dace7fdc861bb6a39fde0a6ee06003187e6af39416313d98" : standinSourceDigest();
29432
29520
 
29433
29521
  // src/swift-standins.ts
29434
29522
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
@@ -35201,7 +35289,7 @@ function entryRootId(packagePath, file) {
35201
35289
  return `${import_node_path51.default.basename(packagePath)}${import_node_path51.default.posix.sep}${relative2}`;
35202
35290
  }
35203
35291
  function icuUrl(origin, artifact) {
35204
- return "url" in artifact.icu ? artifact.icu.url : `${origin}${ICU_PATH}${artifact.icu.sha256}`;
35292
+ return "url" in artifact.icu ? artifact.icu.url : `${origin}${ICU_PATH}${swiftIcuAddress(artifact.icu)}`;
35205
35293
  }
35206
35294
  function standinLibraries(binaries, standins, rootDir, toolchain) {
35207
35295
  const linked = /* @__PURE__ */ new Map();
@@ -35877,20 +35965,30 @@ async function serveSwiftPackageAsset(pathname, res) {
35877
35965
  if (pathname.startsWith(ICU_PATH)) {
35878
35966
  for (const project of projects().values()) {
35879
35967
  const icu = project.artifacts.find(
35880
- (artifact) => "sha256" in artifact.icu && pathname === `${ICU_PATH}${artifact.icu.sha256}`
35968
+ (artifact) => "sha256" in artifact.icu && pathname === `${ICU_PATH}${swiftIcuAddress(artifact.icu)}`
35881
35969
  )?.icu;
35882
- if (!icu || "url" in icu || pathname !== `${ICU_PATH}${icu.sha256}`) continue;
35970
+ if (!icu || "url" in icu) continue;
35971
+ const packed = await swiftIcuPacked(icu);
35883
35972
  res.setHeader("access-control-allow-origin", "*");
35884
35973
  res.setHeader("cache-control", "public, max-age=31536000, immutable");
35885
- res.setHeader("vary", "accept-encoding");
35886
- if (acceptsBr) {
35887
- res.setHeader("content-type", "application/octet-stream");
35888
- res.setHeader("content-encoding", "br");
35889
- res.end(await swiftIcuBrotliQ4(icu));
35890
- } else {
35891
- res.setHeader("content-type", "application/gzip");
35892
- res.end(icu.gzip);
35974
+ res.setHeader("content-type", "application/octet-stream");
35975
+ res.setHeader("accept-ranges", "bytes");
35976
+ const range2 = /^bytes=(\d+)-(\d+)$/.exec(res.req?.headers.range ?? "");
35977
+ if (!range2) {
35978
+ res.end(packed);
35979
+ return true;
35980
+ }
35981
+ const start = Number(range2[1]);
35982
+ const end = Math.min(Number(range2[2]), packed.length - 1);
35983
+ if (start > end) {
35984
+ res.statusCode = 416;
35985
+ res.setHeader("content-range", `bytes */${packed.length}`);
35986
+ res.end();
35987
+ return true;
35893
35988
  }
35989
+ res.statusCode = 206;
35990
+ res.setHeader("content-range", `bytes ${start}-${end}/${packed.length}`);
35991
+ res.end(packed.subarray(start, end + 1));
35894
35992
  return true;
35895
35993
  }
35896
35994
  res.statusCode = 404;
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1886 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1887 | (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;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1886 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1887 | (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 __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1886 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1887 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/worklet-executable.ts
4
4
  import { parse } from "acorn";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.1886",
3
+ "version": "0.1.1887",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1,6 +1,7 @@
1
1
  // release publishers use the same app compiler as local launches, then carry
2
2
  // its immutable native assets beside the javascript bundle.
3
3
  import { compileExpoSwiftModules } from './expo-swift-host'
4
+ import { swiftIcuBundleAsset } from './swift-icu'
4
5
  import type { ExpoSwiftCompilationResult } from './expoSwiftContract'
5
6
 
6
7
  export interface ExpoSwiftBundle {
@@ -22,13 +23,7 @@ export async function buildExpoSwiftBundle(
22
23
  bytes: artifact.bytes,
23
24
  contentType: 'application/wasm',
24
25
  })
25
- if ('gzip' in artifact.icu) {
26
- assets.push({
27
- path: `__peach/swift-icu/${artifact.icu.sha256}`,
28
- bytes: artifact.icu.gzip,
29
- contentType: 'application/gzip',
30
- })
31
- }
26
+ if ('gzip' in artifact.icu) assets.push(await swiftIcuBundleAsset(artifact.icu))
32
27
  },
33
28
  )
34
29
  if (!metadata) return null
@@ -16,6 +16,7 @@ import { discoverNitroProviders, selectNitroProviders } from './nitro-source'
16
16
  import { sharedNitroModule } from './nitro-superset'
17
17
  import { swiftDistributionRoot } from './swift-distribution'
18
18
  import { icuUrl, type SwiftArtifact } from './swift-host'
19
+ import { swiftIcuBundleAsset } from './swift-icu'
19
20
  import type { NitroBuildConfiguration, NitroCompiledModule } from './nitroContract'
20
21
  import type { IncomingMessage, ServerResponse } from 'node:http'
21
22
 
@@ -134,21 +135,17 @@ export async function compileNitroApp(
134
135
  }
135
136
 
136
137
  /** a compiled module's served files: its wasm and, unless shared, its ICU. */
137
- export function compiledModuleAssets(artifact: SwiftArtifact): CompiledModuleAsset[] {
138
- const assets: CompiledModuleAsset[] = [
138
+ export async function compiledModuleAssets(
139
+ artifact: SwiftArtifact,
140
+ ): Promise<CompiledModuleAsset[]> {
141
+ return [
139
142
  {
140
143
  path: `__peach/swift/${artifact.hash}.wasm`,
141
144
  bytes: artifact.bytes,
142
145
  contentType: 'application/wasm',
143
146
  },
147
+ ...('gzip' in artifact.icu ? [await swiftIcuBundleAsset(artifact.icu)] : []),
144
148
  ]
145
- if ('gzip' in artifact.icu)
146
- assets.push({
147
- path: `__peach/swift-icu/${artifact.icu.sha256}`,
148
- bytes: artifact.icu.gzip,
149
- contentType: 'application/gzip',
150
- })
151
- return assets
152
149
  }
153
150
 
154
151
  export async function buildNitroBundle(
@@ -161,7 +158,7 @@ export async function buildNitroBundle(
161
158
  if (!compiled) return null
162
159
  return {
163
160
  metadata: compiled.metadata,
164
- assets: compiled.artifact ? compiledModuleAssets(compiled.artifact) : [],
161
+ assets: compiled.artifact ? await compiledModuleAssets(compiled.artifact) : [],
165
162
  }
166
163
  }
167
164
 
@@ -1028,6 +1028,26 @@ class Evaluator {
1028
1028
  helper,
1029
1029
  node.args.map((arg) => this.ev(scope, arg)),
1030
1030
  )
1031
+ // react-native 0.75 podspecs call the global that react_native_pods.rb defines as
1032
+ // `Helpers::Constants.folly_config`
1033
+ if (node.name === 'get_folly_config') {
1034
+ let root = path.dirname(this.current)
1035
+ while (!fs.existsSync(path.join(root, 'scripts/cocoapods/helpers.rb'))) {
1036
+ if (root === path.dirname(root)) return this.fail('call to get_folly_config')
1037
+ root = path.dirname(root)
1038
+ }
1039
+ const helpers = fs.readFileSync(
1040
+ path.join(root, 'scripts/cocoapods/helpers.rb'),
1041
+ 'utf8',
1042
+ )
1043
+ const version = /:version\s*=>\s*'([^']*)'/.exec(helpers)?.[1]
1044
+ const flags = /:compiler_flags\s*=>\s*'([^']*)'/.exec(helpers)?.[1]
1045
+ if (!version || !flags) return this.fail('get_folly_config')
1046
+ return new Map([
1047
+ ['version', version],
1048
+ ['compiler_flags', flags],
1049
+ ])
1050
+ }
1031
1051
  return this.fail(`call to ${node.name}`)
1032
1052
  }
1033
1053
  case 'bin': {
@@ -50,9 +50,10 @@ import { compileGuestLink } from './swift-guest-compile'
50
50
  import {
51
51
  brotliCompressQ11,
52
52
  brotliCompressQ4,
53
+ swiftIcuAddress,
53
54
  swiftIcuAsset,
54
- swiftIcuBrotli,
55
- swiftIcuBrotliQ4,
55
+ swiftIcuBundleAsset,
56
+ swiftIcuPacked,
56
57
  type SwiftIcuAsset,
57
58
  } from './swift-icu'
58
59
  import { swiftObjcRootObjects } from './swift-link-roots'
@@ -141,9 +142,10 @@ import type { SwiftResourceBundle } from './swiftContract'
141
142
  export {
142
143
  brotliCompressQ11,
143
144
  brotliCompressQ4,
145
+ swiftIcuAddress,
144
146
  swiftIcuAsset,
145
- swiftIcuBrotli,
146
- swiftIcuBrotliQ4,
147
+ swiftIcuBundleAsset,
148
+ swiftIcuPacked,
147
149
  type SwiftIcuAsset,
148
150
  }
149
151
 
@@ -1505,7 +1507,8 @@ const ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One
1505
1507
  // edit pay for an optimizer pass and the artifact depend on the machine, so
1506
1508
  // -O0 on the clang link turns that pass off everywhere. the build root's
1507
1509
  // linker drops repeated autolink -l flags (writeSwiftAutolinkLinker). the
1508
- // rest is the native main-thread stack budget.
1510
+ // icu wraps route icu data opens through Sources/PeachICU, whose host places
1511
+ // each item on first use. the rest is the native main-thread stack budget.
1509
1512
  const executableLinkFlags = (root: string) => ` "-Xclang-linker", "-O0",
1510
1513
  "-Xclang-linker", ${JSON.stringify(`-fuse-ld=${path.join(root, SWIFT_AUTOLINK_LINKER)}`)},
1511
1514
  "-Xlinker", "-z", "-Xlinker", "stack-size=8372224",
@@ -1514,6 +1517,8 @@ const executableLinkFlags = (root: string) => ` "-Xclang-linker", "-O0"
1514
1517
  "-Xlinker", "-lsetjmp",
1515
1518
  "-Xlinker", "--export-table",
1516
1519
  "-Xlinker", "--growable-table",
1520
+ "-Xlinker", "--wrap=swift_udata_open",
1521
+ "-Xlinker", "--wrap=swift_udata_openChoice",
1517
1522
  `
1518
1523
  // the Darwin module's providers link as an archive does, ahead of the sdk's
1519
1524
  // libDarwinRecords.a, which supplies only what remains undefined
package/src/swift-host.ts CHANGED
@@ -27,7 +27,9 @@ import {
27
27
  missingSwiftModules,
28
28
  swiftAvailableModules,
29
29
  swiftSystemLibrarySurface,
30
- swiftIcuBrotliQ4,
30
+ swiftIcuAddress,
31
+ swiftIcuBundleAsset,
32
+ swiftIcuPacked,
31
33
  swiftImportNames,
32
34
  swiftPeachModules,
33
35
  withNativeSourceGlue,
@@ -2264,7 +2266,7 @@ export function entryRootId(packagePath: string, file: string): string {
2264
2266
  export function icuUrl(origin: string, artifact: SwiftArtifact): string {
2265
2267
  return 'url' in artifact.icu
2266
2268
  ? artifact.icu.url
2267
- : `${origin}${ICU_PATH}${artifact.icu.sha256}`
2269
+ : `${origin}${ICU_PATH}${swiftIcuAddress(artifact.icu)}`
2268
2270
  }
2269
2271
 
2270
2272
  // a c stand-in whose framework has a WebAssembly build links that library,
@@ -3250,22 +3252,34 @@ export async function serveSwiftPackageAsset(
3250
3252
  for (const project of projects().values()) {
3251
3253
  const icu = project.artifacts.find(
3252
3254
  (artifact) =>
3253
- 'sha256' in artifact.icu && pathname === `${ICU_PATH}${artifact.icu.sha256}`,
3255
+ 'sha256' in artifact.icu &&
3256
+ pathname === `${ICU_PATH}${swiftIcuAddress(artifact.icu)}`,
3254
3257
  )?.icu
3255
- if (!icu || 'url' in icu || pathname !== `${ICU_PATH}${icu.sha256}`) continue
3258
+ if (!icu || 'url' in icu) continue
3256
3259
  // the address is the content, so the browser keeps it across reloads,
3257
- // restarts and every app built with this toolchain
3260
+ // restarts and every app built with this toolchain. the tenant reads
3261
+ // the index and then one pack at a time by range.
3262
+ const packed = await swiftIcuPacked(icu)
3258
3263
  res.setHeader('access-control-allow-origin', '*')
3259
3264
  res.setHeader('cache-control', 'public, max-age=31536000, immutable')
3260
- res.setHeader('vary', 'accept-encoding')
3261
- if (acceptsBr) {
3262
- res.setHeader('content-type', 'application/octet-stream')
3263
- res.setHeader('content-encoding', 'br')
3264
- res.end(await swiftIcuBrotliQ4(icu))
3265
- } else {
3266
- res.setHeader('content-type', 'application/gzip')
3267
- res.end(icu.gzip)
3265
+ res.setHeader('content-type', 'application/octet-stream')
3266
+ res.setHeader('accept-ranges', 'bytes')
3267
+ const range = /^bytes=(\d+)-(\d+)$/.exec(res.req?.headers.range ?? '')
3268
+ if (!range) {
3269
+ res.end(packed)
3270
+ return true
3268
3271
  }
3272
+ const start = Number(range[1])
3273
+ const end = Math.min(Number(range[2]), packed.length - 1)
3274
+ if (start > end) {
3275
+ res.statusCode = 416
3276
+ res.setHeader('content-range', `bytes */${packed.length}`)
3277
+ res.end()
3278
+ return true
3279
+ }
3280
+ res.statusCode = 206
3281
+ res.setHeader('content-range', `bytes ${start}-${end}/${packed.length}`)
3282
+ res.end(packed.subarray(start, end + 1))
3269
3283
  return true
3270
3284
  }
3271
3285
  res.statusCode = 404
@@ -3295,7 +3309,7 @@ export async function serveSwiftPackageAsset(
3295
3309
  }
3296
3310
 
3297
3311
  // packages retain the exact bytes the foreground host serves, including ICU.
3298
- export function swiftPackageAssets(packagePath: string, hash: string) {
3312
+ export async function swiftPackageAssets(packagePath: string, hash: string) {
3299
3313
  const project = projects().get(fs.realpathSync(packagePath))
3300
3314
  const artifact = project?.artifacts.find((candidate) => candidate.hash === hash)
3301
3315
  if (!project || !artifact) throw new Error(`Swift artifact ${hash} was not built`)
@@ -3307,11 +3321,10 @@ export function swiftPackageAssets(packagePath: string, hash: string) {
3307
3321
  ])
3308
3322
  for (const [key, resource] of project.resourceFiles)
3309
3323
  assets.set(`${RESOURCE_PATH}${key}`, resource)
3310
- if ('sha256' in artifact.icu)
3311
- assets.set(`${ICU_PATH}${artifact.icu.sha256}`, {
3312
- bytes: artifact.icu.gzip,
3313
- contentType: 'application/gzip',
3314
- })
3324
+ if ('sha256' in artifact.icu) {
3325
+ const asset = await swiftIcuBundleAsset(artifact.icu)
3326
+ assets.set(`/${asset.path}`, asset)
3327
+ }
3315
3328
  return assets
3316
3329
  }
3317
3330
 
package/src/swift-icu.ts CHANGED
@@ -5,7 +5,14 @@ import { mkdir, readFile, rename, writeFile } from 'node:fs/promises'
5
5
  import os from 'node:os'
6
6
  import path from 'node:path'
7
7
  import { promisify } from 'node:util'
8
- import { brotliCompress, constants as zlibConstants, gunzip, gzip } from 'node:zlib'
8
+ import {
9
+ brotliCompress,
10
+ constants as zlibConstants,
11
+ deflateRawSync,
12
+ gunzip,
13
+ gzip,
14
+ } from 'node:zlib'
15
+ import { SWIFT_ICU_PACKED, swiftIcuPack } from '../../sootsim-swift/src/icuData.ts'
9
16
  import { swiftEnvironment, swiftSdkOptions } from './swift-toolchain.ts'
10
17
 
11
18
  /**
@@ -15,11 +22,11 @@ import { swiftEnvironment, swiftSdkOptions } from './swift-toolchain.ts'
15
22
  * leaves out, so it is exactly the bytes the linker used to place: one blob
16
23
  * per toolchain release.
17
24
  *
18
- * node builtins only: the fixture harnesses import this file straight from
19
- * the checkout.
25
+ * node builtins and plain typescript only: the fixture harnesses import this
26
+ * file straight from the checkout.
20
27
  */
21
28
  export interface SwiftIcuAsset {
22
- /** sha256 of `gzip`, the address a host serves it at. */
29
+ /** sha256 of `gzip`: the blob's content address (swiftIcuAddress). */
23
30
  sha256: string
24
31
  /**
25
32
  * the blob gzipped, for local artifact receipts and clients without brotli
@@ -84,20 +91,6 @@ export function brotliCompressQ4(bytes: Buffer, cacheKey?: string): Promise<Buff
84
91
  return cachedBrotli(bytes, 4, cacheKey)
85
92
  }
86
93
 
87
- export async function swiftIcuBrotli(icu: SwiftIcuAsset): Promise<Buffer> {
88
- return (
89
- brotliMemoryCache.get(`11:${icu.sha256}`) ??
90
- brotliCompressQ11(await inflateGzip(icu.gzip), icu.sha256)
91
- )
92
- }
93
-
94
- export async function swiftIcuBrotliQ4(icu: SwiftIcuAsset): Promise<Buffer> {
95
- return (
96
- brotliMemoryCache.get(`4:${icu.sha256}`) ??
97
- brotliCompressQ4(await inflateGzip(icu.gzip), icu.sha256)
98
- )
99
- }
100
-
101
94
  async function memo<T>(
102
95
  cache: Map<string, T>,
103
96
  key: string,
@@ -219,3 +212,52 @@ function icuSegment(object: Buffer): Buffer {
219
212
  throw new Error(`swift-icu: expected one icu data segment, found ${found.length}`)
220
213
  return found[0]
221
214
  }
215
+
216
+ /**
217
+ * the packed file's name under a host's icu root: the blob's content address
218
+ * and the packed format (packages/sootsim-swift/src/icuData.ts).
219
+ */
220
+ export function swiftIcuAddress(icu: SwiftIcuAsset): string {
221
+ return `${icu.sha256}.${SWIFT_ICU_PACKED}`
222
+ }
223
+
224
+ const packedFiles = new Map<string, Buffer>()
225
+
226
+ /**
227
+ * the blob packed for on-demand reads: an index, the deflated table of
228
+ * contents and each deflated pack. a host serves it as is and answers range
229
+ * requests, so it carries no content encoding.
230
+ */
231
+ export function swiftIcuPacked(icu: SwiftIcuAsset): Promise<Buffer> {
232
+ return memo(packedFiles, icu.sha256, async () => {
233
+ const file = path.join(
234
+ os.homedir(),
235
+ '.peach',
236
+ 'cache',
237
+ 'swift-brotli',
238
+ swiftIcuAddress(icu),
239
+ )
240
+ if (existsSync(file)) return readFile(file)
241
+ const packed = Buffer.from(
242
+ swiftIcuPack(await inflateGzip(icu.gzip), (bytes) =>
243
+ deflateRawSync(bytes, { level: 9 }),
244
+ ),
245
+ )
246
+ await mkdir(path.dirname(file), { recursive: true })
247
+ const tmp = `${file}.${randomUUID()}.tmp`
248
+ await writeFile(tmp, packed)
249
+ await rename(tmp, file)
250
+ return packed
251
+ })
252
+ }
253
+
254
+ /** the packed icu file a bundle carries beside its wasm, at the path its icu url names. */
255
+ export async function swiftIcuBundleAsset(
256
+ icu: SwiftIcuAsset,
257
+ ): Promise<{ path: string; bytes: Buffer; contentType: string }> {
258
+ return {
259
+ path: `__peach/swift-icu/${swiftIcuAddress(icu)}`,
260
+ bytes: await swiftIcuPacked(icu),
261
+ contentType: 'application/octet-stream',
262
+ }
263
+ }
@@ -144,7 +144,9 @@ export const MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024
144
144
  // sysctl hw.model board configuration.
145
145
  // 67: `peach.dyld_image_uuid` supplies the compiled app image identity.
146
146
  // 68: fetch headers replies carry `setCookies`, the response's Set-Cookie list.
147
- export const SWIFT_HOST_ABI = 68
147
+ // 69: `peach.icu_item_v1` replaces `icu_data_v1`: the host fills icu's table of
148
+ // contents and places each item's pack the first time icu opens it.
149
+ export const SWIFT_HOST_ABI = 69
148
150
 
149
151
  export interface SwiftImageUpload {
150
152
  /** the raster file picked for the asset (has the extension). */
@@ -115,7 +115,7 @@ export async function buildTurboBundle(
115
115
  if (!compiled) return null
116
116
  return {
117
117
  metadata: compiled.metadata,
118
- assets: compiled.artifact ? compiledModuleAssets(compiled.artifact) : [],
118
+ assets: compiled.artifact ? await compiledModuleAssets(compiled.artifact) : [],
119
119
  }
120
120
  }
121
121