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") {
@@ -358,7 +358,7 @@ function isLoopbackHost(hostname) {
358
358
  }
359
359
  function isContrastBackendHost(hostname) {
360
360
  const normalized = normalizeHostname(hostname);
361
- return isLoopbackHost(normalized) || normalized === "contrast.dev" || normalized.endsWith(".contrast.dev") || normalized === PEACHSIM_NATIVE_HOST;
361
+ return isLoopbackHost(normalized) || normalized === "contrast.dev" || normalized.endsWith(".contrast.dev") || normalized === "peachsim.com" || normalized === "www.peachsim.com" || normalized === PEACHSIM_NATIVE_HOST;
362
362
  }
363
363
  function resolveContrastBackendOrigin(currentOrigin, search) {
364
364
  const origin = new URLSearchParams(search ?? "").get("backend")?.trim() || currentOrigin?.trim();
@@ -374,7 +374,7 @@ var DEFAULT_CONTRAST_BACKEND_ORIGIN, PEACHSIM_NATIVE_HOST;
374
374
  var init_backend_origin = __esm({
375
375
  "src/backend-origin.ts"() {
376
376
  "use strict";
377
- DEFAULT_CONTRAST_BACKEND_ORIGIN = "https://contrast.dev";
377
+ DEFAULT_CONTRAST_BACKEND_ORIGIN = "https://peachsim.com";
378
378
  PEACHSIM_NATIVE_HOST = "native.peachsim.com";
379
379
  }
380
380
  });
@@ -395,33 +395,33 @@ function findBundleFooter(source, prefix) {
395
395
  function isFooterBlockLine(source, line, end) {
396
396
  return line === end || source.startsWith("globalThis.", line) || source.startsWith("//", line);
397
397
  }
398
- function readFooter(source, prefix, suffix, name2) {
398
+ function readFooter(source, prefix, suffix, name3) {
399
399
  const start = findBundleFooter(source, prefix);
400
400
  if (start < 0) return null;
401
401
  const end = source.indexOf("\n", start + 1);
402
402
  const line = source.slice(start + 1, end < 0 ? void 0 : end);
403
- if (!line.endsWith(suffix)) throw new Error(`${name2} footer is truncated`);
403
+ if (!line.endsWith(suffix)) throw new Error(`${name3} footer is truncated`);
404
404
  const value = JSON.parse(
405
405
  line.slice(prefix.length, suffix ? -suffix.length : void 0)
406
406
  );
407
- if (value === null) throw new Error(`${name2} footer has no metadata`);
407
+ if (value === null) throw new Error(`${name3} footer has no metadata`);
408
408
  return value;
409
409
  }
410
- function detachFooter(source, prefix, suffix, name2) {
410
+ function detachFooter(source, prefix, suffix, name3) {
411
411
  const start = findBundleFooter(source, prefix);
412
412
  if (start < 0) return { source, value: null };
413
- const value = readFooter(source, prefix, suffix, name2);
413
+ const value = readFooter(source, prefix, suffix, name3);
414
414
  const end = source.indexOf("\n", start + 1);
415
415
  return { source: source.slice(0, start) + (end < 0 ? "" : source.slice(end)), value };
416
416
  }
417
- function insertBundleGlobalFooter(source, name2, value) {
418
- return insertFooter(source, `globalThis.${name2}=`, ";", name2, value);
417
+ function insertBundleGlobalFooter(source, name3, value) {
418
+ return insertFooter(source, `globalThis.${name3}=`, ";", name3, value);
419
419
  }
420
- function insertBundleMetadataFooter(source, name2, value) {
421
- return insertFooter(source, `// peach.${name2}=`, "", name2, value);
420
+ function insertBundleMetadataFooter(source, name3, value) {
421
+ return insertFooter(source, `// peach.${name3}=`, "", name3, value);
422
422
  }
423
- function insertFooter(source, prefix, suffix, name2, value) {
424
- source = detachFooter(source, prefix, suffix, name2).source;
423
+ function insertFooter(source, prefix, suffix, name3, value) {
424
+ source = detachFooter(source, prefix, suffix, name3).source;
425
425
  const json = JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
426
426
  const footer = `
427
427
  ${prefix}${json}${suffix}`;
@@ -502,9 +502,9 @@ function cacheDir() {
502
502
  }
503
503
  function swiftPackageCacheOptions() {
504
504
  const root = import_node_path2.default.join(cacheDir(), "swiftpm");
505
- return ["cache", "config", "security"].flatMap((name2) => [
506
- `--${name2}-path`,
507
- import_node_path2.default.join(root, name2)
505
+ return ["cache", "config", "security"].flatMap((name3) => [
506
+ `--${name3}-path`,
507
+ import_node_path2.default.join(root, name3)
508
508
  ]);
509
509
  }
510
510
  var import_node_os2, import_node_path2, PEACH_HOME_ENV, DAEMON_LOCKFILE_MAX_BYTES;
@@ -882,7 +882,7 @@ function designTimeDiagnostic(output, files2) {
882
882
  const rewritten = /* @__PURE__ */ new Map();
883
883
  const linesOf = (path25) => {
884
884
  const file = Object.keys(files2).find(
885
- (name2) => name2.endsWith(".swift") && (path25 === name2 || path25.endsWith(`/${name2}`))
885
+ (name3) => name3.endsWith(".swift") && (path25 === name3 || path25.endsWith(`/${name3}`))
886
886
  );
887
887
  if (file === void 0) return null;
888
888
  let lines = rewritten.get(file);
@@ -1078,10 +1078,10 @@ function peachHome() {
1078
1078
  function confineSwiftScratch(root) {
1079
1079
  if (scratch) return;
1080
1080
  import_node_fs2.default.mkdirSync(root, { recursive: true });
1081
- for (const name2 of import_node_fs2.default.readdirSync(root)) {
1082
- const pid = Number(name2);
1081
+ for (const name3 of import_node_fs2.default.readdirSync(root)) {
1082
+ const pid = Number(name3);
1083
1083
  if (Number.isInteger(pid) && pid > 0 && !processRuns(pid))
1084
- import_node_fs2.default.rmSync(import_node_path3.default.join(root, name2), { recursive: true, force: true });
1084
+ import_node_fs2.default.rmSync(import_node_path3.default.join(root, name3), { recursive: true, force: true });
1085
1085
  }
1086
1086
  const dir = import_node_path3.default.join(root, String(process.pid));
1087
1087
  import_node_fs2.default.mkdirSync(dir, { recursive: true });
@@ -1093,11 +1093,11 @@ function confineSwiftScratch(root) {
1093
1093
  const seeded = import_node_path3.default.join(import_node_os3.default.homedir(), ".swiftpm");
1094
1094
  const dirAbsentBefore = lstatIfKnown(seeded) === null;
1095
1095
  const absentBefore = swiftpmSeeds.filter(
1096
- (name2) => lstatIfKnown(import_node_path3.default.join(seeded, name2)) === null
1096
+ (name3) => lstatIfKnown(import_node_path3.default.join(seeded, name3)) === null
1097
1097
  );
1098
1098
  process.once("exit", () => {
1099
1099
  import_node_fs2.default.rmSync(dir, { recursive: true, force: true });
1100
- for (const name2 of absentBefore) removeSwiftpmSeed(import_node_path3.default.join(seeded, name2), name2);
1100
+ for (const name3 of absentBefore) removeSwiftpmSeed(import_node_path3.default.join(seeded, name3), name3);
1101
1101
  if (dirAbsentBefore && lstatIfKnown(seeded)?.isDirectory())
1102
1102
  try {
1103
1103
  import_node_fs2.default.rmdirSync(seeded);
@@ -1113,11 +1113,11 @@ function lstatIfKnown(entry) {
1113
1113
  return void 0;
1114
1114
  }
1115
1115
  }
1116
- function removeSwiftpmSeed(entry, name2) {
1116
+ function removeSwiftpmSeed(entry, name3) {
1117
1117
  const stat = lstatIfKnown(entry);
1118
1118
  if (!stat) return;
1119
1119
  try {
1120
- if (name2 === "cache") {
1120
+ if (name3 === "cache") {
1121
1121
  if (stat.isSymbolicLink() && import_node_fs2.default.readlinkSync(entry).endsWith("/.cache/org.swift.swiftpm"))
1122
1122
  import_node_fs2.default.unlinkSync(entry);
1123
1123
  } else if (stat.isDirectory()) {
@@ -1205,7 +1205,7 @@ function swiftSdkPayloadChecksum(bundle) {
1205
1205
  hash.update(JSON.stringify([relative, "link", import_node_fs2.default.readlinkSync(file)]) + "\n");
1206
1206
  } else if (stat.isDirectory()) {
1207
1207
  hash.update(JSON.stringify([relative, "directory"]) + "\n");
1208
- for (const name2 of import_node_fs2.default.readdirSync(file).sort()) visit(import_node_path3.default.join(relative, name2));
1208
+ for (const name3 of import_node_fs2.default.readdirSync(file).sort()) visit(import_node_path3.default.join(relative, name3));
1209
1209
  } else if (stat.isFile()) {
1210
1210
  const stamp = [stat.dev, stat.ino, stat.size, stat.mtimeNs, stat.ctimeNs].join(":");
1211
1211
  let cached2 = sdkFileHashes.get(file);
@@ -1432,12 +1432,12 @@ function swiftCompilerInstall(release) {
1432
1432
  };
1433
1433
  }
1434
1434
  const platform = `debian12${process.arch === "arm64" ? "-aarch64" : ""}`;
1435
- const name2 = `${release}-${platform}`;
1435
+ const name3 = `${release}-${platform}`;
1436
1436
  return {
1437
1437
  note: " (Debian 12 shown; other distributions: https://www.swift.org/install/linux/)",
1438
1438
  commands: [
1439
- `curl -fsSL ${downloads}/${platform}/${release}/${name2}.tar.gz | tar -xz -C /opt`,
1440
- `export PATH=/opt/${name2}/usr/bin:$PATH`
1439
+ `curl -fsSL ${downloads}/${platform}/${release}/${name3}.tar.gz | tar -xz -C /opt`,
1440
+ `export PATH=/opt/${name3}/usr/bin:$PATH`
1441
1441
  ]
1442
1442
  };
1443
1443
  }
@@ -1527,7 +1527,7 @@ async function load(toolchainBin, sdk) {
1527
1527
  icuSegment(archiveMember((0, import_node_fs3.readFileSync)(import_node_path4.default.join(resources, ARCHIVE)), MEMBER))
1528
1528
  );
1529
1529
  }
1530
- function archiveMember(archive, name2) {
1530
+ function archiveMember(archive, name3) {
1531
1531
  if (archive.toString("latin1", 0, 8) !== "!<arch>\n")
1532
1532
  throw new Error("swift-icu: not an ar archive");
1533
1533
  let names = "";
@@ -1537,10 +1537,10 @@ function archiveMember(archive, name2) {
1537
1537
  const body = archive.subarray(at + 60, at + 60 + size);
1538
1538
  if (raw2 === "//") names = body.toString("latin1");
1539
1539
  const member = /^\/\d+$/.test(raw2) ? names.slice(Number(raw2.slice(1)), names.indexOf("/\n", Number(raw2.slice(1)))) : raw2.replace(/\/$/, "");
1540
- if (member === name2) return body;
1540
+ if (member === name3) return body;
1541
1541
  at += 60 + size + size % 2;
1542
1542
  }
1543
- throw new Error(`swift-icu: ${name2} is not in the sdk's icu archive`);
1543
+ throw new Error(`swift-icu: ${name3} is not in the sdk's icu archive`);
1544
1544
  }
1545
1545
  function icuSegment(object2) {
1546
1546
  let at = 8;
@@ -1681,8 +1681,8 @@ function splitManifestArguments(source) {
1681
1681
  if (final) arguments_.push(final);
1682
1682
  return arguments_;
1683
1683
  }
1684
- function swiftTargetModuleName(name2) {
1685
- return name2.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
1684
+ function swiftTargetModuleName(name3) {
1685
+ return name3.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
1686
1686
  }
1687
1687
  function swiftPackageIdentity(url) {
1688
1688
  return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
@@ -1697,16 +1697,16 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
1697
1697
  ]);
1698
1698
  const targetNames = new Set(
1699
1699
  declarations.flatMap(({ flat }) => {
1700
- const name2 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
1701
- return name2 ? [name2] : [];
1700
+ const name3 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
1701
+ return name3 ? [name3] : [];
1702
1702
  })
1703
1703
  );
1704
1704
  for (const { kind, flat, call } of declarations) {
1705
1705
  const executable = kind === "executableTarget";
1706
- const name2 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
1707
- if (!name2) continue;
1706
+ const name3 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
1707
+ if (!name3) continue;
1708
1708
  const rawPath = /\bpath\s*:\s*"([^"]*)"/.exec(flat)?.[1];
1709
- const targetPath = rawPath == null || rawPath === "" ? `Sources/${name2}` : rawPath.replace(/^\.\//, "").replace(/\/+$/, "");
1709
+ const targetPath = rawPath == null || rawPath === "" ? `Sources/${name3}` : rawPath.replace(/^\.\//, "").replace(/\/+$/, "");
1710
1710
  const languageMode = Number(
1711
1711
  /\.swiftLanguageMode\(\s*\.v(\d+)\s*\)/.exec(call)?.[1] ?? "5"
1712
1712
  );
@@ -1746,12 +1746,12 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
1746
1746
  dependencyNames.add(dependencyName);
1747
1747
  }
1748
1748
  }
1749
- const dependencies = [...dependencyNames].map((name3) => ({
1749
+ const dependencies = [...dependencyNames].map((name4) => ({
1750
1750
  kind: "target",
1751
- name: name3
1751
+ name: name4
1752
1752
  }));
1753
1753
  targets.push({
1754
- name: name2,
1754
+ name: name3,
1755
1755
  path: targetPath,
1756
1756
  executable,
1757
1757
  ...kind === "systemLibrary" ? { systemLibrary: true } : {},
@@ -1799,8 +1799,8 @@ function swiftResourceBundleForFile(bundles, file) {
1799
1799
  return owner;
1800
1800
  }
1801
1801
  function swiftResourceBundleInfoPlist(bundle) {
1802
- const name2 = bundle.path.split("/").pop().replace(/\.(bundle|framework)$/, "");
1803
- const escaped = name2.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
1802
+ const name3 = bundle.path.split("/").pop().replace(/\.(bundle|framework)$/, "");
1803
+ const escaped = name3.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
1804
1804
  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>`;
1805
1805
  }
1806
1806
  function swiftMetalSourceFiles(files2) {
@@ -1860,38 +1860,54 @@ var init_swift_package = __esm({
1860
1860
  });
1861
1861
 
1862
1862
  // src/swift-root-lock.ts
1863
- function processStart(pid) {
1864
- try {
1865
- return (0, import_node_child_process5.execFileSync)("ps", ["-o", "lstart=", "-p", String(pid)], {
1866
- encoding: "utf8",
1867
- stdio: ["ignore", "pipe", "ignore"]
1868
- }).trim() || null;
1869
- } catch {
1870
- return null;
1871
- }
1863
+ function errorCode(error) {
1864
+ return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : void 0;
1872
1865
  }
1873
- function parseHolder(text4) {
1874
- try {
1875
- const value = JSON.parse(text4);
1876
- if (value && typeof value === "object" && "pid" in value && typeof value.pid === "number" && "start" in value && (typeof value.start === "string" || value.start === null))
1877
- return { pid: value.pid, start: value.start };
1878
- } catch {
1879
- }
1880
- return null;
1866
+ function parseStart(text4) {
1867
+ const start = Date.parse(`${text4} UTC`);
1868
+ if (Number.isNaN(start)) throw new Error(`unreadable process start time "${text4}"`);
1869
+ return start;
1881
1870
  }
1882
- function readLock(lock) {
1883
- try {
1884
- return (0, import_node_fs4.readFileSync)(lock, "utf8");
1885
- } catch (error) {
1886
- if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
1887
- throw error;
1871
+ function processTable() {
1872
+ const result = (0, import_node_child_process5.spawnSync)("ps", ["-A", "-o", "pid=,pgid=,stat=,lstart="], {
1873
+ encoding: "utf8",
1874
+ env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
1875
+ stdio: ["ignore", "pipe", "pipe"],
1876
+ timeout: 1e4,
1877
+ killSignal: "SIGKILL"
1878
+ });
1879
+ if (result.error || result.status !== 0) {
1880
+ throw new Error(
1881
+ `swift root lock cannot read the process table: ${result.error?.message || result.stderr.trim() || `ps exited ${result.status}`}`
1882
+ );
1888
1883
  }
1884
+ return result.stdout.split("\n").filter((line) => line.trim()).map((line) => {
1885
+ const match = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+(.+?)\s*$/.exec(line);
1886
+ if (!match)
1887
+ throw new Error(`swift root lock cannot parse a process table row: ${line}`);
1888
+ return {
1889
+ pid: Number(match[1]),
1890
+ pgid: Number(match[2]),
1891
+ zombie: match[3].startsWith("Z"),
1892
+ start: parseStart(match[4])
1893
+ };
1894
+ });
1889
1895
  }
1890
- function holderAlive(text4) {
1891
- const holder = parseHolder(text4);
1892
- if (!holder) return false;
1893
- const start = processStart(holder.pid);
1894
- return start !== null && start === holder.start;
1896
+ function sameProcess(row, identity) {
1897
+ return row.pid === identity.pid && Math.abs(row.start - identity.start) <= START_TOLERANCE_MS;
1898
+ }
1899
+ function ownIdentity(pid) {
1900
+ const row = processTable().find(
1901
+ (candidate) => candidate.pid === pid && !candidate.zombie
1902
+ );
1903
+ if (!row) throw new Error(`swift root lock cannot find process ${pid}`);
1904
+ return { pid, start: row.start };
1905
+ }
1906
+ function parseIdentity(text4) {
1907
+ const value = JSON.parse(text4);
1908
+ if (value && typeof value === "object" && "pid" in value && typeof value.pid === "number" && "start" in value && typeof value.start === "number")
1909
+ return { pid: value.pid, start: value.start };
1910
+ throw new Error(`swift root lock record is not a process identity: ${text4}`);
1895
1911
  }
1896
1912
  function pause(ms, signal) {
1897
1913
  return new Promise((resolve3) => {
@@ -1904,67 +1920,129 @@ function pause(ms, signal) {
1904
1920
  signal?.addEventListener("abort", done, { once: true });
1905
1921
  });
1906
1922
  }
1923
+ function generationNumbers(directory) {
1924
+ const numbers = /* @__PURE__ */ new Set();
1925
+ for (const entry of (0, import_node_fs4.readdirSync)(directory)) {
1926
+ const match = /^(\d{12})\./.exec(entry);
1927
+ if (match) numbers.add(Number(match[1]));
1928
+ }
1929
+ return [...numbers].sort((a, b) => a - b);
1930
+ }
1931
+ function readGeneration(directory, number) {
1932
+ let owner;
1933
+ try {
1934
+ owner = (0, import_node_fs4.readFileSync)(import_node_path5.default.join(directory, name(number, "owner")), "utf8");
1935
+ } catch (error) {
1936
+ if (errorCode(error) === "ENOENT") return null;
1937
+ throw error;
1938
+ }
1939
+ return {
1940
+ number,
1941
+ holder: parseIdentity(owner),
1942
+ released: (0, import_node_fs4.readdirSync)(directory).includes(name(number, "released"))
1943
+ };
1944
+ }
1945
+ function readChildren(directory, number) {
1946
+ const prefix = name(number, "child.");
1947
+ 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")));
1948
+ }
1949
+ function groupAlive(table, leader) {
1950
+ const row = table.find((candidate) => candidate.pid === leader.pid);
1951
+ if (row && !sameProcess(row, leader)) return false;
1952
+ return table.some((candidate) => candidate.pgid === leader.pid && !candidate.zombie);
1953
+ }
1907
1954
  async function withSwiftRootLock(root, work, signal) {
1908
- const directory = import_node_path5.default.join(rnxHomeDir(), "cache", "swift-root-locks");
1909
- (0, import_node_fs4.mkdirSync)(directory, { recursive: true });
1910
- const lock = import_node_path5.default.join(
1911
- directory,
1912
- `${(0, import_node_crypto3.createHash)("sha256").update(root).digest("hex").slice(0, 32)}.lock`
1955
+ const directory = import_node_path5.default.join(
1956
+ rnxHomeDir(),
1957
+ "cache",
1958
+ "swift-root-locks",
1959
+ (0, import_node_crypto3.createHash)("sha256").update(root).digest("hex").slice(0, 32)
1913
1960
  );
1961
+ (0, import_node_fs4.mkdirSync)(directory, { recursive: true });
1914
1962
  const token = (0, import_node_crypto3.randomUUID)();
1915
- const owner = JSON.stringify({
1916
- pid: process.pid,
1917
- start: processStart(process.pid),
1918
- token
1919
- });
1920
- const pending = `${lock}.${token}`;
1921
- (0, import_node_fs4.writeFileSync)(pending, owner);
1922
- try {
1923
- for (; ; ) {
1924
- signal?.throwIfAborted();
1925
- try {
1926
- (0, import_node_fs4.linkSync)(pending, lock);
1927
- break;
1928
- } catch (error) {
1929
- if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
1930
- throw error;
1963
+ const owner = JSON.stringify(ownIdentity(process.pid));
1964
+ const pending = import_node_path5.default.join(directory, `pending.${token}`);
1965
+ let held = 0;
1966
+ for (; ; ) {
1967
+ signal?.throwIfAborted();
1968
+ const newest = generationNumbers(directory).at(-1) ?? 0;
1969
+ const current = newest > 0 ? readGeneration(directory, newest) : null;
1970
+ if (newest > 0 && !current) continue;
1971
+ if (current && !current.released) {
1972
+ const table = processTable();
1973
+ if (table.some((row) => !row.zombie && sameProcess(row, current.holder))) {
1974
+ await pause(POLL_MS, signal);
1975
+ continue;
1931
1976
  }
1932
- const held = readLock(lock);
1933
- if (held === null) continue;
1934
- if (holderAlive(held)) {
1977
+ const children2 = readChildren(directory, newest);
1978
+ if (children2.some((child) => groupAlive(table, child))) {
1935
1979
  await pause(POLL_MS, signal);
1936
1980
  continue;
1937
1981
  }
1938
- const dead = `${lock}.dead-${token}`;
1939
- try {
1940
- (0, import_node_fs4.renameSync)(lock, dead);
1941
- } catch (error) {
1942
- if (error instanceof Error && "code" in error && error.code === "ENOENT") continue;
1943
- throw error;
1982
+ }
1983
+ (0, import_node_fs4.writeFileSync)(pending, owner);
1984
+ try {
1985
+ (0, import_node_fs4.linkSync)(pending, import_node_path5.default.join(directory, name(newest + 1, "owner")));
1986
+ } catch (error) {
1987
+ if (errorCode(error) === "EEXIST") continue;
1988
+ throw error;
1989
+ } finally {
1990
+ (0, import_node_fs4.rmSync)(pending, { force: true });
1991
+ }
1992
+ const numbers = generationNumbers(directory);
1993
+ if (numbers.at(-1) !== newest + 1) {
1994
+ (0, import_node_fs4.rmSync)(import_node_path5.default.join(directory, name(newest + 1, "owner")), { force: true });
1995
+ continue;
1996
+ }
1997
+ held = newest + 1;
1998
+ for (const number of numbers)
1999
+ if (number < held) {
2000
+ for (const entry of (0, import_node_fs4.readdirSync)(directory))
2001
+ if (entry.startsWith(name(number, "")))
2002
+ (0, import_node_fs4.rmSync)(import_node_path5.default.join(directory, entry), { force: true });
1944
2003
  }
2004
+ break;
2005
+ }
2006
+ const children = [];
2007
+ const lease = {
2008
+ spawn(command, args, options) {
2009
+ const child = (0, import_node_child_process5.spawn)(
2010
+ "/bin/sh",
2011
+ ["-c", 'IFS= read -r go || exit 1; exec "$@" </dev/null', "sh", command, ...args],
2012
+ { ...options, detached: true, stdio: ["pipe", "pipe", "pipe"] }
2013
+ );
2014
+ child.stdin.on("error", () => {
2015
+ });
2016
+ children.push(child);
1945
2017
  try {
1946
- if (readLock(dead) !== held) {
1947
- try {
1948
- (0, import_node_fs4.linkSync)(dead, lock);
1949
- } catch (error) {
1950
- if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
1951
- throw error;
1952
- }
2018
+ if (child.pid === void 0) {
2019
+ child.once("error", () => {
2020
+ });
2021
+ throw new Error(`could not start ${command}`);
1953
2022
  }
1954
- } finally {
1955
- (0, import_node_fs4.rmSync)(dead, { force: true });
2023
+ const childPending = `${pending}.child.${child.pid}`;
2024
+ try {
2025
+ (0, import_node_fs4.writeFileSync)(childPending, JSON.stringify(ownIdentity(child.pid)));
2026
+ (0, import_node_fs4.linkSync)(childPending, import_node_path5.default.join(directory, name(held, `child.${child.pid}`)));
2027
+ } finally {
2028
+ (0, import_node_fs4.rmSync)(childPending, { force: true });
2029
+ }
2030
+ } catch (error) {
2031
+ child.stdin.destroy();
2032
+ throw error;
1956
2033
  }
2034
+ child.stdin.end("go\n");
2035
+ return child;
1957
2036
  }
1958
- } finally {
1959
- (0, import_node_fs4.rmSync)(pending, { force: true });
1960
- }
2037
+ };
1961
2038
  try {
1962
- return await work();
2039
+ return await work(lease);
1963
2040
  } finally {
1964
- if (readLock(lock) === owner) (0, import_node_fs4.rmSync)(lock, { force: true });
2041
+ await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
2042
+ (0, import_node_fs4.writeFileSync)(import_node_path5.default.join(directory, name(held, "released")), "");
1965
2043
  }
1966
2044
  }
1967
- var import_node_child_process5, import_node_crypto3, import_node_fs4, import_node_path5, POLL_MS;
2045
+ var import_node_child_process5, import_node_crypto3, import_node_fs4, import_node_path5, POLL_MS, START_TOLERANCE_MS, name;
1968
2046
  var init_swift_root_lock = __esm({
1969
2047
  "src/swift-root-lock.ts"() {
1970
2048
  "use strict";
@@ -1973,7 +2051,10 @@ var init_swift_root_lock = __esm({
1973
2051
  import_node_fs4 = require("node:fs");
1974
2052
  import_node_path5 = __toESM(require("node:path"), 1);
1975
2053
  init_home_paths();
2054
+ init_process_group();
1976
2055
  POLL_MS = 250;
2056
+ START_TOLERANCE_MS = 2e3;
2057
+ name = (number, suffix) => `${String(number).padStart(12, "0")}.${suffix}`;
1977
2058
  }
1978
2059
  });
1979
2060
 
@@ -2017,12 +2098,13 @@ var init_swiftContract = __esm({
2017
2098
  async function runCompiler(command, args, options, stream = false, quiet) {
2018
2099
  const { signal } = options;
2019
2100
  signal?.throwIfAborted();
2020
- const child = (0, import_node_child_process6.spawn)(command, args, {
2101
+ const launch = {
2021
2102
  cwd: options.cwd,
2022
2103
  env: swiftEnvironment(options.env),
2023
2104
  detached: true,
2024
2105
  stdio: ["ignore", "pipe", "pipe"]
2025
- });
2106
+ };
2107
+ const child = options.lease ? options.lease.spawn(command, args, launch) : (0, import_node_child_process6.spawn)(command, args, launch);
2026
2108
  let stopping;
2027
2109
  try {
2028
2110
  await new Promise((resolve3, reject) => {
@@ -2036,20 +2118,20 @@ async function runCompiler(command, args, options, stream = false, quiet) {
2036
2118
  void stopping.catch(() => {
2037
2119
  });
2038
2120
  };
2039
- for (const name2 of ["stdout", "stderr"]) {
2040
- child[name2].on("data", (bytes) => {
2041
- if (stream === true) process[name2].write(bytes);
2121
+ for (const name3 of ["stdout", "stderr"]) {
2122
+ child[name3].on("data", (bytes) => {
2123
+ if (stream === true) process[name3].write(bytes);
2042
2124
  else if (stream) {
2043
- const lines = (partial[name2] + bytes.toString()).split("\n");
2044
- partial[name2] = lines.pop();
2125
+ const lines = (partial[name3] + bytes.toString()).split("\n");
2126
+ partial[name3] = lines.pop();
2045
2127
  for (const line of lines)
2046
- if (stream.test(line)) process[name2].write(`${line}
2128
+ if (stream.test(line)) process[name3].write(`${line}
2047
2129
  `);
2048
2130
  }
2049
- sizes[name2] += bytes.length;
2050
- if (sizes[name2] <= (options.maxBuffer ?? 1024 * 1024)) chunks[name2].push(bytes);
2131
+ sizes[name3] += bytes.length;
2132
+ if (sizes[name3] <= (options.maxBuffer ?? 1024 * 1024)) chunks[name3].push(bytes);
2051
2133
  else {
2052
- failure2 = new Error(`Swift compiler ${name2} exceeded its output limit`);
2134
+ failure2 = new Error(`Swift compiler ${name3} exceeded its output limit`);
2053
2135
  stop();
2054
2136
  }
2055
2137
  });
@@ -2077,9 +2159,9 @@ async function runCompiler(command, args, options, stream = false, quiet) {
2077
2159
  );
2078
2160
  else {
2079
2161
  if (quiet) {
2080
- for (const name2 of ["stdout", "stderr"])
2081
- for (const line of Buffer.concat(chunks[name2]).toString().split("\n"))
2082
- if (line && !quiet.test(line)) process[name2].write(`${line}
2162
+ for (const name3 of ["stdout", "stderr"])
2163
+ for (const line of Buffer.concat(chunks[name3]).toString().split("\n"))
2164
+ if (line && !quiet.test(line)) process[name3].write(`${line}
2083
2165
  `);
2084
2166
  }
2085
2167
  resolve3();
@@ -2267,11 +2349,11 @@ function swiftCondition(text4, available) {
2267
2349
  if (token === "false") return false;
2268
2350
  const call = /^(\w+)\s*\(\s*([^,()]*?)\s*(?:,[^()]*)?\)$/.exec(token ?? "");
2269
2351
  if (!call) return void 0;
2270
- const [, name2, argument] = call;
2271
- if (name2 === "os") return argument === "iOS" || argument === "WASI";
2272
- if (name2 === "canImport") return available.has(argument);
2273
- if (name2 === "targetEnvironment") return false;
2274
- if (name2 === "arch") return argument === "wasm32";
2352
+ const [, name3, argument] = call;
2353
+ if (name3 === "os") return argument === "iOS" || argument === "WASI";
2354
+ if (name3 === "canImport") return available.has(argument);
2355
+ if (name3 === "targetEnvironment") return false;
2356
+ if (name3 === "arch") return argument === "wasm32";
2275
2357
  return void 0;
2276
2358
  };
2277
2359
  const both = () => {
@@ -2315,8 +2397,8 @@ function swiftImportNames(contents, available) {
2315
2397
  continue;
2316
2398
  }
2317
2399
  if (available && frames.some((frame) => frame.active !== true)) continue;
2318
- const name2 = SWIFT_IMPORT.exec(line)?.[1];
2319
- if (name2) names.push(name2);
2400
+ const name3 = SWIFT_IMPORT.exec(line)?.[1];
2401
+ if (name3) names.push(name3);
2320
2402
  }
2321
2403
  return names;
2322
2404
  }
@@ -2345,9 +2427,9 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
2345
2427
  ],
2346
2428
  { encoding: "utf8", env: swiftEnvironment(), stdio: ["ignore", "pipe", "pipe"] }
2347
2429
  );
2348
- const field = (name2) => {
2349
- const value = new RegExp(`^${name2}:\\s*(.+)$`, "m").exec(configuration)?.[1]?.trim();
2350
- if (!value) throw new Error(`swift sdk ${sdk} reports no ${name2}`);
2430
+ const field = (name3) => {
2431
+ const value = new RegExp(`^${name3}:\\s*(.+)$`, "m").exec(configuration)?.[1]?.trim();
2432
+ if (!value) throw new Error(`swift sdk ${sdk} reports no ${name3}`);
2351
2433
  return value;
2352
2434
  };
2353
2435
  const paths = {
@@ -2381,9 +2463,9 @@ function missingSwiftModules(files2, available) {
2381
2463
  const missing = /* @__PURE__ */ new Map();
2382
2464
  for (const [file, contents] of Object.entries(files2)) {
2383
2465
  if (!file.endsWith(".swift") || file === "Package.swift") continue;
2384
- for (const name2 of new Set(swiftImportNames(contents, available))) {
2385
- if (available.has(name2)) continue;
2386
- missing.set(name2, [...missing.get(name2) ?? [], file]);
2466
+ for (const name3 of new Set(swiftImportNames(contents, available))) {
2467
+ if (available.has(name3)) continue;
2468
+ missing.set(name3, [...missing.get(name3) ?? [], file]);
2387
2469
  }
2388
2470
  }
2389
2471
  return new Map([...missing].sort(([left], [right]) => left.localeCompare(right)));
@@ -2404,8 +2486,8 @@ function swiftTargetDependencies(files2, targets) {
2404
2486
  (candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
2405
2487
  ))
2406
2488
  continue;
2407
- for (const name2 of swiftImportNames(contents)) {
2408
- if (names.has(name2) && name2 !== target.name) deps.add(name2);
2489
+ for (const name3 of swiftImportNames(contents)) {
2490
+ if (names.has(name3) && name3 !== target.name) deps.add(name3);
2409
2491
  }
2410
2492
  }
2411
2493
  siblings.set(target.name, [...deps].sort());
@@ -2437,10 +2519,10 @@ ${release}
2437
2519
  (0, import_node_crypto4.createHash)("sha256").update(input.resources?.[base] ?? "").digest()
2438
2520
  );
2439
2521
  }
2440
- for (const name2 of Object.keys(input.images ?? {}).sort()) {
2441
- const image = input.images?.[name2];
2522
+ for (const name3 of Object.keys(input.images ?? {}).sort()) {
2523
+ const image = input.images?.[name3];
2442
2524
  if (!image) continue;
2443
- hash.update((0, import_node_crypto4.createHash)("sha256").update(name2).digest());
2525
+ hash.update((0, import_node_crypto4.createHash)("sha256").update(name3).digest());
2444
2526
  hash.update((0, import_node_crypto4.createHash)("sha256").update(image.file).digest());
2445
2527
  hash.update((0, import_node_crypto4.createHash)("sha256").update(image.data).digest());
2446
2528
  }
@@ -2479,17 +2561,17 @@ ${target}
2479
2561
  function emitSwiftPackageManifest(args) {
2480
2562
  const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
2481
2563
  const reachedFrameworks = /* @__PURE__ */ new Set();
2482
- const reach = (name2) => {
2483
- if (reachedFrameworks.has(name2)) return;
2484
- reachedFrameworks.add(name2);
2485
- for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[name2] ?? [])
2564
+ const reach = (name3) => {
2565
+ if (reachedFrameworks.has(name3)) return;
2566
+ reachedFrameworks.add(name3);
2567
+ for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[name3] ?? [])
2486
2568
  reach(dependency);
2487
2569
  };
2488
- for (const name2 of [...siblings.values()].flat())
2489
- if (OPTIONAL_FRAMEWORKS.has(name2) && !targets.some((target) => target.name === name2))
2490
- reach(name2);
2570
+ for (const name3 of [...siblings.values()].flat())
2571
+ if (OPTIONAL_FRAMEWORKS.has(name3) && !targets.some((target) => target.name === name3))
2572
+ reach(name3);
2491
2573
  if (spriteKit) {
2492
- for (const name2 of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name2);
2574
+ for (const name3 of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name3);
2493
2575
  }
2494
2576
  const distributionLink = args.distributionLink;
2495
2577
  if (distribution && !distributionLink)
@@ -2499,7 +2581,7 @@ function emitSwiftPackageManifest(args) {
2499
2581
  if (distribution && distributionLink) {
2500
2582
  const objects = distribution.objects.filter(
2501
2583
  (object2) => [...OPTIONAL_FRAMEWORKS, "SpriteKit", "PeachBox2D"].every(
2502
- (name2) => !object2.startsWith(`lib/${name2}-`) || reachedFrameworks.has(name2)
2584
+ (name3) => !object2.startsWith(`lib/${name3}-`) || reachedFrameworks.has(name3)
2503
2585
  )
2504
2586
  );
2505
2587
  distributionLink.files.set(
@@ -2528,11 +2610,11 @@ function emitSwiftPackageManifest(args) {
2528
2610
  return ` .systemLibrary(name: ${JSON.stringify(target.name)}, path: ${JSON.stringify(target.path)}),`;
2529
2611
  const isolation = target.mainActorIsolation ? " .defaultIsolation(MainActor.self)," : "";
2530
2612
  const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
2531
- const defines = (target.defines ?? []).map((name2) => ` .define(${JSON.stringify(name2)}),`).join("");
2613
+ const defines = (target.defines ?? []).map((name3) => ` .define(${JSON.stringify(name3)}),`).join("");
2532
2614
  const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path6.default.join(moduleRoot, "modules"))}` : "";
2533
2615
  const native = args.native?.get(target.name);
2534
- const nativeImports = (siblings.get(target.name) ?? []).filter((name2) => args.native?.has(name2)).map(
2535
- (name2) => `, "-Xfrontend", "-import-module", "-Xfrontend", ${JSON.stringify(swiftTargetModuleName(name2))}`
2616
+ const nativeImports = (siblings.get(target.name) ?? []).filter((name3) => args.native?.has(name3)).map(
2617
+ (name3) => `, "-Xfrontend", "-import-module", "-Xfrontend", ${JSON.stringify(swiftTargetModuleName(name3))}`
2536
2618
  ).join("");
2537
2619
  const header = args.headerDirectory && [...args.native?.values() ?? []].some(
2538
2620
  (value) => value.late?.producers.includes(target.name)
@@ -2554,7 +2636,7 @@ function emitSwiftPackageManifest(args) {
2554
2636
  const library = distribution && distributionLink ? ["-Xclang-linker", `--config=${distributionLink.path}`, ...distribution.link].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
2555
2637
  const kind = target.executable ? ".executableTarget" : ".target";
2556
2638
  const linkedLibraries = (target.linkedLibraries ?? []).map(
2557
- (name2) => `.linkedLibrary(${JSON.stringify(name2)})`
2639
+ (name3) => `.linkedLibrary(${JSON.stringify(name3)})`
2558
2640
  );
2559
2641
  const librarySettings = [
2560
2642
  ...linkedLibraries,
@@ -2593,9 +2675,9 @@ function emitSwiftPackageManifest(args) {
2593
2675
  " targets: [",
2594
2676
  ...targets.map(stanza),
2595
2677
  ...[...args.native?.entries() ?? []].flatMap(
2596
- ([name2, native]) => native.late ? [
2678
+ ([name3, native]) => native.late ? [
2597
2679
  ` .target(name: ${JSON.stringify(native.late.name)},`,
2598
- ` dependencies: ${JSON.stringify([name2, ...native.late.producers])},`,
2680
+ ` dependencies: ${JSON.stringify([name3, ...native.late.producers])},`,
2599
2681
  ` path: ${JSON.stringify(native.path)},`,
2600
2682
  ` sources: ${JSON.stringify(native.lateSources)},`,
2601
2683
  ` publicHeadersPath: "include",`,
@@ -2826,7 +2908,7 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
2826
2908
  if (top?.kind !== "extension") continue;
2827
2909
  const func = OVERRIDE_FUNC.exec(rest);
2828
2910
  if (func) {
2829
- const name2 = func[2];
2911
+ const name3 = func[2];
2830
2912
  const open = at + func[0].length - 1;
2831
2913
  let depth = 0;
2832
2914
  let close = open;
@@ -2839,12 +2921,12 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
2839
2921
  const clause = source.slice(close + 1, body).trim();
2840
2922
  const args = forwardedArguments(source.slice(open + 1, close));
2841
2923
  if (args === null) continue;
2842
- const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name2}(${args})`;
2843
- const signature = `func ${name2}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
2844
- const nameAt = at + rest.indexOf(name2, rest.indexOf("func", "override".length + func[1].length) + 4);
2924
+ const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name3}(${args})`;
2925
+ const signature = `func ${name3}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
2926
+ const nameAt = at + rest.indexOf(name3, rest.indexOf("func", "override".length + func[1].length) + 4);
2845
2927
  lifted.push({
2846
2928
  type: top.name,
2847
- member: name2,
2929
+ member: name3,
2848
2930
  at,
2849
2931
  modifiers,
2850
2932
  access,
@@ -2862,16 +2944,16 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
2862
2944
  if (property) {
2863
2945
  const open = at + property[0].length - 1;
2864
2946
  if (/\b(?:set|willSet|didSet)\b/.test(source.slice(open, closing(open)))) continue;
2865
- const name2 = property[2];
2866
- const nameAt = at + rest.indexOf(name2, rest.indexOf("var"));
2947
+ const name3 = property[2];
2948
+ const nameAt = at + rest.indexOf(name3, rest.indexOf("var"));
2867
2949
  lifted.push({
2868
2950
  type: top.name,
2869
- member: name2,
2951
+ member: name3,
2870
2952
  at,
2871
2953
  modifiers,
2872
2954
  access,
2873
- decl: `var ${name2}: ${property[3].trim()}`,
2874
- forward: `{ __peach_ext_${name2} };`,
2955
+ decl: `var ${name3}: ${property[3].trim()}`,
2956
+ forward: `{ __peach_ext_${name3} };`,
2875
2957
  nameAt,
2876
2958
  edits: [
2877
2959
  [at, "override".length, " ".repeat("override".length)],
@@ -3008,15 +3090,15 @@ function objcRootedClasses(sources) {
3008
3090
  ))
3009
3091
  bases.set(match[1], match[2]);
3010
3092
  const rooted = /* @__PURE__ */ new Set();
3011
- for (const name2 of bases.keys()) {
3012
- const seen = /* @__PURE__ */ new Set([name2]);
3013
- let base = bases.get(name2);
3093
+ for (const name3 of bases.keys()) {
3094
+ const seen = /* @__PURE__ */ new Set([name3]);
3095
+ let base = bases.get(name3);
3014
3096
  while (bases.has(base) && !seen.has(base)) {
3015
3097
  seen.add(base);
3016
3098
  base = bases.get(base);
3017
3099
  }
3018
3100
  if (!bases.has(base) && APPLE_CLASS.test(base) && !APPLE_PROTOCOL.test(base) && !(base in SDK_OBJC_OPTIONAL))
3019
- rooted.add(name2);
3101
+ rooted.add(name3);
3020
3102
  }
3021
3103
  return rooted;
3022
3104
  }
@@ -3159,8 +3241,8 @@ function inheritedTypes(sources) {
3159
3241
  if (colon === -1) continue;
3160
3242
  const inherited = parents.get(owner[1]) ?? /* @__PURE__ */ new Set();
3161
3243
  for (const type of splitTopLevel(header.slice(colon + 1).split(/\bwhere\b/)[0])) {
3162
- const name2 = /^\s*(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/.exec(type)?.[1];
3163
- if (name2 && !type.includes("<")) inherited.add(name2);
3244
+ const name3 = /^\s*(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/.exec(type)?.[1];
3245
+ if (name3 && !type.includes("<")) inherited.add(name3);
3164
3246
  }
3165
3247
  parents.set(owner[1], inherited);
3166
3248
  }
@@ -3185,20 +3267,20 @@ function conformingTypes(parents, protocols) {
3185
3267
  return result;
3186
3268
  }
3187
3269
  function objcSelectorName(base, labels, isAsync, isThrowing) {
3188
- let name2 = base;
3270
+ let name3 = base;
3189
3271
  labels.forEach((label, index) => {
3190
- if (index > 0) name2 += `${label === "_" ? "" : label}:`;
3272
+ if (index > 0) name3 += `${label === "_" ? "" : label}:`;
3191
3273
  else {
3192
3274
  if (label !== "_") {
3193
3275
  const firstWord = label[0] + /^[^A-Z_]*/.exec(label.slice(1))[0];
3194
- name2 += `${OBJC_PREPOSITIONS.has(firstWord) ? "" : "With"}${label[0].toUpperCase()}${label.slice(1)}`;
3276
+ name3 += `${OBJC_PREPOSITIONS.has(firstWord) ? "" : "With"}${label[0].toUpperCase()}${label.slice(1)}`;
3195
3277
  }
3196
- name2 += ":";
3278
+ name3 += ":";
3197
3279
  }
3198
3280
  });
3199
- if (isAsync) name2 += labels.length ? "completionHandler:" : "WithCompletionHandler:";
3200
- else if (isThrowing) name2 += labels.length ? "error:" : "AndReturnError:";
3201
- return name2;
3281
+ if (isAsync) name3 += labels.length ? "completionHandler:" : "WithCompletionHandler:";
3282
+ else if (isThrowing) name3 += labels.length ? "error:" : "AndReturnError:";
3283
+ return name3;
3202
3284
  }
3203
3285
  function declarationStart(code, at, floor) {
3204
3286
  let start = at;
@@ -3259,22 +3341,22 @@ function objcOptionalProtocols(source) {
3259
3341
  ...(attributes.match(/@available\s*\((?:[^()"]|"(?:[^"\\]|\\.)*")*\)/g) ?? []).map((attribute) => attribute.replace(/\s*\n\s*/g, " ")),
3260
3342
  access ?? ""
3261
3343
  ].filter((word) => word !== "").join(" ");
3262
- const name2 = member[2];
3344
+ const name3 = member[2];
3263
3345
  const after = at + member[0].length;
3264
3346
  if (member[1] === "var") {
3265
3347
  const typed = /^\s*:\s*([^{\n]+?)\s*\{[^}]*\}/.exec(code.slice(after));
3266
3348
  if (!typed) continue;
3267
- const selector2 = explicit ?? name2;
3349
+ const selector2 = explicit ?? name3;
3268
3350
  const typeMember2 = /\bstatic\b/.test(code.slice(start, at));
3269
3351
  members.push({
3270
- name: name2,
3352
+ name: name3,
3271
3353
  labels: null,
3272
3354
  selector: selector2,
3273
3355
  start,
3274
3356
  end: after + typed[0].length,
3275
3357
  result: objcTypeName(typed[1]),
3276
3358
  typeMember: typeMember2,
3277
- helper: `${head} ${typeMember2 ? "static " : ""}var ${name2}: ${optionalResult(typed[1])} { _objcOptionalSend(self, Selector(${JSON.stringify(selector2)}), [], default: nil) }`
3359
+ helper: `${head} ${typeMember2 ? "static " : ""}var ${name3}: ${optionalResult(typed[1])} { _objcOptionalSend(self, Selector(${JSON.stringify(selector2)}), [], default: nil) }`
3278
3360
  });
3279
3361
  continue;
3280
3362
  }
@@ -3286,10 +3368,10 @@ function objcOptionalProtocols(source) {
3286
3368
  const parameters = code.slice(paren + 1, shut);
3287
3369
  const names = parameterNames(parameters);
3288
3370
  const labels = names.map((parameter) => parameter.label);
3289
- const selector = explicit ?? objcSelectorName(name2, labels, tail[1] !== void 0, tail[2] !== void 0);
3371
+ const selector = explicit ?? objcSelectorName(name3, labels, tail[1] !== void 0, tail[2] !== void 0);
3290
3372
  const typeMember = /\bstatic\b/.test(code.slice(start, at));
3291
3373
  members.push({
3292
- name: name2,
3374
+ name: name3,
3293
3375
  labels,
3294
3376
  typeMember,
3295
3377
  selector,
@@ -3298,12 +3380,12 @@ function objcOptionalProtocols(source) {
3298
3380
  types: parameterTypes(parameters),
3299
3381
  result: objcTypeName(tail[3]?.trim() ?? "Void"),
3300
3382
  helper: typeMember && (tail[1] !== void 0 || tail[2] !== void 0) ? null : tail[1] !== void 0 ? objcAsyncOptionalHelper(
3301
- `${head} func ${name2}(${parameters.replace(/\s*\n\s*/g, " ")})`,
3383
+ `${head} func ${name3}(${parameters.replace(/\s*\n\s*/g, " ")})`,
3302
3384
  parameters,
3303
3385
  selector,
3304
3386
  tail[3]?.trim() ?? "Void",
3305
3387
  tail[2] !== void 0
3306
- ) : 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)`)} }`
3388
+ ) : 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)`)} }`
3307
3389
  });
3308
3390
  }
3309
3391
  if (members.length) found.push({ name: declared[1], close, members });
@@ -3320,8 +3402,8 @@ function escapingSend(parameters, send, effects = "") {
3320
3402
  if (!named || !type?.startsWith("(")) return body;
3321
3403
  const shut = closingParen(type, 0);
3322
3404
  if (!/^\s*(?:async\b\s*)?(?:throws\b\s*)?->/.test(type.slice(shut + 1))) return body;
3323
- const name2 = named[2] ?? named[1];
3324
- return `${effects}withoutActuallyEscaping(${name2}) { ${name2} in ${body} }`;
3405
+ const name3 = named[2] ?? named[1];
3406
+ return `${effects}withoutActuallyEscaping(${name3}) { ${name3} in ${body} }`;
3325
3407
  }, send);
3326
3408
  }
3327
3409
  function objcAsyncOptionalHelper(declaration, parameters, selector, result, throwing) {
@@ -3384,10 +3466,10 @@ function objcTypeMethods(source, found) {
3384
3466
  function objcIndex(sources) {
3385
3467
  const requirements = /* @__PURE__ */ new Map();
3386
3468
  const callable = /* @__PURE__ */ new Map();
3387
- const callableAs = (name2, member, labels) => {
3388
- const known = callable.get(name2);
3469
+ const callableAs = (name3, member, labels) => {
3470
+ const known = callable.get(name3);
3389
3471
  if (known) known.labels.push(labels);
3390
- else callable.set(name2, { member, labels: [labels] });
3472
+ else callable.set(name3, { member, labels: [labels] });
3391
3473
  };
3392
3474
  const typeMethods = /* @__PURE__ */ new Map();
3393
3475
  const sdkParents = /* @__PURE__ */ new Map();
@@ -3405,9 +3487,9 @@ function objcIndex(sources) {
3405
3487
  requirements.set(
3406
3488
  protocol,
3407
3489
  sdk.requirements.map(([signature, selector, typed, asyncSignature]) => {
3408
- const name2 = signature.slice(0, signature.indexOf("("));
3409
- const labels = signature.slice(name2.length + 1, -1).split(":").slice(0, -1);
3410
- if (sdk.callers) callableAs(name2, `_objcOptional_${name2}`, labels);
3490
+ const name3 = signature.slice(0, signature.indexOf("("));
3491
+ const labels = signature.slice(name3.length + 1, -1).split(":").slice(0, -1);
3492
+ if (sdk.callers) callableAs(name3, `_objcOptional_${name3}`, labels);
3411
3493
  const arrow = typed?.lastIndexOf("->") ?? -1;
3412
3494
  const types = typed?.slice(0, arrow);
3413
3495
  const result = typed?.slice(arrow + 2);
@@ -3418,7 +3500,7 @@ function objcIndex(sources) {
3418
3500
  const values = handler ? splitTopLevel(handler[1]) : [];
3419
3501
  const asyncName = asyncSignature?.slice(0, asyncSignature.indexOf("("));
3420
3502
  return {
3421
- name: name2,
3503
+ name: name3,
3422
3504
  labels,
3423
3505
  selector,
3424
3506
  ...parameters !== void 0 && { types: parameters },
@@ -3444,8 +3526,8 @@ function objcIndex(sources) {
3444
3526
  for (const protocol of objcOptionalProtocols(source)) {
3445
3527
  requirements.set(
3446
3528
  protocol.name,
3447
- protocol.members.map(({ name: name2, labels, selector, types, result, typeMember }) => ({
3448
- name: name2,
3529
+ protocol.members.map(({ name: name3, labels, selector, types, result, typeMember }) => ({
3530
+ name: name3,
3449
3531
  labels,
3450
3532
  selector,
3451
3533
  ...typeMember && { typeMember },
@@ -3475,18 +3557,18 @@ function objcIndex(sources) {
3475
3557
  const code = swiftCodeMask(source);
3476
3558
  const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
3477
3559
  for (const protocol of code.matchAll(/\bprotocol\s+([A-Za-z_]\w*)[^{}]*\{/g)) {
3478
- const name2 = protocol[1];
3479
- protocols.add(name2);
3560
+ const name3 = protocol[1];
3561
+ protocols.add(name3);
3480
3562
  const open = protocol.index + protocol[0].length - 1;
3481
3563
  if (/\binit\s*[?!]?\s*\(/.test(code.slice(open + 1, closingBrace(code, braces, open))))
3482
- initializers.add(name2);
3564
+ initializers.add(name3);
3483
3565
  }
3484
3566
  }
3485
3567
  const rooted = conformingTypes(parents, /* @__PURE__ */ new Set(["NSObject"]));
3486
3568
  const initialized = conformingTypes(parents, initializers);
3487
3569
  const nsObjectTypes = /* @__PURE__ */ new Set([
3488
3570
  "NSObject",
3489
- ...[...protocols].filter((name2) => rooted.has(name2) && !initialized.has(name2))
3571
+ ...[...protocols].filter((name3) => rooted.has(name3) && !initialized.has(name3))
3490
3572
  ]);
3491
3573
  return {
3492
3574
  requirements,
@@ -3513,8 +3595,8 @@ function objcAliases(sources) {
3513
3595
  }
3514
3596
  }
3515
3597
  const aliases = /* @__PURE__ */ new Map();
3516
- for (const [name2, type] of declared) if (type !== null) aliases.set(name2, type);
3517
- for (const [name2, type] of aliases) aliases.set(name2, resolveAliases(type, aliases));
3598
+ for (const [name3, type] of declared) if (type !== null) aliases.set(name3, type);
3599
+ for (const [name3, type] of aliases) aliases.set(name3, resolveAliases(type, aliases));
3518
3600
  return aliases;
3519
3601
  }
3520
3602
  function resolveAliases(type, aliases) {
@@ -3522,7 +3604,7 @@ function resolveAliases(type, aliases) {
3522
3604
  for (let pass = 0; pass < 8 && aliases.size; pass++) {
3523
3605
  const next = resolved.replace(
3524
3606
  /(?<![\w.])[A-Za-z_]\w*(?![\w.])/g,
3525
- (name2) => aliases.get(name2) ?? name2
3607
+ (name3) => aliases.get(name3) ?? name3
3526
3608
  );
3527
3609
  if (next === resolved) break;
3528
3610
  resolved = next;
@@ -3628,17 +3710,17 @@ function lowerObjCOptionalRequirements(source, index) {
3628
3710
  `; extension ${protocol.name} { ${helpers.join("; ")} }`
3629
3711
  ]);
3630
3712
  }
3631
- for (const name2 of code.matchAll(
3713
+ for (const name3 of code.matchAll(
3632
3714
  /#selector\(\s*([A-Za-z_]\w*)\.([A-Za-z_]\w*)\(((?:\s*\w+\s*:)+)\s*\)\s*\)/g
3633
3715
  )) {
3634
- const signature = `${name2[2]}(${name2[3].replace(/\s+/g, "")})`;
3635
- const found = SDK_OBJC_OPTIONAL[name2[1]]?.requirements.filter(
3716
+ const signature = `${name3[2]}(${name3[3].replace(/\s+/g, "")})`;
3717
+ const found = SDK_OBJC_OPTIONAL[name3[1]]?.requirements.filter(
3636
3718
  ([requirement]) => requirement === signature
3637
3719
  );
3638
3720
  if (found?.length === 1)
3639
3721
  edits.push([
3640
- name2.index,
3641
- name2[0].length,
3722
+ name3.index,
3723
+ name3[0].length,
3642
3724
  `NSSelectorFromString(${JSON.stringify(found[0][1])})`
3643
3725
  ]);
3644
3726
  }
@@ -3646,7 +3728,7 @@ function lowerObjCOptionalRequirements(source, index) {
3646
3728
  const receivesAsProtocol = (dot) => {
3647
3729
  const receiver = /([A-Za-z_]\w*)\s*[?!]?\s*$/.exec(code.slice(0, dot))?.[1];
3648
3730
  if (!receiver) return false;
3649
- const name2 = /^\.\s*([A-Za-z_]\w*)/.exec(code.slice(dot))?.[1];
3731
+ const name3 = /^\.\s*([A-Za-z_]\w*)/.exec(code.slice(dot))?.[1];
3650
3732
  let innermost;
3651
3733
  for (const declared of code.matchAll(
3652
3734
  new RegExp(
@@ -3659,7 +3741,7 @@ function lowerObjCOptionalRequirements(source, index) {
3659
3741
  if (dot > from && dot < to && (!innermost || from >= innermost.from))
3660
3742
  innermost = { from, type: declared[1] };
3661
3743
  }
3662
- return innermost?.type !== void 0 && !!index.requirements.get(resolveAliases(innermost.type, index.aliases))?.some((wanted) => wanted.name === name2);
3744
+ return innermost?.type !== void 0 && !!index.requirements.get(resolveAliases(innermost.type, index.aliases))?.some((wanted) => wanted.name === name3);
3663
3745
  };
3664
3746
  for (const call of code.matchAll(/\.\s*([A-Za-z_]\w*)\s*\?(?=\s*[({])/g)) {
3665
3747
  const callable = index.callable.get(call[1]);
@@ -3676,8 +3758,8 @@ function lowerObjCOptionalRequirements(source, index) {
3676
3758
  continue;
3677
3759
  if (callable.member === call[1]) edits.push([mark, 1, " "]);
3678
3760
  else {
3679
- const name2 = call.index + call[0].indexOf(call[1]);
3680
- edits.push([name2, mark + 1 - name2, callable.member]);
3761
+ const name3 = call.index + call[0].indexOf(call[1]);
3762
+ edits.push([name3, mark + 1 - name3, callable.member]);
3681
3763
  }
3682
3764
  }
3683
3765
  for (const owner of code.matchAll(
@@ -3775,8 +3857,8 @@ function lowerObjCRuntimeCalls(source, index) {
3775
3857
  for (const declared of code.matchAll(
3776
3858
  /(?:\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
3777
3859
  )) {
3778
- const name2 = declared[1] ?? declared[4] ?? declared[5];
3779
- const list2 = declarations.get(name2) ?? [];
3860
+ const name3 = declared[1] ?? declared[4] ?? declared[5];
3861
+ const list2 = declarations.get(name3) ?? [];
3780
3862
  let type = declared[3] ? "" : declared[2] ?? "";
3781
3863
  if (!type && declared[4]) {
3782
3864
  const lookup = /^\s*=\s*NSClassFromString\s*\(/.exec(
@@ -3791,7 +3873,7 @@ function lowerObjCRuntimeCalls(source, index) {
3791
3873
  }
3792
3874
  const resolved = type.endsWith(".Type") ? `${resolveAliases(type.slice(0, -5), index.aliases)}.Type` : resolveAliases(type, index.aliases);
3793
3875
  list2.push({ at: declared.index, type: resolved });
3794
- declarations.set(name2, list2);
3876
+ declarations.set(name3, list2);
3795
3877
  }
3796
3878
  for (const pattern of code.matchAll(/\b(?:let|var|for)\s*(?=\(|\.\s*\w+\s*\()/g)) {
3797
3879
  const open = code.indexOf("(", pattern.index + pattern[0].length);
@@ -3804,9 +3886,9 @@ function lowerObjCRuntimeCalls(source, index) {
3804
3886
  }
3805
3887
  for (const list2 of declarations.values()) list2.sort((a, b) => a.at - b.at);
3806
3888
  const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
3807
- const receiverType = (name2, at) => {
3889
+ const receiverType = (name3, at) => {
3808
3890
  let innermost;
3809
- for (const declared of declarations.get(name2) ?? []) {
3891
+ for (const declared of declarations.get(name3) ?? []) {
3810
3892
  if (declared.at > at) break;
3811
3893
  const [from, to] = declarationScope(code, braces, declared.at);
3812
3894
  if (at > from && at < to && (!innermost || from >= innermost.from))
@@ -4151,11 +4233,11 @@ function swiftSourceClosure(files2, roots) {
4151
4233
  continue;
4152
4234
  }
4153
4235
  if (depth !== 0 || !match[2]) continue;
4154
- const name2 = match[2].split(".").pop();
4236
+ const name3 = match[2].split(".").pop();
4155
4237
  const index = match[1] === "extension" ? extensions : owners;
4156
- const set = index.get(name2) ?? /* @__PURE__ */ new Set();
4238
+ const set = index.get(name3) ?? /* @__PURE__ */ new Set();
4157
4239
  set.add(file);
4158
- index.set(name2, set);
4240
+ index.set(name3, set);
4159
4241
  }
4160
4242
  sources.set(file, references);
4161
4243
  }
@@ -4163,10 +4245,10 @@ function swiftSourceClosure(files2, roots) {
4163
4245
  const pending = [...roots];
4164
4246
  const seen = /* @__PURE__ */ new Set();
4165
4247
  while (pending.length) {
4166
- const name2 = pending.pop();
4167
- if (seen.has(name2)) continue;
4168
- seen.add(name2);
4169
- for (const file of [...owners.get(name2) ?? [], ...extensions.get(name2) ?? []]) {
4248
+ const name3 = pending.pop();
4249
+ if (seen.has(name3)) continue;
4250
+ seen.add(name3);
4251
+ for (const file of [...owners.get(name3) ?? [], ...extensions.get(name3) ?? []]) {
4170
4252
  if (included.has(file)) continue;
4171
4253
  included.add(file);
4172
4254
  for (const reference of sources.get(file)) pending.push(reference);
@@ -4416,7 +4498,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
4416
4498
  [
4417
4499
  product,
4418
4500
  ...optionalProducts.map(
4419
- (name2) => `.product(name: "${name2}", package: "sootsim-swift"),`
4501
+ (name3) => `.product(name: "${name3}", package: "sootsim-swift"),`
4420
4502
  )
4421
4503
  ].join("\n ")
4422
4504
  );
@@ -4531,7 +4613,7 @@ function builtArtifact(layout) {
4531
4613
  }
4532
4614
  const file = import_node_path6.default.join(binDir, `${executable.name}.wasm`);
4533
4615
  if (!(0, import_node_fs5.existsSync)(file)) {
4534
- const found = (0, import_node_fs5.existsSync)(binDir) ? (0, import_node_fs5.readdirSync)(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
4616
+ const found = (0, import_node_fs5.existsSync)(binDir) ? (0, import_node_fs5.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
4535
4617
  throw new Error(
4536
4618
  `swift-compile: the build produced no ${executable.name}.wasm (found: ${found.join(", ") || "none"})`
4537
4619
  );
@@ -4707,7 +4789,7 @@ function compileSwiftProjectUnit(input, options) {
4707
4789
  }
4708
4790
  return withSwiftRootLock(
4709
4791
  root,
4710
- async () => {
4792
+ async (lease) => {
4711
4793
  const built2 = readCompiledArtifact(import_node_path6.default.join(sharedRoot, "artifact"), hash);
4712
4794
  if (built2) {
4713
4795
  report("reusing verified disk artifact");
@@ -4770,7 +4852,8 @@ function compileSwiftProjectUnit(input, options) {
4770
4852
  },
4771
4853
  maxBuffer: 64 * 1024 * 1024,
4772
4854
  timeout: options.timeoutMs,
4773
- signal: options.signal
4855
+ signal: options.signal,
4856
+ lease
4774
4857
  };
4775
4858
  report("compiling and linking Swift modules");
4776
4859
  try {
@@ -4928,7 +5011,7 @@ var init_swift_compile = __esm({
4928
5011
  `;
4929
5012
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
4930
5013
  MULTI_MANIFEST_VERSION = 39;
4931
- compilerSourceDigest = true ? "ee2738333bb81c79211d5bee8a503c539cf65f25c95fb024c45b840450b5359e" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
5014
+ compilerSourceDigest = true ? "c2ab17198fbe6328c75dc09bbe160fe6b0fd74d4b84a08e9f8dfcd2fcf4ca1f0" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
4932
5015
  DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
4933
5016
  OS_IOS = /\b(?:os\(\s*iOS\s*\)|targetEnvironment\(\s*simulator\s*\))/g;
4934
5017
  OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
@@ -7078,7 +7161,7 @@ var init_swift_compile = __esm({
7078
7161
  "CFSet",
7079
7162
  "CFString",
7080
7163
  "CFURL"
7081
- ].map((name2) => `import class CoreFoundation.${name2}`).concat([
7164
+ ].map((name3) => `import class CoreFoundation.${name3}`).concat([
7082
7165
  "import typealias CoreFoundation.CFPropertyList",
7083
7166
  "import typealias CoreFoundation.CFTypeRef",
7084
7167
  "import CoreGraphics"
@@ -7275,8 +7358,8 @@ var require_build = __commonJS({
7275
7358
  }
7276
7359
  function walk_obj(next, next_child) {
7277
7360
  var tag_type, i, prop;
7278
- var name2 = type(next);
7279
- if ("Undefined" == name2) {
7361
+ var name3 = type(next);
7362
+ if ("Undefined" == name3) {
7280
7363
  return;
7281
7364
  } else if (Array.isArray(next)) {
7282
7365
  next_child = next_child.ele("array");
@@ -7285,7 +7368,7 @@ var require_build = __commonJS({
7285
7368
  }
7286
7369
  } else if (Buffer.isBuffer(next)) {
7287
7370
  next_child.ele("data").raw(next.toString("base64"));
7288
- } else if ("Object" == name2) {
7371
+ } else if ("Object" == name3) {
7289
7372
  next_child = next_child.ele("dict");
7290
7373
  for (prop in next) {
7291
7374
  if (next.hasOwnProperty(prop)) {
@@ -7293,22 +7376,22 @@ var require_build = __commonJS({
7293
7376
  walk_obj(next[prop], next_child);
7294
7377
  }
7295
7378
  }
7296
- } else if ("Number" == name2) {
7379
+ } else if ("Number" == name3) {
7297
7380
  tag_type = next % 1 === 0 ? "integer" : "real";
7298
7381
  next_child.ele(tag_type).txt(next.toString());
7299
- } else if ("BigInt" == name2) {
7382
+ } else if ("BigInt" == name3) {
7300
7383
  next_child.ele("integer").txt(next);
7301
- } else if ("Date" == name2) {
7384
+ } else if ("Date" == name3) {
7302
7385
  next_child.ele("date").txt(ISODateString(new Date(next)));
7303
- } else if ("Boolean" == name2) {
7386
+ } else if ("Boolean" == name3) {
7304
7387
  next_child.ele(next ? "true" : "false");
7305
- } else if ("String" == name2) {
7388
+ } else if ("String" == name3) {
7306
7389
  next_child.ele("string").txt(next);
7307
- } else if ("ArrayBuffer" == name2) {
7390
+ } else if ("ArrayBuffer" == name3) {
7308
7391
  next_child.ele("data").raw(base64.fromByteArray(next));
7309
7392
  } else if (next && next.buffer && "ArrayBuffer" == type(next.buffer)) {
7310
7393
  next_child.ele("data").raw(base64.fromByteArray(new Uint8Array(next.buffer), next_child));
7311
- } else if ("Null" === name2) {
7394
+ } else if ("Null" === name3) {
7312
7395
  next_child.ele("null").txt("");
7313
7396
  }
7314
7397
  }
@@ -7394,8 +7477,8 @@ var require_parse2 = __commonJS({
7394
7477
  }
7395
7478
  return root;
7396
7479
  };
7397
- function internalize(holder, name2, reviver) {
7398
- const value = holder[name2];
7480
+ function internalize(holder, name3, reviver) {
7481
+ const value = holder[name3];
7399
7482
  if (value != null && typeof value === "object") {
7400
7483
  if (Array.isArray(value)) {
7401
7484
  for (let i = 0; i < value.length; i++) {
@@ -7428,7 +7511,7 @@ var require_parse2 = __commonJS({
7428
7511
  }
7429
7512
  }
7430
7513
  }
7431
- return reviver.call(holder, name2, value);
7514
+ return reviver.call(holder, name3, value);
7432
7515
  }
7433
7516
  var lexState;
7434
7517
  var buffer;
@@ -8477,8 +8560,8 @@ function readXcodeJsonProject(xcodeproj, source) {
8477
8560
  const kind = text2(entry.kind) ?? "file-reference";
8478
8561
  const raw2 = text2(entry.path) ?? "";
8479
8562
  const located = raw2 === "" ? null : locate(raw2, parent.dir);
8480
- const name2 = text2(entry.name) ?? import_node_path7.default.basename(raw2);
8481
- const node = { id: "", name: name2, dir: null, parent, children: [] };
8563
+ const name3 = text2(entry.name) ?? import_node_path7.default.basename(raw2);
8564
+ const node = { id: "", name: name3, dir: null, parent, children: [] };
8482
8565
  if (kind === "group" || kind === "variant-group" || kind === "version-group") {
8483
8566
  node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
8484
8567
  const childIds = walk2(items(entry.children), node);
@@ -8491,7 +8574,7 @@ function readXcodeJsonProject(xcodeproj, source) {
8491
8574
  isa: kind === "variant-group" ? "PBXVariantGroup" : "PBXGroup",
8492
8575
  children: childIds,
8493
8576
  ...kind === "variant-group" ? {} : { sourceTree: "<absolute>", path: node.dir ?? "" },
8494
- name: name2
8577
+ name: name3
8495
8578
  },
8496
8579
  text2(entry.id)
8497
8580
  );
@@ -8509,7 +8592,7 @@ function readXcodeJsonProject(xcodeproj, source) {
8509
8592
  {
8510
8593
  isa: "PBXFileReference",
8511
8594
  ...located ?? { sourceTree: "SDKROOT", path: raw2 },
8512
- name: name2
8595
+ name: name3
8513
8596
  },
8514
8597
  text2(entry.id)
8515
8598
  );
@@ -8561,8 +8644,8 @@ function readXcodeJsonProject(xcodeproj, source) {
8561
8644
  return node;
8562
8645
  };
8563
8646
  const configurations = items(json.configurations).flatMap((entry) => {
8564
- const name2 = isObject(entry) ? text2(entry.name) : text2(entry);
8565
- return name2 ? [{ name: name2, file: isObject(entry) ? entry.file : void 0 }] : [];
8647
+ const name3 = isObject(entry) ? text2(entry.name) : text2(entry);
8648
+ return name3 ? [{ name: name3, file: isObject(entry) ? entry.file : void 0 }] : [];
8566
8649
  });
8567
8650
  const settingsOf = (value) => Object.fromEntries(
8568
8651
  Object.entries(isObject(value) ? value : {}).flatMap(
@@ -8577,11 +8660,11 @@ function readXcodeJsonProject(xcodeproj, source) {
8577
8660
  const configurationList = (settings, specialized) => add({
8578
8661
  isa: "XCConfigurationList",
8579
8662
  defaultConfigurationName: text2(json["default-configuration"]) ?? "Debug",
8580
- buildConfigurations: configurations.map(({ name: name2, file }) => {
8581
- const base = lookup(specialized.has(name2) ? specialized.get(name2) : file);
8663
+ buildConfigurations: configurations.map(({ name: name3, file }) => {
8664
+ const base = lookup(specialized.has(name3) ? specialized.get(name3) : file);
8582
8665
  return add({
8583
8666
  isa: "XCBuildConfiguration",
8584
- name: name2,
8667
+ name: name3,
8585
8668
  buildSettings: settings,
8586
8669
  ...base ? { baseConfigurationReference: base } : {}
8587
8670
  });
@@ -8592,9 +8675,9 @@ function readXcodeJsonProject(xcodeproj, source) {
8592
8675
  if (!isObject(entry)) continue;
8593
8676
  const repository = text2(entry.repository);
8594
8677
  const local = text2(entry.path);
8595
- const name2 = local !== void 0 ? import_node_path7.default.basename(import_node_path7.default.resolve(import_node_path7.default.dirname(xcodeproj), local)) : import_node_path7.default.basename(repository ?? "").replace(/\.git$/, "");
8678
+ const name3 = local !== void 0 ? import_node_path7.default.basename(import_node_path7.default.resolve(import_node_path7.default.dirname(xcodeproj), local)) : import_node_path7.default.basename(repository ?? "").replace(/\.git$/, "");
8596
8679
  const id = text2(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
8597
- packageIds.set(name2.toLowerCase(), id);
8680
+ packageIds.set(name3.toLowerCase(), id);
8598
8681
  }
8599
8682
  const productDependency = (entry) => add({
8600
8683
  isa: "XCSwiftPackageProductDependency",
@@ -8614,12 +8697,12 @@ function readXcodeJsonProject(xcodeproj, source) {
8614
8697
  const targets = [];
8615
8698
  for (const entry of items(json.targets)) {
8616
8699
  if (!isObject(entry)) continue;
8617
- const name2 = text2(entry.name) ?? "";
8700
+ const name3 = text2(entry.name) ?? "";
8618
8701
  const productType = text2(entry["product-type"]);
8619
8702
  const target = {
8620
8703
  isa: text2(entry.kind) === "aggregate" ? "PBXAggregateTarget" : "PBXNativeTarget",
8621
- name: name2,
8622
- productName: name2,
8704
+ name: name3,
8705
+ productName: name3,
8623
8706
  productType: productType ? `com.apple.product-type.${productType}` : text2(entry["full-product-type"]) ?? "",
8624
8707
  buildPhases: [],
8625
8708
  dependencies: [],
@@ -8629,7 +8712,7 @@ function readXcodeJsonProject(xcodeproj, source) {
8629
8712
  const product = lookup(entry.product);
8630
8713
  if (product) target.productReference = product;
8631
8714
  const id = add(target, text2(entry.id));
8632
- targetIds.set(name2, id);
8715
+ targetIds.set(name3, id);
8633
8716
  targets.push({ id, target, entry });
8634
8717
  for (const phase of items(entry["build-phases"])) {
8635
8718
  const kind = isObject(phase) ? text2(phase.kind) : text2(phase);
@@ -8641,7 +8724,7 @@ function readXcodeJsonProject(xcodeproj, source) {
8641
8724
  isObject(phase) ? text2(phase.id) : void 0
8642
8725
  );
8643
8726
  target.buildPhases.push(phaseId);
8644
- phases.set([name2, kind, phaseName].filter(Boolean).join("/"), phaseId);
8727
+ phases.set([name3, kind, phaseName].filter(Boolean).join("/"), phaseId);
8645
8728
  phases.set(`id:${phaseId}`, phaseId);
8646
8729
  }
8647
8730
  }
@@ -8657,7 +8740,7 @@ function readXcodeJsonProject(xcodeproj, source) {
8657
8740
  files2?.push(add({ isa: "PBXBuildFile", fileRef: refId }));
8658
8741
  }
8659
8742
  for (const { target, entry } of targets) {
8660
- const name2 = text2(entry.name) ?? "";
8743
+ const name3 = text2(entry.name) ?? "";
8661
8744
  target.buildConfigurationList = configurationList(
8662
8745
  settingsOf(entry["build-settings"]),
8663
8746
  new Map(
@@ -8695,7 +8778,7 @@ function readXcodeJsonProject(xcodeproj, source) {
8695
8778
  const dependency = productDependency(member);
8696
8779
  target.packageProductDependencies.push(dependency);
8697
8780
  const buildFile = member["build-phase"];
8698
- phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name2)?.push(
8781
+ phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name3)?.push(
8699
8782
  add({ isa: "PBXBuildFile", productRef: dependency })
8700
8783
  );
8701
8784
  }
@@ -9016,8 +9099,8 @@ function applyConditions(raw2, configuration) {
9016
9099
  continue;
9017
9100
  }
9018
9101
  const matches = [...key2.slice(bracket).matchAll(/\[([^=\]]+)=([^\]]*)\]/g)].every(
9019
- ([, name2, pattern]) => {
9020
- const actual = name2 === "config" ? configuration : CONDITIONS[name2];
9102
+ ([, name3, pattern]) => {
9103
+ const actual = name3 === "config" ? configuration : CONDITIONS[name3];
9021
9104
  return actual !== void 0 && new RegExp(
9022
9105
  `^${pattern.replace(/[.+^${}()|\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
9023
9106
  ).test(actual);
@@ -9077,9 +9160,9 @@ function workspaceReferences(workspace) {
9077
9160
  function enclosingXcodeWorkspace(xcodeproj) {
9078
9161
  const project = import_node_fs6.default.realpathSync(xcodeproj);
9079
9162
  for (let dir = import_node_path8.default.dirname(project); ; dir = import_node_path8.default.dirname(dir)) {
9080
- for (const name2 of import_node_fs6.default.readdirSync(dir).sort()) {
9081
- if (!name2.endsWith(".xcworkspace")) continue;
9082
- const workspace = import_node_path8.default.join(dir, name2);
9163
+ for (const name3 of import_node_fs6.default.readdirSync(dir).sort()) {
9164
+ if (!name3.endsWith(".xcworkspace")) continue;
9165
+ const workspace = import_node_path8.default.join(dir, name3);
9083
9166
  if (!import_node_fs6.default.existsSync(import_node_path8.default.join(workspace, "contents.xcworkspacedata"))) continue;
9084
9167
  if (workspaceReferences(workspace).some(
9085
9168
  (reference) => import_node_fs6.default.existsSync(reference) && import_node_fs6.default.realpathSync(reference) === project
@@ -9097,7 +9180,7 @@ function findXcodeProject(input) {
9097
9180
  if (resolved.endsWith(".xcodeproj")) return resolved;
9098
9181
  if (!isDirectory(resolved)) return null;
9099
9182
  for (const extension of [".xcworkspace", ".xcodeproj"]) {
9100
- const found = import_node_fs6.default.readdirSync(resolved).filter((name2) => name2.endsWith(extension)).sort();
9183
+ const found = import_node_fs6.default.readdirSync(resolved).filter((name3) => name3.endsWith(extension)).sort();
9101
9184
  if (found.length > 1) {
9102
9185
  throw new Error(
9103
9186
  `${resolved} holds ${found.length} ${extension} bundles (${found.join(", ")}); pass one`
@@ -9108,8 +9191,8 @@ function findXcodeProject(input) {
9108
9191
  return null;
9109
9192
  }
9110
9193
  function xcodeProjectFile(xcodeproj) {
9111
- for (const name2 of ["project.pbxproj", "project.xcproj"]) {
9112
- const file = import_node_path8.default.join(xcodeproj, name2);
9194
+ for (const name3 of ["project.pbxproj", "project.xcproj"]) {
9195
+ const file = import_node_path8.default.join(xcodeproj, name3);
9113
9196
  if (import_node_fs6.default.existsSync(file)) return file;
9114
9197
  }
9115
9198
  return null;
@@ -9166,7 +9249,7 @@ function targetSettings(ref, configuration, builtins, options = {}) {
9166
9249
  const configs = list(configList?.buildConfigurations).map(project.object);
9167
9250
  const config = configs.find((entry) => entry?.name === configuration) ?? configs.find((entry) => entry?.name === str(configList?.defaultConfigurationName));
9168
9251
  if (!config) return [];
9169
- const name2 = str(config.name) ?? configuration;
9252
+ const name3 = str(config.name) ?? configuration;
9170
9253
  const base = str(config.baseConfigurationReference);
9171
9254
  const anchor = str(config.baseConfigurationReferenceAnchor);
9172
9255
  const relative = str(config.baseConfigurationReferenceRelativePath);
@@ -9181,14 +9264,14 @@ function targetSettings(ref, configuration, builtins, options = {}) {
9181
9264
  const fromFile = baseFile ? readXcconfig(baseFile, read) : {};
9182
9265
  xcconfigs.push(...read);
9183
9266
  return [
9184
- applyConditions(fromFile, name2),
9267
+ applyConditions(fromFile, name3),
9185
9268
  applyConditions(
9186
9269
  Object.fromEntries(
9187
9270
  Object.entries(own).flatMap(
9188
9271
  ([key2, value]) => typeof value === "string" ? [[key2, value]] : Array.isArray(value) ? [[key2, list(value).join(" ")]] : []
9189
9272
  )
9190
9273
  ),
9191
- name2
9274
+ name3
9192
9275
  )
9193
9276
  ];
9194
9277
  };
@@ -9208,13 +9291,13 @@ function targetSettings(ref, configuration, builtins, options = {}) {
9208
9291
  resolving2.add(marker);
9209
9292
  const value = expand(
9210
9293
  levels[at][key2],
9211
- (name2) => name2 === "inherited" ? valueAt(key2, at - 1) : valueAt(name2, levels.length - 1)
9294
+ (name3) => name3 === "inherited" ? valueAt(key2, at - 1) : valueAt(name3, levels.length - 1)
9212
9295
  );
9213
9296
  resolving2.delete(marker);
9214
9297
  return value;
9215
9298
  };
9216
9299
  const derived = (key2) => {
9217
- const get = (name2) => valueAt(name2, levels.length - 1);
9300
+ const get = (name3) => valueAt(name3, levels.length - 1);
9218
9301
  switch (key2) {
9219
9302
  case "PRODUCT_NAME":
9220
9303
  return get("TARGET_NAME");
@@ -9222,6 +9305,9 @@ function targetSettings(ref, configuration, builtins, options = {}) {
9222
9305
  return applyOperator(get("PRODUCT_NAME"), "c99extidentifier");
9223
9306
  case "EXECUTABLE_NAME":
9224
9307
  return get("PRODUCT_NAME");
9308
+ // the native default of CoreBuildSystem.xcspec
9309
+ case "EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES":
9310
+ return "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets *.icon (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
9225
9311
  case "AppIdentifierPrefix":
9226
9312
  case "TeamIdentifierPrefix": {
9227
9313
  const team = get("DEVELOPMENT_TEAM");
@@ -9244,6 +9330,45 @@ function settingList(value) {
9244
9330
  items2.push((quoted ?? plain).replace(/\\(.)/g, "$1"));
9245
9331
  return items2;
9246
9332
  }
9333
+ function expandSearchPath(directory, rules) {
9334
+ if (import_node_path8.default.basename(directory) !== "**") return [directory];
9335
+ const expanded = [];
9336
+ const seen = /* @__PURE__ */ new Set();
9337
+ const queue = [import_node_path8.default.dirname(directory)];
9338
+ for (let at = 0; at < queue.length; at++) {
9339
+ const current = queue[at];
9340
+ let real;
9341
+ try {
9342
+ real = import_node_fs6.default.realpathSync(current);
9343
+ } catch {
9344
+ continue;
9345
+ }
9346
+ if (!import_node_fs6.default.statSync(real).isDirectory() || seen.has(real)) continue;
9347
+ seen.add(real);
9348
+ expanded.push(current);
9349
+ for (const entry of import_node_fs6.default.readdirSync(real, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
9350
+ if (entry.isSymbolicLink() ? !rules.followLinks : !entry.isDirectory()) continue;
9351
+ if (rules.excluded.some((pattern) => pattern.test(entry.name)) && !rules.included.some((pattern) => pattern.test(entry.name)))
9352
+ continue;
9353
+ queue.push(import_node_path8.default.join(current, entry.name));
9354
+ }
9355
+ }
9356
+ return expanded;
9357
+ }
9358
+ function recursiveSearchRules(settings) {
9359
+ const glob = (pattern) => new RegExp(
9360
+ `^${pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
9361
+ );
9362
+ return {
9363
+ excluded: settingList(settings("EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES")).map(
9364
+ glob
9365
+ ),
9366
+ included: settingList(settings("INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES")).map(
9367
+ glob
9368
+ ),
9369
+ followLinks: settings("RECURSIVE_SEARCH_PATHS_FOLLOW_SYMLINKS") !== "NO"
9370
+ };
9371
+ }
9247
9372
  function compilationConditions(settings) {
9248
9373
  const flags = settingList(settings("OTHER_SWIFT_FLAGS"));
9249
9374
  const defined = flags.flatMap(
@@ -9260,9 +9385,9 @@ function expand(value, lookup) {
9260
9385
  return value.replace(
9261
9386
  /\$(?:\(([A-Za-z_][A-Za-z0-9_]*)((?::[^)]*)?)\)|\{([A-Za-z_][A-Za-z0-9_]*)((?::[^}]*)?)\}|([A-Za-z_][A-Za-z0-9_]*))/g,
9262
9387
  (_match, paren, parenOps, brace, braceOps, bare) => {
9263
- const name2 = paren ?? brace ?? bare;
9388
+ const name3 = paren ?? brace ?? bare;
9264
9389
  const operators = parenOps ?? braceOps ?? "";
9265
- return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name2));
9390
+ return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name3));
9266
9391
  }
9267
9392
  );
9268
9393
  }
@@ -9490,8 +9615,8 @@ function isIosAppTarget(ref, options = {}) {
9490
9615
  const sdk = get("SDKROOT");
9491
9616
  return sdk === "auto" ? settingList(get("SUPPORTED_PLATFORMS")).some(isIosPlatform) : sdk === "" || isIosPlatform(sdk);
9492
9617
  }
9493
- function isIosPlatform(name2) {
9494
- return name2.startsWith("iphoneos") || name2.startsWith("iphonesimulator");
9618
+ function isIosPlatform(name3) {
9619
+ return name3.startsWith("iphoneos") || name3.startsWith("iphonesimulator");
9495
9620
  }
9496
9621
  function listXcodeAppTargets(xcodeprojOrWorkspace, options = {}) {
9497
9622
  return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(nativeTargets).filter((ref) => isIosAppTarget(ref, options)).map((ref) => str(ref.target.name) ?? ref.id);
@@ -9564,7 +9689,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
9564
9689
  visit(app);
9565
9690
  const xcconfigs = /* @__PURE__ */ new Set();
9566
9691
  const moduleTarget = (ref) => {
9567
- const name2 = str(ref.target.name) ?? ref.id;
9692
+ const name3 = str(ref.target.name) ?? ref.id;
9568
9693
  const {
9569
9694
  get: settings2,
9570
9695
  keys,
@@ -9573,7 +9698,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
9573
9698
  ref,
9574
9699
  configuration,
9575
9700
  {
9576
- TARGET_NAME: name2,
9701
+ TARGET_NAME: name3,
9577
9702
  PROJECT_NAME: import_node_path8.default.basename(ref.project.xcodeproj, ".xcodeproj"),
9578
9703
  SRCROOT: ref.project.projectDir,
9579
9704
  SOURCE_ROOT: ref.project.projectDir,
@@ -9604,6 +9729,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
9604
9729
  for (const file of read) xcconfigs.add(file);
9605
9730
  const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
9606
9731
  const members = targetMembers(ref, settings2, options, keys, xcconfigs);
9732
+ const searchRules = recursiveSearchRules(settings2);
9607
9733
  const implementations = members.allSources.filter(
9608
9734
  (file) => /\.(c|cc|cpp|cxx|m|mm)$/.test(file)
9609
9735
  );
@@ -9628,7 +9754,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
9628
9754
  settings: settings2,
9629
9755
  keys,
9630
9756
  module: {
9631
- name: name2,
9757
+ name: name3,
9632
9758
  moduleName: applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier"),
9633
9759
  ...members,
9634
9760
  languageMode: swiftVersion >= 6 ? 6 : 5,
@@ -9646,10 +9772,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
9646
9772
  headerSearchPaths: [
9647
9773
  ...settingList(settings2("HEADER_SEARCH_PATHS")),
9648
9774
  ...settingList(settings2("USER_HEADER_SEARCH_PATHS"))
9649
- ].map(absolute),
9650
- frameworkSearchPaths: settingList(settings2("FRAMEWORK_SEARCH_PATHS")).map(
9651
- absolute
9652
- ),
9775
+ ].flatMap((raw2) => expandSearchPath(absolute(raw2), searchRules)),
9776
+ frameworkSearchPaths: settingList(
9777
+ settings2("FRAMEWORK_SEARCH_PATHS")
9778
+ ).flatMap((raw2) => expandSearchPath(absolute(raw2), searchRules)),
9653
9779
  flags: [
9654
9780
  ...settings2("CLANG_ENABLE_OBJC_ARC") === "YES" ? ["-fobjc-arc"] : [],
9655
9781
  ...settings2("CLANG_ENABLE_OBJC_WEAK") === "YES" ? ["-fobjc-weak"] : [],
@@ -9771,12 +9897,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
9771
9897
  const fileId = str(project.object(buildFileId)?.fileRef);
9772
9898
  const file = project.object(fileId);
9773
9899
  const tree = str(file?.sourceTree);
9774
- const name2 = /([^/]+)\.(xc)?framework$/.exec(str(file?.path) ?? "")?.[1];
9775
- if (file?.isa !== "PBXFileReference" || !name2) continue;
9900
+ const name3 = /([^/]+)\.(xc)?framework$/.exec(str(file?.path) ?? "")?.[1];
9901
+ if (file?.isa !== "PBXFileReference" || !name3) continue;
9776
9902
  if (tree === "BUILT_PRODUCTS_DIR" || tree === "SDKROOT" || tree === "DEVELOPER_DIR")
9777
9903
  continue;
9778
9904
  const resolved = fileId ? project.resolvePath(fileId) : null;
9779
- if (!binaryFrameworks.get(name2)) binaryFrameworks.set(name2, resolved);
9905
+ if (!binaryFrameworks.get(name3)) binaryFrameworks.set(name3, resolved);
9780
9906
  }
9781
9907
  }
9782
9908
  }
@@ -9811,7 +9937,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
9811
9937
  localPackageDirs: [
9812
9938
  ...new Set(localPackageDirs.map((dir) => import_node_fs6.default.realpathSync(dir)))
9813
9939
  ].sort(),
9814
- binaryFrameworks: [...binaryFrameworks].map(([name2, file]) => ({ name: name2, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
9940
+ binaryFrameworks: [...binaryFrameworks].map(([name3, file]) => ({ name: name3, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
9815
9941
  packageResolved,
9816
9942
  appTargets: appTargetNames,
9817
9943
  configuration,
@@ -10108,7 +10234,7 @@ function collectBridgeModuleSources(appRoot, signal) {
10108
10234
  const own = (file) => {
10109
10235
  const resolved = import_node_fs7.default.realpathSync(file);
10110
10236
  if ([file, resolved].some(
10111
- (name2) => name2.split(import_node_path9.default.sep).some((part) => part === "Pods" || part === "node_modules")
10237
+ (name3) => name3.split(import_node_path9.default.sep).some((part) => part === "Pods" || part === "node_modules")
10112
10238
  ))
10113
10239
  return false;
10114
10240
  const relative = import_node_path9.default.relative(projectRoot, resolved);
@@ -10127,7 +10253,7 @@ function collectBridgeModuleSources(appRoot, signal) {
10127
10253
  ];
10128
10254
  if (objc.length === 0) continue;
10129
10255
  const headers = [...new Set(objc.map((file) => import_node_path9.default.dirname(file)))].flatMap(
10130
- (dir) => import_node_fs7.default.readdirSync(dir).filter((name2) => name2.endsWith(".h")).sort().map((name2) => import_node_path9.default.join(dir, name2)).filter(own)
10256
+ (dir) => import_node_fs7.default.readdirSync(dir).filter((name3) => name3.endsWith(".h")).sort().map((name3) => import_node_path9.default.join(dir, name3)).filter(own)
10131
10257
  );
10132
10258
  const declarations = parseObjectiveCModules(
10133
10259
  [...objc, ...headers].map((file) => ({
@@ -10272,7 +10398,7 @@ async function swiftBinaryModules(binary) {
10272
10398
  );
10273
10399
  if (import_node_fs8.default.existsSync(cached2)) {
10274
10400
  const value = JSON.parse(import_node_fs8.default.readFileSync(cached2, "utf8"));
10275
- if (Array.isArray(value) && value.every((name2) => typeof name2 === "string"))
10401
+ if (Array.isArray(value) && value.every((name3) => typeof name3 === "string"))
10276
10402
  return value;
10277
10403
  }
10278
10404
  const modules = frameworkModules(await zipEntries(binary.url));
@@ -10924,10 +11050,10 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
10924
11050
  };
10925
11051
  const catalogs = paths.filter((path25) => baseOf(path25) === "Contents.json");
10926
11052
  for (const contentsPath of catalogs) {
10927
- const name2 = catalogEntryName(contentsPath, ".imageset", readText);
10928
- if (name2 === null) continue;
11053
+ const name3 = catalogEntryName(contentsPath, ".imageset", readText);
11054
+ if (name3 === null) continue;
10929
11055
  const { bundlePath, names } = namesFor(contentsPath);
10930
- if (names.has(name2)) continue;
11056
+ if (names.has(name3)) continue;
10931
11057
  let parsed;
10932
11058
  try {
10933
11059
  const text4 = readText(contentsPath);
@@ -10941,10 +11067,10 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
10941
11067
  const dir = contentsPath.split("/").slice(0, -1).join("/");
10942
11068
  const variants = imagesetFiles(images);
10943
11069
  if (variants.length === 0) continue;
10944
- names.add(name2);
11070
+ names.add(name3);
10945
11071
  for (const variant of variants)
10946
11072
  table.push({
10947
- name: name2,
11073
+ name: name3,
10948
11074
  file: `${dir}/${variant.filename}`,
10949
11075
  scale: variant.scale,
10950
11076
  bundlePath
@@ -10952,11 +11078,11 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
10952
11078
  }
10953
11079
  for (const path25 of paths) {
10954
11080
  if (!isFlatResourceImage(path25)) continue;
10955
- const name2 = baseOf(path25).slice(0, -extOf(path25).length);
11081
+ const name3 = baseOf(path25).slice(0, -extOf(path25).length);
10956
11082
  const { bundlePath, names } = namesFor(path25);
10957
- if (name2 === "" || names.has(name2)) continue;
10958
- names.add(name2);
10959
- table.push({ name: name2, file: path25, scale: flatScale(path25), bundlePath });
11083
+ if (name3 === "" || names.has(name3)) continue;
11084
+ names.add(name3);
11085
+ table.push({ name: name3, file: path25, scale: flatScale(path25), bundlePath });
10960
11086
  }
10961
11087
  return table;
10962
11088
  }
@@ -10986,8 +11112,8 @@ function colorsetValue(color) {
10986
11112
  function enumerateBundleColors(paths, readText) {
10987
11113
  const table = {};
10988
11114
  for (const contentsPath of paths.filter((path25) => baseOf(path25) === "Contents.json")) {
10989
- const name2 = catalogEntryName(contentsPath, ".colorset", readText);
10990
- if (name2 === null || name2 in table) continue;
11115
+ const name3 = catalogEntryName(contentsPath, ".colorset", readText);
11116
+ if (name3 === null || name3 in table) continue;
10991
11117
  let colors;
10992
11118
  try {
10993
11119
  const text4 = readText(contentsPath);
@@ -11016,8 +11142,8 @@ function enumerateBundleColors(paths, readText) {
11016
11142
  else light = value;
11017
11143
  }
11018
11144
  if (light === null) continue;
11019
- if (typeof light === "object") table[name2] = light;
11020
- else table[name2] = { light, dark: typeof dark === "string" ? dark : light };
11145
+ if (typeof light === "object") table[name3] = light;
11146
+ else table[name3] = { light, dark: typeof dark === "string" ? dark : light };
11021
11147
  }
11022
11148
  return table;
11023
11149
  }
@@ -11078,10 +11204,10 @@ function guide(svg, id, axis) {
11078
11204
  function enumerateBundleSymbols(paths, readText, bundleForFile) {
11079
11205
  const table = {};
11080
11206
  for (const contentsPath of paths.filter((path25) => baseOf(path25) === "Contents.json")) {
11081
- const name2 = catalogEntryName(contentsPath, ".symbolset", readText);
11082
- if (name2 === null) continue;
11207
+ const name3 = catalogEntryName(contentsPath, ".symbolset", readText);
11208
+ if (name3 === null) continue;
11083
11209
  const bundle = bundleForFile(contentsPath);
11084
- const key2 = bundle === "." ? name2 : `${bundle}/${name2}`;
11210
+ const key2 = bundle === "." ? name3 : `${bundle}/${name3}`;
11085
11211
  if (Object.hasOwn(table, key2)) continue;
11086
11212
  let symbols;
11087
11213
  try {
@@ -11121,7 +11247,7 @@ function enumerateBundleSymbols(paths, readText, bundleForFile) {
11121
11247
  return table;
11122
11248
  }
11123
11249
  function isCopiedResource(path25) {
11124
- if (path25.split("/").some((segment2) => segment2.endsWith(".atlasc"))) return true;
11250
+ if (path25.split("/").some((segment2) => /\.(atlasc|bundle)$/.test(segment2))) return true;
11125
11251
  const ext = extOf(path25);
11126
11252
  if (ext === ".json" || ext === ".xcstrings") return true;
11127
11253
  return !RASTER_EXTENSIONS.has(ext) && !COMPILED_EXTENSIONS.has(ext) && !path25.split("/").some((segment2) => segment2.endsWith(".xcassets"));
@@ -11138,9 +11264,7 @@ function enumerateBundleResources(paths) {
11138
11264
  });
11139
11265
  for (const file of ordered) {
11140
11266
  const parts = file.split("/");
11141
- const nested = parts.findIndex(
11142
- (part) => part.endsWith(".atlasc") || part.endsWith(".lproj")
11143
- );
11267
+ const nested = parts.findIndex((part) => /\.(atlasc|lproj|bundle)$/.test(part));
11144
11268
  const base = nested < 0 ? baseOf(file) : parts.slice(nested).join("/");
11145
11269
  if (seen.has(base)) continue;
11146
11270
  seen.add(base);
@@ -11220,7 +11344,7 @@ function plural(node, specifier) {
11220
11344
  const forms = dictionary();
11221
11345
  forms.NSStringFormatSpecTypeKey = "NSStringPluralRuleType";
11222
11346
  forms.NSStringFormatValueTypeKey = specifier;
11223
- for (const [name2, value] of Object.entries(object(node))) forms[name2] = unit(value);
11347
+ for (const [name3, value] of Object.entries(object(node))) forms[name3] = unit(value);
11224
11348
  return forms;
11225
11349
  }
11226
11350
  function resolve(node, key2) {
@@ -11228,7 +11352,7 @@ function resolve(node, key2) {
11228
11352
  if (value.substitutions !== void 0) {
11229
11353
  let format = unit(value);
11230
11354
  const rules = dictionary();
11231
- for (const [name2, raw2] of Object.entries(object(value.substitutions))) {
11355
+ for (const [name3, raw2] of Object.entries(object(value.substitutions))) {
11232
11356
  const sub = object(raw2), specifier = typeof sub.formatSpecifier === "string" ? sub.formatSpecifier : "";
11233
11357
  const forms = plural(object(sub.variations).plural, specifier);
11234
11358
  for (const [category, text4] of Object.entries(forms)) {
@@ -11241,10 +11365,10 @@ function resolve(node, key2) {
11241
11365
  }
11242
11366
  if (typeof sub.argNum === "number")
11243
11367
  format = format.replaceAll(
11244
- "%#@" + name2 + "@",
11245
- "%" + sub.argNum + "$#@" + name2 + "@"
11368
+ "%#@" + name3 + "@",
11369
+ "%" + sub.argNum + "$#@" + name3 + "@"
11246
11370
  );
11247
- rules[name2] = forms;
11371
+ rules[name3] = forms;
11248
11372
  }
11249
11373
  return { rules: { NSStringLocalizedFormatKey: format, ...rules } };
11250
11374
  }
@@ -11259,9 +11383,9 @@ function resolve(node, key2) {
11259
11383
  const specifier = numeric.specifier;
11260
11384
  const forms = plural(sourceForms, specifier);
11261
11385
  if (argument > 0) {
11262
- for (const [name2, text4] of Object.entries(forms))
11263
- if (!name2.startsWith("NSString") && typeof text4 === "string")
11264
- forms[name2] = positioned(text4);
11386
+ for (const [name3, text4] of Object.entries(forms))
11387
+ if (!name3.startsWith("NSString") && typeof text4 === "string")
11388
+ forms[name3] = positioned(text4);
11265
11389
  }
11266
11390
  return {
11267
11391
  rules: {
@@ -11285,8 +11409,8 @@ function resolve(node, key2) {
11285
11409
  }
11286
11410
  throw Error("unsupported string catalog variation for " + key2);
11287
11411
  }
11288
- function compileCatalogTables(source, name2) {
11289
- if (!isSwiftResourcePath(name2) || name2.includes("/"))
11412
+ function compileCatalogTables(source, name3) {
11413
+ if (!isSwiftResourcePath(name3) || name3.includes("/"))
11290
11414
  throw Error("invalid string catalog table name");
11291
11415
  const root = object(JSON.parse(source)), strings3 = object(root.strings);
11292
11416
  const output = {};
@@ -11309,21 +11433,21 @@ function compileCatalogTables(source, name2) {
11309
11433
  const localizations = entry.localizations === void 0 ? {} : object(entry.localizations);
11310
11434
  if (entry.extractionState === "manual") {
11311
11435
  if (!Object.hasOwn(localizations, sourceLanguage))
11312
- (output[sourceLanguage + ".lproj/" + name2 + ".strings"] ??= dictionary())[key2] = key2;
11436
+ (output[sourceLanguage + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = key2;
11313
11437
  const source2 = !Object.hasOwn(localizations, sourceLanguage) ? void 0 : object(localizations[sourceLanguage]);
11314
11438
  const variations = source2?.variations === void 0 ? void 0 : object(source2.variations);
11315
11439
  if (variations?.plural !== void 0) {
11316
11440
  for (const language of languages)
11317
11441
  if (!Object.hasOwn(localizations, language))
11318
- (output[language + ".lproj/" + name2 + ".strings"] ??= dictionary())[key2] = key2;
11442
+ (output[language + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = key2;
11319
11443
  }
11320
11444
  }
11321
11445
  for (const [language, node] of Object.entries(localizations)) {
11322
11446
  const resolved = resolve(node, key2);
11323
11447
  if (resolved.text !== void 0)
11324
- (output[language + ".lproj/" + name2 + ".strings"] ??= dictionary())[key2] = resolved.text;
11448
+ (output[language + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = resolved.text;
11325
11449
  if (resolved.rules !== void 0)
11326
- (output[language + ".lproj/" + name2 + ".stringsdict"] ??= dictionary())[key2] = resolved.rules;
11450
+ (output[language + ".lproj/" + name3 + ".stringsdict"] ??= dictionary())[key2] = resolved.rules;
11327
11451
  }
11328
11452
  }
11329
11453
  return output;
@@ -11333,9 +11457,9 @@ function plist2(value) {
11333
11457
  if (typeof value === "string") return "<string>" + escaped(value) + "</string>";
11334
11458
  return "<dict>" + Object.entries(value).map(([key2, item]) => "<key>" + escaped(key2) + "</key>" + plist2(item)).join("") + "</dict>";
11335
11459
  }
11336
- function compileStringCatalog(source, name2) {
11460
+ function compileStringCatalog(source, name3) {
11337
11461
  return Object.fromEntries(
11338
- Object.entries(compileCatalogTables(source, name2)).map(([path25, table]) => [
11462
+ Object.entries(compileCatalogTables(source, name3)).map(([path25, table]) => [
11339
11463
  path25,
11340
11464
  '<?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">' + plist2(table) + "</plist>"
11341
11465
  ])
@@ -11349,13 +11473,13 @@ var init_stringCatalog = __esm({
11349
11473
  });
11350
11474
 
11351
11475
  // src/public-brand.ts
11352
- var name, peachPublicBrand, rnxPublicBrand;
11476
+ var name2, peachPublicBrand, rnxPublicBrand;
11353
11477
  var init_public_brand = __esm({
11354
11478
  "src/public-brand.ts"() {
11355
11479
  "use strict";
11356
- name = "Peach";
11480
+ name2 = "Peach";
11357
11481
  peachPublicBrand = Object.freeze({
11358
- name,
11482
+ name: name2,
11359
11483
  packageName: "peachsim",
11360
11484
  commandName: "peach",
11361
11485
  domain: "peachsim.com",
@@ -13709,15 +13833,15 @@ function materializeObjcSdk(cacheDir5) {
13709
13833
  }
13710
13834
  function missingHeader(missing) {
13711
13835
  const lines = ["#import <Foundation/Foundation.h>", "#import <UIKit/UIKit.h>"];
13712
- for (const [name2, kind] of missing) if (kind === "macro") lines.push(`#define ${name2}`);
13713
- for (const [name2, kind] of missing)
13714
- if (kind === "protocol") lines.push(`@protocol ${name2} <NSObject>
13836
+ for (const [name3, kind] of missing) if (kind === "macro") lines.push(`#define ${name3}`);
13837
+ for (const [name3, kind] of missing)
13838
+ if (kind === "protocol") lines.push(`@protocol ${name3} <NSObject>
13715
13839
  @end`);
13716
- for (const [name2, kind] of missing)
13717
- if (kind === "class") lines.push(`@interface ${name2} : NSObject
13840
+ for (const [name3, kind] of missing)
13841
+ if (kind === "class") lines.push(`@interface ${name3} : NSObject
13718
13842
  @end`);
13719
- for (const [name2, kind] of missing)
13720
- if (kind === "struct") lines.push(`typedef struct ${name2} { char opaque; } ${name2};`);
13843
+ for (const [name3, kind] of missing)
13844
+ if (kind === "struct") lines.push(`typedef struct ${name3} { char opaque; } ${name3};`);
13721
13845
  return `${lines.join("\n")}
13722
13846
  `;
13723
13847
  }
@@ -13809,11 +13933,11 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13809
13933
  stubbed.add(include2);
13810
13934
  const slash = include2.indexOf("/");
13811
13935
  if (slash > 0 && /^[A-Z]/.test(include2)) {
13812
- const name2 = include2.slice(0, slash);
13813
- const umbrella = `${name2}/${name2}.h`;
13936
+ const name3 = include2.slice(0, slash);
13937
+ const umbrella = `${name3}/${name3}.h`;
13814
13938
  if (Object.hasOwn(
13815
13939
  IOS_SDK_HEADERS,
13816
- `System/Library/Frameworks/${name2}.framework/Headers/${name2}.h`
13940
+ `System/Library/Frameworks/${name3}.framework/Headers/${name3}.h`
13817
13941
  )) {
13818
13942
  const header2 = import_node_path14.default.join(stubIncludes, include2);
13819
13943
  import_node_fs12.default.mkdirSync(import_node_path14.default.dirname(header2), { recursive: true });
@@ -13821,7 +13945,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13821
13945
  `);
13822
13946
  return true;
13823
13947
  }
13824
- const root = import_node_path14.default.join(stubs, `${name2}.framework`);
13948
+ const root = import_node_path14.default.join(stubs, `${name3}.framework`);
13825
13949
  const header = import_node_path14.default.join(root, "Headers", include2.slice(slash + 1));
13826
13950
  import_node_fs12.default.mkdirSync(import_node_path14.default.dirname(header), { recursive: true });
13827
13951
  import_node_fs12.default.writeFileSync(
@@ -13831,7 +13955,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13831
13955
  import_node_fs12.default.mkdirSync(import_node_path14.default.join(root, "Modules"), { recursive: true });
13832
13956
  import_node_fs12.default.writeFileSync(
13833
13957
  import_node_path14.default.join(root, "Modules", "module.modulemap"),
13834
- `framework module ${name2} {
13958
+ `framework module ${name3} {
13835
13959
  umbrella "Headers"
13836
13960
  export *
13837
13961
  module * { export * }
@@ -13861,10 +13985,10 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13861
13985
  const text4 = import_node_fs12.default.existsSync(file) ? import_node_fs12.default.readFileSync(file, "utf8").split("\n")[line - 1] : void 0;
13862
13986
  if (text4 === void 0) return null;
13863
13987
  const rest = text4.slice(column - 1);
13864
- const name2 = /^[A-Za-z_]\w*/.exec(rest)?.[0];
13865
- return name2 ? { name: name2, after: rest.slice(name2.length) } : null;
13988
+ const name3 = /^[A-Za-z_]\w*/.exec(rest)?.[0];
13989
+ return name3 ? { name: name3, after: rest.slice(name3.length) } : null;
13866
13990
  };
13867
- const typeKind = (name2, after) => /^[A-Z][A-Z0-9_]+$/.test(name2) && !/^\s*\*/.test(after) ? "macro" : /^\s*\*/.test(after) ? "class" : "struct";
13991
+ const typeKind = (name3, after) => /^[A-Z][A-Z0-9_]+$/.test(name3) && !/^\s*\*/.test(after) ? "macro" : /^\s*\*/.test(after) ? "class" : "struct";
13868
13992
  for (let round = 0; ; round++) {
13869
13993
  import_node_fs12.default.rmSync(out, { recursive: true, force: true });
13870
13994
  import_node_fs12.default.mkdirSync(out, { recursive: true });
@@ -13893,9 +14017,9 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13893
14017
  ];
13894
14018
  if (errors.length === 0 && run5.status === 0) break;
13895
14019
  let progress = false;
13896
- const learn = (name2, kind) => {
13897
- if (missing.has(name2)) return;
13898
- missing.set(name2, kind);
14020
+ const learn = (name3, kind) => {
14021
+ if (missing.has(name3)) return;
14022
+ missing.set(name3, kind);
13899
14023
  progress = true;
13900
14024
  };
13901
14025
  for (const [, file, line, column, message] of errors) {
@@ -13924,8 +14048,8 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13924
14048
  const unknown = /^unknown type name '(\w+)'$/.exec(message);
13925
14049
  if ((unknown || message === "expected a type") && file && line && column) {
13926
14050
  const token = tokenAt(file, Number(line), Number(column));
13927
- const name2 = unknown?.[1] ?? token?.name;
13928
- if (name2) learn(name2, typeKind(name2, token?.name === name2 ? token.after : ""));
14051
+ const name3 = unknown?.[1] ?? token?.name;
14052
+ if (name3) learn(name3, typeKind(name3, token?.name === name3 ? token.after : ""));
13929
14053
  }
13930
14054
  }
13931
14055
  if (!progress || round === ROUNDS)
@@ -13934,7 +14058,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
13934
14058
  );
13935
14059
  if (missing.size > 0) declareMissing();
13936
14060
  }
13937
- const graphs = import_node_fs12.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs12.default.readFileSync(import_node_path14.default.join(out, name2), "utf8")));
14061
+ const graphs = import_node_fs12.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs12.default.readFileSync(import_node_path14.default.join(out, name3), "utf8")));
13938
14062
  const imports = /* @__PURE__ */ new Set(["Foundation", "UIKit"]);
13939
14063
  for (const text4 of originals.values())
13940
14064
  for (const match of text4.matchAll(
@@ -14026,8 +14150,8 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work) {
14026
14150
  walk2(inner);
14027
14151
  };
14028
14152
  walk2(JSON.parse(run5.stdout));
14029
- for (const [id, name2] of wanted) {
14030
- const value = constants.get(name2);
14153
+ for (const [id, name3] of wanted) {
14154
+ const value = constants.get(name3);
14031
14155
  if (value !== void 0) values.set(id, value.toString());
14032
14156
  }
14033
14157
  return values;
@@ -14224,7 +14348,7 @@ function compileObjcPeerMetadata(args) {
14224
14348
  const emitted = [...symbols.stdout.matchAll(/^\._OBJC_CLASS_(\w+) [^U] /gm)].map(
14225
14349
  (match) => match[1]
14226
14350
  );
14227
- 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))
14351
+ 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))
14228
14352
  throw new ObjcPeerMetadataError(
14229
14353
  `Objective-C peer metadata contains unexpected classes or methods: ${receipt}`,
14230
14354
  files2,
@@ -14258,10 +14382,10 @@ function swiftCommand() {
14258
14382
  return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path16.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
14259
14383
  }
14260
14384
  function dump(dir) {
14261
- const manifests = import_node_fs14.default.readdirSync(dir).filter((name2) => /^Package(@swift-[\d.]+)?\.swift$/.test(name2)).sort();
14385
+ const manifests = import_node_fs14.default.readdirSync(dir).filter((name3) => /^Package(@swift-[\d.]+)?\.swift$/.test(name3)).sort();
14262
14386
  const command = swiftCommand();
14263
14387
  const key2 = (0, import_node_crypto10.createHash)("sha256").update(JSON.stringify([command, import_node_path16.default.resolve(dir)])).update(
14264
- manifests.map((name2) => `${name2}\0${import_node_fs14.default.readFileSync(import_node_path16.default.join(dir, name2), "utf8")}`).join("\0")
14388
+ manifests.map((name3) => `${name3}\0${import_node_fs14.default.readFileSync(import_node_path16.default.join(dir, name3), "utf8")}`).join("\0")
14265
14389
  ).digest("hex").slice(0, 32);
14266
14390
  const cached2 = import_node_path16.default.join(cacheDir3, `${key2}.json`);
14267
14391
  if (import_node_fs14.default.existsSync(cached2))
@@ -14302,16 +14426,16 @@ function defaultTraits(manifest) {
14302
14426
  const traits = new Map(
14303
14427
  array(manifest.traits).map((trait) => [
14304
14428
  string(record(trait).name) ?? "",
14305
- array(record(trait).enabledTraits).flatMap((name2) => string(name2) ?? [])
14429
+ array(record(trait).enabledTraits).flatMap((name3) => string(name3) ?? [])
14306
14430
  ])
14307
14431
  );
14308
14432
  const enabled = /* @__PURE__ */ new Set();
14309
14433
  const pending = [...traits.get("default") ?? []];
14310
14434
  while (pending.length > 0) {
14311
- const name2 = pending.pop();
14312
- if (enabled.has(name2)) continue;
14313
- enabled.add(name2);
14314
- pending.push(...traits.get(name2) ?? []);
14435
+ const name3 = pending.pop();
14436
+ if (enabled.has(name3)) continue;
14437
+ enabled.add(name3);
14438
+ pending.push(...traits.get(name3) ?? []);
14315
14439
  }
14316
14440
  return enabled;
14317
14441
  }
@@ -14320,7 +14444,7 @@ function linksOnIOS(condition, traits) {
14320
14444
  const platforms = array(platformNames);
14321
14445
  if (platforms.length > 0 && !platforms.includes("ios")) return false;
14322
14446
  const gates = array(needed);
14323
- return gates.length === 0 || gates.some((name2) => traits.has(string(name2) ?? ""));
14447
+ return gates.length === 0 || gates.some((name3) => traits.has(string(name3) ?? ""));
14324
14448
  }
14325
14449
  function swiftPackageManifest(dir) {
14326
14450
  dir = import_node_fs14.default.realpathSync(dir);
@@ -14355,10 +14479,10 @@ function swiftPackageManifest(dir) {
14355
14479
  }
14356
14480
  const products = /* @__PURE__ */ new Map();
14357
14481
  for (const product of array(raw2.products)) {
14358
- const { name: name3, targets: targets2, type } = record(product);
14359
- if (!string(name3) || !("library" in record(type))) continue;
14482
+ const { name: name4, targets: targets2, type } = record(product);
14483
+ if (!string(name4) || !("library" in record(type))) continue;
14360
14484
  products.set(
14361
- string(name3),
14485
+ string(name4),
14362
14486
  array(targets2).flatMap((target) => string(target) ?? [])
14363
14487
  );
14364
14488
  }
@@ -14366,12 +14490,12 @@ function swiftPackageManifest(dir) {
14366
14490
  const names = new Set(array(raw2.targets).map((target) => string(record(target).name)));
14367
14491
  for (const entry of array(raw2.targets)) {
14368
14492
  const target = record(entry);
14369
- const name3 = string(target.name);
14493
+ const name4 = string(target.name);
14370
14494
  const kind = string(target.type);
14371
- if (!name3 || !isTargetType(kind)) continue;
14495
+ if (!name4 || !isTargetType(kind)) continue;
14372
14496
  const declared = string(target.path);
14373
14497
  const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
14374
- const targetDir = declared ? import_node_path16.default.resolve(dir, declared) : roots.map((root) => import_node_path16.default.join(dir, root, name3)).find((candidate) => import_node_fs14.default.existsSync(candidate)) ?? import_node_path16.default.join(dir, roots[0], name3);
14498
+ const targetDir = declared ? import_node_path16.default.resolve(dir, declared) : roots.map((root) => import_node_path16.default.join(dir, root, name4)).find((candidate) => import_node_fs14.default.existsSync(candidate)) ?? import_node_path16.default.join(dir, roots[0], name4);
14375
14499
  const dependencies = [];
14376
14500
  for (const dependency of array(target.dependencies)) {
14377
14501
  const { target: local, product, byName } = record(dependency);
@@ -14419,7 +14543,7 @@ function swiftPackageManifest(dir) {
14419
14543
  const flags = header ? ["-I", import_node_path16.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;
14420
14544
  if (!flags)
14421
14545
  throw new Error(
14422
- `${name3}: unsupported ${tool} compiler setting ${JSON.stringify(rawKind)}`
14546
+ `${name4}: unsupported ${tool} compiler setting ${JSON.stringify(rawKind)}`
14423
14547
  );
14424
14548
  nativeSettings.push({
14425
14549
  tool,
@@ -14449,8 +14573,8 @@ function swiftPackageManifest(dir) {
14449
14573
  });
14450
14574
  }
14451
14575
  }
14452
- targets.set(name3, {
14453
- name: name3,
14576
+ targets.set(name4, {
14577
+ name: name4,
14454
14578
  type: kind,
14455
14579
  dir: targetDir,
14456
14580
  sources: target.sources == null ? null : array(target.sources).flatMap((file) => string(file) ?? []),
@@ -14467,9 +14591,9 @@ function swiftPackageManifest(dir) {
14467
14591
  checksum: string(target.checksum) ?? null
14468
14592
  });
14469
14593
  }
14470
- const name2 = string(raw2.name);
14471
- if (!name2) throw new Error(`swiftpm returned no package name for ${dir}`);
14472
- const manifest = { name: name2, dir, products, targets, packages };
14594
+ const name3 = string(raw2.name);
14595
+ if (!name3) throw new Error(`swiftpm returned no package name for ${dir}`);
14596
+ const manifest = { name: name3, dir, products, targets, packages };
14473
14597
  evaluated.set(key2, manifest);
14474
14598
  return manifest;
14475
14599
  }
@@ -14621,18 +14745,18 @@ function resolveSwiftPackages(options) {
14621
14745
  };
14622
14746
  const targets = /* @__PURE__ */ new Map();
14623
14747
  const targetOutcomes = /* @__PURE__ */ new Map();
14624
- const resolveTarget = (pkg, name2) => {
14625
- const key2 = `${pkg.manifest.dir}\0${name2}`;
14748
+ const resolveTarget = (pkg, name3) => {
14749
+ const key2 = `${pkg.manifest.dir}\0${name3}`;
14626
14750
  if (targetOutcomes.has(key2)) return targetOutcomes.get(key2);
14627
14751
  targetOutcomes.set(key2, []);
14628
14752
  const outcome = (() => {
14629
- if (provided.has(name2)) return [];
14630
- const target = pkg.manifest.targets.get(name2);
14753
+ if (provided.has(name3)) return [];
14754
+ const target = pkg.manifest.targets.get(name3);
14631
14755
  if (!target)
14632
- return [`${import_node_path17.default.basename(pkg.manifest.dir)} declares no target ${name2}`];
14756
+ return [`${import_node_path17.default.basename(pkg.manifest.dir)} declares no target ${name3}`];
14633
14757
  const files2 = target.type === "regular" || target.type === "system" ? swiftTargetFiles(pkg.manifest, target) : [];
14634
- const gap = options.binaryGaps?.get(name2);
14635
- 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;
14758
+ const gap = options.binaryGaps?.get(name3);
14759
+ 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;
14636
14760
  const reasons = target.dependencies.map((dependency) => {
14637
14761
  if (dependency.kind === "target") return resolveTarget(pkg, dependency.name);
14638
14762
  const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
@@ -14641,8 +14765,8 @@ function resolveSwiftPackages(options) {
14641
14765
  const blocked = blockers([ownReason ? [ownReason] : [], ...reasons]);
14642
14766
  if (blocked.length > 0) return blocked;
14643
14767
  const relative = files2.map((file) => import_node_path17.default.relative(target.dir, file));
14644
- targets.set(`${pkg.manifest.dir}\0${name2}`, {
14645
- name: name2,
14768
+ targets.set(`${pkg.manifest.dir}\0${name3}`, {
14769
+ name: name3,
14646
14770
  path: "",
14647
14771
  dir: target.dir,
14648
14772
  files: files2,
@@ -14656,9 +14780,9 @@ function resolveSwiftPackages(options) {
14656
14780
  const source = pkg.manifest.packages.get(dependency.package);
14657
14781
  const nested = source && packages.get("dir" in source ? import_node_path17.default.resolve(source.dir) : source.url);
14658
14782
  return nested && typeof nested !== "string" ? (nested.manifest.products.get(dependency.name) ?? []).map(
14659
- (name3) => ({
14783
+ (name4) => ({
14660
14784
  kind: "target",
14661
- name: name3
14785
+ name: name4
14662
14786
  })
14663
14787
  ) : [];
14664
14788
  }),
@@ -14677,7 +14801,7 @@ function resolveSwiftPackages(options) {
14677
14801
  const resolveProduct = (pkg, product) => {
14678
14802
  if (provided.has(product)) return [];
14679
14803
  const roots = pkg.manifest.products.get(product);
14680
- const reason = !roots ? [`${import_node_path17.default.basename(pkg.manifest.dir)} has no library ${product}`] : blockers(roots.map((name2) => resolveTarget(pkg, name2)));
14804
+ const reason = !roots ? [`${import_node_path17.default.basename(pkg.manifest.dir)} has no library ${product}`] : blockers(roots.map((name3) => resolveTarget(pkg, name3)));
14681
14805
  productOutcomes.set(`${pkg.manifest.dir}\0${product}`, { pkg, reason });
14682
14806
  return reason;
14683
14807
  };
@@ -14708,14 +14832,14 @@ function resolveSwiftPackages(options) {
14708
14832
  }
14709
14833
  for (const pkg of packages.values()) {
14710
14834
  if (typeof pkg === "string") continue;
14711
- for (const [name2, target] of pkg.manifest.targets) {
14835
+ for (const [name3, target] of pkg.manifest.targets) {
14712
14836
  if (target.type === "test" || target.type === "plugin" || target.type === "macro")
14713
14837
  continue;
14714
14838
  if (target.type === "executable") continue;
14715
14839
  const objc = target.type === "regular" && swiftTargetFiles(pkg.manifest, target).some((file) => /\.(m|mm)$/.test(file));
14716
14840
  if (target.type === "binary" || objc)
14717
14841
  result.binaries.push({
14718
- target: name2,
14842
+ target: name3,
14719
14843
  source: pkg.source,
14720
14844
  url: target.url,
14721
14845
  checksum: target.checksum,
@@ -14728,9 +14852,9 @@ function resolveSwiftPackages(options) {
14728
14852
  )
14729
14853
  } : {}
14730
14854
  });
14731
- const reason = resolveTarget(pkg, name2);
14732
- if (reason.length > 0 && !result.modules.has(name2))
14733
- result.modules.set(name2, { source: pkg.source, reason: reason.join("; ") });
14855
+ const reason = resolveTarget(pkg, name3);
14856
+ if (reason.length > 0 && !result.modules.has(name3))
14857
+ result.modules.set(name3, { source: pkg.source, reason: reason.join("; ") });
14734
14858
  }
14735
14859
  }
14736
14860
  for (const [key2, { pkg, reason }] of productOutcomes) {
@@ -14739,11 +14863,11 @@ function resolveSwiftPackages(options) {
14739
14863
  result.modules.set(product, { source: pkg.source, reason: reason.join("; ") });
14740
14864
  }
14741
14865
  const reached = /* @__PURE__ */ new Set();
14742
- const reach = (pkg, name2) => {
14743
- const key2 = `${pkg.manifest.dir}\0${name2}`;
14866
+ const reach = (pkg, name3) => {
14867
+ const key2 = `${pkg.manifest.dir}\0${name3}`;
14744
14868
  if (reached.has(key2)) return;
14745
14869
  reached.add(key2);
14746
- for (const dependency of pkg.manifest.targets.get(name2)?.dependencies ?? []) {
14870
+ for (const dependency of pkg.manifest.targets.get(name3)?.dependencies ?? []) {
14747
14871
  if (dependency.kind === "target") reach(pkg, dependency.name);
14748
14872
  else {
14749
14873
  const source = pkg.manifest.packages.get(dependency.package);
@@ -14770,11 +14894,11 @@ function resolveSwiftPackages(options) {
14770
14894
  if (!pkg || typeof pkg === "string") continue;
14771
14895
  const headers = /* @__PURE__ */ new Map();
14772
14896
  const visited = /* @__PURE__ */ new Set();
14773
- const visit = (owner, name2) => {
14774
- const key2 = `${owner.manifest.dir}\0${name2}`;
14897
+ const visit = (owner, name3) => {
14898
+ const key2 = `${owner.manifest.dir}\0${name3}`;
14775
14899
  if (visited.has(key2)) return;
14776
14900
  visited.add(key2);
14777
- const target = owner.manifest.targets.get(name2);
14901
+ const target = owner.manifest.targets.get(name3);
14778
14902
  if (!target) return;
14779
14903
  const dir = import_node_path17.default.join(target.dir, target.publicHeadersPath);
14780
14904
  for (const dependency of target.dependencies) {
@@ -14787,8 +14911,8 @@ function resolveSwiftPackages(options) {
14787
14911
  visit(nested, root);
14788
14912
  }
14789
14913
  }
14790
- if (name2 !== binary.target && import_node_fs15.default.existsSync(dir))
14791
- headers.set(name2, import_node_path17.default.relative(binary.dir, dir));
14914
+ if (name3 !== binary.target && import_node_fs15.default.existsSync(dir))
14915
+ headers.set(name3, import_node_path17.default.relative(binary.dir, dir));
14792
14916
  };
14793
14917
  visit(pkg, binary.target);
14794
14918
  binary.headerDependencies = [...headers].map(([module2, path25]) => ({ module: module2, path: path25 }));
@@ -14872,6 +14996,14 @@ function compileXcodeObjCImplementations(app, binaries, moduleRoot) {
14872
14996
  `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}`
14873
14997
  );
14874
14998
  }
14999
+ function linkedStat(file) {
15000
+ try {
15001
+ return import_node_fs17.default.statSync(file);
15002
+ } catch (error) {
15003
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
15004
+ throw error;
15005
+ }
15006
+ }
14875
15007
  function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
14876
15008
  if (peers) validateObjcPeerClasses(peers);
14877
15009
  const toolchain = swiftModuleToolchain(moduleRoot);
@@ -14892,13 +15024,22 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
14892
15024
  )
14893
15025
  );
14894
15026
  };
15027
+ const walked = /* @__PURE__ */ new Set();
15028
+ const ancestors = /* @__PURE__ */ new Set();
14895
15029
  const addHeaders = (directory) => {
15030
+ const real = import_node_fs17.default.realpathSync(directory);
15031
+ if (walked.has(directory) || ancestors.has(real)) return;
15032
+ walked.add(directory);
15033
+ ancestors.add(real);
14896
15034
  for (const entry of import_node_fs17.default.readdirSync(directory, { withFileTypes: true })) {
14897
- if (entry.isDirectory() && entry.name.startsWith(".")) continue;
15035
+ if (entry.name.startsWith(".") && !entry.isFile()) continue;
14898
15036
  const file = import_node_path19.default.join(directory, entry.name);
14899
- if (entry.isDirectory()) addHeaders(file);
15037
+ const linked = entry.isSymbolicLink() ? linkedStat(file) : null;
15038
+ if (entry.isSymbolicLink() && !linked) continue;
15039
+ if (entry.isDirectory() || linked?.isDirectory()) addHeaders(file);
14900
15040
  else if (/\.(h|hh|hpp|hxx|inc|inl|modulemap)$/.test(entry.name)) add(file, true);
14901
15041
  }
15042
+ ancestors.delete(real);
14902
15043
  };
14903
15044
  const targets = [];
14904
15045
  const configuration = app.configuration === "Debug" ? "debug" : "release";
@@ -14962,6 +15103,11 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
14962
15103
  )
14963
15104
  ])
14964
15105
  add(file, true);
15106
+ for (const directory of [
15107
+ ...target.objc.headerSearchPaths,
15108
+ ...target.objc.frameworkSearchPaths
15109
+ ])
15110
+ if (!isSdkInclude(directory) && import_node_fs17.default.existsSync(directory)) addHeaders(directory);
14965
15111
  targets.push({
14966
15112
  name: target.moduleName,
14967
15113
  deploymentTarget: target.iosDeploymentTarget,
@@ -15065,16 +15211,16 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
15065
15211
  }
15066
15212
  import_node_fs17.default.mkdirSync(work);
15067
15213
  const staged = (file) => {
15068
- for (const { root, name: name2 } of [
15214
+ for (const { root, name: name3 } of [
15069
15215
  { root: checkouts, name: "packages" },
15070
15216
  { root: app.rootDir, name: "project" }
15071
15217
  ]) {
15072
15218
  const relative = import_node_path19.default.relative(root, file);
15073
15219
  if (relative !== ".." && !relative.startsWith(`..${import_node_path19.default.sep}`) && !import_node_path19.default.isAbsolute(relative))
15074
- return import_node_path19.default.join(work, name2, relative);
15220
+ return import_node_path19.default.join(work, name3, relative);
15075
15221
  }
15076
- if (file.startsWith("/usr/include/"))
15077
- return import_node_path19.default.join(sdk.sysroot, "include", file.slice("/usr/include/".length));
15222
+ if (isSdkInclude(file))
15223
+ return import_node_path19.default.join(sdk.sysroot, "include", file.slice("/usr/include".length));
15078
15224
  throw new Error(
15079
15225
  `Objective-C compiler input is outside the project and its pinned packages: ${file}`
15080
15226
  );
@@ -15295,7 +15441,7 @@ ${diagnostics.trimEnd() || `Clang exited with status ${result.status}`}`
15295
15441
  import_node_fs17.default.closeSync(descriptor);
15296
15442
  }
15297
15443
  }
15298
- var import_node_child_process13, import_node_crypto12, import_node_fs17, import_node_path19, SwiftObjCCompilationError;
15444
+ var import_node_child_process13, import_node_crypto12, import_node_fs17, import_node_path19, SwiftObjCCompilationError, isSdkInclude;
15299
15445
  var init_swift_objc_compile = __esm({
15300
15446
  "src/swift-objc-compile.ts"() {
15301
15447
  "use strict";
@@ -15315,6 +15461,7 @@ var init_swift_objc_compile = __esm({
15315
15461
  init_swift_toolchain();
15316
15462
  SwiftObjCCompilationError = class extends Error {
15317
15463
  };
15464
+ isSdkInclude = (file) => file === "/usr/include" || file.startsWith("/usr/include/");
15318
15465
  }
15319
15466
  });
15320
15467
 
@@ -15443,8 +15590,8 @@ function emitSwiftStandin(graphs, options) {
15443
15590
  const parts = fallback.split(".");
15444
15591
  const module2 = parts[0] === "SwiftUICore" ? "SwiftUI" : parts[0];
15445
15592
  const unqualified = parts.slice(1).join(".") || parts[0];
15446
- const name2 = family.has(parts[0]) && parts[0] !== "SwiftUICore" ? parts.join(".") : unqualified;
15447
- return { name: name2, module: module2, local: false };
15593
+ const name3 = family.has(parts[0]) && parts[0] !== "SwiftUICore" ? parts.join(".") : unqualified;
15594
+ return { name: name3, module: module2, local: false };
15448
15595
  };
15449
15596
  const nsObject = nameOf("c:objc(cs)NSObject", "ObjectiveC.NSObject").name;
15450
15597
  const nsObjectProtocol = nameOf(
@@ -15465,8 +15612,8 @@ function emitSwiftStandin(graphs, options) {
15465
15612
  ...all(edge.source)
15466
15613
  ]);
15467
15614
  } else if (edge.targetFallback) {
15468
- const name2 = nameOf(edge.target, edge.targetFallback).name;
15469
- external.set(name2, [...external.get(name2) ?? [], ...all(edge.source)]);
15615
+ const name3 = nameOf(edge.target, edge.targetFallback).name;
15616
+ external.set(name3, [...external.get(name3) ?? [], ...all(edge.source)]);
15470
15617
  owner.set(edge.source, edge.target);
15471
15618
  }
15472
15619
  break;
@@ -15480,9 +15627,9 @@ function emitSwiftStandin(graphs, options) {
15480
15627
  case "conformsTo": {
15481
15628
  const target = nameOf(edge.target, edge.targetFallback);
15482
15629
  const kept = KEEP_EXTERNAL.get(edge.target);
15483
- const name2 = kept ?? (target && (target.local || family.has(target.module ?? "")) ? target.name : null);
15484
- if (name2)
15485
- conforms.set(edge.source, [...conforms.get(edge.source) ?? [], name2]);
15630
+ const name3 = kept ?? (target && (target.local || family.has(target.module ?? "")) ? target.name : null);
15631
+ if (name3)
15632
+ conforms.set(edge.source, [...conforms.get(edge.source) ?? [], name3]);
15486
15633
  if (byId.has(edge.target)) {
15487
15634
  const map = source.kind.identifier === "swift.protocol" ? protocolParents : conformIds;
15488
15635
  map.set(edge.source, [...map.get(edge.source) ?? [], edge.target]);
@@ -15728,13 +15875,13 @@ function emitSwiftStandin(graphs, options) {
15728
15875
  if (blocked) return void skipped.push({ path: path25, reason: blocked });
15729
15876
  const ancestors = /* @__PURE__ */ new Set();
15730
15877
  for (let at = superId.get(id); at; at = superId.get(at))
15731
- for (const name2 of conforms.get(at) ?? []) ancestors.add(name2);
15878
+ for (const name3 of conforms.get(at) ?? []) ancestors.add(name3);
15732
15879
  const list2 = [
15733
15880
  ...parent ? [parent] : [],
15734
15881
  ...(conforms.get(id) ?? []).filter(
15735
- (name2) => !ancestors.has(name2) && !(parent && [...KEEP_EXTERNAL.values()].includes(name2)) && !(name2 === nsObjectProtocol && externalRoot(id) === nsObject)
15882
+ (name3) => !ancestors.has(name3) && !(parent && [...KEEP_EXTERNAL.values()].includes(name3)) && !(name3 === nsObjectProtocol && externalRoot(id) === nsObject)
15736
15883
  )
15737
- ].filter((name2, at, all2) => all2.indexOf(name2) === at);
15884
+ ].filter((name3, at, all2) => all2.indexOf(name3) === at);
15738
15885
  const parentSymbol = superId.has(id) ? byId.get(superId.get(id)) : void 0;
15739
15886
  const open = symbol.accessLevel === "open" && (!parentSymbol || parentSymbol.accessLevel === "open");
15740
15887
  emit(
@@ -15855,7 +16002,7 @@ function emitSwiftStandin(graphs, options) {
15855
16002
  reason: `no header value for ${missing.map(leaf).join(", ")}`
15856
16003
  });
15857
16004
  const list2 = inheritance(id, raw2 ?? void 0).filter(
15858
- (name2) => !raw2 || name2 !== "RawRepresentable"
16005
+ (name3) => !raw2 || name3 !== "RawRepresentable"
15859
16006
  );
15860
16007
  emit(
15861
16008
  `${indent}${shape.attrs}public enum ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${shape.where} {`
@@ -15996,7 +16143,7 @@ function emitSwiftStandin(graphs, options) {
15996
16143
  if (TYPE_KINDS.has(symbol.kind.identifier)) emitType(symbol, "");
15997
16144
  else emitGlobal(symbol);
15998
16145
  }
15999
- for (const [name2, members] of [...external].sort(([a], [b]) => a.localeCompare(b))) {
16146
+ for (const [name3, members] of [...external].sort(([a], [b]) => a.localeCompare(b))) {
16000
16147
  const seen = /* @__PURE__ */ new Set();
16001
16148
  const kept = members.filter((member) => {
16002
16149
  const key2 = `${member.kind.identifier}|${text3(member)}`;
@@ -16005,7 +16152,7 @@ function emitSwiftStandin(graphs, options) {
16005
16152
  return true;
16006
16153
  });
16007
16154
  if (kept.length === 0) continue;
16008
- emit(`extension ${name2} {`);
16155
+ emit(`extension ${name3} {`);
16009
16156
  for (const member of kept)
16010
16157
  if (member.kind.identifier === "swift.init" && !text3(member).startsWith("convenience"))
16011
16158
  emitMember(
@@ -16029,7 +16176,7 @@ function emitSwiftStandin(graphs, options) {
16029
16176
  `// stand-in for the binary ${options.module} module, generated from ${options.source}.`,
16030
16177
  options.inert ? "// generated from public headers; native behavior is inert in peach." : "// unconfigured bodies trap because the vendor binary cannot run in peach.",
16031
16178
  "",
16032
- ...imports.map((name2) => `import ${name2}`),
16179
+ ...imports.map((name3) => `import ${name3}`),
16033
16180
  ""
16034
16181
  ];
16035
16182
  for (const path25 of behavior.keys())
@@ -16157,7 +16304,7 @@ var init_swift_standin_emit = __esm({
16157
16304
  "false",
16158
16305
  "nil"
16159
16306
  ]);
16160
- tick = (name2) => KEYWORDS.has(name2) ? `\`${name2}\`` : name2;
16307
+ tick = (name3) => KEYWORDS.has(name3) ? `\`${name3}\`` : name3;
16161
16308
  }
16162
16309
  });
16163
16310
 
@@ -16193,16 +16340,16 @@ function treeDigest(root) {
16193
16340
  ancestors.delete(resolved);
16194
16341
  };
16195
16342
  walk2(root);
16196
- const stamp = names.map((name2) => {
16197
- const stat = import_node_fs20.default.statSync(import_node_path20.default.join(root, name2));
16198
- return `${name2}\0${stat.size}:${stat.mtimeMs}`;
16343
+ const stamp = names.map((name3) => {
16344
+ const stat = import_node_fs20.default.statSync(import_node_path20.default.join(root, name3));
16345
+ return `${name3}\0${stat.size}:${stat.mtimeMs}`;
16199
16346
  }).join("\n");
16200
16347
  const memo2 = digests.get(`tree\0${root}`);
16201
16348
  if (memo2?.stamp === stamp) return memo2.digest;
16202
16349
  const hash = (0, import_node_crypto13.createHash)("sha256");
16203
- for (const name2 of names) {
16204
- hash.update(`${name2}\0`);
16205
- hash.update(import_node_fs20.default.readFileSync(import_node_path20.default.join(root, name2)));
16350
+ for (const name3 of names) {
16351
+ hash.update(`${name3}\0`);
16352
+ hash.update(import_node_fs20.default.readFileSync(import_node_path20.default.join(root, name3)));
16206
16353
  hash.update("\0");
16207
16354
  }
16208
16355
  const digest2 = hash.digest("hex");
@@ -16279,13 +16426,13 @@ function xcframework(binary) {
16279
16426
  return { dir: found, digest: sha };
16280
16427
  }
16281
16428
  function headerSurface(module2, modulemap, headers) {
16282
- const objc = files(headers, (name2) => name2.endsWith(".h")).some(
16429
+ const objc = files(headers, (name3) => name3.endsWith(".h")).some(
16283
16430
  (file) => OBJC.test(import_node_fs20.default.readFileSync(import_node_path20.default.join(headers, file), "utf8"))
16284
16431
  );
16285
16432
  return objc ? { kind: "objc", module: module2, modulemap, headers } : { kind: "c", module: module2, modulemap, headers };
16286
16433
  }
16287
16434
  function surfaces(xcframeworkDir) {
16288
- const slice = import_node_fs20.default.readdirSync(xcframeworkDir).filter((name2) => /^ios-.+-simulator$/.test(name2)).sort()[0];
16435
+ const slice = import_node_fs20.default.readdirSync(xcframeworkDir).filter((name3) => /^ios-.+-simulator$/.test(name3)).sort()[0];
16289
16436
  const plain = !slice && xcframeworkDir.endsWith(".framework");
16290
16437
  if (!slice && !plain) throw new Error("it has no iOS simulator slice");
16291
16438
  const root = plain ? import_node_path20.default.dirname(xcframeworkDir) : import_node_path20.default.join(xcframeworkDir, slice);
@@ -16297,9 +16444,9 @@ function surfaces(xcframeworkDir) {
16297
16444
  const swiftmodule = import_node_path20.default.join(framework, "Modules", `${module2}.swiftmodule`);
16298
16445
  const interfaces = files(
16299
16446
  swiftmodule,
16300
- (name2) => name2.endsWith(".swiftinterface") && !name2.endsWith(".private.swiftinterface") && !name2.endsWith(".package.swiftinterface")
16447
+ (name3) => name3.endsWith(".swiftinterface") && !name3.endsWith(".private.swiftinterface") && !name3.endsWith(".package.swiftinterface")
16301
16448
  );
16302
- const chosen = interfaces.find((name2) => name2.startsWith("arm64-")) ?? interfaces[0] ?? null;
16449
+ const chosen = interfaces.find((name3) => name3.startsWith("arm64-")) ?? interfaces[0] ?? null;
16303
16450
  const modulemap = import_node_path20.default.join(framework, "Modules", "module.modulemap");
16304
16451
  if (chosen) {
16305
16452
  const file = import_node_path20.default.join(swiftmodule, chosen);
@@ -16323,7 +16470,7 @@ function surfaces(xcframeworkDir) {
16323
16470
  found.push(headerSurface(module2, modulemap, import_node_path20.default.join(framework, "Headers")));
16324
16471
  }
16325
16472
  const headers = import_node_path20.default.join(root, "Headers");
16326
- for (const map of files(headers, (name2) => name2 === "module.modulemap")) {
16473
+ for (const map of files(headers, (name3) => name3 === "module.modulemap")) {
16327
16474
  const modulemap = import_node_path20.default.join(headers, map);
16328
16475
  const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs20.default.readFileSync(modulemap, "utf8"))?.[1];
16329
16476
  if (module2) found.push(headerSurface(module2, modulemap, import_node_path20.default.dirname(modulemap)));
@@ -16340,7 +16487,7 @@ function peachModuleDirs(toolchain, imports) {
16340
16487
  if (swiftDistributionAt(moduleRoot)) return [import_node_path20.default.join(moduleRoot, "modules")];
16341
16488
  const peach = new Set(swiftPeachModules(moduleRoot));
16342
16489
  const targets = [.../* @__PURE__ */ new Set([...STANDIN_IMPORTS, ...imports])].filter(
16343
- (name2) => peach.has(name2)
16490
+ (name3) => peach.has(name3)
16344
16491
  );
16345
16492
  const plugins = swiftMacroPlugins(moduleRoot);
16346
16493
  if (plugins.stale)
@@ -16381,8 +16528,8 @@ function peachModuleDirs(toolchain, imports) {
16381
16528
  return [
16382
16529
  import_node_path20.default.join(release, "Modules"),
16383
16530
  ...import_node_fs20.default.readdirSync(release).filter(
16384
- (name2) => name2.endsWith(".build") && import_node_fs20.default.existsSync(import_node_path20.default.join(release, name2, "module.modulemap"))
16385
- ).sort().map((name2) => import_node_path20.default.join(release, name2))
16531
+ (name3) => name3.endsWith(".build") && import_node_fs20.default.existsSync(import_node_path20.default.join(release, name3, "module.modulemap"))
16532
+ ).sort().map((name3) => import_node_path20.default.join(release, name3))
16386
16533
  ];
16387
16534
  }
16388
16535
  function swiftInterfaceForWasm(text4) {
@@ -16393,7 +16540,7 @@ function swiftInterfaceForWasm(text4) {
16393
16540
  const foundation = rooted !== text4 && !/^import[ \t]+Foundation\b/m.test(rooted) ? rooted.replace(/^(?=import[ \t])/m, "import Foundation\n") : rooted;
16394
16541
  return foundation.replace(
16395
16542
  /^(\/\/ swift-module-flags:.*)$/m,
16396
- (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(" ")}`
16543
+ (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(" ")}`
16397
16544
  ).replace(
16398
16545
  /@(?:objc(?:\s*\([^()]*\))?|objcMembers|nonobjc|IBOutlet|IBAction|IBInspectable|IBDesignable|_objcRuntimeName\([^()]*\))(?![\w(])/g,
16399
16546
  ""
@@ -16422,7 +16569,7 @@ function swiftStandin(surface, binary, toolchain, work, behavior, siblings) {
16422
16569
  "-output-dir",
16423
16570
  out
16424
16571
  ]);
16425
- const graphs = import_node_fs20.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs20.default.readFileSync(import_node_path20.default.join(out, name2), "utf8")));
16572
+ const graphs = import_node_fs20.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs20.default.readFileSync(import_node_path20.default.join(out, name3), "utf8")));
16426
16573
  return graphStandin(
16427
16574
  surface.module,
16428
16575
  graphs,
@@ -16468,7 +16615,7 @@ function wasmFlags(toolchain, imports) {
16468
16615
  "-resource-dir",
16469
16616
  resources,
16470
16617
  // the sdk toolset's emulation defines, which raw swiftc does not read
16471
- ...WASI_EMULATION.flatMap((name2) => ["-Xcc", `-D${name2}`]),
16618
+ ...WASI_EMULATION.flatMap((name3) => ["-Xcc", `-D${name3}`]),
16472
16619
  ...peachModuleDirs(toolchain, imports).flatMap((dir) => ["-I", dir]),
16473
16620
  ...toolchain.standinModules ? ["-I", toolchain.standinModules] : []
16474
16621
  ];
@@ -16501,10 +16648,10 @@ function graphStandin(module2, graphs, values, wasm, binary, toolchain, work, be
16501
16648
  (graph) => graph.symbols.map((symbol) => symbol.pathComponents.join("."))
16502
16649
  )
16503
16650
  );
16504
- for (const name2 of behavior.keys()) {
16505
- if (!paths.has(name2))
16651
+ for (const name3 of behavior.keys()) {
16652
+ if (!paths.has(name3))
16506
16653
  throw new Error(
16507
- `Configured Swift behavior ${module2}.${name2} is not in the SDK surface`
16654
+ `Configured Swift behavior ${module2}.${name3} is not in the SDK surface`
16508
16655
  );
16509
16656
  }
16510
16657
  const omit = /* @__PURE__ */ new Map();
@@ -16688,7 +16835,7 @@ function cStandin(surface, binary, toolchain, work) {
16688
16835
  const named = [
16689
16836
  ...import_node_fs20.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
16690
16837
  ].map((match) => match[1]);
16691
- const headers = files(surface.headers, (name2) => name2.endsWith(".h"));
16838
+ const headers = files(surface.headers, (name3) => name3.endsWith(".h"));
16692
16839
  const texts = new Map(
16693
16840
  headers.map((file) => [
16694
16841
  file,
@@ -16802,7 +16949,7 @@ ${roots.map((file) => ` header "${file}"
16802
16949
  }
16803
16950
  };
16804
16951
  }
16805
- function crateFor(root, name2) {
16952
+ function crateFor(root, name3) {
16806
16953
  const walk2 = (dir, depth) => {
16807
16954
  const manifest = import_node_path20.default.join(dir, "Cargo.toml");
16808
16955
  if (import_node_fs20.default.existsSync(manifest)) {
@@ -16813,10 +16960,10 @@ function crateFor(root, name2) {
16813
16960
  const field = (body, key2) => new RegExp(`^${key2}\\s*=\\s*"([^"]+)"`, "m").exec(body)?.[1];
16814
16961
  const lib = section("lib");
16815
16962
  const crate = field(lib, "name") ?? field(section("package"), "name")?.replaceAll("-", "_");
16816
- if (crate === name2) {
16963
+ if (crate === name3) {
16817
16964
  if (!/crate-type\s*=\s*\[[^\]]*"staticlib"/.test(lib))
16818
16965
  throw new Error(
16819
- `${import_node_path20.default.relative(root, manifest)} builds lib${name2} without crate-type "staticlib"`
16966
+ `${import_node_path20.default.relative(root, manifest)} builds lib${name3} without crate-type "staticlib"`
16820
16967
  );
16821
16968
  return manifest;
16822
16969
  }
@@ -16838,7 +16985,7 @@ function simulatorLibraryName(dir) {
16838
16985
  if (!Array.isArray(libraries)) return void 0;
16839
16986
  return libraries.filter(
16840
16987
  (entry) => typeof entry === "object" && entry !== null && Reflect.get(entry, "SupportedPlatform") === "ios" && Reflect.get(entry, "SupportedPlatformVariant") === "simulator"
16841
- ).map((entry) => Reflect.get(entry, "LibraryPath")).find((name2) => typeof name2 === "string" && /^lib.+\.a$/.test(name2));
16988
+ ).map((entry) => Reflect.get(entry, "LibraryPath")).find((name3) => typeof name3 === "string" && /^lib.+\.a$/.test(name3));
16842
16989
  }
16843
16990
  function standinLibrary(binary, searchRoot) {
16844
16991
  if (binary.publicHeaders !== void 0) return null;
@@ -16846,7 +16993,7 @@ function standinLibrary(binary, searchRoot) {
16846
16993
  const library = simulatorLibraryName(dir);
16847
16994
  const supplied = import_node_path20.default.join(dir, RUST_TARGET);
16848
16995
  if (import_node_fs20.default.existsSync(supplied)) {
16849
- const found = import_node_fs20.default.readdirSync(supplied).filter((name2) => name2.endsWith(".a"));
16996
+ const found = import_node_fs20.default.readdirSync(supplied).filter((name3) => name3.endsWith(".a"));
16850
16997
  const chosen = library && found.includes(library) ? library : found.length === 1 ? found[0] : null;
16851
16998
  if (!chosen)
16852
16999
  throw new Error(
@@ -17050,12 +17197,12 @@ function readStandinResults(receipt, generation, targets) {
17050
17197
  if (!Array.isArray(entry.result))
17051
17198
  throw new Error("invalid Swift stand-in builder result");
17052
17199
  for (const item of entry.result) {
17053
- 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")))
17200
+ 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")))
17054
17201
  throw new Error("invalid Swift stand-in builder result");
17055
17202
  const files2 = {};
17056
- for (const [name2, text4] of Object.entries(item.files)) {
17203
+ for (const [name3, text4] of Object.entries(item.files)) {
17057
17204
  if (typeof text4 !== "string") throw new Error("invalid Swift stand-in file");
17058
- files2[name2] = text4;
17205
+ files2[name3] = text4;
17059
17206
  }
17060
17207
  standins.push({
17061
17208
  module: item.module,
@@ -17091,13 +17238,13 @@ function standinGenerationInputs(binaries, toolchain, behavior = {}) {
17091
17238
  }
17092
17239
  })
17093
17240
  );
17094
- const selected = Object.keys(behavior).filter((name2) => modules.has(name2)).sort();
17241
+ const selected = Object.keys(behavior).filter((name3) => modules.has(name3)).sort();
17095
17242
  if (selected.length > 0)
17096
17243
  parts.push(
17097
17244
  JSON.stringify(
17098
- selected.map((name2) => [
17099
- name2,
17100
- Object.keys(behavior[name2]).sort().map((member) => [member, behavior[name2][member]])
17245
+ selected.map((name3) => [
17246
+ name3,
17247
+ Object.keys(behavior[name3]).sort().map((member) => [member, behavior[name3][member]])
17101
17248
  ])
17102
17249
  )
17103
17250
  );
@@ -17147,7 +17294,7 @@ function binaryStandins(binary, toolchain, provided, behavior, frameworks, sibli
17147
17294
  const module2 = swiftTargetModuleName(binary.target);
17148
17295
  const modulemap = import_node_path20.default.join(work, "module.modulemap");
17149
17296
  const supplied = import_node_path20.default.join(headers, "module.modulemap");
17150
- const roots = files(headers, (name2) => name2.endsWith(".h"));
17297
+ const roots = files(headers, (name3) => name3.endsWith(".h"));
17151
17298
  if (roots.length === 0)
17152
17299
  throw new Error("its public header directory has no headers");
17153
17300
  import_node_fs20.default.writeFileSync(
@@ -17203,7 +17350,7 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
17203
17350
  for (const file of surface.kind === "swift" ? [surface.interface] : [
17204
17351
  ...surface.kind === "mixed" ? [surface.interface] : [],
17205
17352
  surface.modulemap,
17206
- ...files(surface.headers, (name2) => name2.endsWith(".h")).map(
17353
+ ...files(surface.headers, (name3) => name3.endsWith(".h")).map(
17207
17354
  (file2) => import_node_path20.default.join(surface.headers, file2)
17208
17355
  )
17209
17356
  ])
@@ -17483,7 +17630,7 @@ function isSwiftNativeModules(value) {
17483
17630
  ...Object.values(value.modules),
17484
17631
  ...Object.values(value.views)
17485
17632
  ].every(
17486
- (names) => Array.isArray(names) && names.every((name2) => typeof name2 === "string")
17633
+ (names) => Array.isArray(names) && names.every((name3) => typeof name3 === "string")
17487
17634
  ) && Array.isArray(value.defaultViewFiles) && value.defaultViewFiles.every((file) => typeof file === "string");
17488
17635
  }
17489
17636
  function isSwiftCompileOutcome(value) {
@@ -17509,8 +17656,8 @@ function compileAssetUrl(value, origin) {
17509
17656
  }
17510
17657
  function resolveImageUrls(urls, origin) {
17511
17658
  const resolved = {};
17512
- for (const [name2, url] of Object.entries(urls)) {
17513
- resolved[name2] = compileAssetUrl(url, origin);
17659
+ for (const [name3, url] of Object.entries(urls)) {
17660
+ resolved[name3] = compileAssetUrl(url, origin);
17514
17661
  }
17515
17662
  return resolved;
17516
17663
  }
@@ -17669,9 +17816,9 @@ function swiftPackages(entry, app) {
17669
17816
  ))
17670
17817
  compileXcodeObjCImplementations(app, cached2.binaries, entry.moduleRoot);
17671
17818
  const vendored = app.binaryFrameworks.flatMap(
17672
- ({ name: name2, path: dir }) => dir ? [
17819
+ ({ name: name3, path: dir }) => dir ? [
17673
17820
  {
17674
- target: name2,
17821
+ target: name3,
17675
17822
  source: "the project",
17676
17823
  url: null,
17677
17824
  checksum: null,
@@ -17793,7 +17940,7 @@ ${implementations.map((file) => ` ${file}`).join("\n")}`
17793
17940
  targets.push({
17794
17941
  name: standin.module,
17795
17942
  path: import_node_path21.default.posix.join(SWIFT_STANDINS_DIR, standin.module),
17796
- dependencies: standin.dependencies?.map((name2) => ({ kind: "target", name: name2 })),
17943
+ dependencies: standin.dependencies?.map((name3) => ({ kind: "target", name: name3 })),
17797
17944
  executable: false,
17798
17945
  resources: false,
17799
17946
  exclude: [],
@@ -17852,9 +17999,9 @@ function xcodeManifest(layout) {
17852
17999
  const settings = (target) => `swiftSettings: [${[
17853
18000
  `.swiftLanguageMode(.v${target.languageMode})`,
17854
18001
  ...target.mainActorIsolation ? [".defaultIsolation(MainActor.self)"] : [],
17855
- ...(target.defines ?? []).map((name2) => `.define(${JSON.stringify(name2)})`)
18002
+ ...(target.defines ?? []).map((name3) => `.define(${JSON.stringify(name3)})`)
17856
18003
  ].join(", ")}]`;
17857
- const libraries = (target) => target.linkedLibraries?.length ? `, linkerSettings: [${target.linkedLibraries.map((name2) => `.linkedLibrary(${JSON.stringify(name2)})`).join(", ")}]` : "";
18004
+ const libraries = (target) => target.linkedLibraries?.length ? `, linkerSettings: [${target.linkedLibraries.map((name3) => `.linkedLibrary(${JSON.stringify(name3)})`).join(", ")}]` : "";
17858
18005
  return [
17859
18006
  "// swift-tools-version: 6.2",
17860
18007
  "import PackageDescription",
@@ -18008,7 +18155,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
18008
18155
  registered.set(`${sha256}.metal`, { bytes, contentType: "text/plain; charset=utf-8" });
18009
18156
  }
18010
18157
  let imageBytes = 0;
18011
- for (const { name: name2, file, scale, bundlePath } of found) {
18158
+ for (const { name: name3, file, scale, bundlePath } of found) {
18012
18159
  const disk = byRelative.get(file);
18013
18160
  if (!disk) continue;
18014
18161
  if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs21.default.statSync(disk).size > limits.imageTotalBytes) {
@@ -18019,7 +18166,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
18019
18166
  const hash = (0, import_node_crypto14.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
18020
18167
  const ext = import_node_path21.default.posix.extname(file).toLowerCase();
18021
18168
  const bundle = table[bundlePath] ?? /* @__PURE__ */ Object.create(null);
18022
- const variants = bundle[name2] ??= [];
18169
+ const variants = bundle[name3] ??= [];
18023
18170
  variants.push({ uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale });
18024
18171
  table[bundlePath] = bundle;
18025
18172
  const key2 = layout ? xcodeInputKey(layout, disk, file) : file;
@@ -18100,10 +18247,10 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs) {
18100
18247
  const bytes = readPackageFile2(packagePath, disk, limits.resourceBytes);
18101
18248
  addFile(bundlePath === "." ? base : `${bundlePath}/${base}`, bytes);
18102
18249
  if (base.endsWith(".xcstrings")) {
18103
- for (const [name2, table] of Object.entries(
18250
+ for (const [name3, table] of Object.entries(
18104
18251
  compileStringCatalog(bytes.toString("utf8"), base.slice(0, -10))
18105
18252
  )) {
18106
- addFile(bundlePath === "." ? name2 : `${bundlePath}/${name2}`, Buffer.from(table));
18253
+ addFile(bundlePath === "." ? name3 : `${bundlePath}/${name3}`, Buffer.from(table));
18107
18254
  }
18108
18255
  }
18109
18256
  }
@@ -18396,10 +18543,10 @@ function swiftApiGapReport(output) {
18396
18543
  async function missingModulesMessage(packagePath, missing) {
18397
18544
  const layout = xcodeLayout(packagePath);
18398
18545
  const gaps = new Map([
18399
- ...(layout?.app.binaryFrameworks ?? []).map(({ name: name2 }) => {
18400
- const gap = layout?.projectGaps.get(name2);
18546
+ ...(layout?.app.binaryFrameworks ?? []).map(({ name: name3 }) => {
18547
+ const gap = layout?.projectGaps.get(name3);
18401
18548
  return [
18402
- name2,
18549
+ name3,
18403
18550
  {
18404
18551
  source: "the project",
18405
18552
  reason: `a vendored binary framework${gap ? `; no stand-in: ${gap}` : ""}`
@@ -18407,9 +18554,9 @@ async function missingModulesMessage(packagePath, missing) {
18407
18554
  ];
18408
18555
  }),
18409
18556
  ...[...missing.keys()].flatMap(
18410
- (name2) => IOS_SDK_FRAMEWORKS.has(name2) ? [
18557
+ (name3) => IOS_SDK_FRAMEWORKS.has(name3) ? [
18411
18558
  [
18412
- name2,
18559
+ name3,
18413
18560
  { source: "the iOS SDK", reason: "a framework Peach does not provide" }
18414
18561
  ]
18415
18562
  ] : []
@@ -18418,28 +18565,28 @@ async function missingModulesMessage(packagePath, missing) {
18418
18565
  ...layout?.packages.unavailable ?? []
18419
18566
  ]);
18420
18567
  const packaged = new Set(
18421
- [...missing.keys()].filter((name2) => !IOS_SDK_FRAMEWORKS.has(name2))
18568
+ [...missing.keys()].filter((name3) => !IOS_SDK_FRAMEWORKS.has(name3))
18422
18569
  );
18423
18570
  if (packaged.size > 0)
18424
18571
  await Promise.all(
18425
18572
  (layout?.packages.binaries ?? []).map(async (binary) => {
18426
18573
  const modules = await swiftBinaryModules(binary).catch(() => []);
18427
- for (const name2 of modules)
18428
- if (packaged.has(name2))
18429
- gaps.set(name2, {
18574
+ for (const name3 of modules)
18575
+ if (packaged.has(name3))
18576
+ gaps.set(name3, {
18430
18577
  source: binary.source,
18431
18578
  reason: layout?.packages.modules.get(binary.target)?.reason ?? `${binary.target} is a binary framework`
18432
18579
  });
18433
18580
  })
18434
18581
  );
18435
- const width = Math.max(...[...missing.keys()].map((name2) => name2.length));
18582
+ const width = Math.max(...[...missing.keys()].map((name3) => name3.length));
18436
18583
  const opened = xcodeProjects.get(packagePath)?.xcodeproj;
18437
18584
  const workspace = opened?.endsWith(".xcodeproj") ? enclosingXcodeWorkspace(opened) : null;
18438
18585
  return [
18439
18586
  `Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
18440
- ...[...missing].map(([name2, files2]) => {
18441
- const gap = gaps.get(name2);
18442
- return ` ${name2.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path21.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
18587
+ ...[...missing].map(([name3, files2]) => {
18588
+ const gap = gaps.get(name3);
18589
+ return ` ${name3.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path21.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
18443
18590
  }),
18444
18591
  ...workspace ? [
18445
18592
  `${import_node_path21.default.basename(opened)} is part of ${import_node_path21.default.relative(process.cwd(), workspace)}, which holds its local packages and Package.resolved pins; pass the workspace to build what Xcode builds there.`
@@ -18781,12 +18928,12 @@ async function collectExpoSwiftSources(appRoot, signal) {
18781
18928
  const classes = [];
18782
18929
  for (const module2 of modules) {
18783
18930
  const className = typeof module2 === "string" ? module2 : module2 && typeof module2 === "object" ? Reflect.get(module2, "class") : null;
18784
- const name2 = typeof module2 === "string" ? null : module2 && typeof module2 === "object" ? Reflect.get(module2, "name") : null;
18785
- if (typeof className !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(className) || name2 !== null && typeof name2 !== "string")
18931
+ const name3 = typeof module2 === "string" ? null : module2 && typeof module2 === "object" ? Reflect.get(module2, "name") : null;
18932
+ if (typeof className !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(className) || name3 !== null && typeof name3 !== "string")
18786
18933
  throw new Error(`${sourceRoot}: invalid Expo Apple module descriptor`);
18787
18934
  classes.push({
18788
18935
  name: className.split(".").pop(),
18789
- registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
18936
+ registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name3 === null ? "nil" : JSON.stringify(name3)})`
18790
18937
  });
18791
18938
  }
18792
18939
  const ios = import_node_path22.default.join(canonical, "ios");
@@ -18886,8 +19033,8 @@ ${import_node_fs22.default.readFileSync(source, "utf8")}`;
18886
19033
  ...dependency.flatMap((item) => item.frameworks)
18887
19034
  ])
18888
19035
  ];
18889
- for (const [name2, source] of Object.entries(allFiles)) {
18890
- if (name2.startsWith(`Sources/${namespace}/`)) unit2.files[name2] = source;
19036
+ for (const [name3, source] of Object.entries(allFiles)) {
19037
+ if (name3.startsWith(`Sources/${namespace}/`)) unit2.files[name3] = source;
18891
19038
  }
18892
19039
  }
18893
19040
  unit2.files["Package.swift"] = expoManifest(unit2.files);
@@ -18906,7 +19053,7 @@ function expoManifest(files2, generation = "", modes = /* @__PURE__ */ new Map()
18906
19053
  }
18907
19054
  return `// swift-tools-version: 6.0
18908
19055
  import PackageDescription
18909
- let package = Package(name: "PeachExpo", targets: [${[...targets].map(([name2, dir]) => `.target(name: ${JSON.stringify(name2)}, path: ${JSON.stringify(dir)}${dir.startsWith(`${SWIFT_STANDINS_DIR}/`) ? ", swiftSettings: [.swiftLanguageMode(.v5)]" : modes.has(name2) ? `, swiftSettings: [.swiftLanguageMode(.v${modes.get(name2)})]` : ""})`).join(", ")}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])
19056
+ let package = Package(name: "PeachExpo", targets: [${[...targets].map(([name3, dir]) => `.target(name: ${JSON.stringify(name3)}, path: ${JSON.stringify(dir)}${dir.startsWith(`${SWIFT_STANDINS_DIR}/`) ? ", swiftSettings: [.swiftLanguageMode(.v5)]" : modes.has(name3) ? `, swiftSettings: [.swiftLanguageMode(.v${modes.get(name3)})]` : ""})`).join(", ")}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])
18910
19057
  // stand-in inputs: ${generation}
18911
19058
  `;
18912
19059
  }
@@ -18946,17 +19093,17 @@ function expoSwiftPreparedKey(base, units) {
18946
19093
  for (const unit2 of units) {
18947
19094
  hash.update("\0");
18948
19095
  hash.update(unit2.moduleId);
18949
- for (const name2 of Object.keys(unit2.files).sort()) {
19096
+ for (const name3 of Object.keys(unit2.files).sort()) {
18950
19097
  hash.update("\0");
18951
- hash.update(name2);
19098
+ hash.update(name3);
18952
19099
  hash.update("\0");
18953
- hash.update(unit2.files[name2] ?? "");
19100
+ hash.update(unit2.files[name3] ?? "");
18954
19101
  }
18955
19102
  }
18956
19103
  return hash.digest("hex");
18957
19104
  }
18958
- function expoSwiftPackage(appKey, name2) {
18959
- return import_node_path22.default.join(import_node_os7.default.tmpdir(), "peach-expo-swift", appKey, `p${process.pid}`, name2);
19105
+ function expoSwiftPackage(appKey, name3) {
19106
+ return import_node_path22.default.join(import_node_os7.default.tmpdir(), "peach-expo-swift", appKey, `p${process.pid}`, name3);
18960
19107
  }
18961
19108
  function failureRecordPath(packagePath) {
18962
19109
  const app = import_node_path22.default.dirname(import_node_path22.default.dirname(packagePath));
@@ -19070,7 +19217,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
19070
19217
  (source) => swiftImportNames(source, importedAvailable)
19071
19218
  )
19072
19219
  );
19073
- const reached = binaries.filter((item) => item.modules.some((name2) => imports.has(name2))).map((item) => item.binary);
19220
+ const reached = binaries.filter((item) => item.modules.some((name3) => imports.has(name3))).map((item) => item.binary);
19074
19221
  if (reached.length > 0) {
19075
19222
  const toolchain = {
19076
19223
  moduleRoot: module2.root,
@@ -19082,9 +19229,9 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
19082
19229
  const linkedLibraries = standinLibraries(reached, built2.standins, root);
19083
19230
  const linkedStandins = new Set([...linkedLibraries.values()].flat());
19084
19231
  for (const standin of built2.standins)
19085
- for (const [name2, source] of Object.entries(standin.files)) {
19086
- const file = `${SWIFT_STANDINS_DIR}/${standin.module}/${name2}`;
19087
- const text4 = linkedStandins.has(standin) && name2 === `${standin.module}.c` ? `// ${standin.target}'s WebAssembly library defines ${standin.module}'s functions.
19232
+ for (const [name3, source] of Object.entries(standin.files)) {
19233
+ const file = `${SWIFT_STANDINS_DIR}/${standin.module}/${name3}`;
19234
+ const text4 = linkedStandins.has(standin) && name3 === `${standin.module}.c` ? `// ${standin.target}'s WebAssembly library defines ${standin.module}'s functions.
19088
19235
  ` : source;
19089
19236
  if (file in unit2.files && unit2.files[file] !== text4)
19090
19237
  throw new Error(`conflicting Expo Swift binary source ${file}`);
@@ -19103,7 +19250,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
19103
19250
  generations.set(unit2, generation);
19104
19251
  gaps.set(
19105
19252
  unit2,
19106
- [...built2.gaps].map(([name2, reason]) => `${name2}: no stand-in: ${reason}`)
19253
+ [...built2.gaps].map(([name3, reason]) => `${name3}: no stand-in: ${reason}`)
19107
19254
  );
19108
19255
  unit2.files["Package.swift"] = expoManifest(
19109
19256
  unit2.files,
@@ -19116,8 +19263,8 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
19116
19263
  syncSwiftTree(
19117
19264
  packagePath,
19118
19265
  new Map(
19119
- Object.entries(unit2.files).map(([name2, source]) => [
19120
- import_node_path22.default.join(packagePath, name2),
19266
+ Object.entries(unit2.files).map(([name3, source]) => [
19267
+ import_node_path22.default.join(packagePath, name3),
19121
19268
  source
19122
19269
  ])
19123
19270
  )
@@ -19144,10 +19291,10 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
19144
19291
  const link = async (linked2) => {
19145
19292
  const files2 = {};
19146
19293
  for (const unit2 of linked2)
19147
- for (const [name2, source] of Object.entries(unit2.files)) {
19148
- if (name2.startsWith(`${SWIFT_STANDINS_DIR}/`) && name2 in files2 && files2[name2] !== source)
19149
- throw new Error(`conflicting Expo Swift binary source ${name2}`);
19150
- files2[name2] = source;
19294
+ for (const [name3, source] of Object.entries(unit2.files)) {
19295
+ if (name3.startsWith(`${SWIFT_STANDINS_DIR}/`) && name3 in files2 && files2[name3] !== source)
19296
+ throw new Error(`conflicting Expo Swift binary source ${name3}`);
19297
+ files2[name3] = source;
19151
19298
  }
19152
19299
  files2[EXPO_SWIFT_ENTRY] = expoEntry(linked2);
19153
19300
  files2["Package.swift"] = expoManifest(
@@ -19159,18 +19306,18 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
19159
19306
  syncSwiftTree(
19160
19307
  packagePath,
19161
19308
  new Map(
19162
- Object.entries(files2).map(([name2, source]) => [
19163
- import_node_path22.default.join(packagePath, name2),
19309
+ Object.entries(files2).map(([name3, source]) => [
19310
+ import_node_path22.default.join(packagePath, name3),
19164
19311
  source
19165
19312
  ])
19166
19313
  )
19167
19314
  );
19168
19315
  const linkedLibraries = /* @__PURE__ */ new Map();
19169
19316
  for (const unit2 of linked2)
19170
- for (const [name2, library] of Object.entries(libraries.get(unit2) ?? {})) {
19171
- if (linkedLibraries.has(name2) && linkedLibraries.get(name2) !== library)
19172
- throw new Error(`conflicting Expo Swift binary libraries for ${name2}`);
19173
- linkedLibraries.set(name2, library);
19317
+ for (const [name3, library] of Object.entries(libraries.get(unit2) ?? {})) {
19318
+ if (linkedLibraries.has(name3) && linkedLibraries.get(name3) !== library)
19319
+ throw new Error(`conflicting Expo Swift binary libraries for ${name3}`);
19320
+ linkedLibraries.set(name3, library);
19174
19321
  }
19175
19322
  projectFor(packagePath).libraries = linkedLibraries.size > 0 ? Object.fromEntries(linkedLibraries) : void 0;
19176
19323
  signal.throwIfAborted();
@@ -19274,7 +19421,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
19274
19421
  );
19275
19422
  const dropped = linked.filter(
19276
19423
  (unit2) => Object.values(unit2.files).some(
19277
- (source) => swiftImportNames(source).some((name2) => missing.has(name2))
19424
+ (source) => swiftImportNames(source).some((name3) => missing.has(name3))
19278
19425
  )
19279
19426
  );
19280
19427
  if (dropped.length === 0) throw error;
@@ -19478,8 +19625,8 @@ function peachKotlinModuleRoot() {
19478
19625
  if (!import_node_fs24.default.existsSync(root)) {
19479
19626
  const pending = import_node_fs24.default.mkdtempSync(import_node_path24.default.join(parent, ".install-"));
19480
19627
  try {
19481
- for (const [name2, contents] of Object.entries(files2)) {
19482
- const file = import_node_path24.default.join(pending, name2);
19628
+ for (const [name3, contents] of Object.entries(files2)) {
19629
+ const file = import_node_path24.default.join(pending, name3);
19483
19630
  import_node_fs24.default.mkdirSync(import_node_path24.default.dirname(file), { recursive: true });
19484
19631
  import_node_fs24.default.writeFileSync(file, contents);
19485
19632
  }
@@ -19493,9 +19640,9 @@ function peachKotlinModuleRoot() {
19493
19640
  import_node_fs24.default.rmSync(pending, { recursive: true, force: true });
19494
19641
  }
19495
19642
  }
19496
- for (const [name2, contents] of Object.entries(files2)) {
19497
- if (import_node_fs24.default.readFileSync(import_node_path24.default.join(root, name2), "utf8") !== contents)
19498
- throw new Error(`packaged Kotlin module differs from this CLI: ${name2}`);
19643
+ for (const [name3, contents] of Object.entries(files2)) {
19644
+ if (import_node_fs24.default.readFileSync(import_node_path24.default.join(root, name3), "utf8") !== contents)
19645
+ throw new Error(`packaged Kotlin module differs from this CLI: ${name3}`);
19499
19646
  }
19500
19647
  installedRoot = root;
19501
19648
  return root;
@@ -19564,11 +19711,11 @@ function signatureOf(row, android) {
19564
19711
  function viewModelClasses(rows) {
19565
19712
  const byName = new Map(rows.map((row) => [row.name, row]));
19566
19713
  const base = (row, seen) => {
19567
- for (const name2 of row.supers) {
19568
- if (name2 === VIEW_MODEL || name2 === ANDROID_VIEW_MODEL) return name2;
19569
- const parent = byName.get(name2);
19570
- if (parent && !seen.has(name2)) {
19571
- seen.add(name2);
19714
+ for (const name3 of row.supers) {
19715
+ if (name3 === VIEW_MODEL || name3 === ANDROID_VIEW_MODEL) return name3;
19716
+ const parent = byName.get(name3);
19717
+ if (parent && !seen.has(name3)) {
19718
+ seen.add(name3);
19572
19719
  const found = base(parent, seen);
19573
19720
  if (found) return found;
19574
19721
  }
@@ -19745,11 +19892,11 @@ function ensureCompilerPlugin(kotlinc, plugin) {
19745
19892
  const classes = import_node_path25.default.join(work, "classes");
19746
19893
  try {
19747
19894
  const sources = [];
19748
- for (const { name: name2, bytes } of plugin.files) {
19749
- const target = import_node_path25.default.join(work, "sources", name2);
19895
+ for (const { name: name3, bytes } of plugin.files) {
19896
+ const target = import_node_path25.default.join(work, "sources", name3);
19750
19897
  import_node_fs25.default.mkdirSync(import_node_path25.default.dirname(target), { recursive: true });
19751
19898
  import_node_fs25.default.writeFileSync(target, bytes);
19752
- if (name2.endsWith(".kt")) sources.push(target);
19899
+ if (name3.endsWith(".kt")) sources.push(target);
19753
19900
  }
19754
19901
  await run4(
19755
19902
  import_node_path25.default.join(import_node_path25.default.dirname(kotlinc), "kotlinc"),
@@ -19975,11 +20122,11 @@ function expoTypeSources(files2) {
19975
20122
  );
19976
20123
  continue;
19977
20124
  }
19978
- const name2 = literal(field.key);
20125
+ const name3 = literal(field.key);
19979
20126
  const read = `{ record: ${record2.name} -> record.${field.name} }`;
19980
20127
  const write = field.mutable && !field.initializer ? `{ record, value -> record.${field.name} = value }` : "null";
19981
20128
  fields.push(
19982
- ` dev.peach.expo.PeachExpoTypes.field(${name2}, ${field.required}, ${read}, ${write}),`
20129
+ ` dev.peach.expo.PeachExpoTypes.field(${name3}, ${field.required}, ${read}, ${write}),`
19983
20130
  );
19984
20131
  }
19985
20132
  if (record2.hidden) continue;
@@ -20033,9 +20180,9 @@ function expoTypeSources(files2) {
20033
20180
  `${file.package ? `${file.package}.` : ""}peachExpoViews${index}()`
20034
20181
  );
20035
20182
  }
20036
- const name2 = `PeachExpoSource_${index}_${import_node_path25.default.basename(file.file)}`;
20037
- generated[name2] = text4;
20038
- origins[name2] = file.file;
20183
+ const name3 = `PeachExpoSource_${index}_${import_node_path25.default.basename(file.file)}`;
20184
+ generated[name3] = text4;
20185
+ origins[name3] = file.file;
20039
20186
  }
20040
20187
  if (calls.length === 0) return;
20041
20188
  generated[`PeachExpoTypes_${index}.kt`] = [
@@ -20082,7 +20229,7 @@ async function expoKotlinArtifact(root, moduleRoot, origin, modules) {
20082
20229
  ...types.registrations.map((call) => ` ${call}`),
20083
20230
  " PeachExpoRuntime.register(listOf(",
20084
20231
  ...modules.modules.map(
20085
- ({ classifier, name: name2 }) => ` { ${classifier}() } to ${name2 === null ? "null" : JSON.stringify(name2)},`
20232
+ ({ classifier, name: name3 }) => ` { ${classifier}() } to ${name3 === null ? "null" : JSON.stringify(name3)},`
20086
20233
  ),
20087
20234
  " ))",
20088
20235
  "}",
@@ -20128,8 +20275,8 @@ function viewsSource(viewIds) {
20128
20275
  "}"
20129
20276
  ].join("\n");
20130
20277
  }
20131
- function viewModelInitializer({ name: name2, signature }) {
20132
- const call = (args) => ` addInitializer(${name2}::class) { ${name2}(${args}) }`;
20278
+ function viewModelInitializer({ name: name3, signature }) {
20279
+ const call = (args) => ` addInitializer(${name3}::class) { ${name3}(${args}) }`;
20133
20280
  switch (signature) {
20134
20281
  case "none":
20135
20282
  return call("");
@@ -20140,8 +20287,8 @@ function viewModelInitializer({ name: name2, signature }) {
20140
20287
  case "application-handle":
20141
20288
  return call("dev.peach.app.peachApplication(), createSavedStateHandle()");
20142
20289
  case "misordered":
20143
- return ` addInitializer(${name2}::class) { throw UnsupportedOperationException(${JSON.stringify(
20144
- `Class ${name2.split(".").pop()} must have parameters in the proper order: [class android.app.Application, class androidx.lifecycle.SavedStateHandle]`
20290
+ return ` addInitializer(${name3}::class) { throw UnsupportedOperationException(${JSON.stringify(
20291
+ `Class ${name3.split(".").pop()} must have parameters in the proper order: [class android.app.Application, class androidx.lifecycle.SavedStateHandle]`
20145
20292
  )}) }`;
20146
20293
  }
20147
20294
  }
@@ -20236,7 +20383,7 @@ async function kotlinAppArtifact(app, moduleRoot, origin) {
20236
20383
  );
20237
20384
  }
20238
20385
  function appResourceSources(app) {
20239
- const field = (name2) => `\`${name2.replace(/[.-]/g, "_")}\``;
20386
+ const field = (name3) => `\`${name3.replace(/[.-]/g, "_")}\``;
20240
20387
  const id = (type, entry) => `0x7f${type.toString(16).padStart(2, "0")}${entry.toString(16).padStart(4, "0")}`;
20241
20388
  const localized = (resources, render) => resources.map((resource) => ({
20242
20389
  name: resource.name,
@@ -20322,7 +20469,7 @@ ${drawable.files.map((file) => drawableInit(file, import_node_path25.default.rel
20322
20469
  "androidx.compose.ui.graphics.vector.ImageVector",
20323
20470
  "androidx.compose.ui.graphics.vector.addPathNodes",
20324
20471
  "androidx.compose.ui.unit.Dp"
20325
- ].map((name2) => `import ${name2}`),
20472
+ ].map((name3) => `import ${name3}`),
20326
20473
  "",
20327
20474
  ...kinds.flatMap((kind) => [
20328
20475
  `internal val ${kind.table}: Map<Int, ${kind.value}> = mapOf(`,
@@ -20405,15 +20552,15 @@ async function compileKotlin(input, origin) {
20405
20552
  (file) => import_node_path25.default.relative(compilerRoot, file)
20406
20553
  ),
20407
20554
  COMPILER_PLUGIN_SERVICE
20408
- ].map((name2) => ({
20409
- name: name2,
20410
- bytes: import_node_fs25.default.readFileSync(import_node_path25.default.join(compilerRoot, name2))
20555
+ ].map((name3) => ({
20556
+ name: name3,
20557
+ bytes: import_node_fs25.default.readFileSync(import_node_path25.default.join(compilerRoot, name3))
20411
20558
  }));
20412
20559
  const compilerDigest = (0, import_node_crypto17.createHash)("sha256").update(
20413
20560
  JSON.stringify({ format: 1, compiler: toolchain.compiler })
20414
20561
  );
20415
- for (const { name: name2, bytes } of compilerFiles)
20416
- compilerDigest.update(name2).update("\0").update(bytes).update("\0");
20562
+ for (const { name: name3, bytes } of compilerFiles)
20563
+ compilerDigest.update(name3).update("\0").update(bytes).update("\0");
20417
20564
  const plugin = { hash: compilerDigest.digest("hex"), files: compilerFiles };
20418
20565
  const inputs = [...shims, ...sources].map((file) => ({
20419
20566
  file,
@@ -20426,8 +20573,8 @@ async function compileKotlin(input, origin) {
20426
20573
  for (const { file, bytes } of inputs)
20427
20574
  digest2.update(import_node_path25.default.relative(root, file)).update("\0").update(bytes).update("\0");
20428
20575
  if (viewModels) digest2.update(import_node_fs25.default.readFileSync(viewModels.script));
20429
- for (const [name2, text4] of Object.entries(generated))
20430
- digest2.update(`${name2}\0${text4}\0`);
20576
+ for (const [name3, text4] of Object.entries(generated))
20577
+ digest2.update(`${name3}\0${text4}\0`);
20431
20578
  const hash = digest2.digest("hex").slice(0, 24);
20432
20579
  const artifact = {
20433
20580
  url: `${origin}${KOTLIN_ARTIFACT_PREFIX}${hash}/app.mjs`,
@@ -20459,8 +20606,8 @@ async function compileKotlin(input, origin) {
20459
20606
  const work = import_node_fs25.default.mkdtempSync(import_node_path25.default.join(buildsDir(), `${hash}-`));
20460
20607
  const generatedDir = import_node_path25.default.join(work, "generated");
20461
20608
  import_node_fs25.default.mkdirSync(generatedDir);
20462
- for (const [name2, text4] of Object.entries(generated))
20463
- import_node_fs25.default.writeFileSync(import_node_path25.default.join(generatedDir, name2), text4);
20609
+ for (const [name3, text4] of Object.entries(generated))
20610
+ import_node_fs25.default.writeFileSync(import_node_path25.default.join(generatedDir, name3), text4);
20464
20611
  const compiledSources = inputs.map(({ file, bytes }, index) => {
20465
20612
  const target = import_node_path25.default.join(work, "sources", String(index), import_node_path25.default.basename(file));
20466
20613
  import_node_fs25.default.mkdirSync(import_node_path25.default.dirname(target), { recursive: true });
@@ -20494,7 +20641,7 @@ async function compileKotlin(input, origin) {
20494
20641
  "-ir-output-name",
20495
20642
  "app",
20496
20643
  ...compiledSources.map(({ target }) => target),
20497
- ...Object.keys(generated).map((name2) => import_node_path25.default.join(generatedDir, name2))
20644
+ ...Object.keys(generated).map((name3) => import_node_path25.default.join(generatedDir, name3))
20498
20645
  ],
20499
20646
  { maxBuffer: 16 * 1024 * 1024 }
20500
20647
  );
@@ -20573,7 +20720,7 @@ async function compileKotlin(input, origin) {
20573
20720
  "const runtime = globalThis.__peachKotlinSkiko;",
20574
20721
  "if (!runtime) throw Error('Kotlin tenant runtime was not installed before guest evaluation');",
20575
20722
  `for (const name of ${JSON.stringify(names)}) if (!(name in runtime)) throw Error('Kotlin tenant runtime has no ' + name);`,
20576
- ...names.map((name2) => `export const ${name2} = runtime.${name2};`),
20723
+ ...names.map((name3) => `export const ${name3} = runtime.${name3};`),
20577
20724
  ""
20578
20725
  ].join("\n")
20579
20726
  );
@@ -20611,8 +20758,8 @@ async function compileKotlin(input, origin) {
20611
20758
  } catch (error) {
20612
20759
  import_node_fs25.default.rmSync(work, { recursive: true, force: true });
20613
20760
  let output = isRecord(error) ? `${String(error.stderr ?? "")}${String(error.stdout ?? "")}` : "";
20614
- for (const [name2, source] of Object.entries(origins))
20615
- output = output.replaceAll(import_node_path25.default.join(generatedDir, name2), source);
20761
+ for (const [name3, source] of Object.entries(origins))
20762
+ output = output.replaceAll(import_node_path25.default.join(generatedDir, name3), source);
20616
20763
  for (const { file, target } of compiledSources)
20617
20764
  output = output.replaceAll(target, file).replaceAll(import_node_path25.default.relative(process.cwd(), target), file);
20618
20765
  throw new Error(
@@ -20660,10 +20807,10 @@ ${output.trim() || (error instanceof Error ? error.message : String(error))}`
20660
20807
  }
20661
20808
  function kotlinArtifactFiles(hash) {
20662
20809
  const dir = import_node_path25.default.join(buildsDir(), hash, "js");
20663
- return import_node_fs25.default.readdirSync(dir).sort().map((name2) => {
20664
- const contentType = CONTENT_TYPES[import_node_path25.default.extname(name2)];
20665
- if (!contentType) throw new Error(`unexpected kotlin artifact file ${name2}`);
20666
- return { name: name2, bytes: import_node_fs25.default.readFileSync(import_node_path25.default.join(dir, name2)), contentType };
20810
+ return import_node_fs25.default.readdirSync(dir).sort().map((name3) => {
20811
+ const contentType = CONTENT_TYPES[import_node_path25.default.extname(name3)];
20812
+ if (!contentType) throw new Error(`unexpected kotlin artifact file ${name3}`);
20813
+ return { name: name3, bytes: import_node_fs25.default.readFileSync(import_node_path25.default.join(dir, name3)), contentType };
20667
20814
  });
20668
20815
  }
20669
20816
  function serveKotlinArtifact(pathname, res) {
@@ -20926,7 +21073,7 @@ function isExpoSwiftCompilationResult(value) {
20926
21073
  return false;
20927
21074
  const remaining = new Set(value.namespaces);
20928
21075
  if (remaining.size !== value.namespaces.length) return false;
20929
- if (value.bridgeModules !== void 0 && (!strings(value.bridgeModules) || !value.bridgeModules.every((name2) => remaining.has(name2))))
21076
+ if (value.bridgeModules !== void 0 && (!strings(value.bridgeModules) || !value.bridgeModules.every((name3) => remaining.has(name3))))
20930
21077
  return false;
20931
21078
  for (const artifact of value.modules) {
20932
21079
  if (!isRecord(artifact) || !strings(artifact.namespaces) || artifact.namespaces.length === 0 || !artifact.namespaces.every((namespace) => remaining.delete(namespace)) || typeof artifact.url !== "string" || typeof artifact.hash !== "string" || typeof artifact.icuUrl !== "string" || typeof artifact.rootId !== "string")
@@ -20990,7 +21137,7 @@ function prepareBundleChannel({
20990
21137
  publicOrigin,
20991
21138
  sourceSha,
20992
21139
  runtimeVersion,
20993
- name: name2,
21140
+ name: name3,
20994
21141
  icon,
20995
21142
  platforms
20996
21143
  }) {
@@ -21018,7 +21165,7 @@ function prepareBundleChannel({
21018
21165
  origin,
21019
21166
  sourceSha,
21020
21167
  runtimeVersion,
21021
- name: name2,
21168
+ name: name3,
21022
21169
  icon,
21023
21170
  ...snapshot
21024
21171
  })
@@ -21030,7 +21177,7 @@ function prepareChannel({
21030
21177
  origin,
21031
21178
  sourceSha,
21032
21179
  runtimeVersion,
21033
- name: name2,
21180
+ name: name3,
21034
21181
  icon,
21035
21182
  platform,
21036
21183
  bundle,
@@ -21140,7 +21287,7 @@ function prepareChannel({
21140
21287
  schemaVersion: 1,
21141
21288
  ...nativeMetadata,
21142
21289
  channel: "prod",
21143
- name: name2,
21290
+ name: name3,
21144
21291
  iconUrl: `${assetBaseUrl}icon.png`,
21145
21292
  bundleUrl: `${assetBaseUrl}bundle.js`,
21146
21293
  assetBaseUrl,
@@ -21260,7 +21407,7 @@ async function snapshotDevServerBundles(origin, projectRoot, { platforms = ["ios
21260
21407
  return { platforms: snapshots };
21261
21408
  }
21262
21409
  async function snapshotOneDevBundle(projectRoot, env = {}) {
21263
- const { spawn: spawn4 } = await import("node:child_process");
21410
+ const { spawn: spawn5 } = await import("node:child_process");
21264
21411
  const { readFileSync: readFileSync7 } = await import("node:fs");
21265
21412
  const { createServer } = await import("node:net");
21266
21413
  const { dirname: dirname2, join: join3 } = await import("node:path");
@@ -21278,7 +21425,7 @@ async function snapshotOneDevBundle(projectRoot, env = {}) {
21278
21425
  server.close(() => resolve3(port2));
21279
21426
  }).on("error", reject);
21280
21427
  });
21281
- const child = spawn4(process.execPath, [oneBin, "dev", "--port", String(port)], {
21428
+ const child = spawn5(process.execPath, [oneBin, "dev", "--port", String(port)], {
21282
21429
  cwd: projectRoot,
21283
21430
  env: { ...process.env, ...env },
21284
21431
  stdio: ["ignore", "inherit", "inherit"],