peachsim 0.1.1635 → 0.1.1640

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 (129) hide show
  1. package/README.md +5 -1
  2. package/cli/app-config.ts +14 -5
  3. package/cli/app-stubs.ts +62 -13
  4. package/cli/bridge-flow-runner.ts +2 -2
  5. package/cli/cloud-client.ts +60 -40
  6. package/cli/commands/doctor.ts +13 -5
  7. package/cli/commands/flow.ts +1 -1
  8. package/cli/commands/inspect/shared.ts +9 -4
  9. package/cli/commands/inspect.ts +65 -47
  10. package/cli/commands/preview.ts +1 -1
  11. package/cli/commands/record.ts +97 -47
  12. package/cli/commands/swift.ts +9 -3
  13. package/cli/commands/upload.ts +48 -42
  14. package/cli/drivers/playwright-sim-host.ts +65 -42
  15. package/cli/main.ts +1 -1
  16. package/cli/outbound-endpoints.ts +7 -5
  17. package/cli/pause-aware-timeout.ts +4 -0
  18. package/cli/ws-bridge.ts +19 -10
  19. package/detox/attempt-events.cjs +62 -5
  20. package/detox/attempt-events.d.cts +7 -0
  21. package/detox/expectations.ts +7 -3
  22. package/detox/index.ts +121 -47
  23. package/detox/motion-change.cjs +170 -21
  24. package/detox/motion-change.d.cts +32 -0
  25. package/detox/navigation-lifecycle.ts +35 -3
  26. package/dist-lib/agent-daemon-client.cjs +1 -1
  27. package/dist-lib/agent-events.cjs +1 -1
  28. package/dist-lib/attached-projects.cjs +1 -1
  29. package/dist-lib/auth/shared-session.cjs +1 -1
  30. package/dist-lib/backend-origin.cjs +8 -7
  31. package/dist-lib/beta.cjs +1 -1
  32. package/dist-lib/beta.mjs +1 -1
  33. package/dist-lib/bridge-constants.cjs +1 -1
  34. package/dist-lib/bridge-contract-input.cjs +1 -1
  35. package/dist-lib/bridge-contract-input.mjs +1 -1
  36. package/dist-lib/bridge-contract.cjs +1 -1
  37. package/dist-lib/bridge-contract.mjs +1 -1
  38. package/dist-lib/bundle-channel.cjs +4038 -1983
  39. package/dist-lib/capture-contract.cjs +1 -1
  40. package/dist-lib/capture-contract.mjs +1 -1
  41. package/dist-lib/cloud-contract.cjs +1 -1
  42. package/dist-lib/cloud-contract.mjs +1 -1
  43. package/dist-lib/cloud-test-args.cjs +1 -1
  44. package/dist-lib/cloud-test-args.mjs +1 -1
  45. package/dist-lib/cloud.cjs +1 -1
  46. package/dist-lib/cloud.mjs +1 -1
  47. package/dist-lib/config.cjs +1 -1
  48. package/dist-lib/config.mjs +1 -1
  49. package/dist-lib/detox/index.cjs +509 -86
  50. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  51. package/dist-lib/expo-swift-bundle.cjs +3551 -1574
  52. package/dist-lib/expo-swift-metadata.cjs +9 -7
  53. package/dist-lib/expo-swift-metadata.mjs +9 -7
  54. package/dist-lib/home-paths.cjs +1 -1
  55. package/dist-lib/host/bridge-host.cjs +43633 -2635
  56. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  57. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  58. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  59. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  60. package/dist-lib/host/websocket-proxy.cjs +1 -1
  61. package/dist-lib/index.cjs +2748 -128
  62. package/dist-lib/jump-to-source-babel.cjs +1 -1
  63. package/dist-lib/jump-to-source-native.cjs +1 -1
  64. package/dist-lib/kotlin-host.cjs +1 -1
  65. package/dist-lib/menu.cjs +1 -1
  66. package/dist-lib/menu.mjs +1 -1
  67. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  68. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  69. package/dist-lib/metro-production-bundle.cjs +1 -1
  70. package/dist-lib/metro-production-bundle.mjs +1 -1
  71. package/dist-lib/metro.cjs +2547 -83
  72. package/dist-lib/native-app-identity-project.cjs +237 -50
  73. package/dist-lib/native-app-identity-project.mjs +237 -50
  74. package/dist-lib/native-app-identity.cjs +29 -30
  75. package/dist-lib/native-app-identity.mjs +29 -30
  76. package/dist-lib/native-firebase-metadata.cjs +1 -1
  77. package/dist-lib/native-firebase-metadata.mjs +1 -1
  78. package/dist-lib/plist.cjs +1 -1
  79. package/dist-lib/plist.mjs +1 -1
  80. package/dist-lib/profiles.cjs +1 -1
  81. package/dist-lib/public-brand.cjs +1 -1
  82. package/dist-lib/react-native-host-modules.cjs +2 -2
  83. package/dist-lib/react-native-host-modules.mjs +2 -2
  84. package/dist-lib/scripts/dev-server-scanner.cjs +8 -6
  85. package/dist-lib/sdk.cjs +1 -1
  86. package/dist-lib/sdk.mjs +1 -1
  87. package/dist-lib/skills.cjs +65403 -22739
  88. package/dist-lib/swift-compile.cjs +93 -32
  89. package/dist-lib/swift-compile.mjs +93 -32
  90. package/dist-lib/swift-package.cjs +1 -1
  91. package/dist-lib/swift-package.mjs +1 -1
  92. package/dist-lib/swift-submit.cjs +7 -5
  93. package/dist-lib/swift-submit.mjs +7 -5
  94. package/dist-lib/swift-toolchain.cjs +316 -41
  95. package/dist-lib/swift.cjs +1 -1
  96. package/dist-lib/vite-swift.cjs +7335 -5432
  97. package/dist-lib/vite.cjs +2857 -12
  98. package/dist-lib/worklet-executable.cjs +14 -2
  99. package/dist-lib/worklet-executable.mjs +14 -2
  100. package/package.json +1 -1
  101. package/src/backend-origin.ts +13 -6
  102. package/src/expo-swift-host.ts +5 -2
  103. package/src/expoKotlinContract.ts +4 -7
  104. package/src/expoSwiftContract.ts +4 -6
  105. package/src/host/staged-host-files.ts +9 -0
  106. package/src/native-app-identity-project.ts +1 -4
  107. package/src/native-app-identity.ts +1 -4
  108. package/src/nativeAppIconContract.ts +1 -4
  109. package/src/output-lock-stdio.ts +36 -0
  110. package/src/react-native-bridge-modules.ts +21 -6
  111. package/src/react-native-host-modules.ts +4 -1
  112. package/src/settings-bundle.ts +1 -4
  113. package/src/swift-compile.ts +91 -33
  114. package/src/swift-distribution.lock.json +22 -12
  115. package/src/swift-distribution.ts +103 -4
  116. package/src/swift-host.ts +89 -26
  117. package/src/swift-icu.ts +16 -10
  118. package/src/swift-objc-compile.ts +355 -0
  119. package/src/swift-objc-sdk.ts +689 -18
  120. package/src/swift-objc-standin.ts +126 -14
  121. package/src/swift-package-manifest.ts +39 -1
  122. package/src/swift-packages.ts +35 -21
  123. package/src/swift-standin-emit.ts +40 -7
  124. package/src/swift-standins.ts +404 -138
  125. package/src/swift-submit.ts +3 -5
  126. package/src/swift-toolchain.ts +378 -46
  127. package/src/worker-system-chunks.ts +11 -12
  128. package/src/worklet-executable.ts +19 -1
  129. package/src/xcode-project.ts +270 -30
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1640 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -57,6 +57,7 @@ __export(swift_compile_exports, {
57
57
  swiftModuleInputFiles: () => swiftModuleInputFiles,
58
58
  swiftModuleSdk: () => swiftModuleSdk,
59
59
  swiftPeachModules: () => swiftPeachModules,
60
+ swiftProjectBuildKey: () => swiftProjectBuildKey,
60
61
  swiftSdkPaths: () => swiftSdkPaths,
61
62
  swiftSourceAsIOS: () => swiftSourceAsIOS,
62
63
  swiftSourceClosure: () => swiftSourceClosure,
@@ -867,6 +868,12 @@ function swiftSdkOptions() {
867
868
  const directory = process.env.PEACH_SWIFT_SDKS_PATH;
868
869
  return directory ? ["--swift-sdks-path", import_node_path3.default.resolve(directory)] : [];
869
870
  }
871
+ var scratch;
872
+ var swiftHome;
873
+ function swiftEnvironment(base = process.env) {
874
+ if (!scratch) return base;
875
+ return swiftHome ? { ...base, TMPDIR: scratch, HOME: swiftHome } : { ...base, TMPDIR: scratch };
876
+ }
870
877
 
871
878
  // src/swift-icu.ts
872
879
  var run = (0, import_node_util.promisify)(import_node_child_process3.execFile);
@@ -905,17 +912,23 @@ async function load(toolchainBin, sdk) {
905
912
  const swift = import_node_path4.default.join(toolchainBin, "swift");
906
913
  if (!(0, import_node_fs2.existsSync)(swift))
907
914
  throw new Error(`swift-icu: no swift at ${swift} for the ${sdk} SDK's icu data`);
908
- const { stdout: listed } = await run(swift, ["sdk", "list", ...swiftSdkOptions()]);
915
+ const { stdout: listed } = await run(swift, ["sdk", "list", ...swiftSdkOptions()], {
916
+ env: swiftEnvironment()
917
+ });
909
918
  if (!listed.split("\n").some((line) => line.trim() === sdk))
910
919
  throw new Error(`swift-icu: ${sdk} is not installed for ${swift}`);
911
- const { stdout } = await run(swift, [
912
- "sdk",
913
- "configure",
914
- ...swiftSdkOptions(),
915
- "--show-configuration",
916
- sdk,
917
- "wasm32-unknown-wasip1"
918
- ]);
920
+ const { stdout } = await run(
921
+ swift,
922
+ [
923
+ "sdk",
924
+ "configure",
925
+ ...swiftSdkOptions(),
926
+ "--show-configuration",
927
+ sdk,
928
+ "wasm32-unknown-wasip1"
929
+ ],
930
+ { env: swiftEnvironment() }
931
+ );
919
932
  const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
920
933
  if (!resources) throw new Error(`swift-icu: ${sdk} names no static resources`);
921
934
  return Buffer.from(
@@ -1177,12 +1190,12 @@ function isSwiftResourceBundles(value) {
1177
1190
  }
1178
1191
 
1179
1192
  // src/swift-compile.ts
1180
- async function runCompiler(command, args, options, stream = false) {
1193
+ async function runCompiler(command, args, options, stream = false, quiet) {
1181
1194
  const { signal } = options;
1182
1195
  signal?.throwIfAborted();
1183
1196
  const child = (0, import_node_child_process4.spawn)(command, args, {
1184
1197
  cwd: options.cwd,
1185
- env: options.env,
1198
+ env: swiftEnvironment(options.env),
1186
1199
  detached: true,
1187
1200
  stdio: ["ignore", "pipe", "pipe"]
1188
1201
  });
@@ -1193,6 +1206,7 @@ async function runCompiler(command, args, options, stream = false) {
1193
1206
  let timeout;
1194
1207
  const chunks = { stdout: [], stderr: [] };
1195
1208
  const sizes = { stdout: 0, stderr: 0 };
1209
+ const partial = { stdout: "", stderr: "" };
1196
1210
  const stop = () => {
1197
1211
  stopping ??= terminateProcessGroup(child);
1198
1212
  void stopping.catch(() => {
@@ -1200,7 +1214,14 @@ async function runCompiler(command, args, options, stream = false) {
1200
1214
  };
1201
1215
  for (const name of ["stdout", "stderr"]) {
1202
1216
  child[name].on("data", (bytes) => {
1203
- if (stream) process[name].write(bytes);
1217
+ if (stream === true) process[name].write(bytes);
1218
+ else if (stream) {
1219
+ const lines = (partial[name] + bytes.toString()).split("\n");
1220
+ partial[name] = lines.pop();
1221
+ for (const line of lines)
1222
+ if (stream.test(line)) process[name].write(`${line}
1223
+ `);
1224
+ }
1204
1225
  sizes[name] += bytes.length;
1205
1226
  if (sizes[name] <= (options.maxBuffer ?? 1024 * 1024)) chunks[name].push(bytes);
1206
1227
  else {
@@ -1230,7 +1251,15 @@ async function runCompiler(command, args, options, stream = false) {
1230
1251
  }
1231
1252
  )
1232
1253
  );
1233
- else resolve();
1254
+ else {
1255
+ if (quiet) {
1256
+ for (const name of ["stdout", "stderr"])
1257
+ for (const line of Buffer.concat(chunks[name]).toString().split("\n"))
1258
+ if (line && !quiet.test(line)) process[name].write(`${line}
1259
+ `);
1260
+ }
1261
+ resolve();
1262
+ }
1234
1263
  });
1235
1264
  if (options.timeout)
1236
1265
  timeout = setTimeout(() => {
@@ -1244,6 +1273,8 @@ async function runCompiler(command, args, options, stream = false) {
1244
1273
  }
1245
1274
  }
1246
1275
  var WASM_TRIPLE = "wasm32-unknown-wasip1";
1276
+ var SWIFTPM_PROGRESS = /^\[\d+\/\d+\] /;
1277
+ var SWIFTPM_NOISE = /^(?:\[\d+\/\d+\] |Building for production\.\.\.$|warning: '--build-system native' has been deprecated)/;
1247
1278
  var BUILD_JOBS = String(
1248
1279
  Math.min(4, Math.max(1, Math.floor(import_node_os3.default.availableParallelism() / 2)))
1249
1280
  );
@@ -1269,6 +1300,10 @@ function swiftModuleInputFiles(root) {
1269
1300
  "scripts/contrast-app-Package.swift",
1270
1301
  "scripts/build-distribution.ts",
1271
1302
  "scripts/distribution-clang.ts",
1303
+ "scripts/distribution-libxml2.ts",
1304
+ "scripts/distribution-libxml2.json",
1305
+ "Sources/libxml2/include/module.modulemap",
1306
+ "Sources/libxml2/COPYING",
1272
1307
  "scripts/build-distribution-plugins.sh",
1273
1308
  "scripts/build-distribution-plugins-docker.sh",
1274
1309
  "scripts/build-preview-plugin.sh",
@@ -1305,17 +1340,27 @@ function swiftMacroPlugins(moduleRoot) {
1305
1340
  const plugins = [
1306
1341
  {
1307
1342
  library: import_node_path5.default.join(dir, `libRnxPreviewMacros.${ext}`),
1308
- source: import_node_path5.default.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")
1343
+ sources: [import_node_path5.default.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")]
1309
1344
  },
1310
1345
  {
1311
1346
  library: import_node_path5.default.join(dir, `libFoundationMacros.${ext}`),
1312
- source: import_node_path5.default.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift")
1347
+ sources: [
1348
+ import_node_path5.default.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift"),
1349
+ import_node_path5.default.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
1350
+ ]
1351
+ },
1352
+ {
1353
+ library: import_node_path5.default.join(dir, `libTipKitMacros.${ext}`),
1354
+ sources: [
1355
+ import_node_path5.default.join(moduleRoot, "Sources/TipKitMacros/TipKitMacros.swift"),
1356
+ import_node_path5.default.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
1357
+ ]
1313
1358
  }
1314
1359
  ];
1315
1360
  return {
1316
1361
  libraries: plugins.map(({ library }) => library),
1317
1362
  stale: !(0, import_node_fs3.existsSync)(compilerStamp) || (0, import_node_fs3.readFileSync)(compilerStamp, "utf8").trim() !== release || plugins.some(
1318
- ({ library, source }) => !(0, import_node_fs3.existsSync)(library) || (0, import_node_fs3.statSync)(source).mtimeMs > (0, import_node_fs3.statSync)(library).mtimeMs
1363
+ ({ library, sources }) => !(0, import_node_fs3.existsSync)(library) || sources.some((source) => (0, import_node_fs3.statSync)(source).mtimeMs > (0, import_node_fs3.statSync)(library).mtimeMs)
1319
1364
  )
1320
1365
  };
1321
1366
  }
@@ -1369,6 +1414,9 @@ function swiftModuleDigest(root) {
1369
1414
  linkedModuleDigests.set(root, { stamp, digest });
1370
1415
  return digest;
1371
1416
  }
1417
+ function swiftProjectBuildKey(moduleRoot, release) {
1418
+ return (0, import_node_crypto2.createHash)("sha256").update(`${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).update(swiftModuleDigest(moduleRoot)).digest("hex").slice(0, 32);
1419
+ }
1372
1420
  function compileTargets(input) {
1373
1421
  const manifest = input.files["Package.swift"];
1374
1422
  return manifest === void 0 ? [] : swiftPackagePartition(manifest, input.resourcePaths);
@@ -1396,11 +1444,13 @@ var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
1396
1444
  Accelerate: [],
1397
1445
  CryptoKit: [],
1398
1446
  CommonCrypto: [],
1447
+ ImagePlayground: [],
1448
+ QuickLookThumbnailing: [],
1449
+ libxml2: [],
1399
1450
  CoreText: [],
1400
1451
  Compression: ["PeachCodec"],
1401
1452
  zlib: ["PeachCodec"],
1402
1453
  PeachCodec: [],
1403
- Security: ["CryptoKit"],
1404
1454
  TikTokBusinessSDK: [],
1405
1455
  nSure: [],
1406
1456
  Statsig: [],
@@ -1527,7 +1577,7 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
1527
1577
  sdk,
1528
1578
  "wasm32-unknown-wasip1"
1529
1579
  ],
1530
- { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
1580
+ { encoding: "utf8", env: swiftEnvironment(), stdio: ["ignore", "pipe", "pipe"] }
1531
1581
  );
1532
1582
  const field = (name) => {
1533
1583
  const value = new RegExp(`^${name}:\\s*(.+)$`, "m").exec(configuration)?.[1]?.trim();
@@ -1620,7 +1670,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
1620
1670
  `;
1621
1671
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
1622
1672
  var MULTI_MANIFEST_VERSION = 39;
1623
- var compilerSourceDigest = true ? "fe15160b7f10d0c1ea06e54dc06a1de4d770f6f968e547bd41bd11fc6f5dbd8f" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
1673
+ var compilerSourceDigest = true ? "0c614fef8e4e656ac3500002f7d1f2746f20f462321142e2f69a93e94f2321c4" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
1624
1674
  function swiftArtifactHash(input, release, moduleRoot) {
1625
1675
  const hash = (0, import_node_crypto2.createHash)("sha256");
1626
1676
  hash.update(`swift-compile
@@ -2255,19 +2305,24 @@ function objcRootedClasses(sources) {
2255
2305
  function hideObjCClassesFromCxx(source, rooted) {
2256
2306
  if (rooted.size === 0) return source;
2257
2307
  const code = swiftCodeMask(source);
2258
- const starts = [];
2308
+ const insertions = [];
2259
2309
  let depth = 0;
2260
2310
  for (const match of code.matchAll(
2261
2311
  /[{}]|\bclass\s+(?!(?:func|var|let|subscript)\b)([A-Za-z_]\w*)/g
2262
2312
  )) {
2263
2313
  if (match[0] === "{") depth++;
2264
2314
  else if (match[0] === "}") depth--;
2265
- else if (depth === 0 && rooted.has(match[1]))
2266
- starts.push(declarationStart(code, match.index, 0));
2315
+ else if (depth === 0 && rooted.has(match[1])) {
2316
+ const start = declarationStart(code, match.index, 0);
2317
+ const main = /@main\b/.exec(code.slice(start, match.index));
2318
+ insertions.push(
2319
+ main ? { at: start + main.index + main[0].length, text: " @_expose(!Cxx)" } : { at: start, text: "@_expose(!Cxx) " }
2320
+ );
2321
+ }
2267
2322
  }
2268
2323
  let out = source;
2269
- for (const at of starts.reverse())
2270
- out = `${out.slice(0, at)}@_expose(!Cxx) ${out.slice(at)}`;
2324
+ for (const { at, text: text2 } of insertions.reverse())
2325
+ out = `${out.slice(0, at)}${text2}${out.slice(at)}`;
2271
2326
  return out;
2272
2327
  }
2273
2328
  function lowerAnyObjectDoubleValue(source) {
@@ -5944,7 +5999,7 @@ function builtArtifact(layout) {
5944
5999
  function projectDiagnostic(output, layout, files) {
5945
6000
  const base = layout.multi ? layout.root : layout.sources;
5946
6001
  const prefix = `${base}${import_node_path5.default.sep}`;
5947
- return designTimeDiagnostic(output, files).split("\n").map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
6002
+ return designTimeDiagnostic(output, files).split("\n").filter((line) => !SWIFTPM_NOISE.test(line)).map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
5948
6003
  }
5949
6004
  var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
5950
6005
  var host = globalThis;
@@ -6067,10 +6122,9 @@ function compileSwiftProjectUnit(input, options) {
6067
6122
  hash,
6068
6123
  release: options.release,
6069
6124
  timeoutMs: options.timeoutMs,
6070
- // the builder's swiftpm tree holds the sootsim-swift objects, which
6071
- // depend on the toolchain and sdk and not on the caller's checkout
6072
- // path, so every caller shares one warm tree per toolchain.
6073
- buildKey: (0, import_node_crypto2.createHash)("sha256").update(`${options.release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).digest("hex").slice(0, 32)
6125
+ // framework sources and compiler inputs own the shared object tree;
6126
+ // unrelated app edits reuse it without retaining stale private ABI.
6127
+ buildKey: swiftProjectBuildKey(moduleRoot, options.release)
6074
6128
  })
6075
6129
  );
6076
6130
  try {
@@ -6171,7 +6225,7 @@ function compileSwiftProjectUnit(input, options) {
6171
6225
  };
6172
6226
  report("compiling and linking Swift modules");
6173
6227
  try {
6174
- await runCompiler(swift, buildArgs, buildOptions, true);
6228
+ await runCompiler(swift, buildArgs, buildOptions, SWIFTPM_PROGRESS, SWIFTPM_NOISE);
6175
6229
  } catch (error) {
6176
6230
  const output = outputOf(error);
6177
6231
  const moduleCache = import_node_path5.default.join(
@@ -6184,7 +6238,13 @@ function compileSwiftProjectUnit(input, options) {
6184
6238
  if (output.includes("was compiled with module cache path") && (0, import_node_fs3.existsSync)(moduleCache)) {
6185
6239
  (0, import_node_fs3.rmSync)(moduleCache, { recursive: true, force: true });
6186
6240
  try {
6187
- await runCompiler(swift, buildArgs, buildOptions, true);
6241
+ await runCompiler(
6242
+ swift,
6243
+ buildArgs,
6244
+ buildOptions,
6245
+ SWIFTPM_PROGRESS,
6246
+ SWIFTPM_NOISE
6247
+ );
6188
6248
  } catch (retryError) {
6189
6249
  throw new Error(
6190
6250
  projectDiagnostic(outputOf(retryError), layout, input.files),
@@ -6239,6 +6299,7 @@ function compileSwiftProjectUnit(input, options) {
6239
6299
  swiftModuleInputFiles,
6240
6300
  swiftModuleSdk,
6241
6301
  swiftPeachModules,
6302
+ swiftProjectBuildKey,
6242
6303
  swiftSdkPaths,
6243
6304
  swiftSourceAsIOS,
6244
6305
  swiftSourceClosure,
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1640 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/swift-compile.ts
4
4
  import { spawn as spawn2, execFileSync as execFileSync2 } from "node:child_process";
@@ -828,10 +828,17 @@ import { createHash as createHash2 } from "node:crypto";
828
828
  import fs2 from "node:fs";
829
829
  import os from "node:os";
830
830
  import path3 from "node:path";
831
+ import { fileURLToPath } from "node:url";
831
832
  function swiftSdkOptions() {
832
833
  const directory = process.env.PEACH_SWIFT_SDKS_PATH;
833
834
  return directory ? ["--swift-sdks-path", path3.resolve(directory)] : [];
834
835
  }
836
+ var scratch;
837
+ var swiftHome;
838
+ function swiftEnvironment(base = process.env) {
839
+ if (!scratch) return base;
840
+ return swiftHome ? { ...base, TMPDIR: scratch, HOME: swiftHome } : { ...base, TMPDIR: scratch };
841
+ }
835
842
 
836
843
  // src/swift-icu.ts
837
844
  var run = promisify(execFile);
@@ -870,17 +877,23 @@ async function load(toolchainBin, sdk) {
870
877
  const swift = path4.join(toolchainBin, "swift");
871
878
  if (!existsSync(swift))
872
879
  throw new Error(`swift-icu: no swift at ${swift} for the ${sdk} SDK's icu data`);
873
- const { stdout: listed } = await run(swift, ["sdk", "list", ...swiftSdkOptions()]);
880
+ const { stdout: listed } = await run(swift, ["sdk", "list", ...swiftSdkOptions()], {
881
+ env: swiftEnvironment()
882
+ });
874
883
  if (!listed.split("\n").some((line) => line.trim() === sdk))
875
884
  throw new Error(`swift-icu: ${sdk} is not installed for ${swift}`);
876
- const { stdout } = await run(swift, [
877
- "sdk",
878
- "configure",
879
- ...swiftSdkOptions(),
880
- "--show-configuration",
881
- sdk,
882
- "wasm32-unknown-wasip1"
883
- ]);
885
+ const { stdout } = await run(
886
+ swift,
887
+ [
888
+ "sdk",
889
+ "configure",
890
+ ...swiftSdkOptions(),
891
+ "--show-configuration",
892
+ sdk,
893
+ "wasm32-unknown-wasip1"
894
+ ],
895
+ { env: swiftEnvironment() }
896
+ );
884
897
  const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
885
898
  if (!resources) throw new Error(`swift-icu: ${sdk} names no static resources`);
886
899
  return Buffer.from(
@@ -1142,12 +1155,12 @@ function isSwiftResourceBundles(value) {
1142
1155
  }
1143
1156
 
1144
1157
  // src/swift-compile.ts
1145
- async function runCompiler(command, args, options, stream = false) {
1158
+ async function runCompiler(command, args, options, stream = false, quiet) {
1146
1159
  const { signal } = options;
1147
1160
  signal?.throwIfAborted();
1148
1161
  const child = spawn2(command, args, {
1149
1162
  cwd: options.cwd,
1150
- env: options.env,
1163
+ env: swiftEnvironment(options.env),
1151
1164
  detached: true,
1152
1165
  stdio: ["ignore", "pipe", "pipe"]
1153
1166
  });
@@ -1158,6 +1171,7 @@ async function runCompiler(command, args, options, stream = false) {
1158
1171
  let timeout;
1159
1172
  const chunks = { stdout: [], stderr: [] };
1160
1173
  const sizes = { stdout: 0, stderr: 0 };
1174
+ const partial = { stdout: "", stderr: "" };
1161
1175
  const stop = () => {
1162
1176
  stopping ?? (stopping = terminateProcessGroup(child));
1163
1177
  void stopping.catch(() => {
@@ -1165,7 +1179,14 @@ async function runCompiler(command, args, options, stream = false) {
1165
1179
  };
1166
1180
  for (const name of ["stdout", "stderr"]) {
1167
1181
  child[name].on("data", (bytes) => {
1168
- if (stream) process[name].write(bytes);
1182
+ if (stream === true) process[name].write(bytes);
1183
+ else if (stream) {
1184
+ const lines = (partial[name] + bytes.toString()).split("\n");
1185
+ partial[name] = lines.pop();
1186
+ for (const line of lines)
1187
+ if (stream.test(line)) process[name].write(`${line}
1188
+ `);
1189
+ }
1169
1190
  sizes[name] += bytes.length;
1170
1191
  if (sizes[name] <= (options.maxBuffer ?? 1024 * 1024)) chunks[name].push(bytes);
1171
1192
  else {
@@ -1195,7 +1216,15 @@ async function runCompiler(command, args, options, stream = false) {
1195
1216
  }
1196
1217
  )
1197
1218
  );
1198
- else resolve();
1219
+ else {
1220
+ if (quiet) {
1221
+ for (const name of ["stdout", "stderr"])
1222
+ for (const line of Buffer.concat(chunks[name]).toString().split("\n"))
1223
+ if (line && !quiet.test(line)) process[name].write(`${line}
1224
+ `);
1225
+ }
1226
+ resolve();
1227
+ }
1199
1228
  });
1200
1229
  if (options.timeout)
1201
1230
  timeout = setTimeout(() => {
@@ -1209,6 +1238,8 @@ async function runCompiler(command, args, options, stream = false) {
1209
1238
  }
1210
1239
  }
1211
1240
  var WASM_TRIPLE = "wasm32-unknown-wasip1";
1241
+ var SWIFTPM_PROGRESS = /^\[\d+\/\d+\] /;
1242
+ var SWIFTPM_NOISE = /^(?:\[\d+\/\d+\] |Building for production\.\.\.$|warning: '--build-system native' has been deprecated)/;
1212
1243
  var BUILD_JOBS = String(
1213
1244
  Math.min(4, Math.max(1, Math.floor(os2.availableParallelism() / 2)))
1214
1245
  );
@@ -1234,6 +1265,10 @@ function swiftModuleInputFiles(root) {
1234
1265
  "scripts/contrast-app-Package.swift",
1235
1266
  "scripts/build-distribution.ts",
1236
1267
  "scripts/distribution-clang.ts",
1268
+ "scripts/distribution-libxml2.ts",
1269
+ "scripts/distribution-libxml2.json",
1270
+ "Sources/libxml2/include/module.modulemap",
1271
+ "Sources/libxml2/COPYING",
1237
1272
  "scripts/build-distribution-plugins.sh",
1238
1273
  "scripts/build-distribution-plugins-docker.sh",
1239
1274
  "scripts/build-preview-plugin.sh",
@@ -1270,17 +1305,27 @@ function swiftMacroPlugins(moduleRoot) {
1270
1305
  const plugins = [
1271
1306
  {
1272
1307
  library: path5.join(dir, `libRnxPreviewMacros.${ext}`),
1273
- source: path5.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")
1308
+ sources: [path5.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")]
1274
1309
  },
1275
1310
  {
1276
1311
  library: path5.join(dir, `libFoundationMacros.${ext}`),
1277
- source: path5.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift")
1312
+ sources: [
1313
+ path5.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift"),
1314
+ path5.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
1315
+ ]
1316
+ },
1317
+ {
1318
+ library: path5.join(dir, `libTipKitMacros.${ext}`),
1319
+ sources: [
1320
+ path5.join(moduleRoot, "Sources/TipKitMacros/TipKitMacros.swift"),
1321
+ path5.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
1322
+ ]
1278
1323
  }
1279
1324
  ];
1280
1325
  return {
1281
1326
  libraries: plugins.map(({ library }) => library),
1282
1327
  stale: !existsSync2(compilerStamp) || readFileSync4(compilerStamp, "utf8").trim() !== release || plugins.some(
1283
- ({ library, source }) => !existsSync2(library) || statSync(source).mtimeMs > statSync(library).mtimeMs
1328
+ ({ library, sources }) => !existsSync2(library) || sources.some((source) => statSync(source).mtimeMs > statSync(library).mtimeMs)
1284
1329
  )
1285
1330
  };
1286
1331
  }
@@ -1334,6 +1379,9 @@ function swiftModuleDigest(root) {
1334
1379
  linkedModuleDigests.set(root, { stamp, digest });
1335
1380
  return digest;
1336
1381
  }
1382
+ function swiftProjectBuildKey(moduleRoot, release) {
1383
+ return createHash4("sha256").update(`${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).update(swiftModuleDigest(moduleRoot)).digest("hex").slice(0, 32);
1384
+ }
1337
1385
  function compileTargets(input) {
1338
1386
  const manifest = input.files["Package.swift"];
1339
1387
  return manifest === void 0 ? [] : swiftPackagePartition(manifest, input.resourcePaths);
@@ -1361,11 +1409,13 @@ var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
1361
1409
  Accelerate: [],
1362
1410
  CryptoKit: [],
1363
1411
  CommonCrypto: [],
1412
+ ImagePlayground: [],
1413
+ QuickLookThumbnailing: [],
1414
+ libxml2: [],
1364
1415
  CoreText: [],
1365
1416
  Compression: ["PeachCodec"],
1366
1417
  zlib: ["PeachCodec"],
1367
1418
  PeachCodec: [],
1368
- Security: ["CryptoKit"],
1369
1419
  TikTokBusinessSDK: [],
1370
1420
  nSure: [],
1371
1421
  Statsig: [],
@@ -1492,7 +1542,7 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
1492
1542
  sdk,
1493
1543
  "wasm32-unknown-wasip1"
1494
1544
  ],
1495
- { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
1545
+ { encoding: "utf8", env: swiftEnvironment(), stdio: ["ignore", "pipe", "pipe"] }
1496
1546
  );
1497
1547
  const field = (name) => {
1498
1548
  const value = new RegExp(`^${name}:\\s*(.+)$`, "m").exec(configuration)?.[1]?.trim();
@@ -1585,7 +1635,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
1585
1635
  `;
1586
1636
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
1587
1637
  var MULTI_MANIFEST_VERSION = 39;
1588
- var compilerSourceDigest = true ? "fe15160b7f10d0c1ea06e54dc06a1de4d770f6f968e547bd41bd11fc6f5dbd8f" : swiftCompilerSourceDigest(import.meta.dirname);
1638
+ var compilerSourceDigest = true ? "0c614fef8e4e656ac3500002f7d1f2746f20f462321142e2f69a93e94f2321c4" : swiftCompilerSourceDigest(import.meta.dirname);
1589
1639
  function swiftArtifactHash(input, release, moduleRoot) {
1590
1640
  const hash = createHash4("sha256");
1591
1641
  hash.update(`swift-compile
@@ -2220,19 +2270,24 @@ function objcRootedClasses(sources) {
2220
2270
  function hideObjCClassesFromCxx(source, rooted) {
2221
2271
  if (rooted.size === 0) return source;
2222
2272
  const code = swiftCodeMask(source);
2223
- const starts = [];
2273
+ const insertions = [];
2224
2274
  let depth = 0;
2225
2275
  for (const match of code.matchAll(
2226
2276
  /[{}]|\bclass\s+(?!(?:func|var|let|subscript)\b)([A-Za-z_]\w*)/g
2227
2277
  )) {
2228
2278
  if (match[0] === "{") depth++;
2229
2279
  else if (match[0] === "}") depth--;
2230
- else if (depth === 0 && rooted.has(match[1]))
2231
- starts.push(declarationStart(code, match.index, 0));
2280
+ else if (depth === 0 && rooted.has(match[1])) {
2281
+ const start = declarationStart(code, match.index, 0);
2282
+ const main = /@main\b/.exec(code.slice(start, match.index));
2283
+ insertions.push(
2284
+ main ? { at: start + main.index + main[0].length, text: " @_expose(!Cxx)" } : { at: start, text: "@_expose(!Cxx) " }
2285
+ );
2286
+ }
2232
2287
  }
2233
2288
  let out = source;
2234
- for (const at of starts.reverse())
2235
- out = `${out.slice(0, at)}@_expose(!Cxx) ${out.slice(at)}`;
2289
+ for (const { at, text: text2 } of insertions.reverse())
2290
+ out = `${out.slice(0, at)}${text2}${out.slice(at)}`;
2236
2291
  return out;
2237
2292
  }
2238
2293
  function lowerAnyObjectDoubleValue(source) {
@@ -5909,7 +5964,7 @@ function builtArtifact(layout) {
5909
5964
  function projectDiagnostic(output, layout, files) {
5910
5965
  const base = layout.multi ? layout.root : layout.sources;
5911
5966
  const prefix = `${base}${path5.sep}`;
5912
- return designTimeDiagnostic(output, files).split("\n").map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
5967
+ return designTimeDiagnostic(output, files).split("\n").filter((line) => !SWIFTPM_NOISE.test(line)).map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
5913
5968
  }
5914
5969
  var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
5915
5970
  var host = globalThis;
@@ -6032,10 +6087,9 @@ function compileSwiftProjectUnit(input, options) {
6032
6087
  hash,
6033
6088
  release: options.release,
6034
6089
  timeoutMs: options.timeoutMs,
6035
- // the builder's swiftpm tree holds the sootsim-swift objects, which
6036
- // depend on the toolchain and sdk and not on the caller's checkout
6037
- // path, so every caller shares one warm tree per toolchain.
6038
- buildKey: createHash4("sha256").update(`${options.release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).digest("hex").slice(0, 32)
6090
+ // framework sources and compiler inputs own the shared object tree;
6091
+ // unrelated app edits reuse it without retaining stale private ABI.
6092
+ buildKey: swiftProjectBuildKey(moduleRoot, options.release)
6039
6093
  })
6040
6094
  );
6041
6095
  try {
@@ -6136,7 +6190,7 @@ function compileSwiftProjectUnit(input, options) {
6136
6190
  };
6137
6191
  report("compiling and linking Swift modules");
6138
6192
  try {
6139
- await runCompiler(swift, buildArgs, buildOptions, true);
6193
+ await runCompiler(swift, buildArgs, buildOptions, SWIFTPM_PROGRESS, SWIFTPM_NOISE);
6140
6194
  } catch (error) {
6141
6195
  const output = outputOf(error);
6142
6196
  const moduleCache = path5.join(
@@ -6149,7 +6203,13 @@ function compileSwiftProjectUnit(input, options) {
6149
6203
  if (output.includes("was compiled with module cache path") && existsSync2(moduleCache)) {
6150
6204
  rmSync2(moduleCache, { recursive: true, force: true });
6151
6205
  try {
6152
- await runCompiler(swift, buildArgs, buildOptions, true);
6206
+ await runCompiler(
6207
+ swift,
6208
+ buildArgs,
6209
+ buildOptions,
6210
+ SWIFTPM_PROGRESS,
6211
+ SWIFTPM_NOISE
6212
+ );
6153
6213
  } catch (retryError) {
6154
6214
  throw new Error(
6155
6215
  projectDiagnostic(outputOf(retryError), layout, input.files),
@@ -6203,6 +6263,7 @@ export {
6203
6263
  swiftModuleInputFiles,
6204
6264
  swiftModuleSdk,
6205
6265
  swiftPeachModules,
6266
+ swiftProjectBuildKey,
6206
6267
  swiftSdkPaths,
6207
6268
  swiftSourceAsIOS,
6208
6269
  swiftSourceClosure,
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1640 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1640 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/swift-package.ts
4
4
  function isSwiftManifestFile(file) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1640 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -46,6 +46,11 @@ __export(swift_submit_exports, {
46
46
  });
47
47
  module.exports = __toCommonJS(swift_submit_exports);
48
48
 
49
+ // src/is-record.ts
50
+ function isRecord(value) {
51
+ return typeof value === "object" && value !== null && !Array.isArray(value);
52
+ }
53
+
49
54
  // src/swiftContract.ts
50
55
  function isSwiftResourcePath(value) {
51
56
  return typeof value === "string" && value.length <= 4096 && !value.startsWith("/") && !value.includes("\\") && !value.includes("\0") && value.split("/").every((part) => part !== "" && part !== "." && part !== "..");
@@ -81,7 +86,7 @@ var MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES = 8 * 1024 * 1024;
81
86
  var MAX_SWIFT_COMPILE_IMAGES = 128;
82
87
  var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
83
88
  var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
84
- var SWIFT_HOST_ABI = 46;
89
+ var SWIFT_HOST_ABI = 47;
85
90
  var POLL_INTERVAL_MS = 1500;
86
91
  function swiftNativeEntry(native, file) {
87
92
  return {
@@ -133,9 +138,6 @@ function httpSwiftCompileSubmit(context) {
133
138
  return outcome;
134
139
  };
135
140
  }
136
- function isRecord(value) {
137
- return typeof value === "object" && value !== null && !Array.isArray(value);
138
- }
139
141
  function isSwiftNativeModules(value) {
140
142
  return isRecord(value) && typeof value.packageId === "string" && typeof value.hash === "string" && isRecord(value.files) && isRecord(value.modules) && isRecord(value.views) && [
141
143
  ...Object.values(value.files),
@@ -1,4 +1,9 @@
1
- /*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1640 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+
3
+ // src/is-record.ts
4
+ function isRecord(value) {
5
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6
+ }
2
7
 
3
8
  // src/swiftContract.ts
4
9
  function isSwiftResourcePath(value) {
@@ -35,7 +40,7 @@ var MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES = 8 * 1024 * 1024;
35
40
  var MAX_SWIFT_COMPILE_IMAGES = 128;
36
41
  var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
37
42
  var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
38
- var SWIFT_HOST_ABI = 46;
43
+ var SWIFT_HOST_ABI = 47;
39
44
  var POLL_INTERVAL_MS = 1500;
40
45
  function swiftNativeEntry(native, file) {
41
46
  return {
@@ -87,9 +92,6 @@ function httpSwiftCompileSubmit(context) {
87
92
  return outcome;
88
93
  };
89
94
  }
90
- function isRecord(value) {
91
- return typeof value === "object" && value !== null && !Array.isArray(value);
92
- }
93
95
  function isSwiftNativeModules(value) {
94
96
  return isRecord(value) && typeof value.packageId === "string" && typeof value.hash === "string" && isRecord(value.files) && isRecord(value.modules) && isRecord(value.views) && [
95
97
  ...Object.values(value.files),