peachsim 0.1.1855 → 0.1.1857

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 (96) hide show
  1. package/cli/outbound-endpoints.ts +4 -0
  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 +2389 -2160
  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 +1766 -1478
  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 +2704 -2465
  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 +2 -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 +2 -2
  48. package/dist-lib/native-app-identity-project.cjs +2 -2
  49. package/dist-lib/native-app-identity-project.mjs +2 -2
  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 +24 -24
  61. package/dist-lib/public-origins-lib.json +84 -68
  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 +3437 -3180
  69. package/dist-lib/swift-compile.cjs +33 -62
  70. package/dist-lib/swift-compile.mjs +33 -62
  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 +1 -1
  74. package/dist-lib/swift-submit.mjs +1 -1
  75. package/dist-lib/swift-toolchain.cjs +1 -1
  76. package/dist-lib/swift.cjs +1 -1
  77. package/dist-lib/vite-swift.cjs +44 -72
  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-native-compiler-digest.ts +18 -0
  83. package/src/expo-native-prebuilt.ts +353 -0
  84. package/src/expo-native-workspace.ts +1 -1
  85. package/src/expo-swift-host.ts +18 -4
  86. package/src/native-bundles.ts +6 -6
  87. package/src/native-prebuilt.ts +7 -4
  88. package/src/nitro-compile.ts +2 -6
  89. package/src/nitro-superset.ts +7 -23
  90. package/src/package-tree-digest.ts +29 -0
  91. package/src/swift-compile.ts +22 -60
  92. package/src/swift-host.ts +6 -6
  93. package/src/swift-standin-digest.ts +24 -12
  94. package/src/swift-wasm-prune.ts +13 -16
  95. package/src/turbo-bundle.ts +9 -2
  96. package/src/turbo-compile.ts +2 -2
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1855 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1857 | (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;
@@ -10416,7 +10416,7 @@ function getModulePrefix(file) {
10416
10416
  const dash = base.indexOf("-");
10417
10417
  return dash > 0 ? base.slice(0, dash) : base;
10418
10418
  }
10419
- function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTargets = []) {
10419
+ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTargets = [], owner) {
10420
10420
  const rspPath = import_node_path16.default.join(directory, ".peach-link.rsp");
10421
10421
  if (!import_node_fs16.default.existsSync(rspPath)) return;
10422
10422
  const origRsp = import_node_fs16.default.readFileSync(rspPath, "utf8");
@@ -10425,8 +10425,11 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
10425
10425
  const sdkFlag = tokens2.find(
10426
10426
  (t) => t.startsWith("-L") && t.endsWith("/swift_static/wasi")
10427
10427
  );
10428
- if (!sdkFlag) return;
10429
- const sdkWasiDir = sdkFlag.slice(2);
10428
+ if (!sdkFlag)
10429
+ throw new Error(`swift-wasm-prune: ${rspPath} names no sdk library directory`);
10430
+ const sdkWasiDir = import_node_fs16.default.realpathSync(sdkFlag.slice(2));
10431
+ if (owner && import_node_fs16.default.statSync(sdkWasiDir).uid === owner.uid)
10432
+ throw new Error(`swift-wasm-prune: the build owns its sdk directory ${sdkWasiDir}`);
10430
10433
  const sdkObjsDir = ensureUnpackedSdkObjects(sdkWasiDir);
10431
10434
  const distDir = import_node_path16.default.join(moduleRoot, "lib");
10432
10435
  const prunedObjsDir = import_node_path16.default.join(directory, ".peach-pruned-objs");
@@ -10448,7 +10451,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
10448
10451
  continue;
10449
10452
  }
10450
10453
  if (t.endsWith(".o")) {
10451
- if (t.startsWith(distDir)) {
10454
+ if (import_node_path16.default.resolve(t).startsWith(distDir + import_node_path16.default.sep)) {
10452
10455
  if (!foundationCategoryObjects.some(
10453
10456
  (name3) => import_node_path16.default.basename(t) === `Foundation-${name3}.o`
10454
10457
  )) {
@@ -10753,12 +10756,9 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
10753
10756
  }
10754
10757
  }
10755
10758
  let hasClangObjCEager = false;
10756
- const eagerBuildPrunable = [];
10757
10759
  for (const f of eagerFiles) {
10758
10760
  const isDist = f.startsWith(distDir);
10759
- const isBuildSwift = !isDist && f.endsWith(".swift.o");
10760
- const obj = distObjs.get(f) ?? parseWasmObjectCached(f, isDist || isBuildSwift, false);
10761
- if (isBuildSwift) eagerBuildPrunable.push(obj);
10761
+ const obj = distObjs.get(f) ?? parseWasmObjectCached(f, isDist, false);
10762
10762
  extractObject(obj);
10763
10763
  if (!isDist && !hasClangObjCEager && obj.symNames.includes("__objc_load")) {
10764
10764
  hasClangObjCEager = true;
@@ -11147,14 +11147,6 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
11147
11147
  writePrunedObject(o, outPath);
11148
11148
  prunedMap.set(o.file, outPath);
11149
11149
  }
11150
- for (const o of eagerBuildPrunable) {
11151
- const outPath = import_node_path16.default.join(
11152
- prunedObjsDir,
11153
- `build-${import_node_path16.default.basename(import_node_path16.default.dirname(o.file))}-${import_node_path16.default.basename(o.file)}`
11154
- );
11155
- writePrunedObject(o, outPath);
11156
- prunedMap.set(o.file, outPath);
11157
- }
11158
11150
  const extraSdkObjs = allSdkObjFiles.filter(
11159
11151
  (f) => f.startsWith("libDarwin__") || f.startsWith("libswiftCore__") && f !== "libswiftCore__Swift.o" || f.startsWith("libswift_Concurrency__") && f !== "libswift_Concurrency___Concurrency.o"
11160
11152
  ).map((f) => import_node_path16.default.join(sdkObjsDir, f));
@@ -11215,7 +11207,8 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
11215
11207
  import_node_fs16.default.writeFileSync(prunedRspPath, outTokens.map((t) => JSON.stringify(t)).join(" "));
11216
11208
  (0, import_node_child_process13.execFileSync)(import_node_path16.default.join(toolchainBin, "wasm-ld"), [`@${prunedRspPath}`], {
11217
11209
  stdio: "pipe",
11218
- maxBuffer: Infinity
11210
+ maxBuffer: Infinity,
11211
+ ...owner
11219
11212
  });
11220
11213
  import_node_fs16.default.rmSync(rspPath, { force: true });
11221
11214
  }
@@ -12165,7 +12158,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
12165
12158
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
12166
12159
  var MULTI_MANIFEST_VERSION = 65;
12167
12160
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
12168
- var compilerSourceDigest = true ? "266f0a8129486f5fdb6354090f587d7fcd2173e8fd6d97af6d11d9d278388e6f" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
12161
+ var compilerSourceDigest = true ? "e8de8fa3db7ed30ab6e2496f8e91fbb98dacbcb1ce01fd4cba3f949b2834edcd" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
12169
12162
  function swiftArtifactHash(input, release, moduleRoot) {
12170
12163
  const hash = (0, import_node_crypto8.createHash)("sha256");
12171
12164
  hash.update(`swift-compile
@@ -12174,8 +12167,7 @@ ${release}
12174
12167
  hash.update(compilerSourceDigest);
12175
12168
  if (input.oneModule) hash.update("one-module\n");
12176
12169
  hash.update(swiftModuleDigest(moduleRoot));
12177
- if (input.lazyDistribution)
12178
- hash.update(`lazy-distribution
12170
+ if (input.optimize) hash.update(`optimize
12179
12171
  ${WASM_OPTIMIZE_IDENTITY}
12180
12172
  `);
12181
12173
  for (const file of Object.keys(input.files).sort()) {
@@ -12312,27 +12304,19 @@ function emitSwiftPackageManifest(args) {
12312
12304
  (name3) => !object2.startsWith(`lib/${name3}-`) || reachedFrameworks.has(name3)
12313
12305
  )
12314
12306
  );
12315
- const selectedObjects = new Set(objects);
12316
12307
  const quoted = (object2) => `"${import_node_path19.default.join(moduleRoot, object2).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
12317
12308
  const categoryObjects = new Set(
12318
12309
  foundationCategoryObjects.map((name3) => `lib/Foundation-${name3}.o`)
12319
12310
  );
12320
- const roots = args.lazyDistribution ? swiftObjcRootObjects(distribution.id, moduleRoot, distribution.objects) : null;
12311
+ const roots = swiftObjcRootObjects(distribution.id, moduleRoot, distribution.objects);
12321
12312
  const eager = new Set(
12322
- objects.filter((object2) => roots?.has(object2) || categoryObjects.has(object2))
12313
+ objects.filter((object2) => roots.has(object2) || categoryObjects.has(object2))
12323
12314
  );
12324
12315
  const list2 = [
12325
- ...roots ? [
12326
- ...[...eager].map(quoted),
12327
- "-Wl,--start-lib",
12328
- ...available.filter((object2) => !eager.has(object2)).map(quoted),
12329
- "-Wl,--end-lib"
12330
- ] : [
12331
- ...objects.map(quoted),
12332
- "-Wl,--start-lib",
12333
- ...available.filter((object2) => !selectedObjects.has(object2)).map(quoted),
12334
- "-Wl,--end-lib"
12335
- ],
12316
+ ...[...eager].map(quoted),
12317
+ "-Wl,--start-lib",
12318
+ ...available.filter((object2) => !eager.has(object2)).map(quoted),
12319
+ "-Wl,--end-lib",
12336
12320
  ...darwinRecordsRegion(distribution.objects.filter(isProvider).map(quoted))
12337
12321
  ].join("\n") + "\n";
12338
12322
  distributionLinkPath = distributionLink.path.replace(
@@ -15143,8 +15127,7 @@ module ${moduleName}.Swift {
15143
15127
  distributionLink: {
15144
15128
  path: import_node_path19.default.join(layout.root, ".peach-distribution-objects.rsp"),
15145
15129
  files: files2
15146
- },
15147
- lazyDistribution: input.lazyDistribution
15130
+ }
15148
15131
  } : {},
15149
15132
  ...prebuilt && frameworkLink ? {
15150
15133
  prebuilt: {
@@ -15849,15 +15832,6 @@ function compileSwiftProjectOnce(input, options) {
15849
15832
  const root = (0, import_node_fs19.realpathSync)(options.buildRoot);
15850
15833
  const moduleRoot = import_node_path19.default.resolve(options.moduleRoot);
15851
15834
  const distribution = swiftDistributionAt(moduleRoot);
15852
- const entrySource = input.files[input.entry];
15853
- if (distribution && entrySource && !input.lazyDistribution) {
15854
- const imports2 = swiftImportNames(entrySource);
15855
- const sources = Object.keys(input.files).filter(
15856
- (file) => /\.(?:swift|c|cc|cpp|cxx|m|mm)$/.test(file) && file !== "Package.swift"
15857
- );
15858
- if (sources.length === 1 && sources[0] === input.entry && imports2.includes("Foundation") && !imports2.some((name3) => distribution.modules.includes(name3)))
15859
- input = { ...input, lazyDistribution: true };
15860
- }
15861
15835
  const layout = {
15862
15836
  root,
15863
15837
  sources: import_node_path19.default.join(root, "Sources", "App"),
@@ -15980,7 +15954,7 @@ function compileSwiftProjectOnce(input, options) {
15980
15954
  process.env.LD_LIBRARY_PATH
15981
15955
  ].filter(Boolean).join(":")
15982
15956
  } : {},
15983
- ...input.lazyDistribution ? { PEACH_DEFER_WASM_LINK: "1" } : {}
15957
+ PEACH_DEFER_WASM_LINK: "1"
15984
15958
  },
15985
15959
  maxBuffer: 64 * 1024 * 1024,
15986
15960
  timeout: options.timeoutMs,
@@ -16080,11 +16054,9 @@ function compileSwiftProjectOnce(input, options) {
16080
16054
  ])
16081
16055
  ];
16082
16056
  const linked = builtArtifact(layout);
16083
- if (input.lazyDistribution) {
16084
- (0, import_node_fs19.rmSync)(import_node_path19.default.join(root, ".peach-link.rsp"), { force: true });
16085
- if ((0, import_node_fs19.existsSync)(linked) && (0, import_node_fs19.statSync)(linked).size <= 8)
16086
- (0, import_node_fs19.rmSync)(linked, { force: true });
16087
- }
16057
+ (0, import_node_fs19.rmSync)(import_node_path19.default.join(root, ".peach-link.rsp"), { force: true });
16058
+ if ((0, import_node_fs19.existsSync)(linked) && (0, import_node_fs19.statSync)(linked).size <= 8)
16059
+ (0, import_node_fs19.rmSync)(linked, { force: true });
16088
16060
  report("compiling and linking Swift modules");
16089
16061
  try {
16090
16062
  const headerBuilds = preparation.headerProductTarget ? [
@@ -16198,20 +16170,19 @@ function compileSwiftProjectOnce(input, options) {
16198
16170
  );
16199
16171
  }
16200
16172
  if (options.project) removeProjectLinks(root);
16173
+ pruneSwiftWasmLink(
16174
+ root,
16175
+ options.toolchainBin,
16176
+ frameworkRoot,
16177
+ input.staticClangTargets,
16178
+ options.project
16179
+ );
16201
16180
  const output2 = options.project ? projectOutputFile(root, linked, options.project) : linked;
16202
16181
  const optimized = `${output2}.optimized`;
16203
- if (input.lazyDistribution) {
16204
- pruneSwiftWasmLink(
16205
- root,
16206
- options.toolchainBin,
16207
- frameworkRoot,
16208
- input.staticClangTargets
16209
- );
16210
- await optimizeWasm(output2, optimized);
16211
- }
16182
+ if (input.optimize) await optimizeWasm(output2, optimized);
16212
16183
  const artifact = {
16213
16184
  hash,
16214
- bytes: (0, import_node_fs19.readFileSync)(input.lazyDistribution ? optimized : output2),
16185
+ bytes: (0, import_node_fs19.readFileSync)(input.optimize ? optimized : output2),
16215
16186
  icu: await icu
16216
16187
  };
16217
16188
  if (!options.project) saveCompiledArtifact(root, artifact);
@@ -24868,13 +24839,13 @@ function resolveImport(fromDir, specifier) {
24868
24839
  if ((0, import_node_fs33.existsSync)(candidate)) return candidate;
24869
24840
  return null;
24870
24841
  }
24871
- function standinDigestFiles(srcDir = __sootsim_import_meta_dirname) {
24872
- for (const entry of STANDIN_DIGEST_ENTRYPOINTS)
24842
+ function sourceClosureFiles(srcDir, entrypoints) {
24843
+ for (const entry of entrypoints)
24873
24844
  if (!(0, import_node_fs33.existsSync)(import_node_path34.default.join(srcDir, entry)))
24874
- throw new Error(`stand-in digest entrypoint is missing: ${entry}`);
24845
+ throw new Error(`digest entrypoint is missing: ${entry}`);
24875
24846
  const files2 = [];
24876
24847
  const seen = /* @__PURE__ */ new Set();
24877
- const queue = STANDIN_DIGEST_ENTRYPOINTS.map((file) => import_node_path34.default.join(srcDir, file));
24848
+ const queue = entrypoints.map((file) => import_node_path34.default.join(srcDir, file));
24878
24849
  while (queue.length > 0) {
24879
24850
  const file = queue.pop();
24880
24851
  if (seen.has(file)) continue;
@@ -24889,16 +24860,17 @@ function standinDigestFiles(srcDir = __sootsim_import_meta_dirname) {
24889
24860
  }
24890
24861
  return files2.sort();
24891
24862
  }
24892
- function standinSourceDigest(srcDir = __sootsim_import_meta_dirname) {
24863
+ function sourceClosureDigest(srcDir, entrypoints) {
24893
24864
  const hash = (0, import_node_crypto17.createHash)("sha256");
24894
- for (const file of standinDigestFiles(srcDir)) {
24865
+ for (const file of sourceClosureFiles(srcDir, entrypoints)) {
24895
24866
  const key2 = import_node_path34.default.relative(srcDir, file);
24896
24867
  const bytes = (0, import_node_fs33.readFileSync)(file);
24897
24868
  hash.update(`${Buffer.byteLength(key2)}:${key2}${bytes.length}:`).update(bytes);
24898
24869
  }
24899
24870
  return hash.digest("hex");
24900
24871
  }
24901
- var STANDIN_SOURCE_DIGEST = true ? "9187c18e7a56dd3fd47466df93a74aaf4347e40a79cd9af2fa25d24773004142" : standinSourceDigest();
24872
+ var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
24873
+ var STANDIN_SOURCE_DIGEST = true ? "d2841ceea24055bf080e98e95dfb6f4c4230b62c1f1449d3541fd9a0c7aa4816" : standinSourceDigest();
24902
24874
 
24903
24875
  // src/swift-standins.ts
24904
24876
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
@@ -30555,7 +30527,7 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
30555
30527
  hash.update(JSON.stringify(xcodeProjects().get(packagePath)?.behavior ?? {}));
30556
30528
  const libraries = projects().get(packagePath)?.libraries;
30557
30529
  if (libraries) hash.update(JSON.stringify(libraries));
30558
- if (projects().get(packagePath)?.lazyDistribution) hash.update("lazy-distribution");
30530
+ if (projects().get(packagePath)?.optimize) hash.update("optimize");
30559
30531
  hash.update(JSON.stringify(projects().get(packagePath)?.staticClangTargets ?? []));
30560
30532
  hash.update(JSON.stringify(projects().get(packagePath)?.oneModule ?? true));
30561
30533
  hash.update(JSON.stringify(projects().get(packagePath)?.nativeTargets ?? []));
@@ -30733,7 +30705,7 @@ function packageSnapshot(project, entry, moduleRoot) {
30733
30705
  project.resourceBundles
30734
30706
  ),
30735
30707
  native,
30736
- ...project.lazyDistribution ? { lazyDistribution: true } : {},
30708
+ ...project.optimize ? { optimize: true } : {},
30737
30709
  ...project.staticClangTargets ? { staticClangTargets: project.staticClangTargets } : {},
30738
30710
  ...linked.size > 0 || project.libraries ? {
30739
30711
  libraries: {
@@ -30774,7 +30746,7 @@ function snapshotCompileInput(snapshot) {
30774
30746
  entry: snapshot.entry,
30775
30747
  oneModule: snapshot.oneModule,
30776
30748
  ...snapshot.libraries ? { libraries: snapshot.libraries } : {},
30777
- ...snapshot.lazyDistribution ? { lazyDistribution: true } : {},
30749
+ ...snapshot.optimize ? { optimize: true } : {},
30778
30750
  ...snapshot.staticClangTargets ? { staticClangTargets: snapshot.staticClangTargets } : {}
30779
30751
  };
30780
30752
  return snapshot.glue ? withNativeSourceGlue(input, snapshot.glue) : input;
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1855 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1857 | (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.1855 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1857 | (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.1855 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1857 | (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.1855",
3
+ "version": "0.1.1857",
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",
@@ -0,0 +1,18 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { swiftCompilerSourceDigest } from './swift-compiler-digest'
3
+ import { sourceClosureDigest, sourceClosureFiles } from './swift-standin-digest'
4
+
5
+ // the compilers whose output a published Expo native entry holds
6
+ // (expo-native-prebuilt.ts); their import closure and the Swift compiler
7
+ // sources name the entry, so any edit to them moves its key.
8
+ const ENTRYPOINTS = ['expo-swift-host.ts', 'turbo-bundle.ts']
9
+
10
+ export const expoNativeCompilerFiles = (srcDir: string) =>
11
+ sourceClosureFiles(srcDir, ENTRYPOINTS)
12
+
13
+ export const expoNativeCompilerDigest = (srcDir: string) =>
14
+ createHash('sha256')
15
+ .update(sourceClosureDigest(srcDir, ENTRYPOINTS))
16
+ .update('\0')
17
+ .update(swiftCompilerSourceDigest(srcDir))
18
+ .digest('hex')
@@ -0,0 +1,353 @@
1
+ // a standard Expo app's native build from the prebuilt registry
2
+ // (specs/peach-swift/expo-native-prebuilt.md). preparing an Expo app's native
3
+ // workspace runs prebuild and pod install before the Expo Swift and TurboModule
4
+ // compilers can read it, which is most of a first open. our builder publishes
5
+ // both compilers' outputs for an app under a key of every native input, read
6
+ // before any preparation: Expo's own fingerprint of the app with its identity
7
+ // fields skipped, each native package's version and source tree, the runtime's
8
+ // answered packages, the Swift pin and these compilers' sources. an app whose
9
+ // inputs match fetches one metadata file and loads the published wasm; any
10
+ // other app prepares and compiles as before. identity values stay out of the
11
+ // artifact: an app reads its own from its prebuilt Xcode project.
12
+ import { createHash } from 'node:crypto'
13
+ import fs from 'node:fs'
14
+ import { createRequire } from 'node:module'
15
+ import path from 'node:path'
16
+ import { isDeepStrictEqual } from 'node:util'
17
+ import plist from 'plist'
18
+ import { peachAnsweredNativePackages } from './answeredNativePackages'
19
+ import { expoNativeCompilerDigest } from './expo-native-compiler-digest'
20
+ import {
21
+ prepareExpoNativeProject,
22
+ reactNativePodsEnvironment,
23
+ } from './expo-native-workspace'
24
+ import {
25
+ isExpoSwiftCompilationResult,
26
+ type ExpoSwiftCompilationResult,
27
+ } from './expoSwiftContract'
28
+ import { isRecord } from './is-record'
29
+ import { readNativeAppIdentityFromXcodeTarget } from './native-app-identity-project'
30
+ import {
31
+ NATIVE_PREBUILT_ORIGIN,
32
+ nativeEntryKey,
33
+ nativeEntryPrefix,
34
+ } from './native-prebuilt'
35
+ import { readTurboMetadata, type TurboCompiledModule } from './nitroContract'
36
+ import { packageTreeDigest } from './package-tree-digest'
37
+ import { swiftNativePin } from './swift-native-pin'
38
+ import { readXcodeAppTarget, type XcodeAppTarget } from './xcode-project'
39
+
40
+ export const EXPO_NATIVE_ENTRY_NAME = 'ios'
41
+
42
+ // build-cli replaces this in every bundle with the digest of the sources it
43
+ // bundles; source runs read the files once at load.
44
+ declare const __EXPO_NATIVE_COMPILER_DIGEST__: string | undefined
45
+ export const EXPO_NATIVE_COMPILER_DIGEST =
46
+ typeof __EXPO_NATIVE_COMPILER_DIGEST__ === 'string'
47
+ ? __EXPO_NATIVE_COMPILER_DIGEST__
48
+ : expoNativeCompilerDigest(import.meta.dirname)
49
+
50
+ // upstream's own skips for the values that differ between two copies of one
51
+ // app: versions, names, the bundle id and android package, schemes, the EAS
52
+ // project, icon and splash assets and `extra`. they reach the native build only
53
+ // through the app's identity, which each app reads from its own project.
54
+ const IDENTITY_SOURCE_SKIPS = 1 | 4 | 8 | 16 | 32 | 64 | 128 | 4096
55
+
56
+ type FingerprintSource = {
57
+ type: string
58
+ hash: string | null
59
+ id?: string
60
+ filePath?: string
61
+ contents?: unknown
62
+ }
63
+
64
+ function readSources(value: unknown): FingerprintSource[] {
65
+ const sources = isRecord(value) ? value.sources : null
66
+ if (!Array.isArray(sources)) throw new Error('invalid Expo fingerprint')
67
+ return sources.map((source) => {
68
+ if (
69
+ !isRecord(source) ||
70
+ typeof source.type !== 'string' ||
71
+ (source.hash !== null && typeof source.hash !== 'string')
72
+ )
73
+ throw new Error('invalid Expo fingerprint source')
74
+ return {
75
+ type: source.type,
76
+ hash: source.hash,
77
+ ...(typeof source.id === 'string' ? { id: source.id } : {}),
78
+ ...(typeof source.filePath === 'string' ? { filePath: source.filePath } : {}),
79
+ contents: source.contents,
80
+ }
81
+ })
82
+ }
83
+
84
+ // the package directory a fingerprint source under node_modules belongs to
85
+ function packageRootOf(appRoot: string, file: string): string | null {
86
+ const parts = file.split('/')
87
+ if (parts[0] !== 'node_modules') return null
88
+ const depth = parts[1]?.startsWith('@') ? 3 : 2
89
+ return parts.length > depth ? path.join(appRoot, ...parts.slice(0, depth)) : null
90
+ }
91
+
92
+ /**
93
+ * every input a standard Expo app's native build depends on, or null when the
94
+ * app is not one the registry can serve: it keeps its own ios directory, its
95
+ * Expo has no fingerprint, or its config compiles app-owned inline modules.
96
+ * the compiler digest and the Swift pin are among the inputs, so they name the
97
+ * published entry on their own. `packages` maps each native package to its
98
+ * directory: a hit compares their source trees with the ones the entry was
99
+ * built from, which costs seconds, so a miss never pays it.
100
+ */
101
+ export async function expoNativeInputs(appRoot: string): Promise<{
102
+ inputs: Record<string, string>
103
+ packages: Map<string, string>
104
+ } | null> {
105
+ appRoot = fs.realpathSync(appRoot)
106
+ if (fs.existsSync(path.join(appRoot, 'ios'))) return null
107
+ const appRequire = createRequire(path.join(appRoot, 'package.json'))
108
+ let fingerprintEntry: string
109
+ try {
110
+ fingerprintEntry = appRequire.resolve('@expo/fingerprint', {
111
+ paths: [path.dirname(appRequire.resolve('expo/package.json'))],
112
+ })
113
+ } catch {
114
+ return null
115
+ }
116
+ const fingerprint: unknown = appRequire(fingerprintEntry)
117
+ const create = isRecord(fingerprint) ? fingerprint.createFingerprintAsync : null
118
+ if (typeof create !== 'function') return null
119
+ const sources = readSources(
120
+ await create(appRoot, {
121
+ platforms: ['ios'],
122
+ sourceSkips: IDENTITY_SOURCE_SKIPS,
123
+ debug: true,
124
+ silent: true,
125
+ }),
126
+ )
127
+ const config = sources.find((source) => source.id === 'expoConfig')?.contents
128
+ const experiments =
129
+ typeof config === 'string' ? JSON.parse(config)?.experiments : undefined
130
+ if (isRecord(experiments) && experiments.inlineModules !== undefined) return null
131
+ const packages = new Map<string, string>()
132
+ const lines: string[] = []
133
+ for (const source of sources) {
134
+ lines.push(`${source.type}\0${source.id ?? source.filePath}\0${source.hash}`)
135
+ // older fingerprints hash a native module's directory, newer ones its manifest
136
+ const root =
137
+ (source.type === 'package' || source.type === 'dir') && source.filePath
138
+ ? packageRootOf(appRoot, source.filePath)
139
+ : null
140
+ if (!root) continue
141
+ const manifest: unknown = JSON.parse(
142
+ fs.readFileSync(path.join(root, 'package.json'), 'utf8'),
143
+ )
144
+ if (!isRecord(manifest) || typeof manifest.name !== 'string')
145
+ throw new Error(`${root}: package has no name`)
146
+ packages.set(manifest.name, root)
147
+ }
148
+ packages.set(
149
+ 'react-native',
150
+ path.dirname(appRequire.resolve('react-native/package.json')),
151
+ )
152
+ return {
153
+ inputs: {
154
+ compiler: EXPO_NATIVE_COMPILER_DIGEST,
155
+ 'swift-pin': JSON.stringify(swiftNativePin()),
156
+ answered: JSON.stringify([...peachAnsweredNativePackages()].sort()),
157
+ 'pods-environment': JSON.stringify(reactNativePodsEnvironment()),
158
+ fingerprint: createHash('sha256').update(lines.sort().join('\n')).digest('hex'),
159
+ },
160
+ packages,
161
+ }
162
+ }
163
+
164
+ /** each native package's source tree, as an entry records them. */
165
+ export async function expoNativePackageDigests(
166
+ packages: ReadonlyMap<string, string>,
167
+ ): Promise<Record<string, string>> {
168
+ const names = [...packages.keys()].sort()
169
+ const digests = await Promise.all(
170
+ names.map((name) => packageTreeDigest(packages.get(name)!)),
171
+ )
172
+ return Object.fromEntries(names.map((name, index) => [name, digests[index]!]))
173
+ }
174
+
175
+ export const expoNativeEntryUrl = (key: string, file: string) =>
176
+ `${NATIVE_PREBUILT_ORIGIN}/${nativeEntryPrefix('expo', EXPO_NATIVE_ENTRY_NAME, key)}/${file}`
177
+
178
+ /** what an entry's metadata.json holds: both compilers' results with every url on the registry. */
179
+ export interface ExpoNativeEntry {
180
+ // the Expo Swift result without the app's root id and identity, which the
181
+ // app supplies; `identity` says whether the compiler's result carried one
182
+ expoSwift: ExpoSwiftCompilationResult | null
183
+ identity: boolean
184
+ turbo: TurboCompiledModule | null
185
+ // the source tree of each native package the entry was built from
186
+ packages: Record<string, string>
187
+ // the top-level values pod install writes into the app's own Info.plist
188
+ infoPlist: Record<string, plist.PlistValue>
189
+ }
190
+
191
+ const isStringRecord = (value: unknown): value is Record<string, string> =>
192
+ isRecord(value) && Object.values(value).every((item) => typeof item === 'string')
193
+
194
+ // the json an entry carries: what pod install writes is booleans and strings
195
+ function isPlistValue(value: unknown): value is plist.PlistValue {
196
+ if (
197
+ typeof value === 'string' ||
198
+ typeof value === 'number' ||
199
+ typeof value === 'boolean'
200
+ )
201
+ return true
202
+ if (Array.isArray(value)) return value.every(isPlistValue)
203
+ return isRecord(value) && Object.values(value).every(isPlistValue)
204
+ }
205
+
206
+ const isPlistArray = (value: plist.PlistValue): value is plist.PlistArray =>
207
+ Array.isArray(value)
208
+
209
+ export function parsePlistDictionary(source: string): plist.PlistObject {
210
+ const parsed = plist.parse(source)
211
+ if (
212
+ typeof parsed !== 'object' ||
213
+ isPlistArray(parsed) ||
214
+ parsed instanceof Date ||
215
+ Buffer.isBuffer(parsed)
216
+ )
217
+ throw new Error('Info.plist is not a dictionary')
218
+ return parsed
219
+ }
220
+
221
+ /**
222
+ * the app's processed Info.plist as pod install leaves it: pod install
223
+ * rewrites the file with its values added and every key sorted.
224
+ */
225
+ export function installedInfoPlist(
226
+ prebuilt: string,
227
+ additions: Record<string, plist.PlistValue>,
228
+ ): string {
229
+ const merged = { ...parsePlistDictionary(prebuilt), ...additions }
230
+ return plist.build(
231
+ Object.fromEntries(
232
+ Object.keys(merged)
233
+ .sort()
234
+ .map((key) => [key, merged[key]!]),
235
+ ),
236
+ )
237
+ }
238
+
239
+ export function readExpoNativeEntry(value: unknown): ExpoNativeEntry | null {
240
+ if (!isRecord(value) || typeof value.identity !== 'boolean') return null
241
+ if (!isStringRecord(value.packages) || !isRecord(value.infoPlist)) return null
242
+ const expoSwift = value.expoSwift === null ? null : value.expoSwift
243
+ if (expoSwift !== null && !isExpoSwiftCompilationResult(expoSwift)) return null
244
+ const turbo = value.turbo === null ? null : readTurboMetadata(value.turbo)
245
+ if (value.turbo !== null && !turbo) return null
246
+ const infoPlist: Record<string, plist.PlistValue> = {}
247
+ for (const [key, item] of Object.entries(value.infoPlist)) {
248
+ if (!isPlistValue(item)) return null
249
+ infoPlist[key] = item
250
+ }
251
+ return {
252
+ expoSwift,
253
+ identity: value.identity,
254
+ turbo,
255
+ packages: value.packages,
256
+ infoPlist,
257
+ }
258
+ }
259
+
260
+ // one process asks for each key once: an entry never changes, and the builder
261
+ // publishes a missing one for later processes.
262
+ const published = new Map<string, Promise<ExpoNativeEntry | null>>()
263
+ // the Expo Swift and TurboModule requests of one open look the app up together.
264
+ const lookups = new Map<string, Promise<ExpoNativeEntry | null>>()
265
+
266
+ async function lookup(appRoot: string): Promise<ExpoNativeEntry | null> {
267
+ const app = await expoNativeInputs(appRoot)
268
+ if (!app) return null
269
+ const url = expoNativeEntryUrl(nativeEntryKey(app.inputs), 'metadata.json')
270
+ let pending = published.get(url)
271
+ if (!pending) {
272
+ pending = fetch(url)
273
+ .then(async (response) =>
274
+ response.ok ? readExpoNativeEntry(await response.json()) : null,
275
+ )
276
+ .catch(() => null)
277
+ published.set(url, pending)
278
+ }
279
+ const entry = await pending
280
+ if (!entry) return null
281
+ const digests = await expoNativePackageDigests(app.packages)
282
+ return isDeepStrictEqual(digests, entry.packages) ? entry : null
283
+ }
284
+
285
+ /**
286
+ * the published native build for an app, or null when the app is not a
287
+ * standard one, its packages' sources differ from the entry's, or our builder
288
+ * has not published its key. a network failure is a miss: the local route that
289
+ * follows reports its own failures.
290
+ */
291
+ export function prebuiltExpoNative(
292
+ appRoot: string,
293
+ iosTarget: string | undefined,
294
+ ): Promise<ExpoNativeEntry | null> {
295
+ if (iosTarget !== undefined) return Promise.resolve(null)
296
+ const root = fs.realpathSync(appRoot)
297
+ let pending = lookups.get(root)
298
+ if (!pending) {
299
+ pending = lookup(root).finally(() => lookups.delete(root))
300
+ lookups.set(root, pending)
301
+ }
302
+ return pending
303
+ }
304
+
305
+ /** the app target prebuild alone writes, which a hit reads the app's own values from. */
306
+ export async function prebuiltAppTarget(
307
+ appRoot: string,
308
+ signal?: AbortSignal,
309
+ ): Promise<XcodeAppTarget> {
310
+ const prepared = await prepareExpoNativeProject(fs.realpathSync(appRoot), signal)
311
+ const ios = path.join(prepared.app, 'ios')
312
+ const projects = fs.readdirSync(ios).filter((name) => name.endsWith('.xcodeproj'))
313
+ if (projects.length !== 1) throw new Error(`expected one Xcode project in ${ios}`)
314
+ return readXcodeAppTarget(path.join(ios, projects[0]!), undefined, 'Debug', {
315
+ requireSources: false,
316
+ })
317
+ }
318
+
319
+ /** the Expo Swift result an entry serves an app, with its own root id, identity and Info.plist. */
320
+ export function servedExpoSwift(
321
+ appRoot: string,
322
+ entry: ExpoNativeEntry,
323
+ app: XcodeAppTarget,
324
+ ): ExpoSwiftCompilationResult | null {
325
+ if (!entry.expoSwift) return null
326
+ const rootId = `${createHash('sha256').update(fs.realpathSync(appRoot)).digest('hex')}/Expo`
327
+ if (app.infoPlist === null) throw new Error('the prebuilt app target has no Info.plist')
328
+ const infoPlist = Buffer.from(
329
+ installedInfoPlist(app.infoPlist, entry.infoPlist),
330
+ ).toString('base64')
331
+ return {
332
+ ...entry.expoSwift,
333
+ ...(entry.identity
334
+ ? { nativeAppIdentity: readNativeAppIdentityFromXcodeTarget(app) }
335
+ : {}),
336
+ modules: entry.expoSwift.modules.map((module) => ({
337
+ ...module,
338
+ rootId,
339
+ bundleFiles: { 'Info.plist': infoPlist, ...module.bundleFiles },
340
+ })),
341
+ }
342
+ }
343
+
344
+ export async function prebuiltExpoSwiftResult(
345
+ appRoot: string,
346
+ entry: ExpoNativeEntry,
347
+ signal?: AbortSignal,
348
+ ): Promise<ExpoSwiftCompilationResult | null> {
349
+ if (!entry.expoSwift) return null
350
+ // an entry that links nothing and carries no identity needs nothing from the app
351
+ if (entry.expoSwift.modules.length === 0 && !entry.identity) return entry.expoSwift
352
+ return servedExpoSwift(appRoot, entry, await prebuiltAppTarget(appRoot, signal))
353
+ }