peachsim 0.1.758 → 0.1.760

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 (79) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/agent-identity.cjs +1 -1
  4. package/dist-lib/agent-sessions.cjs +1 -1
  5. package/dist-lib/attached-projects.cjs +1 -1
  6. package/dist-lib/auth/shared-session.cjs +1 -1
  7. package/dist-lib/backend-origin.cjs +1 -1
  8. package/dist-lib/beta.cjs +1 -1
  9. package/dist-lib/beta.mjs +1 -1
  10. package/dist-lib/bridge-constants.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.mjs +1 -1
  13. package/dist-lib/bridge-contract.cjs +1 -1
  14. package/dist-lib/bridge-contract.mjs +1 -1
  15. package/dist-lib/capture-contract.cjs +1 -1
  16. package/dist-lib/capture-contract.mjs +1 -1
  17. package/dist-lib/cli-constants.cjs +1 -1
  18. package/dist-lib/cloud-contract.cjs +1 -1
  19. package/dist-lib/cloud-contract.mjs +1 -1
  20. package/dist-lib/cloud-test-args.cjs +1 -1
  21. package/dist-lib/cloud-test-args.mjs +1 -1
  22. package/dist-lib/cloud.cjs +1 -1
  23. package/dist-lib/cloud.mjs +1 -1
  24. package/dist-lib/config.cjs +1 -1
  25. package/dist-lib/detox/index.cjs +1 -1
  26. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  27. package/dist-lib/home-paths.cjs +1 -1
  28. package/dist-lib/host/bridge-host.cjs +1316 -863
  29. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  30. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  31. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  32. package/dist-lib/host/replacement-module-handler.cjs +2 -4
  33. package/dist-lib/host/websocket-proxy.cjs +1 -1
  34. package/dist-lib/index.cjs +509 -336
  35. package/dist-lib/jump-to-source-babel.cjs +1 -1
  36. package/dist-lib/jump-to-source-native.cjs +1 -1
  37. package/dist-lib/kotlin-host.cjs +1 -1
  38. package/dist-lib/menu.cjs +1 -1
  39. package/dist-lib/menu.mjs +1 -1
  40. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  41. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  42. package/dist-lib/metro-production-bundle.cjs +1 -1
  43. package/dist-lib/metro-production-bundle.mjs +1 -1
  44. package/dist-lib/metro.cjs +480 -307
  45. package/dist-lib/native-app-identity.cjs +1 -1
  46. package/dist-lib/native-app-identity.mjs +1 -1
  47. package/dist-lib/native-firebase-metadata.cjs +1 -1
  48. package/dist-lib/native-firebase-metadata.mjs +1 -1
  49. package/dist-lib/plist.cjs +1 -1
  50. package/dist-lib/plist.mjs +1 -1
  51. package/dist-lib/profiles.cjs +1 -1
  52. package/dist-lib/public-brand.cjs +1 -1
  53. package/dist-lib/react-native-host-modules.cjs +1 -1
  54. package/dist-lib/react-native-host-modules.mjs +1 -1
  55. package/dist-lib/render-mode.cjs +1 -1
  56. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  57. package/dist-lib/sdk.cjs +1 -1
  58. package/dist-lib/sdk.mjs +1 -1
  59. package/dist-lib/skills.cjs +1637 -1173
  60. package/dist-lib/swift-compile.cjs +1 -1
  61. package/dist-lib/swift-compile.mjs +1 -1
  62. package/dist-lib/swift-package.cjs +1 -110
  63. package/dist-lib/swift-package.mjs +1 -109
  64. package/dist-lib/swift-submit.cjs +1 -1
  65. package/dist-lib/swift-submit.mjs +1 -1
  66. package/dist-lib/swift-toolchain.cjs +1 -1
  67. package/dist-lib/swift.cjs +1 -1
  68. package/dist-lib/vite-swift.cjs +1013 -558
  69. package/dist-lib/vite.cjs +2 -4
  70. package/package.json +1 -1
  71. package/src/host/replacement-module-handler.ts +2 -1
  72. package/src/native-seam-manifest.ts +8 -0
  73. package/src/swift-host.ts +68 -66
  74. package/src/swift-package-manifest.ts +307 -0
  75. package/src/swift-package.ts +2 -135
  76. package/src/swift-packages.ts +341 -0
  77. package/src/xcode-json-project.ts +450 -0
  78. package/src/xcode-project.ts +112 -92
  79. package/src/swift-remote-packages.ts +0 -255
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.758 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.760 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -287,8 +287,8 @@ __export(vite_plugin_swift_exports, {
287
287
  swiftPlugin: () => swiftPlugin
288
288
  });
289
289
  module.exports = __toCommonJS(vite_plugin_swift_exports);
290
- var import_node_fs10 = __toESM(require("node:fs"), 1);
291
- var import_node_path11 = __toESM(require("node:path"), 1);
290
+ var import_node_fs11 = __toESM(require("node:fs"), 1);
291
+ var import_node_path13 = __toESM(require("node:path"), 1);
292
292
 
293
293
  // ../sootsim-swift/src/entryModule.ts
294
294
  function nativeExportLines(args, commonjs) {
@@ -544,116 +544,9 @@ function manifestCalls(manifest, kinds) {
544
544
  }
545
545
  return calls;
546
546
  }
547
- var NAME = /\bname\s*:\s*"([^"]+)"/;
548
- function listArgument(call, label) {
549
- const start = new RegExp(`\\b${label}\\s*:\\s*\\[`).exec(call);
550
- if (!start) return [];
551
- const items = [];
552
- let depth = 0;
553
- let inString = false;
554
- let item = "";
555
- for (let i = start.index + start[0].length; i < call.length; i++) {
556
- const ch = call[i];
557
- if (inString) {
558
- item += ch;
559
- if (ch === '"' && call[i - 1] !== "\\") inString = false;
560
- continue;
561
- }
562
- if (ch === '"') inString = true;
563
- else if (ch === "(" || ch === "[") depth++;
564
- else if (ch === ")" || ch === "]") {
565
- if (depth === 0) break;
566
- depth--;
567
- } else if (ch === "," && depth === 0) {
568
- items.push(item.trim());
569
- item = "";
570
- continue;
571
- }
572
- item += ch;
573
- }
574
- if (item.trim()) items.push(item.trim());
575
- return items;
576
- }
577
547
  function swiftPackageIdentity(url) {
578
548
  return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
579
549
  }
580
- function swiftManifestGraph(manifest) {
581
- const graph = {
582
- products: /* @__PURE__ */ new Map(),
583
- dependencies: /* @__PURE__ */ new Map(),
584
- binaryTargets: /* @__PURE__ */ new Set(),
585
- systemLibraries: /* @__PURE__ */ new Set(),
586
- packageURLs: /* @__PURE__ */ new Map(),
587
- packagePaths: []
588
- };
589
- for (const { kind, flat, call } of manifestCalls(manifest, [
590
- "library",
591
- "executableTarget",
592
- "target",
593
- "binaryTarget",
594
- "systemLibrary",
595
- "package"
596
- ])) {
597
- if (kind === "package") {
598
- const local = /\bpath\s*:\s*"([^"]+)"/.exec(flat)?.[1];
599
- if (local) graph.packagePaths.push(local);
600
- const url = /\burl\s*:\s*"([^"]+)"/.exec(flat)?.[1];
601
- if (!url) continue;
602
- graph.packageURLs.set(swiftPackageIdentity(url), url);
603
- const name2 = NAME.exec(flat)?.[1];
604
- if (name2) graph.packageURLs.set(name2.toLowerCase(), url);
605
- continue;
606
- }
607
- const name = NAME.exec(flat)?.[1];
608
- if (!name) continue;
609
- if (kind === "library") {
610
- graph.products.set(
611
- name,
612
- listArgument(call, "targets").flatMap(
613
- (item) => /^"([^"]+)"$/.exec(item)?.[1] ?? []
614
- )
615
- );
616
- continue;
617
- }
618
- if (kind === "binaryTarget") graph.binaryTargets.add(name);
619
- if (kind === "systemLibrary") graph.systemLibraries.add(name);
620
- const dependencies = [];
621
- for (const item of listArgument(call, "dependencies")) {
622
- const platforms = /condition\s*:\s*\.when\(\s*platforms\s*:\s*\[([^\]]*)\]/.exec(
623
- item
624
- )?.[1];
625
- if (platforms !== void 0 && !/\.iOS\b/.test(platforms)) continue;
626
- if (/condition\s*:\s*\.when\([^)]*\btraits\s*:/.test(item)) continue;
627
- const plain = /^"([^"]+)"$/.exec(item)?.[1];
628
- const product = /^\.product(?:Item)?\(\s*name\s*:\s*"([^"]+)"\s*,\s*package\s*:\s*"([^"]+)"/.exec(
629
- item
630
- );
631
- const target = /^\.(?:target|byName)(?:Item)?\(\s*name\s*:\s*"([^"]+)"/.exec(
632
- item
633
- )?.[1];
634
- if (plain) dependencies.push({ kind: "target", name: plain });
635
- else if (product)
636
- dependencies.push({
637
- kind: "product",
638
- name: product[1],
639
- package: product[2].toLowerCase()
640
- });
641
- else if (target) dependencies.push({ kind: "target", name: target });
642
- }
643
- graph.dependencies.set(name, dependencies);
644
- }
645
- for (const dependencies of graph.dependencies.values()) {
646
- for (const [index, dependency] of dependencies.entries()) {
647
- if (dependency.kind === "target" && !graph.dependencies.has(dependency.name))
648
- dependencies[index] = {
649
- kind: "product",
650
- name: dependency.name,
651
- package: dependency.name.toLowerCase()
652
- };
653
- }
654
- }
655
- return graph;
656
- }
657
550
  function swiftManifestTargets(manifest, resourcePaths = []) {
658
551
  const implicitResources = swiftImplicitResourcePaths(resourcePaths);
659
552
  const targets = [];
@@ -1072,21 +965,21 @@ var CLASS_DECL = /^class\s+(?!(?:func|var|let|subscript)\b)([A-Za-z_]\w*)/;
1072
965
  var MODIFIERS = /(?:^|\s)(public|open|internal|fileprivate|private|final|nonisolated|@MainActor)(?=\s)/g;
1073
966
  var OVERRIDE_FUNC = /^override((?:\s+(?:public|open|internal|fileprivate|private|final|nonisolated|dynamic|@\w+))*)\s+func\s+([A-Za-z_]\w*)\s*(<[^>{}]*>)?\s*\(/;
1074
967
  var OVERRIDE_VAR = /^override((?:\s+(?:public|open|internal|fileprivate|private|final|nonisolated|dynamic|@\w+))*)\s+var\s+([A-Za-z_]\w*)\s*:\s*([^{=]+?)\s*\{/;
1075
- function splitTopLevel(text) {
968
+ function splitTopLevel(text2) {
1076
969
  const parts = [];
1077
970
  let depth = 0;
1078
971
  let start = 0;
1079
- for (let i = 0; i < text.length; i++) {
1080
- const char = text[i];
972
+ for (let i = 0; i < text2.length; i++) {
973
+ const char = text2[i];
1081
974
  if (char === "(" || char === "[" || char === "<") depth++;
1082
- else if (char === ")" || char === "]" || char === ">" && text[i - 1] !== "-")
975
+ else if (char === ")" || char === "]" || char === ">" && text2[i - 1] !== "-")
1083
976
  depth--;
1084
977
  else if (char === "," && depth === 0) {
1085
- parts.push(text.slice(start, i));
978
+ parts.push(text2.slice(start, i));
1086
979
  start = i + 1;
1087
980
  }
1088
981
  }
1089
- parts.push(text.slice(start));
982
+ parts.push(text2.slice(start));
1090
983
  return parts.map((part) => part.trim()).filter((part) => part !== "");
1091
984
  }
1092
985
  function forwardedArguments(parameters) {
@@ -1113,21 +1006,21 @@ function scanObjCExtensionMembers(source, tokens, records) {
1113
1006
  const masked = swiftCodeMask(source);
1114
1007
  const found = /* @__PURE__ */ new Map();
1115
1008
  const member = /\b(func|var)\s+([A-Za-z_]\w*)/g;
1116
- for (const record of records) {
1117
- const close = closingBrace(source, tokens, record.open);
1118
- const body = masked.slice(record.open, close);
1009
+ for (const record2 of records) {
1010
+ const close = closingBrace(source, tokens, record2.open);
1011
+ const body = masked.slice(record2.open, close);
1119
1012
  member.lastIndex = 0;
1120
1013
  for (let match = member.exec(body); match; match = member.exec(body)) {
1121
- const at = record.open + match.index + match[0].indexOf(match[1]);
1014
+ const at = record2.open + match.index + match[0].indexOf(match[1]);
1122
1015
  let depth = 0;
1123
1016
  for (const token of tokens) {
1124
- if (token <= record.open) continue;
1017
+ if (token <= record2.open) continue;
1125
1018
  if (token >= at) break;
1126
1019
  if (source[token] === "{") depth++;
1127
1020
  else if (source[token] === "}") depth--;
1128
1021
  }
1129
1022
  if (depth > 0) continue;
1130
- const head = masked.slice(record.open, at);
1023
+ const head = masked.slice(record2.open, at);
1131
1024
  const bound = Math.max(
1132
1025
  head.lastIndexOf(";"),
1133
1026
  head.lastIndexOf("{"),
@@ -1138,11 +1031,11 @@ function scanObjCExtensionMembers(source, tokens, records) {
1138
1031
  prefix
1139
1032
  ))
1140
1033
  continue;
1141
- if (!/@objc\b/.test(prefix) && !/@IBAction\b/.test(prefix) && !record.objcMembers)
1034
+ if (!/@objc\b/.test(prefix) && !/@IBAction\b/.test(prefix) && !record2.objcMembers)
1142
1035
  continue;
1143
- const members = found.get(record.type) ?? /* @__PURE__ */ new Set();
1036
+ const members = found.get(record2.type) ?? /* @__PURE__ */ new Set();
1144
1037
  members.add(match[2]);
1145
- found.set(record.type, members);
1038
+ found.set(record2.type, members);
1146
1039
  }
1147
1040
  }
1148
1041
  return found;
@@ -2007,10 +1900,10 @@ function compileSwiftProjectUnit(input, options) {
2007
1900
  }
2008
1901
 
2009
1902
  // src/swift-host.ts
2010
- var import_node_crypto4 = require("node:crypto");
2011
- var import_node_fs9 = __toESM(require("node:fs"), 1);
2012
- var import_node_os5 = __toESM(require("node:os"), 1);
2013
- var import_node_path10 = __toESM(require("node:path"), 1);
1903
+ var import_node_crypto5 = require("node:crypto");
1904
+ var import_node_fs10 = __toESM(require("node:fs"), 1);
1905
+ var import_node_os6 = __toESM(require("node:os"), 1);
1906
+ var import_node_path12 = __toESM(require("node:path"), 1);
2014
1907
 
2015
1908
  // ../sootsim-swift/src/bundleAssets.ts
2016
1909
  var import_svgpath = __toESM(require("svgpath"), 1);
@@ -2044,14 +1937,14 @@ function pickImagesetFile(images) {
2044
1937
  scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
2045
1938
  };
2046
1939
  }
2047
- function flatScale(path11) {
2048
- const match = /@([23])x\.[^./]+$/.exec(path11);
1940
+ function flatScale(path13) {
1941
+ const match = /@([23])x\.[^./]+$/.exec(path13);
2049
1942
  return match ? Number(match[1]) : 1;
2050
1943
  }
2051
- function providesNamespace(text) {
2052
- if (text === null) return false;
1944
+ function providesNamespace(text2) {
1945
+ if (text2 === null) return false;
2053
1946
  try {
2054
- const parsed = JSON.parse(text);
1947
+ const parsed = JSON.parse(text2);
2055
1948
  return parsed?.properties?.["provides-namespace"] === true;
2056
1949
  } catch {
2057
1950
  return false;
@@ -2072,21 +1965,21 @@ function catalogEntryName(contentsPath, kind, readText) {
2072
1965
  }
2073
1966
  return segments.join("/");
2074
1967
  }
2075
- function isFlatResourceImage(path11) {
2076
- return path11.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path11));
1968
+ function isFlatResourceImage(path13) {
1969
+ return path13.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path13));
2077
1970
  }
2078
1971
  function enumerateBundleImages(paths, readText) {
2079
1972
  const table = [];
2080
1973
  const seen = /* @__PURE__ */ new Set();
2081
- const catalogs = paths.filter((path11) => baseOf(path11) === "Contents.json");
1974
+ const catalogs = paths.filter((path13) => baseOf(path13) === "Contents.json");
2082
1975
  for (const contentsPath of catalogs) {
2083
1976
  const name = catalogEntryName(contentsPath, ".imageset", readText);
2084
1977
  if (name === null || seen.has(name)) continue;
2085
1978
  let parsed;
2086
1979
  try {
2087
- const text = readText(contentsPath);
2088
- if (text === null) continue;
2089
- parsed = JSON.parse(text);
1980
+ const text2 = readText(contentsPath);
1981
+ if (text2 === null) continue;
1982
+ parsed = JSON.parse(text2);
2090
1983
  } catch {
2091
1984
  continue;
2092
1985
  }
@@ -2099,12 +1992,12 @@ function enumerateBundleImages(paths, readText) {
2099
1992
  seen.add(name);
2100
1993
  table.push({ name, file: `${dir}/${pick.filename}`, scale: pick.scale });
2101
1994
  }
2102
- for (const path11 of paths) {
2103
- if (!isFlatResourceImage(path11)) continue;
2104
- const name = baseOf(path11).slice(0, -extOf(path11).length);
1995
+ for (const path13 of paths) {
1996
+ if (!isFlatResourceImage(path13)) continue;
1997
+ const name = baseOf(path13).slice(0, -extOf(path13).length);
2105
1998
  if (name === "" || seen.has(name)) continue;
2106
1999
  seen.add(name);
2107
- table.push({ name, file: path11, scale: flatScale(path11) });
2000
+ table.push({ name, file: path13, scale: flatScale(path13) });
2108
2001
  }
2109
2002
  return table;
2110
2003
  }
@@ -2133,14 +2026,14 @@ function colorsetValue(color) {
2133
2026
  }
2134
2027
  function enumerateBundleColors(paths, readText) {
2135
2028
  const table = {};
2136
- for (const contentsPath of paths.filter((path11) => baseOf(path11) === "Contents.json")) {
2029
+ for (const contentsPath of paths.filter((path13) => baseOf(path13) === "Contents.json")) {
2137
2030
  const name = catalogEntryName(contentsPath, ".colorset", readText);
2138
2031
  if (name === null || name in table) continue;
2139
2032
  let colors;
2140
2033
  try {
2141
- const text = readText(contentsPath);
2142
- if (text === null) continue;
2143
- colors = Reflect.get(JSON.parse(text), "colors");
2034
+ const text2 = readText(contentsPath);
2035
+ if (text2 === null) continue;
2036
+ colors = Reflect.get(JSON.parse(text2), "colors");
2144
2037
  } catch {
2145
2038
  continue;
2146
2039
  }
@@ -2173,11 +2066,11 @@ var SYMBOL_CAP_HEIGHT_EM = 1443 / 2048;
2173
2066
  function axisExtremes(points) {
2174
2067
  const [a = 0, b = 0, c = 0, d] = points;
2175
2068
  const out = [a, d ?? c];
2176
- const within = (t) => t > 0 && t < 1;
2069
+ const within2 = (t) => t > 0 && t < 1;
2177
2070
  if (d === void 0) {
2178
2071
  const denom = a - 2 * b + c;
2179
2072
  const t = denom === 0 ? -1 : (a - b) / denom;
2180
- if (within(t)) out.push((1 - t) ** 2 * a + 2 * (1 - t) * t * b + t ** 2 * c);
2073
+ if (within2(t)) out.push((1 - t) ** 2 * a + 2 * (1 - t) * t * b + t ** 2 * c);
2181
2074
  return out;
2182
2075
  }
2183
2076
  const qa = 3 * (-a + 3 * b - 3 * c + d);
@@ -2189,7 +2082,7 @@ function axisExtremes(points) {
2189
2082
  const root = Math.sqrt(disc);
2190
2083
  return [(-qb + root) / (2 * qa), (-qb - root) / (2 * qa)];
2191
2084
  })();
2192
- for (const t of roots.filter(within))
2085
+ for (const t of roots.filter(within2))
2193
2086
  out.push(
2194
2087
  (1 - t) ** 3 * a + 3 * (1 - t) ** 2 * t * b + 3 * (1 - t) * t ** 2 * c + t ** 3 * d
2195
2088
  );
@@ -2198,8 +2091,8 @@ function axisExtremes(points) {
2198
2091
  function pathBounds(d) {
2199
2092
  const xs = [];
2200
2093
  const ys = [];
2201
- for (const path11 of d)
2202
- (0, import_svgpath.default)(path11).abs().unshort().unarc().iterate((segment, _index, x, y) => {
2094
+ for (const path13 of d)
2095
+ (0, import_svgpath.default)(path13).abs().unshort().unarc().iterate((segment, _index, x, y) => {
2203
2096
  const [command, ...args] = segment;
2204
2097
  if (command === "M" || command === "L") {
2205
2098
  xs.push(Number(args[0]));
@@ -2226,7 +2119,7 @@ function guide(svg, id, axis) {
2226
2119
  }
2227
2120
  function enumerateBundleSymbols(paths, readText) {
2228
2121
  const table = {};
2229
- for (const contentsPath of paths.filter((path11) => baseOf(path11) === "Contents.json")) {
2122
+ for (const contentsPath of paths.filter((path13) => baseOf(path13) === "Contents.json")) {
2230
2123
  const name = catalogEntryName(contentsPath, ".symbolset", readText);
2231
2124
  if (name === null || name in table) continue;
2232
2125
  let symbols;
@@ -2259,8 +2152,8 @@ function enumerateBundleSymbols(paths, readText) {
2259
2152
  viewBox: "0 0 24 24",
2260
2153
  advance,
2261
2154
  box: [12 - advance / 2, 12 - tall / 2, advance, tall],
2262
- layers: d.map((path11) => ({
2263
- d: (0, import_svgpath.default)(path11).abs().scale(scale).translate(translateX, translateY).round(3).toString()
2155
+ layers: d.map((path13) => ({
2156
+ d: (0, import_svgpath.default)(path13).abs().scale(scale).translate(translateX, translateY).round(3).toString()
2264
2157
  }))
2265
2158
  };
2266
2159
  }
@@ -2270,7 +2163,7 @@ function enumerateBundleJson(paths) {
2270
2163
  const found = [];
2271
2164
  const seen = /* @__PURE__ */ new Set();
2272
2165
  const ordered = [...paths].filter(
2273
- (path11) => path11.split("/").includes("Resources") && path11.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path11) === ".json" || extOf(path11) === ".xcstrings")
2166
+ (path13) => path13.split("/").includes("Resources") && path13.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path13) === ".json" || extOf(path13) === ".xcstrings")
2274
2167
  ).sort((a, b) => {
2275
2168
  const aDepth = a.split("/").length;
2276
2169
  const bDepth = b.split("/").length;
@@ -2748,14 +2641,225 @@ function swiftModuleToolchain(root) {
2748
2641
  };
2749
2642
  }
2750
2643
 
2751
- // src/swift-remote-packages.ts
2644
+ // src/swift-packages.ts
2645
+ var import_node_child_process6 = require("node:child_process");
2646
+ var import_node_fs8 = __toESM(require("node:fs"), 1);
2647
+ var import_node_path9 = __toESM(require("node:path"), 1);
2648
+
2649
+ // src/swift-package-manifest.ts
2752
2650
  var import_node_child_process5 = require("node:child_process");
2651
+ var import_node_crypto4 = require("node:crypto");
2753
2652
  var import_node_fs7 = __toESM(require("node:fs"), 1);
2653
+ var import_node_os5 = __toESM(require("node:os"), 1);
2754
2654
  var import_node_path8 = __toESM(require("node:path"), 1);
2755
- var REMOTE_CHECKOUTS = import_node_path8.default.join(".build", "peach", "checkouts");
2655
+ var TARGET_TYPES = [
2656
+ "regular",
2657
+ "executable",
2658
+ "test",
2659
+ "binary",
2660
+ "system",
2661
+ "macro",
2662
+ "plugin"
2663
+ ];
2664
+ var isTargetType = (value) => TARGET_TYPES.some((type) => type === value);
2665
+ var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
2666
+ var array = (value) => Array.isArray(value) ? value : [];
2667
+ var string = (value) => typeof value === "string" ? value : void 0;
2668
+ function swiftCommand() {
2669
+ return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path8.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
2670
+ }
2671
+ var cacheDir = import_node_path8.default.join(import_node_os5.default.tmpdir(), "peach-swift-manifests");
2672
+ var evaluated = /* @__PURE__ */ new Map();
2673
+ function dump(dir) {
2674
+ const manifests = import_node_fs7.default.readdirSync(dir).filter((name) => /^Package(@swift-[\d.]+)?\.swift$/.test(name)).sort();
2675
+ const command = swiftCommand();
2676
+ const key = (0, import_node_crypto4.createHash)("sha256").update(JSON.stringify([command, import_node_path8.default.resolve(dir)])).update(
2677
+ manifests.map((name) => `${name}\0${import_node_fs7.default.readFileSync(import_node_path8.default.join(dir, name), "utf8")}`).join("\0")
2678
+ ).digest("hex").slice(0, 32);
2679
+ const cached = import_node_path8.default.join(cacheDir, `${key}.json`);
2680
+ if (import_node_fs7.default.existsSync(cached))
2681
+ return { key, raw: record(JSON.parse(import_node_fs7.default.readFileSync(cached, "utf8"))) };
2682
+ let output;
2683
+ try {
2684
+ output = (0, import_node_child_process5.execFileSync)(
2685
+ command.file,
2686
+ [
2687
+ ...command.args,
2688
+ "package",
2689
+ "--package-path",
2690
+ dir,
2691
+ // swiftpm's scratch files never land in the app's own package
2692
+ "--scratch-path",
2693
+ import_node_path8.default.join(cacheDir, `${key}.build`),
2694
+ "dump-package"
2695
+ ],
2696
+ {
2697
+ encoding: "utf8",
2698
+ stdio: ["ignore", "pipe", "pipe"],
2699
+ maxBuffer: 64 * 1024 * 1024
2700
+ }
2701
+ );
2702
+ } catch (error) {
2703
+ const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
2704
+ throw new Error(
2705
+ `swiftpm could not evaluate ${import_node_path8.default.join(dir, "Package.swift")}${stderr ? `: ${stderr}` : ""}`
2706
+ );
2707
+ }
2708
+ import_node_fs7.default.mkdirSync(cacheDir, { recursive: true });
2709
+ import_node_fs7.default.writeFileSync(cached, output);
2710
+ return { key, raw: record(JSON.parse(output)) };
2711
+ }
2712
+ function defaultTraits(manifest) {
2713
+ const traits = new Map(
2714
+ array(manifest.traits).map((trait) => [
2715
+ string(record(trait).name) ?? "",
2716
+ array(record(trait).enabledTraits).flatMap((name) => string(name) ?? [])
2717
+ ])
2718
+ );
2719
+ const enabled = /* @__PURE__ */ new Set();
2720
+ const pending = [...traits.get("default") ?? []];
2721
+ while (pending.length > 0) {
2722
+ const name = pending.pop();
2723
+ if (enabled.has(name)) continue;
2724
+ enabled.add(name);
2725
+ pending.push(...traits.get(name) ?? []);
2726
+ }
2727
+ return enabled;
2728
+ }
2729
+ function linksOnIOS(condition, traits) {
2730
+ const { platformNames, traits: needed } = record(condition);
2731
+ const platforms = array(platformNames);
2732
+ if (platforms.length > 0 && !platforms.includes("ios")) return false;
2733
+ const gates = array(needed);
2734
+ return gates.length === 0 || gates.some((name) => traits.has(string(name) ?? ""));
2735
+ }
2736
+ function swiftPackageManifest(dir) {
2737
+ dir = import_node_fs7.default.realpathSync(dir);
2738
+ const { key, raw: raw2 } = dump(dir);
2739
+ const known = evaluated.get(key);
2740
+ if (known) return known;
2741
+ const traits = defaultTraits(raw2);
2742
+ const tools = Number(
2743
+ /^(\d+)/.exec(string(record(raw2.toolsVersion)._version) ?? "5")?.[1] ?? 5
2744
+ );
2745
+ const declaredModes = array(raw2.swiftLanguageVersions).flatMap((mode) => {
2746
+ const major = Number(/^(\d+)/.exec(string(mode) ?? "")?.[1]);
2747
+ return Number.isFinite(major) ? [major] : [];
2748
+ });
2749
+ const packageMode = Math.max(
2750
+ 5,
2751
+ declaredModes.length > 0 ? Math.max(...declaredModes) : tools >= 6 ? 6 : 5
2752
+ );
2753
+ const packages = /* @__PURE__ */ new Map();
2754
+ for (const entry of array(raw2.dependencies)) {
2755
+ const { sourceControl, fileSystem } = record(entry);
2756
+ const source = record(array(sourceControl ?? fileSystem)[0]);
2757
+ const identity = string(source.identity);
2758
+ if (!identity) continue;
2759
+ const url = string(record(array(record(source.location).remote)[0]).urlString);
2760
+ const local = string(source.path);
2761
+ const value = url ? { url } : local ? { dir: local } : null;
2762
+ if (!value) continue;
2763
+ packages.set(identity, value);
2764
+ const alias = string(source.nameForTargetDependencyResolutionOnly);
2765
+ if (alias) packages.set(alias.toLowerCase(), value);
2766
+ }
2767
+ const products = /* @__PURE__ */ new Map();
2768
+ for (const product of array(raw2.products)) {
2769
+ const { name, targets: targets2, type } = record(product);
2770
+ if (!string(name) || !("library" in record(type))) continue;
2771
+ products.set(
2772
+ string(name),
2773
+ array(targets2).flatMap((target) => string(target) ?? [])
2774
+ );
2775
+ }
2776
+ const targets = /* @__PURE__ */ new Map();
2777
+ const names = new Set(array(raw2.targets).map((target) => string(record(target).name)));
2778
+ for (const entry of array(raw2.targets)) {
2779
+ const target = record(entry);
2780
+ const name = string(target.name);
2781
+ const kind = string(target.type);
2782
+ if (!name || !isTargetType(kind)) continue;
2783
+ const declared = string(target.path);
2784
+ const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
2785
+ const targetDir = declared ? import_node_path8.default.resolve(dir, declared) : roots.map((root) => import_node_path8.default.join(dir, root, name)).find((candidate) => import_node_fs7.default.existsSync(candidate)) ?? import_node_path8.default.join(dir, roots[0], name);
2786
+ const dependencies = [];
2787
+ for (const dependency of array(target.dependencies)) {
2788
+ const { target: local, product, byName } = record(dependency);
2789
+ const payload = array(local ?? product ?? byName);
2790
+ if (!linksOnIOS(payload[payload.length - 1], traits)) continue;
2791
+ const dependencyName = string(payload[0]);
2792
+ if (!dependencyName) continue;
2793
+ if (product)
2794
+ dependencies.push({
2795
+ kind: "product",
2796
+ name: dependencyName,
2797
+ package: (string(payload[1]) ?? "").toLowerCase()
2798
+ });
2799
+ else if (local || names.has(dependencyName))
2800
+ dependencies.push({ kind: "target", name: dependencyName });
2801
+ else
2802
+ dependencies.push({
2803
+ kind: "product",
2804
+ name: dependencyName,
2805
+ package: dependencyName.toLowerCase()
2806
+ });
2807
+ }
2808
+ let languageMode = packageMode;
2809
+ let mainActorIsolation = false;
2810
+ for (const setting of array(target.settings)) {
2811
+ const settingKind = record(record(setting).kind);
2812
+ const mode = string(record(settingKind.swiftLanguageMode)._0);
2813
+ if (mode)
2814
+ languageMode = Math.max(5, Number(/^(\d+)/.exec(mode)?.[1] ?? languageMode));
2815
+ if (string(record(settingKind.defaultIsolation)._0) === "MainActor")
2816
+ mainActorIsolation = true;
2817
+ }
2818
+ targets.set(name, {
2819
+ name,
2820
+ type: kind,
2821
+ dir: targetDir,
2822
+ sources: target.sources == null ? null : array(target.sources).flatMap((file) => string(file) ?? []),
2823
+ exclude: array(target.exclude).flatMap((file) => string(file) ?? []),
2824
+ dependencies,
2825
+ languageMode,
2826
+ mainActorIsolation,
2827
+ declaresResources: array(target.resources).length > 0
2828
+ });
2829
+ }
2830
+ const manifest = { dir, products, targets, packages };
2831
+ evaluated.set(key, manifest);
2832
+ return manifest;
2833
+ }
2834
+ var within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path8.default.sep}`));
2835
+ function walk(dir) {
2836
+ if (!import_node_fs7.default.existsSync(dir)) return [];
2837
+ if (import_node_fs7.default.statSync(dir).isFile()) return [dir];
2838
+ const out = [];
2839
+ for (const entry of import_node_fs7.default.readdirSync(dir, { withFileTypes: true })) {
2840
+ if (entry.name.startsWith(".")) continue;
2841
+ const full = import_node_path8.default.join(dir, entry.name);
2842
+ if (entry.isDirectory()) out.push(...walk(full));
2843
+ else if (entry.isFile()) out.push(full);
2844
+ }
2845
+ return out;
2846
+ }
2847
+ function swiftTargetFiles(manifest, target) {
2848
+ const included = target.sources ? target.sources.map((source) => import_node_path8.default.resolve(target.dir, source)) : [target.dir];
2849
+ const excluded = [
2850
+ ...target.exclude.map((file) => import_node_path8.default.resolve(target.dir, file)),
2851
+ ...[...manifest.targets.values()].flatMap(
2852
+ (other) => other !== target && within(other.dir, [target.dir]) && other.dir !== target.dir ? [other.dir] : []
2853
+ )
2854
+ ];
2855
+ return included.flatMap(walk).filter((file) => !within(file, excluded)).sort();
2856
+ }
2857
+
2858
+ // src/swift-packages.ts
2859
+ var REMOTE_CHECKOUTS = import_node_path9.default.join(".build", "peach", "checkouts");
2756
2860
  var C_FAMILY = /\.(c|cc|cpp|cxx|m|mm|s|S)$/;
2757
2861
  function readPins(resolved) {
2758
- const data = JSON.parse(import_node_fs7.default.readFileSync(resolved, "utf8"));
2862
+ const data = JSON.parse(import_node_fs8.default.readFileSync(resolved, "utf8"));
2759
2863
  const pins = data && typeof data === "object" && "pins" in data && Array.isArray(data.pins) ? data.pins : null;
2760
2864
  if (!pins)
2761
2865
  throw new Error(`${resolved} has no pins; resolve packages in a current Xcode`);
@@ -2769,36 +2873,25 @@ function readPins(resolved) {
2769
2873
  }
2770
2874
  return out;
2771
2875
  }
2772
- function walk(dir) {
2773
- if (!import_node_fs7.default.existsSync(dir)) return [];
2774
- const out = [];
2775
- for (const entry of import_node_fs7.default.readdirSync(dir, { withFileTypes: true })) {
2776
- if (entry.name.startsWith(".")) continue;
2777
- const full = import_node_path8.default.join(dir, entry.name);
2778
- if (entry.isDirectory()) out.push(...walk(full));
2779
- else if (entry.isFile()) out.push(full);
2780
- }
2781
- return out.sort();
2782
- }
2783
2876
  var verified2 = /* @__PURE__ */ new Set();
2784
2877
  function checkout(checkouts, identity, pin) {
2785
- const dir = import_node_path8.default.join(checkouts, identity);
2878
+ const dir = import_node_path9.default.join(checkouts, identity);
2786
2879
  const key = `${dir}\0${pin.revision}`;
2787
2880
  if (verified2.has(key)) return dir;
2788
- const git = (...args) => (0, import_node_child_process5.execFileSync)("git", ["-C", dir, ...args], {
2881
+ const git = (...args) => (0, import_node_child_process6.execFileSync)("git", ["-C", dir, ...args], {
2789
2882
  encoding: "utf8",
2790
2883
  stdio: ["ignore", "pipe", "pipe"]
2791
2884
  }).trim();
2792
- const current = import_node_fs7.default.existsSync(import_node_path8.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
2885
+ const current = import_node_fs8.default.existsSync(import_node_path9.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
2793
2886
  if (current !== pin.revision) {
2794
- import_node_fs7.default.rmSync(dir, { recursive: true, force: true });
2795
- import_node_fs7.default.mkdirSync(dir, { recursive: true });
2887
+ import_node_fs8.default.rmSync(dir, { recursive: true, force: true });
2888
+ import_node_fs8.default.mkdirSync(dir, { recursive: true });
2796
2889
  try {
2797
2890
  git("init", "-q");
2798
2891
  git("fetch", "-q", "--depth", "1", pin.location, pin.revision);
2799
2892
  git("checkout", "-q", "FETCH_HEAD");
2800
2893
  } catch (error) {
2801
- import_node_fs7.default.rmSync(dir, { recursive: true, force: true });
2894
+ import_node_fs8.default.rmSync(dir, { recursive: true, force: true });
2802
2895
  const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
2803
2896
  throw new Error(
2804
2897
  `could not fetch ${pin.location} at ${pin.revision}${stderr ? `: ${stderr}` : ""}`
@@ -2808,127 +2901,153 @@ function checkout(checkouts, identity, pin) {
2808
2901
  verified2.add(key);
2809
2902
  return dir;
2810
2903
  }
2811
- function resolveRemotePackages(projectDir, resolved, products, provided) {
2812
- const result = { targets: [], unavailable: /* @__PURE__ */ new Map() };
2813
- const wanted = products.filter((entry) => !provided.has(entry.product));
2814
- if (wanted.length === 0) return result;
2815
- if (!resolved) {
2816
- for (const entry of wanted)
2817
- result.unavailable.set(entry.product, {
2818
- repositoryURL: entry.repositoryURL,
2819
- reason: "no Package.resolved pins it; resolve packages in Xcode once"
2820
- });
2821
- return result;
2822
- }
2823
- const pins = readPins(resolved);
2824
- const checkouts = import_node_path8.default.join(projectDir, REMOTE_CHECKOUTS);
2825
- import_node_fs7.default.mkdirSync(checkouts, { recursive: true });
2826
- import_node_fs7.default.writeFileSync(import_node_path8.default.join(import_node_path8.default.dirname(checkouts), ".gitignore"), "*\n");
2904
+ function resolveSwiftPackages(options) {
2905
+ const { rootDir, resolved, products, localDirs } = options;
2906
+ const provided = options.provided ?? /* @__PURE__ */ new Set();
2907
+ const result = {
2908
+ targets: [],
2909
+ unavailable: /* @__PURE__ */ new Map(),
2910
+ modules: /* @__PURE__ */ new Map()
2911
+ };
2912
+ const pins = resolved ? readPins(resolved) : null;
2913
+ const checkouts = import_node_path9.default.join(rootDir, REMOTE_CHECKOUTS);
2827
2914
  const packages = /* @__PURE__ */ new Map();
2828
- const load2 = (identity) => {
2829
- const cached = packages.get(identity);
2830
- if (cached) return cached;
2831
- const pin = pins.get(identity);
2832
- if (!pin) return null;
2833
- const dir = checkout(checkouts, identity, pin);
2834
- const manifest = import_node_fs7.default.readFileSync(import_node_path8.default.join(dir, "Package.swift"), "utf8");
2835
- const loaded2 = { dir, manifest, graph: swiftManifestGraph(manifest) };
2836
- packages.set(identity, loaded2);
2915
+ const load2 = (source) => {
2916
+ const key = source.kind === "local" ? import_node_path9.default.resolve(source.dir) : source.url;
2917
+ const cached = packages.get(key);
2918
+ if (cached !== void 0) return cached;
2919
+ let loaded2;
2920
+ if (source.kind === "local") {
2921
+ loaded2 = { source: key, remote: false, manifest: swiftPackageManifest(key) };
2922
+ } else {
2923
+ const identity = swiftPackageIdentity(source.url);
2924
+ const pin = pins?.get(identity);
2925
+ if (!pin) {
2926
+ loaded2 = pins ? `package ${identity} is not pinned in Package.resolved` : "no Package.resolved pins it; resolve packages in Xcode once";
2927
+ } else {
2928
+ import_node_fs8.default.mkdirSync(checkouts, { recursive: true });
2929
+ import_node_fs8.default.writeFileSync(import_node_path9.default.join(import_node_path9.default.dirname(checkouts), ".gitignore"), "*\n");
2930
+ loaded2 = {
2931
+ source: source.url,
2932
+ remote: true,
2933
+ manifest: swiftPackageManifest(checkout(checkouts, identity, pin))
2934
+ };
2935
+ }
2936
+ }
2937
+ packages.set(key, loaded2);
2837
2938
  return loaded2;
2838
2939
  };
2839
2940
  const targets = /* @__PURE__ */ new Map();
2840
- const outcomes = /* @__PURE__ */ new Map();
2841
- const resolveProduct = (identity, product) => {
2842
- const key = `${identity}\0${product}`;
2843
- if (outcomes.has(key)) return outcomes.get(key);
2844
- outcomes.set(key, null);
2845
- const pkg = load2(identity);
2846
- if (!pkg) {
2847
- outcomes.set(key, `package ${identity} is not pinned in Package.resolved`);
2848
- return outcomes.get(key);
2849
- }
2850
- const roots = pkg.graph.products.get(product);
2851
- if (!roots) {
2852
- outcomes.set(key, `package ${identity} has no library ${product}`);
2853
- return outcomes.get(key);
2854
- }
2855
- const declared = new Map(
2856
- swiftManifestTargets(pkg.manifest).map((target) => [target.name, target])
2857
- );
2858
- const reached = [];
2859
- const seen = /* @__PURE__ */ new Set();
2860
- const pending = [...roots];
2861
- let reason = null;
2862
- while (pending.length > 0 && !reason) {
2863
- const name = pending.pop();
2864
- if (seen.has(name) || provided.has(name)) continue;
2865
- seen.add(name);
2866
- if (pkg.graph.binaryTargets.has(name)) {
2867
- reason = `${name} is a binary framework`;
2868
- break;
2869
- }
2870
- if (pkg.graph.systemLibraries.has(name)) {
2871
- reason = `${name} is a system C library`;
2872
- break;
2873
- }
2874
- const target = declared.get(name);
2875
- if (!target) {
2876
- reason = `${identity} declares no target ${name}`;
2877
- break;
2878
- }
2879
- const files = walk(import_node_path8.default.join(pkg.dir, target.path));
2880
- if (files.some((file) => C_FAMILY.test(file))) {
2881
- reason = `${name} is a C or Objective-C target`;
2882
- break;
2883
- }
2884
- reached.push(target);
2885
- for (const dependency of pkg.graph.dependencies.get(name) ?? []) {
2886
- if (dependency.kind === "target") pending.push(dependency.name);
2887
- else if (!provided.has(dependency.name)) {
2888
- const url = pkg.graph.packageURLs.get(dependency.package);
2889
- const nested = resolveProduct(
2890
- url ? swiftPackageIdentity(url) : dependency.package,
2891
- dependency.name
2892
- );
2893
- if (nested) reason = `${dependency.name}: ${nested}`;
2941
+ const targetOutcomes = /* @__PURE__ */ new Map();
2942
+ const resolveTarget = (pkg, name) => {
2943
+ const key = `${pkg.manifest.dir}\0${name}`;
2944
+ if (targetOutcomes.has(key)) return targetOutcomes.get(key);
2945
+ targetOutcomes.set(key, null);
2946
+ const outcome = (() => {
2947
+ if (provided.has(name)) return null;
2948
+ const target = pkg.manifest.targets.get(name);
2949
+ if (!target) return `${import_node_path9.default.basename(pkg.manifest.dir)} declares no target ${name}`;
2950
+ if (target.type === "binary") return `${name} is a binary framework`;
2951
+ if (target.type === "system") return `${name} is a system C library`;
2952
+ if (target.type !== "regular") return `${name} is a ${target.type} target`;
2953
+ const files = swiftTargetFiles(pkg.manifest, target);
2954
+ if (files.some((file) => C_FAMILY.test(file)))
2955
+ return `${name} is a C or Objective-C target`;
2956
+ for (const dependency of target.dependencies) {
2957
+ if (dependency.kind === "target") {
2958
+ const nested2 = resolveTarget(pkg, dependency.name);
2959
+ if (nested2) return nested2;
2960
+ continue;
2894
2961
  }
2962
+ const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
2963
+ if (nested) return `${dependency.name}: ${nested}`;
2895
2964
  }
2896
- }
2897
- if (reason) {
2898
- outcomes.set(key, reason);
2899
- return reason;
2900
- }
2901
- const relative = reached.flatMap(
2902
- (target) => walk(import_node_path8.default.join(pkg.dir, target.path)).map(
2903
- (file) => import_node_path8.default.relative(pkg.dir, file).split(import_node_path8.default.sep).join(import_node_path8.default.posix.sep)
2904
- )
2905
- );
2906
- const withResources = new Map(
2907
- swiftManifestTargets(pkg.manifest, relative).map((target) => [target.name, target])
2908
- );
2909
- for (const target of reached) {
2910
- const dir = import_node_path8.default.join(pkg.dir, target.path);
2911
- targets.set(target.name, {
2912
- ...withResources.get(target.name) ?? target,
2965
+ const relative = files.map((file) => import_node_path9.default.relative(target.dir, file));
2966
+ targets.set(`${pkg.manifest.dir}\0${name}`, {
2967
+ name,
2968
+ path: "",
2969
+ dir: target.dir,
2970
+ files,
2971
+ packageDir: pkg.manifest.dir,
2972
+ remote: pkg.remote,
2913
2973
  executable: false,
2914
- dir,
2915
- files: walk(dir)
2974
+ languageMode: target.languageMode,
2975
+ mainActorIsolation: target.mainActorIsolation,
2976
+ resources: target.declaresResources || swiftImplicitResourcePaths(relative).length > 0
2916
2977
  });
2978
+ return null;
2979
+ })();
2980
+ targetOutcomes.set(key, outcome);
2981
+ return outcome;
2982
+ };
2983
+ const resolveProduct = (pkg, product) => {
2984
+ if (provided.has(product)) return null;
2985
+ const roots = pkg.manifest.products.get(product);
2986
+ if (!roots) return `${import_node_path9.default.basename(pkg.manifest.dir)} has no library ${product}`;
2987
+ for (const name of roots) {
2988
+ const reason = resolveTarget(pkg, name);
2989
+ if (reason) return reason;
2917
2990
  }
2918
2991
  return null;
2919
2992
  };
2920
- for (const entry of wanted) {
2921
- const reason = resolveProduct(
2922
- swiftPackageIdentity(entry.repositoryURL),
2923
- entry.product
2924
- );
2993
+ const resolveDependencyProduct = (pkg, packageName, product) => {
2994
+ if (provided.has(product)) return null;
2995
+ const dependency = pkg.manifest.packages.get(packageName);
2996
+ if (!dependency)
2997
+ return `${import_node_path9.default.basename(pkg.manifest.dir)} names no package ${packageName}`;
2998
+ if ("dir" in dependency) {
2999
+ const loaded3 = load2({ kind: "local", dir: dependency.dir });
3000
+ return typeof loaded3 === "string" ? loaded3 : resolveProduct(loaded3, product);
3001
+ }
3002
+ if (!options.provided) return null;
3003
+ const loaded2 = load2({ kind: "remote", url: dependency.url });
3004
+ return typeof loaded2 === "string" ? loaded2 : resolveProduct(loaded2, product);
3005
+ };
3006
+ const unnamed = () => localDirs.map((dir) => load2({ kind: "local", dir })).filter((pkg) => typeof pkg !== "string");
3007
+ for (const { product, source } of products) {
3008
+ if (provided.has(product)) continue;
3009
+ if (source.kind === "remote" && !options.provided) continue;
3010
+ const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : load2(source);
3011
+ const reason = pkg === void 0 ? "no package the workspace references vends it" : typeof pkg === "string" ? pkg : resolveProduct(pkg, product);
2925
3012
  if (reason)
2926
- result.unavailable.set(entry.product, {
2927
- repositoryURL: entry.repositoryURL,
3013
+ result.unavailable.set(product, {
3014
+ source: source.kind === "remote" ? source.url : typeof pkg === "object" ? pkg.source : source.kind === "local" ? source.dir : "the workspace",
2928
3015
  reason
2929
3016
  });
2930
3017
  }
2931
- result.targets = [...targets.values()];
3018
+ for (const pkg of packages.values()) {
3019
+ if (typeof pkg === "string") continue;
3020
+ for (const [name, target] of pkg.manifest.targets) {
3021
+ if (target.type === "test" || target.type === "plugin" || target.type === "macro")
3022
+ continue;
3023
+ if (target.type === "executable") continue;
3024
+ const reason = resolveTarget(pkg, name);
3025
+ if (reason && !result.modules.has(name))
3026
+ result.modules.set(name, { source: pkg.source, reason });
3027
+ }
3028
+ }
3029
+ const reached = /* @__PURE__ */ new Set();
3030
+ const reach = (pkg, name) => {
3031
+ const key = `${pkg.manifest.dir}\0${name}`;
3032
+ if (reached.has(key) || !targets.has(key)) return;
3033
+ reached.add(key);
3034
+ for (const dependency of pkg.manifest.targets.get(name)?.dependencies ?? []) {
3035
+ if (dependency.kind === "target") reach(pkg, dependency.name);
3036
+ else {
3037
+ const source = pkg.manifest.packages.get(dependency.package);
3038
+ const nested = source && ("dir" in source ? packages.get(import_node_path9.default.resolve(source.dir)) : packages.get(source.url));
3039
+ if (nested && typeof nested !== "string")
3040
+ for (const root of nested.manifest.products.get(dependency.name) ?? [])
3041
+ reach(nested, root);
3042
+ }
3043
+ }
3044
+ };
3045
+ for (const { product, source } of products) {
3046
+ const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ? import_node_path9.default.resolve(source.dir) : source.url);
3047
+ if (!pkg || typeof pkg === "string" || result.unavailable.has(product)) continue;
3048
+ for (const root of pkg.manifest.products.get(product) ?? []) reach(pkg, root);
3049
+ }
3050
+ result.targets = [...targets.entries()].filter(([key]) => reached.has(key)).map(([, target]) => target);
2932
3051
  return result;
2933
3052
  }
2934
3053
 
@@ -3069,26 +3188,361 @@ async function compileSwiftProject(submit, work, origin, signal) {
3069
3188
  }
3070
3189
 
3071
3190
  // src/xcode-project.ts
3072
- var import_node_fs8 = __toESM(require("node:fs"), 1);
3073
- var import_node_path9 = __toESM(require("node:path"), 1);
3191
+ var import_node_fs9 = __toESM(require("node:fs"), 1);
3192
+ var import_node_path11 = __toESM(require("node:path"), 1);
3074
3193
  var import_plist = __toESM(require_plist(), 1);
3075
- function parseOpenStepPlist(text) {
3194
+
3195
+ // src/xcode-json-project.ts
3196
+ var import_node_path10 = __toESM(require("node:path"), 1);
3197
+ var import_json5 = __toESM(require("json5"), 1);
3198
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3199
+ var text = (value) => typeof value === "string" ? value : void 0;
3200
+ var items = (value) => Array.isArray(value) ? value : [];
3201
+ var PHASE_ISA = {
3202
+ "compile-sources": "PBXSourcesBuildPhase",
3203
+ resources: "PBXResourcesBuildPhase",
3204
+ frameworks: "PBXFrameworksBuildPhase",
3205
+ headers: "PBXHeadersBuildPhase",
3206
+ copy: "PBXCopyFilesBuildPhase",
3207
+ script: "PBXShellScriptBuildPhase"
3208
+ };
3209
+ function readXcodeJsonProject(xcodeproj, source) {
3210
+ const json = import_json5.default.parse(source);
3211
+ if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
3212
+ const projectDir = import_node_path10.default.dirname(xcodeproj);
3213
+ const objects = {};
3214
+ let next = 0;
3215
+ const add = (entry, id) => {
3216
+ const key = id ?? `XCPROJ${(next++).toString(16).toUpperCase().padStart(18, "0")}`;
3217
+ objects[key] = entry;
3218
+ return key;
3219
+ };
3220
+ const locate = (raw2, groupDir) => {
3221
+ if (raw2.startsWith("<USER:")) return null;
3222
+ const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
3223
+ if (base) {
3224
+ if (base[1] === "PROJECT")
3225
+ return { sourceTree: "<absolute>", path: import_node_path10.default.join(projectDir, base[2]) };
3226
+ if (base[1] === "PRODUCTS")
3227
+ return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
3228
+ return null;
3229
+ }
3230
+ const unescaped = raw2.replaceAll("\\<", "<");
3231
+ if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
3232
+ if (unescaped.startsWith("~")) return null;
3233
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path10.default.join(groupDir, unescaped) };
3234
+ };
3235
+ const memberships = [];
3236
+ const folders = [];
3237
+ const projectFiles = [];
3238
+ const root = { id: "", name: "", dir: projectDir, parent: null, children: [] };
3239
+ const walk2 = (entries, parent) => entries.flatMap((entry) => {
3240
+ if (!isObject(entry)) return [];
3241
+ const kind = text(entry.kind) ?? "file-reference";
3242
+ const raw2 = text(entry.path) ?? "";
3243
+ const located = raw2 === "" ? null : locate(raw2, parent.dir);
3244
+ const name = text(entry.name) ?? import_node_path10.default.basename(raw2);
3245
+ const node = { id: "", name, dir: null, parent, children: [] };
3246
+ if (kind === "group" || kind === "variant-group" || kind === "version-group") {
3247
+ node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
3248
+ const childIds = walk2(items(entry.children), node);
3249
+ node.id = add(
3250
+ kind === "version-group" && located ? {
3251
+ isa: "PBXFileReference",
3252
+ ...located,
3253
+ lastKnownFileType: "wrapper.xcdatamodel"
3254
+ } : {
3255
+ isa: kind === "variant-group" ? "PBXVariantGroup" : "PBXGroup",
3256
+ children: childIds,
3257
+ ...kind === "variant-group" ? {} : { sourceTree: "<absolute>", path: node.dir ?? "" },
3258
+ name
3259
+ },
3260
+ text(entry.id)
3261
+ );
3262
+ } else if (kind === "folder") {
3263
+ node.id = add(
3264
+ {
3265
+ isa: "PBXFileSystemSynchronizedRootGroup",
3266
+ ...located ?? { sourceTree: "SDKROOT", path: raw2 }
3267
+ },
3268
+ text(entry.id)
3269
+ );
3270
+ folders.push({ id: node.id, folder: entry });
3271
+ } else {
3272
+ node.id = add(
3273
+ {
3274
+ isa: "PBXFileReference",
3275
+ ...located ?? { sourceTree: "SDKROOT", path: raw2 },
3276
+ name
3277
+ },
3278
+ text(entry.id)
3279
+ );
3280
+ if (located?.sourceTree === "<absolute>" && located.path.endsWith(".xcodeproj"))
3281
+ projectFiles.push(node.id);
3282
+ }
3283
+ parent.children.push(node);
3284
+ for (const membership of items(entry["target-membership"])) {
3285
+ if (kind !== "folder") memberships.push({ refId: node.id, entry: membership });
3286
+ }
3287
+ return [node.id];
3288
+ });
3289
+ const mainGroupChildren = walk2(items(json.files), root);
3290
+ const mainGroup = add({
3291
+ isa: "PBXGroup",
3292
+ children: mainGroupChildren,
3293
+ sourceTree: "<absolute>",
3294
+ path: projectDir
3295
+ });
3296
+ root.id = mainGroup;
3297
+ const lookup = (reference, from = root) => {
3298
+ if (isObject(reference)) {
3299
+ const anchor = lookupNode(reference.anchor, root);
3300
+ return anchor ? lookup(reference["relative-path"], anchor) : void 0;
3301
+ }
3302
+ if (Array.isArray(reference)) {
3303
+ return lookupNode(
3304
+ reference.map(
3305
+ (component) => isObject(component) ? text(component.name) ?? "" : text(component) ?? ""
3306
+ ).join("/"),
3307
+ from
3308
+ )?.id;
3309
+ }
3310
+ return lookupNode(reference, from)?.id;
3311
+ };
3312
+ const lookupNode = (reference, from) => {
3313
+ const value = text(reference);
3314
+ if (value === void 0) return void 0;
3315
+ if (value.startsWith("id:")) {
3316
+ const id = value.slice(3);
3317
+ const find = (node2) => node2.id === id ? node2 : node2.children.map(find).find(Boolean);
3318
+ return find(root);
3319
+ }
3320
+ let node = from;
3321
+ for (const component of value.split("/")) {
3322
+ if (!node) return void 0;
3323
+ node = component === "." ? node : component === ".." ? node.parent ?? void 0 : node.children.find((child) => child.name === component);
3324
+ }
3325
+ return node;
3326
+ };
3327
+ const configurations = items(json.configurations).flatMap((entry) => {
3328
+ const name = isObject(entry) ? text(entry.name) : text(entry);
3329
+ return name ? [{ name, file: isObject(entry) ? entry.file : void 0 }] : [];
3330
+ });
3331
+ const settingsOf = (value) => Object.fromEntries(
3332
+ Object.entries(isObject(value) ? value : {}).flatMap(
3333
+ ([key, setting]) => typeof setting === "string" ? [[key, setting]] : Array.isArray(setting) ? [
3334
+ [
3335
+ key,
3336
+ setting.filter((item) => typeof item === "string")
3337
+ ]
3338
+ ] : []
3339
+ )
3340
+ );
3341
+ const configurationList = (settings, specialized) => add({
3342
+ isa: "XCConfigurationList",
3343
+ defaultConfigurationName: text(json["default-configuration"]) ?? "Debug",
3344
+ buildConfigurations: configurations.map(({ name, file }) => {
3345
+ const base = lookup(specialized.has(name) ? specialized.get(name) : file);
3346
+ return add({
3347
+ isa: "XCBuildConfiguration",
3348
+ name,
3349
+ buildSettings: settings,
3350
+ ...base ? { baseConfigurationReference: base } : {}
3351
+ });
3352
+ })
3353
+ });
3354
+ const packageIds = /* @__PURE__ */ new Map();
3355
+ for (const entry of items(json.packages)) {
3356
+ if (!isObject(entry)) continue;
3357
+ const repository = text(entry.repository);
3358
+ const local = text(entry.path);
3359
+ const name = local !== void 0 ? import_node_path10.default.basename(import_node_path10.default.resolve(import_node_path10.default.dirname(xcodeproj), local)) : import_node_path10.default.basename(repository ?? "").replace(/\.git$/, "");
3360
+ const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
3361
+ packageIds.set(name.toLowerCase(), id);
3362
+ }
3363
+ const productDependency = (entry) => add({
3364
+ isa: "XCSwiftPackageProductDependency",
3365
+ productName: text(entry["product-name"]) ?? "",
3366
+ // xcode finds a product by name across packages when none is named
3367
+ ...packageIds.has(text(entry.package)?.toLowerCase() ?? "") ? { package: packageIds.get(text(entry.package).toLowerCase()) } : {}
3368
+ });
3369
+ const proxy = (entry, remote, proxyType) => add({
3370
+ isa: "PBXContainerItemProxy",
3371
+ containerPortal: lookup(entry.project) ?? "",
3372
+ proxyType,
3373
+ remoteGlobalIDString: remote ?? "",
3374
+ remoteInfo: text(entry.target) ?? ""
3375
+ });
3376
+ const phases = /* @__PURE__ */ new Map();
3377
+ const targetIds = /* @__PURE__ */ new Map();
3378
+ const targets = [];
3379
+ for (const entry of items(json.targets)) {
3380
+ if (!isObject(entry)) continue;
3381
+ const name = text(entry.name) ?? "";
3382
+ const productType = text(entry["product-type"]);
3383
+ const target = {
3384
+ isa: text(entry.kind) === "aggregate" ? "PBXAggregateTarget" : "PBXNativeTarget",
3385
+ name,
3386
+ productName: name,
3387
+ productType: productType ? `com.apple.product-type.${productType}` : text(entry["full-product-type"]) ?? "",
3388
+ buildPhases: [],
3389
+ dependencies: [],
3390
+ packageProductDependencies: [],
3391
+ fileSystemSynchronizedGroups: []
3392
+ };
3393
+ const product = lookup(entry.product);
3394
+ if (product) target.productReference = product;
3395
+ const id = add(target, text(entry.id));
3396
+ targetIds.set(name, id);
3397
+ targets.push({ id, target, entry });
3398
+ for (const phase of items(entry["build-phases"])) {
3399
+ const kind = isObject(phase) ? text(phase.kind) : text(phase);
3400
+ const isa = kind ? PHASE_ISA[kind] : void 0;
3401
+ if (!kind || !isa) continue;
3402
+ const phaseName = isObject(phase) ? text(phase.name) : void 0;
3403
+ const phaseId = add(
3404
+ { isa, files: [] },
3405
+ isObject(phase) ? text(phase.id) : void 0
3406
+ );
3407
+ target.buildPhases.push(phaseId);
3408
+ phases.set([name, kind, phaseName].filter(Boolean).join("/"), phaseId);
3409
+ phases.set(`id:${phaseId}`, phaseId);
3410
+ }
3411
+ }
3412
+ const phaseFiles = (reference, targetName) => {
3413
+ const value = text(reference);
3414
+ if (value === void 0) return null;
3415
+ const key = value.startsWith("id:") || !targetName ? value : `${targetName}/${value}`;
3416
+ const phase = objects[phases.get(key) ?? ""];
3417
+ return phase && typeof phase === "object" && !Array.isArray(phase) && Array.isArray(phase.files) ? phase.files : null;
3418
+ };
3419
+ for (const { refId, entry } of memberships) {
3420
+ const files = phaseFiles(isObject(entry) ? entry["build-phase"] : entry);
3421
+ files?.push(add({ isa: "PBXBuildFile", fileRef: refId }));
3422
+ }
3423
+ for (const { target, entry } of targets) {
3424
+ const name = text(entry.name) ?? "";
3425
+ target.buildConfigurationList = configurationList(
3426
+ settingsOf(entry["build-settings"]),
3427
+ new Map(
3428
+ items(entry["specialized-configurations"]).flatMap(
3429
+ (configuration) => isObject(configuration) && text(configuration.name) ? [[text(configuration.name), configuration.file]] : []
3430
+ )
3431
+ )
3432
+ );
3433
+ for (const dependency of items(entry.dependencies)) {
3434
+ const kind = isObject(dependency) ? text(dependency.kind) ?? "localTarget" : "localTarget";
3435
+ if (kind === "package" && isObject(dependency)) {
3436
+ ;
3437
+ target.dependencies.push(
3438
+ add({ isa: "PBXTargetDependency", productRef: productDependency(dependency) })
3439
+ );
3440
+ } else if (kind === "remoteTarget" && isObject(dependency)) {
3441
+ ;
3442
+ target.dependencies.push(
3443
+ add({
3444
+ isa: "PBXTargetDependency",
3445
+ targetProxy: proxy(dependency, text(dependency["target-id"]), "1")
3446
+ })
3447
+ );
3448
+ } else {
3449
+ const local = isObject(dependency) ? text(dependency.target) : text(dependency);
3450
+ const id = local ? targetIds.get(local) : void 0;
3451
+ if (id)
3452
+ target.dependencies.push(
3453
+ add({ isa: "PBXTargetDependency", target: id })
3454
+ );
3455
+ }
3456
+ }
3457
+ for (const member of items(entry["package-product-members"])) {
3458
+ if (!isObject(member)) continue;
3459
+ const dependency = productDependency(member);
3460
+ target.packageProductDependencies.push(dependency);
3461
+ const buildFile = member["build-phase"];
3462
+ phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name)?.push(
3463
+ add({ isa: "PBXBuildFile", productRef: dependency })
3464
+ );
3465
+ }
3466
+ }
3467
+ for (const imported of items(json["imported-products"])) {
3468
+ if (!isObject(imported)) continue;
3469
+ const reference = add({
3470
+ isa: "PBXReferenceProxy",
3471
+ path: text(imported.name) ?? text(imported.path) ?? "",
3472
+ sourceTree: "BUILT_PRODUCTS_DIR",
3473
+ remoteRef: proxy(imported, text(imported["product-id"]), "2")
3474
+ });
3475
+ for (const membership of items(imported["target-membership"])) {
3476
+ phaseFiles(isObject(membership) ? membership["build-phase"] : membership)?.push(
3477
+ add({ isa: "PBXBuildFile", fileRef: reference })
3478
+ );
3479
+ }
3480
+ }
3481
+ for (const { id, folder } of folders) {
3482
+ const exceptions = [];
3483
+ for (const exception of items(folder["membership-exceptions"])) {
3484
+ if (!isObject(exception)) continue;
3485
+ const target = targetIds.get(text(exception.target) ?? "");
3486
+ if (!target) continue;
3487
+ exceptions.push(
3488
+ add({
3489
+ isa: "PBXFileSystemSynchronizedBuildFileExceptionSet",
3490
+ target,
3491
+ membershipExceptions: [
3492
+ ...items(exception.exclusions),
3493
+ ...items(exception.inclusions)
3494
+ ].flatMap((member) => typeof member === "string" ? [member] : [])
3495
+ })
3496
+ );
3497
+ }
3498
+ const group = objects[id];
3499
+ if (group && typeof group === "object" && !Array.isArray(group))
3500
+ group.exceptions = exceptions;
3501
+ for (const owner of items(folder["target-membership"])) {
3502
+ const target = targets.find(
3503
+ (candidate) => candidate.id === targetIds.get(text(owner) ?? "")
3504
+ );
3505
+ target?.target.fileSystemSynchronizedGroups?.push(id);
3506
+ }
3507
+ }
3508
+ const localizations = isObject(json.localizations) ? json.localizations : {};
3509
+ const project = add({
3510
+ isa: "PBXProject",
3511
+ mainGroup,
3512
+ projectDirPath: "",
3513
+ developmentRegion: text(localizations.development) ?? "en",
3514
+ buildConfigurationList: configurationList(
3515
+ settingsOf(json["build-settings"]),
3516
+ /* @__PURE__ */ new Map()
3517
+ ),
3518
+ targets: targets.map((entry) => entry.id),
3519
+ packageReferences: [...packageIds.values()],
3520
+ projectReferences: projectFiles.map((ProjectRef) => ({ ProjectRef }))
3521
+ });
3522
+ return { objects, rootObject: project };
3523
+ }
3524
+ function isJsonObject(value) {
3525
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3526
+ }
3527
+
3528
+ // src/xcode-project.ts
3529
+ function parseOpenStepPlist(text2) {
3076
3530
  let i = 0;
3077
3531
  const fail = (message) => {
3078
- const line = text.slice(0, i).split("\n").length;
3532
+ const line = text2.slice(0, i).split("\n").length;
3079
3533
  throw new Error(`project.pbxproj line ${line}: ${message}`);
3080
3534
  };
3081
3535
  const skip = () => {
3082
3536
  for (; ; ) {
3083
- const ch = text[i];
3537
+ const ch = text2[i];
3084
3538
  if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
3085
- else if (ch === "/" && text[i + 1] === "*") {
3086
- const end = text.indexOf("*/", i + 2);
3539
+ else if (ch === "/" && text2[i + 1] === "*") {
3540
+ const end = text2.indexOf("*/", i + 2);
3087
3541
  if (end < 0) fail("unterminated comment");
3088
3542
  i = end + 2;
3089
- } else if (ch === "/" && text[i + 1] === "/") {
3090
- const end = text.indexOf("\n", i);
3091
- i = end < 0 ? text.length : end + 1;
3543
+ } else if (ch === "/" && text2[i + 1] === "/") {
3544
+ const end = text2.indexOf("\n", i);
3545
+ i = end < 0 ? text2.length : end + 1;
3092
3546
  } else return;
3093
3547
  }
3094
3548
  };
@@ -3096,42 +3550,42 @@ function parseOpenStepPlist(text) {
3096
3550
  i++;
3097
3551
  let out = "";
3098
3552
  for (; ; ) {
3099
- const ch = text[i++];
3553
+ const ch = text2[i++];
3100
3554
  if (ch === void 0) fail("unterminated string");
3101
3555
  if (ch === '"') return out;
3102
3556
  if (ch !== "\\") {
3103
3557
  out += ch;
3104
3558
  continue;
3105
3559
  }
3106
- const next = text[i++];
3560
+ const next = text2[i++];
3107
3561
  if (next === "n") out += "\n";
3108
3562
  else if (next === "t") out += " ";
3109
3563
  else if (next === "r") out += "\r";
3110
3564
  else if (next === "U") {
3111
- out += String.fromCharCode(parseInt(text.slice(i, i + 4), 16));
3565
+ out += String.fromCharCode(parseInt(text2.slice(i, i + 4), 16));
3112
3566
  i += 4;
3113
3567
  } else out += next;
3114
3568
  }
3115
3569
  };
3116
3570
  const value = () => {
3117
3571
  skip();
3118
- const ch = text[i];
3572
+ const ch = text2[i];
3119
3573
  if (ch === "{") {
3120
3574
  i++;
3121
3575
  const dict = {};
3122
3576
  for (; ; ) {
3123
3577
  skip();
3124
- if (text[i] === "}") {
3578
+ if (text2[i] === "}") {
3125
3579
  i++;
3126
3580
  return dict;
3127
3581
  }
3128
3582
  const key = value();
3129
3583
  if (typeof key !== "string") fail("dictionary key is not a string");
3130
3584
  skip();
3131
- if (text[i++] !== "=") fail("expected =");
3585
+ if (text2[i++] !== "=") fail("expected =");
3132
3586
  dict[key] = value();
3133
3587
  skip();
3134
- if (text[i++] !== ";") fail("expected ;");
3588
+ if (text2[i++] !== ";") fail("expected ;");
3135
3589
  }
3136
3590
  }
3137
3591
  if (ch === "(") {
@@ -3139,26 +3593,26 @@ function parseOpenStepPlist(text) {
3139
3593
  const list2 = [];
3140
3594
  for (; ; ) {
3141
3595
  skip();
3142
- if (text[i] === ")") {
3596
+ if (text2[i] === ")") {
3143
3597
  i++;
3144
3598
  return list2;
3145
3599
  }
3146
3600
  list2.push(value());
3147
3601
  skip();
3148
- if (text[i] === ",") i++;
3149
- else if (text[i] !== ")") fail("expected , or )");
3602
+ if (text2[i] === ",") i++;
3603
+ else if (text2[i] !== ")") fail("expected , or )");
3150
3604
  }
3151
3605
  }
3152
3606
  if (ch === '"') return quoted();
3153
3607
  const start = i;
3154
- while (i < text.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text[i])) i++;
3608
+ while (i < text2.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text2[i])) i++;
3155
3609
  if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
3156
- return text.slice(start, i);
3610
+ return text2.slice(start, i);
3157
3611
  };
3158
- if (text.startsWith("// !$*UTF8*$!")) i = text.indexOf("\n") + 1;
3612
+ if (text2.startsWith("// !$*UTF8*$!")) i = text2.indexOf("\n") + 1;
3159
3613
  const root = value();
3160
3614
  skip();
3161
- if (i !== text.length) fail("trailing content");
3615
+ if (i !== text2.length) fail("trailing content");
3162
3616
  return root;
3163
3617
  }
3164
3618
  var isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -3179,28 +3633,28 @@ var CONDITIONS = {
3179
3633
  variant: "normal"
3180
3634
  };
3181
3635
  function walkFiles(dir) {
3182
- if (!import_node_fs8.default.existsSync(dir)) return [];
3636
+ if (!import_node_fs9.default.existsSync(dir)) return [];
3183
3637
  const out = [];
3184
- for (const entry of import_node_fs8.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
3638
+ for (const entry of import_node_fs9.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
3185
3639
  if (entry.name.startsWith(".")) continue;
3186
- const full = import_node_path9.default.join(dir, entry.name);
3640
+ const full = import_node_path11.default.join(dir, entry.name);
3187
3641
  if (entry.isDirectory()) out.push(...walkFiles(full));
3188
3642
  else if (entry.isFile()) out.push(full);
3189
3643
  }
3190
3644
  return out;
3191
3645
  }
3192
- var isDirectory = (dir) => import_node_fs8.default.existsSync(dir) && import_node_fs8.default.statSync(dir).isDirectory();
3646
+ var isDirectory = (dir) => import_node_fs9.default.existsSync(dir) && import_node_fs9.default.statSync(dir).isDirectory();
3193
3647
  function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
3194
- if (seen.has(file) || !import_node_fs8.default.existsSync(file)) return {};
3648
+ if (seen.has(file) || !import_node_fs9.default.existsSync(file)) return {};
3195
3649
  seen.add(file);
3196
3650
  const settings = {};
3197
- for (const raw2 of import_node_fs8.default.readFileSync(file, "utf8").split("\n")) {
3651
+ for (const raw2 of import_node_fs9.default.readFileSync(file, "utf8").split("\n")) {
3198
3652
  const line = raw2.replace(/\/\/.*$/, "").trim();
3199
3653
  const include = /^#include\??\s+"([^"]+)"/.exec(line);
3200
3654
  if (include) {
3201
3655
  Object.assign(
3202
3656
  settings,
3203
- readXcconfig(import_node_path9.default.resolve(import_node_path9.default.dirname(file), include[1]), seen)
3657
+ readXcconfig(import_node_path11.default.resolve(import_node_path11.default.dirname(file), include[1]), seen)
3204
3658
  );
3205
3659
  continue;
3206
3660
  }
@@ -3246,26 +3700,26 @@ function applyOperator(value, operator) {
3246
3700
  }
3247
3701
  throw new Error(`unsupported build setting operator :${operator}`);
3248
3702
  }
3249
- function decodeXml(text) {
3250
- return text.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
3703
+ function decodeXml(text2) {
3704
+ return text2.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
3251
3705
  }
3252
3706
  function workspaceReferences(workspace) {
3253
- const data = import_node_path9.default.join(workspace, "contents.xcworkspacedata");
3254
- if (!import_node_fs8.default.existsSync(data))
3707
+ const data = import_node_path11.default.join(workspace, "contents.xcworkspacedata");
3708
+ if (!import_node_fs9.default.existsSync(data))
3255
3709
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
3256
- const container = import_node_path9.default.dirname(workspace);
3710
+ const container = import_node_path11.default.dirname(workspace);
3257
3711
  const locate = (location, base) => {
3258
3712
  const colon = location.indexOf(":");
3259
3713
  const kind = location.slice(0, colon);
3260
3714
  const rest = location.slice(colon + 1);
3261
- if (kind === "group") return import_node_path9.default.resolve(base, rest);
3262
- if (kind === "container" || kind === "self") return import_node_path9.default.resolve(container, rest);
3263
- if (kind === "absolute") return import_node_path9.default.resolve(rest);
3264
- throw new Error(`${import_node_path9.default.basename(workspace)} has an unsupported location ${location}`);
3715
+ if (kind === "group") return import_node_path11.default.resolve(base, rest);
3716
+ if (kind === "container" || kind === "self") return import_node_path11.default.resolve(container, rest);
3717
+ if (kind === "absolute") return import_node_path11.default.resolve(rest);
3718
+ throw new Error(`${import_node_path11.default.basename(workspace)} has an unsupported location ${location}`);
3265
3719
  };
3266
3720
  const groups = [container];
3267
3721
  const references = [];
3268
- for (const [, closing, tag, attributes, selfClosing] of import_node_fs8.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
3722
+ for (const [, closing, tag, attributes, selfClosing] of import_node_fs9.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
3269
3723
  if (closing) {
3270
3724
  if (tag === "Group") groups.pop();
3271
3725
  continue;
@@ -3279,15 +3733,24 @@ function workspaceReferences(workspace) {
3279
3733
  return references;
3280
3734
  }
3281
3735
  var loaded = /* @__PURE__ */ new Map();
3736
+ function xcodeProjectFile(xcodeproj) {
3737
+ for (const name of ["project.pbxproj", "project.xcproj"]) {
3738
+ const file = import_node_path11.default.join(xcodeproj, name);
3739
+ if (import_node_fs9.default.existsSync(file)) return file;
3740
+ }
3741
+ return null;
3742
+ }
3282
3743
  function loadProject(xcodeproj) {
3283
- const pbxproj = import_node_path9.default.join(xcodeproj, "project.pbxproj");
3284
- if (!import_node_fs8.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
3285
- const mtimeMs = import_node_fs8.default.statSync(pbxproj).mtimeMs;
3286
- const cached = loaded.get(pbxproj);
3744
+ const projectFile = xcodeProjectFile(xcodeproj);
3745
+ if (!projectFile)
3746
+ throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
3747
+ const mtimeMs = import_node_fs9.default.statSync(projectFile).mtimeMs;
3748
+ const cached = loaded.get(projectFile);
3287
3749
  if (cached?.mtimeMs === mtimeMs) return cached.project;
3288
- const root = parseOpenStepPlist(import_node_fs8.default.readFileSync(pbxproj, "utf8"));
3750
+ const source = import_node_fs9.default.readFileSync(projectFile, "utf8");
3751
+ const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
3289
3752
  if (!isDict(root) || !isDict(root.objects)) {
3290
- throw new Error(`${pbxproj} has no objects table`);
3753
+ throw new Error(`${projectFile} has no objects table`);
3291
3754
  }
3292
3755
  const objects = root.objects;
3293
3756
  const object = (id) => {
@@ -3296,10 +3759,10 @@ function loadProject(xcodeproj) {
3296
3759
  };
3297
3760
  const project = object(str(root.rootObject));
3298
3761
  if (!project || project.isa !== "PBXProject") {
3299
- throw new Error(`${pbxproj} has no PBXProject root`);
3762
+ throw new Error(`${projectFile} has no PBXProject root`);
3300
3763
  }
3301
- const projectDir = import_node_fs8.default.realpathSync(
3302
- import_node_path9.default.resolve(import_node_path9.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
3764
+ const projectDir = import_node_fs9.default.realpathSync(
3765
+ import_node_path11.default.resolve(import_node_path11.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
3303
3766
  );
3304
3767
  const parent = /* @__PURE__ */ new Map();
3305
3768
  for (const [id, entry] of Object.entries(objects)) {
@@ -3317,18 +3780,26 @@ function loadProject(xcodeproj) {
3317
3780
  const own = str(entry.path) ?? "";
3318
3781
  const tree = str(entry.sourceTree) ?? "<group>";
3319
3782
  if (tree === "<absolute>") result2 = own;
3320
- else if (tree === "SOURCE_ROOT") result2 = import_node_path9.default.join(projectDir, own);
3783
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path11.default.join(projectDir, own);
3321
3784
  else if (tree === "<group>") {
3322
3785
  const up = parent.get(id);
3323
3786
  const base = up ? resolvePath(up) : projectDir;
3324
- result2 = base === null ? null : import_node_path9.default.join(base, own);
3787
+ result2 = base === null ? null : import_node_path11.default.join(base, own);
3325
3788
  }
3326
3789
  }
3327
3790
  resolvedPaths.set(id, result2);
3328
3791
  return result2;
3329
3792
  };
3330
- const result = { xcodeproj, pbxproj, objects, project, projectDir, object, resolvePath };
3331
- loaded.set(pbxproj, { mtimeMs, project: result });
3793
+ const result = {
3794
+ xcodeproj,
3795
+ projectFile,
3796
+ objects,
3797
+ project,
3798
+ projectDir,
3799
+ object,
3800
+ resolvePath
3801
+ };
3802
+ loaded.set(projectFile, { mtimeMs, project: result });
3332
3803
  return result;
3333
3804
  }
3334
3805
  function targetSettings(ref, builtins) {
@@ -3413,7 +3884,7 @@ function targetMembers(ref) {
3413
3884
  const addResource = (file) => {
3414
3885
  if (isDirectory(file)) {
3415
3886
  for (const inner of walkFiles(file)) resources.add(inner);
3416
- } else if (import_node_fs8.default.existsSync(file)) resources.add(file);
3887
+ } else if (import_node_fs9.default.existsSync(file)) resources.add(file);
3417
3888
  };
3418
3889
  const fileRefPaths = (refId) => {
3419
3890
  const entry = project.object(refId);
@@ -3434,7 +3905,7 @@ function targetMembers(ref) {
3434
3905
  for (const buildFileId of list(phase.files)) {
3435
3906
  for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
3436
3907
  if (phase.isa === "PBXSourcesBuildPhase") {
3437
- if (!import_node_fs8.default.existsSync(file)) continue;
3908
+ if (!import_node_fs9.default.existsSync(file)) continue;
3438
3909
  allSources.add(file);
3439
3910
  if (file.endsWith(".swift")) sources.add(file);
3440
3911
  } else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
@@ -3442,7 +3913,7 @@ function targetMembers(ref) {
3442
3913
  }
3443
3914
  }
3444
3915
  const addSynchronized = (folder, relative) => {
3445
- const file = import_node_path9.default.join(folder, relative);
3916
+ const file = import_node_path11.default.join(folder, relative);
3446
3917
  if (NEVER_MEMBER.test(relative)) return;
3447
3918
  if (file.endsWith(".swift")) {
3448
3919
  if (!relative.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
@@ -3467,7 +3938,7 @@ function targetMembers(ref) {
3467
3938
  }
3468
3939
  if (owned.has(groupId)) {
3469
3940
  for (const file of walkFiles(folder)) {
3470
- const relative = import_node_path9.default.relative(folder, file).split(import_node_path9.default.sep).join("/");
3941
+ const relative = import_node_path11.default.relative(folder, file).split(import_node_path11.default.sep).join("/");
3471
3942
  if ([...exceptions].some(
3472
3943
  (exception) => relative === exception || relative.startsWith(`${exception}/`)
3473
3944
  ))
@@ -3476,14 +3947,14 @@ function targetMembers(ref) {
3476
3947
  }
3477
3948
  } else {
3478
3949
  for (const relative of exceptions) {
3479
- const file = import_node_path9.default.join(folder, relative);
3950
+ const file = import_node_path11.default.join(folder, relative);
3480
3951
  if (isDirectory(file)) {
3481
3952
  for (const inner of walkFiles(file))
3482
3953
  addSynchronized(
3483
3954
  folder,
3484
- import_node_path9.default.relative(folder, inner).split(import_node_path9.default.sep).join("/")
3955
+ import_node_path11.default.relative(folder, inner).split(import_node_path11.default.sep).join("/")
3485
3956
  );
3486
- } else if (import_node_fs8.default.existsSync(file)) addSynchronized(folder, relative);
3957
+ } else if (import_node_fs9.default.existsSync(file)) addSynchronized(folder, relative);
3487
3958
  }
3488
3959
  }
3489
3960
  }
@@ -3496,8 +3967,8 @@ function targetMembers(ref) {
3496
3967
  function commonAncestor(dirs) {
3497
3968
  let common = dirs[0];
3498
3969
  for (const dir of dirs) {
3499
- while (common !== import_node_path9.default.dirname(common) && import_node_path9.default.relative(common, dir).startsWith(".."))
3500
- common = import_node_path9.default.dirname(common);
3970
+ while (common !== import_node_path11.default.dirname(common) && import_node_path11.default.relative(common, dir).startsWith(".."))
3971
+ common = import_node_path11.default.dirname(common);
3501
3972
  }
3502
3973
  return common;
3503
3974
  }
@@ -3506,9 +3977,9 @@ function workspaceProjects(xcodeprojOrWorkspace) {
3506
3977
  const projects2 = [];
3507
3978
  const projectAt = /* @__PURE__ */ new Map();
3508
3979
  const addProject = (xcodeproj) => {
3509
- const key = import_node_path9.default.resolve(xcodeproj);
3510
- if (projectAt.has(key) || key.split(import_node_path9.default.sep).includes("Pods")) return;
3511
- if (!import_node_fs8.default.existsSync(import_node_path9.default.join(key, "project.pbxproj"))) return;
3980
+ const key = import_node_path11.default.resolve(xcodeproj);
3981
+ if (projectAt.has(key) || key.split(import_node_path11.default.sep).includes("Pods")) return;
3982
+ if (!xcodeProjectFile(key)) return;
3512
3983
  const project = loadProject(key);
3513
3984
  projectAt.set(key, project);
3514
3985
  projects2.push(project);
@@ -3524,21 +3995,29 @@ function workspaceProjects(xcodeprojOrWorkspace) {
3524
3995
  for (const reference of listed)
3525
3996
  if (reference.endsWith(".xcodeproj")) addProject(reference);
3526
3997
  if (projects2.length === 0) {
3527
- throw new Error(`${import_node_path9.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
3998
+ throw new Error(`${import_node_path11.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
3528
3999
  }
3529
4000
  return { listed, projects: projects2, projectAt };
3530
4001
  }
3531
- var nativeTargets = (project) => list(project.project.targets).flatMap((id) => {
3532
- const target = project.object(id);
3533
- return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
3534
- });
4002
+ var targetRefs = /* @__PURE__ */ new WeakMap();
4003
+ function nativeTargets(project) {
4004
+ let refs = targetRefs.get(project);
4005
+ if (!refs) {
4006
+ refs = list(project.project.targets).flatMap((id) => {
4007
+ const target = project.object(id);
4008
+ return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
4009
+ });
4010
+ targetRefs.set(project, refs);
4011
+ }
4012
+ return refs;
4013
+ }
3535
4014
  function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
3536
4015
  const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
3537
4016
  const { listed, projects: projects2, projectAt } = workspaceProjects(xcodeprojOrWorkspace);
3538
4017
  const allTargets = projects2.flatMap(nativeTargets);
3539
4018
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
3540
4019
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
3541
- const container = import_node_path9.default.basename(xcodeprojOrWorkspace);
4020
+ const container = import_node_path11.default.basename(xcodeprojOrWorkspace);
3542
4021
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
3543
4022
  if (named.length !== 1) {
3544
4023
  throw new Error(
@@ -3550,14 +4029,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
3550
4029
  for (const ref of allTargets) {
3551
4030
  const product = ref.project.object(str(ref.target.productReference));
3552
4031
  const file = str(product?.path);
3553
- if (file && !byProduct.has(import_node_path9.default.basename(file)))
3554
- byProduct.set(import_node_path9.default.basename(file), ref);
4032
+ if (file && !byProduct.has(import_node_path11.default.basename(file)))
4033
+ byProduct.set(import_node_path11.default.basename(file), ref);
3555
4034
  }
3556
4035
  const proxied = (project, proxyId) => {
3557
4036
  const proxy = project.object(proxyId);
3558
4037
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
3559
4038
  const portal = str(proxy.containerPortal);
3560
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path9.default.resolve(project.resolvePath(portal ?? "") ?? ""));
4039
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path11.default.resolve(project.resolvePath(portal ?? "") ?? ""));
3561
4040
  const remote = str(proxy.remoteGlobalIDString);
3562
4041
  if (!owner || !remote) return void 0;
3563
4042
  return nativeTargets(owner).find(
@@ -3578,7 +4057,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
3578
4057
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
3579
4058
  for (const buildFileId of list(phase.files)) {
3580
4059
  const file = project.object(str(project.object(buildFileId)?.fileRef));
3581
- const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path9.default.basename(str(file.path) ?? "")) : void 0;
4060
+ const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path11.default.basename(str(file.path) ?? "")) : void 0;
3582
4061
  if (resolved) found.push(resolved);
3583
4062
  }
3584
4063
  }
@@ -3599,7 +4078,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
3599
4078
  const name = str(ref.target.name) ?? ref.id;
3600
4079
  const { get: settings2, keys } = targetSettings(ref, {
3601
4080
  TARGET_NAME: name,
3602
- PROJECT_NAME: import_node_path9.default.basename(ref.project.xcodeproj, ".xcodeproj"),
4081
+ PROJECT_NAME: import_node_path11.default.basename(ref.project.xcodeproj, ".xcodeproj"),
3603
4082
  SRCROOT: ref.project.projectDir,
3604
4083
  SOURCE_ROOT: ref.project.projectDir,
3605
4084
  PROJECT_DIR: ref.project.projectDir,
@@ -3630,8 +4109,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
3630
4109
  }
3631
4110
  return value;
3632
4111
  };
3633
- const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path9.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
3634
- const sourceInfo = infoPlistFile ? import_plist.default.parse(import_node_fs8.default.readFileSync(infoPlistFile, "utf8")) : {};
4112
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path11.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
4113
+ const sourceInfo = infoPlistFile ? import_plist.default.parse(import_node_fs9.default.readFileSync(infoPlistFile, "utf8")) : {};
3635
4114
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
3636
4115
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
3637
4116
  }
@@ -3649,34 +4128,17 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
3649
4128
  };
3650
4129
  }
3651
4130
  const localPackageDirs = [
3652
- ...listed.filter((reference) => import_node_fs8.default.existsSync(import_node_path9.default.join(reference, "Package.swift"))),
4131
+ ...listed.filter((reference) => import_node_fs9.default.existsSync(import_node_path11.default.join(reference, "Package.swift"))),
3653
4132
  ...projects2.flatMap(
3654
4133
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
3655
4134
  if (!isDict(entry)) return [];
3656
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path9.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
3657
- return candidate && import_node_fs8.default.existsSync(import_node_path9.default.join(candidate, "Package.swift")) ? [candidate] : [];
4135
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path11.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
4136
+ return candidate && import_node_fs9.default.existsSync(import_node_path11.default.join(candidate, "Package.swift")) ? [candidate] : [];
3658
4137
  })
3659
4138
  )
3660
4139
  ];
3661
- const graphs = /* @__PURE__ */ new Map();
3662
- const graphOf = (dir) => {
3663
- const cached = graphs.get(dir);
3664
- if (cached) return cached;
3665
- const graph = swiftManifestGraph(
3666
- import_node_fs8.default.readFileSync(import_node_path9.default.join(dir, "Package.swift"), "utf8")
3667
- );
3668
- graphs.set(dir, graph);
3669
- return graph;
3670
- };
3671
- const localProducts = /* @__PURE__ */ new Map();
3672
- for (const dir of localPackageDirs) {
3673
- for (const product of graphOf(dir).products.keys()) {
3674
- if (!localProducts.has(product)) localProducts.set(product, dir);
3675
- }
3676
- }
3677
- const localPackages = /* @__PURE__ */ new Set();
3678
- const remoteProducts = [];
3679
- const unresolvedProducts = [];
4140
+ const linkedProducts = [];
4141
+ const binaryFrameworks = /* @__PURE__ */ new Set();
3680
4142
  for (const { project, target } of order) {
3681
4143
  const productDependencies = [
3682
4144
  ...list(target.packageProductDependencies),
@@ -3688,45 +4150,37 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
3688
4150
  for (const dependencyId of productDependencies) {
3689
4151
  const dependency = project.object(dependencyId);
3690
4152
  const product = str(dependency?.productName)?.replace(/^plugin:/, "");
3691
- if (!dependency || !product) continue;
4153
+ if (!dependency || !product || linkedProducts.some((entry) => entry.product === product))
4154
+ continue;
3692
4155
  const reference = project.object(str(dependency.package));
3693
- if (reference?.isa === "XCRemoteSwiftPackageReference") {
3694
- if (!remoteProducts.some((entry) => entry.product === product))
3695
- remoteProducts.push({
3696
- product,
3697
- repositoryURL: str(reference.repositoryURL) ?? ""
3698
- });
3699
- } else if (reference?.isa === "XCLocalSwiftPackageReference") {
3700
- localPackages.add(
3701
- import_node_path9.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
3702
- );
3703
- } else if (localProducts.has(product)) {
3704
- localPackages.add(localProducts.get(product));
3705
- } else if (!unresolvedProducts.includes(product)) unresolvedProducts.push(product);
4156
+ linkedProducts.push({
4157
+ product,
4158
+ source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
4159
+ kind: "local",
4160
+ dir: import_node_path11.default.resolve(
4161
+ project.projectDir,
4162
+ str(reference.relativePath) ?? ""
4163
+ )
4164
+ } : { kind: "unnamed" }
4165
+ });
3706
4166
  }
3707
- }
3708
- const pending = [...localPackages];
3709
- while (pending.length > 0) {
3710
- const dir = pending.pop();
3711
- const graph = graphOf(dir);
3712
- for (const relative of graph.packagePaths) {
3713
- const next = import_node_path9.default.resolve(dir, relative);
3714
- if (localPackages.has(next) || !import_node_fs8.default.existsSync(import_node_path9.default.join(next, "Package.swift")))
3715
- continue;
3716
- localPackages.add(next);
3717
- pending.push(next);
3718
- }
3719
- for (const dependencies of graph.dependencies.values()) {
3720
- for (const dependency of dependencies) {
3721
- if (dependency.kind !== "product") continue;
3722
- const url = graph.packageURLs.get(dependency.package);
3723
- if (url && !remoteProducts.some((entry) => entry.product === dependency.name))
3724
- remoteProducts.push({ product: dependency.name, repositoryURL: url });
4167
+ for (const phaseId of list(target.buildPhases)) {
4168
+ const phase = project.object(phaseId);
4169
+ if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
4170
+ for (const buildFileId of list(phase.files)) {
4171
+ const fileId = str(project.object(buildFileId)?.fileRef);
4172
+ const file = project.object(fileId);
4173
+ const tree = str(file?.sourceTree);
4174
+ const name = /([^/]+)\.(xc)?framework$/.exec(str(file?.path) ?? "")?.[1];
4175
+ if (file?.isa !== "PBXFileReference" || !name) continue;
4176
+ if (tree === "BUILT_PRODUCTS_DIR" || tree === "SDKROOT" || tree === "DEVELOPER_DIR")
4177
+ continue;
4178
+ binaryFrameworks.add(name);
3725
4179
  }
3726
4180
  }
3727
4181
  }
3728
- const resolvedFile = import_node_path9.default.join(
3729
- workspace ?? import_node_path9.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
4182
+ const resolvedFile = import_node_path11.default.join(
4183
+ workspace ?? import_node_path11.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
3730
4184
  "xcshareddata",
3731
4185
  "swiftpm",
3732
4186
  "Package.resolved"
@@ -3736,19 +4190,24 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
3736
4190
  ...module2,
3737
4191
  rootDir: commonAncestor(
3738
4192
  [
3739
- workspace ? import_node_path9.default.dirname(workspace) : app.project.projectDir,
4193
+ workspace ? import_node_path11.default.dirname(workspace) : app.project.projectDir,
3740
4194
  ...used.map((project) => project.projectDir),
3741
- ...localPackages
3742
- ].map((dir) => import_node_fs8.default.realpathSync(dir))
4195
+ ...localPackageDirs,
4196
+ ...linkedProducts.flatMap(
4197
+ ({ source }) => source.kind === "local" && import_node_fs9.default.existsSync(source.dir) ? [source.dir] : []
4198
+ )
4199
+ ].map((dir) => import_node_fs9.default.realpathSync(dir))
3743
4200
  ),
3744
- pbxprojs: [...new Set(used.map((project) => project.pbxproj))].sort(),
4201
+ projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
3745
4202
  infoPlist: import_plist.default.build(info),
3746
4203
  infoPlistFile,
3747
4204
  frameworks,
3748
- localPackages: [...localPackages].map((dir) => import_node_fs8.default.realpathSync(dir)).sort(),
3749
- remoteProducts,
3750
- packageResolved: import_node_fs8.default.existsSync(resolvedFile) ? resolvedFile : null,
3751
- unresolvedProducts,
4205
+ linkedProducts,
4206
+ localPackageDirs: [
4207
+ ...new Set(localPackageDirs.map((dir) => import_node_fs9.default.realpathSync(dir)))
4208
+ ].sort(),
4209
+ binaryFrameworks: [...binaryFrameworks].sort(),
4210
+ packageResolved: import_node_fs9.default.existsSync(resolvedFile) ? resolvedFile : null,
3752
4211
  appTargets: appTargetNames
3753
4212
  };
3754
4213
  }
@@ -3768,17 +4227,17 @@ var SKIP_SOURCE_DIRS = /* @__PURE__ */ new Set([
3768
4227
  var NATIVE_DESCRIPTOR = ".one-native-source.json";
3769
4228
  var NATIVE_GLUE = ".one-native-source.swift.txt";
3770
4229
  function swiftPackageId(packagePath) {
3771
- return import_node_path10.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
4230
+ return import_node_path12.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
3772
4231
  }
3773
4232
  function nativeSourceDescriptor(packagePath) {
3774
- packagePath = import_node_fs9.default.realpathSync(packagePath);
3775
- const file = import_node_path10.default.join(packagePath, NATIVE_DESCRIPTOR);
3776
- if (!import_node_fs9.default.existsSync(file)) return null;
4233
+ packagePath = import_node_fs10.default.realpathSync(packagePath);
4234
+ const file = import_node_path12.default.join(packagePath, NATIVE_DESCRIPTOR);
4235
+ if (!import_node_fs10.default.existsSync(file)) return null;
3777
4236
  const value = JSON.parse(
3778
4237
  readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
3779
4238
  );
3780
4239
  const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
3781
- if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs9.default.existsSync(import_node_path10.default.join(packagePath, NATIVE_GLUE))) {
4240
+ if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs10.default.existsSync(import_node_path12.default.join(packagePath, NATIVE_GLUE))) {
3782
4241
  throw invalid();
3783
4242
  }
3784
4243
  if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
@@ -3787,12 +4246,12 @@ function nativeSourceDescriptor(packagePath) {
3787
4246
  return value;
3788
4247
  }
3789
4248
  function nativeSourceFiles(packagePath) {
3790
- packagePath = import_node_fs9.default.realpathSync(packagePath);
3791
- return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name) => import_node_path10.default.join(packagePath, name)).filter((file) => import_node_fs9.default.existsSync(file));
4249
+ packagePath = import_node_fs10.default.realpathSync(packagePath);
4250
+ return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name) => import_node_path12.default.join(packagePath, name)).filter((file) => import_node_fs10.default.existsSync(file));
3792
4251
  }
3793
4252
  var projects = /* @__PURE__ */ new Map();
3794
4253
  function projectFor(packagePath, hosted) {
3795
- packagePath = import_node_fs9.default.realpathSync(packagePath);
4254
+ packagePath = import_node_fs10.default.realpathSync(packagePath);
3796
4255
  const existing = projects.get(packagePath);
3797
4256
  if (existing) {
3798
4257
  if (hosted && !existing.hosted) {
@@ -3813,45 +4272,50 @@ function projectFor(packagePath, hosted) {
3813
4272
  return created;
3814
4273
  }
3815
4274
  var xcodeProjects = /* @__PURE__ */ new Map();
3816
- function remotePackages(entry, app) {
3817
- if (!entry.provided) return { targets: [], unavailable: /* @__PURE__ */ new Map() };
4275
+ function swiftPackages(entry, app) {
4276
+ const stamp = (file) => file && import_node_fs10.default.existsSync(file) ? import_node_fs10.default.statSync(file).mtimeMs : 0;
3818
4277
  const key = JSON.stringify([
3819
- app.remoteProducts,
4278
+ app.linkedProducts,
3820
4279
  app.packageResolved,
3821
- app.packageResolved ? import_node_fs9.default.statSync(app.packageResolved).mtimeMs : 0
4280
+ stamp(app.packageResolved),
4281
+ app.localPackageDirs.map((dir) => stamp(import_node_path12.default.join(dir, "Package.swift"))),
4282
+ app.linkedProducts.map(
4283
+ ({ source }) => source.kind === "local" ? stamp(import_node_path12.default.join(source.dir, "Package.swift")) : 0
4284
+ )
3822
4285
  ]);
3823
- if (entry.remote?.key !== key) {
3824
- entry.remote = {
4286
+ if (entry.packages?.key !== key) {
4287
+ entry.packages = {
3825
4288
  key,
3826
- packages: resolveRemotePackages(
3827
- app.rootDir,
3828
- app.packageResolved,
3829
- app.remoteProducts,
3830
- entry.provided
3831
- )
4289
+ packages: resolveSwiftPackages({
4290
+ rootDir: app.rootDir,
4291
+ resolved: app.packageResolved,
4292
+ products: app.linkedProducts,
4293
+ localDirs: app.localPackageDirs,
4294
+ provided: entry.provided
4295
+ })
3832
4296
  };
3833
4297
  }
3834
- return entry.remote.packages;
4298
+ return entry.packages.packages;
3835
4299
  }
3836
4300
  var XCODE_APP_DIR = "__app__";
3837
4301
  var XCODE_FRAMEWORKS_DIR = "__frameworks__";
3838
4302
  var XCODE_PACKAGES_DIR = "__packages__";
3839
- var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep)}/`;
4303
+ var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep)}/`;
3840
4304
  function xcodeInputKey(layout, file, relative) {
3841
4305
  const owner = layout.targetDirs.get(file);
3842
- if (owner) return import_node_path10.default.posix.join(owner, relative);
3843
- return relative.startsWith(CHECKOUTS_PREFIX) ? import_node_path10.default.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length)) : relative;
4306
+ if (owner) return import_node_path12.default.posix.join(owner, relative);
4307
+ return relative.startsWith(CHECKOUTS_PREFIX) ? import_node_path12.default.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length)) : relative;
3844
4308
  }
3845
4309
  function xcodeLayout(root) {
3846
4310
  const registered = xcodeProjects.get(root);
3847
4311
  if (!registered) return null;
3848
4312
  const app = readXcodeAppTarget(registered.xcodeproj, registered.target);
3849
- const files = /* @__PURE__ */ new Set([...app.pbxprojs, ...app.sources, ...app.resources]);
4313
+ const files = /* @__PURE__ */ new Set([...app.projectFiles, ...app.sources, ...app.resources]);
3850
4314
  if (app.infoPlistFile) files.add(app.infoPlistFile);
3851
4315
  const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
3852
4316
  const targets = [];
3853
4317
  for (const framework of app.frameworks) {
3854
- const dir = import_node_path10.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
4318
+ const dir = import_node_path12.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
3855
4319
  for (const file of framework.sources) {
3856
4320
  if (targetDirs.has(file)) continue;
3857
4321
  targetDirs.set(file, dir);
@@ -3862,44 +4326,35 @@ function xcodeLayout(root) {
3862
4326
  path: dir,
3863
4327
  executable: false,
3864
4328
  resources: false,
4329
+ exclude: [],
3865
4330
  languageMode: framework.languageMode,
3866
4331
  mainActorIsolation: framework.mainActorIsolation
3867
4332
  });
3868
4333
  }
3869
- for (const dir of app.localPackages) {
3870
- const manifestFile = import_node_path10.default.join(dir, "Package.swift");
3871
- files.add(manifestFile);
3872
- const manifest = import_node_fs9.default.readFileSync(manifestFile, "utf8");
3873
- const prefix = import_node_path10.default.relative(root, dir).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep);
3874
- const declared = swiftManifestTargets(manifest).filter((target) => !target.executable);
3875
- const all = declared.flatMap(
3876
- (target) => sourceTreeFiles(import_node_path10.default.join(dir, target.path), root).map(
3877
- (file) => import_node_path10.default.relative(dir, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep)
3878
- )
4334
+ const packages = swiftPackages(registered, app);
4335
+ for (const target of packages.targets) {
4336
+ const relative = import_node_path12.default.relative(
4337
+ target.remote ? import_node_path12.default.join(root, REMOTE_CHECKOUTS) : root,
4338
+ target.dir
3879
4339
  );
3880
- for (const target of swiftManifestTargets(manifest, all)) {
3881
- if (target.executable) continue;
3882
- targets.push({ ...target, path: import_node_path10.default.posix.join(prefix, target.path) });
3883
- for (const relative of all) {
3884
- if (relative.startsWith(`${target.path}/`)) files.add(import_node_path10.default.join(dir, relative));
3885
- }
3886
- }
3887
- }
3888
- const remote = remotePackages(registered, app);
3889
- for (const target of remote.targets) {
4340
+ if (relative === ".." || relative.startsWith(`..${import_node_path12.default.sep}`) || import_node_path12.default.isAbsolute(relative))
4341
+ throw new Error(`swift input escapes the selected package: ${target.dir}`);
4342
+ const posix = relative.split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep);
3890
4343
  targets.push({
3891
4344
  ...target,
3892
- path: import_node_path10.default.posix.join(
3893
- XCODE_PACKAGES_DIR,
3894
- import_node_path10.default.relative(import_node_path10.default.join(root, REMOTE_CHECKOUTS), target.dir).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep)
3895
- )
4345
+ path: target.remote ? import_node_path12.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
4346
+ exclude: []
3896
4347
  });
4348
+ if (!target.remote) files.add(import_node_path12.default.join(target.packageDir, "Package.swift"));
3897
4349
  for (const file of target.files) files.add(file);
3898
4350
  }
4351
+ for (const target of targets) {
4352
+ target.exclude = targets.filter((other) => other.path.startsWith(`${target.path}/`)).map((other) => other.path.slice(target.path.length + 1));
4353
+ }
3899
4354
  return {
3900
4355
  app,
3901
4356
  targets,
3902
- unavailable: remote.unavailable,
4357
+ packages,
3903
4358
  targetDirs,
3904
4359
  files: [...files].sort()
3905
4360
  };
@@ -3912,32 +4367,32 @@ function xcodeManifest(layout) {
3912
4367
  'let package = Package(name: "app", targets: [',
3913
4368
  ` .executableTarget(name: "${layout.app.moduleName}", path: "${XCODE_APP_DIR}", ${settings(layout.app.languageMode, layout.app.mainActorIsolation)}),`,
3914
4369
  ...layout.targets.map(
3915
- (target) => ` .target(name: "${target.name}", path: "${target.path}", ${target.resources ? "resources: [], " : ""}${settings(target.languageMode, target.mainActorIsolation)}),`
4370
+ (target) => ` .target(name: "${target.name}", path: "${target.path}", ${target.exclude.length > 0 ? `exclude: ${JSON.stringify(target.exclude)}, ` : ""}${target.resources ? "resources: [], " : ""}${settings(target.languageMode, target.mainActorIsolation)}),`
3916
4371
  ),
3917
4372
  "])",
3918
4373
  ""
3919
4374
  ].join("\n");
3920
4375
  }
3921
4376
  function packageFiles(root) {
3922
- const canonicalRoot = import_node_fs9.default.realpathSync(root);
4377
+ const canonicalRoot = import_node_fs10.default.realpathSync(root);
3923
4378
  const xcode = xcodeLayout(canonicalRoot);
3924
4379
  return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
3925
4380
  }
3926
4381
  function sourceTreeFiles(dir, canonicalRoot) {
3927
4382
  const found = [];
3928
4383
  const walk2 = (dir2) => {
3929
- for (const entry of import_node_fs9.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
4384
+ for (const entry of import_node_fs10.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
3930
4385
  if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
3931
4386
  continue;
3932
- const full = import_node_path10.default.join(dir2, entry.name);
4387
+ const full = import_node_path12.default.join(dir2, entry.name);
3933
4388
  if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
3934
- const real = import_node_fs9.default.realpathSync(full);
3935
- const relative = import_node_path10.default.relative(canonicalRoot, real);
3936
- if (relative.startsWith(`..${import_node_path10.default.sep}`) || relative === ".." || import_node_path10.default.isAbsolute(relative)) {
4389
+ const real = import_node_fs10.default.realpathSync(full);
4390
+ const relative = import_node_path12.default.relative(canonicalRoot, real);
4391
+ if (relative.startsWith(`..${import_node_path12.default.sep}`) || relative === ".." || import_node_path12.default.isAbsolute(relative)) {
3937
4392
  throw new Error(`swift input escapes the selected package: ${full}`);
3938
4393
  }
3939
4394
  if (entry.isDirectory()) {
3940
- if (import_node_fs9.default.existsSync(import_node_path10.default.join(full, "Package.swift"))) continue;
4395
+ if (import_node_fs10.default.existsSync(import_node_path12.default.join(full, "Package.swift"))) continue;
3941
4396
  walk2(full);
3942
4397
  } else if (entry.isFile()) {
3943
4398
  found.push(full);
@@ -3945,29 +4400,29 @@ function sourceTreeFiles(dir, canonicalRoot) {
3945
4400
  }
3946
4401
  }
3947
4402
  };
3948
- if (import_node_fs9.default.existsSync(dir)) walk2(import_node_fs9.default.realpathSync(dir));
4403
+ if (import_node_fs10.default.existsSync(dir)) walk2(import_node_fs10.default.realpathSync(dir));
3949
4404
  return found;
3950
4405
  }
3951
4406
  function readPackageFile(root, file, maxBytes) {
3952
- const canonicalRoot = import_node_fs9.default.realpathSync(root);
3953
- const relative = import_node_path10.default.relative(canonicalRoot, import_node_fs9.default.realpathSync(file));
3954
- if (relative === ".." || relative.startsWith(`..${import_node_path10.default.sep}`) || import_node_path10.default.isAbsolute(relative)) {
4407
+ const canonicalRoot = import_node_fs10.default.realpathSync(root);
4408
+ const relative = import_node_path12.default.relative(canonicalRoot, import_node_fs10.default.realpathSync(file));
4409
+ if (relative === ".." || relative.startsWith(`..${import_node_path12.default.sep}`) || import_node_path12.default.isAbsolute(relative)) {
3955
4410
  throw new Error(`swift input escapes the selected package: ${file}`);
3956
4411
  }
3957
- let ancestor = import_node_path10.default.resolve(file);
4412
+ let ancestor = import_node_path12.default.resolve(file);
3958
4413
  while (ancestor !== canonicalRoot) {
3959
- if (import_node_fs9.default.lstatSync(ancestor).isSymbolicLink()) {
4414
+ if (import_node_fs10.default.lstatSync(ancestor).isSymbolicLink()) {
3960
4415
  throw new Error(`swift input is a symlink: ${ancestor}`);
3961
4416
  }
3962
- const parent = import_node_path10.default.dirname(ancestor);
4417
+ const parent = import_node_path12.default.dirname(ancestor);
3963
4418
  if (parent === ancestor)
3964
4419
  throw new Error(`swift input escapes the selected package: ${file}`);
3965
4420
  ancestor = parent;
3966
4421
  }
3967
- const expected = import_node_fs9.default.statSync(file);
3968
- const fd = import_node_fs9.default.openSync(file, import_node_fs9.default.constants.O_RDONLY | import_node_fs9.default.constants.O_NOFOLLOW);
4422
+ const expected = import_node_fs10.default.statSync(file);
4423
+ const fd = import_node_fs10.default.openSync(file, import_node_fs10.default.constants.O_RDONLY | import_node_fs10.default.constants.O_NOFOLLOW);
3969
4424
  try {
3970
- const stat = import_node_fs9.default.fstatSync(fd);
4425
+ const stat = import_node_fs10.default.fstatSync(fd);
3971
4426
  if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
3972
4427
  throw new Error(`swift input changed while opening: ${file}`);
3973
4428
  }
@@ -3977,16 +4432,16 @@ function readPackageFile(root, file, maxBytes) {
3977
4432
  const bytes = Buffer.alloc(stat.size + 1);
3978
4433
  let offset = 0;
3979
4434
  while (offset < bytes.length) {
3980
- const count = import_node_fs9.default.readSync(fd, bytes, offset, bytes.length - offset, null);
4435
+ const count = import_node_fs10.default.readSync(fd, bytes, offset, bytes.length - offset, null);
3981
4436
  if (count === 0) break;
3982
4437
  offset += count;
3983
4438
  }
3984
- if (offset !== stat.size || import_node_fs9.default.fstatSync(fd).size !== stat.size) {
4439
+ if (offset !== stat.size || import_node_fs10.default.fstatSync(fd).size !== stat.size) {
3985
4440
  throw new Error(`swift input changed while reading: ${file}`);
3986
4441
  }
3987
4442
  return bytes.subarray(0, offset);
3988
4443
  } finally {
3989
- import_node_fs9.default.closeSync(fd);
4444
+ import_node_fs10.default.closeSync(fd);
3990
4445
  }
3991
4446
  }
3992
4447
  function sourceFiles(root) {
@@ -3994,7 +4449,7 @@ function sourceFiles(root) {
3994
4449
  }
3995
4450
  function resourceCandidateFiles(root) {
3996
4451
  return packageFiles(root).filter(
3997
- (file) => !file.endsWith(".swift") && import_node_path10.default.basename(file) !== "project.pbxproj"
4452
+ (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path12.default.basename(file))
3998
4453
  );
3999
4454
  }
4000
4455
  var HOSTED_LIMITS = {
@@ -4028,7 +4483,7 @@ function buildSwiftResourceTable(project, baseUrl) {
4028
4483
  const limits = inputLimits(Boolean(project.hosted));
4029
4484
  const absolute = resourceCandidateFiles(project.packagePath);
4030
4485
  const relative = absolute.map(
4031
- (file) => import_node_path10.default.relative(project.packagePath, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep)
4486
+ (file) => import_node_path12.default.relative(project.packagePath, file).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep)
4032
4487
  );
4033
4488
  const byRelative = new Map(absolute.map((file, index) => [relative[index], file]));
4034
4489
  const readContents = (candidate) => {
@@ -4050,16 +4505,16 @@ function buildSwiftResourceTable(project, baseUrl) {
4050
4505
  for (const { name, file, scale } of found) {
4051
4506
  const disk = byRelative.get(file);
4052
4507
  if (!disk) continue;
4053
- if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs9.default.statSync(disk).size > limits.imageTotalBytes) {
4508
+ if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs10.default.statSync(disk).size > limits.imageTotalBytes) {
4054
4509
  throw new Error("swift image pack exceeds the compile service caps");
4055
4510
  }
4056
4511
  const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
4057
4512
  imageBytes += bytes.length;
4058
- const hash = (0, import_node_crypto4.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
4059
- const ext = import_node_path10.default.posix.extname(file).toLowerCase();
4513
+ const hash = (0, import_node_crypto5.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
4514
+ const ext = import_node_path12.default.posix.extname(file).toLowerCase();
4060
4515
  table[name] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
4061
4516
  images[name] = {
4062
- file: import_node_path10.default.posix.basename(file),
4517
+ file: import_node_path12.default.posix.basename(file),
4063
4518
  data: bytes.toString("base64")
4064
4519
  };
4065
4520
  watched.push(file);
@@ -4083,10 +4538,10 @@ function buildSwiftResourceTable(project, baseUrl) {
4083
4538
  return { table, images, colors, symbols, watched };
4084
4539
  }
4085
4540
  function buildSwiftBundleFiles(packagePath, hosted) {
4086
- packagePath = import_node_fs9.default.realpathSync(packagePath);
4541
+ packagePath = import_node_fs10.default.realpathSync(packagePath);
4087
4542
  const limits = inputLimits(hosted);
4088
4543
  const relative = resourceCandidateFiles(packagePath).map(
4089
- (file) => import_node_path10.default.relative(packagePath, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep)
4544
+ (file) => import_node_path12.default.relative(packagePath, file).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep)
4090
4545
  );
4091
4546
  const files = {};
4092
4547
  const watched = [];
@@ -4100,13 +4555,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
4100
4555
  total += bytes.length;
4101
4556
  if (xcode.app.infoPlistFile)
4102
4557
  watched.push(
4103
- import_node_path10.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path10.default.sep).join("/")
4558
+ import_node_path12.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path12.default.sep).join("/")
4104
4559
  );
4105
4560
  }
4106
4561
  for (const { base, file } of enumerateBundleJson(relative)) {
4107
4562
  watched.push(file);
4108
- const disk = import_node_path10.default.join(packagePath, ...file.split("/"));
4109
- if (Object.keys(files).length >= limits.resources || total + import_node_fs9.default.statSync(disk).size > limits.resourceTotalBytes) {
4563
+ const disk = import_node_path12.default.join(packagePath, ...file.split("/"));
4564
+ if (Object.keys(files).length >= limits.resources || total + import_node_fs10.default.statSync(disk).size > limits.resourceTotalBytes) {
4110
4565
  throw new Error(
4111
4566
  `swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
4112
4567
  );
@@ -4121,12 +4576,12 @@ function serveSwiftResource(project, key) {
4121
4576
  return project.resourceFiles.get(key) ?? project.resourcesPrevious.get(key) ?? null;
4122
4577
  }
4123
4578
  function linkedModuleRoots(packagePath) {
4124
- packagePath = import_node_fs9.default.realpathSync(packagePath);
4579
+ packagePath = import_node_fs10.default.realpathSync(packagePath);
4125
4580
  let manifest;
4126
4581
  try {
4127
4582
  manifest = readPackageFile(
4128
4583
  packagePath,
4129
- import_node_path10.default.join(packagePath, "Package.swift"),
4584
+ import_node_path12.default.join(packagePath, "Package.swift"),
4130
4585
  MAX_SWIFT_COMPILE_SOURCE_BYTES
4131
4586
  ).toString("utf8");
4132
4587
  } catch {
@@ -4135,35 +4590,35 @@ function linkedModuleRoots(packagePath) {
4135
4590
  const roots = /* @__PURE__ */ new Set();
4136
4591
  const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
4137
4592
  for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
4138
- const root = import_node_path10.default.resolve(packagePath, match[1]);
4139
- if (import_node_fs9.default.existsSync(import_node_path10.default.join(root, "Package.swift"))) roots.add(root);
4593
+ const root = import_node_path12.default.resolve(packagePath, match[1]);
4594
+ if (import_node_fs10.default.existsSync(import_node_path12.default.join(root, "Package.swift"))) roots.add(root);
4140
4595
  }
4141
4596
  return [...roots].sort();
4142
4597
  }
4143
4598
  function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
4144
- const hash = (0, import_node_crypto4.createHash)("sha256");
4599
+ const hash = (0, import_node_crypto5.createHash)("sha256");
4145
4600
  hash.update(packagePath);
4146
4601
  const projectInputs = new Set(packageFiles(packagePath));
4147
4602
  for (const file of [...projectInputs].sort()) {
4148
- hash.update(import_node_path10.default.relative(packagePath, file));
4149
- const stat = import_node_fs9.default.statSync(file);
4603
+ hash.update(import_node_path12.default.relative(packagePath, file));
4604
+ const stat = import_node_fs10.default.statSync(file);
4150
4605
  hash.update(`${stat.mtimeMs}/${stat.ctimeMs}/${stat.size}`);
4151
4606
  }
4152
4607
  const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
4153
- (root) => import_node_fs9.default.existsSync(import_node_path10.default.join(root, "toolchain.json"))
4608
+ (root) => import_node_fs10.default.existsSync(import_node_path12.default.join(root, "toolchain.json"))
4154
4609
  );
4155
4610
  if (moduleRoot) {
4156
4611
  hash.update(moduleRoot);
4157
4612
  for (const relative of swiftModuleInputFiles(moduleRoot)) {
4158
4613
  hash.update(relative);
4159
- hash.update(String(import_node_fs9.default.statSync(import_node_path10.default.join(moduleRoot, relative)).mtimeMs));
4614
+ hash.update(String(import_node_fs10.default.statSync(import_node_path12.default.join(moduleRoot, relative)).mtimeMs));
4160
4615
  }
4161
4616
  }
4162
4617
  return hash.digest("hex").slice(0, 16);
4163
4618
  }
4164
4619
  function entryRootId(packagePath, file) {
4165
- const relative = import_node_path10.default.relative(packagePath, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep);
4166
- return `${import_node_path10.default.basename(packagePath)}${import_node_path10.default.posix.sep}${relative}`;
4620
+ const relative = import_node_path12.default.relative(packagePath, file).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep);
4621
+ return `${import_node_path12.default.basename(packagePath)}${import_node_path12.default.posix.sep}${relative}`;
4167
4622
  }
4168
4623
  function icuUrl(origin, artifact) {
4169
4624
  return "url" in artifact.icu ? artifact.icu.url : `${origin}${ICU_PATH}${artifact.icu.sha256}`;
@@ -4172,8 +4627,8 @@ function packageSources(packagePath) {
4172
4627
  const xcode = xcodeLayout(packagePath);
4173
4628
  const files = {};
4174
4629
  for (const file of sourceFiles(packagePath)) {
4175
- const relative = import_node_path10.default.relative(packagePath, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep);
4176
- if (xcode && import_node_path10.default.basename(file) === "Package.swift") continue;
4630
+ const relative = import_node_path12.default.relative(packagePath, file).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep);
4631
+ if (xcode && import_node_path12.default.basename(file) === "Package.swift") continue;
4177
4632
  files[xcode ? xcodeInputKey(xcode, file, relative) : relative] = readPackageFile(
4178
4633
  packagePath,
4179
4634
  file,
@@ -4190,7 +4645,7 @@ function packageSnapshot(project) {
4190
4645
  files,
4191
4646
  resourcePaths: swiftImplicitResourcePaths(
4192
4647
  resourceCandidateFiles(project.packagePath).map(
4193
- (file) => import_node_path10.default.relative(project.packagePath, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep)
4648
+ (file) => import_node_path12.default.relative(project.packagePath, file).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep)
4194
4649
  )
4195
4650
  ),
4196
4651
  resources: buildSwiftResourceTable(project, ""),
@@ -4199,7 +4654,7 @@ function packageSnapshot(project) {
4199
4654
  ...native ? {
4200
4655
  glue: readPackageFile(
4201
4656
  project.packagePath,
4202
- import_node_path10.default.join(project.packagePath, NATIVE_GLUE),
4657
+ import_node_path12.default.join(project.packagePath, NATIVE_GLUE),
4203
4658
  MAX_SWIFT_COMPILE_SOURCE_BYTES
4204
4659
  ).toString("utf8")
4205
4660
  } : {}
@@ -4238,7 +4693,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
4238
4693
  package: content
4239
4694
  };
4240
4695
  const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
4241
- (root) => import_node_fs9.default.existsSync(import_node_path10.default.join(root, "toolchain.json"))
4696
+ (root) => import_node_fs10.default.existsSync(import_node_path12.default.join(root, "toolchain.json"))
4242
4697
  ) ?? await swiftDistributionRoot();
4243
4698
  if (!moduleRoot)
4244
4699
  return {
@@ -4264,10 +4719,10 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
4264
4719
  // server and a capture, or two checkouts) build each other's sources. so
4265
4720
  // each app and module checkout gets its own root, which keeps the same
4266
4721
  // app's incremental build across restarts.
4267
- buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path10.default.join(
4268
- import_node_os5.default.tmpdir(),
4722
+ buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path12.default.join(
4723
+ import_node_os6.default.tmpdir(),
4269
4724
  "contrast-swift-build",
4270
- (0, import_node_crypto4.createHash)("sha256").update(`${moduleRoot}\0${import_node_path10.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
4725
+ (0, import_node_crypto5.createHash)("sha256").update(`${moduleRoot}\0${import_node_path12.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
4271
4726
  ),
4272
4727
  moduleRoot,
4273
4728
  ...toolchain
@@ -4332,19 +4787,19 @@ function swiftApiGapReport(output) {
4332
4787
  }
4333
4788
  function missingModulesMessage(packagePath, missing) {
4334
4789
  const layout = xcodeLayout(packagePath);
4335
- const remote = new Map(
4336
- (layout?.app.remoteProducts ?? []).map((entry) => [
4337
- entry.product,
4338
- entry.repositoryURL
4339
- ])
4340
- );
4790
+ const gaps = new Map([
4791
+ ...(layout?.app.binaryFrameworks ?? []).map(
4792
+ (name) => [name, { source: "the project", reason: "a vendored binary framework" }]
4793
+ ),
4794
+ ...layout?.packages.modules ?? [],
4795
+ ...layout?.packages.unavailable ?? []
4796
+ ]);
4341
4797
  const width = Math.max(...[...missing.keys()].map((name) => name.length));
4342
4798
  return [
4343
4799
  `Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
4344
4800
  ...[...missing].map(([name, files]) => {
4345
- const source = remote.get(name);
4346
- const reason = layout?.unavailable.get(name)?.reason;
4347
- return ` ${name.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${source ? `, package ${source}` : ""}${reason ? ` (${reason})` : ""}`;
4801
+ const gap = gaps.get(name);
4802
+ return ` ${name.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path12.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
4348
4803
  })
4349
4804
  ].join("\n");
4350
4805
  }
@@ -4352,7 +4807,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
4352
4807
  const auth = hosted ? null : resolveCliAuth();
4353
4808
  if (!hosted && (!auth || auth.kind === "github")) {
4354
4809
  throw new Error(
4355
- `compiling ${import_node_path10.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
4810
+ `compiling ${import_node_path12.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
4356
4811
  );
4357
4812
  }
4358
4813
  const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
@@ -4368,10 +4823,10 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
4368
4823
  });
4369
4824
  if (!submit) throw new Error("swift compile: no credential to submit with");
4370
4825
  const sources = Object.values(snapshot.files);
4371
- const bytes = sources.reduce((total2, text) => total2 + Buffer.byteLength(text), 0);
4826
+ const bytes = sources.reduce((total2, text2) => total2 + Buffer.byteLength(text2), 0);
4372
4827
  if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
4373
4828
  throw new Error(
4374
- `${import_node_path10.default.basename(packagePath)} has ${sources.length} Swift files (${bytes} bytes), over Contrast's compile limits of ${MAX_SWIFT_COMPILE_FILES} files and ${MAX_SWIFT_COMPILE_SOURCE_BYTES} bytes; compile it on this machine with the Swift distribution instead`
4829
+ `${import_node_path12.default.basename(packagePath)} has ${sources.length} Swift files (${bytes} bytes), over Contrast's compile limits of ${MAX_SWIFT_COMPILE_FILES} files and ${MAX_SWIFT_COMPILE_SOURCE_BYTES} bytes; compile it on this machine with the Swift distribution instead`
4375
4830
  );
4376
4831
  }
4377
4832
  const descriptor = snapshot.native;
@@ -4390,7 +4845,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
4390
4845
  );
4391
4846
  if (descriptor && address.native?.hash !== descriptor.hash) {
4392
4847
  throw new Error(
4393
- `${import_node_path10.default.basename(packagePath)}: Contrast compiled native contract ${address.native?.hash ?? "none"} but one typegen wrote ${descriptor.hash}; the app's One and the compile host's differ, or the compile host is older than this peachsim`
4848
+ `${import_node_path12.default.basename(packagePath)}: Contrast compiled native contract ${address.native?.hash ?? "none"} but one typegen wrote ${descriptor.hash}; the app's One and the compile host's differ, or the compile host is older than this peachsim`
4394
4849
  );
4395
4850
  }
4396
4851
  const response = await fetch(address.url, { signal });
@@ -4463,17 +4918,17 @@ function artifactFor(project, entry, moduleRoot) {
4463
4918
  return fresh;
4464
4919
  }
4465
4920
  function swiftPackageWatchFiles(packagePath, moduleRoot) {
4466
- packagePath = import_node_fs9.default.realpathSync(packagePath);
4921
+ packagePath = import_node_fs10.default.realpathSync(packagePath);
4467
4922
  return [
4468
- ...xcodeProjects.has(packagePath) ? [] : [import_node_path10.default.join(packagePath, "Package.swift")],
4923
+ ...xcodeProjects.has(packagePath) ? [] : [import_node_path12.default.join(packagePath, "Package.swift")],
4469
4924
  ...sourceFiles(packagePath),
4470
4925
  ...nativeSourceFiles(packagePath),
4471
4926
  ...resourceCandidateFiles(packagePath),
4472
- ...moduleRoot ? swiftModuleInputFiles(moduleRoot).map((file) => import_node_path10.default.join(moduleRoot, file)) : []
4927
+ ...moduleRoot ? swiftModuleInputFiles(moduleRoot).map((file) => import_node_path12.default.join(moduleRoot, file)) : []
4473
4928
  ];
4474
4929
  }
4475
4930
  async function swiftPackageMetadata(packagePath, packageName, moduleRoot, origin, hosted) {
4476
- packagePath = import_node_fs9.default.realpathSync(packagePath);
4931
+ packagePath = import_node_fs10.default.realpathSync(packagePath);
4477
4932
  const mains = sourceFiles(packagePath).filter(
4478
4933
  (file) => swiftApplicationEntry(
4479
4934
  file,
@@ -4487,7 +4942,7 @@ async function swiftPackageMetadata(packagePath, packageName, moduleRoot, origin
4487
4942
  );
4488
4943
  }
4489
4944
  const project = projectFor(packagePath, hosted);
4490
- const entry = mains.length === 1 ? import_node_path10.default.relative(packagePath, mains[0]).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep) : Object.entries(native?.files ?? {}).find(
4945
+ const entry = mains.length === 1 ? import_node_path12.default.relative(packagePath, mains[0]).split(import_node_path12.default.sep).join(import_node_path12.default.posix.sep) : Object.entries(native?.files ?? {}).find(
4491
4946
  ([_file, names]) => names.length > 0
4492
4947
  )?.[0];
4493
4948
  if (!entry) throw new Error(`swift package ${packageName} has no native module source`);
@@ -4576,12 +5031,12 @@ function artifactUrl(project, artifact) {
4576
5031
  return `${serverOrigin()}${ARTIFACT_PATH2}${artifact.hash}.wasm`;
4577
5032
  }
4578
5033
  function packageFor(file) {
4579
- let dir = import_node_path11.default.dirname(file);
5034
+ let dir = import_node_path13.default.dirname(file);
4580
5035
  const stop = devServer?.config.root;
4581
5036
  for (; ; ) {
4582
- if (import_node_fs10.default.existsSync(import_node_path11.default.join(dir, "Package.swift"))) return dir;
4583
- if (stop !== void 0 && dir === stop || import_node_path11.default.dirname(dir) === dir) break;
4584
- dir = import_node_path11.default.dirname(dir);
5037
+ if (import_node_fs11.default.existsSync(import_node_path13.default.join(dir, "Package.swift"))) return dir;
5038
+ if (stop !== void 0 && dir === stop || import_node_path13.default.dirname(dir) === dir) break;
5039
+ dir = import_node_path13.default.dirname(dir);
4585
5040
  }
4586
5041
  throw new Error(
4587
5042
  `no Package.swift above ${file}${stop === void 0 ? "" : ` (searched up to ${stop})`}; a .swift import needs a swiftpm package like the one in packages/sootsim-swift/example`
@@ -4602,9 +5057,9 @@ function swiftPlugin(options = {}) {
4602
5057
  if (!resolved) throw new Error(`cannot resolve swift source ${source}`);
4603
5058
  let id = resolved.id;
4604
5059
  if (importer && (source.startsWith("./") || source.startsWith("../"))) {
4605
- const raw2 = import_node_path11.default.resolve(import_node_path11.default.dirname(importer.split("?")[0] ?? importer), source);
5060
+ const raw2 = import_node_path13.default.resolve(import_node_path13.default.dirname(importer.split("?")[0] ?? importer), source);
4606
5061
  try {
4607
- if (import_node_fs10.default.realpathSync(raw2) === import_node_fs10.default.realpathSync(resolved.id)) id = raw2;
5062
+ if (import_node_fs11.default.realpathSync(raw2) === import_node_fs11.default.realpathSync(resolved.id)) id = raw2;
4608
5063
  } catch {
4609
5064
  }
4610
5065
  }
@@ -4613,22 +5068,22 @@ function swiftPlugin(options = {}) {
4613
5068
  async load(id) {
4614
5069
  if (!id.startsWith(VIRTUAL_PREFIX)) return null;
4615
5070
  const file = id.slice(VIRTUAL_PREFIX.length);
4616
- if (!import_node_fs10.default.existsSync(file)) throw new Error(`swift source ${file} no longer exists`);
5071
+ if (!import_node_fs11.default.existsSync(file)) throw new Error(`swift source ${file} no longer exists`);
4617
5072
  const packagePath = options.packagePath ?? packageFor(file);
4618
5073
  const project = projectFor(packagePath);
4619
- const entry = import_node_path11.default.relative(packagePath, file).split(import_node_path11.default.sep).join(import_node_path11.default.posix.sep);
5074
+ const entry = import_node_path13.default.relative(packagePath, file).split(import_node_path13.default.sep).join(import_node_path13.default.posix.sep);
4620
5075
  for (const source of [
4621
5076
  ...sourceFiles(packagePath),
4622
5077
  ...nativeSourceFiles(packagePath)
4623
5078
  ])
4624
5079
  this.addWatchFile(source);
4625
- this.addWatchFile(import_node_path11.default.join(packagePath, "Package.swift"));
5080
+ this.addWatchFile(import_node_path13.default.join(packagePath, "Package.swift"));
4626
5081
  const moduleRoot = linkedModuleRoots(packagePath).find(
4627
- (root) => import_node_fs10.default.existsSync(import_node_path11.default.join(root, "toolchain.json"))
5082
+ (root) => import_node_fs11.default.existsSync(import_node_path13.default.join(root, "toolchain.json"))
4628
5083
  );
4629
5084
  if (moduleRoot)
4630
5085
  for (const relative of swiftModuleInputFiles(moduleRoot))
4631
- this.addWatchFile(import_node_path11.default.join(moduleRoot, relative));
5086
+ this.addWatchFile(import_node_path13.default.join(moduleRoot, relative));
4632
5087
  let artifact;
4633
5088
  try {
4634
5089
  artifact = await artifactFor(project, entry);
@@ -4647,7 +5102,7 @@ function swiftPlugin(options = {}) {
4647
5102
  ...artifact.package.resources.watched,
4648
5103
  ...artifact.package.bundleFiles.watched
4649
5104
  ])
4650
- this.addWatchFile(import_node_path11.default.join(packagePath, ...watched.split(import_node_path11.default.posix.sep)));
5105
+ this.addWatchFile(import_node_path13.default.join(packagePath, ...watched.split(import_node_path13.default.posix.sep)));
4651
5106
  const colors = artifact.package.resources.colors;
4652
5107
  const symbols = artifact.package.resources.symbols;
4653
5108
  const bundleFiles = artifact.package.bundleFiles.files;