peachsim 0.1.2434 → 0.1.2436

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 (92) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +1 -1
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +1 -1
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +1 -1
  13. package/dist-lib/bundle-channel.cjs +95 -28
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +1 -1
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +1 -1
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +1 -1
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +1 -1
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +1 -1
  24. package/dist-lib/detox/index.cjs +1 -1
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/expo-swift-bundle.cjs +94 -27
  27. package/dist-lib/expo-swift-metadata.cjs +1 -1
  28. package/dist-lib/expo-swift-metadata.mjs +1 -1
  29. package/dist-lib/home-paths.cjs +1 -1
  30. package/dist-lib/host/bridge-host.cjs +95 -28
  31. package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
  32. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  33. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  34. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  35. package/dist-lib/host/websocket-proxy.cjs +1 -1
  36. package/dist-lib/index.cjs +14 -6
  37. package/dist-lib/jump-to-source-babel.cjs +1 -1
  38. package/dist-lib/jump-to-source-native.cjs +1 -1
  39. package/dist-lib/kotlin-host.cjs +1 -1
  40. package/dist-lib/menu.cjs +1 -1
  41. package/dist-lib/menu.mjs +1 -1
  42. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  44. package/dist-lib/metro-production-bundle.cjs +1 -1
  45. package/dist-lib/metro-production-bundle.mjs +1 -1
  46. package/dist-lib/metro.cjs +14 -6
  47. package/dist-lib/native-app-identity-project.cjs +13 -5
  48. package/dist-lib/native-app-identity-project.mjs +13 -5
  49. package/dist-lib/native-app-identity.cjs +1 -1
  50. package/dist-lib/native-app-identity.mjs +1 -1
  51. package/dist-lib/native-firebase-metadata.cjs +1 -1
  52. package/dist-lib/native-firebase-metadata.mjs +1 -1
  53. package/dist-lib/pdfium-raster.cjs +1 -1
  54. package/dist-lib/pdfium-raster.mjs +1 -1
  55. package/dist-lib/plist.cjs +1 -1
  56. package/dist-lib/plist.mjs +1 -1
  57. package/dist-lib/profiles.cjs +1 -1
  58. package/dist-lib/public-brand.cjs +1 -1
  59. package/dist-lib/public-origins-lib-esm.json +24 -24
  60. package/dist-lib/public-origins-lib.json +53 -53
  61. package/dist-lib/react-native-host-modules.cjs +1 -1
  62. package/dist-lib/react-native-host-modules.mjs +1 -1
  63. package/dist-lib/reap-browser.cjs +1 -1
  64. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  65. package/dist-lib/sdk.cjs +1 -1
  66. package/dist-lib/sdk.mjs +1 -1
  67. package/dist-lib/skills.cjs +101 -35
  68. package/dist-lib/swift-compile.cjs +69 -19
  69. package/dist-lib/swift-compile.mjs +69 -19
  70. package/dist-lib/swift-package.cjs +1 -1
  71. package/dist-lib/swift-package.mjs +1 -1
  72. package/dist-lib/swift-submit.cjs +1 -1
  73. package/dist-lib/swift-submit.mjs +1 -1
  74. package/dist-lib/swift-toolchain.cjs +1 -1
  75. package/dist-lib/swift.cjs +1 -1
  76. package/dist-lib/vite-swift.cjs +92 -25
  77. package/dist-lib/vite.cjs +3 -3
  78. package/dist-lib/worklet-executable.cjs +1 -1
  79. package/dist-lib/worklet-executable.mjs +1 -1
  80. package/dist-types/packages/peach-engine/src/engine/inspect-info.d.ts +2 -1
  81. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
  82. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  83. package/dist-types/packages/peach-globals/src/nodeContract.d.ts +8 -0
  84. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +4 -1
  85. package/package.json +1 -1
  86. package/src/bazel-project.ts +11 -3
  87. package/src/swift-compile.ts +49 -5
  88. package/src/swift-guest-image-ledger.ts +15 -12
  89. package/src/swift-guest-link.ts +13 -2
  90. package/src/swift-host.ts +12 -0
  91. package/src/swift-submit.ts +2 -0
  92. package/src/swift-wasm-prune.ts +8 -3
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2434 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2436 | (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;
@@ -10038,9 +10038,9 @@ var init_registry = __esm({
10038
10038
  {
10039
10039
  range: ">=7.0.0",
10040
10040
  coverage: 0.82,
10041
- note: "native-seam only \u2014 the real upstream index.ts (an async wrapper around `NativeModules.Contacts ?? TurboModuleRegistry.get('RCTContacts')`) runs from the bundle. sootsim provides a deterministic in-memory address book against the Contacts TurboModule (every consumer method delegates here): add/update/delete operate on an in-process Map keyed by recordID; getContactsByPhoneNumber/Email/MatchingString filter that store; checkPermission/requestPermission use the shared app-scoped system permission registry; the groups subsurface (addGroup/getGroup/contactsInGroup/etc.) is wired against an in-process group store so consumers can exercise the full membership round-trip.",
10042
- working: "real upstream JS wrapper running from the bundle, getAll/getAllWithoutPhotos, getContactById, getContactsByPhoneNumber/Email/MatchingString, getCount, getPhotoForId, addContact/openContactForm/openExistingContact/viewExistingContact/editExistingContact/updateContact/deleteContact, writePhotoToPath, iosEnableNotesUsage, checkPermission/requestPermission, getGroups/getGroup/addGroup/updateGroup/deleteGroup/contactsInGroup/addContactsToGroup/removeContactsFromGroup",
10043
- missing: "real OS contacts database access (no browser AddressBook API), native iOS/Android contacts UI for openContactForm presentation, thumbnail photo writing to disk, container/source routing"
10041
+ note: "The published JavaScript uses the Contacts native module, backed by a local address book and the shared permission registry.",
10042
+ working: "list, find, count, add, update and delete local contacts, read thumbnail paths, check and request permission, manage groups and membership",
10043
+ missing: "OS contacts database access, contact forms and cards, thumbnail file writes, iOS Notes entitlement and container routing"
10044
10044
  }
10045
10045
  ]
10046
10046
  },
@@ -13434,10 +13434,9 @@ var init_registry = __esm({
13434
13434
  versions: [
13435
13435
  {
13436
13436
  range: ">=0.6.0",
13437
- coverage: 0.3,
13438
- note: "native-seam only: RNWhisper.install() mounts all fourteen JSI bindings so the package's own JS runs, but transcripts come from the host speech recognizer instead of a whisper model",
13439
- working: "package load and JSI binding handshake, getConstants, context and VAD context init/release lifecycle, transcribeFile/transcribeData resolving TranscribeResult shapes, onProgress and onNewSegments callbacks, abortTranscribe, bench, toggleNativeLog, and RealtimeTranscriber delivering real text through the browser SpeechRecognition API",
13440
- missing: "no whisper.cpp/ggml runtime, so the declared model file is never loaded \u2014 no CoreML or GPU acceleration, model-derived segment timings, token timestamps, tinydiarize, beam/temperature decoding options, language auto-detect, or real VAD speech probabilities"
13437
+ coverage: 0,
13438
+ note: "RNWhisper.install() resolves false and the published wrapper reports that JSI bindings are unavailable",
13439
+ missing: "whisper.cpp and ggml model loading, transcription, Parakeet, voice activity detection, and benchmarks"
13441
13440
  }
13442
13441
  ]
13443
13442
  },
@@ -59976,8 +59975,10 @@ function bazelGraph(root, label, configuration) {
59976
59975
  );
59977
59976
  const deps = app2.attrs.get("deps")?.list ?? [];
59978
59977
  if (deps.length === 0) throw new Error(`${label} links no libraries`);
59978
+ const strings7 = app2.attrs.get("strings")?.list ?? [];
59979
59979
  const infoplists = app2.attrs.get("infoplists")?.list ?? [];
59980
- const query = `kind("${QUERIED_RULES.join("|")}", deps(set(${deps.join(" ")})))${infoplists.length > 0 ? ` + set(${infoplists.join(" ")})` : ""}`;
59980
+ const roots = [...deps, ...strings7];
59981
+ const query = `kind("${QUERIED_RULES.join("|")}", deps(set(${roots.join(" ")})))${infoplists.length > 0 ? ` + set(${infoplists.join(" ")})` : ""}`;
59981
59982
  const output2 = run12(["cquery", query, ...flags, "--output=jsonproto"]);
59982
59983
  const defaults = run12([
59983
59984
  "cquery",
@@ -60354,8 +60355,14 @@ ${published3.map(
60354
60355
  graph.app.attrs.get("infoplists")?.list ?? [],
60355
60356
  graph.app.label
60356
60357
  );
60358
+ const strings7 = files2.expand(
60359
+ graph.app.attrs.get("strings")?.list ?? [],
60360
+ graph.app.label
60361
+ );
60362
+ resources.push(...strings7);
60357
60363
  const absent = () => [
60358
60364
  ...infoPlistFiles,
60365
+ ...strings7,
60359
60366
  ...[...frameworks, appModule].flatMap((module2) => [
60360
60367
  ...module2.allSources,
60361
60368
  ...module2.objc?.headers ?? []
@@ -60399,7 +60406,7 @@ ${published3.map(
60399
60406
  const missing2 = options.requireSources === false ? [] : absent();
60400
60407
  if (missing2.length > 0)
60401
60408
  throw new Error(
60402
- `bazel generates ${missing2.length} sources this app compiles that are not built: ${missing2.slice(0, 5).map((file) => import_node_path45.default.relative(root, file)).join(", ")}`
60409
+ `bazel application has ${missing2.length} unbuilt inputs: ${missing2.slice(0, 5).map((file) => import_node_path45.default.relative(root, file)).join(", ")}`
60403
60410
  );
60404
60411
  const archives = /* @__PURE__ */ new Map();
60405
60412
  for (const rule of order) {
@@ -60707,7 +60714,7 @@ var init_bazel_project = __esm({
60707
60714
  HEADER3 = /\.(?:h|hh|hpp|hxx|inc|inl|ipp)$/;
60708
60715
  PRODUCTS = import_node_path45.default.join(".build", "peach-bazel", "Products");
60709
60716
  graphs = /* @__PURE__ */ new Map();
60710
- GRAPH_FORMAT = 4;
60717
+ GRAPH_FORMAT = 6;
60711
60718
  BazelFiles = class {
60712
60719
  constructor(graph, root) {
60713
60720
  this.graph = graph;
@@ -69945,7 +69952,11 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
69945
69952
  const def = definedGlobalSyms.get(symName);
69946
69953
  if (def) activateSymbolInObj(def.obj, def.symIdx);
69947
69954
  }
69948
- for (const symName of ["__peach_dlsym_from_image", "__peach_dlerror"]) {
69955
+ for (const symName of [
69956
+ "__peach_dlsym_from_image",
69957
+ "__peach_dlerror",
69958
+ ...link ? ["_dyld_register_func_for_add_image"] : []
69959
+ ]) {
69949
69960
  const provider = lazyProviders.get(symName)?.[0];
69950
69961
  if (provider) extractObject(provider);
69951
69962
  const def = definedGlobalSyms.get(symName);
@@ -70595,7 +70606,7 @@ function readString(bytes, position) {
70595
70606
  const [length, start] = readNumber(bytes, position);
70596
70607
  if (start + length > bytes.length) throw new Error("invalid wasm string");
70597
70608
  return [
70598
- Buffer.from(bytes.subarray(start, start + length)).toString("utf8"),
70609
+ Buffer.from(bytes.buffer, bytes.byteOffset + start, length).toString("utf8"),
70599
70610
  start + length
70600
70611
  ];
70601
70612
  }
@@ -70620,7 +70631,7 @@ function llvmType(value) {
70620
70631
  function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLookups, preserveCanonical) {
70621
70632
  if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
70622
70633
  throw new Error("expected wasm object");
70623
- const sections2 = [Buffer.from(bytes.subarray(0, 8))];
70634
+ const sections2 = binding ? [Buffer.from(bytes.subarray(0, 8))] : void 0;
70624
70635
  const types = [];
70625
70636
  const functionTypes = [];
70626
70637
  const definitions = [];
@@ -70634,8 +70645,9 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
70634
70645
  const [size2, start] = readNumber(bytes, position);
70635
70646
  const end = start + size2;
70636
70647
  if (end > bytes.length) throw new Error("invalid wasm section");
70637
- let section = Buffer.from(bytes.subarray(start, end));
70638
70648
  position = end;
70649
+ if (!sections2 && id > 3) continue;
70650
+ let section = Buffer.from(bytes.buffer, bytes.byteOffset + start, size2);
70639
70651
  let offset = 0;
70640
70652
  const number4 = () => {
70641
70653
  const [value, next] = readNumber(section, offset);
@@ -70663,7 +70675,7 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
70663
70675
  }
70664
70676
  } else if (id === 2) {
70665
70677
  const count = number4();
70666
- const imports2 = [encodeNumber(count)];
70678
+ const imports2 = sections2 ? [encodeNumber(count)] : void 0;
70667
70679
  for (let i = 0; i < count; i++) {
70668
70680
  const module2 = string7();
70669
70681
  const name3 = string7();
@@ -70707,17 +70719,17 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
70707
70719
  }
70708
70720
  if (isDlsym) usesDlsym = true;
70709
70721
  if (isDlerror) usesDlerror = true;
70710
- imports2.push(
70722
+ imports2?.push(
70711
70723
  encodedString(module2),
70712
70724
  encodedString(
70713
- isDlsym ? callerAlias : isDlerror ? "__peach_dlerror" : module2 === "env" && name3 !== "dlsym" && name3 !== "dlerror" ? binding(name3) ?? name3 : name3
70725
+ isDlsym ? callerAlias : isDlerror ? "__peach_dlerror" : module2 === "env" && name3 !== "dlsym" && name3 !== "dlerror" ? binding?.(name3) ?? name3 : name3
70714
70726
  ),
70715
70727
  Buffer.from([kind]),
70716
70728
  section.subarray(typeStart, offset)
70717
70729
  );
70718
70730
  }
70719
70731
  if (offset !== section.length) throw new Error("invalid wasm import section");
70720
- section = Buffer.concat(imports2);
70732
+ if (imports2) section = Buffer.concat(imports2);
70721
70733
  } else if (id === 3) {
70722
70734
  const count = number4();
70723
70735
  for (let i = 0; i < count; i++) functionTypes.push(number4());
@@ -70801,7 +70813,7 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
70801
70813
  encodedString(name3 === "dlsym" ? callerAlias : "__peach_dlerror"),
70802
70814
  section.subarray(nameEnd, offset)
70803
70815
  );
70804
- } else if (flags & 16 && name3 !== "dlsym" && name3 !== "dlerror" && binding(name3) !== void 0) {
70816
+ } else if (flags & 16 && name3 !== "dlsym" && name3 !== "dlerror" && binding?.(name3) !== void 0) {
70805
70817
  entries.push(
70806
70818
  section.subarray(begin, nameStart),
70807
70819
  encodedString(binding(name3)),
@@ -70876,10 +70888,10 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
70876
70888
  section = Buffer.concat(parts);
70877
70889
  }
70878
70890
  }
70879
- sections2.push(Buffer.from([id]), encodeNumber(section.length), section);
70891
+ sections2?.push(Buffer.from([id]), encodeNumber(section.length), section);
70880
70892
  }
70881
70893
  return {
70882
- bytes: Buffer.concat(sections2),
70894
+ bytes: sections2 ? Buffer.concat(sections2) : bytes,
70883
70895
  definitions,
70884
70896
  functionImports,
70885
70897
  usesDlsym,
@@ -70935,7 +70947,7 @@ function createGuestImageLedger(input) {
70935
70947
  object8.bytes,
70936
70948
  aliases,
70937
70949
  `__peach_dlsym_caller_${image.id}`,
70938
- () => void 0,
70950
+ void 0,
70939
70951
  object8.instrumentDynamicLookups,
70940
70952
  /* @__PURE__ */ new Set()
70941
70953
  );
@@ -73603,13 +73615,21 @@ function verifyGuestSymbolScopes(options) {
73603
73615
  continue;
73604
73616
  if (!scope2.includes(provider)) {
73605
73617
  const candidates = options.definitionObjects.get(symbol2) ?? /* @__PURE__ */ new Set();
73606
- const providers = [...record5.providers.keys()];
73618
+ const traced = [...record5.providers.keys()];
73619
+ const strongTraced = traced.filter(
73620
+ (definer) => !options.weakDefinitions.get(definer)?.has(symbol2)
73621
+ );
73622
+ const providers = strongTraced.length === 1 ? strongTraced : traced;
73607
73623
  if (options.weakReferences.get(object8)?.has(symbol2) && !providers.some((provider2) => options.systemProviders.has(provider2)))
73608
73624
  continue;
73609
73625
  const equivalentCopies = providers.length === 1 && candidates.has(providers[0]) && [...candidates].every(
73610
73626
  (definer) => options.weakDefinitions.get(definer)?.has(symbol2)
73611
73627
  );
73612
- if (!equivalentCopies && (candidates.size !== 1 || providers.length !== 1 || !candidates.has(providers[0]) || !(options.systemProviders.has(providers[0]) || // a strong undefined reference binds through the process global
73628
+ const strongCandidates = [...candidates].filter(
73629
+ (definer) => !options.weakDefinitions.get(definer)?.has(symbol2)
73630
+ );
73631
+ const soleCandidate = candidates.size === 1 || strongCandidates.length === 1 && strongCandidates[0] === providers[0];
73632
+ if (!equivalentCopies && (!soleCandidate || providers.length !== 1 || !candidates.has(providers[0]) || !(options.systemProviders.has(providers[0]) || // a strong undefined reference binds through the process global
73613
73633
  // scope, the root image and its dependency closure, as in elf.
73614
73634
  provider === 0 || callers.get(0)?.includes(provider) || !options.weakReferences.get(object8)?.has(symbol2) && options.frameworkProviders.get(object8)?.has(providers[0]))))
73615
73635
  throw new Error(
@@ -77148,6 +77168,8 @@ ${WASM_LOWER_IDENTITY}
77148
77168
  hash.update(JSON.stringify(input.staticClangTargets ?? []));
77149
77169
  hash.update(JSON.stringify(input.headerAliases ?? {}));
77150
77170
  hash.update(JSON.stringify(input.packageGuestImports ?? []));
77171
+ if (input.packageHostMacros?.length)
77172
+ hash.update("package-host-macros\n" + JSON.stringify(input.packageHostMacros));
77151
77173
  if (input.defaultLocalization)
77152
77174
  hash.update(`default-localization
77153
77175
  ${input.defaultLocalization}
@@ -80789,6 +80811,8 @@ function swiftLinkStamp(args) {
80789
80811
  hash.update(`swift-link/v1
80790
80812
  ${args.frameworkKey}
80791
80813
  `);
80814
+ if (args.packageHostMacros?.length)
80815
+ hash.update("package-host-macros\n" + JSON.stringify(args.packageHostMacros));
80792
80816
  if (!args.prebuilt) return hash.digest("hex");
80793
80817
  const statOf = (file) => {
80794
80818
  const stat2 = (0, import_node_fs72.statSync)(file, { bigint: true });
@@ -81013,11 +81037,13 @@ function compileSwiftProjectOnce(input, options) {
81013
81037
  });
81014
81038
  }
81015
81039
  if (options.project) removeProjectLinks(root);
81040
+ const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
81016
81041
  if (retireStaleSwiftLink(
81017
81042
  root,
81018
81043
  swiftLinkStamp({
81019
81044
  frameworkKey,
81020
- prebuilt
81045
+ prebuilt,
81046
+ packageHostMacros
81021
81047
  })
81022
81048
  ))
81023
81049
  report("framework revision changed; rebuilding the app link");
@@ -81040,8 +81066,38 @@ function compileSwiftProjectOnce(input, options) {
81040
81066
  ).product.name
81041
81067
  ] : []
81042
81068
  );
81043
- const projectProcess = options.project ? prepareSwiftProjectProcess(root, options.project) : void 0;
81044
81069
  const compiler = preparation.targetToolset ? { CC: import_node_path70.default.join(root, CLANG_TARGET_MODULE_WRAPPER) } : {};
81070
+ if (packageHostMacros?.length) {
81071
+ const swiftc = import_node_path70.default.join(root, SWIFT_HOST_COMPILER_WRAPPER);
81072
+ writeBuildFile(
81073
+ swiftc,
81074
+ [
81075
+ "#!/bin/sh",
81076
+ "target=",
81077
+ "module=",
81078
+ "compile=",
81079
+ "previous=",
81080
+ "for argument do",
81081
+ ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
81082
+ ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
81083
+ " previous=$argument",
81084
+ "done",
81085
+ 'case "$target/$compile" in',
81086
+ " *-*-linux*/1)",
81087
+ ' case ",$PEACH_SWIFT_HOST_MACROS," in',
81088
+ ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
81089
+ " esac ;;",
81090
+ "esac",
81091
+ 'exec "$PEACH_SWIFTC" "$@"',
81092
+ ""
81093
+ ].join("\n")
81094
+ );
81095
+ (0, import_node_fs72.chmodSync)(swiftc, 493);
81096
+ compiler.SWIFT_EXEC = swiftc;
81097
+ compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
81098
+ compiler.PEACH_SWIFTC = import_node_path70.default.join(options.toolchainBin, "swiftc");
81099
+ }
81100
+ const projectProcess = options.project ? prepareSwiftProjectProcess(root, options.project) : void 0;
81045
81101
  const appOptions = projectProcess ? {
81046
81102
  ...buildOptions,
81047
81103
  uid: projectProcess.uid,
@@ -81396,7 +81452,7 @@ function compileSwiftProjectOnce(input, options) {
81396
81452
  releaseDirectory: import_node_path70.default.dirname(linked),
81397
81453
  moduleRoot: frameworkRoot,
81398
81454
  toolchainBin: options.toolchainBin,
81399
- swiftCompiler: preparation.headerCompiler ? import_node_path70.default.join(root, SWIFT_HEADER_COMPILER_WRAPPER) : import_node_path70.default.join(options.toolchainBin, "swiftc"),
81455
+ swiftCompiler: preparation.headerCompiler ? import_node_path70.default.join(root, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path70.default.join(options.toolchainBin, "swiftc"),
81400
81456
  sysroot: swiftSdkPaths(frameworkRoot, options.toolchainBin).sysroot,
81401
81457
  sdk: swiftModuleSdk(frameworkRoot),
81402
81458
  staticClangTargets: input.staticClangTargets ?? [],
@@ -81434,7 +81490,7 @@ function compileSwiftProjectOnce(input, options) {
81434
81490
  options.signal
81435
81491
  );
81436
81492
  }
81437
- var import_node_child_process37, import_node_crypto35, import_node_fs72, import_node_os15, import_node_path70, v5, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, REACH_STAGED_FRAMEWORKS, clangInterfaceHeader, objcEnumerations, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, sdkPaths, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, FOUNDATION_IMPLICIT_MODULES, PRECONCURRENCY_FOUNDATION_IMPORT, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, DIRECTIVE, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, emptyMacroEnvironment, wasmMacroEnvironment, cPredefineTable, cPredefineCache, SWIFT_SCAN_KEYWORDS, HIDDEN_UNITS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, SWIFT_LINK_STAMP, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN;
81493
+ var import_node_child_process37, import_node_crypto35, import_node_fs72, import_node_os15, import_node_path70, v5, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, REACH_STAGED_FRAMEWORKS, clangInterfaceHeader, objcEnumerations, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, sdkPaths, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, FOUNDATION_IMPLICIT_MODULES, PRECONCURRENCY_FOUNDATION_IMPORT, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, DIRECTIVE, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, emptyMacroEnvironment, wasmMacroEnvironment, cPredefineTable, cPredefineCache, SWIFT_SCAN_KEYWORDS, HIDDEN_UNITS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN;
81438
81494
  var init_swift_compile = __esm({
81439
81495
  "src/swift-compile.ts"() {
81440
81496
  "use strict";
@@ -81675,7 +81731,7 @@ int EXUpdatesApplyBSDiffPatch(const char * _Nonnull oldFilePath,
81675
81731
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
81676
81732
  MULTI_MANIFEST_VERSION = 72;
81677
81733
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
81678
- compilerSourceDigest = true ? "2ff4da3ff6b56e29c8968a39135d8974f54c927608bde4993a6a2476beb749e6" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
81734
+ compilerSourceDigest = true ? "4a6e02699924195639b15c5cdfd8852b5f17fb2ffacb8f9f964ef3daeee8b9dc" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
81679
81735
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
81680
81736
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
81681
81737
  cxxFlagArray = (flags) => JSON.stringify([...nativeCxxCompilerFlags, ...withoutGlogModuleMap(flags)]);
@@ -82171,6 +82227,7 @@ int EXUpdatesApplyBSDiffPatch(const char * _Nonnull oldFilePath,
82171
82227
  retainedArtifacts = /* @__PURE__ */ new Map();
82172
82228
  FRAMEWORK_LINK_TARGET = "PeachFrameworkLink";
82173
82229
  SWIFT_LINK_STAMP = ".peach-link-stamp";
82230
+ SWIFT_HOST_COMPILER_WRAPPER = ".peach-swiftc";
82174
82231
  SWIFT_FRAMEWORK_SLOTS = 8;
82175
82232
  SWIFT_FRAMEWORK_SLOT_KEY = ".peach-framework-key";
82176
82233
  SWIFT_FRAMEWORK_SLOT_ORIGIN = ".peach-framework-origin";
@@ -88417,7 +88474,7 @@ var init_swift_standin_digest = __esm({
88417
88474
  STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
88418
88475
  SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
88419
88476
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
88420
- STANDIN_SOURCE_DIGEST = true ? "1f6eece6339ce20859e9666fa0ad8e9076485c71ec1cd098fe6a45fd6e28a28f" : standinSourceDigest();
88477
+ STANDIN_SOURCE_DIGEST = true ? "2517dacc106de8d2cadefded667b8502b029a35f04f5453646eb48792e0fb55c" : standinSourceDigest();
88421
88478
  }
88422
88479
  });
88423
88480
 
@@ -88912,7 +88969,7 @@ __export(expo_native_prebuilt_exports, {
88912
88969
  servedExpoSwift: () => servedExpoSwift
88913
88970
  });
88914
88971
  function expoNativeCompilerDigestValue() {
88915
- return true ? "412a013232d2ba79e33dcada2fa52a4b06e11bdaa1404a1d5ad312b7fe1522b5" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
88972
+ return true ? "5f4ceb325a4bf4e4aa833707da1460384624555bbc7a3bed9d973bd2507d8db6" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
88916
88973
  }
88917
88974
  function readSources(value) {
88918
88975
  const sources = isRecord(value) ? value.sources : null;
@@ -101094,6 +101151,13 @@ function packageSnapshot(project2, entry, moduleRoot) {
101094
101151
  ...Object.keys(projectFiles).length > 0 ? { projectFiles } : {},
101095
101152
  ...Object.keys(packageFiles2).length > 0 ? {
101096
101153
  packageFiles: packageFiles2,
101154
+ packageHostMacros: [
101155
+ ...new Set(
101156
+ (layout2?.packages.nativePackages ?? []).flatMap(
101157
+ ({ manifest }) => [...manifest.targets.values()].filter((target) => target.type === "macro").map((target) => swiftTargetModuleName(target.name))
101158
+ )
101159
+ )
101160
+ ].sort(),
101097
101161
  packageGuestImports: [
101098
101162
  ...new Set(
101099
101163
  (layout2?.packages.nativePackages ?? []).flatMap(
@@ -101160,7 +101224,8 @@ function snapshotCompileInput(snapshot) {
101160
101224
  files: snapshot.files,
101161
101225
  ...snapshot.packageFiles ? {
101162
101226
  packageFiles: snapshot.packageFiles,
101163
- packageGuestImports: snapshot.packageGuestImports
101227
+ packageGuestImports: snapshot.packageGuestImports,
101228
+ packageHostMacros: snapshot.packageHostMacros
101164
101229
  } : {},
101165
101230
  ...snapshot.projectFiles ? { projectFiles: snapshot.projectFiles } : {},
101166
101231
  ...snapshot.nativeTargets ? { nativeTargets: snapshot.nativeTargets } : {},
@@ -101426,7 +101491,8 @@ async function compileRemote(packagePath, snapshot, hosted, ownerSignal) {
101426
101491
  files: snapshot.files,
101427
101492
  ...snapshot.packageFiles ? {
101428
101493
  packageFiles: snapshot.packageFiles,
101429
- packageGuestImports: snapshot.packageGuestImports
101494
+ packageGuestImports: snapshot.packageGuestImports,
101495
+ packageHostMacros: snapshot.packageHostMacros
101430
101496
  } : {},
101431
101497
  ...snapshot.nativeTargets ? { nativeTargets: snapshot.nativeTargets } : {},
101432
101498
  ...snapshot.sourceLinkGraph ? { sourceLinkGraph: snapshot.sourceLinkGraph } : {},
@@ -112115,7 +112181,7 @@ var init_nitro_superset = __esm({
112115
112181
  init_nitroContract();
112116
112182
  init_swift_standin_digest();
112117
112183
  NITRO_SUPERSET_ENTRY_NAME = "superset";
112118
- NITRO_COMPILER_DIGEST = true ? "6764c6ea26594f3a00f19cd9e5f36dd70b5b7512565469477e6ea04833ce04ae" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
112184
+ NITRO_COMPILER_DIGEST = true ? "3856ca8527b7219f2b4be3736283df1fec84313b7dc56326d4d30f5e0e9b382a" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
112119
112185
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
112120
112186
  nitroSupersetKey = (inputs) => nativeEntryKey({ ...inputs, compiler: NITRO_COMPILER_DIGEST });
112121
112187
  published2 = /* @__PURE__ */ new Map();
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2434 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2436 | (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;
@@ -6571,7 +6571,11 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
6571
6571
  const def = definedGlobalSyms.get(symName);
6572
6572
  if (def) activateSymbolInObj(def.obj, def.symIdx);
6573
6573
  }
6574
- for (const symName of ["__peach_dlsym_from_image", "__peach_dlerror"]) {
6574
+ for (const symName of [
6575
+ "__peach_dlsym_from_image",
6576
+ "__peach_dlerror",
6577
+ ...link ? ["_dyld_register_func_for_add_image"] : []
6578
+ ]) {
6575
6579
  const provider = lazyProviders.get(symName)?.[0];
6576
6580
  if (provider) extractObject(provider);
6577
6581
  const def = definedGlobalSyms.get(symName);
@@ -7124,7 +7128,7 @@ function readString(bytes, position) {
7124
7128
  const [length, start] = readNumber(bytes, position);
7125
7129
  if (start + length > bytes.length) throw new Error("invalid wasm string");
7126
7130
  return [
7127
- Buffer.from(bytes.subarray(start, start + length)).toString("utf8"),
7131
+ Buffer.from(bytes.buffer, bytes.byteOffset + start, length).toString("utf8"),
7128
7132
  start + length
7129
7133
  ];
7130
7134
  }
@@ -7151,7 +7155,7 @@ var OBJC_LOAD_FUNCTION = ".objcv2_load_function";
7151
7155
  function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLookups, preserveCanonical) {
7152
7156
  if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
7153
7157
  throw new Error("expected wasm object");
7154
- const sections2 = [Buffer.from(bytes.subarray(0, 8))];
7158
+ const sections2 = binding ? [Buffer.from(bytes.subarray(0, 8))] : void 0;
7155
7159
  const types = [];
7156
7160
  const functionTypes = [];
7157
7161
  const definitions = [];
@@ -7165,8 +7169,9 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
7165
7169
  const [size, start] = readNumber(bytes, position);
7166
7170
  const end = start + size;
7167
7171
  if (end > bytes.length) throw new Error("invalid wasm section");
7168
- let section = Buffer.from(bytes.subarray(start, end));
7169
7172
  position = end;
7173
+ if (!sections2 && id > 3) continue;
7174
+ let section = Buffer.from(bytes.buffer, bytes.byteOffset + start, size);
7170
7175
  let offset = 0;
7171
7176
  const number3 = () => {
7172
7177
  const [value, next] = readNumber(section, offset);
@@ -7194,7 +7199,7 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
7194
7199
  }
7195
7200
  } else if (id === 2) {
7196
7201
  const count = number3();
7197
- const imports = [encodeNumber(count)];
7202
+ const imports = sections2 ? [encodeNumber(count)] : void 0;
7198
7203
  for (let i = 0; i < count; i++) {
7199
7204
  const module2 = string3();
7200
7205
  const name2 = string3();
@@ -7238,17 +7243,17 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
7238
7243
  }
7239
7244
  if (isDlsym) usesDlsym = true;
7240
7245
  if (isDlerror) usesDlerror = true;
7241
- imports.push(
7246
+ imports?.push(
7242
7247
  encodedString(module2),
7243
7248
  encodedString(
7244
- isDlsym ? callerAlias : isDlerror ? "__peach_dlerror" : module2 === "env" && name2 !== "dlsym" && name2 !== "dlerror" ? binding(name2) ?? name2 : name2
7249
+ isDlsym ? callerAlias : isDlerror ? "__peach_dlerror" : module2 === "env" && name2 !== "dlsym" && name2 !== "dlerror" ? binding?.(name2) ?? name2 : name2
7245
7250
  ),
7246
7251
  Buffer.from([kind]),
7247
7252
  section.subarray(typeStart, offset)
7248
7253
  );
7249
7254
  }
7250
7255
  if (offset !== section.length) throw new Error("invalid wasm import section");
7251
- section = Buffer.concat(imports);
7256
+ if (imports) section = Buffer.concat(imports);
7252
7257
  } else if (id === 3) {
7253
7258
  const count = number3();
7254
7259
  for (let i = 0; i < count; i++) functionTypes.push(number3());
@@ -7332,7 +7337,7 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
7332
7337
  encodedString(name2 === "dlsym" ? callerAlias : "__peach_dlerror"),
7333
7338
  section.subarray(nameEnd, offset)
7334
7339
  );
7335
- } else if (flags & 16 && name2 !== "dlsym" && name2 !== "dlerror" && binding(name2) !== void 0) {
7340
+ } else if (flags & 16 && name2 !== "dlsym" && name2 !== "dlerror" && binding?.(name2) !== void 0) {
7336
7341
  entries.push(
7337
7342
  section.subarray(begin, nameStart),
7338
7343
  encodedString(binding(name2)),
@@ -7407,10 +7412,10 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
7407
7412
  section = Buffer.concat(parts);
7408
7413
  }
7409
7414
  }
7410
- sections2.push(Buffer.from([id]), encodeNumber(section.length), section);
7415
+ sections2?.push(Buffer.from([id]), encodeNumber(section.length), section);
7411
7416
  }
7412
7417
  return {
7413
- bytes: Buffer.concat(sections2),
7418
+ bytes: sections2 ? Buffer.concat(sections2) : bytes,
7414
7419
  definitions,
7415
7420
  functionImports,
7416
7421
  usesDlsym,
@@ -7466,7 +7471,7 @@ function createGuestImageLedger(input) {
7466
7471
  object3.bytes,
7467
7472
  aliases,
7468
7473
  `__peach_dlsym_caller_${image.id}`,
7469
- () => void 0,
7474
+ void 0,
7470
7475
  object3.instrumentDynamicLookups,
7471
7476
  /* @__PURE__ */ new Set()
7472
7477
  );
@@ -10062,13 +10067,21 @@ function verifyGuestSymbolScopes(options) {
10062
10067
  continue;
10063
10068
  if (!scope.includes(provider)) {
10064
10069
  const candidates = options.definitionObjects.get(symbol) ?? /* @__PURE__ */ new Set();
10065
- const providers = [...record.providers.keys()];
10070
+ const traced = [...record.providers.keys()];
10071
+ const strongTraced = traced.filter(
10072
+ (definer) => !options.weakDefinitions.get(definer)?.has(symbol)
10073
+ );
10074
+ const providers = strongTraced.length === 1 ? strongTraced : traced;
10066
10075
  if (options.weakReferences.get(object3)?.has(symbol) && !providers.some((provider2) => options.systemProviders.has(provider2)))
10067
10076
  continue;
10068
10077
  const equivalentCopies = providers.length === 1 && candidates.has(providers[0]) && [...candidates].every(
10069
10078
  (definer) => options.weakDefinitions.get(definer)?.has(symbol)
10070
10079
  );
10071
- if (!equivalentCopies && (candidates.size !== 1 || providers.length !== 1 || !candidates.has(providers[0]) || !(options.systemProviders.has(providers[0]) || // a strong undefined reference binds through the process global
10080
+ const strongCandidates = [...candidates].filter(
10081
+ (definer) => !options.weakDefinitions.get(definer)?.has(symbol)
10082
+ );
10083
+ const soleCandidate = candidates.size === 1 || strongCandidates.length === 1 && strongCandidates[0] === providers[0];
10084
+ if (!equivalentCopies && (!soleCandidate || providers.length !== 1 || !candidates.has(providers[0]) || !(options.systemProviders.has(providers[0]) || // a strong undefined reference binds through the process global
10072
10085
  // scope, the root image and its dependency closure, as in elf.
10073
10086
  provider === 0 || callers.get(0)?.includes(provider) || !options.weakReferences.get(object3)?.has(symbol) && options.frameworkProviders.get(object3)?.has(providers[0]))))
10074
10087
  throw new Error(
@@ -14067,7 +14080,7 @@ var darwinRecordsRegion = (quoted2) => quoted2.length ? ["-Wl,--start-lib", ...q
14067
14080
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
14068
14081
  var MULTI_MANIFEST_VERSION = 72;
14069
14082
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
14070
- var compilerSourceDigest = true ? "2ff4da3ff6b56e29c8968a39135d8974f54c927608bde4993a6a2476beb749e6" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
14083
+ var compilerSourceDigest = true ? "4a6e02699924195639b15c5cdfd8852b5f17fb2ffacb8f9f964ef3daeee8b9dc" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
14071
14084
  function swiftArtifactHash(input, release, moduleRoot) {
14072
14085
  const hash = (0, import_node_crypto15.createHash)("sha256");
14073
14086
  hash.update(`swift-compile
@@ -14119,6 +14132,8 @@ ${WASM_LOWER_IDENTITY}
14119
14132
  hash.update(JSON.stringify(input.staticClangTargets ?? []));
14120
14133
  hash.update(JSON.stringify(input.headerAliases ?? {}));
14121
14134
  hash.update(JSON.stringify(input.packageGuestImports ?? []));
14135
+ if (input.packageHostMacros?.length)
14136
+ hash.update("package-host-macros\n" + JSON.stringify(input.packageHostMacros));
14122
14137
  if (input.defaultLocalization)
14123
14138
  hash.update(`default-localization
14124
14139
  ${input.defaultLocalization}
@@ -18161,6 +18176,7 @@ ${args.frameworkKey}`, scratch2, [
18161
18176
  };
18162
18177
  }
18163
18178
  var SWIFT_LINK_STAMP = ".peach-link-stamp";
18179
+ var SWIFT_HOST_COMPILER_WRAPPER = ".peach-swiftc";
18164
18180
  var SWIFT_FRAMEWORK_SLOTS = 8;
18165
18181
  var SWIFT_FRAMEWORK_SLOT_KEY = ".peach-framework-key";
18166
18182
  var SWIFT_FRAMEWORK_SLOT_ORIGIN = ".peach-framework-origin";
@@ -18318,6 +18334,8 @@ function swiftLinkStamp(args) {
18318
18334
  hash.update(`swift-link/v1
18319
18335
  ${args.frameworkKey}
18320
18336
  `);
18337
+ if (args.packageHostMacros?.length)
18338
+ hash.update("package-host-macros\n" + JSON.stringify(args.packageHostMacros));
18321
18339
  if (!args.prebuilt) return hash.digest("hex");
18322
18340
  const statOf = (file) => {
18323
18341
  const stat = (0, import_node_fs26.statSync)(file, { bigint: true });
@@ -18542,11 +18560,13 @@ function compileSwiftProjectOnce(input, options) {
18542
18560
  });
18543
18561
  }
18544
18562
  if (options.project) removeProjectLinks(root);
18563
+ const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
18545
18564
  if (retireStaleSwiftLink(
18546
18565
  root,
18547
18566
  swiftLinkStamp({
18548
18567
  frameworkKey,
18549
- prebuilt
18568
+ prebuilt,
18569
+ packageHostMacros
18550
18570
  })
18551
18571
  ))
18552
18572
  report("framework revision changed; rebuilding the app link");
@@ -18569,8 +18589,38 @@ function compileSwiftProjectOnce(input, options) {
18569
18589
  ).product.name
18570
18590
  ] : []
18571
18591
  );
18572
- const projectProcess = options.project ? prepareSwiftProjectProcess(root, options.project) : void 0;
18573
18592
  const compiler = preparation.targetToolset ? { CC: import_node_path28.default.join(root, CLANG_TARGET_MODULE_WRAPPER) } : {};
18593
+ if (packageHostMacros?.length) {
18594
+ const swiftc = import_node_path28.default.join(root, SWIFT_HOST_COMPILER_WRAPPER);
18595
+ writeBuildFile(
18596
+ swiftc,
18597
+ [
18598
+ "#!/bin/sh",
18599
+ "target=",
18600
+ "module=",
18601
+ "compile=",
18602
+ "previous=",
18603
+ "for argument do",
18604
+ ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
18605
+ ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
18606
+ " previous=$argument",
18607
+ "done",
18608
+ 'case "$target/$compile" in',
18609
+ " *-*-linux*/1)",
18610
+ ' case ",$PEACH_SWIFT_HOST_MACROS," in',
18611
+ ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
18612
+ " esac ;;",
18613
+ "esac",
18614
+ 'exec "$PEACH_SWIFTC" "$@"',
18615
+ ""
18616
+ ].join("\n")
18617
+ );
18618
+ (0, import_node_fs26.chmodSync)(swiftc, 493);
18619
+ compiler.SWIFT_EXEC = swiftc;
18620
+ compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
18621
+ compiler.PEACH_SWIFTC = import_node_path28.default.join(options.toolchainBin, "swiftc");
18622
+ }
18623
+ const projectProcess = options.project ? prepareSwiftProjectProcess(root, options.project) : void 0;
18574
18624
  const appOptions = projectProcess ? {
18575
18625
  ...buildOptions,
18576
18626
  uid: projectProcess.uid,
@@ -18925,7 +18975,7 @@ function compileSwiftProjectOnce(input, options) {
18925
18975
  releaseDirectory: import_node_path28.default.dirname(linked),
18926
18976
  moduleRoot: frameworkRoot,
18927
18977
  toolchainBin: options.toolchainBin,
18928
- swiftCompiler: preparation.headerCompiler ? import_node_path28.default.join(root, SWIFT_HEADER_COMPILER_WRAPPER) : import_node_path28.default.join(options.toolchainBin, "swiftc"),
18978
+ swiftCompiler: preparation.headerCompiler ? import_node_path28.default.join(root, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path28.default.join(options.toolchainBin, "swiftc"),
18929
18979
  sysroot: swiftSdkPaths(frameworkRoot, options.toolchainBin).sysroot,
18930
18980
  sdk: swiftModuleSdk(frameworkRoot),
18931
18981
  staticClangTargets: input.staticClangTargets ?? [],