peachsim 0.1.1641 → 0.1.1644

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/cli/app-bundle-resources.ts +57 -0
  2. package/cli/commands/control.ts +12 -0
  3. package/cli/drivers/playwright.ts +39 -0
  4. package/cli/outbound-endpoints.ts +4 -2
  5. package/detox/motion-change.cjs +7 -5
  6. package/detox/motion-change.d.cts +1 -0
  7. package/detox/motion-leg-starts.cjs +20 -0
  8. package/detox/motion-leg-starts.d.cts +8 -0
  9. package/dist-lib/agent-daemon-client.cjs +1 -1
  10. package/dist-lib/agent-events.cjs +1 -1
  11. package/dist-lib/attached-projects.cjs +1 -1
  12. package/dist-lib/auth/shared-session.cjs +1 -1
  13. package/dist-lib/backend-origin.cjs +3 -3
  14. package/dist-lib/beta.cjs +1 -1
  15. package/dist-lib/beta.mjs +1 -1
  16. package/dist-lib/bridge-constants.cjs +1 -1
  17. package/dist-lib/bridge-contract-input.cjs +1 -1
  18. package/dist-lib/bridge-contract-input.mjs +1 -1
  19. package/dist-lib/bridge-contract.cjs +1 -1
  20. package/dist-lib/bridge-contract.mjs +1 -1
  21. package/dist-lib/bundle-channel.cjs +719 -572
  22. package/dist-lib/capture-contract.cjs +1 -1
  23. package/dist-lib/capture-contract.mjs +1 -1
  24. package/dist-lib/cloud-contract.cjs +1 -1
  25. package/dist-lib/cloud-contract.mjs +1 -1
  26. package/dist-lib/cloud-test-args.cjs +1 -1
  27. package/dist-lib/cloud-test-args.mjs +1 -1
  28. package/dist-lib/cloud.cjs +1 -1
  29. package/dist-lib/cloud.mjs +1 -1
  30. package/dist-lib/config.cjs +1 -1
  31. package/dist-lib/config.mjs +1 -1
  32. package/dist-lib/detox/index.cjs +7 -6
  33. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  34. package/dist-lib/expo-swift-bundle.cjs +656 -509
  35. package/dist-lib/expo-swift-metadata.cjs +1 -1
  36. package/dist-lib/expo-swift-metadata.mjs +1 -1
  37. package/dist-lib/home-paths.cjs +1 -1
  38. package/dist-lib/host/bridge-host.cjs +811 -658
  39. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  40. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  41. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  42. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  43. package/dist-lib/host/websocket-proxy.cjs +1 -1
  44. package/dist-lib/index.cjs +89 -41
  45. package/dist-lib/jump-to-source-babel.cjs +1 -1
  46. package/dist-lib/jump-to-source-native.cjs +1 -1
  47. package/dist-lib/kotlin-host.cjs +1 -1
  48. package/dist-lib/menu.cjs +14 -6
  49. package/dist-lib/menu.mjs +14 -6
  50. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  51. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  52. package/dist-lib/metro-production-bundle.cjs +1 -1
  53. package/dist-lib/metro-production-bundle.mjs +1 -1
  54. package/dist-lib/metro.cjs +88 -41
  55. package/dist-lib/native-app-identity-project.cjs +90 -41
  56. package/dist-lib/native-app-identity-project.mjs +89 -41
  57. package/dist-lib/native-app-identity.cjs +1 -1
  58. package/dist-lib/native-app-identity.mjs +1 -1
  59. package/dist-lib/native-firebase-metadata.cjs +1 -1
  60. package/dist-lib/native-firebase-metadata.mjs +1 -1
  61. package/dist-lib/plist.cjs +1 -1
  62. package/dist-lib/plist.mjs +1 -1
  63. package/dist-lib/profiles.cjs +1 -1
  64. package/dist-lib/public-brand.cjs +1 -1
  65. package/dist-lib/react-native-host-modules.cjs +1 -1
  66. package/dist-lib/react-native-host-modules.mjs +1 -1
  67. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  68. package/dist-lib/sdk.cjs +2 -1
  69. package/dist-lib/sdk.mjs +2 -1
  70. package/dist-lib/skills.cjs +1716 -1366
  71. package/dist-lib/swift-compile.cjs +297 -215
  72. package/dist-lib/swift-compile.mjs +315 -227
  73. package/dist-lib/swift-package.cjs +1 -1
  74. package/dist-lib/swift-package.mjs +1 -1
  75. package/dist-lib/swift-submit.cjs +1 -1
  76. package/dist-lib/swift-submit.mjs +1 -1
  77. package/dist-lib/swift-toolchain.cjs +1 -1
  78. package/dist-lib/swift.cjs +1 -1
  79. package/dist-lib/vite-swift.cjs +620 -473
  80. package/dist-lib/vite.cjs +1 -1
  81. package/dist-lib/worklet-executable.cjs +1 -1
  82. package/dist-lib/worklet-executable.mjs +1 -1
  83. package/package.json +1 -1
  84. package/src/appBundleResourcesContract.ts +51 -0
  85. package/src/backend-origin.ts +3 -1
  86. package/src/host/bridge-host.ts +17 -11
  87. package/src/host/staged-host-files.ts +28 -4
  88. package/src/launchMetadataContract.ts +1 -0
  89. package/src/menu.ts +12 -4
  90. package/src/native-app-identity-project.ts +47 -38
  91. package/src/runtime-delivery.ts +6 -7
  92. package/src/swift-compile.ts +18 -7
  93. package/src/swift-compiler-digest.ts +5 -3
  94. package/src/swift-objc-compile.ts +34 -4
  95. package/src/swift-root-lock.ts +241 -92
  96. package/src/xcode-project.ts +67 -4
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1641 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1644 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -14,8 +14,8 @@ var __commonJS = (cb, mod) => function __require() {
14
14
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
15
  };
16
16
  var __export = (target, all) => {
17
- for (var name2 in all)
18
- __defProp(target, name2, { get: all[name2], enumerable: true });
17
+ for (var name3 in all)
18
+ __defProp(target, name3, { get: all[name3], enumerable: true });
19
19
  };
20
20
  var __copyProps = (to, from, except, desc) => {
21
21
  if (from && typeof from === "object" || typeof from === "function") {
@@ -533,8 +533,8 @@ var require_build = __commonJS({
533
533
  }
534
534
  function walk_obj(next, next_child) {
535
535
  var tag_type, i, prop;
536
- var name2 = type(next);
537
- if ("Undefined" == name2) {
536
+ var name3 = type(next);
537
+ if ("Undefined" == name3) {
538
538
  return;
539
539
  } else if (Array.isArray(next)) {
540
540
  next_child = next_child.ele("array");
@@ -543,7 +543,7 @@ var require_build = __commonJS({
543
543
  }
544
544
  } else if (Buffer.isBuffer(next)) {
545
545
  next_child.ele("data").raw(next.toString("base64"));
546
- } else if ("Object" == name2) {
546
+ } else if ("Object" == name3) {
547
547
  next_child = next_child.ele("dict");
548
548
  for (prop in next) {
549
549
  if (next.hasOwnProperty(prop)) {
@@ -551,22 +551,22 @@ var require_build = __commonJS({
551
551
  walk_obj(next[prop], next_child);
552
552
  }
553
553
  }
554
- } else if ("Number" == name2) {
554
+ } else if ("Number" == name3) {
555
555
  tag_type = next % 1 === 0 ? "integer" : "real";
556
556
  next_child.ele(tag_type).txt(next.toString());
557
- } else if ("BigInt" == name2) {
557
+ } else if ("BigInt" == name3) {
558
558
  next_child.ele("integer").txt(next);
559
- } else if ("Date" == name2) {
559
+ } else if ("Date" == name3) {
560
560
  next_child.ele("date").txt(ISODateString(new Date(next)));
561
- } else if ("Boolean" == name2) {
561
+ } else if ("Boolean" == name3) {
562
562
  next_child.ele(next ? "true" : "false");
563
- } else if ("String" == name2) {
563
+ } else if ("String" == name3) {
564
564
  next_child.ele("string").txt(next);
565
- } else if ("ArrayBuffer" == name2) {
565
+ } else if ("ArrayBuffer" == name3) {
566
566
  next_child.ele("data").raw(base64.fromByteArray(next));
567
567
  } else if (next && next.buffer && "ArrayBuffer" == type(next.buffer)) {
568
568
  next_child.ele("data").raw(base64.fromByteArray(new Uint8Array(next.buffer), next_child));
569
- } else if ("Null" === name2) {
569
+ } else if ("Null" === name3) {
570
570
  next_child.ele("null").txt("");
571
571
  }
572
572
  }
@@ -652,8 +652,8 @@ var require_parse2 = __commonJS({
652
652
  }
653
653
  return root;
654
654
  };
655
- function internalize(holder, name2, reviver) {
656
- const value = holder[name2];
655
+ function internalize(holder, name3, reviver) {
656
+ const value = holder[name3];
657
657
  if (value != null && typeof value === "object") {
658
658
  if (Array.isArray(value)) {
659
659
  for (let i = 0; i < value.length; i++) {
@@ -686,7 +686,7 @@ var require_parse2 = __commonJS({
686
686
  }
687
687
  }
688
688
  }
689
- return reviver.call(holder, name2, value);
689
+ return reviver.call(holder, name3, value);
690
690
  }
691
691
  var lexState;
692
692
  var buffer;
@@ -1821,10 +1821,10 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
1821
1821
  };
1822
1822
  const catalogs = paths.filter((path22) => baseOf(path22) === "Contents.json");
1823
1823
  for (const contentsPath of catalogs) {
1824
- const name2 = catalogEntryName(contentsPath, ".imageset", readText);
1825
- if (name2 === null) continue;
1824
+ const name3 = catalogEntryName(contentsPath, ".imageset", readText);
1825
+ if (name3 === null) continue;
1826
1826
  const { bundlePath, names } = namesFor(contentsPath);
1827
- if (names.has(name2)) continue;
1827
+ if (names.has(name3)) continue;
1828
1828
  let parsed;
1829
1829
  try {
1830
1830
  const text4 = readText(contentsPath);
@@ -1838,10 +1838,10 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
1838
1838
  const dir = contentsPath.split("/").slice(0, -1).join("/");
1839
1839
  const variants = imagesetFiles(images);
1840
1840
  if (variants.length === 0) continue;
1841
- names.add(name2);
1841
+ names.add(name3);
1842
1842
  for (const variant of variants)
1843
1843
  table.push({
1844
- name: name2,
1844
+ name: name3,
1845
1845
  file: `${dir}/${variant.filename}`,
1846
1846
  scale: variant.scale,
1847
1847
  bundlePath
@@ -1849,11 +1849,11 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
1849
1849
  }
1850
1850
  for (const path22 of paths) {
1851
1851
  if (!isFlatResourceImage(path22)) continue;
1852
- const name2 = baseOf(path22).slice(0, -extOf(path22).length);
1852
+ const name3 = baseOf(path22).slice(0, -extOf(path22).length);
1853
1853
  const { bundlePath, names } = namesFor(path22);
1854
- if (name2 === "" || names.has(name2)) continue;
1855
- names.add(name2);
1856
- table.push({ name: name2, file: path22, scale: flatScale(path22), bundlePath });
1854
+ if (name3 === "" || names.has(name3)) continue;
1855
+ names.add(name3);
1856
+ table.push({ name: name3, file: path22, scale: flatScale(path22), bundlePath });
1857
1857
  }
1858
1858
  return table;
1859
1859
  }
@@ -1883,8 +1883,8 @@ function colorsetValue(color) {
1883
1883
  function enumerateBundleColors(paths, readText) {
1884
1884
  const table = {};
1885
1885
  for (const contentsPath of paths.filter((path22) => baseOf(path22) === "Contents.json")) {
1886
- const name2 = catalogEntryName(contentsPath, ".colorset", readText);
1887
- if (name2 === null || name2 in table) continue;
1886
+ const name3 = catalogEntryName(contentsPath, ".colorset", readText);
1887
+ if (name3 === null || name3 in table) continue;
1888
1888
  let colors;
1889
1889
  try {
1890
1890
  const text4 = readText(contentsPath);
@@ -1913,8 +1913,8 @@ function enumerateBundleColors(paths, readText) {
1913
1913
  else light = value;
1914
1914
  }
1915
1915
  if (light === null) continue;
1916
- if (typeof light === "object") table[name2] = light;
1917
- else table[name2] = { light, dark: typeof dark === "string" ? dark : light };
1916
+ if (typeof light === "object") table[name3] = light;
1917
+ else table[name3] = { light, dark: typeof dark === "string" ? dark : light };
1918
1918
  }
1919
1919
  return table;
1920
1920
  }
@@ -1976,10 +1976,10 @@ function guide(svg, id, axis) {
1976
1976
  function enumerateBundleSymbols(paths, readText, bundleForFile) {
1977
1977
  const table = {};
1978
1978
  for (const contentsPath of paths.filter((path22) => baseOf(path22) === "Contents.json")) {
1979
- const name2 = catalogEntryName(contentsPath, ".symbolset", readText);
1980
- if (name2 === null) continue;
1979
+ const name3 = catalogEntryName(contentsPath, ".symbolset", readText);
1980
+ if (name3 === null) continue;
1981
1981
  const bundle = bundleForFile(contentsPath);
1982
- const key2 = bundle === "." ? name2 : `${bundle}/${name2}`;
1982
+ const key2 = bundle === "." ? name3 : `${bundle}/${name3}`;
1983
1983
  if (Object.hasOwn(table, key2)) continue;
1984
1984
  let symbols;
1985
1985
  try {
@@ -2020,7 +2020,7 @@ function enumerateBundleSymbols(paths, readText, bundleForFile) {
2020
2020
  }
2021
2021
  var COMPILED_EXTENSIONS = /* @__PURE__ */ new Set([".swift", ".metal", ".storyboard", ".xib"]);
2022
2022
  function isCopiedResource(path22) {
2023
- if (path22.split("/").some((segment) => segment.endsWith(".atlasc"))) return true;
2023
+ if (path22.split("/").some((segment) => /\.(atlasc|bundle)$/.test(segment))) return true;
2024
2024
  const ext = extOf(path22);
2025
2025
  if (ext === ".json" || ext === ".xcstrings") return true;
2026
2026
  return !RASTER_EXTENSIONS.has(ext) && !COMPILED_EXTENSIONS.has(ext) && !path22.split("/").some((segment) => segment.endsWith(".xcassets"));
@@ -2037,9 +2037,7 @@ function enumerateBundleResources(paths) {
2037
2037
  });
2038
2038
  for (const file of ordered) {
2039
2039
  const parts = file.split("/");
2040
- const nested = parts.findIndex(
2041
- (part) => part.endsWith(".atlasc") || part.endsWith(".lproj")
2042
- );
2040
+ const nested = parts.findIndex((part) => /\.(atlasc|lproj|bundle)$/.test(part));
2043
2041
  const base = nested < 0 ? baseOf(file) : parts.slice(nested).join("/");
2044
2042
  if (seen.has(base)) continue;
2045
2043
  seen.add(base);
@@ -2053,8 +2051,8 @@ function resolveSwiftImageResourceUrls(resources, origin) {
2053
2051
  Object.entries(resources).map(([bundlePath, images]) => [
2054
2052
  bundlePath,
2055
2053
  Object.fromEntries(
2056
- Object.entries(images).map(([name2, image]) => [
2057
- name2,
2054
+ Object.entries(images).map(([name3, image]) => [
2055
+ name3,
2058
2056
  image.map((variant) => ({
2059
2057
  ...variant,
2060
2058
  uri: new URL(variant.uri, origin).href
@@ -2070,11 +2068,11 @@ function nativeExportLines(args, commonjs) {
2070
2068
  const native = args.native;
2071
2069
  if (!native) return [];
2072
2070
  return [
2073
- ...Object.entries(native.modules).map(([name2, methods]) => {
2071
+ ...Object.entries(native.modules).map(([name3, methods]) => {
2074
2072
  const calls = methods.map(
2075
- (method) => `${method}: (...args) => callSwiftModule(options, ${JSON.stringify(`${native.packageId}.${name2}`)}, ${JSON.stringify(method)}, args, ${JSON.stringify(native.contractHash)})`
2073
+ (method) => `${method}: (...args) => callSwiftModule(options, ${JSON.stringify(`${native.packageId}.${name3}`)}, ${JSON.stringify(method)}, args, ${JSON.stringify(native.contractHash)})`
2076
2074
  ).join(", ");
2077
- return commonjs ? `module.exports.${name2} = Object.freeze({ ${calls} })` : `export const ${name2} = Object.freeze({ ${calls} })`;
2075
+ return commonjs ? `module.exports.${name3} = Object.freeze({ ${calls} })` : `export const ${name3} = Object.freeze({ ${calls} })`;
2078
2076
  }),
2079
2077
  ...native.views.map((view) => {
2080
2078
  const value = `createSwiftEntry({ ...options, rootId: options.rootId + ${JSON.stringify("/")} + ${JSON.stringify(view)}, view: ${JSON.stringify(view)}, contractHash: ${JSON.stringify(native.contractHash)} })`;
@@ -2145,9 +2143,9 @@ function cacheDir() {
2145
2143
  }
2146
2144
  function swiftPackageCacheOptions() {
2147
2145
  const root = import_node_path.default.join(cacheDir(), "swiftpm");
2148
- return ["cache", "config", "security"].flatMap((name2) => [
2149
- `--${name2}-path`,
2150
- import_node_path.default.join(root, name2)
2146
+ return ["cache", "config", "security"].flatMap((name3) => [
2147
+ `--${name3}-path`,
2148
+ import_node_path.default.join(root, name3)
2151
2149
  ]);
2152
2150
  }
2153
2151
  var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
@@ -2532,7 +2530,7 @@ function designTimeDiagnostic(output, files2) {
2532
2530
  const rewritten = /* @__PURE__ */ new Map();
2533
2531
  const linesOf = (path22) => {
2534
2532
  const file = Object.keys(files2).find(
2535
- (name2) => name2.endsWith(".swift") && (path22 === name2 || path22.endsWith(`/${name2}`))
2533
+ (name3) => name3.endsWith(".swift") && (path22 === name3 || path22.endsWith(`/${name3}`))
2536
2534
  );
2537
2535
  if (file === void 0) return null;
2538
2536
  let lines = rewritten.get(file);
@@ -2801,7 +2799,7 @@ function swiftSdkPayloadChecksum(bundle) {
2801
2799
  hash.update(JSON.stringify([relative, "link", import_node_fs2.default.readlinkSync(file)]) + "\n");
2802
2800
  } else if (stat.isDirectory()) {
2803
2801
  hash.update(JSON.stringify([relative, "directory"]) + "\n");
2804
- for (const name2 of import_node_fs2.default.readdirSync(file).sort()) visit(import_node_path3.default.join(relative, name2));
2802
+ for (const name3 of import_node_fs2.default.readdirSync(file).sort()) visit(import_node_path3.default.join(relative, name3));
2805
2803
  } else if (stat.isFile()) {
2806
2804
  const stamp = [stat.dev, stat.ino, stat.size, stat.mtimeNs, stat.ctimeNs].join(":");
2807
2805
  let cached2 = sdkFileHashes.get(file);
@@ -3029,12 +3027,12 @@ function swiftCompilerInstall(release) {
3029
3027
  };
3030
3028
  }
3031
3029
  const platform = `debian12${process.arch === "arm64" ? "-aarch64" : ""}`;
3032
- const name2 = `${release}-${platform}`;
3030
+ const name3 = `${release}-${platform}`;
3033
3031
  return {
3034
3032
  note: " (Debian 12 shown; other distributions: https://www.swift.org/install/linux/)",
3035
3033
  commands: [
3036
- `curl -fsSL ${downloads}/${platform}/${release}/${name2}.tar.gz | tar -xz -C /opt`,
3037
- `export PATH=/opt/${name2}/usr/bin:$PATH`
3034
+ `curl -fsSL ${downloads}/${platform}/${release}/${name3}.tar.gz | tar -xz -C /opt`,
3035
+ `export PATH=/opt/${name3}/usr/bin:$PATH`
3038
3036
  ]
3039
3037
  };
3040
3038
  }
@@ -3099,7 +3097,7 @@ async function load(toolchainBin, sdk) {
3099
3097
  icuSegment(archiveMember((0, import_node_fs3.readFileSync)(import_node_path4.default.join(resources, ARCHIVE)), MEMBER))
3100
3098
  );
3101
3099
  }
3102
- function archiveMember(archive, name2) {
3100
+ function archiveMember(archive, name3) {
3103
3101
  if (archive.toString("latin1", 0, 8) !== "!<arch>\n")
3104
3102
  throw new Error("swift-icu: not an ar archive");
3105
3103
  let names = "";
@@ -3109,10 +3107,10 @@ function archiveMember(archive, name2) {
3109
3107
  const body = archive.subarray(at + 60, at + 60 + size);
3110
3108
  if (raw2 === "//") names = body.toString("latin1");
3111
3109
  const member = /^\/\d+$/.test(raw2) ? names.slice(Number(raw2.slice(1)), names.indexOf("/\n", Number(raw2.slice(1)))) : raw2.replace(/\/$/, "");
3112
- if (member === name2) return body;
3110
+ if (member === name3) return body;
3113
3111
  at += 60 + size + size % 2;
3114
3112
  }
3115
- throw new Error(`swift-icu: ${name2} is not in the sdk's icu archive`);
3113
+ throw new Error(`swift-icu: ${name3} is not in the sdk's icu archive`);
3116
3114
  }
3117
3115
  function icuSegment(object2) {
3118
3116
  let at = 8;
@@ -3261,8 +3259,8 @@ var SWIFT_NATIVE_SOURCE_EXTENSIONS = [
3261
3259
  ".inl",
3262
3260
  ".modulemap"
3263
3261
  ];
3264
- function swiftTargetModuleName(name2) {
3265
- return name2.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
3262
+ function swiftTargetModuleName(name3) {
3263
+ return name3.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
3266
3264
  }
3267
3265
  function swiftPackageIdentity(url) {
3268
3266
  return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
@@ -3277,16 +3275,16 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
3277
3275
  ]);
3278
3276
  const targetNames = new Set(
3279
3277
  declarations.flatMap(({ flat }) => {
3280
- const name2 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
3281
- return name2 ? [name2] : [];
3278
+ const name3 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
3279
+ return name3 ? [name3] : [];
3282
3280
  })
3283
3281
  );
3284
3282
  for (const { kind, flat, call } of declarations) {
3285
3283
  const executable = kind === "executableTarget";
3286
- const name2 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
3287
- if (!name2) continue;
3284
+ const name3 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
3285
+ if (!name3) continue;
3288
3286
  const rawPath = /\bpath\s*:\s*"([^"]*)"/.exec(flat)?.[1];
3289
- const targetPath = rawPath == null || rawPath === "" ? `Sources/${name2}` : rawPath.replace(/^\.\//, "").replace(/\/+$/, "");
3287
+ const targetPath = rawPath == null || rawPath === "" ? `Sources/${name3}` : rawPath.replace(/^\.\//, "").replace(/\/+$/, "");
3290
3288
  const languageMode = Number(
3291
3289
  /\.swiftLanguageMode\(\s*\.v(\d+)\s*\)/.exec(call)?.[1] ?? "5"
3292
3290
  );
@@ -3326,12 +3324,12 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
3326
3324
  dependencyNames.add(dependencyName);
3327
3325
  }
3328
3326
  }
3329
- const dependencies = [...dependencyNames].map((name3) => ({
3327
+ const dependencies = [...dependencyNames].map((name4) => ({
3330
3328
  kind: "target",
3331
- name: name3
3329
+ name: name4
3332
3330
  }));
3333
3331
  targets.push({
3334
- name: name2,
3332
+ name: name3,
3335
3333
  path: targetPath,
3336
3334
  executable,
3337
3335
  ...kind === "systemLibrary" ? { systemLibrary: true } : {},
@@ -3379,8 +3377,8 @@ function swiftResourceBundleForFile(bundles, file) {
3379
3377
  return owner;
3380
3378
  }
3381
3379
  function swiftResourceBundleInfoPlist(bundle) {
3382
- const name2 = bundle.path.split("/").pop().replace(/\.(bundle|framework)$/, "");
3383
- const escaped = name2.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
3380
+ const name3 = bundle.path.split("/").pop().replace(/\.(bundle|framework)$/, "");
3381
+ const escaped = name3.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
3384
3382
  return `<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>CFBundleName</key><string>${escaped}</string><key>CFBundlePackageType</key><string>${bundle.path.endsWith(".framework") ? "FMWK" : "BNDL"}</string></dict></plist>`;
3385
3383
  }
3386
3384
  function swiftMetalSourceFiles(files2) {
@@ -3411,39 +3409,57 @@ var import_node_child_process5 = require("node:child_process");
3411
3409
  var import_node_crypto3 = require("node:crypto");
3412
3410
  var import_node_fs4 = require("node:fs");
3413
3411
  var import_node_path5 = __toESM(require("node:path"), 1);
3412
+ init_process_group();
3414
3413
  var POLL_MS = 250;
3415
- function processStart(pid) {
3416
- try {
3417
- return (0, import_node_child_process5.execFileSync)("ps", ["-o", "lstart=", "-p", String(pid)], {
3418
- encoding: "utf8",
3419
- stdio: ["ignore", "pipe", "ignore"]
3420
- }).trim() || null;
3421
- } catch {
3422
- return null;
3423
- }
3414
+ var START_TOLERANCE_MS = 2e3;
3415
+ function errorCode(error) {
3416
+ return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : void 0;
3424
3417
  }
3425
- function parseHolder(text4) {
3426
- try {
3427
- const value = JSON.parse(text4);
3428
- if (value && typeof value === "object" && "pid" in value && typeof value.pid === "number" && "start" in value && (typeof value.start === "string" || value.start === null))
3429
- return { pid: value.pid, start: value.start };
3430
- } catch {
3431
- }
3432
- return null;
3418
+ function parseStart(text4) {
3419
+ const start = Date.parse(`${text4} UTC`);
3420
+ if (Number.isNaN(start)) throw new Error(`unreadable process start time "${text4}"`);
3421
+ return start;
3433
3422
  }
3434
- function readLock(lock) {
3435
- try {
3436
- return (0, import_node_fs4.readFileSync)(lock, "utf8");
3437
- } catch (error) {
3438
- if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
3439
- throw error;
3423
+ function processTable() {
3424
+ const result = (0, import_node_child_process5.spawnSync)("ps", ["-A", "-o", "pid=,pgid=,stat=,lstart="], {
3425
+ encoding: "utf8",
3426
+ env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
3427
+ stdio: ["ignore", "pipe", "pipe"],
3428
+ timeout: 1e4,
3429
+ killSignal: "SIGKILL"
3430
+ });
3431
+ if (result.error || result.status !== 0) {
3432
+ throw new Error(
3433
+ `swift root lock cannot read the process table: ${result.error?.message || result.stderr.trim() || `ps exited ${result.status}`}`
3434
+ );
3440
3435
  }
3436
+ return result.stdout.split("\n").filter((line) => line.trim()).map((line) => {
3437
+ const match = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+(.+?)\s*$/.exec(line);
3438
+ if (!match)
3439
+ throw new Error(`swift root lock cannot parse a process table row: ${line}`);
3440
+ return {
3441
+ pid: Number(match[1]),
3442
+ pgid: Number(match[2]),
3443
+ zombie: match[3].startsWith("Z"),
3444
+ start: parseStart(match[4])
3445
+ };
3446
+ });
3447
+ }
3448
+ function sameProcess(row, identity) {
3449
+ return row.pid === identity.pid && Math.abs(row.start - identity.start) <= START_TOLERANCE_MS;
3450
+ }
3451
+ function ownIdentity(pid) {
3452
+ const row = processTable().find(
3453
+ (candidate) => candidate.pid === pid && !candidate.zombie
3454
+ );
3455
+ if (!row) throw new Error(`swift root lock cannot find process ${pid}`);
3456
+ return { pid, start: row.start };
3441
3457
  }
3442
- function holderAlive(text4) {
3443
- const holder = parseHolder(text4);
3444
- if (!holder) return false;
3445
- const start = processStart(holder.pid);
3446
- return start !== null && start === holder.start;
3458
+ function parseIdentity(text4) {
3459
+ const value = JSON.parse(text4);
3460
+ if (value && typeof value === "object" && "pid" in value && typeof value.pid === "number" && "start" in value && typeof value.start === "number")
3461
+ return { pid: value.pid, start: value.start };
3462
+ throw new Error(`swift root lock record is not a process identity: ${text4}`);
3447
3463
  }
3448
3464
  function pause(ms, signal) {
3449
3465
  return new Promise((resolve3) => {
@@ -3456,64 +3472,127 @@ function pause(ms, signal) {
3456
3472
  signal?.addEventListener("abort", done, { once: true });
3457
3473
  });
3458
3474
  }
3475
+ var name = (number, suffix) => `${String(number).padStart(12, "0")}.${suffix}`;
3476
+ function generationNumbers(directory) {
3477
+ const numbers = /* @__PURE__ */ new Set();
3478
+ for (const entry of (0, import_node_fs4.readdirSync)(directory)) {
3479
+ const match = /^(\d{12})\./.exec(entry);
3480
+ if (match) numbers.add(Number(match[1]));
3481
+ }
3482
+ return [...numbers].sort((a, b) => a - b);
3483
+ }
3484
+ function readGeneration(directory, number) {
3485
+ let owner;
3486
+ try {
3487
+ owner = (0, import_node_fs4.readFileSync)(import_node_path5.default.join(directory, name(number, "owner")), "utf8");
3488
+ } catch (error) {
3489
+ if (errorCode(error) === "ENOENT") return null;
3490
+ throw error;
3491
+ }
3492
+ return {
3493
+ number,
3494
+ holder: parseIdentity(owner),
3495
+ released: (0, import_node_fs4.readdirSync)(directory).includes(name(number, "released"))
3496
+ };
3497
+ }
3498
+ function readChildren(directory, number) {
3499
+ const prefix = name(number, "child.");
3500
+ return (0, import_node_fs4.readdirSync)(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity((0, import_node_fs4.readFileSync)(import_node_path5.default.join(directory, entry), "utf8")));
3501
+ }
3502
+ function groupAlive(table, leader) {
3503
+ const row = table.find((candidate) => candidate.pid === leader.pid);
3504
+ if (row && !sameProcess(row, leader)) return false;
3505
+ return table.some((candidate) => candidate.pgid === leader.pid && !candidate.zombie);
3506
+ }
3459
3507
  async function withSwiftRootLock(root, work, signal) {
3460
- const directory = import_node_path5.default.join(rnxHomeDir(), "cache", "swift-root-locks");
3461
- (0, import_node_fs4.mkdirSync)(directory, { recursive: true });
3462
- const lock = import_node_path5.default.join(
3463
- directory,
3464
- `${(0, import_node_crypto3.createHash)("sha256").update(root).digest("hex").slice(0, 32)}.lock`
3508
+ const directory = import_node_path5.default.join(
3509
+ rnxHomeDir(),
3510
+ "cache",
3511
+ "swift-root-locks",
3512
+ (0, import_node_crypto3.createHash)("sha256").update(root).digest("hex").slice(0, 32)
3465
3513
  );
3514
+ (0, import_node_fs4.mkdirSync)(directory, { recursive: true });
3466
3515
  const token = (0, import_node_crypto3.randomUUID)();
3467
- const owner = JSON.stringify({
3468
- pid: process.pid,
3469
- start: processStart(process.pid),
3470
- token
3471
- });
3472
- const pending = `${lock}.${token}`;
3473
- (0, import_node_fs4.writeFileSync)(pending, owner);
3474
- try {
3475
- for (; ; ) {
3476
- signal?.throwIfAborted();
3477
- try {
3478
- (0, import_node_fs4.linkSync)(pending, lock);
3479
- break;
3480
- } catch (error) {
3481
- if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
3482
- throw error;
3516
+ const owner = JSON.stringify(ownIdentity(process.pid));
3517
+ const pending = import_node_path5.default.join(directory, `pending.${token}`);
3518
+ let held = 0;
3519
+ for (; ; ) {
3520
+ signal?.throwIfAborted();
3521
+ const newest = generationNumbers(directory).at(-1) ?? 0;
3522
+ const current = newest > 0 ? readGeneration(directory, newest) : null;
3523
+ if (newest > 0 && !current) continue;
3524
+ if (current && !current.released) {
3525
+ const table = processTable();
3526
+ if (table.some((row) => !row.zombie && sameProcess(row, current.holder))) {
3527
+ await pause(POLL_MS, signal);
3528
+ continue;
3483
3529
  }
3484
- const held = readLock(lock);
3485
- if (held === null) continue;
3486
- if (holderAlive(held)) {
3530
+ const children2 = readChildren(directory, newest);
3531
+ if (children2.some((child) => groupAlive(table, child))) {
3487
3532
  await pause(POLL_MS, signal);
3488
3533
  continue;
3489
3534
  }
3490
- const dead = `${lock}.dead-${token}`;
3491
- try {
3492
- (0, import_node_fs4.renameSync)(lock, dead);
3493
- } catch (error) {
3494
- if (error instanceof Error && "code" in error && error.code === "ENOENT") continue;
3495
- throw error;
3535
+ }
3536
+ (0, import_node_fs4.writeFileSync)(pending, owner);
3537
+ try {
3538
+ (0, import_node_fs4.linkSync)(pending, import_node_path5.default.join(directory, name(newest + 1, "owner")));
3539
+ } catch (error) {
3540
+ if (errorCode(error) === "EEXIST") continue;
3541
+ throw error;
3542
+ } finally {
3543
+ (0, import_node_fs4.rmSync)(pending, { force: true });
3544
+ }
3545
+ const numbers = generationNumbers(directory);
3546
+ if (numbers.at(-1) !== newest + 1) {
3547
+ (0, import_node_fs4.rmSync)(import_node_path5.default.join(directory, name(newest + 1, "owner")), { force: true });
3548
+ continue;
3549
+ }
3550
+ held = newest + 1;
3551
+ for (const number of numbers)
3552
+ if (number < held) {
3553
+ for (const entry of (0, import_node_fs4.readdirSync)(directory))
3554
+ if (entry.startsWith(name(number, "")))
3555
+ (0, import_node_fs4.rmSync)(import_node_path5.default.join(directory, entry), { force: true });
3496
3556
  }
3557
+ break;
3558
+ }
3559
+ const children = [];
3560
+ const lease = {
3561
+ spawn(command, args, options) {
3562
+ const child = (0, import_node_child_process5.spawn)(
3563
+ "/bin/sh",
3564
+ ["-c", 'IFS= read -r go || exit 1; exec "$@" </dev/null', "sh", command, ...args],
3565
+ { ...options, detached: true, stdio: ["pipe", "pipe", "pipe"] }
3566
+ );
3567
+ child.stdin.on("error", () => {
3568
+ });
3569
+ children.push(child);
3497
3570
  try {
3498
- if (readLock(dead) !== held) {
3499
- try {
3500
- (0, import_node_fs4.linkSync)(dead, lock);
3501
- } catch (error) {
3502
- if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
3503
- throw error;
3504
- }
3571
+ if (child.pid === void 0) {
3572
+ child.once("error", () => {
3573
+ });
3574
+ throw new Error(`could not start ${command}`);
3505
3575
  }
3506
- } finally {
3507
- (0, import_node_fs4.rmSync)(dead, { force: true });
3576
+ const childPending = `${pending}.child.${child.pid}`;
3577
+ try {
3578
+ (0, import_node_fs4.writeFileSync)(childPending, JSON.stringify(ownIdentity(child.pid)));
3579
+ (0, import_node_fs4.linkSync)(childPending, import_node_path5.default.join(directory, name(held, `child.${child.pid}`)));
3580
+ } finally {
3581
+ (0, import_node_fs4.rmSync)(childPending, { force: true });
3582
+ }
3583
+ } catch (error) {
3584
+ child.stdin.destroy();
3585
+ throw error;
3508
3586
  }
3587
+ child.stdin.end("go\n");
3588
+ return child;
3509
3589
  }
3510
- } finally {
3511
- (0, import_node_fs4.rmSync)(pending, { force: true });
3512
- }
3590
+ };
3513
3591
  try {
3514
- return await work();
3592
+ return await work(lease);
3515
3593
  } finally {
3516
- if (readLock(lock) === owner) (0, import_node_fs4.rmSync)(lock, { force: true });
3594
+ await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
3595
+ (0, import_node_fs4.writeFileSync)(import_node_path5.default.join(directory, name(held, "released")), "");
3517
3596
  }
3518
3597
  }
3519
3598
 
@@ -3521,12 +3600,13 @@ async function withSwiftRootLock(root, work, signal) {
3521
3600
  async function runCompiler(command, args, options, stream = false, quiet) {
3522
3601
  const { signal } = options;
3523
3602
  signal?.throwIfAborted();
3524
- const child = (0, import_node_child_process6.spawn)(command, args, {
3603
+ const launch = {
3525
3604
  cwd: options.cwd,
3526
3605
  env: swiftEnvironment(options.env),
3527
3606
  detached: true,
3528
3607
  stdio: ["ignore", "pipe", "pipe"]
3529
- });
3608
+ };
3609
+ const child = options.lease ? options.lease.spawn(command, args, launch) : (0, import_node_child_process6.spawn)(command, args, launch);
3530
3610
  let stopping;
3531
3611
  try {
3532
3612
  await new Promise((resolve3, reject) => {
@@ -3540,20 +3620,20 @@ async function runCompiler(command, args, options, stream = false, quiet) {
3540
3620
  void stopping.catch(() => {
3541
3621
  });
3542
3622
  };
3543
- for (const name2 of ["stdout", "stderr"]) {
3544
- child[name2].on("data", (bytes) => {
3545
- if (stream === true) process[name2].write(bytes);
3623
+ for (const name3 of ["stdout", "stderr"]) {
3624
+ child[name3].on("data", (bytes) => {
3625
+ if (stream === true) process[name3].write(bytes);
3546
3626
  else if (stream) {
3547
- const lines = (partial[name2] + bytes.toString()).split("\n");
3548
- partial[name2] = lines.pop();
3627
+ const lines = (partial[name3] + bytes.toString()).split("\n");
3628
+ partial[name3] = lines.pop();
3549
3629
  for (const line of lines)
3550
- if (stream.test(line)) process[name2].write(`${line}
3630
+ if (stream.test(line)) process[name3].write(`${line}
3551
3631
  `);
3552
3632
  }
3553
- sizes[name2] += bytes.length;
3554
- if (sizes[name2] <= (options.maxBuffer ?? 1024 * 1024)) chunks[name2].push(bytes);
3633
+ sizes[name3] += bytes.length;
3634
+ if (sizes[name3] <= (options.maxBuffer ?? 1024 * 1024)) chunks[name3].push(bytes);
3555
3635
  else {
3556
- failure2 = new Error(`Swift compiler ${name2} exceeded its output limit`);
3636
+ failure2 = new Error(`Swift compiler ${name3} exceeded its output limit`);
3557
3637
  stop();
3558
3638
  }
3559
3639
  });
@@ -3581,9 +3661,9 @@ async function runCompiler(command, args, options, stream = false, quiet) {
3581
3661
  );
3582
3662
  else {
3583
3663
  if (quiet) {
3584
- for (const name2 of ["stdout", "stderr"])
3585
- for (const line of Buffer.concat(chunks[name2]).toString().split("\n"))
3586
- if (line && !quiet.test(line)) process[name2].write(`${line}
3664
+ for (const name3 of ["stdout", "stderr"])
3665
+ for (const line of Buffer.concat(chunks[name3]).toString().split("\n"))
3666
+ if (line && !quiet.test(line)) process[name3].write(`${line}
3587
3667
  `);
3588
3668
  }
3589
3669
  resolve3();
@@ -3824,11 +3904,11 @@ function swiftCondition(text4, available) {
3824
3904
  if (token === "false") return false;
3825
3905
  const call = /^(\w+)\s*\(\s*([^,()]*?)\s*(?:,[^()]*)?\)$/.exec(token ?? "");
3826
3906
  if (!call) return void 0;
3827
- const [, name2, argument] = call;
3828
- if (name2 === "os") return argument === "iOS" || argument === "WASI";
3829
- if (name2 === "canImport") return available.has(argument);
3830
- if (name2 === "targetEnvironment") return false;
3831
- if (name2 === "arch") return argument === "wasm32";
3907
+ const [, name3, argument] = call;
3908
+ if (name3 === "os") return argument === "iOS" || argument === "WASI";
3909
+ if (name3 === "canImport") return available.has(argument);
3910
+ if (name3 === "targetEnvironment") return false;
3911
+ if (name3 === "arch") return argument === "wasm32";
3832
3912
  return void 0;
3833
3913
  };
3834
3914
  const both = () => {
@@ -3872,8 +3952,8 @@ function swiftImportNames(contents, available) {
3872
3952
  continue;
3873
3953
  }
3874
3954
  if (available && frames.some((frame) => frame.active !== true)) continue;
3875
- const name2 = SWIFT_IMPORT.exec(line)?.[1];
3876
- if (name2) names.push(name2);
3955
+ const name3 = SWIFT_IMPORT.exec(line)?.[1];
3956
+ if (name3) names.push(name3);
3877
3957
  }
3878
3958
  return names;
3879
3959
  }
@@ -3903,9 +3983,9 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
3903
3983
  ],
3904
3984
  { encoding: "utf8", env: swiftEnvironment(), stdio: ["ignore", "pipe", "pipe"] }
3905
3985
  );
3906
- const field = (name2) => {
3907
- const value = new RegExp(`^${name2}:\\s*(.+)$`, "m").exec(configuration)?.[1]?.trim();
3908
- if (!value) throw new Error(`swift sdk ${sdk} reports no ${name2}`);
3986
+ const field = (name3) => {
3987
+ const value = new RegExp(`^${name3}:\\s*(.+)$`, "m").exec(configuration)?.[1]?.trim();
3988
+ if (!value) throw new Error(`swift sdk ${sdk} reports no ${name3}`);
3909
3989
  return value;
3910
3990
  };
3911
3991
  const paths = {
@@ -3940,9 +4020,9 @@ function missingSwiftModules(files2, available) {
3940
4020
  const missing = /* @__PURE__ */ new Map();
3941
4021
  for (const [file, contents] of Object.entries(files2)) {
3942
4022
  if (!file.endsWith(".swift") || file === "Package.swift") continue;
3943
- for (const name2 of new Set(swiftImportNames(contents, available))) {
3944
- if (available.has(name2)) continue;
3945
- missing.set(name2, [...missing.get(name2) ?? [], file]);
4023
+ for (const name3 of new Set(swiftImportNames(contents, available))) {
4024
+ if (available.has(name3)) continue;
4025
+ missing.set(name3, [...missing.get(name3) ?? [], file]);
3946
4026
  }
3947
4027
  }
3948
4028
  return new Map([...missing].sort(([left], [right]) => left.localeCompare(right)));
@@ -3963,8 +4043,8 @@ function swiftTargetDependencies(files2, targets) {
3963
4043
  (candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
3964
4044
  ))
3965
4045
  continue;
3966
- for (const name2 of swiftImportNames(contents)) {
3967
- if (names.has(name2) && name2 !== target.name) deps.add(name2);
4046
+ for (const name3 of swiftImportNames(contents)) {
4047
+ if (names.has(name3) && name3 !== target.name) deps.add(name3);
3968
4048
  }
3969
4049
  }
3970
4050
  siblings.set(target.name, [...deps].sort());
@@ -3994,7 +4074,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
3994
4074
  `;
3995
4075
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
3996
4076
  var MULTI_MANIFEST_VERSION = 39;
3997
- var compilerSourceDigest = true ? "ee2738333bb81c79211d5bee8a503c539cf65f25c95fb024c45b840450b5359e" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
4077
+ var compilerSourceDigest = true ? "c2ab17198fbe6328c75dc09bbe160fe6b0fd74d4b84a08e9f8dfcd2fcf4ca1f0" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
3998
4078
  function swiftArtifactHash(input, release, moduleRoot) {
3999
4079
  const hash = (0, import_node_crypto4.createHash)("sha256");
4000
4080
  hash.update(`swift-compile
@@ -4020,10 +4100,10 @@ ${release}
4020
4100
  (0, import_node_crypto4.createHash)("sha256").update(input.resources?.[base] ?? "").digest()
4021
4101
  );
4022
4102
  }
4023
- for (const name2 of Object.keys(input.images ?? {}).sort()) {
4024
- const image = input.images?.[name2];
4103
+ for (const name3 of Object.keys(input.images ?? {}).sort()) {
4104
+ const image = input.images?.[name3];
4025
4105
  if (!image) continue;
4026
- hash.update((0, import_node_crypto4.createHash)("sha256").update(name2).digest());
4106
+ hash.update((0, import_node_crypto4.createHash)("sha256").update(name3).digest());
4027
4107
  hash.update((0, import_node_crypto4.createHash)("sha256").update(image.file).digest());
4028
4108
  hash.update((0, import_node_crypto4.createHash)("sha256").update(image.data).digest());
4029
4109
  }
@@ -4062,17 +4142,17 @@ ${target}
4062
4142
  function emitSwiftPackageManifest(args) {
4063
4143
  const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
4064
4144
  const reachedFrameworks = /* @__PURE__ */ new Set();
4065
- const reach = (name2) => {
4066
- if (reachedFrameworks.has(name2)) return;
4067
- reachedFrameworks.add(name2);
4068
- for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[name2] ?? [])
4145
+ const reach = (name3) => {
4146
+ if (reachedFrameworks.has(name3)) return;
4147
+ reachedFrameworks.add(name3);
4148
+ for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[name3] ?? [])
4069
4149
  reach(dependency);
4070
4150
  };
4071
- for (const name2 of [...siblings.values()].flat())
4072
- if (OPTIONAL_FRAMEWORKS.has(name2) && !targets.some((target) => target.name === name2))
4073
- reach(name2);
4151
+ for (const name3 of [...siblings.values()].flat())
4152
+ if (OPTIONAL_FRAMEWORKS.has(name3) && !targets.some((target) => target.name === name3))
4153
+ reach(name3);
4074
4154
  if (spriteKit) {
4075
- for (const name2 of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name2);
4155
+ for (const name3 of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name3);
4076
4156
  }
4077
4157
  const distributionLink = args.distributionLink;
4078
4158
  if (distribution && !distributionLink)
@@ -4082,7 +4162,7 @@ function emitSwiftPackageManifest(args) {
4082
4162
  if (distribution && distributionLink) {
4083
4163
  const objects = distribution.objects.filter(
4084
4164
  (object2) => [...OPTIONAL_FRAMEWORKS, "SpriteKit", "PeachBox2D"].every(
4085
- (name2) => !object2.startsWith(`lib/${name2}-`) || reachedFrameworks.has(name2)
4165
+ (name3) => !object2.startsWith(`lib/${name3}-`) || reachedFrameworks.has(name3)
4086
4166
  )
4087
4167
  );
4088
4168
  distributionLink.files.set(
@@ -4111,11 +4191,11 @@ function emitSwiftPackageManifest(args) {
4111
4191
  return ` .systemLibrary(name: ${JSON.stringify(target.name)}, path: ${JSON.stringify(target.path)}),`;
4112
4192
  const isolation = target.mainActorIsolation ? " .defaultIsolation(MainActor.self)," : "";
4113
4193
  const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
4114
- const defines = (target.defines ?? []).map((name2) => ` .define(${JSON.stringify(name2)}),`).join("");
4194
+ const defines = (target.defines ?? []).map((name3) => ` .define(${JSON.stringify(name3)}),`).join("");
4115
4195
  const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path6.default.join(moduleRoot, "modules"))}` : "";
4116
4196
  const native = args.native?.get(target.name);
4117
- const nativeImports = (siblings.get(target.name) ?? []).filter((name2) => args.native?.has(name2)).map(
4118
- (name2) => `, "-Xfrontend", "-import-module", "-Xfrontend", ${JSON.stringify(swiftTargetModuleName(name2))}`
4197
+ const nativeImports = (siblings.get(target.name) ?? []).filter((name3) => args.native?.has(name3)).map(
4198
+ (name3) => `, "-Xfrontend", "-import-module", "-Xfrontend", ${JSON.stringify(swiftTargetModuleName(name3))}`
4119
4199
  ).join("");
4120
4200
  const header = args.headerDirectory && [...args.native?.values() ?? []].some(
4121
4201
  (value) => value.late?.producers.includes(target.name)
@@ -4137,7 +4217,7 @@ function emitSwiftPackageManifest(args) {
4137
4217
  const library = distribution && distributionLink ? ["-Xclang-linker", `--config=${distributionLink.path}`, ...distribution.link].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
4138
4218
  const kind = target.executable ? ".executableTarget" : ".target";
4139
4219
  const linkedLibraries = (target.linkedLibraries ?? []).map(
4140
- (name2) => `.linkedLibrary(${JSON.stringify(name2)})`
4220
+ (name3) => `.linkedLibrary(${JSON.stringify(name3)})`
4141
4221
  );
4142
4222
  const librarySettings = [
4143
4223
  ...linkedLibraries,
@@ -4176,9 +4256,9 @@ function emitSwiftPackageManifest(args) {
4176
4256
  " targets: [",
4177
4257
  ...targets.map(stanza),
4178
4258
  ...[...args.native?.entries() ?? []].flatMap(
4179
- ([name2, native]) => native.late ? [
4259
+ ([name3, native]) => native.late ? [
4180
4260
  ` .target(name: ${JSON.stringify(native.late.name)},`,
4181
- ` dependencies: ${JSON.stringify([name2, ...native.late.producers])},`,
4261
+ ` dependencies: ${JSON.stringify([name3, ...native.late.producers])},`,
4182
4262
  ` path: ${JSON.stringify(native.path)},`,
4183
4263
  ` sources: ${JSON.stringify(native.lateSources)},`,
4184
4264
  ` publicHeadersPath: "include",`,
@@ -4431,7 +4511,7 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
4431
4511
  if (top?.kind !== "extension") continue;
4432
4512
  const func = OVERRIDE_FUNC.exec(rest);
4433
4513
  if (func) {
4434
- const name2 = func[2];
4514
+ const name3 = func[2];
4435
4515
  const open = at + func[0].length - 1;
4436
4516
  let depth = 0;
4437
4517
  let close = open;
@@ -4444,12 +4524,12 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
4444
4524
  const clause = source.slice(close + 1, body).trim();
4445
4525
  const args = forwardedArguments(source.slice(open + 1, close));
4446
4526
  if (args === null) continue;
4447
- const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name2}(${args})`;
4448
- const signature = `func ${name2}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
4449
- const nameAt = at + rest.indexOf(name2, rest.indexOf("func", "override".length + func[1].length) + 4);
4527
+ const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name3}(${args})`;
4528
+ const signature = `func ${name3}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
4529
+ const nameAt = at + rest.indexOf(name3, rest.indexOf("func", "override".length + func[1].length) + 4);
4450
4530
  lifted.push({
4451
4531
  type: top.name,
4452
- member: name2,
4532
+ member: name3,
4453
4533
  at,
4454
4534
  modifiers,
4455
4535
  access,
@@ -4467,16 +4547,16 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
4467
4547
  if (property) {
4468
4548
  const open = at + property[0].length - 1;
4469
4549
  if (/\b(?:set|willSet|didSet)\b/.test(source.slice(open, closing(open)))) continue;
4470
- const name2 = property[2];
4471
- const nameAt = at + rest.indexOf(name2, rest.indexOf("var"));
4550
+ const name3 = property[2];
4551
+ const nameAt = at + rest.indexOf(name3, rest.indexOf("var"));
4472
4552
  lifted.push({
4473
4553
  type: top.name,
4474
- member: name2,
4554
+ member: name3,
4475
4555
  at,
4476
4556
  modifiers,
4477
4557
  access,
4478
- decl: `var ${name2}: ${property[3].trim()}`,
4479
- forward: `{ __peach_ext_${name2} };`,
4558
+ decl: `var ${name3}: ${property[3].trim()}`,
4559
+ forward: `{ __peach_ext_${name3} };`,
4480
4560
  nameAt,
4481
4561
  edits: [
4482
4562
  [at, "override".length, " ".repeat("override".length)],
@@ -4614,15 +4694,15 @@ function objcRootedClasses(sources) {
4614
4694
  ))
4615
4695
  bases.set(match[1], match[2]);
4616
4696
  const rooted = /* @__PURE__ */ new Set();
4617
- for (const name2 of bases.keys()) {
4618
- const seen = /* @__PURE__ */ new Set([name2]);
4619
- let base = bases.get(name2);
4697
+ for (const name3 of bases.keys()) {
4698
+ const seen = /* @__PURE__ */ new Set([name3]);
4699
+ let base = bases.get(name3);
4620
4700
  while (bases.has(base) && !seen.has(base)) {
4621
4701
  seen.add(base);
4622
4702
  base = bases.get(base);
4623
4703
  }
4624
4704
  if (!bases.has(base) && APPLE_CLASS.test(base) && !APPLE_PROTOCOL.test(base) && !(base in SDK_OBJC_OPTIONAL))
4625
- rooted.add(name2);
4705
+ rooted.add(name3);
4626
4706
  }
4627
4707
  return rooted;
4628
4708
  }
@@ -4765,8 +4845,8 @@ function inheritedTypes(sources) {
4765
4845
  if (colon === -1) continue;
4766
4846
  const inherited = parents.get(owner[1]) ?? /* @__PURE__ */ new Set();
4767
4847
  for (const type of splitTopLevel(header.slice(colon + 1).split(/\bwhere\b/)[0])) {
4768
- const name2 = /^\s*(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/.exec(type)?.[1];
4769
- if (name2 && !type.includes("<")) inherited.add(name2);
4848
+ const name3 = /^\s*(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/.exec(type)?.[1];
4849
+ if (name3 && !type.includes("<")) inherited.add(name3);
4770
4850
  }
4771
4851
  parents.set(owner[1], inherited);
4772
4852
  }
@@ -4845,20 +4925,20 @@ var DECLARATION_MODIFIERS = /* @__PURE__ */ new Set([
4845
4925
  "unowned"
4846
4926
  ]);
4847
4927
  function objcSelectorName(base, labels, isAsync, isThrowing) {
4848
- let name2 = base;
4928
+ let name3 = base;
4849
4929
  labels.forEach((label, index) => {
4850
- if (index > 0) name2 += `${label === "_" ? "" : label}:`;
4930
+ if (index > 0) name3 += `${label === "_" ? "" : label}:`;
4851
4931
  else {
4852
4932
  if (label !== "_") {
4853
4933
  const firstWord = label[0] + /^[^A-Z_]*/.exec(label.slice(1))[0];
4854
- name2 += `${OBJC_PREPOSITIONS.has(firstWord) ? "" : "With"}${label[0].toUpperCase()}${label.slice(1)}`;
4934
+ name3 += `${OBJC_PREPOSITIONS.has(firstWord) ? "" : "With"}${label[0].toUpperCase()}${label.slice(1)}`;
4855
4935
  }
4856
- name2 += ":";
4936
+ name3 += ":";
4857
4937
  }
4858
4938
  });
4859
- if (isAsync) name2 += labels.length ? "completionHandler:" : "WithCompletionHandler:";
4860
- else if (isThrowing) name2 += labels.length ? "error:" : "AndReturnError:";
4861
- return name2;
4939
+ if (isAsync) name3 += labels.length ? "completionHandler:" : "WithCompletionHandler:";
4940
+ else if (isThrowing) name3 += labels.length ? "error:" : "AndReturnError:";
4941
+ return name3;
4862
4942
  }
4863
4943
  function declarationStart(code, at, floor) {
4864
4944
  let start = at;
@@ -4920,22 +5000,22 @@ function objcOptionalProtocols(source) {
4920
5000
  ...(attributes.match(/@available\s*\((?:[^()"]|"(?:[^"\\]|\\.)*")*\)/g) ?? []).map((attribute) => attribute.replace(/\s*\n\s*/g, " ")),
4921
5001
  access ?? ""
4922
5002
  ].filter((word) => word !== "").join(" ");
4923
- const name2 = member[2];
5003
+ const name3 = member[2];
4924
5004
  const after = at + member[0].length;
4925
5005
  if (member[1] === "var") {
4926
5006
  const typed = /^\s*:\s*([^{\n]+?)\s*\{[^}]*\}/.exec(code.slice(after));
4927
5007
  if (!typed) continue;
4928
- const selector2 = explicit ?? name2;
5008
+ const selector2 = explicit ?? name3;
4929
5009
  const typeMember2 = /\bstatic\b/.test(code.slice(start, at));
4930
5010
  members.push({
4931
- name: name2,
5011
+ name: name3,
4932
5012
  labels: null,
4933
5013
  selector: selector2,
4934
5014
  start,
4935
5015
  end: after + typed[0].length,
4936
5016
  result: objcTypeName(typed[1]),
4937
5017
  typeMember: typeMember2,
4938
- helper: `${head} ${typeMember2 ? "static " : ""}var ${name2}: ${optionalResult(typed[1])} { _objcOptionalSend(self, Selector(${JSON.stringify(selector2)}), [], default: nil) }`
5018
+ helper: `${head} ${typeMember2 ? "static " : ""}var ${name3}: ${optionalResult(typed[1])} { _objcOptionalSend(self, Selector(${JSON.stringify(selector2)}), [], default: nil) }`
4939
5019
  });
4940
5020
  continue;
4941
5021
  }
@@ -4947,10 +5027,10 @@ function objcOptionalProtocols(source) {
4947
5027
  const parameters = code.slice(paren + 1, shut);
4948
5028
  const names = parameterNames(parameters);
4949
5029
  const labels = names.map((parameter) => parameter.label);
4950
- const selector = explicit ?? objcSelectorName(name2, labels, tail[1] !== void 0, tail[2] !== void 0);
5030
+ const selector = explicit ?? objcSelectorName(name3, labels, tail[1] !== void 0, tail[2] !== void 0);
4951
5031
  const typeMember = /\bstatic\b/.test(code.slice(start, at));
4952
5032
  members.push({
4953
- name: name2,
5033
+ name: name3,
4954
5034
  labels,
4955
5035
  typeMember,
4956
5036
  selector,
@@ -4959,12 +5039,12 @@ function objcOptionalProtocols(source) {
4959
5039
  types: parameterTypes(parameters),
4960
5040
  result: objcTypeName(tail[3]?.trim() ?? "Void"),
4961
5041
  helper: typeMember && (tail[1] !== void 0 || tail[2] !== void 0) ? null : tail[1] !== void 0 ? objcAsyncOptionalHelper(
4962
- `${head} func ${name2}(${parameters.replace(/\s*\n\s*/g, " ")})`,
5042
+ `${head} func ${name3}(${parameters.replace(/\s*\n\s*/g, " ")})`,
4963
5043
  parameters,
4964
5044
  selector,
4965
5045
  tail[3]?.trim() ?? "Void",
4966
5046
  tail[2] !== void 0
4967
- ) : tail[2] !== void 0 ? null : `@discardableResult ${head} ${typeMember ? "static " : ""}func ${name2}(${parameters.replace(/\s*\n\s*/g, " ")}) -> ${optionalResult(tail[3]?.trim() ?? "Void")} { ${escapingSend(parameters, `_objcOptionalSend(self, Selector(${JSON.stringify(selector)}), [${names.map((parameter) => parameter.name).join(", ")}], default: nil)`)} }`
5047
+ ) : tail[2] !== void 0 ? null : `@discardableResult ${head} ${typeMember ? "static " : ""}func ${name3}(${parameters.replace(/\s*\n\s*/g, " ")}) -> ${optionalResult(tail[3]?.trim() ?? "Void")} { ${escapingSend(parameters, `_objcOptionalSend(self, Selector(${JSON.stringify(selector)}), [${names.map((parameter) => parameter.name).join(", ")}], default: nil)`)} }`
4968
5048
  });
4969
5049
  }
4970
5050
  if (members.length) found.push({ name: declared[1], close, members });
@@ -4981,8 +5061,8 @@ function escapingSend(parameters, send, effects = "") {
4981
5061
  if (!named || !type?.startsWith("(")) return body;
4982
5062
  const shut = closingParen(type, 0);
4983
5063
  if (!/^\s*(?:async\b\s*)?(?:throws\b\s*)?->/.test(type.slice(shut + 1))) return body;
4984
- const name2 = named[2] ?? named[1];
4985
- return `${effects}withoutActuallyEscaping(${name2}) { ${name2} in ${body} }`;
5064
+ const name3 = named[2] ?? named[1];
5065
+ return `${effects}withoutActuallyEscaping(${name3}) { ${name3} in ${body} }`;
4986
5066
  }, send);
4987
5067
  }
4988
5068
  function objcAsyncOptionalHelper(declaration, parameters, selector, result, throwing) {
@@ -6432,10 +6512,10 @@ function objcTypeMethods(source, found) {
6432
6512
  function objcIndex(sources) {
6433
6513
  const requirements = /* @__PURE__ */ new Map();
6434
6514
  const callable = /* @__PURE__ */ new Map();
6435
- const callableAs = (name2, member, labels) => {
6436
- const known = callable.get(name2);
6515
+ const callableAs = (name3, member, labels) => {
6516
+ const known = callable.get(name3);
6437
6517
  if (known) known.labels.push(labels);
6438
- else callable.set(name2, { member, labels: [labels] });
6518
+ else callable.set(name3, { member, labels: [labels] });
6439
6519
  };
6440
6520
  const typeMethods = /* @__PURE__ */ new Map();
6441
6521
  const sdkParents = /* @__PURE__ */ new Map();
@@ -6453,9 +6533,9 @@ function objcIndex(sources) {
6453
6533
  requirements.set(
6454
6534
  protocol,
6455
6535
  sdk.requirements.map(([signature, selector, typed, asyncSignature]) => {
6456
- const name2 = signature.slice(0, signature.indexOf("("));
6457
- const labels = signature.slice(name2.length + 1, -1).split(":").slice(0, -1);
6458
- if (sdk.callers) callableAs(name2, `_objcOptional_${name2}`, labels);
6536
+ const name3 = signature.slice(0, signature.indexOf("("));
6537
+ const labels = signature.slice(name3.length + 1, -1).split(":").slice(0, -1);
6538
+ if (sdk.callers) callableAs(name3, `_objcOptional_${name3}`, labels);
6459
6539
  const arrow = typed?.lastIndexOf("->") ?? -1;
6460
6540
  const types = typed?.slice(0, arrow);
6461
6541
  const result = typed?.slice(arrow + 2);
@@ -6466,7 +6546,7 @@ function objcIndex(sources) {
6466
6546
  const values = handler ? splitTopLevel(handler[1]) : [];
6467
6547
  const asyncName = asyncSignature?.slice(0, asyncSignature.indexOf("("));
6468
6548
  return {
6469
- name: name2,
6549
+ name: name3,
6470
6550
  labels,
6471
6551
  selector,
6472
6552
  ...parameters !== void 0 && { types: parameters },
@@ -6492,8 +6572,8 @@ function objcIndex(sources) {
6492
6572
  for (const protocol of objcOptionalProtocols(source)) {
6493
6573
  requirements.set(
6494
6574
  protocol.name,
6495
- protocol.members.map(({ name: name2, labels, selector, types, result, typeMember }) => ({
6496
- name: name2,
6575
+ protocol.members.map(({ name: name3, labels, selector, types, result, typeMember }) => ({
6576
+ name: name3,
6497
6577
  labels,
6498
6578
  selector,
6499
6579
  ...typeMember && { typeMember },
@@ -6523,18 +6603,18 @@ function objcIndex(sources) {
6523
6603
  const code = swiftCodeMask(source);
6524
6604
  const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
6525
6605
  for (const protocol of code.matchAll(/\bprotocol\s+([A-Za-z_]\w*)[^{}]*\{/g)) {
6526
- const name2 = protocol[1];
6527
- protocols.add(name2);
6606
+ const name3 = protocol[1];
6607
+ protocols.add(name3);
6528
6608
  const open = protocol.index + protocol[0].length - 1;
6529
6609
  if (/\binit\s*[?!]?\s*\(/.test(code.slice(open + 1, closingBrace(code, braces, open))))
6530
- initializers.add(name2);
6610
+ initializers.add(name3);
6531
6611
  }
6532
6612
  }
6533
6613
  const rooted = conformingTypes(parents, /* @__PURE__ */ new Set(["NSObject"]));
6534
6614
  const initialized = conformingTypes(parents, initializers);
6535
6615
  const nsObjectTypes = /* @__PURE__ */ new Set([
6536
6616
  "NSObject",
6537
- ...[...protocols].filter((name2) => rooted.has(name2) && !initialized.has(name2))
6617
+ ...[...protocols].filter((name3) => rooted.has(name3) && !initialized.has(name3))
6538
6618
  ]);
6539
6619
  return {
6540
6620
  requirements,
@@ -6561,8 +6641,8 @@ function objcAliases(sources) {
6561
6641
  }
6562
6642
  }
6563
6643
  const aliases = /* @__PURE__ */ new Map();
6564
- for (const [name2, type] of declared) if (type !== null) aliases.set(name2, type);
6565
- for (const [name2, type] of aliases) aliases.set(name2, resolveAliases(type, aliases));
6644
+ for (const [name3, type] of declared) if (type !== null) aliases.set(name3, type);
6645
+ for (const [name3, type] of aliases) aliases.set(name3, resolveAliases(type, aliases));
6566
6646
  return aliases;
6567
6647
  }
6568
6648
  function resolveAliases(type, aliases) {
@@ -6570,7 +6650,7 @@ function resolveAliases(type, aliases) {
6570
6650
  for (let pass = 0; pass < 8 && aliases.size; pass++) {
6571
6651
  const next = resolved.replace(
6572
6652
  /(?<![\w.])[A-Za-z_]\w*(?![\w.])/g,
6573
- (name2) => aliases.get(name2) ?? name2
6653
+ (name3) => aliases.get(name3) ?? name3
6574
6654
  );
6575
6655
  if (next === resolved) break;
6576
6656
  resolved = next;
@@ -6676,17 +6756,17 @@ function lowerObjCOptionalRequirements(source, index) {
6676
6756
  `; extension ${protocol.name} { ${helpers.join("; ")} }`
6677
6757
  ]);
6678
6758
  }
6679
- for (const name2 of code.matchAll(
6759
+ for (const name3 of code.matchAll(
6680
6760
  /#selector\(\s*([A-Za-z_]\w*)\.([A-Za-z_]\w*)\(((?:\s*\w+\s*:)+)\s*\)\s*\)/g
6681
6761
  )) {
6682
- const signature = `${name2[2]}(${name2[3].replace(/\s+/g, "")})`;
6683
- const found = SDK_OBJC_OPTIONAL[name2[1]]?.requirements.filter(
6762
+ const signature = `${name3[2]}(${name3[3].replace(/\s+/g, "")})`;
6763
+ const found = SDK_OBJC_OPTIONAL[name3[1]]?.requirements.filter(
6684
6764
  ([requirement]) => requirement === signature
6685
6765
  );
6686
6766
  if (found?.length === 1)
6687
6767
  edits.push([
6688
- name2.index,
6689
- name2[0].length,
6768
+ name3.index,
6769
+ name3[0].length,
6690
6770
  `NSSelectorFromString(${JSON.stringify(found[0][1])})`
6691
6771
  ]);
6692
6772
  }
@@ -6694,7 +6774,7 @@ function lowerObjCOptionalRequirements(source, index) {
6694
6774
  const receivesAsProtocol = (dot) => {
6695
6775
  const receiver = /([A-Za-z_]\w*)\s*[?!]?\s*$/.exec(code.slice(0, dot))?.[1];
6696
6776
  if (!receiver) return false;
6697
- const name2 = /^\.\s*([A-Za-z_]\w*)/.exec(code.slice(dot))?.[1];
6777
+ const name3 = /^\.\s*([A-Za-z_]\w*)/.exec(code.slice(dot))?.[1];
6698
6778
  let innermost;
6699
6779
  for (const declared of code.matchAll(
6700
6780
  new RegExp(
@@ -6707,7 +6787,7 @@ function lowerObjCOptionalRequirements(source, index) {
6707
6787
  if (dot > from && dot < to && (!innermost || from >= innermost.from))
6708
6788
  innermost = { from, type: declared[1] };
6709
6789
  }
6710
- return innermost?.type !== void 0 && !!index.requirements.get(resolveAliases(innermost.type, index.aliases))?.some((wanted) => wanted.name === name2);
6790
+ return innermost?.type !== void 0 && !!index.requirements.get(resolveAliases(innermost.type, index.aliases))?.some((wanted) => wanted.name === name3);
6711
6791
  };
6712
6792
  for (const call of code.matchAll(/\.\s*([A-Za-z_]\w*)\s*\?(?=\s*[({])/g)) {
6713
6793
  const callable = index.callable.get(call[1]);
@@ -6724,8 +6804,8 @@ function lowerObjCOptionalRequirements(source, index) {
6724
6804
  continue;
6725
6805
  if (callable.member === call[1]) edits.push([mark, 1, " "]);
6726
6806
  else {
6727
- const name2 = call.index + call[0].indexOf(call[1]);
6728
- edits.push([name2, mark + 1 - name2, callable.member]);
6807
+ const name3 = call.index + call[0].indexOf(call[1]);
6808
+ edits.push([name3, mark + 1 - name3, callable.member]);
6729
6809
  }
6730
6810
  }
6731
6811
  for (const owner of code.matchAll(
@@ -6824,8 +6904,8 @@ function lowerObjCRuntimeCalls(source, index) {
6824
6904
  for (const declared of code.matchAll(
6825
6905
  /(?:\b(?:let|var)\s+|[(,]\s*(?:[A-Za-z_]\w*\s+)?)([A-Za-z_]\w*)\s*:\s*(?:(?:any\s+)?([A-Z]\w*(?:\.\w+)*)\s*([?!])?|[[(])|\b(?:let|var|for)\s+([A-Za-z_]\w*)\b(?!\s*:)|[{,]\s*([A-Za-z_]\w*)\s+in\b/g
6826
6906
  )) {
6827
- const name2 = declared[1] ?? declared[4] ?? declared[5];
6828
- const list2 = declarations.get(name2) ?? [];
6907
+ const name3 = declared[1] ?? declared[4] ?? declared[5];
6908
+ const list2 = declarations.get(name3) ?? [];
6829
6909
  let type = declared[3] ? "" : declared[2] ?? "";
6830
6910
  if (!type && declared[4]) {
6831
6911
  const lookup = /^\s*=\s*NSClassFromString\s*\(/.exec(
@@ -6840,7 +6920,7 @@ function lowerObjCRuntimeCalls(source, index) {
6840
6920
  }
6841
6921
  const resolved = type.endsWith(".Type") ? `${resolveAliases(type.slice(0, -5), index.aliases)}.Type` : resolveAliases(type, index.aliases);
6842
6922
  list2.push({ at: declared.index, type: resolved });
6843
- declarations.set(name2, list2);
6923
+ declarations.set(name3, list2);
6844
6924
  }
6845
6925
  for (const pattern of code.matchAll(/\b(?:let|var|for)\s*(?=\(|\.\s*\w+\s*\()/g)) {
6846
6926
  const open = code.indexOf("(", pattern.index + pattern[0].length);
@@ -6853,9 +6933,9 @@ function lowerObjCRuntimeCalls(source, index) {
6853
6933
  }
6854
6934
  for (const list2 of declarations.values()) list2.sort((a, b) => a.at - b.at);
6855
6935
  const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
6856
- const receiverType = (name2, at) => {
6936
+ const receiverType = (name3, at) => {
6857
6937
  let innermost;
6858
- for (const declared of declarations.get(name2) ?? []) {
6938
+ for (const declared of declarations.get(name3) ?? []) {
6859
6939
  if (declared.at > at) break;
6860
6940
  const [from, to] = declarationScope(code, braces, declared.at);
6861
6941
  if (at > from && at < to && (!innermost || from >= innermost.from))
@@ -7694,7 +7774,7 @@ var CORE_FOUNDATION_HANDLE_IMPORTS = [
7694
7774
  "CFSet",
7695
7775
  "CFString",
7696
7776
  "CFURL"
7697
- ].map((name2) => `import class CoreFoundation.${name2}`).concat([
7777
+ ].map((name3) => `import class CoreFoundation.${name3}`).concat([
7698
7778
  "import typealias CoreFoundation.CFPropertyList",
7699
7779
  "import typealias CoreFoundation.CFTypeRef",
7700
7780
  "import CoreGraphics"
@@ -8123,7 +8203,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
8123
8203
  [
8124
8204
  product,
8125
8205
  ...optionalProducts.map(
8126
- (name2) => `.product(name: "${name2}", package: "sootsim-swift"),`
8206
+ (name3) => `.product(name: "${name3}", package: "sootsim-swift"),`
8127
8207
  )
8128
8208
  ].join("\n ")
8129
8209
  );
@@ -8238,7 +8318,7 @@ function builtArtifact(layout) {
8238
8318
  }
8239
8319
  const file = import_node_path6.default.join(binDir, `${executable.name}.wasm`);
8240
8320
  if (!(0, import_node_fs5.existsSync)(file)) {
8241
- const found = (0, import_node_fs5.existsSync)(binDir) ? (0, import_node_fs5.readdirSync)(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
8321
+ const found = (0, import_node_fs5.existsSync)(binDir) ? (0, import_node_fs5.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
8242
8322
  throw new Error(
8243
8323
  `swift-compile: the build produced no ${executable.name}.wasm (found: ${found.join(", ") || "none"})`
8244
8324
  );
@@ -8418,7 +8498,7 @@ function compileSwiftProjectUnit(input, options) {
8418
8498
  }
8419
8499
  return withSwiftRootLock(
8420
8500
  root,
8421
- async () => {
8501
+ async (lease) => {
8422
8502
  const built2 = readCompiledArtifact(import_node_path6.default.join(sharedRoot, "artifact"), hash);
8423
8503
  if (built2) {
8424
8504
  report("reusing verified disk artifact");
@@ -8481,7 +8561,8 @@ function compileSwiftProjectUnit(input, options) {
8481
8561
  },
8482
8562
  maxBuffer: 64 * 1024 * 1024,
8483
8563
  timeout: options.timeoutMs,
8484
- signal: options.signal
8564
+ signal: options.signal,
8565
+ lease
8485
8566
  };
8486
8567
  report("compiling and linking Swift modules");
8487
8568
  try {
@@ -8597,7 +8678,7 @@ function plural(node, specifier) {
8597
8678
  const forms = dictionary();
8598
8679
  forms.NSStringFormatSpecTypeKey = "NSStringPluralRuleType";
8599
8680
  forms.NSStringFormatValueTypeKey = specifier;
8600
- for (const [name2, value] of Object.entries(object(node))) forms[name2] = unit(value);
8681
+ for (const [name3, value] of Object.entries(object(node))) forms[name3] = unit(value);
8601
8682
  return forms;
8602
8683
  }
8603
8684
  function resolve(node, key2) {
@@ -8605,7 +8686,7 @@ function resolve(node, key2) {
8605
8686
  if (value.substitutions !== void 0) {
8606
8687
  let format = unit(value);
8607
8688
  const rules = dictionary();
8608
- for (const [name2, raw2] of Object.entries(object(value.substitutions))) {
8689
+ for (const [name3, raw2] of Object.entries(object(value.substitutions))) {
8609
8690
  const sub = object(raw2), specifier = typeof sub.formatSpecifier === "string" ? sub.formatSpecifier : "";
8610
8691
  const forms = plural(object(sub.variations).plural, specifier);
8611
8692
  for (const [category, text4] of Object.entries(forms)) {
@@ -8618,10 +8699,10 @@ function resolve(node, key2) {
8618
8699
  }
8619
8700
  if (typeof sub.argNum === "number")
8620
8701
  format = format.replaceAll(
8621
- "%#@" + name2 + "@",
8622
- "%" + sub.argNum + "$#@" + name2 + "@"
8702
+ "%#@" + name3 + "@",
8703
+ "%" + sub.argNum + "$#@" + name3 + "@"
8623
8704
  );
8624
- rules[name2] = forms;
8705
+ rules[name3] = forms;
8625
8706
  }
8626
8707
  return { rules: { NSStringLocalizedFormatKey: format, ...rules } };
8627
8708
  }
@@ -8636,9 +8717,9 @@ function resolve(node, key2) {
8636
8717
  const specifier = numeric.specifier;
8637
8718
  const forms = plural(sourceForms, specifier);
8638
8719
  if (argument > 0) {
8639
- for (const [name2, text4] of Object.entries(forms))
8640
- if (!name2.startsWith("NSString") && typeof text4 === "string")
8641
- forms[name2] = positioned(text4);
8720
+ for (const [name3, text4] of Object.entries(forms))
8721
+ if (!name3.startsWith("NSString") && typeof text4 === "string")
8722
+ forms[name3] = positioned(text4);
8642
8723
  }
8643
8724
  return {
8644
8725
  rules: {
@@ -8662,8 +8743,8 @@ function resolve(node, key2) {
8662
8743
  }
8663
8744
  throw Error("unsupported string catalog variation for " + key2);
8664
8745
  }
8665
- function compileCatalogTables(source, name2) {
8666
- if (!isSwiftResourcePath(name2) || name2.includes("/"))
8746
+ function compileCatalogTables(source, name3) {
8747
+ if (!isSwiftResourcePath(name3) || name3.includes("/"))
8667
8748
  throw Error("invalid string catalog table name");
8668
8749
  const root = object(JSON.parse(source)), strings = object(root.strings);
8669
8750
  const output = {};
@@ -8686,21 +8767,21 @@ function compileCatalogTables(source, name2) {
8686
8767
  const localizations = entry.localizations === void 0 ? {} : object(entry.localizations);
8687
8768
  if (entry.extractionState === "manual") {
8688
8769
  if (!Object.hasOwn(localizations, sourceLanguage))
8689
- (output[sourceLanguage + ".lproj/" + name2 + ".strings"] ??= dictionary())[key2] = key2;
8770
+ (output[sourceLanguage + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = key2;
8690
8771
  const source2 = !Object.hasOwn(localizations, sourceLanguage) ? void 0 : object(localizations[sourceLanguage]);
8691
8772
  const variations = source2?.variations === void 0 ? void 0 : object(source2.variations);
8692
8773
  if (variations?.plural !== void 0) {
8693
8774
  for (const language of languages)
8694
8775
  if (!Object.hasOwn(localizations, language))
8695
- (output[language + ".lproj/" + name2 + ".strings"] ??= dictionary())[key2] = key2;
8776
+ (output[language + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = key2;
8696
8777
  }
8697
8778
  }
8698
8779
  for (const [language, node] of Object.entries(localizations)) {
8699
8780
  const resolved = resolve(node, key2);
8700
8781
  if (resolved.text !== void 0)
8701
- (output[language + ".lproj/" + name2 + ".strings"] ??= dictionary())[key2] = resolved.text;
8782
+ (output[language + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = resolved.text;
8702
8783
  if (resolved.rules !== void 0)
8703
- (output[language + ".lproj/" + name2 + ".stringsdict"] ??= dictionary())[key2] = resolved.rules;
8784
+ (output[language + ".lproj/" + name3 + ".stringsdict"] ??= dictionary())[key2] = resolved.rules;
8704
8785
  }
8705
8786
  }
8706
8787
  return output;
@@ -8710,9 +8791,9 @@ function plist(value) {
8710
8791
  if (typeof value === "string") return "<string>" + escaped(value) + "</string>";
8711
8792
  return "<dict>" + Object.entries(value).map(([key2, item]) => "<key>" + escaped(key2) + "</key>" + plist(item)).join("") + "</dict>";
8712
8793
  }
8713
- function compileStringCatalog(source, name2) {
8794
+ function compileStringCatalog(source, name3) {
8714
8795
  return Object.fromEntries(
8715
- Object.entries(compileCatalogTables(source, name2)).map(([path22, table]) => [
8796
+ Object.entries(compileCatalogTables(source, name3)).map(([path22, table]) => [
8716
8797
  path22,
8717
8798
  '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0">' + plist(table) + "</plist>"
8718
8799
  ])
@@ -8724,9 +8805,9 @@ var import_node_fs6 = require("node:fs");
8724
8805
  var import_node_path7 = require("node:path");
8725
8806
 
8726
8807
  // src/public-brand.ts
8727
- var name = "Peach";
8808
+ var name2 = "Peach";
8728
8809
  var peachPublicBrand = Object.freeze({
8729
- name,
8810
+ name: name2,
8730
8811
  packageName: "peachsim",
8731
8812
  commandName: "peach",
8732
8813
  domain: "peachsim.com",
@@ -8889,7 +8970,7 @@ function authHeaderValue(auth) {
8889
8970
  }
8890
8971
 
8891
8972
  // src/backend-origin.ts
8892
- var DEFAULT_CONTRAST_BACKEND_ORIGIN = "https://contrast.dev";
8973
+ var DEFAULT_CONTRAST_BACKEND_ORIGIN = "https://peachsim.com";
8893
8974
  function normalizeHostname(hostname) {
8894
8975
  return hostname.replace(/^\[|\]$/g, "").toLowerCase();
8895
8976
  }
@@ -8900,7 +8981,7 @@ function isLoopbackHost(hostname) {
8900
8981
  var PEACHSIM_NATIVE_HOST = "native.peachsim.com";
8901
8982
  function isContrastBackendHost(hostname) {
8902
8983
  const normalized = normalizeHostname(hostname);
8903
- return isLoopbackHost(normalized) || normalized === "contrast.dev" || normalized.endsWith(".contrast.dev") || normalized === PEACHSIM_NATIVE_HOST;
8984
+ return isLoopbackHost(normalized) || normalized === "contrast.dev" || normalized.endsWith(".contrast.dev") || normalized === "peachsim.com" || normalized === "www.peachsim.com" || normalized === PEACHSIM_NATIVE_HOST;
8904
8985
  }
8905
8986
  function resolveContrastBackendOrigin(currentOrigin, search) {
8906
8987
  const origin = new URLSearchParams(search ?? "").get("backend")?.trim() || currentOrigin?.trim();
@@ -9447,8 +9528,8 @@ function readXcodeJsonProject(xcodeproj, source) {
9447
9528
  const kind = text2(entry.kind) ?? "file-reference";
9448
9529
  const raw2 = text2(entry.path) ?? "";
9449
9530
  const located = raw2 === "" ? null : locate(raw2, parent.dir);
9450
- const name2 = text2(entry.name) ?? import_node_path8.default.basename(raw2);
9451
- const node = { id: "", name: name2, dir: null, parent, children: [] };
9531
+ const name3 = text2(entry.name) ?? import_node_path8.default.basename(raw2);
9532
+ const node = { id: "", name: name3, dir: null, parent, children: [] };
9452
9533
  if (kind === "group" || kind === "variant-group" || kind === "version-group") {
9453
9534
  node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
9454
9535
  const childIds = walk2(items(entry.children), node);
@@ -9461,7 +9542,7 @@ function readXcodeJsonProject(xcodeproj, source) {
9461
9542
  isa: kind === "variant-group" ? "PBXVariantGroup" : "PBXGroup",
9462
9543
  children: childIds,
9463
9544
  ...kind === "variant-group" ? {} : { sourceTree: "<absolute>", path: node.dir ?? "" },
9464
- name: name2
9545
+ name: name3
9465
9546
  },
9466
9547
  text2(entry.id)
9467
9548
  );
@@ -9479,7 +9560,7 @@ function readXcodeJsonProject(xcodeproj, source) {
9479
9560
  {
9480
9561
  isa: "PBXFileReference",
9481
9562
  ...located ?? { sourceTree: "SDKROOT", path: raw2 },
9482
- name: name2
9563
+ name: name3
9483
9564
  },
9484
9565
  text2(entry.id)
9485
9566
  );
@@ -9531,8 +9612,8 @@ function readXcodeJsonProject(xcodeproj, source) {
9531
9612
  return node;
9532
9613
  };
9533
9614
  const configurations = items(json.configurations).flatMap((entry) => {
9534
- const name2 = isObject(entry) ? text2(entry.name) : text2(entry);
9535
- return name2 ? [{ name: name2, file: isObject(entry) ? entry.file : void 0 }] : [];
9615
+ const name3 = isObject(entry) ? text2(entry.name) : text2(entry);
9616
+ return name3 ? [{ name: name3, file: isObject(entry) ? entry.file : void 0 }] : [];
9536
9617
  });
9537
9618
  const settingsOf = (value) => Object.fromEntries(
9538
9619
  Object.entries(isObject(value) ? value : {}).flatMap(
@@ -9547,11 +9628,11 @@ function readXcodeJsonProject(xcodeproj, source) {
9547
9628
  const configurationList = (settings, specialized) => add({
9548
9629
  isa: "XCConfigurationList",
9549
9630
  defaultConfigurationName: text2(json["default-configuration"]) ?? "Debug",
9550
- buildConfigurations: configurations.map(({ name: name2, file }) => {
9551
- const base = lookup(specialized.has(name2) ? specialized.get(name2) : file);
9631
+ buildConfigurations: configurations.map(({ name: name3, file }) => {
9632
+ const base = lookup(specialized.has(name3) ? specialized.get(name3) : file);
9552
9633
  return add({
9553
9634
  isa: "XCBuildConfiguration",
9554
- name: name2,
9635
+ name: name3,
9555
9636
  buildSettings: settings,
9556
9637
  ...base ? { baseConfigurationReference: base } : {}
9557
9638
  });
@@ -9562,9 +9643,9 @@ function readXcodeJsonProject(xcodeproj, source) {
9562
9643
  if (!isObject(entry)) continue;
9563
9644
  const repository = text2(entry.repository);
9564
9645
  const local = text2(entry.path);
9565
- const name2 = local !== void 0 ? import_node_path8.default.basename(import_node_path8.default.resolve(import_node_path8.default.dirname(xcodeproj), local)) : import_node_path8.default.basename(repository ?? "").replace(/\.git$/, "");
9646
+ const name3 = local !== void 0 ? import_node_path8.default.basename(import_node_path8.default.resolve(import_node_path8.default.dirname(xcodeproj), local)) : import_node_path8.default.basename(repository ?? "").replace(/\.git$/, "");
9566
9647
  const id = text2(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
9567
- packageIds.set(name2.toLowerCase(), id);
9648
+ packageIds.set(name3.toLowerCase(), id);
9568
9649
  }
9569
9650
  const productDependency = (entry) => add({
9570
9651
  isa: "XCSwiftPackageProductDependency",
@@ -9584,12 +9665,12 @@ function readXcodeJsonProject(xcodeproj, source) {
9584
9665
  const targets = [];
9585
9666
  for (const entry of items(json.targets)) {
9586
9667
  if (!isObject(entry)) continue;
9587
- const name2 = text2(entry.name) ?? "";
9668
+ const name3 = text2(entry.name) ?? "";
9588
9669
  const productType = text2(entry["product-type"]);
9589
9670
  const target = {
9590
9671
  isa: text2(entry.kind) === "aggregate" ? "PBXAggregateTarget" : "PBXNativeTarget",
9591
- name: name2,
9592
- productName: name2,
9672
+ name: name3,
9673
+ productName: name3,
9593
9674
  productType: productType ? `com.apple.product-type.${productType}` : text2(entry["full-product-type"]) ?? "",
9594
9675
  buildPhases: [],
9595
9676
  dependencies: [],
@@ -9599,7 +9680,7 @@ function readXcodeJsonProject(xcodeproj, source) {
9599
9680
  const product = lookup(entry.product);
9600
9681
  if (product) target.productReference = product;
9601
9682
  const id = add(target, text2(entry.id));
9602
- targetIds.set(name2, id);
9683
+ targetIds.set(name3, id);
9603
9684
  targets.push({ id, target, entry });
9604
9685
  for (const phase of items(entry["build-phases"])) {
9605
9686
  const kind = isObject(phase) ? text2(phase.kind) : text2(phase);
@@ -9611,7 +9692,7 @@ function readXcodeJsonProject(xcodeproj, source) {
9611
9692
  isObject(phase) ? text2(phase.id) : void 0
9612
9693
  );
9613
9694
  target.buildPhases.push(phaseId);
9614
- phases.set([name2, kind, phaseName].filter(Boolean).join("/"), phaseId);
9695
+ phases.set([name3, kind, phaseName].filter(Boolean).join("/"), phaseId);
9615
9696
  phases.set(`id:${phaseId}`, phaseId);
9616
9697
  }
9617
9698
  }
@@ -9627,7 +9708,7 @@ function readXcodeJsonProject(xcodeproj, source) {
9627
9708
  files2?.push(add({ isa: "PBXBuildFile", fileRef: refId }));
9628
9709
  }
9629
9710
  for (const { target, entry } of targets) {
9630
- const name2 = text2(entry.name) ?? "";
9711
+ const name3 = text2(entry.name) ?? "";
9631
9712
  target.buildConfigurationList = configurationList(
9632
9713
  settingsOf(entry["build-settings"]),
9633
9714
  new Map(
@@ -9665,7 +9746,7 @@ function readXcodeJsonProject(xcodeproj, source) {
9665
9746
  const dependency = productDependency(member);
9666
9747
  target.packageProductDependencies.push(dependency);
9667
9748
  const buildFile = member["build-phase"];
9668
- phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name2)?.push(
9749
+ phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name3)?.push(
9669
9750
  add({ isa: "PBXBuildFile", productRef: dependency })
9670
9751
  );
9671
9752
  }
@@ -9786,8 +9867,8 @@ function applyConditions(raw2, configuration) {
9786
9867
  continue;
9787
9868
  }
9788
9869
  const matches = [...key2.slice(bracket).matchAll(/\[([^=\]]+)=([^\]]*)\]/g)].every(
9789
- ([, name2, pattern]) => {
9790
- const actual = name2 === "config" ? configuration : CONDITIONS[name2];
9870
+ ([, name3, pattern]) => {
9871
+ const actual = name3 === "config" ? configuration : CONDITIONS[name3];
9791
9872
  return actual !== void 0 && new RegExp(
9792
9873
  `^${pattern.replace(/[.+^${}()|\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
9793
9874
  ).test(actual);
@@ -9847,9 +9928,9 @@ function workspaceReferences(workspace) {
9847
9928
  function enclosingXcodeWorkspace(xcodeproj) {
9848
9929
  const project = import_node_fs7.default.realpathSync(xcodeproj);
9849
9930
  for (let dir = import_node_path9.default.dirname(project); ; dir = import_node_path9.default.dirname(dir)) {
9850
- for (const name2 of import_node_fs7.default.readdirSync(dir).sort()) {
9851
- if (!name2.endsWith(".xcworkspace")) continue;
9852
- const workspace = import_node_path9.default.join(dir, name2);
9931
+ for (const name3 of import_node_fs7.default.readdirSync(dir).sort()) {
9932
+ if (!name3.endsWith(".xcworkspace")) continue;
9933
+ const workspace = import_node_path9.default.join(dir, name3);
9853
9934
  if (!import_node_fs7.default.existsSync(import_node_path9.default.join(workspace, "contents.xcworkspacedata"))) continue;
9854
9935
  if (workspaceReferences(workspace).some(
9855
9936
  (reference) => import_node_fs7.default.existsSync(reference) && import_node_fs7.default.realpathSync(reference) === project
@@ -9861,8 +9942,8 @@ function enclosingXcodeWorkspace(xcodeproj) {
9861
9942
  }
9862
9943
  var loaded = /* @__PURE__ */ new Map();
9863
9944
  function xcodeProjectFile(xcodeproj) {
9864
- for (const name2 of ["project.pbxproj", "project.xcproj"]) {
9865
- const file = import_node_path9.default.join(xcodeproj, name2);
9945
+ for (const name3 of ["project.pbxproj", "project.xcproj"]) {
9946
+ const file = import_node_path9.default.join(xcodeproj, name3);
9866
9947
  if (import_node_fs7.default.existsSync(file)) return file;
9867
9948
  }
9868
9949
  return null;
@@ -9919,7 +10000,7 @@ function targetSettings(ref, configuration, builtins, options = {}) {
9919
10000
  const configs2 = list(configList?.buildConfigurations).map(project.object);
9920
10001
  const config = configs2.find((entry) => entry?.name === configuration) ?? configs2.find((entry) => entry?.name === str(configList?.defaultConfigurationName));
9921
10002
  if (!config) return [];
9922
- const name2 = str(config.name) ?? configuration;
10003
+ const name3 = str(config.name) ?? configuration;
9923
10004
  const base = str(config.baseConfigurationReference);
9924
10005
  const anchor = str(config.baseConfigurationReferenceAnchor);
9925
10006
  const relative = str(config.baseConfigurationReferenceRelativePath);
@@ -9934,14 +10015,14 @@ function targetSettings(ref, configuration, builtins, options = {}) {
9934
10015
  const fromFile = baseFile ? readXcconfig(baseFile, read) : {};
9935
10016
  xcconfigs.push(...read);
9936
10017
  return [
9937
- applyConditions(fromFile, name2),
10018
+ applyConditions(fromFile, name3),
9938
10019
  applyConditions(
9939
10020
  Object.fromEntries(
9940
10021
  Object.entries(own).flatMap(
9941
10022
  ([key2, value]) => typeof value === "string" ? [[key2, value]] : Array.isArray(value) ? [[key2, list(value).join(" ")]] : []
9942
10023
  )
9943
10024
  ),
9944
- name2
10025
+ name3
9945
10026
  )
9946
10027
  ];
9947
10028
  };
@@ -9961,13 +10042,13 @@ function targetSettings(ref, configuration, builtins, options = {}) {
9961
10042
  resolving.add(marker);
9962
10043
  const value = expand(
9963
10044
  levels[at][key2],
9964
- (name2) => name2 === "inherited" ? valueAt(key2, at - 1) : valueAt(name2, levels.length - 1)
10045
+ (name3) => name3 === "inherited" ? valueAt(key2, at - 1) : valueAt(name3, levels.length - 1)
9965
10046
  );
9966
10047
  resolving.delete(marker);
9967
10048
  return value;
9968
10049
  };
9969
10050
  const derived = (key2) => {
9970
- const get = (name2) => valueAt(name2, levels.length - 1);
10051
+ const get = (name3) => valueAt(name3, levels.length - 1);
9971
10052
  switch (key2) {
9972
10053
  case "PRODUCT_NAME":
9973
10054
  return get("TARGET_NAME");
@@ -9975,6 +10056,9 @@ function targetSettings(ref, configuration, builtins, options = {}) {
9975
10056
  return applyOperator(get("PRODUCT_NAME"), "c99extidentifier");
9976
10057
  case "EXECUTABLE_NAME":
9977
10058
  return get("PRODUCT_NAME");
10059
+ // the native default of CoreBuildSystem.xcspec
10060
+ case "EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES":
10061
+ return "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets *.icon (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
9978
10062
  case "AppIdentifierPrefix":
9979
10063
  case "TeamIdentifierPrefix": {
9980
10064
  const team = get("DEVELOPMENT_TEAM");
@@ -9997,6 +10081,45 @@ function settingList(value) {
9997
10081
  items2.push((quoted ?? plain).replace(/\\(.)/g, "$1"));
9998
10082
  return items2;
9999
10083
  }
10084
+ function expandSearchPath(directory, rules) {
10085
+ if (import_node_path9.default.basename(directory) !== "**") return [directory];
10086
+ const expanded = [];
10087
+ const seen = /* @__PURE__ */ new Set();
10088
+ const queue = [import_node_path9.default.dirname(directory)];
10089
+ for (let at = 0; at < queue.length; at++) {
10090
+ const current = queue[at];
10091
+ let real;
10092
+ try {
10093
+ real = import_node_fs7.default.realpathSync(current);
10094
+ } catch {
10095
+ continue;
10096
+ }
10097
+ if (!import_node_fs7.default.statSync(real).isDirectory() || seen.has(real)) continue;
10098
+ seen.add(real);
10099
+ expanded.push(current);
10100
+ for (const entry of import_node_fs7.default.readdirSync(real, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
10101
+ if (entry.isSymbolicLink() ? !rules.followLinks : !entry.isDirectory()) continue;
10102
+ if (rules.excluded.some((pattern) => pattern.test(entry.name)) && !rules.included.some((pattern) => pattern.test(entry.name)))
10103
+ continue;
10104
+ queue.push(import_node_path9.default.join(current, entry.name));
10105
+ }
10106
+ }
10107
+ return expanded;
10108
+ }
10109
+ function recursiveSearchRules(settings) {
10110
+ const glob = (pattern) => new RegExp(
10111
+ `^${pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
10112
+ );
10113
+ return {
10114
+ excluded: settingList(settings("EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES")).map(
10115
+ glob
10116
+ ),
10117
+ included: settingList(settings("INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES")).map(
10118
+ glob
10119
+ ),
10120
+ followLinks: settings("RECURSIVE_SEARCH_PATHS_FOLLOW_SYMLINKS") !== "NO"
10121
+ };
10122
+ }
10000
10123
  function compilationConditions(settings) {
10001
10124
  const flags = settingList(settings("OTHER_SWIFT_FLAGS"));
10002
10125
  const defined = flags.flatMap(
@@ -10013,9 +10136,9 @@ function expand(value, lookup) {
10013
10136
  return value.replace(
10014
10137
  /\$(?:\(([A-Za-z_][A-Za-z0-9_]*)((?::[^)]*)?)\)|\{([A-Za-z_][A-Za-z0-9_]*)((?::[^}]*)?)\}|([A-Za-z_][A-Za-z0-9_]*))/g,
10015
10138
  (_match, paren, parenOps, brace, braceOps, bare) => {
10016
- const name2 = paren ?? brace ?? bare;
10139
+ const name3 = paren ?? brace ?? bare;
10017
10140
  const operators = parenOps ?? braceOps ?? "";
10018
- return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name2));
10141
+ return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name3));
10019
10142
  }
10020
10143
  );
10021
10144
  }
@@ -10245,8 +10368,8 @@ function isIosAppTarget(ref, options = {}) {
10245
10368
  const sdk = get("SDKROOT");
10246
10369
  return sdk === "auto" ? settingList(get("SUPPORTED_PLATFORMS")).some(isIosPlatform) : sdk === "" || isIosPlatform(sdk);
10247
10370
  }
10248
- function isIosPlatform(name2) {
10249
- return name2.startsWith("iphoneos") || name2.startsWith("iphonesimulator");
10371
+ function isIosPlatform(name3) {
10372
+ return name3.startsWith("iphoneos") || name3.startsWith("iphonesimulator");
10250
10373
  }
10251
10374
  function readXcodeAppTarget(input, targetName, configurationName, options = {}) {
10252
10375
  const xcodeprojOrWorkspace = import_node_fs7.default.realpathSync(input);
@@ -10316,7 +10439,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10316
10439
  visit(app);
10317
10440
  const xcconfigs = /* @__PURE__ */ new Set();
10318
10441
  const moduleTarget = (ref) => {
10319
- const name2 = str(ref.target.name) ?? ref.id;
10442
+ const name3 = str(ref.target.name) ?? ref.id;
10320
10443
  const {
10321
10444
  get: settings2,
10322
10445
  keys,
@@ -10325,7 +10448,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10325
10448
  ref,
10326
10449
  configuration,
10327
10450
  {
10328
- TARGET_NAME: name2,
10451
+ TARGET_NAME: name3,
10329
10452
  PROJECT_NAME: import_node_path9.default.basename(ref.project.xcodeproj, ".xcodeproj"),
10330
10453
  SRCROOT: ref.project.projectDir,
10331
10454
  SOURCE_ROOT: ref.project.projectDir,
@@ -10356,6 +10479,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10356
10479
  for (const file of read) xcconfigs.add(file);
10357
10480
  const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
10358
10481
  const members = targetMembers(ref, settings2, options, keys, xcconfigs);
10482
+ const searchRules = recursiveSearchRules(settings2);
10359
10483
  const implementations = members.allSources.filter(
10360
10484
  (file) => /\.(c|cc|cpp|cxx|m|mm)$/.test(file)
10361
10485
  );
@@ -10380,7 +10504,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10380
10504
  settings: settings2,
10381
10505
  keys,
10382
10506
  module: {
10383
- name: name2,
10507
+ name: name3,
10384
10508
  moduleName: applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier"),
10385
10509
  ...members,
10386
10510
  languageMode: swiftVersion >= 6 ? 6 : 5,
@@ -10398,10 +10522,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10398
10522
  headerSearchPaths: [
10399
10523
  ...settingList(settings2("HEADER_SEARCH_PATHS")),
10400
10524
  ...settingList(settings2("USER_HEADER_SEARCH_PATHS"))
10401
- ].map(absolute),
10402
- frameworkSearchPaths: settingList(settings2("FRAMEWORK_SEARCH_PATHS")).map(
10403
- absolute
10404
- ),
10525
+ ].flatMap((raw2) => expandSearchPath(absolute(raw2), searchRules)),
10526
+ frameworkSearchPaths: settingList(
10527
+ settings2("FRAMEWORK_SEARCH_PATHS")
10528
+ ).flatMap((raw2) => expandSearchPath(absolute(raw2), searchRules)),
10405
10529
  flags: [
10406
10530
  ...settings2("CLANG_ENABLE_OBJC_ARC") === "YES" ? ["-fobjc-arc"] : [],
10407
10531
  ...settings2("CLANG_ENABLE_OBJC_WEAK") === "YES" ? ["-fobjc-weak"] : [],
@@ -10523,12 +10647,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10523
10647
  const fileId = str(project.object(buildFileId)?.fileRef);
10524
10648
  const file = project.object(fileId);
10525
10649
  const tree = str(file?.sourceTree);
10526
- const name2 = /([^/]+)\.(xc)?framework$/.exec(str(file?.path) ?? "")?.[1];
10527
- if (file?.isa !== "PBXFileReference" || !name2) continue;
10650
+ const name3 = /([^/]+)\.(xc)?framework$/.exec(str(file?.path) ?? "")?.[1];
10651
+ if (file?.isa !== "PBXFileReference" || !name3) continue;
10528
10652
  if (tree === "BUILT_PRODUCTS_DIR" || tree === "SDKROOT" || tree === "DEVELOPER_DIR")
10529
10653
  continue;
10530
10654
  const resolved = fileId ? project.resolvePath(fileId) : null;
10531
- if (!binaryFrameworks.get(name2)) binaryFrameworks.set(name2, resolved);
10655
+ if (!binaryFrameworks.get(name3)) binaryFrameworks.set(name3, resolved);
10532
10656
  }
10533
10657
  }
10534
10658
  }
@@ -10563,7 +10687,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
10563
10687
  localPackageDirs: [
10564
10688
  ...new Set(localPackageDirs.map((dir) => import_node_fs7.default.realpathSync(dir)))
10565
10689
  ].sort(),
10566
- binaryFrameworks: [...binaryFrameworks].map(([name2, file]) => ({ name: name2, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
10690
+ binaryFrameworks: [...binaryFrameworks].map(([name3, file]) => ({ name: name3, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
10567
10691
  packageResolved,
10568
10692
  appTargets: appTargetNames,
10569
10693
  configuration,
@@ -10643,7 +10767,7 @@ async function swiftBinaryModules(binary) {
10643
10767
  );
10644
10768
  if (import_node_fs8.default.existsSync(cached2)) {
10645
10769
  const value = JSON.parse(import_node_fs8.default.readFileSync(cached2, "utf8"));
10646
- if (Array.isArray(value) && value.every((name2) => typeof name2 === "string"))
10770
+ if (Array.isArray(value) && value.every((name3) => typeof name3 === "string"))
10647
10771
  return value;
10648
10772
  }
10649
10773
  const modules = frameworkModules(await zipEntries(binary.url));
@@ -12986,15 +13110,15 @@ function materializeObjcSdk(cacheDir5) {
12986
13110
  var headerFiles = (dir) => import_node_fs11.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => file.endsWith(".h")).sort();
12987
13111
  function missingHeader(missing) {
12988
13112
  const lines = ["#import <Foundation/Foundation.h>", "#import <UIKit/UIKit.h>"];
12989
- for (const [name2, kind] of missing) if (kind === "macro") lines.push(`#define ${name2}`);
12990
- for (const [name2, kind] of missing)
12991
- if (kind === "protocol") lines.push(`@protocol ${name2} <NSObject>
13113
+ for (const [name3, kind] of missing) if (kind === "macro") lines.push(`#define ${name3}`);
13114
+ for (const [name3, kind] of missing)
13115
+ if (kind === "protocol") lines.push(`@protocol ${name3} <NSObject>
12992
13116
  @end`);
12993
- for (const [name2, kind] of missing)
12994
- if (kind === "class") lines.push(`@interface ${name2} : NSObject
13117
+ for (const [name3, kind] of missing)
13118
+ if (kind === "class") lines.push(`@interface ${name3} : NSObject
12995
13119
  @end`);
12996
- for (const [name2, kind] of missing)
12997
- if (kind === "struct") lines.push(`typedef struct ${name2} { char opaque; } ${name2};`);
13120
+ for (const [name3, kind] of missing)
13121
+ if (kind === "struct") lines.push(`typedef struct ${name3} { char opaque; } ${name3};`);
12998
13122
  return `${lines.join("\n")}
12999
13123
  `;
13000
13124
  }
@@ -13087,11 +13211,11 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13087
13211
  stubbed.add(include2);
13088
13212
  const slash = include2.indexOf("/");
13089
13213
  if (slash > 0 && /^[A-Z]/.test(include2)) {
13090
- const name2 = include2.slice(0, slash);
13091
- const umbrella = `${name2}/${name2}.h`;
13214
+ const name3 = include2.slice(0, slash);
13215
+ const umbrella = `${name3}/${name3}.h`;
13092
13216
  if (Object.hasOwn(
13093
13217
  IOS_SDK_HEADERS,
13094
- `System/Library/Frameworks/${name2}.framework/Headers/${name2}.h`
13218
+ `System/Library/Frameworks/${name3}.framework/Headers/${name3}.h`
13095
13219
  )) {
13096
13220
  const header2 = import_node_path13.default.join(stubIncludes, include2);
13097
13221
  import_node_fs11.default.mkdirSync(import_node_path13.default.dirname(header2), { recursive: true });
@@ -13099,7 +13223,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13099
13223
  `);
13100
13224
  return true;
13101
13225
  }
13102
- const root = import_node_path13.default.join(stubs, `${name2}.framework`);
13226
+ const root = import_node_path13.default.join(stubs, `${name3}.framework`);
13103
13227
  const header = import_node_path13.default.join(root, "Headers", include2.slice(slash + 1));
13104
13228
  import_node_fs11.default.mkdirSync(import_node_path13.default.dirname(header), { recursive: true });
13105
13229
  import_node_fs11.default.writeFileSync(
@@ -13109,7 +13233,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13109
13233
  import_node_fs11.default.mkdirSync(import_node_path13.default.join(root, "Modules"), { recursive: true });
13110
13234
  import_node_fs11.default.writeFileSync(
13111
13235
  import_node_path13.default.join(root, "Modules", "module.modulemap"),
13112
- `framework module ${name2} {
13236
+ `framework module ${name3} {
13113
13237
  umbrella "Headers"
13114
13238
  export *
13115
13239
  module * { export * }
@@ -13139,10 +13263,10 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13139
13263
  const text4 = import_node_fs11.default.existsSync(file) ? import_node_fs11.default.readFileSync(file, "utf8").split("\n")[line - 1] : void 0;
13140
13264
  if (text4 === void 0) return null;
13141
13265
  const rest = text4.slice(column - 1);
13142
- const name2 = /^[A-Za-z_]\w*/.exec(rest)?.[0];
13143
- return name2 ? { name: name2, after: rest.slice(name2.length) } : null;
13266
+ const name3 = /^[A-Za-z_]\w*/.exec(rest)?.[0];
13267
+ return name3 ? { name: name3, after: rest.slice(name3.length) } : null;
13144
13268
  };
13145
- const typeKind = (name2, after) => /^[A-Z][A-Z0-9_]+$/.test(name2) && !/^\s*\*/.test(after) ? "macro" : /^\s*\*/.test(after) ? "class" : "struct";
13269
+ const typeKind = (name3, after) => /^[A-Z][A-Z0-9_]+$/.test(name3) && !/^\s*\*/.test(after) ? "macro" : /^\s*\*/.test(after) ? "class" : "struct";
13146
13270
  for (let round = 0; ; round++) {
13147
13271
  import_node_fs11.default.rmSync(out, { recursive: true, force: true });
13148
13272
  import_node_fs11.default.mkdirSync(out, { recursive: true });
@@ -13171,9 +13295,9 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13171
13295
  ];
13172
13296
  if (errors.length === 0 && run3.status === 0) break;
13173
13297
  let progress = false;
13174
- const learn = (name2, kind) => {
13175
- if (missing.has(name2)) return;
13176
- missing.set(name2, kind);
13298
+ const learn = (name3, kind) => {
13299
+ if (missing.has(name3)) return;
13300
+ missing.set(name3, kind);
13177
13301
  progress = true;
13178
13302
  };
13179
13303
  for (const [, file, line, column, message] of errors) {
@@ -13202,8 +13326,8 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13202
13326
  const unknown = /^unknown type name '(\w+)'$/.exec(message);
13203
13327
  if ((unknown || message === "expected a type") && file && line && column) {
13204
13328
  const token = tokenAt(file, Number(line), Number(column));
13205
- const name2 = unknown?.[1] ?? token?.name;
13206
- if (name2) learn(name2, typeKind(name2, token?.name === name2 ? token.after : ""));
13329
+ const name3 = unknown?.[1] ?? token?.name;
13330
+ if (name3) learn(name3, typeKind(name3, token?.name === name3 ? token.after : ""));
13207
13331
  }
13208
13332
  }
13209
13333
  if (!progress || round === ROUNDS)
@@ -13212,7 +13336,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13212
13336
  );
13213
13337
  if (missing.size > 0) declareMissing();
13214
13338
  }
13215
- const graphs = import_node_fs11.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs11.default.readFileSync(import_node_path13.default.join(out, name2), "utf8")));
13339
+ const graphs = import_node_fs11.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs11.default.readFileSync(import_node_path13.default.join(out, name3), "utf8")));
13216
13340
  const imports = /* @__PURE__ */ new Set(["Foundation", "UIKit"]);
13217
13341
  for (const text4 of originals.values())
13218
13342
  for (const match of text4.matchAll(
@@ -13304,8 +13428,8 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work) {
13304
13428
  walk2(inner);
13305
13429
  };
13306
13430
  walk2(JSON.parse(run3.stdout));
13307
- for (const [id, name2] of wanted) {
13308
- const value = constants.get(name2);
13431
+ for (const [id, name3] of wanted) {
13432
+ const value = constants.get(name3);
13309
13433
  if (value !== void 0) values.set(id, value.toString());
13310
13434
  }
13311
13435
  return values;
@@ -13483,7 +13607,7 @@ function compileObjcPeerMetadata(args) {
13483
13607
  const emitted = [...symbols.stdout.matchAll(/^\._OBJC_CLASS_(\w+) [^U] /gm)].map(
13484
13608
  (match) => match[1]
13485
13609
  );
13486
- if (emitted.length !== names.size || !emitted.every((name2) => names.has(name2)) || /^\._OBJC_CLASS_\w+ U(?: |$)/m.test(symbols.stdout) || /^_[ic]_\w+/m.test(symbols.stdout))
13610
+ if (emitted.length !== names.size || !emitted.every((name3) => names.has(name3)) || /^\._OBJC_CLASS_\w+ U(?: |$)/m.test(symbols.stdout) || /^_[ic]_\w+/m.test(symbols.stdout))
13487
13611
  throw new ObjcPeerMetadataError(
13488
13612
  `Objective-C peer metadata contains unexpected classes or methods: ${receipt}`,
13489
13613
  files2,
@@ -13516,10 +13640,10 @@ function swiftCommand() {
13516
13640
  var cacheDir3 = import_node_path15.default.join(cacheDir(), "swift-manifests");
13517
13641
  var evaluated = /* @__PURE__ */ new Map();
13518
13642
  function dump(dir) {
13519
- const manifests = import_node_fs13.default.readdirSync(dir).filter((name2) => /^Package(@swift-[\d.]+)?\.swift$/.test(name2)).sort();
13643
+ const manifests = import_node_fs13.default.readdirSync(dir).filter((name3) => /^Package(@swift-[\d.]+)?\.swift$/.test(name3)).sort();
13520
13644
  const command = swiftCommand();
13521
13645
  const key2 = (0, import_node_crypto10.createHash)("sha256").update(JSON.stringify([command, import_node_path15.default.resolve(dir)])).update(
13522
- manifests.map((name2) => `${name2}\0${import_node_fs13.default.readFileSync(import_node_path15.default.join(dir, name2), "utf8")}`).join("\0")
13646
+ manifests.map((name3) => `${name3}\0${import_node_fs13.default.readFileSync(import_node_path15.default.join(dir, name3), "utf8")}`).join("\0")
13523
13647
  ).digest("hex").slice(0, 32);
13524
13648
  const cached2 = import_node_path15.default.join(cacheDir3, `${key2}.json`);
13525
13649
  if (import_node_fs13.default.existsSync(cached2))
@@ -13560,16 +13684,16 @@ function defaultTraits(manifest) {
13560
13684
  const traits = new Map(
13561
13685
  array(manifest.traits).map((trait) => [
13562
13686
  string(record(trait).name) ?? "",
13563
- array(record(trait).enabledTraits).flatMap((name2) => string(name2) ?? [])
13687
+ array(record(trait).enabledTraits).flatMap((name3) => string(name3) ?? [])
13564
13688
  ])
13565
13689
  );
13566
13690
  const enabled = /* @__PURE__ */ new Set();
13567
13691
  const pending = [...traits.get("default") ?? []];
13568
13692
  while (pending.length > 0) {
13569
- const name2 = pending.pop();
13570
- if (enabled.has(name2)) continue;
13571
- enabled.add(name2);
13572
- pending.push(...traits.get(name2) ?? []);
13693
+ const name3 = pending.pop();
13694
+ if (enabled.has(name3)) continue;
13695
+ enabled.add(name3);
13696
+ pending.push(...traits.get(name3) ?? []);
13573
13697
  }
13574
13698
  return enabled;
13575
13699
  }
@@ -13578,7 +13702,7 @@ function linksOnIOS(condition, traits) {
13578
13702
  const platforms = array(platformNames);
13579
13703
  if (platforms.length > 0 && !platforms.includes("ios")) return false;
13580
13704
  const gates = array(needed);
13581
- return gates.length === 0 || gates.some((name2) => traits.has(string(name2) ?? ""));
13705
+ return gates.length === 0 || gates.some((name3) => traits.has(string(name3) ?? ""));
13582
13706
  }
13583
13707
  function swiftPackageManifest(dir) {
13584
13708
  dir = import_node_fs13.default.realpathSync(dir);
@@ -13613,10 +13737,10 @@ function swiftPackageManifest(dir) {
13613
13737
  }
13614
13738
  const products = /* @__PURE__ */ new Map();
13615
13739
  for (const product of array(raw2.products)) {
13616
- const { name: name3, targets: targets2, type } = record(product);
13617
- if (!string(name3) || !("library" in record(type))) continue;
13740
+ const { name: name4, targets: targets2, type } = record(product);
13741
+ if (!string(name4) || !("library" in record(type))) continue;
13618
13742
  products.set(
13619
- string(name3),
13743
+ string(name4),
13620
13744
  array(targets2).flatMap((target) => string(target) ?? [])
13621
13745
  );
13622
13746
  }
@@ -13624,12 +13748,12 @@ function swiftPackageManifest(dir) {
13624
13748
  const names = new Set(array(raw2.targets).map((target) => string(record(target).name)));
13625
13749
  for (const entry of array(raw2.targets)) {
13626
13750
  const target = record(entry);
13627
- const name3 = string(target.name);
13751
+ const name4 = string(target.name);
13628
13752
  const kind = string(target.type);
13629
- if (!name3 || !isTargetType(kind)) continue;
13753
+ if (!name4 || !isTargetType(kind)) continue;
13630
13754
  const declared = string(target.path);
13631
13755
  const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
13632
- const targetDir = declared ? import_node_path15.default.resolve(dir, declared) : roots.map((root) => import_node_path15.default.join(dir, root, name3)).find((candidate) => import_node_fs13.default.existsSync(candidate)) ?? import_node_path15.default.join(dir, roots[0], name3);
13756
+ const targetDir = declared ? import_node_path15.default.resolve(dir, declared) : roots.map((root) => import_node_path15.default.join(dir, root, name4)).find((candidate) => import_node_fs13.default.existsSync(candidate)) ?? import_node_path15.default.join(dir, roots[0], name4);
13633
13757
  const dependencies = [];
13634
13758
  for (const dependency of array(target.dependencies)) {
13635
13759
  const { target: local, product, byName } = record(dependency);
@@ -13677,7 +13801,7 @@ function swiftPackageManifest(dir) {
13677
13801
  const flags = header ? ["-I", import_node_path15.default.resolve(targetDir, header)] : definition ? [`-D${definition}${value === void 0 ? "" : `=${value}`}`] : disabledWarning !== void 0 ? [`-Wno-${disabledWarning}`] : Array.isArray(unsafe) ? unsafe.flatMap((flag) => string(flag) ?? []) : null;
13678
13802
  if (!flags)
13679
13803
  throw new Error(
13680
- `${name3}: unsupported ${tool} compiler setting ${JSON.stringify(rawKind)}`
13804
+ `${name4}: unsupported ${tool} compiler setting ${JSON.stringify(rawKind)}`
13681
13805
  );
13682
13806
  nativeSettings.push({
13683
13807
  tool,
@@ -13707,8 +13831,8 @@ function swiftPackageManifest(dir) {
13707
13831
  });
13708
13832
  }
13709
13833
  }
13710
- targets.set(name3, {
13711
- name: name3,
13834
+ targets.set(name4, {
13835
+ name: name4,
13712
13836
  type: kind,
13713
13837
  dir: targetDir,
13714
13838
  sources: target.sources == null ? null : array(target.sources).flatMap((file) => string(file) ?? []),
@@ -13725,9 +13849,9 @@ function swiftPackageManifest(dir) {
13725
13849
  checksum: string(target.checksum) ?? null
13726
13850
  });
13727
13851
  }
13728
- const name2 = string(raw2.name);
13729
- if (!name2) throw new Error(`swiftpm returned no package name for ${dir}`);
13730
- const manifest = { name: name2, dir, products, targets, packages };
13852
+ const name3 = string(raw2.name);
13853
+ if (!name3) throw new Error(`swiftpm returned no package name for ${dir}`);
13854
+ const manifest = { name: name3, dir, products, targets, packages };
13731
13855
  evaluated.set(key2, manifest);
13732
13856
  return manifest;
13733
13857
  }
@@ -13859,18 +13983,18 @@ function resolveSwiftPackages(options) {
13859
13983
  };
13860
13984
  const targets = /* @__PURE__ */ new Map();
13861
13985
  const targetOutcomes = /* @__PURE__ */ new Map();
13862
- const resolveTarget = (pkg, name2) => {
13863
- const key2 = `${pkg.manifest.dir}\0${name2}`;
13986
+ const resolveTarget = (pkg, name3) => {
13987
+ const key2 = `${pkg.manifest.dir}\0${name3}`;
13864
13988
  if (targetOutcomes.has(key2)) return targetOutcomes.get(key2);
13865
13989
  targetOutcomes.set(key2, []);
13866
13990
  const outcome = (() => {
13867
- if (provided.has(name2)) return [];
13868
- const target = pkg.manifest.targets.get(name2);
13991
+ if (provided.has(name3)) return [];
13992
+ const target = pkg.manifest.targets.get(name3);
13869
13993
  if (!target)
13870
- return [`${import_node_path16.default.basename(pkg.manifest.dir)} declares no target ${name2}`];
13994
+ return [`${import_node_path16.default.basename(pkg.manifest.dir)} declares no target ${name3}`];
13871
13995
  const files2 = target.type === "regular" || target.type === "system" ? swiftTargetFiles(pkg.manifest, target) : [];
13872
- const gap = options.binaryGaps?.get(name2);
13873
- const ownReason = target.type === "binary" ? `${name2} ${BINARY}${gap ? `; ${gap}` : ""}` : target.type !== "regular" && target.type !== "system" ? `${name2} is a ${target.type} target` : files2.some((file) => UNSUPPORTED_NATIVE.test(file)) ? `${name2} is an Objective-C or assembly target${gap ? `; ${gap}` : ""}` : null;
13996
+ const gap = options.binaryGaps?.get(name3);
13997
+ const ownReason = target.type === "binary" ? `${name3} ${BINARY}${gap ? `; ${gap}` : ""}` : target.type !== "regular" && target.type !== "system" ? `${name3} is a ${target.type} target` : files2.some((file) => UNSUPPORTED_NATIVE.test(file)) ? `${name3} is an Objective-C or assembly target${gap ? `; ${gap}` : ""}` : null;
13874
13998
  const reasons = target.dependencies.map((dependency) => {
13875
13999
  if (dependency.kind === "target") return resolveTarget(pkg, dependency.name);
13876
14000
  const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
@@ -13879,8 +14003,8 @@ function resolveSwiftPackages(options) {
13879
14003
  const blocked = blockers([ownReason ? [ownReason] : [], ...reasons]);
13880
14004
  if (blocked.length > 0) return blocked;
13881
14005
  const relative = files2.map((file) => import_node_path16.default.relative(target.dir, file));
13882
- targets.set(`${pkg.manifest.dir}\0${name2}`, {
13883
- name: name2,
14006
+ targets.set(`${pkg.manifest.dir}\0${name3}`, {
14007
+ name: name3,
13884
14008
  path: "",
13885
14009
  dir: target.dir,
13886
14010
  files: files2,
@@ -13894,9 +14018,9 @@ function resolveSwiftPackages(options) {
13894
14018
  const source = pkg.manifest.packages.get(dependency.package);
13895
14019
  const nested = source && packages.get("dir" in source ? import_node_path16.default.resolve(source.dir) : source.url);
13896
14020
  return nested && typeof nested !== "string" ? (nested.manifest.products.get(dependency.name) ?? []).map(
13897
- (name3) => ({
14021
+ (name4) => ({
13898
14022
  kind: "target",
13899
- name: name3
14023
+ name: name4
13900
14024
  })
13901
14025
  ) : [];
13902
14026
  }),
@@ -13915,7 +14039,7 @@ function resolveSwiftPackages(options) {
13915
14039
  const resolveProduct = (pkg, product) => {
13916
14040
  if (provided.has(product)) return [];
13917
14041
  const roots = pkg.manifest.products.get(product);
13918
- const reason = !roots ? [`${import_node_path16.default.basename(pkg.manifest.dir)} has no library ${product}`] : blockers(roots.map((name2) => resolveTarget(pkg, name2)));
14042
+ const reason = !roots ? [`${import_node_path16.default.basename(pkg.manifest.dir)} has no library ${product}`] : blockers(roots.map((name3) => resolveTarget(pkg, name3)));
13919
14043
  productOutcomes.set(`${pkg.manifest.dir}\0${product}`, { pkg, reason });
13920
14044
  return reason;
13921
14045
  };
@@ -13946,14 +14070,14 @@ function resolveSwiftPackages(options) {
13946
14070
  }
13947
14071
  for (const pkg of packages.values()) {
13948
14072
  if (typeof pkg === "string") continue;
13949
- for (const [name2, target] of pkg.manifest.targets) {
14073
+ for (const [name3, target] of pkg.manifest.targets) {
13950
14074
  if (target.type === "test" || target.type === "plugin" || target.type === "macro")
13951
14075
  continue;
13952
14076
  if (target.type === "executable") continue;
13953
14077
  const objc = target.type === "regular" && swiftTargetFiles(pkg.manifest, target).some((file) => /\.(m|mm)$/.test(file));
13954
14078
  if (target.type === "binary" || objc)
13955
14079
  result.binaries.push({
13956
- target: name2,
14080
+ target: name3,
13957
14081
  source: pkg.source,
13958
14082
  url: target.url,
13959
14083
  checksum: target.checksum,
@@ -13966,9 +14090,9 @@ function resolveSwiftPackages(options) {
13966
14090
  )
13967
14091
  } : {}
13968
14092
  });
13969
- const reason = resolveTarget(pkg, name2);
13970
- if (reason.length > 0 && !result.modules.has(name2))
13971
- result.modules.set(name2, { source: pkg.source, reason: reason.join("; ") });
14093
+ const reason = resolveTarget(pkg, name3);
14094
+ if (reason.length > 0 && !result.modules.has(name3))
14095
+ result.modules.set(name3, { source: pkg.source, reason: reason.join("; ") });
13972
14096
  }
13973
14097
  }
13974
14098
  for (const [key2, { pkg, reason }] of productOutcomes) {
@@ -13977,11 +14101,11 @@ function resolveSwiftPackages(options) {
13977
14101
  result.modules.set(product, { source: pkg.source, reason: reason.join("; ") });
13978
14102
  }
13979
14103
  const reached = /* @__PURE__ */ new Set();
13980
- const reach = (pkg, name2) => {
13981
- const key2 = `${pkg.manifest.dir}\0${name2}`;
14104
+ const reach = (pkg, name3) => {
14105
+ const key2 = `${pkg.manifest.dir}\0${name3}`;
13982
14106
  if (reached.has(key2)) return;
13983
14107
  reached.add(key2);
13984
- for (const dependency of pkg.manifest.targets.get(name2)?.dependencies ?? []) {
14108
+ for (const dependency of pkg.manifest.targets.get(name3)?.dependencies ?? []) {
13985
14109
  if (dependency.kind === "target") reach(pkg, dependency.name);
13986
14110
  else {
13987
14111
  const source = pkg.manifest.packages.get(dependency.package);
@@ -14008,11 +14132,11 @@ function resolveSwiftPackages(options) {
14008
14132
  if (!pkg || typeof pkg === "string") continue;
14009
14133
  const headers = /* @__PURE__ */ new Map();
14010
14134
  const visited = /* @__PURE__ */ new Set();
14011
- const visit = (owner, name2) => {
14012
- const key2 = `${owner.manifest.dir}\0${name2}`;
14135
+ const visit = (owner, name3) => {
14136
+ const key2 = `${owner.manifest.dir}\0${name3}`;
14013
14137
  if (visited.has(key2)) return;
14014
14138
  visited.add(key2);
14015
- const target = owner.manifest.targets.get(name2);
14139
+ const target = owner.manifest.targets.get(name3);
14016
14140
  if (!target) return;
14017
14141
  const dir = import_node_path16.default.join(target.dir, target.publicHeadersPath);
14018
14142
  for (const dependency of target.dependencies) {
@@ -14025,8 +14149,8 @@ function resolveSwiftPackages(options) {
14025
14149
  visit(nested, root);
14026
14150
  }
14027
14151
  }
14028
- if (name2 !== binary.target && import_node_fs14.default.existsSync(dir))
14029
- headers.set(name2, import_node_path16.default.relative(binary.dir, dir));
14152
+ if (name3 !== binary.target && import_node_fs14.default.existsSync(dir))
14153
+ headers.set(name3, import_node_path16.default.relative(binary.dir, dir));
14030
14154
  };
14031
14155
  visit(pkg, binary.target);
14032
14156
  binary.headerDependencies = [...headers].map(([module2, path22]) => ({ module: module2, path: path22 }));
@@ -14089,6 +14213,15 @@ function compileXcodeObjCImplementations(app, binaries, moduleRoot) {
14089
14213
  `Objective-C implementations compiled, but linking their original method bodies requires the canonical Swift framework object bridge. No implementation was replaced. Inputs and objects: ${prepared.receipt}`
14090
14214
  );
14091
14215
  }
14216
+ function linkedStat(file) {
14217
+ try {
14218
+ return import_node_fs16.default.statSync(file);
14219
+ } catch (error) {
14220
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
14221
+ throw error;
14222
+ }
14223
+ }
14224
+ var isSdkInclude = (file) => file === "/usr/include" || file.startsWith("/usr/include/");
14092
14225
  function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
14093
14226
  if (peers) validateObjcPeerClasses(peers);
14094
14227
  const toolchain = swiftModuleToolchain(moduleRoot);
@@ -14109,13 +14242,22 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
14109
14242
  )
14110
14243
  );
14111
14244
  };
14245
+ const walked = /* @__PURE__ */ new Set();
14246
+ const ancestors = /* @__PURE__ */ new Set();
14112
14247
  const addHeaders = (directory) => {
14248
+ const real = import_node_fs16.default.realpathSync(directory);
14249
+ if (walked.has(directory) || ancestors.has(real)) return;
14250
+ walked.add(directory);
14251
+ ancestors.add(real);
14113
14252
  for (const entry of import_node_fs16.default.readdirSync(directory, { withFileTypes: true })) {
14114
- if (entry.isDirectory() && entry.name.startsWith(".")) continue;
14253
+ if (entry.name.startsWith(".") && !entry.isFile()) continue;
14115
14254
  const file = import_node_path18.default.join(directory, entry.name);
14116
- if (entry.isDirectory()) addHeaders(file);
14255
+ const linked = entry.isSymbolicLink() ? linkedStat(file) : null;
14256
+ if (entry.isSymbolicLink() && !linked) continue;
14257
+ if (entry.isDirectory() || linked?.isDirectory()) addHeaders(file);
14117
14258
  else if (/\.(h|hh|hpp|hxx|inc|inl|modulemap)$/.test(entry.name)) add(file, true);
14118
14259
  }
14260
+ ancestors.delete(real);
14119
14261
  };
14120
14262
  const targets = [];
14121
14263
  const configuration = app.configuration === "Debug" ? "debug" : "release";
@@ -14179,6 +14321,11 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
14179
14321
  )
14180
14322
  ])
14181
14323
  add(file, true);
14324
+ for (const directory of [
14325
+ ...target.objc.headerSearchPaths,
14326
+ ...target.objc.frameworkSearchPaths
14327
+ ])
14328
+ if (!isSdkInclude(directory) && import_node_fs16.default.existsSync(directory)) addHeaders(directory);
14182
14329
  targets.push({
14183
14330
  name: target.moduleName,
14184
14331
  deploymentTarget: target.iosDeploymentTarget,
@@ -14282,16 +14429,16 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
14282
14429
  }
14283
14430
  import_node_fs16.default.mkdirSync(work);
14284
14431
  const staged = (file) => {
14285
- for (const { root, name: name2 } of [
14432
+ for (const { root, name: name3 } of [
14286
14433
  { root: checkouts, name: "packages" },
14287
14434
  { root: app.rootDir, name: "project" }
14288
14435
  ]) {
14289
14436
  const relative = import_node_path18.default.relative(root, file);
14290
14437
  if (relative !== ".." && !relative.startsWith(`..${import_node_path18.default.sep}`) && !import_node_path18.default.isAbsolute(relative))
14291
- return import_node_path18.default.join(work, name2, relative);
14438
+ return import_node_path18.default.join(work, name3, relative);
14292
14439
  }
14293
- if (file.startsWith("/usr/include/"))
14294
- return import_node_path18.default.join(sdk.sysroot, "include", file.slice("/usr/include/".length));
14440
+ if (isSdkInclude(file))
14441
+ return import_node_path18.default.join(sdk.sysroot, "include", file.slice("/usr/include".length));
14295
14442
  throw new Error(
14296
14443
  `Objective-C compiler input is outside the project and its pinned packages: ${file}`
14297
14444
  );
@@ -14672,8 +14819,8 @@ function emitSwiftStandin(graphs, options) {
14672
14819
  const parts = fallback.split(".");
14673
14820
  const module2 = parts[0] === "SwiftUICore" ? "SwiftUI" : parts[0];
14674
14821
  const unqualified = parts.slice(1).join(".") || parts[0];
14675
- const name2 = family.has(parts[0]) && parts[0] !== "SwiftUICore" ? parts.join(".") : unqualified;
14676
- return { name: name2, module: module2, local: false };
14822
+ const name3 = family.has(parts[0]) && parts[0] !== "SwiftUICore" ? parts.join(".") : unqualified;
14823
+ return { name: name3, module: module2, local: false };
14677
14824
  };
14678
14825
  const nsObject = nameOf("c:objc(cs)NSObject", "ObjectiveC.NSObject").name;
14679
14826
  const nsObjectProtocol = nameOf(
@@ -14694,8 +14841,8 @@ function emitSwiftStandin(graphs, options) {
14694
14841
  ...all(edge.source)
14695
14842
  ]);
14696
14843
  } else if (edge.targetFallback) {
14697
- const name2 = nameOf(edge.target, edge.targetFallback).name;
14698
- external.set(name2, [...external.get(name2) ?? [], ...all(edge.source)]);
14844
+ const name3 = nameOf(edge.target, edge.targetFallback).name;
14845
+ external.set(name3, [...external.get(name3) ?? [], ...all(edge.source)]);
14699
14846
  owner.set(edge.source, edge.target);
14700
14847
  }
14701
14848
  break;
@@ -14709,9 +14856,9 @@ function emitSwiftStandin(graphs, options) {
14709
14856
  case "conformsTo": {
14710
14857
  const target = nameOf(edge.target, edge.targetFallback);
14711
14858
  const kept = KEEP_EXTERNAL.get(edge.target);
14712
- const name2 = kept ?? (target && (target.local || family.has(target.module ?? "")) ? target.name : null);
14713
- if (name2)
14714
- conforms.set(edge.source, [...conforms.get(edge.source) ?? [], name2]);
14859
+ const name3 = kept ?? (target && (target.local || family.has(target.module ?? "")) ? target.name : null);
14860
+ if (name3)
14861
+ conforms.set(edge.source, [...conforms.get(edge.source) ?? [], name3]);
14715
14862
  if (byId.has(edge.target)) {
14716
14863
  const map = source.kind.identifier === "swift.protocol" ? protocolParents : conformIds;
14717
14864
  map.set(edge.source, [...map.get(edge.source) ?? [], edge.target]);
@@ -14957,13 +15104,13 @@ function emitSwiftStandin(graphs, options) {
14957
15104
  if (blocked) return void skipped.push({ path: path22, reason: blocked });
14958
15105
  const ancestors = /* @__PURE__ */ new Set();
14959
15106
  for (let at = superId.get(id); at; at = superId.get(at))
14960
- for (const name2 of conforms.get(at) ?? []) ancestors.add(name2);
15107
+ for (const name3 of conforms.get(at) ?? []) ancestors.add(name3);
14961
15108
  const list2 = [
14962
15109
  ...parent ? [parent] : [],
14963
15110
  ...(conforms.get(id) ?? []).filter(
14964
- (name2) => !ancestors.has(name2) && !(parent && [...KEEP_EXTERNAL.values()].includes(name2)) && !(name2 === nsObjectProtocol && externalRoot(id) === nsObject)
15111
+ (name3) => !ancestors.has(name3) && !(parent && [...KEEP_EXTERNAL.values()].includes(name3)) && !(name3 === nsObjectProtocol && externalRoot(id) === nsObject)
14965
15112
  )
14966
- ].filter((name2, at, all2) => all2.indexOf(name2) === at);
15113
+ ].filter((name3, at, all2) => all2.indexOf(name3) === at);
14967
15114
  const parentSymbol = superId.has(id) ? byId.get(superId.get(id)) : void 0;
14968
15115
  const open = symbol.accessLevel === "open" && (!parentSymbol || parentSymbol.accessLevel === "open");
14969
15116
  emit(
@@ -15084,7 +15231,7 @@ function emitSwiftStandin(graphs, options) {
15084
15231
  reason: `no header value for ${missing.map(leaf).join(", ")}`
15085
15232
  });
15086
15233
  const list2 = inheritance(id, raw2 ?? void 0).filter(
15087
- (name2) => !raw2 || name2 !== "RawRepresentable"
15234
+ (name3) => !raw2 || name3 !== "RawRepresentable"
15088
15235
  );
15089
15236
  emit(
15090
15237
  `${indent}${shape.attrs}public enum ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${shape.where} {`
@@ -15225,7 +15372,7 @@ function emitSwiftStandin(graphs, options) {
15225
15372
  if (TYPE_KINDS.has(symbol.kind.identifier)) emitType(symbol, "");
15226
15373
  else emitGlobal(symbol);
15227
15374
  }
15228
- for (const [name2, members] of [...external].sort(([a], [b]) => a.localeCompare(b))) {
15375
+ for (const [name3, members] of [...external].sort(([a], [b]) => a.localeCompare(b))) {
15229
15376
  const seen = /* @__PURE__ */ new Set();
15230
15377
  const kept = members.filter((member) => {
15231
15378
  const key2 = `${member.kind.identifier}|${text3(member)}`;
@@ -15234,7 +15381,7 @@ function emitSwiftStandin(graphs, options) {
15234
15381
  return true;
15235
15382
  });
15236
15383
  if (kept.length === 0) continue;
15237
- emit(`extension ${name2} {`);
15384
+ emit(`extension ${name3} {`);
15238
15385
  for (const member of kept)
15239
15386
  if (member.kind.identifier === "swift.init" && !text3(member).startsWith("convenience"))
15240
15387
  emitMember(
@@ -15258,7 +15405,7 @@ function emitSwiftStandin(graphs, options) {
15258
15405
  `// stand-in for the binary ${options.module} module, generated from ${options.source}.`,
15259
15406
  options.inert ? "// generated from public headers; native behavior is inert in peach." : "// unconfigured bodies trap because the vendor binary cannot run in peach.",
15260
15407
  "",
15261
- ...imports.map((name2) => `import ${name2}`),
15408
+ ...imports.map((name3) => `import ${name3}`),
15262
15409
  ""
15263
15410
  ];
15264
15411
  for (const path22 of behavior.keys())
@@ -15306,7 +15453,7 @@ var KEYWORDS = /* @__PURE__ */ new Set([
15306
15453
  "false",
15307
15454
  "nil"
15308
15455
  ]);
15309
- var tick = (name2) => KEYWORDS.has(name2) ? `\`${name2}\`` : name2;
15456
+ var tick = (name3) => KEYWORDS.has(name3) ? `\`${name3}\`` : name3;
15310
15457
  function stripDefaults(decl) {
15311
15458
  let out = "";
15312
15459
  let depth = 0;
@@ -15374,16 +15521,16 @@ function treeDigest(root) {
15374
15521
  ancestors.delete(resolved);
15375
15522
  };
15376
15523
  walk2(root);
15377
- const stamp = names.map((name2) => {
15378
- const stat = import_node_fs19.default.statSync(import_node_path19.default.join(root, name2));
15379
- return `${name2}\0${stat.size}:${stat.mtimeMs}`;
15524
+ const stamp = names.map((name3) => {
15525
+ const stat = import_node_fs19.default.statSync(import_node_path19.default.join(root, name3));
15526
+ return `${name3}\0${stat.size}:${stat.mtimeMs}`;
15380
15527
  }).join("\n");
15381
15528
  const memo2 = digests.get(`tree\0${root}`);
15382
15529
  if (memo2?.stamp === stamp) return memo2.digest;
15383
15530
  const hash = (0, import_node_crypto13.createHash)("sha256");
15384
- for (const name2 of names) {
15385
- hash.update(`${name2}\0`);
15386
- hash.update(import_node_fs19.default.readFileSync(import_node_path19.default.join(root, name2)));
15531
+ for (const name3 of names) {
15532
+ hash.update(`${name3}\0`);
15533
+ hash.update(import_node_fs19.default.readFileSync(import_node_path19.default.join(root, name3)));
15387
15534
  hash.update("\0");
15388
15535
  }
15389
15536
  const digest = hash.digest("hex");
@@ -15462,13 +15609,13 @@ function xcframework(binary) {
15462
15609
  var files = (dir, test) => import_node_fs19.default.existsSync(dir) ? import_node_fs19.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => test(import_node_path19.default.basename(file))).sort() : [];
15463
15610
  var OBJC = /^\s*(?:@interface|@protocol|@class|@import|#import)\b/m;
15464
15611
  function headerSurface(module2, modulemap, headers) {
15465
- const objc = files(headers, (name2) => name2.endsWith(".h")).some(
15612
+ const objc = files(headers, (name3) => name3.endsWith(".h")).some(
15466
15613
  (file) => OBJC.test(import_node_fs19.default.readFileSync(import_node_path19.default.join(headers, file), "utf8"))
15467
15614
  );
15468
15615
  return objc ? { kind: "objc", module: module2, modulemap, headers } : { kind: "c", module: module2, modulemap, headers };
15469
15616
  }
15470
15617
  function surfaces(xcframeworkDir) {
15471
- const slice = import_node_fs19.default.readdirSync(xcframeworkDir).filter((name2) => /^ios-.+-simulator$/.test(name2)).sort()[0];
15618
+ const slice = import_node_fs19.default.readdirSync(xcframeworkDir).filter((name3) => /^ios-.+-simulator$/.test(name3)).sort()[0];
15472
15619
  const plain = !slice && xcframeworkDir.endsWith(".framework");
15473
15620
  if (!slice && !plain) throw new Error("it has no iOS simulator slice");
15474
15621
  const root = plain ? import_node_path19.default.dirname(xcframeworkDir) : import_node_path19.default.join(xcframeworkDir, slice);
@@ -15480,9 +15627,9 @@ function surfaces(xcframeworkDir) {
15480
15627
  const swiftmodule = import_node_path19.default.join(framework, "Modules", `${module2}.swiftmodule`);
15481
15628
  const interfaces = files(
15482
15629
  swiftmodule,
15483
- (name2) => name2.endsWith(".swiftinterface") && !name2.endsWith(".private.swiftinterface") && !name2.endsWith(".package.swiftinterface")
15630
+ (name3) => name3.endsWith(".swiftinterface") && !name3.endsWith(".private.swiftinterface") && !name3.endsWith(".package.swiftinterface")
15484
15631
  );
15485
- const chosen = interfaces.find((name2) => name2.startsWith("arm64-")) ?? interfaces[0] ?? null;
15632
+ const chosen = interfaces.find((name3) => name3.startsWith("arm64-")) ?? interfaces[0] ?? null;
15486
15633
  const modulemap = import_node_path19.default.join(framework, "Modules", "module.modulemap");
15487
15634
  if (chosen) {
15488
15635
  const file = import_node_path19.default.join(swiftmodule, chosen);
@@ -15506,7 +15653,7 @@ function surfaces(xcframeworkDir) {
15506
15653
  found.push(headerSurface(module2, modulemap, import_node_path19.default.join(framework, "Headers")));
15507
15654
  }
15508
15655
  const headers = import_node_path19.default.join(root, "Headers");
15509
- for (const map of files(headers, (name2) => name2 === "module.modulemap")) {
15656
+ for (const map of files(headers, (name3) => name3 === "module.modulemap")) {
15510
15657
  const modulemap = import_node_path19.default.join(headers, map);
15511
15658
  const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs19.default.readFileSync(modulemap, "utf8"))?.[1];
15512
15659
  if (module2) found.push(headerSurface(module2, modulemap, import_node_path19.default.dirname(modulemap)));
@@ -15523,7 +15670,7 @@ function peachModuleDirs(toolchain, imports) {
15523
15670
  if (swiftDistributionAt(moduleRoot)) return [import_node_path19.default.join(moduleRoot, "modules")];
15524
15671
  const peach = new Set(swiftPeachModules(moduleRoot));
15525
15672
  const targets = [.../* @__PURE__ */ new Set([...STANDIN_IMPORTS, ...imports])].filter(
15526
- (name2) => peach.has(name2)
15673
+ (name3) => peach.has(name3)
15527
15674
  );
15528
15675
  const plugins = swiftMacroPlugins(moduleRoot);
15529
15676
  if (plugins.stale)
@@ -15564,8 +15711,8 @@ function peachModuleDirs(toolchain, imports) {
15564
15711
  return [
15565
15712
  import_node_path19.default.join(release, "Modules"),
15566
15713
  ...import_node_fs19.default.readdirSync(release).filter(
15567
- (name2) => name2.endsWith(".build") && import_node_fs19.default.existsSync(import_node_path19.default.join(release, name2, "module.modulemap"))
15568
- ).sort().map((name2) => import_node_path19.default.join(release, name2))
15714
+ (name3) => name3.endsWith(".build") && import_node_fs19.default.existsSync(import_node_path19.default.join(release, name3, "module.modulemap"))
15715
+ ).sort().map((name3) => import_node_path19.default.join(release, name3))
15569
15716
  ];
15570
15717
  }
15571
15718
  function swiftInterfaceForWasm(text4) {
@@ -15576,7 +15723,7 @@ function swiftInterfaceForWasm(text4) {
15576
15723
  const foundation = rooted !== text4 && !/^import[ \t]+Foundation\b/m.test(rooted) ? rooted.replace(/^(?=import[ \t])/m, "import Foundation\n") : rooted;
15577
15724
  return foundation.replace(
15578
15725
  /^(\/\/ swift-module-flags:.*)$/m,
15579
- (flags) => flags.replace(/-target \S+/, `-target ${TRIPLE}`).replace(/\s-enable-objc-interop\b/, "").replace(/\s-target-variant \S+/, "") + ` ${WASI_EMULATION.map((name2) => `-Xcc -D${name2}`).join(" ")}`
15726
+ (flags) => flags.replace(/-target \S+/, `-target ${TRIPLE}`).replace(/\s-enable-objc-interop\b/, "").replace(/\s-target-variant \S+/, "") + ` ${WASI_EMULATION.map((name3) => `-Xcc -D${name3}`).join(" ")}`
15580
15727
  ).replace(
15581
15728
  /@(?:objc(?:\s*\([^()]*\))?|objcMembers|nonobjc|IBOutlet|IBAction|IBInspectable|IBDesignable|_objcRuntimeName\([^()]*\))(?![\w(])/g,
15582
15729
  ""
@@ -15605,7 +15752,7 @@ function swiftStandin(surface, binary, toolchain, work, behavior, siblings) {
15605
15752
  "-output-dir",
15606
15753
  out
15607
15754
  ]);
15608
- const graphs = import_node_fs19.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs19.default.readFileSync(import_node_path19.default.join(out, name2), "utf8")));
15755
+ const graphs = import_node_fs19.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs19.default.readFileSync(import_node_path19.default.join(out, name3), "utf8")));
15609
15756
  return graphStandin(
15610
15757
  surface.module,
15611
15758
  graphs,
@@ -15651,7 +15798,7 @@ function wasmFlags(toolchain, imports) {
15651
15798
  "-resource-dir",
15652
15799
  resources,
15653
15800
  // the sdk toolset's emulation defines, which raw swiftc does not read
15654
- ...WASI_EMULATION.flatMap((name2) => ["-Xcc", `-D${name2}`]),
15801
+ ...WASI_EMULATION.flatMap((name3) => ["-Xcc", `-D${name3}`]),
15655
15802
  ...peachModuleDirs(toolchain, imports).flatMap((dir) => ["-I", dir]),
15656
15803
  ...toolchain.standinModules ? ["-I", toolchain.standinModules] : []
15657
15804
  ];
@@ -15684,10 +15831,10 @@ function graphStandin(module2, graphs, values, wasm, binary, toolchain, work, be
15684
15831
  (graph) => graph.symbols.map((symbol) => symbol.pathComponents.join("."))
15685
15832
  )
15686
15833
  );
15687
- for (const name2 of behavior.keys()) {
15688
- if (!paths.has(name2))
15834
+ for (const name3 of behavior.keys()) {
15835
+ if (!paths.has(name3))
15689
15836
  throw new Error(
15690
- `Configured Swift behavior ${module2}.${name2} is not in the SDK surface`
15837
+ `Configured Swift behavior ${module2}.${name3} is not in the SDK surface`
15691
15838
  );
15692
15839
  }
15693
15840
  const omit = /* @__PURE__ */ new Map();
@@ -15872,7 +16019,7 @@ function cStandin(surface, binary, toolchain, work) {
15872
16019
  const named = [
15873
16020
  ...import_node_fs19.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
15874
16021
  ].map((match) => match[1]);
15875
- const headers = files(surface.headers, (name2) => name2.endsWith(".h"));
16022
+ const headers = files(surface.headers, (name3) => name3.endsWith(".h"));
15876
16023
  const texts = new Map(
15877
16024
  headers.map((file) => [
15878
16025
  file,
@@ -15995,7 +16142,7 @@ var UNSEARCHED = /* @__PURE__ */ new Set([
15995
16142
  ".git",
15996
16143
  "DerivedData"
15997
16144
  ]);
15998
- function crateFor(root, name2) {
16145
+ function crateFor(root, name3) {
15999
16146
  const walk2 = (dir, depth) => {
16000
16147
  const manifest = import_node_path19.default.join(dir, "Cargo.toml");
16001
16148
  if (import_node_fs19.default.existsSync(manifest)) {
@@ -16006,10 +16153,10 @@ function crateFor(root, name2) {
16006
16153
  const field = (body, key2) => new RegExp(`^${key2}\\s*=\\s*"([^"]+)"`, "m").exec(body)?.[1];
16007
16154
  const lib = section("lib");
16008
16155
  const crate = field(lib, "name") ?? field(section("package"), "name")?.replaceAll("-", "_");
16009
- if (crate === name2) {
16156
+ if (crate === name3) {
16010
16157
  if (!/crate-type\s*=\s*\[[^\]]*"staticlib"/.test(lib))
16011
16158
  throw new Error(
16012
- `${import_node_path19.default.relative(root, manifest)} builds lib${name2} without crate-type "staticlib"`
16159
+ `${import_node_path19.default.relative(root, manifest)} builds lib${name3} without crate-type "staticlib"`
16013
16160
  );
16014
16161
  return manifest;
16015
16162
  }
@@ -16031,7 +16178,7 @@ function simulatorLibraryName(dir) {
16031
16178
  if (!Array.isArray(libraries)) return void 0;
16032
16179
  return libraries.filter(
16033
16180
  (entry) => typeof entry === "object" && entry !== null && Reflect.get(entry, "SupportedPlatform") === "ios" && Reflect.get(entry, "SupportedPlatformVariant") === "simulator"
16034
- ).map((entry) => Reflect.get(entry, "LibraryPath")).find((name2) => typeof name2 === "string" && /^lib.+\.a$/.test(name2));
16181
+ ).map((entry) => Reflect.get(entry, "LibraryPath")).find((name3) => typeof name3 === "string" && /^lib.+\.a$/.test(name3));
16035
16182
  }
16036
16183
  function standinLibrary(binary, searchRoot) {
16037
16184
  if (binary.publicHeaders !== void 0) return null;
@@ -16039,7 +16186,7 @@ function standinLibrary(binary, searchRoot) {
16039
16186
  const library = simulatorLibraryName(dir);
16040
16187
  const supplied = import_node_path19.default.join(dir, RUST_TARGET);
16041
16188
  if (import_node_fs19.default.existsSync(supplied)) {
16042
- const found = import_node_fs19.default.readdirSync(supplied).filter((name2) => name2.endsWith(".a"));
16189
+ const found = import_node_fs19.default.readdirSync(supplied).filter((name3) => name3.endsWith(".a"));
16043
16190
  const chosen = library && found.includes(library) ? library : found.length === 1 ? found[0] : null;
16044
16191
  if (!chosen)
16045
16192
  throw new Error(
@@ -16243,12 +16390,12 @@ function readStandinResults(receipt, generation, targets) {
16243
16390
  if (!Array.isArray(entry.result))
16244
16391
  throw new Error("invalid Swift stand-in builder result");
16245
16392
  for (const item of entry.result) {
16246
- if (!isRecord(item) || typeof item.module !== "string" || item.target !== entry.target || !isRecord(item.files) || !Object.values(item.files).every((text4) => typeof text4 === "string") || item.dependencies !== void 0 && (!Array.isArray(item.dependencies) || !item.dependencies.every((name2) => typeof name2 === "string")))
16393
+ if (!isRecord(item) || typeof item.module !== "string" || item.target !== entry.target || !isRecord(item.files) || !Object.values(item.files).every((text4) => typeof text4 === "string") || item.dependencies !== void 0 && (!Array.isArray(item.dependencies) || !item.dependencies.every((name3) => typeof name3 === "string")))
16247
16394
  throw new Error("invalid Swift stand-in builder result");
16248
16395
  const files2 = {};
16249
- for (const [name2, text4] of Object.entries(item.files)) {
16396
+ for (const [name3, text4] of Object.entries(item.files)) {
16250
16397
  if (typeof text4 !== "string") throw new Error("invalid Swift stand-in file");
16251
- files2[name2] = text4;
16398
+ files2[name3] = text4;
16252
16399
  }
16253
16400
  standins.push({
16254
16401
  module: item.module,
@@ -16285,13 +16432,13 @@ function standinGenerationInputs(binaries, toolchain, behavior = {}) {
16285
16432
  }
16286
16433
  })
16287
16434
  );
16288
- const selected = Object.keys(behavior).filter((name2) => modules.has(name2)).sort();
16435
+ const selected = Object.keys(behavior).filter((name3) => modules.has(name3)).sort();
16289
16436
  if (selected.length > 0)
16290
16437
  parts.push(
16291
16438
  JSON.stringify(
16292
- selected.map((name2) => [
16293
- name2,
16294
- Object.keys(behavior[name2]).sort().map((member) => [member, behavior[name2][member]])
16439
+ selected.map((name3) => [
16440
+ name3,
16441
+ Object.keys(behavior[name3]).sort().map((member) => [member, behavior[name3][member]])
16295
16442
  ])
16296
16443
  )
16297
16444
  );
@@ -16341,7 +16488,7 @@ function binaryStandins(binary, toolchain, provided, behavior, frameworks, sibli
16341
16488
  const module2 = swiftTargetModuleName(binary.target);
16342
16489
  const modulemap = import_node_path19.default.join(work, "module.modulemap");
16343
16490
  const supplied = import_node_path19.default.join(headers, "module.modulemap");
16344
- const roots = files(headers, (name2) => name2.endsWith(".h"));
16491
+ const roots = files(headers, (name3) => name3.endsWith(".h"));
16345
16492
  if (roots.length === 0)
16346
16493
  throw new Error("its public header directory has no headers");
16347
16494
  import_node_fs19.default.writeFileSync(
@@ -16397,7 +16544,7 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
16397
16544
  for (const file of surface.kind === "swift" ? [surface.interface] : [
16398
16545
  ...surface.kind === "mixed" ? [surface.interface] : [],
16399
16546
  surface.modulemap,
16400
- ...files(surface.headers, (name2) => name2.endsWith(".h")).map(
16547
+ ...files(surface.headers, (name3) => name3.endsWith(".h")).map(
16401
16548
  (file2) => import_node_path19.default.join(surface.headers, file2)
16402
16549
  )
16403
16550
  ])
@@ -16614,9 +16761,9 @@ function swiftNativeEntry(native, file) {
16614
16761
  packageId: native.packageId,
16615
16762
  contractHash: native.hash,
16616
16763
  modules: Object.fromEntries(
16617
- (native.files[file] ?? []).filter((name2) => Object.hasOwn(native.modules, name2)).map((name2) => [name2, native.modules[name2]])
16764
+ (native.files[file] ?? []).filter((name3) => Object.hasOwn(native.modules, name3)).map((name3) => [name3, native.modules[name3]])
16618
16765
  ),
16619
- views: (native.files[file] ?? []).filter((name2) => Object.hasOwn(native.views, name2)),
16766
+ views: (native.files[file] ?? []).filter((name3) => Object.hasOwn(native.views, name3)),
16620
16767
  defaultView: native.defaultViewFiles.includes(file)
16621
16768
  };
16622
16769
  }
@@ -16665,7 +16812,7 @@ function isSwiftNativeModules(value) {
16665
16812
  ...Object.values(value.modules),
16666
16813
  ...Object.values(value.views)
16667
16814
  ].every(
16668
- (names) => Array.isArray(names) && names.every((name2) => typeof name2 === "string")
16815
+ (names) => Array.isArray(names) && names.every((name3) => typeof name3 === "string")
16669
16816
  ) && Array.isArray(value.defaultViewFiles) && value.defaultViewFiles.every((file) => typeof file === "string");
16670
16817
  }
16671
16818
  function isSwiftCompileOutcome(value) {
@@ -16691,8 +16838,8 @@ function compileAssetUrl(value, origin) {
16691
16838
  }
16692
16839
  function resolveImageUrls(urls, origin) {
16693
16840
  const resolved = {};
16694
- for (const [name2, url] of Object.entries(urls)) {
16695
- resolved[name2] = compileAssetUrl(url, origin);
16841
+ for (const [name3, url] of Object.entries(urls)) {
16842
+ resolved[name3] = compileAssetUrl(url, origin);
16696
16843
  }
16697
16844
  return resolved;
16698
16845
  }
@@ -16783,7 +16930,7 @@ function nativeSourceDescriptor(packagePath) {
16783
16930
  }
16784
16931
  function nativeSourceFiles(packagePath) {
16785
16932
  packagePath = import_node_fs20.default.realpathSync(packagePath);
16786
- return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name2) => import_node_path20.default.join(packagePath, name2)).filter((file) => import_node_fs20.default.existsSync(file));
16933
+ return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name3) => import_node_path20.default.join(packagePath, name3)).filter((file) => import_node_fs20.default.existsSync(file));
16787
16934
  }
16788
16935
  var SwiftMissingModulesError = class extends Error {
16789
16936
  };
@@ -16848,9 +16995,9 @@ function swiftPackages(entry, app) {
16848
16995
  ))
16849
16996
  compileXcodeObjCImplementations(app, cached2.binaries, entry.moduleRoot);
16850
16997
  const vendored = app.binaryFrameworks.flatMap(
16851
- ({ name: name2, path: dir }) => dir ? [
16998
+ ({ name: name3, path: dir }) => dir ? [
16852
16999
  {
16853
- target: name2,
17000
+ target: name3,
16854
17001
  source: "the project",
16855
17002
  url: null,
16856
17003
  checksum: null,
@@ -16975,7 +17122,7 @@ ${implementations.map((file) => ` ${file}`).join("\n")}`
16975
17122
  targets.push({
16976
17123
  name: standin.module,
16977
17124
  path: import_node_path20.default.posix.join(SWIFT_STANDINS_DIR, standin.module),
16978
- dependencies: standin.dependencies?.map((name2) => ({ kind: "target", name: name2 })),
17125
+ dependencies: standin.dependencies?.map((name3) => ({ kind: "target", name: name3 })),
16979
17126
  executable: false,
16980
17127
  resources: false,
16981
17128
  exclude: [],
@@ -17034,9 +17181,9 @@ function xcodeManifest(layout) {
17034
17181
  const settings = (target) => `swiftSettings: [${[
17035
17182
  `.swiftLanguageMode(.v${target.languageMode})`,
17036
17183
  ...target.mainActorIsolation ? [".defaultIsolation(MainActor.self)"] : [],
17037
- ...(target.defines ?? []).map((name2) => `.define(${JSON.stringify(name2)})`)
17184
+ ...(target.defines ?? []).map((name3) => `.define(${JSON.stringify(name3)})`)
17038
17185
  ].join(", ")}]`;
17039
- const libraries = (target) => target.linkedLibraries?.length ? `, linkerSettings: [${target.linkedLibraries.map((name2) => `.linkedLibrary(${JSON.stringify(name2)})`).join(", ")}]` : "";
17186
+ const libraries = (target) => target.linkedLibraries?.length ? `, linkerSettings: [${target.linkedLibraries.map((name3) => `.linkedLibrary(${JSON.stringify(name3)})`).join(", ")}]` : "";
17040
17187
  return [
17041
17188
  "// swift-tools-version: 6.2",
17042
17189
  "import PackageDescription",
@@ -17219,7 +17366,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
17219
17366
  registered.set(`${sha256}.metal`, { bytes, contentType: "text/plain; charset=utf-8" });
17220
17367
  }
17221
17368
  let imageBytes = 0;
17222
- for (const { name: name2, file, scale, bundlePath } of found) {
17369
+ for (const { name: name3, file, scale, bundlePath } of found) {
17223
17370
  const disk = byRelative.get(file);
17224
17371
  if (!disk) continue;
17225
17372
  if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs20.default.statSync(disk).size > limits.imageTotalBytes) {
@@ -17230,7 +17377,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
17230
17377
  const hash = (0, import_node_crypto14.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
17231
17378
  const ext = import_node_path20.default.posix.extname(file).toLowerCase();
17232
17379
  const bundle = table[bundlePath] ?? /* @__PURE__ */ Object.create(null);
17233
- const variants = bundle[name2] ??= [];
17380
+ const variants = bundle[name3] ??= [];
17234
17381
  variants.push({ uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale });
17235
17382
  table[bundlePath] = bundle;
17236
17383
  const key2 = layout ? xcodeInputKey(layout, disk, file) : file;
@@ -17311,10 +17458,10 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs) {
17311
17458
  const bytes = readPackageFile2(packagePath, disk, limits.resourceBytes);
17312
17459
  addFile(bundlePath === "." ? base : `${bundlePath}/${base}`, bytes);
17313
17460
  if (base.endsWith(".xcstrings")) {
17314
- for (const [name2, table] of Object.entries(
17461
+ for (const [name3, table] of Object.entries(
17315
17462
  compileStringCatalog(bytes.toString("utf8"), base.slice(0, -10))
17316
17463
  )) {
17317
- addFile(bundlePath === "." ? name2 : `${bundlePath}/${name2}`, Buffer.from(table));
17464
+ addFile(bundlePath === "." ? name3 : `${bundlePath}/${name3}`, Buffer.from(table));
17318
17465
  }
17319
17466
  }
17320
17467
  }
@@ -17635,10 +17782,10 @@ var IOS_SDK_FRAMEWORKS = new Set(ios_sdk_frameworks_default.frameworks);
17635
17782
  async function missingModulesMessage(packagePath, missing) {
17636
17783
  const layout = xcodeLayout(packagePath);
17637
17784
  const gaps = new Map([
17638
- ...(layout?.app.binaryFrameworks ?? []).map(({ name: name2 }) => {
17639
- const gap = layout?.projectGaps.get(name2);
17785
+ ...(layout?.app.binaryFrameworks ?? []).map(({ name: name3 }) => {
17786
+ const gap = layout?.projectGaps.get(name3);
17640
17787
  return [
17641
- name2,
17788
+ name3,
17642
17789
  {
17643
17790
  source: "the project",
17644
17791
  reason: `a vendored binary framework${gap ? `; no stand-in: ${gap}` : ""}`
@@ -17646,9 +17793,9 @@ async function missingModulesMessage(packagePath, missing) {
17646
17793
  ];
17647
17794
  }),
17648
17795
  ...[...missing.keys()].flatMap(
17649
- (name2) => IOS_SDK_FRAMEWORKS.has(name2) ? [
17796
+ (name3) => IOS_SDK_FRAMEWORKS.has(name3) ? [
17650
17797
  [
17651
- name2,
17798
+ name3,
17652
17799
  { source: "the iOS SDK", reason: "a framework Peach does not provide" }
17653
17800
  ]
17654
17801
  ] : []
@@ -17657,28 +17804,28 @@ async function missingModulesMessage(packagePath, missing) {
17657
17804
  ...layout?.packages.unavailable ?? []
17658
17805
  ]);
17659
17806
  const packaged = new Set(
17660
- [...missing.keys()].filter((name2) => !IOS_SDK_FRAMEWORKS.has(name2))
17807
+ [...missing.keys()].filter((name3) => !IOS_SDK_FRAMEWORKS.has(name3))
17661
17808
  );
17662
17809
  if (packaged.size > 0)
17663
17810
  await Promise.all(
17664
17811
  (layout?.packages.binaries ?? []).map(async (binary) => {
17665
17812
  const modules = await swiftBinaryModules(binary).catch(() => []);
17666
- for (const name2 of modules)
17667
- if (packaged.has(name2))
17668
- gaps.set(name2, {
17813
+ for (const name3 of modules)
17814
+ if (packaged.has(name3))
17815
+ gaps.set(name3, {
17669
17816
  source: binary.source,
17670
17817
  reason: layout?.packages.modules.get(binary.target)?.reason ?? `${binary.target} is a binary framework`
17671
17818
  });
17672
17819
  })
17673
17820
  );
17674
- const width = Math.max(...[...missing.keys()].map((name2) => name2.length));
17821
+ const width = Math.max(...[...missing.keys()].map((name3) => name3.length));
17675
17822
  const opened = xcodeProjects.get(packagePath)?.xcodeproj;
17676
17823
  const workspace = opened?.endsWith(".xcodeproj") ? enclosingXcodeWorkspace(opened) : null;
17677
17824
  return [
17678
17825
  `Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
17679
- ...[...missing].map(([name2, files2]) => {
17680
- const gap = gaps.get(name2);
17681
- return ` ${name2.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path20.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
17826
+ ...[...missing].map(([name3, files2]) => {
17827
+ const gap = gaps.get(name3);
17828
+ return ` ${name3.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path20.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
17682
17829
  }),
17683
17830
  ...workspace ? [
17684
17831
  `${import_node_path20.default.basename(opened)} is part of ${import_node_path20.default.relative(process.cwd(), workspace)}, which holds its local packages and Package.resolved pins; pass the workspace to build what Xcode builds there.`
@@ -18076,14 +18223,14 @@ async function readOneWidgetSources(appRoot) {
18076
18223
  };
18077
18224
  const files2 = /* @__PURE__ */ new Map();
18078
18225
  const sources = {};
18079
- for (const [name2, file] of Object.entries(sourceFiles2)) {
18226
+ for (const [name3, file] of Object.entries(sourceFiles2)) {
18080
18227
  if (!import_node_fs21.default.existsSync(file))
18081
18228
  throw new Error(`missing One widget prebuild source ${file}; run one prebuild`);
18082
18229
  const bytes = readPackageFile(root, file, MAX_SWIFT_COMPILE_SOURCE_BYTES);
18083
18230
  const text4 = bytes.toString("utf8");
18084
18231
  if (!Buffer.from(text4).equals(bytes))
18085
18232
  throw new Error(`One widget prebuild source is not UTF-8: ${file}`);
18086
- files2.set(name2, text4);
18233
+ files2.set(name3, text4);
18087
18234
  sources[import_node_path21.default.relative(root, file).split(import_node_path21.default.sep).join("/")] = (0, import_node_crypto15.createHash)("sha256").update(bytes).digest("hex");
18088
18235
  }
18089
18236
  const contract = files2.get("OneWidgetContract.swift") ?? "";