peachsim 0.1.769 → 0.1.770

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 (75) hide show
  1. package/cli/outbound-endpoints.ts +14 -0
  2. package/dist-lib/agent-daemon-client.cjs +1 -1
  3. package/dist-lib/agent-events.cjs +1 -1
  4. package/dist-lib/agent-identity.cjs +1 -1
  5. package/dist-lib/agent-sessions.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/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +1 -1
  18. package/dist-lib/cli-constants.cjs +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/detox/index.cjs +1 -1
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/home-paths.cjs +1 -1
  29. package/dist-lib/host/bridge-host.cjs +548 -436
  30. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  31. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  32. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  33. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  34. package/dist-lib/host/websocket-proxy.cjs +1 -1
  35. package/dist-lib/index.cjs +1 -1
  36. package/dist-lib/jump-to-source-babel.cjs +1 -1
  37. package/dist-lib/jump-to-source-native.cjs +1 -1
  38. package/dist-lib/kotlin-host.cjs +1 -1
  39. package/dist-lib/menu.cjs +1 -1
  40. package/dist-lib/menu.mjs +1 -1
  41. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  42. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  43. package/dist-lib/metro-production-bundle.cjs +1 -1
  44. package/dist-lib/metro-production-bundle.mjs +1 -1
  45. package/dist-lib/metro.cjs +1 -1
  46. package/dist-lib/native-app-identity.cjs +1 -1
  47. package/dist-lib/native-app-identity.mjs +1 -1
  48. package/dist-lib/native-firebase-metadata.cjs +1 -1
  49. package/dist-lib/native-firebase-metadata.mjs +1 -1
  50. package/dist-lib/plist.cjs +1 -1
  51. package/dist-lib/plist.mjs +1 -1
  52. package/dist-lib/profiles.cjs +1 -1
  53. package/dist-lib/public-brand.cjs +1 -1
  54. package/dist-lib/react-native-host-modules.cjs +1 -1
  55. package/dist-lib/react-native-host-modules.mjs +1 -1
  56. package/dist-lib/render-mode.cjs +1 -1
  57. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  58. package/dist-lib/sdk.cjs +1 -1
  59. package/dist-lib/sdk.mjs +1 -1
  60. package/dist-lib/skills.cjs +817 -698
  61. package/dist-lib/swift-compile.cjs +1 -1
  62. package/dist-lib/swift-compile.mjs +1 -1
  63. package/dist-lib/swift-package.cjs +1 -1
  64. package/dist-lib/swift-package.mjs +1 -1
  65. package/dist-lib/swift-submit.cjs +1 -1
  66. package/dist-lib/swift-submit.mjs +1 -1
  67. package/dist-lib/swift-toolchain.cjs +1 -1
  68. package/dist-lib/swift.cjs +1 -1
  69. package/dist-lib/vite-swift.cjs +381 -269
  70. package/dist-lib/vite.cjs +1 -1
  71. package/package.json +1 -1
  72. package/src/swift-binary-modules.ts +116 -0
  73. package/src/swift-host.ts +28 -4
  74. package/src/swift-package-manifest.ts +3 -0
  75. package/src/swift-packages.ts +32 -4
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.769 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.770 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -287,8 +287,8 @@ __export(vite_plugin_swift_exports, {
287
287
  swiftPlugin: () => swiftPlugin
288
288
  });
289
289
  module.exports = __toCommonJS(vite_plugin_swift_exports);
290
- var import_node_fs11 = __toESM(require("node:fs"), 1);
291
- var import_node_path13 = __toESM(require("node:path"), 1);
290
+ var import_node_fs12 = __toESM(require("node:fs"), 1);
291
+ var import_node_path14 = __toESM(require("node:path"), 1);
292
292
 
293
293
  // ../sootsim-swift/src/entryModule.ts
294
294
  function nativeExportLines(args, commonjs) {
@@ -1227,14 +1227,14 @@ function liftExtensionOverrides(source, extraObjCExtensions) {
1227
1227
  const args = forwardedArguments(source.slice(open + 1, close));
1228
1228
  if (args === null) continue;
1229
1229
  const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name}(${args})`;
1230
- const signature = `func ${name}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
1230
+ const signature2 = `func ${name}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
1231
1231
  const nameAt = at + rest.indexOf(name, rest.indexOf("func", "override".length + func[1].length) + 4);
1232
1232
  lifted.push({
1233
1233
  type: top.name,
1234
1234
  member: name,
1235
1235
  at,
1236
1236
  modifiers,
1237
- decl: signature,
1237
+ decl: signature2,
1238
1238
  forward: `{ ${call} };`,
1239
1239
  nameAt,
1240
1240
  edits: [
@@ -1958,10 +1958,10 @@ function compileSwiftProjectUnit(input, options) {
1958
1958
  }
1959
1959
 
1960
1960
  // src/swift-host.ts
1961
- var import_node_crypto5 = require("node:crypto");
1962
- var import_node_fs10 = __toESM(require("node:fs"), 1);
1963
- var import_node_os6 = __toESM(require("node:os"), 1);
1964
- var import_node_path12 = __toESM(require("node:path"), 1);
1961
+ var import_node_crypto6 = require("node:crypto");
1962
+ var import_node_fs11 = __toESM(require("node:fs"), 1);
1963
+ var import_node_os7 = __toESM(require("node:os"), 1);
1964
+ var import_node_path13 = __toESM(require("node:path"), 1);
1965
1965
 
1966
1966
  // ../sootsim-swift/src/bundleAssets.ts
1967
1967
  var import_svgpath = __toESM(require("svgpath"), 1);
@@ -1995,8 +1995,8 @@ function pickImagesetFile(images) {
1995
1995
  scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
1996
1996
  };
1997
1997
  }
1998
- function flatScale(path13) {
1999
- const match = /@([23])x\.[^./]+$/.exec(path13);
1998
+ function flatScale(path14) {
1999
+ const match = /@([23])x\.[^./]+$/.exec(path14);
2000
2000
  return match ? Number(match[1]) : 1;
2001
2001
  }
2002
2002
  function providesNamespace(text2) {
@@ -2023,13 +2023,13 @@ function catalogEntryName(contentsPath, kind, readText) {
2023
2023
  }
2024
2024
  return segments.join("/");
2025
2025
  }
2026
- function isFlatResourceImage(path13) {
2027
- return path13.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path13));
2026
+ function isFlatResourceImage(path14) {
2027
+ return path14.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path14));
2028
2028
  }
2029
2029
  function enumerateBundleImages(paths, readText) {
2030
2030
  const table = [];
2031
2031
  const seen = /* @__PURE__ */ new Set();
2032
- const catalogs = paths.filter((path13) => baseOf(path13) === "Contents.json");
2032
+ const catalogs = paths.filter((path14) => baseOf(path14) === "Contents.json");
2033
2033
  for (const contentsPath of catalogs) {
2034
2034
  const name = catalogEntryName(contentsPath, ".imageset", readText);
2035
2035
  if (name === null || seen.has(name)) continue;
@@ -2050,12 +2050,12 @@ function enumerateBundleImages(paths, readText) {
2050
2050
  seen.add(name);
2051
2051
  table.push({ name, file: `${dir}/${pick.filename}`, scale: pick.scale });
2052
2052
  }
2053
- for (const path13 of paths) {
2054
- if (!isFlatResourceImage(path13)) continue;
2055
- const name = baseOf(path13).slice(0, -extOf(path13).length);
2053
+ for (const path14 of paths) {
2054
+ if (!isFlatResourceImage(path14)) continue;
2055
+ const name = baseOf(path14).slice(0, -extOf(path14).length);
2056
2056
  if (name === "" || seen.has(name)) continue;
2057
2057
  seen.add(name);
2058
- table.push({ name, file: path13, scale: flatScale(path13) });
2058
+ table.push({ name, file: path14, scale: flatScale(path14) });
2059
2059
  }
2060
2060
  return table;
2061
2061
  }
@@ -2084,7 +2084,7 @@ function colorsetValue(color) {
2084
2084
  }
2085
2085
  function enumerateBundleColors(paths, readText) {
2086
2086
  const table = {};
2087
- for (const contentsPath of paths.filter((path13) => baseOf(path13) === "Contents.json")) {
2087
+ for (const contentsPath of paths.filter((path14) => baseOf(path14) === "Contents.json")) {
2088
2088
  const name = catalogEntryName(contentsPath, ".colorset", readText);
2089
2089
  if (name === null || name in table) continue;
2090
2090
  let colors;
@@ -2149,8 +2149,8 @@ function axisExtremes(points) {
2149
2149
  function pathBounds(d) {
2150
2150
  const xs = [];
2151
2151
  const ys = [];
2152
- for (const path13 of d)
2153
- (0, import_svgpath.default)(path13).abs().unshort().unarc().iterate((segment, _index, x, y) => {
2152
+ for (const path14 of d)
2153
+ (0, import_svgpath.default)(path14).abs().unshort().unarc().iterate((segment, _index, x, y) => {
2154
2154
  const [command, ...args] = segment;
2155
2155
  if (command === "M" || command === "L") {
2156
2156
  xs.push(Number(args[0]));
@@ -2177,7 +2177,7 @@ function guide(svg, id, axis) {
2177
2177
  }
2178
2178
  function enumerateBundleSymbols(paths, readText) {
2179
2179
  const table = {};
2180
- for (const contentsPath of paths.filter((path13) => baseOf(path13) === "Contents.json")) {
2180
+ for (const contentsPath of paths.filter((path14) => baseOf(path14) === "Contents.json")) {
2181
2181
  const name = catalogEntryName(contentsPath, ".symbolset", readText);
2182
2182
  if (name === null || name in table) continue;
2183
2183
  let symbols;
@@ -2210,8 +2210,8 @@ function enumerateBundleSymbols(paths, readText) {
2210
2210
  viewBox: "0 0 24 24",
2211
2211
  advance,
2212
2212
  box: [12 - advance / 2, 12 - tall / 2, advance, tall],
2213
- layers: d.map((path13) => ({
2214
- d: (0, import_svgpath.default)(path13).abs().scale(scale).translate(translateX, translateY).round(3).toString()
2213
+ layers: d.map((path14) => ({
2214
+ d: (0, import_svgpath.default)(path14).abs().scale(scale).translate(translateX, translateY).round(3).toString()
2215
2215
  }))
2216
2216
  };
2217
2217
  }
@@ -2221,7 +2221,7 @@ function enumerateBundleJson(paths) {
2221
2221
  const found = [];
2222
2222
  const seen = /* @__PURE__ */ new Set();
2223
2223
  const ordered = [...paths].filter(
2224
- (path13) => path13.split("/").includes("Resources") && path13.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path13) === ".json" || extOf(path13) === ".xcstrings")
2224
+ (path14) => path14.split("/").includes("Resources") && path14.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path14) === ".json" || extOf(path14) === ".xcstrings")
2225
2225
  ).sort((a, b) => {
2226
2226
  const aDepth = a.split("/").length;
2227
2227
  const bDepth = b.split("/").length;
@@ -2727,25 +2727,109 @@ var ios_sdk_frameworks_default = {
2727
2727
  ]
2728
2728
  };
2729
2729
 
2730
+ // src/swift-binary-modules.ts
2731
+ var import_node_crypto3 = require("node:crypto");
2732
+ var import_node_fs4 = __toESM(require("node:fs"), 1);
2733
+ var import_node_os3 = __toESM(require("node:os"), 1);
2734
+ var import_node_path5 = __toESM(require("node:path"), 1);
2735
+ var cacheDir = import_node_path5.default.join(import_node_os3.default.tmpdir(), "peach-swift-binary-modules");
2736
+ function frameworkModules(paths) {
2737
+ const modules = /* @__PURE__ */ new Set();
2738
+ for (const file of paths) {
2739
+ const segment = file.split("/").find((part) => part.endsWith(".framework"));
2740
+ if (segment) modules.add(segment.slice(0, -".framework".length));
2741
+ }
2742
+ return [...modules].sort();
2743
+ }
2744
+ async function range(url, spec) {
2745
+ const response = await fetch(url, {
2746
+ headers: { range: `bytes=${spec}` },
2747
+ signal: AbortSignal.timeout(2e4)
2748
+ });
2749
+ const match = /^bytes (\d+)-\d+\/(\d+)$/.exec(
2750
+ response.headers.get("content-range") ?? ""
2751
+ );
2752
+ if (response.status !== 206 || !match)
2753
+ throw new Error(`${url} answered ${response.status} to a range request`);
2754
+ return {
2755
+ bytes: Buffer.from(await response.arrayBuffer()),
2756
+ start: Number(match[1]),
2757
+ total: Number(match[2])
2758
+ };
2759
+ }
2760
+ var signature = (bytes, value) => {
2761
+ const needle = Buffer.alloc(4);
2762
+ needle.writeUInt32LE(value);
2763
+ return bytes.lastIndexOf(needle);
2764
+ };
2765
+ async function zipEntries(url) {
2766
+ const { total } = await range(url, "0-0");
2767
+ const tail = await range(url, `${Math.max(0, total - 65558)}-${total - 1}`);
2768
+ const end = signature(tail.bytes, 101010256);
2769
+ if (end < 0) throw new Error(`${url} has no zip end record`);
2770
+ let size = tail.bytes.readUInt32LE(end + 12);
2771
+ let offset = tail.bytes.readUInt32LE(end + 16);
2772
+ if (offset === 4294967295 || size === 4294967295) {
2773
+ const locator = end - 20;
2774
+ if (locator < 0 || tail.bytes.readUInt32LE(locator) !== 117853008)
2775
+ throw new Error(`${url} has no zip64 locator`);
2776
+ const recordAt = Number(tail.bytes.readBigUInt64LE(locator + 8));
2777
+ const record2 = recordAt >= tail.start ? tail.bytes.subarray(recordAt - tail.start) : (await range(url, `${recordAt}-${recordAt + 55}`)).bytes;
2778
+ size = Number(record2.readBigUInt64LE(40));
2779
+ offset = Number(record2.readBigUInt64LE(48));
2780
+ }
2781
+ const directory = offset >= tail.start ? tail.bytes.subarray(offset - tail.start, offset - tail.start + size) : (await range(url, `${offset}-${offset + size - 1}`)).bytes;
2782
+ const names = [];
2783
+ for (let at = 0; at + 46 <= directory.length; ) {
2784
+ if (directory.readUInt32LE(at) !== 33639248) break;
2785
+ const nameLength = directory.readUInt16LE(at + 28);
2786
+ names.push(directory.toString("utf8", at + 46, at + 46 + nameLength));
2787
+ at += 46 + nameLength + directory.readUInt16LE(at + 30) + directory.readUInt16LE(at + 32);
2788
+ }
2789
+ return names;
2790
+ }
2791
+ function localEntries(dir) {
2792
+ if (!import_node_fs4.default.existsSync(dir)) return [];
2793
+ return import_node_fs4.default.readdirSync(dir, { withFileTypes: true }).filter((slice) => slice.isDirectory()).flatMap(
2794
+ (slice) => import_node_fs4.default.readdirSync(import_node_path5.default.join(dir, slice.name)).map((entry) => `${slice.name}/${entry}`)
2795
+ );
2796
+ }
2797
+ async function swiftBinaryModules(binary) {
2798
+ if (!binary.url) return frameworkModules(localEntries(binary.dir));
2799
+ const cached = import_node_path5.default.join(
2800
+ cacheDir,
2801
+ `${(0, import_node_crypto3.createHash)("sha256").update(binary.url).digest("hex").slice(0, 32)}.json`
2802
+ );
2803
+ if (import_node_fs4.default.existsSync(cached)) {
2804
+ const value = JSON.parse(import_node_fs4.default.readFileSync(cached, "utf8"));
2805
+ if (Array.isArray(value) && value.every((name) => typeof name === "string"))
2806
+ return value;
2807
+ }
2808
+ const modules = frameworkModules(await zipEntries(binary.url));
2809
+ import_node_fs4.default.mkdirSync(cacheDir, { recursive: true });
2810
+ import_node_fs4.default.writeFileSync(cached, JSON.stringify(modules));
2811
+ return modules;
2812
+ }
2813
+
2730
2814
  // src/swift-distribution.ts
2731
- var import_node_fs6 = __toESM(require("node:fs"), 1);
2732
- var import_node_path7 = __toESM(require("node:path"), 1);
2815
+ var import_node_fs7 = __toESM(require("node:fs"), 1);
2816
+ var import_node_path8 = __toESM(require("node:path"), 1);
2733
2817
 
2734
2818
  // ../contrast-runtime-delivery/src/index.ts
2735
2819
  var import_node_child_process3 = require("node:child_process");
2736
- var import_node_crypto3 = __toESM(require("node:crypto"), 1);
2737
- var import_node_fs4 = __toESM(require("node:fs"), 1);
2738
- var import_node_os3 = __toESM(require("node:os"), 1);
2739
- var import_node_path5 = __toESM(require("node:path"), 1);
2820
+ var import_node_crypto4 = __toESM(require("node:crypto"), 1);
2821
+ var import_node_fs5 = __toESM(require("node:fs"), 1);
2822
+ var import_node_os4 = __toESM(require("node:os"), 1);
2823
+ var import_node_path6 = __toESM(require("node:path"), 1);
2740
2824
  var import_node_stream = require("node:stream");
2741
2825
  var import_promises = require("node:stream/promises");
2742
2826
  async function installVerifiedTarball(tarball) {
2743
2827
  const { url, digest, destDir, installedMarker, label } = tarball;
2744
- const downloadDir = import_node_fs4.default.mkdtempSync(import_node_path5.default.join(import_node_os3.default.tmpdir(), "runtime-delivery-download-"));
2745
- const archivePath = import_node_path5.default.join(downloadDir, "archive");
2746
- import_node_fs4.default.mkdirSync(import_node_path5.default.dirname(destDir), { recursive: true });
2747
- const tmpDir = import_node_fs4.default.mkdtempSync(
2748
- import_node_path5.default.join(import_node_path5.default.dirname(destDir), `.installing-${import_node_path5.default.basename(destDir)}-`)
2828
+ const downloadDir = import_node_fs5.default.mkdtempSync(import_node_path6.default.join(import_node_os4.default.tmpdir(), "runtime-delivery-download-"));
2829
+ const archivePath = import_node_path6.default.join(downloadDir, "archive");
2830
+ import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(destDir), { recursive: true });
2831
+ const tmpDir = import_node_fs5.default.mkdtempSync(
2832
+ import_node_path6.default.join(import_node_path6.default.dirname(destDir), `.installing-${import_node_path6.default.basename(destDir)}-`)
2749
2833
  );
2750
2834
  try {
2751
2835
  await downloadToFile(url, archivePath);
@@ -2757,33 +2841,33 @@ async function installVerifiedTarball(tarball) {
2757
2841
  }
2758
2842
  if (new URL(url).pathname.endsWith(".zip")) await extractZip(archivePath, tmpDir);
2759
2843
  else await extractTarball(archivePath, tmpDir, tarball.stripComponents ?? 0);
2760
- if (!import_node_fs4.default.existsSync(import_node_path5.default.join(tmpDir, installedMarker))) {
2844
+ if (!import_node_fs5.default.existsSync(import_node_path6.default.join(tmpDir, installedMarker))) {
2761
2845
  throw new Error(`extracted tarball for ${label} is missing ${installedMarker}`);
2762
2846
  }
2763
2847
  tarball.verify?.(tmpDir);
2764
2848
  try {
2765
- import_node_fs4.default.renameSync(tmpDir, destDir);
2849
+ import_node_fs5.default.renameSync(tmpDir, destDir);
2766
2850
  } catch (err) {
2767
2851
  if (!isErrnoCode(err, "ENOTEMPTY", "EEXIST")) throw err;
2768
2852
  const aside = `${tmpDir}-replaced`;
2769
2853
  try {
2770
- import_node_fs4.default.renameSync(destDir, aside);
2854
+ import_node_fs5.default.renameSync(destDir, aside);
2771
2855
  } catch (moveErr) {
2772
2856
  if (!isErrnoCode(moveErr, "ENOENT")) throw moveErr;
2773
2857
  }
2774
2858
  try {
2775
- import_node_fs4.default.renameSync(tmpDir, destDir);
2859
+ import_node_fs5.default.renameSync(tmpDir, destDir);
2776
2860
  } catch (landErr) {
2777
- if (!isErrnoCode(landErr, "ENOTEMPTY", "EEXIST") || !import_node_fs4.default.existsSync(import_node_path5.default.join(destDir, installedMarker))) {
2861
+ if (!isErrnoCode(landErr, "ENOTEMPTY", "EEXIST") || !import_node_fs5.default.existsSync(import_node_path6.default.join(destDir, installedMarker))) {
2778
2862
  throw landErr;
2779
2863
  }
2780
2864
  } finally {
2781
- import_node_fs4.default.rmSync(aside, { recursive: true, force: true });
2865
+ import_node_fs5.default.rmSync(aside, { recursive: true, force: true });
2782
2866
  }
2783
2867
  }
2784
2868
  } finally {
2785
- import_node_fs4.default.rmSync(tmpDir, { recursive: true, force: true });
2786
- import_node_fs4.default.rmSync(downloadDir, { recursive: true, force: true });
2869
+ import_node_fs5.default.rmSync(tmpDir, { recursive: true, force: true });
2870
+ import_node_fs5.default.rmSync(downloadDir, { recursive: true, force: true });
2787
2871
  }
2788
2872
  }
2789
2873
  function isErrnoCode(err, ...codes) {
@@ -2794,17 +2878,17 @@ async function downloadToFile(url, destPath) {
2794
2878
  if (!res.ok || !res.body) {
2795
2879
  throw new Error(`download failed: ${res.status} ${res.statusText} (${url})`);
2796
2880
  }
2797
- import_node_fs4.default.mkdirSync(import_node_path5.default.dirname(destPath), { recursive: true });
2881
+ import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(destPath), { recursive: true });
2798
2882
  const tmp = `${destPath}.partial`;
2799
2883
  try {
2800
2884
  await (0, import_promises.pipeline)(
2801
2885
  import_node_stream.Readable.fromWeb(res.body),
2802
- import_node_fs4.default.createWriteStream(tmp)
2886
+ import_node_fs5.default.createWriteStream(tmp)
2803
2887
  );
2804
- import_node_fs4.default.renameSync(tmp, destPath);
2888
+ import_node_fs5.default.renameSync(tmp, destPath);
2805
2889
  } catch (err) {
2806
2890
  try {
2807
- import_node_fs4.default.unlinkSync(tmp);
2891
+ import_node_fs5.default.unlinkSync(tmp);
2808
2892
  } catch {
2809
2893
  }
2810
2894
  throw err;
@@ -2812,8 +2896,8 @@ async function downloadToFile(url, destPath) {
2812
2896
  }
2813
2897
  function digestFile(filePath, algorithm, encoding) {
2814
2898
  return new Promise((resolve2, reject) => {
2815
- const hash = import_node_crypto3.default.createHash(algorithm);
2816
- const stream = import_node_fs4.default.createReadStream(filePath);
2899
+ const hash = import_node_crypto4.default.createHash(algorithm);
2900
+ const stream = import_node_fs5.default.createReadStream(filePath);
2817
2901
  stream.on("data", (chunk) => hash.update(chunk));
2818
2902
  stream.on("error", reject);
2819
2903
  stream.on("end", () => resolve2(hash.digest(encoding)));
@@ -2866,30 +2950,30 @@ var swift_distribution_lock_default = {
2866
2950
 
2867
2951
  // src/swift-toolchain.ts
2868
2952
  var import_node_child_process4 = require("node:child_process");
2869
- var import_node_fs5 = __toESM(require("node:fs"), 1);
2870
- var import_node_os4 = __toESM(require("node:os"), 1);
2871
- var import_node_path6 = __toESM(require("node:path"), 1);
2953
+ var import_node_fs6 = __toESM(require("node:fs"), 1);
2954
+ var import_node_os5 = __toESM(require("node:os"), 1);
2955
+ var import_node_path7 = __toESM(require("node:path"), 1);
2872
2956
  function swiftToolchainBin(release) {
2873
2957
  if (process.platform === "darwin") {
2874
- const dirs = [import_node_os4.default.homedir(), "/"].map(
2875
- (base) => import_node_path6.default.join(base, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`)
2958
+ const dirs = [import_node_os5.default.homedir(), "/"].map(
2959
+ (base) => import_node_path7.default.join(base, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`)
2876
2960
  );
2877
- return dirs.find((dir) => import_node_fs5.default.existsSync(import_node_path6.default.join(dir, "swift"))) ?? dirs[0];
2961
+ return dirs.find((dir) => import_node_fs6.default.existsSync(import_node_path7.default.join(dir, "swift"))) ?? dirs[0];
2878
2962
  }
2879
2963
  if (process.env.CONTRAST_SWIFT_TOOLCHAINS) {
2880
- return import_node_path6.default.join(process.env.CONTRAST_SWIFT_TOOLCHAINS, release, "usr/bin");
2964
+ return import_node_path7.default.join(process.env.CONTRAST_SWIFT_TOOLCHAINS, release, "usr/bin");
2881
2965
  }
2882
- const image = import_node_path6.default.join("/opt/swift", release, "usr/bin");
2883
- if (import_node_fs5.default.existsSync(import_node_path6.default.join(image, "swift"))) return image;
2884
- return (process.env.PATH ?? "").split(import_node_path6.default.delimiter).find((dir) => dir && import_node_fs5.default.existsSync(import_node_path6.default.join(dir, "swift"))) ?? image;
2966
+ const image = import_node_path7.default.join("/opt/swift", release, "usr/bin");
2967
+ if (import_node_fs6.default.existsSync(import_node_path7.default.join(image, "swift"))) return image;
2968
+ return (process.env.PATH ?? "").split(import_node_path7.default.delimiter).find((dir) => dir && import_node_fs6.default.existsSync(import_node_path7.default.join(dir, "swift"))) ?? image;
2885
2969
  }
2886
2970
  var verified = /* @__PURE__ */ new Map();
2887
2971
  function swiftToolchain(release, sdk) {
2888
2972
  const cached = verified.get(`${release}\0${sdk.wasmSdkId}`);
2889
2973
  if (cached) return cached;
2890
2974
  const bin = swiftToolchainBin(release);
2891
- const swift = import_node_path6.default.join(bin, "swift");
2892
- const version = import_node_fs5.default.existsSync(swift) ? (0, import_node_child_process4.execFileSync)(swift, ["--version"], {
2975
+ const swift = import_node_path7.default.join(bin, "swift");
2976
+ const version = import_node_fs6.default.existsSync(swift) ? (0, import_node_child_process4.execFileSync)(swift, ["--version"], {
2893
2977
  encoding: "utf8",
2894
2978
  stdio: ["ignore", "pipe", "pipe"]
2895
2979
  }) : "";
@@ -2950,11 +3034,11 @@ function swiftDistributionRoot() {
2950
3034
  );
2951
3035
  }
2952
3036
  swiftToolchain(lock.release, lock);
2953
- const dir = import_node_path7.default.join(rnxHomeDir(), "swift", `${lock.id}-${host2}`);
3037
+ const dir = import_node_path8.default.join(rnxHomeDir(), "swift", `${lock.id}-${host2}`);
2954
3038
  let pending = installs.get(dir);
2955
3039
  if (!pending) {
2956
3040
  pending = (async () => {
2957
- if (!import_node_fs6.default.existsSync(import_node_path7.default.join(dir, SWIFT_DISTRIBUTION_MANIFEST))) {
3041
+ if (!import_node_fs7.default.existsSync(import_node_path8.default.join(dir, SWIFT_DISTRIBUTION_MANIFEST))) {
2958
3042
  process.stderr.write(
2959
3043
  `peach: downloading Swift distribution ${lock.id} (${host2})\u2026
2960
3044
  `
@@ -2983,7 +3067,7 @@ function swiftDistributionRoot() {
2983
3067
  return pending;
2984
3068
  }
2985
3069
  function swiftModuleToolchain(root) {
2986
- const pin = swiftDistributionAt(root) ?? JSON.parse(import_node_fs6.default.readFileSync(import_node_path7.default.join(root, "toolchain.json"), "utf8"));
3070
+ const pin = swiftDistributionAt(root) ?? JSON.parse(import_node_fs7.default.readFileSync(import_node_path8.default.join(root, "toolchain.json"), "utf8"));
2987
3071
  return {
2988
3072
  release: pin.release,
2989
3073
  toolchainBin: swiftToolchain(pin.release, swiftModuleSdk(root))
@@ -2992,15 +3076,15 @@ function swiftModuleToolchain(root) {
2992
3076
 
2993
3077
  // src/swift-packages.ts
2994
3078
  var import_node_child_process6 = require("node:child_process");
2995
- var import_node_fs8 = __toESM(require("node:fs"), 1);
2996
- var import_node_path9 = __toESM(require("node:path"), 1);
3079
+ var import_node_fs9 = __toESM(require("node:fs"), 1);
3080
+ var import_node_path10 = __toESM(require("node:path"), 1);
2997
3081
 
2998
3082
  // src/swift-package-manifest.ts
2999
3083
  var import_node_child_process5 = require("node:child_process");
3000
- var import_node_crypto4 = require("node:crypto");
3001
- var import_node_fs7 = __toESM(require("node:fs"), 1);
3002
- var import_node_os5 = __toESM(require("node:os"), 1);
3003
- var import_node_path8 = __toESM(require("node:path"), 1);
3084
+ var import_node_crypto5 = require("node:crypto");
3085
+ var import_node_fs8 = __toESM(require("node:fs"), 1);
3086
+ var import_node_os6 = __toESM(require("node:os"), 1);
3087
+ var import_node_path9 = __toESM(require("node:path"), 1);
3004
3088
  var TARGET_TYPES = [
3005
3089
  "regular",
3006
3090
  "executable",
@@ -3015,19 +3099,19 @@ var record = (value) => value && typeof value === "object" && !Array.isArray(val
3015
3099
  var array = (value) => Array.isArray(value) ? value : [];
3016
3100
  var string = (value) => typeof value === "string" ? value : void 0;
3017
3101
  function swiftCommand() {
3018
- return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path8.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
3102
+ return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path9.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
3019
3103
  }
3020
- var cacheDir = import_node_path8.default.join(import_node_os5.default.tmpdir(), "peach-swift-manifests");
3104
+ var cacheDir2 = import_node_path9.default.join(import_node_os6.default.tmpdir(), "peach-swift-manifests");
3021
3105
  var evaluated = /* @__PURE__ */ new Map();
3022
3106
  function dump(dir) {
3023
- const manifests = import_node_fs7.default.readdirSync(dir).filter((name) => /^Package(@swift-[\d.]+)?\.swift$/.test(name)).sort();
3107
+ const manifests = import_node_fs8.default.readdirSync(dir).filter((name) => /^Package(@swift-[\d.]+)?\.swift$/.test(name)).sort();
3024
3108
  const command = swiftCommand();
3025
- const key = (0, import_node_crypto4.createHash)("sha256").update(JSON.stringify([command, import_node_path8.default.resolve(dir)])).update(
3026
- manifests.map((name) => `${name}\0${import_node_fs7.default.readFileSync(import_node_path8.default.join(dir, name), "utf8")}`).join("\0")
3109
+ const key = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify([command, import_node_path9.default.resolve(dir)])).update(
3110
+ manifests.map((name) => `${name}\0${import_node_fs8.default.readFileSync(import_node_path9.default.join(dir, name), "utf8")}`).join("\0")
3027
3111
  ).digest("hex").slice(0, 32);
3028
- const cached = import_node_path8.default.join(cacheDir, `${key}.json`);
3029
- if (import_node_fs7.default.existsSync(cached))
3030
- return { key, raw: record(JSON.parse(import_node_fs7.default.readFileSync(cached, "utf8"))) };
3112
+ const cached = import_node_path9.default.join(cacheDir2, `${key}.json`);
3113
+ if (import_node_fs8.default.existsSync(cached))
3114
+ return { key, raw: record(JSON.parse(import_node_fs8.default.readFileSync(cached, "utf8"))) };
3031
3115
  let output;
3032
3116
  try {
3033
3117
  output = (0, import_node_child_process5.execFileSync)(
@@ -3039,7 +3123,7 @@ function dump(dir) {
3039
3123
  dir,
3040
3124
  // swiftpm's scratch files never land in the app's own package
3041
3125
  "--scratch-path",
3042
- import_node_path8.default.join(cacheDir, `${key}.build`),
3126
+ import_node_path9.default.join(cacheDir2, `${key}.build`),
3043
3127
  "dump-package"
3044
3128
  ],
3045
3129
  {
@@ -3051,11 +3135,11 @@ function dump(dir) {
3051
3135
  } catch (error) {
3052
3136
  const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
3053
3137
  throw new Error(
3054
- `swiftpm could not evaluate ${import_node_path8.default.join(dir, "Package.swift")}${stderr ? `: ${stderr}` : ""}`
3138
+ `swiftpm could not evaluate ${import_node_path9.default.join(dir, "Package.swift")}${stderr ? `: ${stderr}` : ""}`
3055
3139
  );
3056
3140
  }
3057
- import_node_fs7.default.mkdirSync(cacheDir, { recursive: true });
3058
- import_node_fs7.default.writeFileSync(cached, output);
3141
+ import_node_fs8.default.mkdirSync(cacheDir2, { recursive: true });
3142
+ import_node_fs8.default.writeFileSync(cached, output);
3059
3143
  return { key, raw: record(JSON.parse(output)) };
3060
3144
  }
3061
3145
  function defaultTraits(manifest) {
@@ -3083,7 +3167,7 @@ function linksOnIOS(condition, traits) {
3083
3167
  return gates.length === 0 || gates.some((name) => traits.has(string(name) ?? ""));
3084
3168
  }
3085
3169
  function swiftPackageManifest(dir) {
3086
- dir = import_node_fs7.default.realpathSync(dir);
3170
+ dir = import_node_fs8.default.realpathSync(dir);
3087
3171
  const { key, raw: raw2 } = dump(dir);
3088
3172
  const known = evaluated.get(key);
3089
3173
  if (known) return known;
@@ -3131,7 +3215,7 @@ function swiftPackageManifest(dir) {
3131
3215
  if (!name || !isTargetType(kind)) continue;
3132
3216
  const declared = string(target.path);
3133
3217
  const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
3134
- const targetDir = declared ? import_node_path8.default.resolve(dir, declared) : roots.map((root) => import_node_path8.default.join(dir, root, name)).find((candidate) => import_node_fs7.default.existsSync(candidate)) ?? import_node_path8.default.join(dir, roots[0], name);
3218
+ const targetDir = declared ? import_node_path9.default.resolve(dir, declared) : roots.map((root) => import_node_path9.default.join(dir, root, name)).find((candidate) => import_node_fs8.default.existsSync(candidate)) ?? import_node_path9.default.join(dir, roots[0], name);
3135
3219
  const dependencies = [];
3136
3220
  for (const dependency of array(target.dependencies)) {
3137
3221
  const { target: local, product, byName } = record(dependency);
@@ -3173,30 +3257,31 @@ function swiftPackageManifest(dir) {
3173
3257
  dependencies,
3174
3258
  languageMode,
3175
3259
  mainActorIsolation,
3176
- declaresResources: array(target.resources).length > 0
3260
+ declaresResources: array(target.resources).length > 0,
3261
+ url: string(target.url) ?? null
3177
3262
  });
3178
3263
  }
3179
3264
  const manifest = { dir, products, targets, packages };
3180
3265
  evaluated.set(key, manifest);
3181
3266
  return manifest;
3182
3267
  }
3183
- var within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path8.default.sep}`));
3268
+ var within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path9.default.sep}`));
3184
3269
  function walk(dir) {
3185
- if (!import_node_fs7.default.existsSync(dir)) return [];
3186
- if (import_node_fs7.default.statSync(dir).isFile()) return [dir];
3270
+ if (!import_node_fs8.default.existsSync(dir)) return [];
3271
+ if (import_node_fs8.default.statSync(dir).isFile()) return [dir];
3187
3272
  const out = [];
3188
- for (const entry of import_node_fs7.default.readdirSync(dir, { withFileTypes: true })) {
3273
+ for (const entry of import_node_fs8.default.readdirSync(dir, { withFileTypes: true })) {
3189
3274
  if (entry.name.startsWith(".")) continue;
3190
- const full = import_node_path8.default.join(dir, entry.name);
3275
+ const full = import_node_path9.default.join(dir, entry.name);
3191
3276
  if (entry.isDirectory()) out.push(...walk(full));
3192
3277
  else if (entry.isFile()) out.push(full);
3193
3278
  }
3194
3279
  return out;
3195
3280
  }
3196
3281
  function swiftTargetFiles(manifest, target) {
3197
- const included = target.sources ? target.sources.map((source) => import_node_path8.default.resolve(target.dir, source)) : [target.dir];
3282
+ const included = target.sources ? target.sources.map((source) => import_node_path9.default.resolve(target.dir, source)) : [target.dir];
3198
3283
  const excluded = [
3199
- ...target.exclude.map((file) => import_node_path8.default.resolve(target.dir, file)),
3284
+ ...target.exclude.map((file) => import_node_path9.default.resolve(target.dir, file)),
3200
3285
  ...[...manifest.targets.values()].flatMap(
3201
3286
  (other) => other !== target && within(other.dir, [target.dir]) && other.dir !== target.dir ? [other.dir] : []
3202
3287
  )
@@ -3205,10 +3290,12 @@ function swiftTargetFiles(manifest, target) {
3205
3290
  }
3206
3291
 
3207
3292
  // src/swift-packages.ts
3208
- var REMOTE_CHECKOUTS = import_node_path9.default.join(".build", "peach", "checkouts");
3293
+ var REMOTE_CHECKOUTS = import_node_path10.default.join(".build", "peach", "checkouts");
3209
3294
  var C_FAMILY = /\.(c|cc|cpp|cxx|m|mm|s|S)$/;
3295
+ var BINARY = "is a binary framework";
3296
+ var blocker = (reasons) => reasons.find((reason) => reason?.includes(BINARY)) ?? reasons.find((reason) => reason !== null) ?? null;
3210
3297
  function readPins(resolved) {
3211
- const data = JSON.parse(import_node_fs8.default.readFileSync(resolved, "utf8"));
3298
+ const data = JSON.parse(import_node_fs9.default.readFileSync(resolved, "utf8"));
3212
3299
  const pins = data && typeof data === "object" && "pins" in data && Array.isArray(data.pins) ? data.pins : null;
3213
3300
  if (!pins)
3214
3301
  throw new Error(`${resolved} has no pins; resolve packages in a current Xcode`);
@@ -3224,23 +3311,23 @@ function readPins(resolved) {
3224
3311
  }
3225
3312
  var verified2 = /* @__PURE__ */ new Set();
3226
3313
  function checkout(checkouts, identity, pin) {
3227
- const dir = import_node_path9.default.join(checkouts, identity);
3314
+ const dir = import_node_path10.default.join(checkouts, identity);
3228
3315
  const key = `${dir}\0${pin.revision}`;
3229
3316
  if (verified2.has(key)) return dir;
3230
3317
  const git = (...args) => (0, import_node_child_process6.execFileSync)("git", ["-C", dir, ...args], {
3231
3318
  encoding: "utf8",
3232
3319
  stdio: ["ignore", "pipe", "pipe"]
3233
3320
  }).trim();
3234
- const current = import_node_fs8.default.existsSync(import_node_path9.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
3321
+ const current = import_node_fs9.default.existsSync(import_node_path10.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
3235
3322
  if (current !== pin.revision) {
3236
- import_node_fs8.default.rmSync(dir, { recursive: true, force: true });
3237
- import_node_fs8.default.mkdirSync(dir, { recursive: true });
3323
+ import_node_fs9.default.rmSync(dir, { recursive: true, force: true });
3324
+ import_node_fs9.default.mkdirSync(dir, { recursive: true });
3238
3325
  try {
3239
3326
  git("init", "-q");
3240
3327
  git("fetch", "-q", "--depth", "1", pin.location, pin.revision);
3241
3328
  git("checkout", "-q", "FETCH_HEAD");
3242
3329
  } catch (error) {
3243
- import_node_fs8.default.rmSync(dir, { recursive: true, force: true });
3330
+ import_node_fs9.default.rmSync(dir, { recursive: true, force: true });
3244
3331
  const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
3245
3332
  throw new Error(
3246
3333
  `could not fetch ${pin.location} at ${pin.revision}${stderr ? `: ${stderr}` : ""}`
@@ -3256,13 +3343,14 @@ function resolveSwiftPackages(options) {
3256
3343
  const result = {
3257
3344
  targets: [],
3258
3345
  unavailable: /* @__PURE__ */ new Map(),
3259
- modules: /* @__PURE__ */ new Map()
3346
+ modules: /* @__PURE__ */ new Map(),
3347
+ binaries: []
3260
3348
  };
3261
3349
  const pins = resolved ? readPins(resolved) : null;
3262
- const checkouts = import_node_path9.default.join(rootDir, REMOTE_CHECKOUTS);
3350
+ const checkouts = import_node_path10.default.join(rootDir, REMOTE_CHECKOUTS);
3263
3351
  const packages = /* @__PURE__ */ new Map();
3264
3352
  const load2 = (source) => {
3265
- const key = source.kind === "local" ? import_node_path9.default.resolve(source.dir) : source.url;
3353
+ const key = source.kind === "local" ? import_node_path10.default.resolve(source.dir) : source.url;
3266
3354
  const cached = packages.get(key);
3267
3355
  if (cached !== void 0) return cached;
3268
3356
  let loaded2;
@@ -3274,8 +3362,8 @@ function resolveSwiftPackages(options) {
3274
3362
  if (!pin) {
3275
3363
  loaded2 = pins ? `package ${identity} is not pinned in Package.resolved` : "no Package.resolved pins it; resolve packages in Xcode once";
3276
3364
  } else {
3277
- import_node_fs8.default.mkdirSync(checkouts, { recursive: true });
3278
- import_node_fs8.default.writeFileSync(import_node_path9.default.join(import_node_path9.default.dirname(checkouts), ".gitignore"), "*\n");
3365
+ import_node_fs9.default.mkdirSync(checkouts, { recursive: true });
3366
+ import_node_fs9.default.writeFileSync(import_node_path10.default.join(import_node_path10.default.dirname(checkouts), ".gitignore"), "*\n");
3279
3367
  loaded2 = {
3280
3368
  source: source.url,
3281
3369
  remote: true,
@@ -3295,8 +3383,8 @@ function resolveSwiftPackages(options) {
3295
3383
  const outcome = (() => {
3296
3384
  if (provided.has(name)) return null;
3297
3385
  const target = pkg.manifest.targets.get(name);
3298
- if (!target) return `${import_node_path9.default.basename(pkg.manifest.dir)} declares no target ${name}`;
3299
- if (target.type === "binary") return `${name} is a binary framework`;
3386
+ if (!target) return `${import_node_path10.default.basename(pkg.manifest.dir)} declares no target ${name}`;
3387
+ if (target.type === "binary") return `${name} ${BINARY}`;
3300
3388
  if (target.type === "system") return `${name} is a system C library`;
3301
3389
  if (target.type !== "regular") return `${name} is a ${target.type} target`;
3302
3390
  const files = swiftTargetFiles(pkg.manifest, target);
@@ -3307,9 +3395,9 @@ function resolveSwiftPackages(options) {
3307
3395
  const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
3308
3396
  return nested && `${dependency.name}: ${nested}`;
3309
3397
  });
3310
- const blocked = reasons.find((reason) => reason !== null);
3398
+ const blocked = blocker(reasons);
3311
3399
  if (blocked) return blocked;
3312
- const relative = files.map((file) => import_node_path9.default.relative(target.dir, file));
3400
+ const relative = files.map((file) => import_node_path10.default.relative(target.dir, file));
3313
3401
  targets.set(`${pkg.manifest.dir}\0${name}`, {
3314
3402
  name,
3315
3403
  path: "",
@@ -3331,7 +3419,7 @@ function resolveSwiftPackages(options) {
3331
3419
  const resolveProduct = (pkg, product) => {
3332
3420
  if (provided.has(product)) return null;
3333
3421
  const roots = pkg.manifest.products.get(product);
3334
- const reason = !roots ? `${import_node_path9.default.basename(pkg.manifest.dir)} has no library ${product}` : roots.map((name) => resolveTarget(pkg, name)).find((value) => value !== null) ?? null;
3422
+ const reason = !roots ? `${import_node_path10.default.basename(pkg.manifest.dir)} has no library ${product}` : blocker(roots.map((name) => resolveTarget(pkg, name)));
3335
3423
  productOutcomes.set(`${pkg.manifest.dir}\0${product}`, { pkg, reason });
3336
3424
  return reason;
3337
3425
  };
@@ -3339,7 +3427,7 @@ function resolveSwiftPackages(options) {
3339
3427
  if (provided.has(product)) return null;
3340
3428
  const dependency = pkg.manifest.packages.get(packageName);
3341
3429
  if (!dependency)
3342
- return `${import_node_path9.default.basename(pkg.manifest.dir)} names no package ${packageName}`;
3430
+ return `${import_node_path10.default.basename(pkg.manifest.dir)} names no package ${packageName}`;
3343
3431
  if ("dir" in dependency) {
3344
3432
  const loaded3 = load2({ kind: "local", dir: dependency.dir });
3345
3433
  return typeof loaded3 === "string" ? loaded3 : resolveProduct(loaded3, product);
@@ -3366,6 +3454,13 @@ function resolveSwiftPackages(options) {
3366
3454
  if (target.type === "test" || target.type === "plugin" || target.type === "macro")
3367
3455
  continue;
3368
3456
  if (target.type === "executable") continue;
3457
+ if (target.type === "binary")
3458
+ result.binaries.push({
3459
+ target: name,
3460
+ source: pkg.source,
3461
+ url: target.url,
3462
+ dir: target.dir
3463
+ });
3369
3464
  const reason = resolveTarget(pkg, name);
3370
3465
  if (reason && !result.modules.has(name))
3371
3466
  result.modules.set(name, { source: pkg.source, reason });
@@ -3385,7 +3480,7 @@ function resolveSwiftPackages(options) {
3385
3480
  if (dependency.kind === "target") reach(pkg, dependency.name);
3386
3481
  else {
3387
3482
  const source = pkg.manifest.packages.get(dependency.package);
3388
- const nested = source && ("dir" in source ? packages.get(import_node_path9.default.resolve(source.dir)) : packages.get(source.url));
3483
+ const nested = source && ("dir" in source ? packages.get(import_node_path10.default.resolve(source.dir)) : packages.get(source.url));
3389
3484
  if (nested && typeof nested !== "string")
3390
3485
  for (const root of nested.manifest.products.get(dependency.name) ?? [])
3391
3486
  reach(nested, root);
@@ -3393,7 +3488,7 @@ function resolveSwiftPackages(options) {
3393
3488
  }
3394
3489
  };
3395
3490
  for (const { product, source } of products) {
3396
- const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ? import_node_path9.default.resolve(source.dir) : source.url);
3491
+ const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ? import_node_path10.default.resolve(source.dir) : source.url);
3397
3492
  if (!pkg || typeof pkg === "string") continue;
3398
3493
  for (const root of pkg.manifest.products.get(product) ?? []) reach(pkg, root);
3399
3494
  }
@@ -3538,12 +3633,12 @@ async function compileSwiftProject(submit, work, origin, signal) {
3538
3633
  }
3539
3634
 
3540
3635
  // src/xcode-project.ts
3541
- var import_node_fs9 = __toESM(require("node:fs"), 1);
3542
- var import_node_path11 = __toESM(require("node:path"), 1);
3636
+ var import_node_fs10 = __toESM(require("node:fs"), 1);
3637
+ var import_node_path12 = __toESM(require("node:path"), 1);
3543
3638
  var import_plist = __toESM(require_plist(), 1);
3544
3639
 
3545
3640
  // src/xcode-json-project.ts
3546
- var import_node_path10 = __toESM(require("node:path"), 1);
3641
+ var import_node_path11 = __toESM(require("node:path"), 1);
3547
3642
  var import_json5 = __toESM(require("json5"), 1);
3548
3643
  var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3549
3644
  var text = (value) => typeof value === "string" ? value : void 0;
@@ -3559,7 +3654,7 @@ var PHASE_ISA = {
3559
3654
  function readXcodeJsonProject(xcodeproj, source) {
3560
3655
  const json = import_json5.default.parse(source);
3561
3656
  if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
3562
- const projectDir = import_node_path10.default.dirname(xcodeproj);
3657
+ const projectDir = import_node_path11.default.dirname(xcodeproj);
3563
3658
  const objects = {};
3564
3659
  let next = 0;
3565
3660
  const add = (entry, id) => {
@@ -3572,7 +3667,7 @@ function readXcodeJsonProject(xcodeproj, source) {
3572
3667
  const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
3573
3668
  if (base) {
3574
3669
  if (base[1] === "PROJECT")
3575
- return { sourceTree: "<absolute>", path: import_node_path10.default.join(projectDir, base[2]) };
3670
+ return { sourceTree: "<absolute>", path: import_node_path11.default.join(projectDir, base[2]) };
3576
3671
  if (base[1] === "PRODUCTS")
3577
3672
  return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
3578
3673
  return null;
@@ -3580,7 +3675,7 @@ function readXcodeJsonProject(xcodeproj, source) {
3580
3675
  const unescaped = raw2.replaceAll("\\<", "<");
3581
3676
  if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
3582
3677
  if (unescaped.startsWith("~")) return null;
3583
- return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path10.default.join(groupDir, unescaped) };
3678
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path11.default.join(groupDir, unescaped) };
3584
3679
  };
3585
3680
  const memberships = [];
3586
3681
  const folders = [];
@@ -3591,7 +3686,7 @@ function readXcodeJsonProject(xcodeproj, source) {
3591
3686
  const kind = text(entry.kind) ?? "file-reference";
3592
3687
  const raw2 = text(entry.path) ?? "";
3593
3688
  const located = raw2 === "" ? null : locate(raw2, parent.dir);
3594
- const name = text(entry.name) ?? import_node_path10.default.basename(raw2);
3689
+ const name = text(entry.name) ?? import_node_path11.default.basename(raw2);
3595
3690
  const node = { id: "", name, dir: null, parent, children: [] };
3596
3691
  if (kind === "group" || kind === "variant-group" || kind === "version-group") {
3597
3692
  node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
@@ -3706,7 +3801,7 @@ function readXcodeJsonProject(xcodeproj, source) {
3706
3801
  if (!isObject(entry)) continue;
3707
3802
  const repository = text(entry.repository);
3708
3803
  const local = text(entry.path);
3709
- const name = local !== void 0 ? import_node_path10.default.basename(import_node_path10.default.resolve(import_node_path10.default.dirname(xcodeproj), local)) : import_node_path10.default.basename(repository ?? "").replace(/\.git$/, "");
3804
+ const name = local !== void 0 ? import_node_path11.default.basename(import_node_path11.default.resolve(import_node_path11.default.dirname(xcodeproj), local)) : import_node_path11.default.basename(repository ?? "").replace(/\.git$/, "");
3710
3805
  const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
3711
3806
  packageIds.set(name.toLowerCase(), id);
3712
3807
  }
@@ -3983,28 +4078,28 @@ var CONDITIONS = {
3983
4078
  variant: "normal"
3984
4079
  };
3985
4080
  function walkFiles(dir) {
3986
- if (!import_node_fs9.default.existsSync(dir)) return [];
4081
+ if (!import_node_fs10.default.existsSync(dir)) return [];
3987
4082
  const out = [];
3988
- for (const entry of import_node_fs9.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
4083
+ for (const entry of import_node_fs10.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
3989
4084
  if (entry.name.startsWith(".")) continue;
3990
- const full = import_node_path11.default.join(dir, entry.name);
4085
+ const full = import_node_path12.default.join(dir, entry.name);
3991
4086
  if (entry.isDirectory()) out.push(...walkFiles(full));
3992
4087
  else if (entry.isFile()) out.push(full);
3993
4088
  }
3994
4089
  return out;
3995
4090
  }
3996
- var isDirectory = (dir) => import_node_fs9.default.existsSync(dir) && import_node_fs9.default.statSync(dir).isDirectory();
4091
+ var isDirectory = (dir) => import_node_fs10.default.existsSync(dir) && import_node_fs10.default.statSync(dir).isDirectory();
3997
4092
  function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
3998
- if (seen.has(file) || !import_node_fs9.default.existsSync(file)) return {};
4093
+ if (seen.has(file) || !import_node_fs10.default.existsSync(file)) return {};
3999
4094
  seen.add(file);
4000
4095
  const settings = {};
4001
- for (const raw2 of import_node_fs9.default.readFileSync(file, "utf8").split("\n")) {
4096
+ for (const raw2 of import_node_fs10.default.readFileSync(file, "utf8").split("\n")) {
4002
4097
  const line = raw2.replace(/\/\/.*$/, "").trim();
4003
4098
  const include = /^#include\??\s+"([^"]+)"/.exec(line);
4004
4099
  if (include) {
4005
4100
  Object.assign(
4006
4101
  settings,
4007
- readXcconfig(import_node_path11.default.resolve(import_node_path11.default.dirname(file), include[1]), seen)
4102
+ readXcconfig(import_node_path12.default.resolve(import_node_path12.default.dirname(file), include[1]), seen)
4008
4103
  );
4009
4104
  continue;
4010
4105
  }
@@ -4054,22 +4149,22 @@ function decodeXml(text2) {
4054
4149
  return text2.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
4055
4150
  }
4056
4151
  function workspaceReferences(workspace) {
4057
- const data = import_node_path11.default.join(workspace, "contents.xcworkspacedata");
4058
- if (!import_node_fs9.default.existsSync(data))
4152
+ const data = import_node_path12.default.join(workspace, "contents.xcworkspacedata");
4153
+ if (!import_node_fs10.default.existsSync(data))
4059
4154
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
4060
- const container = import_node_path11.default.dirname(workspace);
4155
+ const container = import_node_path12.default.dirname(workspace);
4061
4156
  const locate = (location, base) => {
4062
4157
  const colon = location.indexOf(":");
4063
4158
  const kind = location.slice(0, colon);
4064
4159
  const rest = location.slice(colon + 1);
4065
- if (kind === "group") return import_node_path11.default.resolve(base, rest);
4066
- if (kind === "container" || kind === "self") return import_node_path11.default.resolve(container, rest);
4067
- if (kind === "absolute") return import_node_path11.default.resolve(rest);
4068
- throw new Error(`${import_node_path11.default.basename(workspace)} has an unsupported location ${location}`);
4160
+ if (kind === "group") return import_node_path12.default.resolve(base, rest);
4161
+ if (kind === "container" || kind === "self") return import_node_path12.default.resolve(container, rest);
4162
+ if (kind === "absolute") return import_node_path12.default.resolve(rest);
4163
+ throw new Error(`${import_node_path12.default.basename(workspace)} has an unsupported location ${location}`);
4069
4164
  };
4070
4165
  const groups = [container];
4071
4166
  const references = [];
4072
- for (const [, closing, tag, attributes, selfClosing] of import_node_fs9.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
4167
+ for (const [, closing, tag, attributes, selfClosing] of import_node_fs10.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
4073
4168
  if (closing) {
4074
4169
  if (tag === "Group") groups.pop();
4075
4170
  continue;
@@ -4085,8 +4180,8 @@ function workspaceReferences(workspace) {
4085
4180
  var loaded = /* @__PURE__ */ new Map();
4086
4181
  function xcodeProjectFile(xcodeproj) {
4087
4182
  for (const name of ["project.pbxproj", "project.xcproj"]) {
4088
- const file = import_node_path11.default.join(xcodeproj, name);
4089
- if (import_node_fs9.default.existsSync(file)) return file;
4183
+ const file = import_node_path12.default.join(xcodeproj, name);
4184
+ if (import_node_fs10.default.existsSync(file)) return file;
4090
4185
  }
4091
4186
  return null;
4092
4187
  }
@@ -4094,10 +4189,10 @@ function loadProject(xcodeproj) {
4094
4189
  const projectFile = xcodeProjectFile(xcodeproj);
4095
4190
  if (!projectFile)
4096
4191
  throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
4097
- const mtimeMs = import_node_fs9.default.statSync(projectFile).mtimeMs;
4192
+ const mtimeMs = import_node_fs10.default.statSync(projectFile).mtimeMs;
4098
4193
  const cached = loaded.get(projectFile);
4099
4194
  if (cached?.mtimeMs === mtimeMs) return cached.project;
4100
- const source = import_node_fs9.default.readFileSync(projectFile, "utf8");
4195
+ const source = import_node_fs10.default.readFileSync(projectFile, "utf8");
4101
4196
  const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
4102
4197
  if (!isDict(root) || !isDict(root.objects)) {
4103
4198
  throw new Error(`${projectFile} has no objects table`);
@@ -4111,8 +4206,8 @@ function loadProject(xcodeproj) {
4111
4206
  if (!project || project.isa !== "PBXProject") {
4112
4207
  throw new Error(`${projectFile} has no PBXProject root`);
4113
4208
  }
4114
- const projectDir = import_node_fs9.default.realpathSync(
4115
- import_node_path11.default.resolve(import_node_path11.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
4209
+ const projectDir = import_node_fs10.default.realpathSync(
4210
+ import_node_path12.default.resolve(import_node_path12.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
4116
4211
  );
4117
4212
  const parent = /* @__PURE__ */ new Map();
4118
4213
  for (const [id, entry] of Object.entries(objects)) {
@@ -4130,11 +4225,11 @@ function loadProject(xcodeproj) {
4130
4225
  const own = str(entry.path) ?? "";
4131
4226
  const tree = str(entry.sourceTree) ?? "<group>";
4132
4227
  if (tree === "<absolute>") result2 = own;
4133
- else if (tree === "SOURCE_ROOT") result2 = import_node_path11.default.join(projectDir, own);
4228
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path12.default.join(projectDir, own);
4134
4229
  else if (tree === "<group>") {
4135
4230
  const up = parent.get(id);
4136
4231
  const base = up ? resolvePath(up) : projectDir;
4137
- result2 = base === null ? null : import_node_path11.default.join(base, own);
4232
+ result2 = base === null ? null : import_node_path12.default.join(base, own);
4138
4233
  }
4139
4234
  }
4140
4235
  resolvedPaths.set(id, result2);
@@ -4234,7 +4329,7 @@ function targetMembers(ref) {
4234
4329
  const addResource = (file) => {
4235
4330
  if (isDirectory(file)) {
4236
4331
  for (const inner of walkFiles(file)) resources.add(inner);
4237
- } else if (import_node_fs9.default.existsSync(file)) resources.add(file);
4332
+ } else if (import_node_fs10.default.existsSync(file)) resources.add(file);
4238
4333
  };
4239
4334
  const fileRefPaths = (refId) => {
4240
4335
  const entry = project.object(refId);
@@ -4255,7 +4350,7 @@ function targetMembers(ref) {
4255
4350
  for (const buildFileId of list(phase.files)) {
4256
4351
  for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
4257
4352
  if (phase.isa === "PBXSourcesBuildPhase") {
4258
- if (!import_node_fs9.default.existsSync(file)) continue;
4353
+ if (!import_node_fs10.default.existsSync(file)) continue;
4259
4354
  allSources.add(file);
4260
4355
  if (file.endsWith(".swift")) sources.add(file);
4261
4356
  } else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
@@ -4263,7 +4358,7 @@ function targetMembers(ref) {
4263
4358
  }
4264
4359
  }
4265
4360
  const addSynchronized = (folder, relative) => {
4266
- const file = import_node_path11.default.join(folder, relative);
4361
+ const file = import_node_path12.default.join(folder, relative);
4267
4362
  if (NEVER_MEMBER.test(relative)) return;
4268
4363
  if (file.endsWith(".swift")) {
4269
4364
  if (!relative.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
@@ -4288,7 +4383,7 @@ function targetMembers(ref) {
4288
4383
  }
4289
4384
  if (owned.has(groupId)) {
4290
4385
  for (const file of walkFiles(folder)) {
4291
- const relative = import_node_path11.default.relative(folder, file).split(import_node_path11.default.sep).join("/");
4386
+ const relative = import_node_path12.default.relative(folder, file).split(import_node_path12.default.sep).join("/");
4292
4387
  if ([...exceptions].some(
4293
4388
  (exception) => relative === exception || relative.startsWith(`${exception}/`)
4294
4389
  ))
@@ -4297,14 +4392,14 @@ function targetMembers(ref) {
4297
4392
  }
4298
4393
  } else {
4299
4394
  for (const relative of exceptions) {
4300
- const file = import_node_path11.default.join(folder, relative);
4395
+ const file = import_node_path12.default.join(folder, relative);
4301
4396
  if (isDirectory(file)) {
4302
4397
  for (const inner of walkFiles(file))
4303
4398
  addSynchronized(
4304
4399
  folder,
4305
- import_node_path11.default.relative(folder, inner).split(import_node_path11.default.sep).join("/")
4400
+ import_node_path12.default.relative(folder, inner).split(import_node_path12.default.sep).join("/")
4306
4401
  );
4307
- } else if (import_node_fs9.default.existsSync(file)) addSynchronized(folder, relative);
4402
+ } else if (import_node_fs10.default.existsSync(file)) addSynchronized(folder, relative);
4308
4403
  }
4309
4404
  }
4310
4405
  }
@@ -4317,8 +4412,8 @@ function targetMembers(ref) {
4317
4412
  function commonAncestor(dirs) {
4318
4413
  let common = dirs[0];
4319
4414
  for (const dir of dirs) {
4320
- while (common !== import_node_path11.default.dirname(common) && import_node_path11.default.relative(common, dir).startsWith(".."))
4321
- common = import_node_path11.default.dirname(common);
4415
+ while (common !== import_node_path12.default.dirname(common) && import_node_path12.default.relative(common, dir).startsWith(".."))
4416
+ common = import_node_path12.default.dirname(common);
4322
4417
  }
4323
4418
  return common;
4324
4419
  }
@@ -4327,8 +4422,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
4327
4422
  const projects2 = [];
4328
4423
  const projectAt = /* @__PURE__ */ new Map();
4329
4424
  const addProject = (xcodeproj) => {
4330
- const key = import_node_path11.default.resolve(xcodeproj);
4331
- if (projectAt.has(key) || key.split(import_node_path11.default.sep).includes("Pods")) return;
4425
+ const key = import_node_path12.default.resolve(xcodeproj);
4426
+ if (projectAt.has(key) || key.split(import_node_path12.default.sep).includes("Pods")) return;
4332
4427
  if (!xcodeProjectFile(key)) return;
4333
4428
  const project = loadProject(key);
4334
4429
  projectAt.set(key, project);
@@ -4345,7 +4440,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
4345
4440
  for (const reference of listed)
4346
4441
  if (reference.endsWith(".xcodeproj")) addProject(reference);
4347
4442
  if (projects2.length === 0) {
4348
- throw new Error(`${import_node_path11.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
4443
+ throw new Error(`${import_node_path12.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
4349
4444
  }
4350
4445
  return { listed, projects: projects2, projectAt };
4351
4446
  }
@@ -4367,7 +4462,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
4367
4462
  const allTargets = projects2.flatMap(nativeTargets);
4368
4463
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
4369
4464
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
4370
- const container = import_node_path11.default.basename(xcodeprojOrWorkspace);
4465
+ const container = import_node_path12.default.basename(xcodeprojOrWorkspace);
4371
4466
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
4372
4467
  if (named.length !== 1) {
4373
4468
  throw new Error(
@@ -4379,14 +4474,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
4379
4474
  for (const ref of allTargets) {
4380
4475
  const product = ref.project.object(str(ref.target.productReference));
4381
4476
  const file = str(product?.path);
4382
- if (file && !byProduct.has(import_node_path11.default.basename(file)))
4383
- byProduct.set(import_node_path11.default.basename(file), ref);
4477
+ if (file && !byProduct.has(import_node_path12.default.basename(file)))
4478
+ byProduct.set(import_node_path12.default.basename(file), ref);
4384
4479
  }
4385
4480
  const proxied = (project, proxyId) => {
4386
4481
  const proxy = project.object(proxyId);
4387
4482
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
4388
4483
  const portal = str(proxy.containerPortal);
4389
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path11.default.resolve(project.resolvePath(portal ?? "") ?? ""));
4484
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path12.default.resolve(project.resolvePath(portal ?? "") ?? ""));
4390
4485
  const remote = str(proxy.remoteGlobalIDString);
4391
4486
  if (!owner || !remote) return void 0;
4392
4487
  return nativeTargets(owner).find(
@@ -4407,7 +4502,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
4407
4502
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
4408
4503
  for (const buildFileId of list(phase.files)) {
4409
4504
  const file = project.object(str(project.object(buildFileId)?.fileRef));
4410
- const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path11.default.basename(str(file.path) ?? "")) : void 0;
4505
+ const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path12.default.basename(str(file.path) ?? "")) : void 0;
4411
4506
  if (resolved) found.push(resolved);
4412
4507
  }
4413
4508
  }
@@ -4428,7 +4523,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
4428
4523
  const name = str(ref.target.name) ?? ref.id;
4429
4524
  const { get: settings2, keys } = targetSettings(ref, {
4430
4525
  TARGET_NAME: name,
4431
- PROJECT_NAME: import_node_path11.default.basename(ref.project.xcodeproj, ".xcodeproj"),
4526
+ PROJECT_NAME: import_node_path12.default.basename(ref.project.xcodeproj, ".xcodeproj"),
4432
4527
  SRCROOT: ref.project.projectDir,
4433
4528
  SOURCE_ROOT: ref.project.projectDir,
4434
4529
  PROJECT_DIR: ref.project.projectDir,
@@ -4459,8 +4554,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
4459
4554
  }
4460
4555
  return value;
4461
4556
  };
4462
- const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path11.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
4463
- const sourceInfo = infoPlistFile ? import_plist.default.parse(import_node_fs9.default.readFileSync(infoPlistFile, "utf8")) : {};
4557
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path12.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
4558
+ const sourceInfo = infoPlistFile ? import_plist.default.parse(import_node_fs10.default.readFileSync(infoPlistFile, "utf8")) : {};
4464
4559
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
4465
4560
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
4466
4561
  }
@@ -4478,12 +4573,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
4478
4573
  };
4479
4574
  }
4480
4575
  const localPackageDirs = [
4481
- ...listed.filter((reference) => import_node_fs9.default.existsSync(import_node_path11.default.join(reference, "Package.swift"))),
4576
+ ...listed.filter((reference) => import_node_fs10.default.existsSync(import_node_path12.default.join(reference, "Package.swift"))),
4482
4577
  ...projects2.flatMap(
4483
4578
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
4484
4579
  if (!isDict(entry)) return [];
4485
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path11.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
4486
- return candidate && import_node_fs9.default.existsSync(import_node_path11.default.join(candidate, "Package.swift")) ? [candidate] : [];
4580
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path12.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
4581
+ return candidate && import_node_fs10.default.existsSync(import_node_path12.default.join(candidate, "Package.swift")) ? [candidate] : [];
4487
4582
  })
4488
4583
  )
4489
4584
  ];
@@ -4507,7 +4602,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
4507
4602
  product,
4508
4603
  source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
4509
4604
  kind: "local",
4510
- dir: import_node_path11.default.resolve(
4605
+ dir: import_node_path12.default.resolve(
4511
4606
  project.projectDir,
4512
4607
  str(reference.relativePath) ?? ""
4513
4608
  )
@@ -4529,8 +4624,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
4529
4624
  }
4530
4625
  }
4531
4626
  }
4532
- const resolvedFile = import_node_path11.default.join(
4533
- workspace ?? import_node_path11.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
4627
+ const resolvedFile = import_node_path12.default.join(
4628
+ workspace ?? import_node_path12.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
4534
4629
  "xcshareddata",
4535
4630
  "swiftpm",
4536
4631
  "Package.resolved"
@@ -4540,13 +4635,13 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
4540
4635
  ...module2,
4541
4636
  rootDir: commonAncestor(
4542
4637
  [
4543
- workspace ? import_node_path11.default.dirname(workspace) : app.project.projectDir,
4638
+ workspace ? import_node_path12.default.dirname(workspace) : app.project.projectDir,
4544
4639
  ...used.map((project) => project.projectDir),
4545
4640
  ...localPackageDirs,
4546
4641
  ...linkedProducts.flatMap(
4547
- ({ source }) => source.kind === "local" && import_node_fs9.default.existsSync(source.dir) ? [source.dir] : []
4642
+ ({ source }) => source.kind === "local" && import_node_fs10.default.existsSync(source.dir) ? [source.dir] : []
4548
4643
  )
4549
- ].map((dir) => import_node_fs9.default.realpathSync(dir))
4644
+ ].map((dir) => import_node_fs10.default.realpathSync(dir))
4550
4645
  ),
4551
4646
  projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
4552
4647
  infoPlist: import_plist.default.build(info),
@@ -4554,10 +4649,10 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
4554
4649
  frameworks,
4555
4650
  linkedProducts,
4556
4651
  localPackageDirs: [
4557
- ...new Set(localPackageDirs.map((dir) => import_node_fs9.default.realpathSync(dir)))
4652
+ ...new Set(localPackageDirs.map((dir) => import_node_fs10.default.realpathSync(dir)))
4558
4653
  ].sort(),
4559
4654
  binaryFrameworks: [...binaryFrameworks].sort(),
4560
- packageResolved: import_node_fs9.default.existsSync(resolvedFile) ? resolvedFile : null,
4655
+ packageResolved: import_node_fs10.default.existsSync(resolvedFile) ? resolvedFile : null,
4561
4656
  appTargets: appTargetNames
4562
4657
  };
4563
4658
  }
@@ -4577,17 +4672,17 @@ var SKIP_SOURCE_DIRS = /* @__PURE__ */ new Set([
4577
4672
  var NATIVE_DESCRIPTOR = ".one-native-source.json";
4578
4673
  var NATIVE_GLUE = ".one-native-source.swift.txt";
4579
4674
  function swiftPackageId(packagePath) {
4580
- return import_node_path12.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
4675
+ return import_node_path13.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
4581
4676
  }
4582
4677
  function nativeSourceDescriptor(packagePath) {
4583
- packagePath = import_node_fs10.default.realpathSync(packagePath);
4584
- const file = import_node_path12.default.join(packagePath, NATIVE_DESCRIPTOR);
4585
- if (!import_node_fs10.default.existsSync(file)) return null;
4678
+ packagePath = import_node_fs11.default.realpathSync(packagePath);
4679
+ const file = import_node_path13.default.join(packagePath, NATIVE_DESCRIPTOR);
4680
+ if (!import_node_fs11.default.existsSync(file)) return null;
4586
4681
  const value = JSON.parse(
4587
4682
  readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
4588
4683
  );
4589
4684
  const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
4590
- if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs10.default.existsSync(import_node_path12.default.join(packagePath, NATIVE_GLUE))) {
4685
+ if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs11.default.existsSync(import_node_path13.default.join(packagePath, NATIVE_GLUE))) {
4591
4686
  throw invalid();
4592
4687
  }
4593
4688
  if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
@@ -4596,12 +4691,12 @@ function nativeSourceDescriptor(packagePath) {
4596
4691
  return value;
4597
4692
  }
4598
4693
  function nativeSourceFiles(packagePath) {
4599
- packagePath = import_node_fs10.default.realpathSync(packagePath);
4600
- return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name) => import_node_path12.default.join(packagePath, name)).filter((file) => import_node_fs10.default.existsSync(file));
4694
+ packagePath = import_node_fs11.default.realpathSync(packagePath);
4695
+ return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name) => import_node_path13.default.join(packagePath, name)).filter((file) => import_node_fs11.default.existsSync(file));
4601
4696
  }
4602
4697
  var projects = /* @__PURE__ */ new Map();
4603
4698
  function projectFor(packagePath, hosted) {
4604
- packagePath = import_node_fs10.default.realpathSync(packagePath);
4699
+ packagePath = import_node_fs11.default.realpathSync(packagePath);
4605
4700
  const existing = projects.get(packagePath);
4606
4701
  if (existing) {
4607
4702
  if (hosted && !existing.hosted) {
@@ -4623,14 +4718,14 @@ function projectFor(packagePath, hosted) {
4623
4718
  }
4624
4719
  var xcodeProjects = /* @__PURE__ */ new Map();
4625
4720
  function swiftPackages(entry, app) {
4626
- const stamp = (file) => file && import_node_fs10.default.existsSync(file) ? import_node_fs10.default.statSync(file).mtimeMs : 0;
4721
+ const stamp = (file) => file && import_node_fs11.default.existsSync(file) ? import_node_fs11.default.statSync(file).mtimeMs : 0;
4627
4722
  const key = JSON.stringify([
4628
4723
  app.linkedProducts,
4629
4724
  app.packageResolved,
4630
4725
  stamp(app.packageResolved),
4631
- app.localPackageDirs.map((dir) => stamp(import_node_path12.default.join(dir, "Package.swift"))),
4726
+ app.localPackageDirs.map((dir) => stamp(import_node_path13.default.join(dir, "Package.swift"))),
4632
4727
  app.linkedProducts.map(
4633
- ({ source }) => source.kind === "local" ? stamp(import_node_path12.default.join(source.dir, "Package.swift")) : 0
4728
+ ({ source }) => source.kind === "local" ? stamp(import_node_path13.default.join(source.dir, "Package.swift")) : 0
4634
4729
  )
4635
4730
  ]);
4636
4731
  if (entry.packages?.key !== key) {
@@ -4650,11 +4745,11 @@ function swiftPackages(entry, app) {
4650
4745
  var XCODE_APP_DIR = "__app__";
4651
4746
  var XCODE_FRAMEWORKS_DIR = "__frameworks__";
4652
4747
  var XCODE_PACKAGES_DIR = "__packages__";
4653
- var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep)}/`;
4748
+ var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep)}/`;
4654
4749
  function xcodeInputKey(layout, file, relative) {
4655
4750
  const owner = layout.targetDirs.get(file);
4656
- if (owner) return import_node_path12.default.posix.join(owner, relative);
4657
- return relative.startsWith(CHECKOUTS_PREFIX) ? import_node_path12.default.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length)) : relative;
4751
+ if (owner) return import_node_path13.default.posix.join(owner, relative);
4752
+ return relative.startsWith(CHECKOUTS_PREFIX) ? import_node_path13.default.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length)) : relative;
4658
4753
  }
4659
4754
  function xcodeLayout(root) {
4660
4755
  const registered = xcodeProjects.get(root);
@@ -4665,7 +4760,7 @@ function xcodeLayout(root) {
4665
4760
  const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
4666
4761
  const targets = [];
4667
4762
  for (const framework of app.frameworks) {
4668
- const dir = import_node_path12.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
4763
+ const dir = import_node_path13.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
4669
4764
  for (const file of framework.sources) {
4670
4765
  if (targetDirs.has(file)) continue;
4671
4766
  targetDirs.set(file, dir);
@@ -4683,19 +4778,19 @@ function xcodeLayout(root) {
4683
4778
  }
4684
4779
  const packages = swiftPackages(registered, app);
4685
4780
  for (const target of packages.targets) {
4686
- const relative = import_node_path12.default.relative(
4687
- target.remote ? import_node_path12.default.join(root, REMOTE_CHECKOUTS) : root,
4781
+ const relative = import_node_path13.default.relative(
4782
+ target.remote ? import_node_path13.default.join(root, REMOTE_CHECKOUTS) : root,
4688
4783
  target.dir
4689
4784
  );
4690
- if (relative === ".." || relative.startsWith(`..${import_node_path12.default.sep}`) || import_node_path12.default.isAbsolute(relative))
4785
+ if (relative === ".." || relative.startsWith(`..${import_node_path13.default.sep}`) || import_node_path13.default.isAbsolute(relative))
4691
4786
  throw new Error(`swift input escapes the selected package: ${target.dir}`);
4692
- const posix = relative.split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep);
4787
+ const posix = relative.split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep);
4693
4788
  targets.push({
4694
4789
  ...target,
4695
- path: target.remote ? import_node_path12.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
4790
+ path: target.remote ? import_node_path13.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
4696
4791
  exclude: []
4697
4792
  });
4698
- if (!target.remote) files.add(import_node_path12.default.join(target.packageDir, "Package.swift"));
4793
+ if (!target.remote) files.add(import_node_path13.default.join(target.packageDir, "Package.swift"));
4699
4794
  for (const file of target.files) files.add(file);
4700
4795
  }
4701
4796
  for (const target of targets) {
@@ -4724,25 +4819,25 @@ function xcodeManifest(layout) {
4724
4819
  ].join("\n");
4725
4820
  }
4726
4821
  function packageFiles(root) {
4727
- const canonicalRoot = import_node_fs10.default.realpathSync(root);
4822
+ const canonicalRoot = import_node_fs11.default.realpathSync(root);
4728
4823
  const xcode = xcodeLayout(canonicalRoot);
4729
4824
  return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
4730
4825
  }
4731
4826
  function sourceTreeFiles(dir, canonicalRoot) {
4732
4827
  const found = [];
4733
4828
  const walk2 = (dir2) => {
4734
- for (const entry of import_node_fs10.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
4829
+ for (const entry of import_node_fs11.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
4735
4830
  if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
4736
4831
  continue;
4737
- const full = import_node_path12.default.join(dir2, entry.name);
4832
+ const full = import_node_path13.default.join(dir2, entry.name);
4738
4833
  if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
4739
- const real = import_node_fs10.default.realpathSync(full);
4740
- const relative = import_node_path12.default.relative(canonicalRoot, real);
4741
- if (relative.startsWith(`..${import_node_path12.default.sep}`) || relative === ".." || import_node_path12.default.isAbsolute(relative)) {
4834
+ const real = import_node_fs11.default.realpathSync(full);
4835
+ const relative = import_node_path13.default.relative(canonicalRoot, real);
4836
+ if (relative.startsWith(`..${import_node_path13.default.sep}`) || relative === ".." || import_node_path13.default.isAbsolute(relative)) {
4742
4837
  throw new Error(`swift input escapes the selected package: ${full}`);
4743
4838
  }
4744
4839
  if (entry.isDirectory()) {
4745
- if (import_node_fs10.default.existsSync(import_node_path12.default.join(full, "Package.swift"))) continue;
4840
+ if (import_node_fs11.default.existsSync(import_node_path13.default.join(full, "Package.swift"))) continue;
4746
4841
  walk2(full);
4747
4842
  } else if (entry.isFile()) {
4748
4843
  found.push(full);
@@ -4750,29 +4845,29 @@ function sourceTreeFiles(dir, canonicalRoot) {
4750
4845
  }
4751
4846
  }
4752
4847
  };
4753
- if (import_node_fs10.default.existsSync(dir)) walk2(import_node_fs10.default.realpathSync(dir));
4848
+ if (import_node_fs11.default.existsSync(dir)) walk2(import_node_fs11.default.realpathSync(dir));
4754
4849
  return found;
4755
4850
  }
4756
4851
  function readPackageFile(root, file, maxBytes) {
4757
- const canonicalRoot = import_node_fs10.default.realpathSync(root);
4758
- const relative = import_node_path12.default.relative(canonicalRoot, import_node_fs10.default.realpathSync(file));
4759
- if (relative === ".." || relative.startsWith(`..${import_node_path12.default.sep}`) || import_node_path12.default.isAbsolute(relative)) {
4852
+ const canonicalRoot = import_node_fs11.default.realpathSync(root);
4853
+ const relative = import_node_path13.default.relative(canonicalRoot, import_node_fs11.default.realpathSync(file));
4854
+ if (relative === ".." || relative.startsWith(`..${import_node_path13.default.sep}`) || import_node_path13.default.isAbsolute(relative)) {
4760
4855
  throw new Error(`swift input escapes the selected package: ${file}`);
4761
4856
  }
4762
- let ancestor = import_node_path12.default.resolve(file);
4857
+ let ancestor = import_node_path13.default.resolve(file);
4763
4858
  while (ancestor !== canonicalRoot) {
4764
- if (import_node_fs10.default.lstatSync(ancestor).isSymbolicLink()) {
4859
+ if (import_node_fs11.default.lstatSync(ancestor).isSymbolicLink()) {
4765
4860
  throw new Error(`swift input is a symlink: ${ancestor}`);
4766
4861
  }
4767
- const parent = import_node_path12.default.dirname(ancestor);
4862
+ const parent = import_node_path13.default.dirname(ancestor);
4768
4863
  if (parent === ancestor)
4769
4864
  throw new Error(`swift input escapes the selected package: ${file}`);
4770
4865
  ancestor = parent;
4771
4866
  }
4772
- const expected = import_node_fs10.default.statSync(file);
4773
- const fd = import_node_fs10.default.openSync(file, import_node_fs10.default.constants.O_RDONLY | import_node_fs10.default.constants.O_NOFOLLOW);
4867
+ const expected = import_node_fs11.default.statSync(file);
4868
+ const fd = import_node_fs11.default.openSync(file, import_node_fs11.default.constants.O_RDONLY | import_node_fs11.default.constants.O_NOFOLLOW);
4774
4869
  try {
4775
- const stat = import_node_fs10.default.fstatSync(fd);
4870
+ const stat = import_node_fs11.default.fstatSync(fd);
4776
4871
  if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
4777
4872
  throw new Error(`swift input changed while opening: ${file}`);
4778
4873
  }
@@ -4782,16 +4877,16 @@ function readPackageFile(root, file, maxBytes) {
4782
4877
  const bytes = Buffer.alloc(stat.size + 1);
4783
4878
  let offset = 0;
4784
4879
  while (offset < bytes.length) {
4785
- const count = import_node_fs10.default.readSync(fd, bytes, offset, bytes.length - offset, null);
4880
+ const count = import_node_fs11.default.readSync(fd, bytes, offset, bytes.length - offset, null);
4786
4881
  if (count === 0) break;
4787
4882
  offset += count;
4788
4883
  }
4789
- if (offset !== stat.size || import_node_fs10.default.fstatSync(fd).size !== stat.size) {
4884
+ if (offset !== stat.size || import_node_fs11.default.fstatSync(fd).size !== stat.size) {
4790
4885
  throw new Error(`swift input changed while reading: ${file}`);
4791
4886
  }
4792
4887
  return bytes.subarray(0, offset);
4793
4888
  } finally {
4794
- import_node_fs10.default.closeSync(fd);
4889
+ import_node_fs11.default.closeSync(fd);
4795
4890
  }
4796
4891
  }
4797
4892
  function sourceFiles(root) {
@@ -4799,7 +4894,7 @@ function sourceFiles(root) {
4799
4894
  }
4800
4895
  function resourceCandidateFiles(root) {
4801
4896
  return packageFiles(root).filter(
4802
- (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path12.default.basename(file))
4897
+ (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path13.default.basename(file))
4803
4898
  );
4804
4899
  }
4805
4900
  var HOSTED_LIMITS = {
@@ -4833,7 +4928,7 @@ function buildSwiftResourceTable(project, baseUrl) {
4833
4928
  const limits = inputLimits(Boolean(project.hosted));
4834
4929
  const absolute = resourceCandidateFiles(project.packagePath);
4835
4930
  const relative = absolute.map(
4836
- (file) => import_node_path12.default.relative(project.packagePath, file).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep)
4931
+ (file) => import_node_path13.default.relative(project.packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep)
4837
4932
  );
4838
4933
  const byRelative = new Map(absolute.map((file, index) => [relative[index], file]));
4839
4934
  const readContents = (candidate) => {
@@ -4855,16 +4950,16 @@ function buildSwiftResourceTable(project, baseUrl) {
4855
4950
  for (const { name, file, scale } of found) {
4856
4951
  const disk = byRelative.get(file);
4857
4952
  if (!disk) continue;
4858
- if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs10.default.statSync(disk).size > limits.imageTotalBytes) {
4953
+ if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs11.default.statSync(disk).size > limits.imageTotalBytes) {
4859
4954
  throw new Error("swift image pack exceeds the compile service caps");
4860
4955
  }
4861
4956
  const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
4862
4957
  imageBytes += bytes.length;
4863
- const hash = (0, import_node_crypto5.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
4864
- const ext = import_node_path12.default.posix.extname(file).toLowerCase();
4958
+ const hash = (0, import_node_crypto6.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
4959
+ const ext = import_node_path13.default.posix.extname(file).toLowerCase();
4865
4960
  table[name] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
4866
4961
  images[name] = {
4867
- file: import_node_path12.default.posix.basename(file),
4962
+ file: import_node_path13.default.posix.basename(file),
4868
4963
  data: bytes.toString("base64")
4869
4964
  };
4870
4965
  watched.push(file);
@@ -4888,10 +4983,10 @@ function buildSwiftResourceTable(project, baseUrl) {
4888
4983
  return { table, images, colors, symbols, watched };
4889
4984
  }
4890
4985
  function buildSwiftBundleFiles(packagePath, hosted) {
4891
- packagePath = import_node_fs10.default.realpathSync(packagePath);
4986
+ packagePath = import_node_fs11.default.realpathSync(packagePath);
4892
4987
  const limits = inputLimits(hosted);
4893
4988
  const relative = resourceCandidateFiles(packagePath).map(
4894
- (file) => import_node_path12.default.relative(packagePath, file).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep)
4989
+ (file) => import_node_path13.default.relative(packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep)
4895
4990
  );
4896
4991
  const files = {};
4897
4992
  const watched = [];
@@ -4905,13 +5000,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
4905
5000
  total += bytes.length;
4906
5001
  if (xcode.app.infoPlistFile)
4907
5002
  watched.push(
4908
- import_node_path12.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path12.default.sep).join("/")
5003
+ import_node_path13.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path13.default.sep).join("/")
4909
5004
  );
4910
5005
  }
4911
5006
  for (const { base, file } of enumerateBundleJson(relative)) {
4912
5007
  watched.push(file);
4913
- const disk = import_node_path12.default.join(packagePath, ...file.split("/"));
4914
- if (Object.keys(files).length >= limits.resources || total + import_node_fs10.default.statSync(disk).size > limits.resourceTotalBytes) {
5008
+ const disk = import_node_path13.default.join(packagePath, ...file.split("/"));
5009
+ if (Object.keys(files).length >= limits.resources || total + import_node_fs11.default.statSync(disk).size > limits.resourceTotalBytes) {
4915
5010
  throw new Error(
4916
5011
  `swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
4917
5012
  );
@@ -4926,12 +5021,12 @@ function serveSwiftResource(project, key) {
4926
5021
  return project.resourceFiles.get(key) ?? project.resourcesPrevious.get(key) ?? null;
4927
5022
  }
4928
5023
  function linkedModuleRoots(packagePath) {
4929
- packagePath = import_node_fs10.default.realpathSync(packagePath);
5024
+ packagePath = import_node_fs11.default.realpathSync(packagePath);
4930
5025
  let manifest;
4931
5026
  try {
4932
5027
  manifest = readPackageFile(
4933
5028
  packagePath,
4934
- import_node_path12.default.join(packagePath, "Package.swift"),
5029
+ import_node_path13.default.join(packagePath, "Package.swift"),
4935
5030
  MAX_SWIFT_COMPILE_SOURCE_BYTES
4936
5031
  ).toString("utf8");
4937
5032
  } catch {
@@ -4940,35 +5035,35 @@ function linkedModuleRoots(packagePath) {
4940
5035
  const roots = /* @__PURE__ */ new Set();
4941
5036
  const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
4942
5037
  for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
4943
- const root = import_node_path12.default.resolve(packagePath, match[1]);
4944
- if (import_node_fs10.default.existsSync(import_node_path12.default.join(root, "Package.swift"))) roots.add(root);
5038
+ const root = import_node_path13.default.resolve(packagePath, match[1]);
5039
+ if (import_node_fs11.default.existsSync(import_node_path13.default.join(root, "Package.swift"))) roots.add(root);
4945
5040
  }
4946
5041
  return [...roots].sort();
4947
5042
  }
4948
5043
  function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
4949
- const hash = (0, import_node_crypto5.createHash)("sha256");
5044
+ const hash = (0, import_node_crypto6.createHash)("sha256");
4950
5045
  hash.update(packagePath);
4951
5046
  const projectInputs = new Set(packageFiles(packagePath));
4952
5047
  for (const file of [...projectInputs].sort()) {
4953
- hash.update(import_node_path12.default.relative(packagePath, file));
4954
- const stat = import_node_fs10.default.statSync(file);
5048
+ hash.update(import_node_path13.default.relative(packagePath, file));
5049
+ const stat = import_node_fs11.default.statSync(file);
4955
5050
  hash.update(`${stat.mtimeMs}/${stat.ctimeMs}/${stat.size}`);
4956
5051
  }
4957
5052
  const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
4958
- (root) => import_node_fs10.default.existsSync(import_node_path12.default.join(root, "toolchain.json"))
5053
+ (root) => import_node_fs11.default.existsSync(import_node_path13.default.join(root, "toolchain.json"))
4959
5054
  );
4960
5055
  if (moduleRoot) {
4961
5056
  hash.update(moduleRoot);
4962
5057
  for (const relative of swiftModuleInputFiles(moduleRoot)) {
4963
5058
  hash.update(relative);
4964
- hash.update(String(import_node_fs10.default.statSync(import_node_path12.default.join(moduleRoot, relative)).mtimeMs));
5059
+ hash.update(String(import_node_fs11.default.statSync(import_node_path13.default.join(moduleRoot, relative)).mtimeMs));
4965
5060
  }
4966
5061
  }
4967
5062
  return hash.digest("hex").slice(0, 16);
4968
5063
  }
4969
5064
  function entryRootId(packagePath, file) {
4970
- const relative = import_node_path12.default.relative(packagePath, file).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep);
4971
- return `${import_node_path12.default.basename(packagePath)}${import_node_path12.default.posix.sep}${relative}`;
5065
+ const relative = import_node_path13.default.relative(packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep);
5066
+ return `${import_node_path13.default.basename(packagePath)}${import_node_path13.default.posix.sep}${relative}`;
4972
5067
  }
4973
5068
  function icuUrl(origin, artifact) {
4974
5069
  return "url" in artifact.icu ? artifact.icu.url : `${origin}${ICU_PATH}${artifact.icu.sha256}`;
@@ -4977,8 +5072,8 @@ function packageSources(packagePath) {
4977
5072
  const xcode = xcodeLayout(packagePath);
4978
5073
  const files = {};
4979
5074
  for (const file of sourceFiles(packagePath)) {
4980
- const relative = import_node_path12.default.relative(packagePath, file).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep);
4981
- if (xcode && import_node_path12.default.basename(file) === "Package.swift") continue;
5075
+ const relative = import_node_path13.default.relative(packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep);
5076
+ if (xcode && import_node_path13.default.basename(file) === "Package.swift") continue;
4982
5077
  files[xcode ? xcodeInputKey(xcode, file, relative) : relative] = readPackageFile(
4983
5078
  packagePath,
4984
5079
  file,
@@ -4995,7 +5090,7 @@ function packageSnapshot(project) {
4995
5090
  files,
4996
5091
  resourcePaths: swiftImplicitResourcePaths(
4997
5092
  resourceCandidateFiles(project.packagePath).map(
4998
- (file) => import_node_path12.default.relative(project.packagePath, file).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep)
5093
+ (file) => import_node_path13.default.relative(project.packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep)
4999
5094
  )
5000
5095
  ),
5001
5096
  resources: buildSwiftResourceTable(project, ""),
@@ -5004,7 +5099,7 @@ function packageSnapshot(project) {
5004
5099
  ...native ? {
5005
5100
  glue: readPackageFile(
5006
5101
  project.packagePath,
5007
- import_node_path12.default.join(project.packagePath, NATIVE_GLUE),
5102
+ import_node_path13.default.join(project.packagePath, NATIVE_GLUE),
5008
5103
  MAX_SWIFT_COMPILE_SOURCE_BYTES
5009
5104
  ).toString("utf8")
5010
5105
  } : {}
@@ -5043,7 +5138,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
5043
5138
  package: content
5044
5139
  };
5045
5140
  const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
5046
- (root) => import_node_fs10.default.existsSync(import_node_path12.default.join(root, "toolchain.json"))
5141
+ (root) => import_node_fs11.default.existsSync(import_node_path13.default.join(root, "toolchain.json"))
5047
5142
  ) ?? await swiftDistributionRoot();
5048
5143
  if (!moduleRoot)
5049
5144
  return {
@@ -5062,17 +5157,17 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
5062
5157
  ...targets.length > 0 ? targets : ["App"]
5063
5158
  ])
5064
5159
  );
5065
- if (missing.size > 0) throw new Error(missingModulesMessage(packagePath, missing));
5160
+ if (missing.size > 0) throw new Error(await missingModulesMessage(packagePath, missing));
5066
5161
  const artifact = await compileSwiftProjectUnit(input, {
5067
5162
  // the compile rewrites Sources/App in its root before swiftpm builds, and
5068
5163
  // its lock orders one process only: two vites on one root (a lane's dev
5069
5164
  // server and a capture, or two checkouts) build each other's sources. so
5070
5165
  // each app and module checkout gets its own root, which keeps the same
5071
5166
  // app's incremental build across restarts.
5072
- buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path12.default.join(
5073
- import_node_os6.default.tmpdir(),
5167
+ buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path13.default.join(
5168
+ import_node_os7.default.tmpdir(),
5074
5169
  "contrast-swift-build",
5075
- (0, import_node_crypto5.createHash)("sha256").update(`${moduleRoot}\0${import_node_path12.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
5170
+ (0, import_node_crypto6.createHash)("sha256").update(`${moduleRoot}\0${import_node_path13.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
5076
5171
  ),
5077
5172
  moduleRoot,
5078
5173
  ...toolchain
@@ -5140,7 +5235,7 @@ var UNPROVIDED_PLATFORM_MODULES = {
5140
5235
  MachO: "Peach compiles for WebAssembly, which has no Mach-O images"
5141
5236
  };
5142
5237
  var IOS_SDK_FRAMEWORKS = new Set(ios_sdk_frameworks_default.frameworks);
5143
- function missingModulesMessage(packagePath, missing) {
5238
+ async function missingModulesMessage(packagePath, missing) {
5144
5239
  const layout = xcodeLayout(packagePath);
5145
5240
  const gaps = new Map([
5146
5241
  ...(layout?.app.binaryFrameworks ?? []).map(
@@ -5162,12 +5257,29 @@ function missingModulesMessage(packagePath, missing) {
5162
5257
  ...layout?.packages.modules ?? [],
5163
5258
  ...layout?.packages.unavailable ?? []
5164
5259
  ]);
5260
+ const packaged = new Set(
5261
+ [...missing.keys()].filter(
5262
+ (name) => !UNPROVIDED_PLATFORM_MODULES[name] && !IOS_SDK_FRAMEWORKS.has(name)
5263
+ )
5264
+ );
5265
+ if (packaged.size > 0)
5266
+ await Promise.all(
5267
+ (layout?.packages.binaries ?? []).map(async (binary) => {
5268
+ const modules = await swiftBinaryModules(binary).catch(() => []);
5269
+ for (const name of modules)
5270
+ if (packaged.has(name))
5271
+ gaps.set(name, {
5272
+ source: binary.source,
5273
+ reason: `${binary.target} is a binary framework`
5274
+ });
5275
+ })
5276
+ );
5165
5277
  const width = Math.max(...[...missing.keys()].map((name) => name.length));
5166
5278
  return [
5167
5279
  `Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
5168
5280
  ...[...missing].map(([name, files]) => {
5169
5281
  const gap = gaps.get(name);
5170
- return ` ${name.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path12.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
5282
+ return ` ${name.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path13.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
5171
5283
  })
5172
5284
  ].join("\n");
5173
5285
  }
@@ -5175,7 +5287,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
5175
5287
  const auth = hosted ? null : resolveCliAuth();
5176
5288
  if (!hosted && (!auth || auth.kind === "github")) {
5177
5289
  throw new Error(
5178
- `compiling ${import_node_path12.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
5290
+ `compiling ${import_node_path13.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
5179
5291
  );
5180
5292
  }
5181
5293
  const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
@@ -5194,7 +5306,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
5194
5306
  const bytes = sources.reduce((total2, text2) => total2 + Buffer.byteLength(text2), 0);
5195
5307
  if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
5196
5308
  throw new Error(
5197
- `${import_node_path12.default.basename(packagePath)} has ${sources.length} Swift files (${bytes} bytes), over Contrast's compile limits of ${MAX_SWIFT_COMPILE_FILES} files and ${MAX_SWIFT_COMPILE_SOURCE_BYTES} bytes; compile it on this machine with the Swift distribution instead`
5309
+ `${import_node_path13.default.basename(packagePath)} has ${sources.length} Swift files (${bytes} bytes), over Contrast's compile limits of ${MAX_SWIFT_COMPILE_FILES} files and ${MAX_SWIFT_COMPILE_SOURCE_BYTES} bytes; compile it on this machine with the Swift distribution instead`
5198
5310
  );
5199
5311
  }
5200
5312
  const descriptor = snapshot.native;
@@ -5213,7 +5325,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
5213
5325
  );
5214
5326
  if (descriptor && address.native?.hash !== descriptor.hash) {
5215
5327
  throw new Error(
5216
- `${import_node_path12.default.basename(packagePath)}: Contrast compiled native contract ${address.native?.hash ?? "none"} but one typegen wrote ${descriptor.hash}; the app's One and the compile host's differ, or the compile host is older than this peachsim`
5328
+ `${import_node_path13.default.basename(packagePath)}: Contrast compiled native contract ${address.native?.hash ?? "none"} but one typegen wrote ${descriptor.hash}; the app's One and the compile host's differ, or the compile host is older than this peachsim`
5217
5329
  );
5218
5330
  }
5219
5331
  const response = await fetch(address.url, { signal });
@@ -5286,17 +5398,17 @@ function artifactFor(project, entry, moduleRoot) {
5286
5398
  return fresh;
5287
5399
  }
5288
5400
  function swiftPackageWatchFiles(packagePath, moduleRoot) {
5289
- packagePath = import_node_fs10.default.realpathSync(packagePath);
5401
+ packagePath = import_node_fs11.default.realpathSync(packagePath);
5290
5402
  return [
5291
- ...xcodeProjects.has(packagePath) ? [] : [import_node_path12.default.join(packagePath, "Package.swift")],
5403
+ ...xcodeProjects.has(packagePath) ? [] : [import_node_path13.default.join(packagePath, "Package.swift")],
5292
5404
  ...sourceFiles(packagePath),
5293
5405
  ...nativeSourceFiles(packagePath),
5294
5406
  ...resourceCandidateFiles(packagePath),
5295
- ...moduleRoot ? swiftModuleInputFiles(moduleRoot).map((file) => import_node_path12.default.join(moduleRoot, file)) : []
5407
+ ...moduleRoot ? swiftModuleInputFiles(moduleRoot).map((file) => import_node_path13.default.join(moduleRoot, file)) : []
5296
5408
  ];
5297
5409
  }
5298
5410
  async function swiftPackageMetadata(packagePath, packageName, moduleRoot, origin, hosted) {
5299
- packagePath = import_node_fs10.default.realpathSync(packagePath);
5411
+ packagePath = import_node_fs11.default.realpathSync(packagePath);
5300
5412
  const mains = sourceFiles(packagePath).filter(
5301
5413
  (file) => swiftApplicationEntry(
5302
5414
  file,
@@ -5310,7 +5422,7 @@ async function swiftPackageMetadata(packagePath, packageName, moduleRoot, origin
5310
5422
  );
5311
5423
  }
5312
5424
  const project = projectFor(packagePath, hosted);
5313
- const entry = mains.length === 1 ? import_node_path12.default.relative(packagePath, mains[0]).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep) : Object.entries(native?.files ?? {}).find(
5425
+ const entry = mains.length === 1 ? import_node_path13.default.relative(packagePath, mains[0]).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep) : Object.entries(native?.files ?? {}).find(
5314
5426
  ([_file, names]) => names.length > 0
5315
5427
  )?.[0];
5316
5428
  if (!entry) throw new Error(`swift package ${packageName} has no native module source`);
@@ -5399,12 +5511,12 @@ function artifactUrl(project, artifact) {
5399
5511
  return `${serverOrigin()}${ARTIFACT_PATH2}${artifact.hash}.wasm`;
5400
5512
  }
5401
5513
  function packageFor(file) {
5402
- let dir = import_node_path13.default.dirname(file);
5514
+ let dir = import_node_path14.default.dirname(file);
5403
5515
  const stop = devServer?.config.root;
5404
5516
  for (; ; ) {
5405
- if (import_node_fs11.default.existsSync(import_node_path13.default.join(dir, "Package.swift"))) return dir;
5406
- if (stop !== void 0 && dir === stop || import_node_path13.default.dirname(dir) === dir) break;
5407
- dir = import_node_path13.default.dirname(dir);
5517
+ if (import_node_fs12.default.existsSync(import_node_path14.default.join(dir, "Package.swift"))) return dir;
5518
+ if (stop !== void 0 && dir === stop || import_node_path14.default.dirname(dir) === dir) break;
5519
+ dir = import_node_path14.default.dirname(dir);
5408
5520
  }
5409
5521
  throw new Error(
5410
5522
  `no Package.swift above ${file}${stop === void 0 ? "" : ` (searched up to ${stop})`}; a .swift import needs a swiftpm package like the one in packages/sootsim-swift/example`
@@ -5425,9 +5537,9 @@ function swiftPlugin(options = {}) {
5425
5537
  if (!resolved) throw new Error(`cannot resolve swift source ${source}`);
5426
5538
  let id = resolved.id;
5427
5539
  if (importer && (source.startsWith("./") || source.startsWith("../"))) {
5428
- const raw2 = import_node_path13.default.resolve(import_node_path13.default.dirname(importer.split("?")[0] ?? importer), source);
5540
+ const raw2 = import_node_path14.default.resolve(import_node_path14.default.dirname(importer.split("?")[0] ?? importer), source);
5429
5541
  try {
5430
- if (import_node_fs11.default.realpathSync(raw2) === import_node_fs11.default.realpathSync(resolved.id)) id = raw2;
5542
+ if (import_node_fs12.default.realpathSync(raw2) === import_node_fs12.default.realpathSync(resolved.id)) id = raw2;
5431
5543
  } catch {
5432
5544
  }
5433
5545
  }
@@ -5436,22 +5548,22 @@ function swiftPlugin(options = {}) {
5436
5548
  async load(id) {
5437
5549
  if (!id.startsWith(VIRTUAL_PREFIX)) return null;
5438
5550
  const file = id.slice(VIRTUAL_PREFIX.length);
5439
- if (!import_node_fs11.default.existsSync(file)) throw new Error(`swift source ${file} no longer exists`);
5551
+ if (!import_node_fs12.default.existsSync(file)) throw new Error(`swift source ${file} no longer exists`);
5440
5552
  const packagePath = options.packagePath ?? packageFor(file);
5441
5553
  const project = projectFor(packagePath);
5442
- const entry = import_node_path13.default.relative(packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep);
5554
+ const entry = import_node_path14.default.relative(packagePath, file).split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep);
5443
5555
  for (const source of [
5444
5556
  ...sourceFiles(packagePath),
5445
5557
  ...nativeSourceFiles(packagePath)
5446
5558
  ])
5447
5559
  this.addWatchFile(source);
5448
- this.addWatchFile(import_node_path13.default.join(packagePath, "Package.swift"));
5560
+ this.addWatchFile(import_node_path14.default.join(packagePath, "Package.swift"));
5449
5561
  const moduleRoot = linkedModuleRoots(packagePath).find(
5450
- (root) => import_node_fs11.default.existsSync(import_node_path13.default.join(root, "toolchain.json"))
5562
+ (root) => import_node_fs12.default.existsSync(import_node_path14.default.join(root, "toolchain.json"))
5451
5563
  );
5452
5564
  if (moduleRoot)
5453
5565
  for (const relative of swiftModuleInputFiles(moduleRoot))
5454
- this.addWatchFile(import_node_path13.default.join(moduleRoot, relative));
5566
+ this.addWatchFile(import_node_path14.default.join(moduleRoot, relative));
5455
5567
  let artifact;
5456
5568
  try {
5457
5569
  artifact = await artifactFor(project, entry);
@@ -5470,7 +5582,7 @@ function swiftPlugin(options = {}) {
5470
5582
  ...artifact.package.resources.watched,
5471
5583
  ...artifact.package.bundleFiles.watched
5472
5584
  ])
5473
- this.addWatchFile(import_node_path13.default.join(packagePath, ...watched.split(import_node_path13.default.posix.sep)));
5585
+ this.addWatchFile(import_node_path14.default.join(packagePath, ...watched.split(import_node_path14.default.posix.sep)));
5474
5586
  const colors = artifact.package.resources.colors;
5475
5587
  const symbols = artifact.package.resources.symbols;
5476
5588
  const bundleFiles = artifact.package.bundleFiles.files;