peachsim 0.1.2218 → 0.1.2220

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 (88) hide show
  1. package/cli/commands/flow.ts +4 -0
  2. package/cli/maestro-compare.ts +37 -26
  3. package/cli/outbound-endpoints.ts +2 -2
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +92 -22
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +1 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +1 -1
  27. package/dist-lib/detox/index.cjs +1 -1
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +89 -19
  30. package/dist-lib/expo-swift-metadata.cjs +1 -1
  31. package/dist-lib/expo-swift-metadata.mjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +90 -20
  34. package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +3 -3
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +1 -1
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +3 -3
  50. package/dist-lib/native-app-identity-project.cjs +2 -2
  51. package/dist-lib/native-app-identity-project.mjs +2 -2
  52. package/dist-lib/native-app-identity.cjs +1 -1
  53. package/dist-lib/native-app-identity.mjs +1 -1
  54. package/dist-lib/native-firebase-metadata.cjs +1 -1
  55. package/dist-lib/native-firebase-metadata.mjs +1 -1
  56. package/dist-lib/pdfium-raster.cjs +1 -1
  57. package/dist-lib/pdfium-raster.mjs +1 -1
  58. package/dist-lib/plist.cjs +1 -1
  59. package/dist-lib/plist.mjs +1 -1
  60. package/dist-lib/profiles.cjs +1 -1
  61. package/dist-lib/public-brand.cjs +1 -1
  62. package/dist-lib/public-origins-lib-esm.json +24 -24
  63. package/dist-lib/public-origins-lib.json +53 -53
  64. package/dist-lib/react-native-host-modules.cjs +1 -1
  65. package/dist-lib/react-native-host-modules.mjs +1 -1
  66. package/dist-lib/reap-browser.cjs +1 -1
  67. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  68. package/dist-lib/sdk.cjs +1 -1
  69. package/dist-lib/sdk.mjs +1 -1
  70. package/dist-lib/skills.cjs +90 -20
  71. package/dist-lib/swift-compile.cjs +14 -7
  72. package/dist-lib/swift-compile.mjs +14 -7
  73. package/dist-lib/swift-package.cjs +1 -1
  74. package/dist-lib/swift-package.mjs +1 -1
  75. package/dist-lib/swift-submit.cjs +1 -1
  76. package/dist-lib/swift-submit.mjs +1 -1
  77. package/dist-lib/swift-toolchain.cjs +1 -1
  78. package/dist-lib/swift.cjs +1 -1
  79. package/dist-lib/vite-swift.cjs +87 -17
  80. package/dist-lib/vite.cjs +3 -3
  81. package/dist-lib/worklet-executable.cjs +1 -1
  82. package/dist-lib/worklet-executable.mjs +1 -1
  83. package/kotlin/sdk.tar.gz +0 -0
  84. package/package.json +1 -1
  85. package/src/swift-guest-runtime-plan.ts +13 -5
  86. package/src/swift-host.ts +84 -2
  87. package/src/swift-packages.ts +19 -10
  88. package/src/swift-standins.ts +1 -1
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2218 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2220 | (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;
@@ -13170,6 +13170,9 @@ var packageSchema = v3.object({
13170
13170
 
13171
13171
  // src/swift-guest-runtime-plan.ts
13172
13172
  var SDK_CATALOG_DIRECTORY = "swift.xctoolchain/usr/lib/swift_static/wasi";
13173
+ function canonicalArchivePath(file) {
13174
+ return import_node_path13.default.join((0, import_node_fs13.realpathSync)(import_node_path13.default.dirname(file)), import_node_path13.default.basename(file));
13175
+ }
13173
13176
  function sdkArtifactBytes(root, artifact) {
13174
13177
  const file = import_node_path13.default.resolve(root, artifact.path);
13175
13178
  const linked = (0, import_node_fs13.readFileSync)(file);
@@ -13275,7 +13278,7 @@ function guestRuntimeInputIdentities(options) {
13275
13278
  ];
13276
13279
  add(file, JSON.stringify(identity2));
13277
13280
  if (artifact.kind !== "archive") continue;
13278
- for (const origin of origins.get(file) ?? [])
13281
+ for (const origin of origins.get(canonicalArchivePath(file)) ?? [])
13279
13282
  add(
13280
13283
  import_node_path13.default.resolve(origin.original),
13281
13284
  JSON.stringify([...identity2, origin.member, origin.ordinal])
@@ -13348,7 +13351,8 @@ function guestRuntimeProductsForInputs(options) {
13348
13351
  for (const { product, root } of options.products) {
13349
13352
  byId.set(product.id, product);
13350
13353
  for (const artifact of product.artifacts) {
13351
- const file = import_node_path13.default.resolve(root, artifact.path);
13354
+ const absolute = import_node_path13.default.resolve(root, artifact.path);
13355
+ const file = artifact.kind === "archive" ? canonicalArchivePath(absolute) : absolute;
13352
13356
  const owners = byFile.get(file) ?? [];
13353
13357
  owners.push({ id: product.id, artifact });
13354
13358
  byFile.set(file, owners);
@@ -13380,7 +13384,9 @@ function guestRuntimeProductsForInputs(options) {
13380
13384
  const file = original.get(import_node_path13.default.resolve(selection.artifact)) ?? import_node_path13.default.resolve(selection.artifact);
13381
13385
  const origin = origins.get(file);
13382
13386
  const archive = origin ? import_node_path13.default.resolve(origin.archive) : file;
13383
- const records = byFile.get(archive);
13387
+ const records = byFile.get(
13388
+ origin || selection.member !== null ? canonicalArchivePath(archive) : archive
13389
+ );
13384
13390
  if (frameworkObjects.has(file)) {
13385
13391
  if (frameworkId === null || !byId.has(frameworkId))
13386
13392
  throw new Error(`framework runtime product has no producer record ${file}`);
@@ -13492,8 +13498,9 @@ function guestSdkProductLinkArtifacts(products, sdk, inputs, linkedArchives, rew
13492
13498
  for (const { product, root } of products) {
13493
13499
  for (const artifact of product.artifacts) {
13494
13500
  const file = import_node_path13.default.resolve(root, artifact.path);
13495
- const objects = artifact.kind === "archive" ? origins.filter(
13496
- (origin) => import_node_path13.default.resolve(origin.archive) === file && (!selectedObjects || selectedObjects.has(
13501
+ const archive = artifact.kind === "archive" ? canonicalArchivePath(file) : null;
13502
+ const objects = archive !== null ? origins.filter(
13503
+ (origin) => import_node_path13.default.resolve(origin.archive) === archive && (!selectedObjects || selectedObjects.has(
13497
13504
  import_node_path13.default.resolve(rewritten.get(origin.original) ?? origin.original)
13498
13505
  ))
13499
13506
  ) : [];
@@ -17452,7 +17459,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
17452
17459
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
17453
17460
  var MULTI_MANIFEST_VERSION = 68;
17454
17461
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
17455
- var compilerSourceDigest = true ? "94960e7e108c556e2184ef22baae1e061ca63c08c954c6ad0f677b524be5e117" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
17462
+ var compilerSourceDigest = true ? "0a0bc1c871aee83ea273120655f55a43ddccde646478a452b4c73d2daefd58c3" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
17456
17463
  function swiftArtifactHash(input, release, moduleRoot) {
17457
17464
  const hash = (0, import_node_crypto13.createHash)("sha256");
17458
17465
  hash.update(`swift-compile
@@ -30260,17 +30267,17 @@ function remoteSwiftCheckouts(root) {
30260
30267
  return import_node_path41.default.join(import_node_fs40.default.realpathSync(cacheDir()), "swift-packages", key2, "checkouts");
30261
30268
  }
30262
30269
  var UNSUPPORTED_NATIVE = /\.(s|S)$/;
30263
- function unlowerableSources(files2, target) {
30270
+ function unlowerableSources(files2, target, portable) {
30264
30271
  if (target.declaresWasiNativeSettings) return [];
30265
30272
  return [
30266
- ...files2.filter((file) => UNSUPPORTED_NATIVE.test(file)),
30273
+ ...portable.has(target.name) ? [] : files2.filter((file) => UNSUPPORTED_NATIVE.test(file)),
30267
30274
  ...files2.filter(isSwiftNativeTranslationUnit).filter((file) => swiftCTakesReturnAddress(import_node_fs40.default.readFileSync(file, "utf8")))
30268
30275
  ];
30269
30276
  }
30270
- function unloweredSources(files2, target) {
30277
+ function unloweredSources(files2, target, portable) {
30271
30278
  if (target.type !== "regular") return null;
30272
30279
  if (!files2.some(isSwiftNativeTranslationUnit)) return null;
30273
- const unlowered = unlowerableSources(files2, target);
30280
+ const unlowered = unlowerableSources(files2, target, portable);
30274
30281
  if (unlowered.length === 0) return null;
30275
30282
  const headers = import_node_path41.default.resolve(target.dir, target.publicHeadersPath);
30276
30283
  if (!files2.some((file) => file.startsWith(`${headers}${import_node_path41.default.sep}`) && file.endsWith(".h")))
@@ -30343,6 +30350,7 @@ async function resolveSwiftPackagesAsync(options) {
30343
30350
  function resolveSwiftPackages(options) {
30344
30351
  const { rootDir, resolved, products, localDirs } = options;
30345
30352
  const providedTargets = new Set(options.provided ?? []);
30353
+ const portableAssembly = options.portableAssembly ?? /* @__PURE__ */ new Set();
30346
30354
  const providedProducts = new Set(options.provided ?? []);
30347
30355
  const result = {
30348
30356
  sourceLinks: { targets: [], owners: [] },
@@ -30440,7 +30448,7 @@ function resolveSwiftPackages(options) {
30440
30448
  if (target.type === "macro") return preservePackage(pkg, [name3], "host");
30441
30449
  const files2 = target.type === "regular" || target.type === "system" ? swiftTargetFiles(pkg.manifest, target) : [];
30442
30450
  const gap = options.binaryGaps?.get(name3);
30443
- const unlowerable = unlowerableSources(files2, target);
30451
+ const unlowerable = unlowerableSources(files2, target, portableAssembly);
30444
30452
  const placeholder = placeholderPackage(pkg);
30445
30453
  const ownReason = target.type === "binary" ? `${name3} ${BINARY}${gap ? `; ${gap}` : ""}` : placeholder && gap ? `${name3} stands in as a placeholder (${placeholder}), and ${gap}` : target.type !== "regular" && target.type !== "system" ? `${name3} is a ${target.type} target` : unlowerable.length > 0 ? `${name3} has native sources with no wasm32 lowering: ${unlowerable.map((file) => import_node_path41.default.relative(pkg.manifest.dir, file)).join(", ")}${gap ? `; ${gap}` : ""}` : null;
30446
30454
  const reasons = target.dependencies.map((dependency) => {
@@ -30521,7 +30529,7 @@ function resolveSwiftPackages(options) {
30521
30529
  (file) => file.endsWith(".swift") && import_node_fs40.default.readFileSync(file, "utf8").trim() === ""
30522
30530
  ))
30523
30531
  return false;
30524
- if (unloweredSources(files2, target)) return false;
30532
+ if (unloweredSources(files2, target, portableAssembly)) return false;
30525
30533
  claimed.add(key2);
30526
30534
  providedTargets.delete(name3);
30527
30535
  for (const dependency of target.dependencies) {
@@ -30569,7 +30577,7 @@ function resolveSwiftPackages(options) {
30569
30577
  if (target.type === "executable") continue;
30570
30578
  const files2 = target.type === "regular" || target.type === "system" ? swiftTargetFiles(pkg.manifest, target) : [];
30571
30579
  const objc = target.type === "regular" && files2.some((file) => /\.(m|mm)$/.test(file));
30572
- const unlowered = unloweredSources(files2, target);
30580
+ const unlowered = unloweredSources(files2, target, portableAssembly);
30573
30581
  const gap = placeholderPackage(pkg);
30574
30582
  const sources = files2.filter((file) => file.endsWith(".swift"));
30575
30583
  const release = (setting) => setting.configuration !== "debug";
@@ -30868,7 +30876,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
30868
30876
  return hash.digest("hex");
30869
30877
  }
30870
30878
  var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
30871
- var STANDIN_SOURCE_DIGEST = true ? "71bed308fc270bafd989236668c1e63cc7dd11ab7b6815686dd07fd9b846e738" : standinSourceDigest();
30879
+ var STANDIN_SOURCE_DIGEST = true ? "c0f609da62368c513c186d23bc8aa8e450d27efae5b8c2e7cdf50d34fa734ff0" : standinSourceDigest();
30872
30880
 
30873
30881
  // src/swift-standins.ts
30874
30882
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
@@ -33109,7 +33117,7 @@ function graphStandin(module2, graphs, values, wasm, binary, toolchain, work, re
33109
33117
  }
33110
33118
  if (omit.size + plain.size + unobjc.size + trapped.size + unconformed.size + forced.size + nonfailable.size === before)
33111
33119
  throw new Error(
33112
- `its generated source does not typecheck: ${elsewhere.slice(0, 3).join("; ") || check2.stderr.trim().slice(0, 400)}`
33120
+ `its generated source does not typecheck: ${(elsewhere.length > 0 ? elsewhere : [...check2.stderr.matchAll(/^\S+?:\d+:\d+: error: .*$/gm)].map((line) => line[0].replace(/^[^:]*\//, ""))).slice(0, 3).join("; ") || check2.stderr.trim().slice(0, 400)}`
33113
33121
  );
33114
33122
  }
33115
33123
  }
@@ -36154,6 +36162,60 @@ function readXcodeAppTargetPrepared(input, target, configuration, options) {
36154
36162
  deferPackageResolution: true
36155
36163
  });
36156
36164
  }
36165
+ var emptyWasmAssembly = /* @__PURE__ */ new Map();
36166
+ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
36167
+ const assembly = binaries.filter(
36168
+ (binary) => binary.unloweredSources?.length && binary.unloweredSources.every((file) => /\.(s|S)$/.test(file)) && binary.publicHeaders !== void 0
36169
+ );
36170
+ if (assembly.length === 0) return /* @__PURE__ */ new Set();
36171
+ const sdk = swiftSdkPaths(moduleRoot, toolchainBin);
36172
+ const clang = import_node_path54.default.join(toolchainBin, "clang");
36173
+ const empty = (binary, file) => {
36174
+ const source = import_node_path54.default.join(binary.dir, file);
36175
+ const key2 = (0, import_node_crypto29.createHash)("sha256").update(
36176
+ JSON.stringify([
36177
+ clang,
36178
+ sdk.sysroot,
36179
+ sdk.cFlags,
36180
+ binary.dir,
36181
+ binary.publicHeaders
36182
+ ])
36183
+ ).update(import_node_fs53.default.readFileSync(source)).digest("hex");
36184
+ const known = emptyWasmAssembly.get(key2);
36185
+ if (known) return known;
36186
+ const result = new Promise(
36187
+ (resolve2) => (0, import_node_child_process33.execFile)(
36188
+ clang,
36189
+ [
36190
+ "-target",
36191
+ "wasm32-unknown-wasip1",
36192
+ "--sysroot",
36193
+ sdk.sysroot,
36194
+ ...sdk.cFlags,
36195
+ "-I",
36196
+ import_node_path54.default.join(binary.dir, binary.publicHeaders),
36197
+ "-I",
36198
+ import_node_path54.default.dirname(source),
36199
+ "-E",
36200
+ "-P",
36201
+ "-x",
36202
+ "assembler-with-cpp",
36203
+ source
36204
+ ],
36205
+ { maxBuffer: 64 * 1024 * 1024 },
36206
+ (error, stdout) => resolve2(!error && stdout.trim() === "")
36207
+ )
36208
+ );
36209
+ emptyWasmAssembly.set(key2, result);
36210
+ return result;
36211
+ };
36212
+ const portable = await Promise.all(
36213
+ assembly.map(
36214
+ async (binary) => (await Promise.all(binary.unloweredSources.map((file) => empty(binary, file)))).every(Boolean) ? [binary.target] : []
36215
+ )
36216
+ );
36217
+ return new Set(portable.flat());
36218
+ }
36157
36219
  async function swiftPackages(entry, app) {
36158
36220
  const stamp = (file) => import_node_fs53.default.existsSync(file) ? (0, import_node_crypto29.createHash)("sha256").update(import_node_fs53.default.readFileSync(file)).digest("hex") : null;
36159
36221
  const owners = [...app.frameworks, app].map((target) => ({
@@ -36218,7 +36280,14 @@ async function swiftPackages(entry, app) {
36218
36280
  entry.moduleRoot,
36219
36281
  import_node_path54.default.join(resolved.toolchainBin, "clang++")
36220
36282
  );
36221
- const cxxArtifacts = reached.filter(standinArtifact);
36283
+ const portableAssembly = await wasmPortableAssembly(
36284
+ reached,
36285
+ resolved.toolchainBin,
36286
+ entry.moduleRoot
36287
+ );
36288
+ const cxxArtifacts = reached.filter(
36289
+ (binary) => standinArtifact(binary) && !portableAssembly.has(binary.target)
36290
+ );
36222
36291
  const generation = standinGenerationInputs(cxxArtifacts, toolchain, entry.behavior);
36223
36292
  if (cached.standinKey !== generation) {
36224
36293
  const replaced = new Set(
@@ -36245,6 +36314,7 @@ async function swiftPackages(entry, app) {
36245
36314
  [...replaced].filter((target) => !built2.gaps.has(target))
36246
36315
  ),
36247
36316
  binaryGaps: built2.gaps,
36317
+ portableAssembly,
36248
36318
  owners
36249
36319
  });
36250
36320
  for (const target of new Set(built2.standins.map((standin) => standin.target)))
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2218 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2220 | (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;
@@ -2923,7 +2923,7 @@ function readIosSdkTree(root) {
2923
2923
 
2924
2924
  // src/swift-standin-digest.ts
2925
2925
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
2926
- var STANDIN_SOURCE_DIGEST = true ? "71bed308fc270bafd989236668c1e63cc7dd11ab7b6815686dd07fd9b846e738" : standinSourceDigest();
2926
+ var STANDIN_SOURCE_DIGEST = true ? "c0f609da62368c513c186d23bc8aa8e450d27efae5b8c2e7cdf50d34fa734ff0" : standinSourceDigest();
2927
2927
 
2928
2928
  // src/expo-native-workspace.ts
2929
2929
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
@@ -6417,7 +6417,7 @@ var FOUNDATION_IMPLICIT_MODULES = [
6417
6417
  var FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
6418
6418
  (module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
6419
6419
  ).join("");
6420
- var compilerSourceDigest = true ? "94960e7e108c556e2184ef22baae1e061ca63c08c954c6ad0f677b524be5e117" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
6420
+ var compilerSourceDigest = true ? "0a0bc1c871aee83ea273120655f55a43ddccde646478a452b4c73d2daefd58c3" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
6421
6421
  var CORE_FOUNDATION_HANDLE_IMPORTS = [
6422
6422
  "CFAllocator",
6423
6423
  "CFArray",
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2218 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2220 | (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.2218 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2220 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/worklet-executable.ts
4
4
  import { parse } from "acorn";
package/kotlin/sdk.tar.gz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.2218",
3
+ "version": "0.1.2220",
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",
@@ -30,6 +30,10 @@ import type {
30
30
 
31
31
  const SDK_CATALOG_DIRECTORY = 'swift.xctoolchain/usr/lib/swift_static/wasi'
32
32
 
33
+ function canonicalArchivePath(file: string): string {
34
+ return path.join(realpathSync(path.dirname(file)), path.basename(file))
35
+ }
36
+
33
37
  // the SDK view weakens three Foundation Bundle symbols. bind that view to the
34
38
  // catalogued archive by reproducing the exact transformation on its bytes.
35
39
  function sdkArtifactBytes(root: string, artifact: SwiftSdkProduct['artifacts'][number]) {
@@ -184,7 +188,7 @@ export function guestRuntimeInputIdentities(options: {
184
188
  ]
185
189
  add(file, JSON.stringify(identity))
186
190
  if (artifact.kind !== 'archive') continue
187
- for (const origin of origins.get(file) ?? [])
191
+ for (const origin of origins.get(canonicalArchivePath(file)) ?? [])
188
192
  add(
189
193
  path.resolve(origin.original),
190
194
  JSON.stringify([...identity, origin.member, origin.ordinal]),
@@ -308,7 +312,8 @@ export function guestRuntimeProductsForInputs(options: {
308
312
  for (const { product, root } of options.products) {
309
313
  byId.set(product.id, product)
310
314
  for (const artifact of product.artifacts) {
311
- const file = path.resolve(root, artifact.path)
315
+ const absolute = path.resolve(root, artifact.path)
316
+ const file = artifact.kind === 'archive' ? canonicalArchivePath(absolute) : absolute
312
317
  const owners = byFile.get(file) ?? []
313
318
  owners.push({ id: product.id, artifact })
314
319
  byFile.set(file, owners)
@@ -343,7 +348,9 @@ export function guestRuntimeProductsForInputs(options: {
343
348
  original.get(path.resolve(selection.artifact)) ?? path.resolve(selection.artifact)
344
349
  const origin = origins.get(file)
345
350
  const archive = origin ? path.resolve(origin.archive) : file
346
- const records = byFile.get(archive)
351
+ const records = byFile.get(
352
+ origin || selection.member !== null ? canonicalArchivePath(archive) : archive,
353
+ )
347
354
  if (frameworkObjects.has(file)) {
348
355
  if (frameworkId === null || !byId.has(frameworkId))
349
356
  throw new Error(`framework runtime product has no producer record ${file}`)
@@ -494,11 +501,12 @@ export function guestSdkProductLinkArtifacts(
494
501
  for (const { product, root } of products) {
495
502
  for (const artifact of product.artifacts) {
496
503
  const file = path.resolve(root, artifact.path)
504
+ const archive = artifact.kind === 'archive' ? canonicalArchivePath(file) : null
497
505
  const objects =
498
- artifact.kind === 'archive'
506
+ archive !== null
499
507
  ? origins.filter(
500
508
  (origin) =>
501
- path.resolve(origin.archive) === file &&
509
+ path.resolve(origin.archive) === archive &&
502
510
  (!selectedObjects ||
503
511
  selectedObjects.has(
504
512
  path.resolve(rewritten.get(origin.original) ?? origin.original),
package/src/swift-host.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AsyncLocalStorage } from 'node:async_hooks'
2
- import { execFileSync } from 'node:child_process'
2
+ import { execFile, execFileSync } from 'node:child_process'
3
3
  import { createHash } from 'node:crypto'
4
4
  // the node host for every Swift preview: package inputs, one compile and
5
5
  // immutable artifact addresses. vite and the foreground CLI adapt this host.
@@ -42,6 +42,7 @@ import {
42
42
  swiftDistributionAt,
43
43
  swiftOptionalFramework,
44
44
  compilerSourceDigest,
45
+ swiftSdkPaths,
45
46
  } from './swift-compile'
46
47
  import {
47
48
  assetSymbolText,
@@ -522,6 +523,79 @@ export function configureSwiftStandinBehavior(
522
523
  const standinBuilds = new Map<string, Promise<SwiftStandins>>()
523
524
 
524
525
  // packages resolve once per set of linked products, pins and local manifests.
526
+ // assembly guarded to the architectures it was written for preprocesses to
527
+ // nothing for wasm32 under the target's own headers and the sdk's c flags, so
528
+ // swiftpm builds that target as plain c instead of it standing in. a file that
529
+ // fails to preprocess (#error on an unknown platform) keeps the stand-in.
530
+ const emptyWasmAssembly = new Map<string, Promise<boolean>>()
531
+ async function wasmPortableAssembly(
532
+ binaries: readonly SwiftPackageBinary[],
533
+ toolchainBin: string,
534
+ moduleRoot: string,
535
+ ): Promise<Set<string>> {
536
+ const assembly = binaries.filter(
537
+ (binary) =>
538
+ binary.unloweredSources?.length &&
539
+ binary.unloweredSources.every((file) => /\.(s|S)$/.test(file)) &&
540
+ binary.publicHeaders !== undefined,
541
+ )
542
+ if (assembly.length === 0) return new Set()
543
+ const sdk = swiftSdkPaths(moduleRoot, toolchainBin)
544
+ const clang = path.join(toolchainBin, 'clang')
545
+ const empty = (binary: SwiftPackageBinary, file: string) => {
546
+ const source = path.join(binary.dir, file)
547
+ const key = createHash('sha256')
548
+ .update(
549
+ JSON.stringify([
550
+ clang,
551
+ sdk.sysroot,
552
+ sdk.cFlags,
553
+ binary.dir,
554
+ binary.publicHeaders,
555
+ ]),
556
+ )
557
+ .update(fs.readFileSync(source))
558
+ .digest('hex')
559
+ const known = emptyWasmAssembly.get(key)
560
+ if (known) return known
561
+ const result = new Promise<boolean>((resolve) =>
562
+ execFile(
563
+ clang,
564
+ [
565
+ '-target',
566
+ 'wasm32-unknown-wasip1',
567
+ '--sysroot',
568
+ sdk.sysroot,
569
+ ...sdk.cFlags,
570
+ '-I',
571
+ path.join(binary.dir, binary.publicHeaders!),
572
+ '-I',
573
+ path.dirname(source),
574
+ '-E',
575
+ '-P',
576
+ '-x',
577
+ 'assembler-with-cpp',
578
+ source,
579
+ ],
580
+ { maxBuffer: 64 * 1024 * 1024 },
581
+ (error, stdout) => resolve(!error && stdout.trim() === ''),
582
+ ),
583
+ )
584
+ emptyWasmAssembly.set(key, result)
585
+ return result
586
+ }
587
+ const portable = await Promise.all(
588
+ assembly.map(async (binary) =>
589
+ (
590
+ await Promise.all(binary.unloweredSources!.map((file) => empty(binary, file)))
591
+ ).every(Boolean)
592
+ ? [binary.target]
593
+ : [],
594
+ ),
595
+ )
596
+ return new Set(portable.flat())
597
+ }
598
+
525
599
  async function swiftPackages(
526
600
  entry: XcodeProjectEntry,
527
601
  app: XcodeAppTarget,
@@ -616,7 +690,14 @@ async function swiftPackages(
616
690
  entry.moduleRoot,
617
691
  path.join(resolved.toolchainBin, 'clang++'),
618
692
  )
619
- const cxxArtifacts = reached.filter(standinArtifact)
693
+ const portableAssembly = await wasmPortableAssembly(
694
+ reached,
695
+ resolved.toolchainBin,
696
+ entry.moduleRoot,
697
+ )
698
+ const cxxArtifacts = reached.filter(
699
+ (binary) => standinArtifact(binary) && !portableAssembly.has(binary.target),
700
+ )
620
701
  const generation = standinGenerationInputs(cxxArtifacts, toolchain, entry.behavior)
621
702
  if (cached.standinKey !== generation) {
622
703
  // an archive other than the one peach ships a module for stands in itself
@@ -648,6 +729,7 @@ async function swiftPackages(
648
729
  [...replaced].filter((target) => !built.gaps.has(target)),
649
730
  ),
650
731
  binaryGaps: built.gaps,
732
+ portableAssembly,
651
733
  owners,
652
734
  })
653
735
  for (const target of new Set(built.standins.map((standin) => standin.target)))
@@ -165,18 +165,23 @@ const UNSUPPORTED_NATIVE = /\.(s|S)$/
165
165
  // return address, cannot lower to wasm, unless upstream declares
166
166
  // wasi-conditioned c settings for it: that is the package's own supported
167
167
  // portable path (boringssl's guarded assembly with OPENSSL_NO_ASM), which
168
- // compiles with those flags exactly as swiftpm builds it. without that signal
169
- // the target keeps the refusal below. when a refused target also ships public
170
- // headers, those headers stand in for it and every declaration they spell
171
- // traps by name. this is the assembly rule above, widened only where the
172
- // target has a header surface to stand in from.
168
+ // compiles with those flags exactly as swiftpm builds it. assembly that
169
+ // preprocesses to nothing for wasm32 (guarded to the architectures it was
170
+ // written for) is the same portable path without the signal: swiftpm compiles
171
+ // it as plain c. otherwise the target keeps the refusal below. when a refused
172
+ // target also ships public headers, those headers stand in for it and every
173
+ // declaration they spell traps by name. this is the assembly rule above,
174
+ // widened only where the target has a header surface to stand in from.
173
175
  function unlowerableSources(
174
176
  files: readonly string[],
175
177
  target: SwiftManifestTarget,
178
+ portable: ReadonlySet<string>,
176
179
  ): string[] {
177
180
  if (target.declaresWasiNativeSettings) return []
178
181
  return [
179
- ...files.filter((file) => UNSUPPORTED_NATIVE.test(file)),
182
+ ...(portable.has(target.name)
183
+ ? []
184
+ : files.filter((file) => UNSUPPORTED_NATIVE.test(file))),
180
185
  ...files
181
186
  .filter(isSwiftNativeTranslationUnit)
182
187
  .filter((file) => swiftCTakesReturnAddress(fs.readFileSync(file, 'utf8'))),
@@ -186,10 +191,11 @@ function unlowerableSources(
186
191
  function unloweredSources(
187
192
  files: readonly string[],
188
193
  target: SwiftManifestTarget,
194
+ portable: ReadonlySet<string>,
189
195
  ): string[] | null {
190
196
  if (target.type !== 'regular') return null
191
197
  if (!files.some(isSwiftNativeTranslationUnit)) return null
192
- const unlowered = unlowerableSources(files, target)
198
+ const unlowered = unlowerableSources(files, target, portable)
193
199
  if (unlowered.length === 0) return null
194
200
  const headers = path.resolve(target.dir, target.publicHeadersPath)
195
201
  if (
@@ -533,6 +539,8 @@ export function resolveSwiftPackages(options: {
533
539
  standinTargets?: ReadonlySet<string>
534
540
  /** why a binary target has no stand-in, added to its reason. */
535
541
  binaryGaps?: ReadonlyMap<string, string>
542
+ /** assembly targets whose sources preprocess to nothing for wasm32. */
543
+ portableAssembly?: ReadonlySet<string>
536
544
  /**
537
545
  * each compiling module and the package products it links. a clang target
538
546
  * in that product's closure records the module as a client.
@@ -542,6 +550,7 @@ export function resolveSwiftPackages(options: {
542
550
  }): SwiftPackages {
543
551
  const { rootDir, resolved, products, localDirs } = options
544
552
  const providedTargets = new Set(options.provided ?? [])
553
+ const portableAssembly = options.portableAssembly ?? new Set<string>()
545
554
  const providedProducts = new Set(options.provided ?? [])
546
555
  const result: SwiftPackages = {
547
556
  sourceLinks: { targets: [], owners: [] },
@@ -674,7 +683,7 @@ export function resolveSwiftPackages(options: {
674
683
  ? swiftTargetFiles(pkg.manifest, target)
675
684
  : []
676
685
  const gap = options.binaryGaps?.get(name)
677
- const unlowerable = unlowerableSources(files, target)
686
+ const unlowerable = unlowerableSources(files, target, portableAssembly)
678
687
  const placeholder = placeholderPackage(pkg)
679
688
  const ownReason =
680
689
  target.type === 'binary'
@@ -794,7 +803,7 @@ export function resolveSwiftPackages(options: {
794
803
  )
795
804
  return false
796
805
  // a target whose headers stand in for its unlowered sources stays with the stand-in
797
- if (unloweredSources(files, target)) return false
806
+ if (unloweredSources(files, target, portableAssembly)) return false
798
807
  claimed.add(key)
799
808
  providedTargets.delete(name)
800
809
  for (const dependency of target.dependencies) {
@@ -865,7 +874,7 @@ export function resolveSwiftPackages(options: {
865
874
  : []
866
875
  const objc =
867
876
  target.type === 'regular' && files.some((file) => /\.(m|mm)$/.test(file))
868
- const unlowered = unloweredSources(files, target)
877
+ const unlowered = unloweredSources(files, target, portableAssembly)
869
878
  const gap = placeholderPackage(pkg)
870
879
  const sources = files.filter((file) => file.endsWith('.swift'))
871
880
  // swiftpm's release settings, as xcode builds a package for any
@@ -1747,7 +1747,7 @@ function graphStandin(
1747
1747
  before
1748
1748
  )
1749
1749
  throw new Error(
1750
- `its generated source does not typecheck: ${elsewhere.slice(0, 3).join('; ') || check.stderr.trim().slice(0, 400)}`,
1750
+ `its generated source does not typecheck: ${(elsewhere.length > 0 ? elsewhere : [...check.stderr.matchAll(/^\S+?:\d+:\d+: error: .*$/gm)].map((line) => line[0].replace(/^[^:]*\//, ''))).slice(0, 3).join('; ') || check.stderr.trim().slice(0, 400)}`,
1751
1751
  )
1752
1752
  }
1753
1753
  }