peachsim 0.1.796 → 0.1.798

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 (86) hide show
  1. package/cli/cloud-test-tunnel.ts +1 -1
  2. package/cli/outbound-endpoints.ts +6 -1
  3. package/dist-lib/agent-daemon-client.cjs +1 -1
  4. package/dist-lib/agent-events.cjs +1 -1
  5. package/dist-lib/agent-identity.cjs +1 -1
  6. package/dist-lib/agent-sessions.cjs +1 -1
  7. package/dist-lib/attached-projects.cjs +1 -1
  8. package/dist-lib/auth/shared-session.cjs +1 -1
  9. package/dist-lib/backend-origin.cjs +1 -1
  10. package/dist-lib/beta.cjs +1 -1
  11. package/dist-lib/beta.mjs +1 -1
  12. package/dist-lib/bridge-constants.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.cjs +1 -1
  14. package/dist-lib/bridge-contract-input.mjs +1 -1
  15. package/dist-lib/bridge-contract.cjs +1 -1
  16. package/dist-lib/bridge-contract.mjs +1 -1
  17. package/dist-lib/bundle-channel.cjs +383 -346
  18. package/dist-lib/capture-contract.cjs +1 -1
  19. package/dist-lib/capture-contract.mjs +1 -1
  20. package/dist-lib/cli-constants.cjs +1 -1
  21. package/dist-lib/cloud-contract.cjs +1 -1
  22. package/dist-lib/cloud-contract.mjs +1 -1
  23. package/dist-lib/cloud-test-args.cjs +1 -1
  24. package/dist-lib/cloud-test-args.mjs +1 -1
  25. package/dist-lib/cloud.cjs +1 -1
  26. package/dist-lib/cloud.mjs +1 -1
  27. package/dist-lib/config.cjs +1 -1
  28. package/dist-lib/detox/index.cjs +1 -1
  29. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  30. package/dist-lib/expo-swift-bundle.cjs +356 -326
  31. package/dist-lib/expo-swift-metadata.cjs +1 -1
  32. package/dist-lib/expo-swift-metadata.mjs +1 -1
  33. package/dist-lib/home-paths.cjs +1 -1
  34. package/dist-lib/host/bridge-host.cjs +679 -565
  35. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  37. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  38. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  39. package/dist-lib/host/websocket-proxy.cjs +1 -1
  40. package/dist-lib/index.cjs +401 -178
  41. package/dist-lib/jump-to-source-babel.cjs +1 -1
  42. package/dist-lib/jump-to-source-native.cjs +1 -1
  43. package/dist-lib/kotlin-host.cjs +1 -1
  44. package/dist-lib/menu.cjs +1 -1
  45. package/dist-lib/menu.mjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  47. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  48. package/dist-lib/metro-production-bundle.cjs +1 -1
  49. package/dist-lib/metro-production-bundle.mjs +1 -1
  50. package/dist-lib/metro.cjs +1 -1
  51. package/dist-lib/native-app-identity.cjs +1 -1
  52. package/dist-lib/native-app-identity.mjs +1 -1
  53. package/dist-lib/native-firebase-metadata.cjs +1 -1
  54. package/dist-lib/native-firebase-metadata.mjs +1 -1
  55. package/dist-lib/plist.cjs +1 -1
  56. package/dist-lib/plist.mjs +1 -1
  57. package/dist-lib/profiles.cjs +1 -1
  58. package/dist-lib/public-brand.cjs +1 -1
  59. package/dist-lib/react-native-host-modules.cjs +1 -1
  60. package/dist-lib/react-native-host-modules.mjs +1 -1
  61. package/dist-lib/render-mode.cjs +1 -1
  62. package/dist-lib/scripts/dev-server-scanner.cjs +85 -1
  63. package/dist-lib/sdk.cjs +1 -1
  64. package/dist-lib/sdk.mjs +1 -1
  65. package/dist-lib/skills.cjs +976 -842
  66. package/dist-lib/swift-compile.cjs +30 -5
  67. package/dist-lib/swift-compile.mjs +29 -5
  68. package/dist-lib/swift-package.cjs +1 -1
  69. package/dist-lib/swift-package.mjs +1 -1
  70. package/dist-lib/swift-submit.cjs +1 -1
  71. package/dist-lib/swift-submit.mjs +1 -1
  72. package/dist-lib/swift-toolchain.cjs +1 -1
  73. package/dist-lib/swift.cjs +1 -1
  74. package/dist-lib/vite-swift.cjs +415 -358
  75. package/dist-lib/vite.cjs +240 -15
  76. package/package.json +1 -1
  77. package/scripts/dev-server-scanner.ts +16 -5
  78. package/src/expo-swift-host.ts +8 -4
  79. package/src/one-widget-discovery.ts +17 -0
  80. package/src/one-widget-metadata.ts +208 -0
  81. package/src/one-widget-package.ts +11 -165
  82. package/src/oneWidgetContract.ts +122 -0
  83. package/src/swift-compile.ts +31 -5
  84. package/src/swift-host.ts +2 -48
  85. package/src/swift-source-file.ts +48 -0
  86. package/src/vite-plugin-one.ts +18 -1
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.796 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.798 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1393,10 +1393,10 @@ module.exports = __toCommonJS(expo_swift_bundle_exports);
1393
1393
  // src/expo-swift-host.ts
1394
1394
  var import_node_child_process8 = require("node:child_process");
1395
1395
  var import_node_crypto8 = require("node:crypto");
1396
- var import_node_fs14 = __toESM(require("node:fs"), 1);
1396
+ var import_node_fs15 = __toESM(require("node:fs"), 1);
1397
1397
  var import_node_module = require("node:module");
1398
1398
  var import_node_os9 = __toESM(require("node:os"), 1);
1399
- var import_node_path15 = __toESM(require("node:path"), 1);
1399
+ var import_node_path16 = __toESM(require("node:path"), 1);
1400
1400
  var import_node_util3 = require("node:util");
1401
1401
 
1402
1402
  // cli/internal-child.ts
@@ -2031,9 +2031,18 @@ var SPRITEKIT_PRODUCT = '.product(name: "SpriteKit", package: "sootsim-swift")';
2031
2031
  var importsSpriteKit = (files2) => Object.entries(files2).some(
2032
2032
  ([file, contents]) => file.endsWith(".swift") && swiftImportNames(contents).includes("SpriteKit")
2033
2033
  );
2034
- var FOUNDATION_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "PeachObjC", "-Xfrontend", "-import-module", "-Xfrontend", "Dispatch", "-Xfrontend", "-import-module", "-Xfrontend", "FoundationNetworking", "-Xfrontend", "-import-module", "-Xfrontend", "WASILibc", "-Xfrontend", "-import-module", "-Xfrontend", "wasi_pthread"';
2034
+ var FOUNDATION_IMPLICIT_MODULES = [
2035
+ "PeachObjC",
2036
+ "Dispatch",
2037
+ "FoundationNetworking",
2038
+ "WASILibc",
2039
+ "wasi_pthread"
2040
+ ];
2041
+ var FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
2042
+ (module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
2043
+ ).join("");
2035
2044
  var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
2036
- var MULTI_MANIFEST_VERSION = 11;
2045
+ var MULTI_MANIFEST_VERSION = 12;
2037
2046
  function swiftArtifactHash(input, release, moduleRoot) {
2038
2047
  const hash = (0, import_node_crypto2.createHash)("sha256");
2039
2048
  hash.update(`swift-compile/v18
@@ -2084,8 +2093,12 @@ function emitSwiftPackageManifest(args) {
2084
2093
  (name2) => OPTIONAL_FRAMEWORKS.has(name2) && !targets.some((target) => target.name === name2)
2085
2094
  ).flatMap((name2) => [name2, ...OPTIONAL_FRAMEWORK_DEPENDENCIES[name2] ?? []])
2086
2095
  );
2096
+ if (spriteKit) {
2097
+ reachedFrameworks.add("SpriteKit");
2098
+ reachedFrameworks.add("PeachBox2D");
2099
+ }
2087
2100
  const distributionObjects = distribution?.objects.filter(
2088
- (object) => [...OPTIONAL_FRAMEWORKS].every(
2101
+ (object) => [...OPTIONAL_FRAMEWORKS, "SpriteKit", "PeachBox2D"].every(
2089
2102
  (name2) => !object.startsWith(`lib/${name2}-`) || reachedFrameworks.has(name2)
2090
2103
  )
2091
2104
  );
@@ -3242,7 +3255,17 @@ function compileSwiftProjectUnit(input, options) {
3242
3255
  ])
3243
3256
  ],
3244
3257
  {
3245
- env: BUILD_ENV,
3258
+ env: {
3259
+ ...BUILD_ENV,
3260
+ // shipped host plugins resolve against the selected compiler's runtime.
3261
+ ...process.platform === "linux" ? {
3262
+ LD_LIBRARY_PATH: [
3263
+ import_node_path2.default.resolve(options.toolchainBin, "../lib/swift/linux"),
3264
+ import_node_path2.default.resolve(options.toolchainBin, "../lib/swift/host"),
3265
+ process.env.LD_LIBRARY_PATH
3266
+ ].filter(Boolean).join(":")
3267
+ } : {}
3268
+ },
3246
3269
  maxBuffer: 64 * 1024 * 1024,
3247
3270
  timeout: options.timeoutMs
3248
3271
  }
@@ -3554,9 +3577,9 @@ function swiftModuleToolchain(root) {
3554
3577
 
3555
3578
  // src/swift-host.ts
3556
3579
  var import_node_crypto7 = require("node:crypto");
3557
- var import_node_fs13 = __toESM(require("node:fs"), 1);
3580
+ var import_node_fs14 = __toESM(require("node:fs"), 1);
3558
3581
  var import_node_os8 = __toESM(require("node:os"), 1);
3559
- var import_node_path14 = __toESM(require("node:path"), 1);
3582
+ var import_node_path15 = __toESM(require("node:path"), 1);
3560
3583
 
3561
3584
  // ../sootsim-swift/src/bundleAssets.ts
3562
3585
  var import_svgpath = __toESM(require("svgpath"), 1);
@@ -3590,8 +3613,8 @@ function pickImagesetFile(images) {
3590
3613
  scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
3591
3614
  };
3592
3615
  }
3593
- function flatScale(path15) {
3594
- const match = /@([23])x\.[^./]+$/.exec(path15);
3616
+ function flatScale(path16) {
3617
+ const match = /@([23])x\.[^./]+$/.exec(path16);
3595
3618
  return match ? Number(match[1]) : 1;
3596
3619
  }
3597
3620
  function providesNamespace(text3) {
@@ -3618,13 +3641,13 @@ function catalogEntryName(contentsPath, kind, readText) {
3618
3641
  }
3619
3642
  return segments.join("/");
3620
3643
  }
3621
- function isFlatResourceImage(path15) {
3622
- return path15.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path15));
3644
+ function isFlatResourceImage(path16) {
3645
+ return path16.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path16));
3623
3646
  }
3624
3647
  function enumerateBundleImages(paths, readText) {
3625
3648
  const table = [];
3626
3649
  const seen = /* @__PURE__ */ new Set();
3627
- const catalogs = paths.filter((path15) => baseOf(path15) === "Contents.json");
3650
+ const catalogs = paths.filter((path16) => baseOf(path16) === "Contents.json");
3628
3651
  for (const contentsPath of catalogs) {
3629
3652
  const name2 = catalogEntryName(contentsPath, ".imageset", readText);
3630
3653
  if (name2 === null || seen.has(name2)) continue;
@@ -3645,12 +3668,12 @@ function enumerateBundleImages(paths, readText) {
3645
3668
  seen.add(name2);
3646
3669
  table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
3647
3670
  }
3648
- for (const path15 of paths) {
3649
- if (!isFlatResourceImage(path15)) continue;
3650
- const name2 = baseOf(path15).slice(0, -extOf(path15).length);
3671
+ for (const path16 of paths) {
3672
+ if (!isFlatResourceImage(path16)) continue;
3673
+ const name2 = baseOf(path16).slice(0, -extOf(path16).length);
3651
3674
  if (name2 === "" || seen.has(name2)) continue;
3652
3675
  seen.add(name2);
3653
- table.push({ name: name2, file: path15, scale: flatScale(path15) });
3676
+ table.push({ name: name2, file: path16, scale: flatScale(path16) });
3654
3677
  }
3655
3678
  return table;
3656
3679
  }
@@ -3679,7 +3702,7 @@ function colorsetValue(color) {
3679
3702
  }
3680
3703
  function enumerateBundleColors(paths, readText) {
3681
3704
  const table = {};
3682
- for (const contentsPath of paths.filter((path15) => baseOf(path15) === "Contents.json")) {
3705
+ for (const contentsPath of paths.filter((path16) => baseOf(path16) === "Contents.json")) {
3683
3706
  const name2 = catalogEntryName(contentsPath, ".colorset", readText);
3684
3707
  if (name2 === null || name2 in table) continue;
3685
3708
  let colors;
@@ -3744,8 +3767,8 @@ function axisExtremes(points) {
3744
3767
  function pathBounds(d) {
3745
3768
  const xs = [];
3746
3769
  const ys = [];
3747
- for (const path15 of d)
3748
- (0, import_svgpath.default)(path15).abs().unshort().unarc().iterate((segment, _index, x, y) => {
3770
+ for (const path16 of d)
3771
+ (0, import_svgpath.default)(path16).abs().unshort().unarc().iterate((segment, _index, x, y) => {
3749
3772
  const [command, ...args] = segment;
3750
3773
  if (command === "M" || command === "L") {
3751
3774
  xs.push(Number(args[0]));
@@ -3772,7 +3795,7 @@ function guide(svg, id, axis) {
3772
3795
  }
3773
3796
  function enumerateBundleSymbols(paths, readText) {
3774
3797
  const table = {};
3775
- for (const contentsPath of paths.filter((path15) => baseOf(path15) === "Contents.json")) {
3798
+ for (const contentsPath of paths.filter((path16) => baseOf(path16) === "Contents.json")) {
3776
3799
  const name2 = catalogEntryName(contentsPath, ".symbolset", readText);
3777
3800
  if (name2 === null || name2 in table) continue;
3778
3801
  let symbols;
@@ -3805,8 +3828,8 @@ function enumerateBundleSymbols(paths, readText) {
3805
3828
  viewBox: "0 0 24 24",
3806
3829
  advance,
3807
3830
  box: [12 - advance / 2, 12 - tall / 2, advance, tall],
3808
- layers: d.map((path15) => ({
3809
- d: (0, import_svgpath.default)(path15).abs().scale(scale).translate(translateX, translateY).round(3).toString()
3831
+ layers: d.map((path16) => ({
3832
+ d: (0, import_svgpath.default)(path16).abs().scale(scale).translate(translateX, translateY).round(3).toString()
3810
3833
  }))
3811
3834
  };
3812
3835
  }
@@ -3816,7 +3839,7 @@ function enumerateBundleJson(paths) {
3816
3839
  const found = [];
3817
3840
  const seen = /* @__PURE__ */ new Set();
3818
3841
  const ordered = [...paths].filter(
3819
- (path15) => path15.split("/").includes("Resources") && path15.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path15) === ".json" || extOf(path15) === ".xcstrings")
3842
+ (path16) => path16.split("/").includes("Resources") && path16.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path16) === ".json" || extOf(path16) === ".xcstrings")
3820
3843
  ).sort((a, b) => {
3821
3844
  const aDepth = a.split("/").length;
3822
3845
  const bDepth = b.split("/").length;
@@ -4794,15 +4817,60 @@ function resolveSwiftPackages(options) {
4794
4817
  return result;
4795
4818
  }
4796
4819
 
4820
+ // src/swift-source-file.ts
4821
+ var import_node_fs10 = __toESM(require("node:fs"), 1);
4822
+ var import_node_path11 = __toESM(require("node:path"), 1);
4823
+ function readPackageFile(root, file, maxBytes) {
4824
+ const canonicalRoot = import_node_fs10.default.realpathSync(root);
4825
+ const relative = import_node_path11.default.relative(canonicalRoot, import_node_fs10.default.realpathSync(file));
4826
+ if (relative === ".." || relative.startsWith(`..${import_node_path11.default.sep}`) || import_node_path11.default.isAbsolute(relative)) {
4827
+ throw new Error(`swift input escapes the selected package: ${file}`);
4828
+ }
4829
+ let ancestor = import_node_path11.default.resolve(file);
4830
+ while (ancestor !== canonicalRoot) {
4831
+ if (import_node_fs10.default.lstatSync(ancestor).isSymbolicLink()) {
4832
+ throw new Error(`swift input is a symlink: ${ancestor}`);
4833
+ }
4834
+ const parent = import_node_path11.default.dirname(ancestor);
4835
+ if (parent === ancestor)
4836
+ throw new Error(`swift input escapes the selected package: ${file}`);
4837
+ ancestor = parent;
4838
+ }
4839
+ const expected = import_node_fs10.default.statSync(file);
4840
+ const fd = import_node_fs10.default.openSync(file, import_node_fs10.default.constants.O_RDONLY | import_node_fs10.default.constants.O_NOFOLLOW);
4841
+ try {
4842
+ const stat = import_node_fs10.default.fstatSync(fd);
4843
+ if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
4844
+ throw new Error(`swift input changed while opening: ${file}`);
4845
+ }
4846
+ if (!stat.isFile() || stat.size > maxBytes) {
4847
+ throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
4848
+ }
4849
+ const bytes = Buffer.alloc(stat.size + 1);
4850
+ let offset = 0;
4851
+ while (offset < bytes.length) {
4852
+ const count = import_node_fs10.default.readSync(fd, bytes, offset, bytes.length - offset, null);
4853
+ if (count === 0) break;
4854
+ offset += count;
4855
+ }
4856
+ if (offset !== stat.size || import_node_fs10.default.fstatSync(fd).size !== stat.size) {
4857
+ throw new Error(`swift input changed while reading: ${file}`);
4858
+ }
4859
+ return bytes.subarray(0, offset);
4860
+ } finally {
4861
+ import_node_fs10.default.closeSync(fd);
4862
+ }
4863
+ }
4864
+
4797
4865
  // src/swift-standins.ts
4798
4866
  var import_node_child_process7 = require("node:child_process");
4799
4867
  var import_node_crypto6 = require("node:crypto");
4800
- var import_node_fs11 = __toESM(require("node:fs"), 1);
4868
+ var import_node_fs12 = __toESM(require("node:fs"), 1);
4801
4869
  var import_node_os7 = __toESM(require("node:os"), 1);
4802
- var import_node_path11 = __toESM(require("node:path"), 1);
4870
+ var import_node_path12 = __toESM(require("node:path"), 1);
4803
4871
 
4804
4872
  // src/cli-version.ts
4805
- var import_node_fs10 = require("node:fs");
4873
+ var import_node_fs11 = require("node:fs");
4806
4874
  var import_node_url = require("node:url");
4807
4875
 
4808
4876
  // src/public-brand.ts
@@ -4831,7 +4899,7 @@ function getCliVersion() {
4831
4899
  ];
4832
4900
  for (const resolve2 of candidates) {
4833
4901
  try {
4834
- const version = JSON.parse((0, import_node_fs10.readFileSync)(resolve2(), "utf8")).version;
4902
+ const version = JSON.parse((0, import_node_fs11.readFileSync)(resolve2(), "utf8")).version;
4835
4903
  if (typeof version === "string" && version) {
4836
4904
  cached = version;
4837
4905
  return cached;
@@ -4901,7 +4969,7 @@ var witnessKey = (symbol) => `${symbol.kind.identifier.startsWith("swift.type.")
4901
4969
  var sideLeaf = (symbol) => `${symbol.kind.identifier.startsWith("swift.type.") ? "type" : "instance"}|leaf|${leaf(symbol)}`;
4902
4970
  var isObjC = (symbol) => symbol.identifier.precise.startsWith("c:");
4903
4971
  var synthesizedEquality = (symbol, conforms) => conforms.includes("Hashable") ? ["==(_:_:)", "hash(into:)", "hashValue"].includes(leaf(symbol)) : conforms.includes("Equatable") && leaf(symbol) === "==(_:_:)";
4904
- var trap = (path15) => `fatalError("${path15} is a binary framework peach cannot run")`;
4972
+ var trap = (path16) => `fatalError("${path16} is a binary framework peach cannot run")`;
4905
4973
  function emitSwiftStandin(graphs, options) {
4906
4974
  const skipped = [];
4907
4975
  const behavior = options.behavior ?? /* @__PURE__ */ new Map();
@@ -5038,10 +5106,10 @@ function emitSwiftStandin(graphs, options) {
5038
5106
  owners.push(...physical.map(() => current));
5039
5107
  };
5040
5108
  const scoped = (body) => (symbol, ...rest) => {
5041
- const path15 = pathOf(symbol);
5042
- if (omit.has(path15)) return void skipped.push({ path: path15, reason: omit.get(path15) });
5109
+ const path16 = pathOf(symbol);
5110
+ if (omit.has(path16)) return void skipped.push({ path: path16, reason: omit.get(path16) });
5043
5111
  const previous = current;
5044
- current = path15;
5112
+ current = path16;
5045
5113
  try {
5046
5114
  body(symbol, ...rest);
5047
5115
  } finally {
@@ -5061,14 +5129,14 @@ function emitSwiftStandin(graphs, options) {
5061
5129
  const access = (symbol, openOwner) => symbol.accessLevel === "open" && openOwner ? "open" : "public";
5062
5130
  const emitMember = scoped(
5063
5131
  (member, indent, context) => {
5064
- const path15 = pathOf(member);
5132
+ const path16 = pathOf(member);
5065
5133
  if (TYPE_KINDS.has(member.kind.identifier)) {
5066
5134
  emitType(member, indent);
5067
5135
  return;
5068
5136
  }
5069
5137
  if (member.kind.identifier === "swift.enum.case") return;
5070
5138
  if (!MEMBER_KINDS.has(member.kind.identifier)) {
5071
- skipped.push({ path: path15, reason: `unhandled ${member.kind.identifier}` });
5139
+ skipped.push({ path: path16, reason: `unhandled ${member.kind.identifier}` });
5072
5140
  return;
5073
5141
  }
5074
5142
  const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(member));
@@ -5082,12 +5150,12 @@ function emitSwiftStandin(graphs, options) {
5082
5150
  const final = context.inClass && flags.has("final") ? "final " : "";
5083
5151
  const mutating = flags.has("mutating") ? "mutating " : flags.has("nonmutating") ? "nonmutating " : "";
5084
5152
  let core = `${flags.has("convenience") ? "convenience " : ""}${modifiers[2]}`;
5085
- const override = context.inClass && !options.plain?.has(path15) && (flags.has("override") || overrides.has(member.identifier.precise) || options.forcedOverride?.has(path15) || isObjC(member) && path15.endsWith(".init()")) ? "override " : "";
5153
+ const override = context.inClass && !options.plain?.has(path16) && (flags.has("override") || overrides.has(member.identifier.precise) || options.forcedOverride?.has(path16) || isObjC(member) && path16.endsWith(".init()")) ? "override " : "";
5086
5154
  const head = `${indent}${attrs}${access(member, context.openOwner)} ${required ? "required " : ""}${final}${override}${mutating}`;
5087
- const measured = behavior.get(path15);
5088
- if (measured) used.add(path15);
5155
+ const measured = behavior.get(path16);
5156
+ if (measured) used.add(path16);
5089
5157
  const overloadBody = /\basync\b/.test(core) ? measured?.asyncBody : /\bResult</.test(core) ? measured?.resultBody : void 0;
5090
- const body = overloadBody ?? measured?.body ?? trap(path15);
5158
+ const body = overloadBody ?? measured?.body ?? trap(path16);
5091
5159
  switch (member.kind.identifier) {
5092
5160
  case "swift.property":
5093
5161
  case "swift.type.property":
@@ -5108,7 +5176,7 @@ function emitSwiftStandin(graphs, options) {
5108
5176
  return;
5109
5177
  }
5110
5178
  emit(
5111
- `${head}${computed} { get${effects} { ${body} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? trap(path15)} }` : ""} }`
5179
+ `${head}${computed} { get${effects} { ${body} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? trap(path16)} }` : ""} }`
5112
5180
  );
5113
5181
  return;
5114
5182
  }
@@ -5161,7 +5229,7 @@ function emitSwiftStandin(graphs, options) {
5161
5229
  };
5162
5230
  const emitType = scoped(
5163
5231
  (symbol, indent) => {
5164
- const path15 = pathOf(symbol);
5232
+ const path16 = pathOf(symbol);
5165
5233
  const id = symbol.identifier.precise;
5166
5234
  const inner = `${indent} `;
5167
5235
  switch (symbol.kind.identifier) {
@@ -5173,10 +5241,10 @@ function emitSwiftStandin(graphs, options) {
5173
5241
  case "swift.class": {
5174
5242
  const shape = header(symbol, "class", indent);
5175
5243
  if (!shape)
5176
- return void skipped.push({ path: path15, reason: `unparsed class ${text(symbol)}` });
5177
- const parent = options.superclasses?.get(path15) ?? superclass.get(id);
5244
+ return void skipped.push({ path: path16, reason: `unparsed class ${text(symbol)}` });
5245
+ const parent = options.superclasses?.get(path16) ?? superclass.get(id);
5178
5246
  const blocked = classBlocked(id);
5179
- if (blocked) return void skipped.push({ path: path15, reason: blocked });
5247
+ if (blocked) return void skipped.push({ path: path16, reason: blocked });
5180
5248
  const ancestors = /* @__PURE__ */ new Set();
5181
5249
  for (let at = superId.get(id); at; at = superId.get(at))
5182
5250
  for (const name2 of conforms.get(at) ?? []) ancestors.add(name2);
@@ -5192,9 +5260,9 @@ function emitSwiftStandin(graphs, options) {
5192
5260
  `${indent}${shape.attrs}${open ? "open" : "public"} class ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${selfConforming(shape.where)} {`
5193
5261
  );
5194
5262
  const members = membersOf(id);
5195
- const extra = options.behavior?.get(path15)?.members;
5263
+ const extra = options.behavior?.get(path16)?.members;
5196
5264
  if (extra) {
5197
- used.add(path15);
5265
+ used.add(path16);
5198
5266
  emit(`${inner}${extra}`);
5199
5267
  }
5200
5268
  for (const member of members)
@@ -5247,13 +5315,13 @@ function emitSwiftStandin(graphs, options) {
5247
5315
  continue;
5248
5316
  have.add(witnessKey(member));
5249
5317
  have.add(sideLeaf(member));
5250
- emitWitness(member, inner, path15);
5318
+ emitWitness(member, inner, path16);
5251
5319
  }
5252
5320
  }
5253
5321
  const coder = members.some((member) => leaf(member) === "init(coder:)");
5254
5322
  if (designated && !coder && externalRoot(id) !== "NSObject" && externalRoot(id) !== null)
5255
5323
  emit(
5256
- `${inner}public required init?(coder: NSCoder) { ${trap(`${path15}.init(coder:)`)} }`
5324
+ `${inner}public required init?(coder: NSCoder) { ${trap(`${path16}.init(coder:)`)} }`
5257
5325
  );
5258
5326
  emit(`${indent}}`);
5259
5327
  return;
@@ -5261,7 +5329,7 @@ function emitSwiftStandin(graphs, options) {
5261
5329
  case "swift.struct": {
5262
5330
  const shape = header(symbol, "struct", indent);
5263
5331
  if (!shape)
5264
- return void skipped.push({ path: path15, reason: `unparsed struct ${text(symbol)}` });
5332
+ return void skipped.push({ path: path16, reason: `unparsed struct ${text(symbol)}` });
5265
5333
  const members = membersOf(id);
5266
5334
  const raw2 = rawType(members);
5267
5335
  const list2 = inheritance(id);
@@ -5312,7 +5380,7 @@ function emitSwiftStandin(graphs, options) {
5312
5380
  case "swift.enum": {
5313
5381
  const shape = header(symbol, "enum", indent);
5314
5382
  if (!shape)
5315
- return void skipped.push({ path: path15, reason: `unparsed enum ${text(symbol)}` });
5383
+ return void skipped.push({ path: path16, reason: `unparsed enum ${text(symbol)}` });
5316
5384
  const members = membersOf(id);
5317
5385
  const raw2 = rawType(members);
5318
5386
  const cases = (children.get(id) ?? []).filter(
@@ -5321,7 +5389,7 @@ function emitSwiftStandin(graphs, options) {
5321
5389
  const missing = raw2 ? cases.filter((member) => !values.has(member.identifier.precise)) : [];
5322
5390
  if (raw2 && isObjC(symbol) && missing.length > 0)
5323
5391
  return void skipped.push({
5324
- path: path15,
5392
+ path: path16,
5325
5393
  reason: `no header value for ${missing.map(leaf).join(", ")}`
5326
5394
  });
5327
5395
  const list2 = inheritance(id, raw2 ?? void 0).filter(
@@ -5362,7 +5430,7 @@ function emitSwiftStandin(graphs, options) {
5362
5430
  const shape = header(symbol, "protocol", indent);
5363
5431
  if (!shape)
5364
5432
  return void skipped.push({
5365
- path: path15,
5433
+ path: path16,
5366
5434
  reason: `unparsed protocol ${text(symbol)}`
5367
5435
  });
5368
5436
  const list2 = [...isObjC(symbol) ? ["AnyObject"] : [], ...inheritance(id)];
@@ -5387,7 +5455,7 @@ function emitSwiftStandin(graphs, options) {
5387
5455
  }
5388
5456
  emit(`${indent}}`);
5389
5457
  if (defaults.length > 0) {
5390
- emit(`${indent}extension ${path15} {`);
5458
+ emit(`${indent}extension ${path16} {`);
5391
5459
  for (const member of defaults) {
5392
5460
  const decl = text(member);
5393
5461
  if (optional.has(member.identifier.precise) && member.kind.identifier === "swift.method" && !decl.replace(/\([^)]*\)/g, "").includes("->") && !/ async\b/.test(decl))
@@ -5434,7 +5502,7 @@ function emitSwiftStandin(graphs, options) {
5434
5502
  return init ? /rawValue:\s*([^)]+)\)/.exec(text(init))?.[1]?.trim() ?? null : null;
5435
5503
  };
5436
5504
  const emitGlobal = scoped((symbol) => {
5437
- const path15 = pathOf(symbol);
5505
+ const path16 = pathOf(symbol);
5438
5506
  const kind = symbol.kind.identifier;
5439
5507
  if (kind === "swift.func" || kind === "swift.func.op" || kind === "swift.method" || kind === "swift.type.method") {
5440
5508
  const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(symbol));
@@ -5445,17 +5513,17 @@ function emitSwiftStandin(graphs, options) {
5445
5513
  if (fix && !/^(?:prefix|infix|postfix)\b/.test(spelled))
5446
5514
  spelled = `${fix} ${spelled}`;
5447
5515
  }
5448
- emit(`${attrs}public ${spelled} { ${trap(path15)} }`);
5516
+ emit(`${attrs}public ${spelled} { ${trap(path16)} }`);
5449
5517
  } else if (kind === "swift.var") {
5450
5518
  const parsed = splitAccessors(text(symbol).replace(/^let /, "var "));
5451
- const measured = behavior.get(path15);
5452
- if (measured) used.add(path15);
5453
- emit(`public ${parsed.decl} { ${measured?.body ?? trap(path15)} }`);
5454
- } else skipped.push({ path: path15, reason: `unhandled top-level ${kind}` });
5519
+ const measured = behavior.get(path16);
5520
+ if (measured) used.add(path16);
5521
+ emit(`public ${parsed.decl} { ${measured?.body ?? trap(path16)} }`);
5522
+ } else skipped.push({ path: path16, reason: `unhandled top-level ${kind}` });
5455
5523
  });
5456
5524
  const roots = [...byId.values()].filter((symbol) => !owner.has(symbol.identifier.precise) && !unavailable(symbol)).sort((a, b) => pathOf(a).localeCompare(pathOf(b)));
5457
5525
  for (const symbol of roots) {
5458
- const path15 = pathOf(symbol);
5526
+ const path16 = pathOf(symbol);
5459
5527
  if (TYPE_KINDS.has(symbol.kind.identifier)) emitType(symbol, "");
5460
5528
  else emitGlobal(symbol);
5461
5529
  }
@@ -5497,9 +5565,9 @@ function emitSwiftStandin(graphs, options) {
5497
5565
  ...imports.map((name2) => `import ${name2}`),
5498
5566
  ""
5499
5567
  ];
5500
- for (const path15 of behavior.keys())
5501
- if (!used.has(path15))
5502
- skipped.push({ path: path15, reason: "behavior names no emitted declaration" });
5568
+ for (const path16 of behavior.keys())
5569
+ if (!used.has(path16))
5570
+ skipped.push({ path: path16, reason: "behavior names no emitted declaration" });
5503
5571
  return {
5504
5572
  source: `${[...banner, ...lines].join("\n")}
5505
5573
  `,
@@ -5574,7 +5642,7 @@ function stripDefaults(decl) {
5574
5642
 
5575
5643
  // src/swift-standins.ts
5576
5644
  var TRIPLE = "wasm32-unknown-wasip1";
5577
- var cacheDir3 = import_node_path11.default.join(import_node_os7.default.tmpdir(), "peach-swift-standins");
5645
+ var cacheDir3 = import_node_path12.default.join(import_node_os7.default.tmpdir(), "peach-swift-standins");
5578
5646
  function exec(file, args, cwd) {
5579
5647
  return (0, import_node_child_process7.execFileSync)(file, args, {
5580
5648
  cwd,
@@ -5594,15 +5662,15 @@ var digests = /* @__PURE__ */ new Map();
5594
5662
  function treeDigest(root) {
5595
5663
  const names = [];
5596
5664
  const walk2 = (dir) => {
5597
- for (const entry of import_node_fs11.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
5598
- const full = import_node_path11.default.join(dir, entry.name);
5665
+ for (const entry of import_node_fs12.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
5666
+ const full = import_node_path12.default.join(dir, entry.name);
5599
5667
  if (entry.isDirectory()) walk2(full);
5600
- else if (entry.isFile()) names.push(import_node_path11.default.relative(root, full));
5668
+ else if (entry.isFile()) names.push(import_node_path12.default.relative(root, full));
5601
5669
  }
5602
5670
  };
5603
5671
  walk2(root);
5604
5672
  const stamp = names.map((name2) => {
5605
- const stat = import_node_fs11.default.statSync(import_node_path11.default.join(root, name2));
5673
+ const stat = import_node_fs12.default.statSync(import_node_path12.default.join(root, name2));
5606
5674
  return `${name2}\0${stat.size}:${stat.mtimeMs}`;
5607
5675
  }).join("\n");
5608
5676
  const memo2 = digests.get(`tree\0${root}`);
@@ -5610,7 +5678,7 @@ function treeDigest(root) {
5610
5678
  const hash = (0, import_node_crypto6.createHash)("sha256");
5611
5679
  for (const name2 of names) {
5612
5680
  hash.update(`${name2}\0`);
5613
- hash.update(import_node_fs11.default.readFileSync(import_node_path11.default.join(root, name2)));
5681
+ hash.update(import_node_fs12.default.readFileSync(import_node_path12.default.join(root, name2)));
5614
5682
  hash.update("\0");
5615
5683
  }
5616
5684
  const digest = hash.digest("hex");
@@ -5619,9 +5687,9 @@ function treeDigest(root) {
5619
5687
  }
5620
5688
  function locateXcframework(tree) {
5621
5689
  const find = (root, depth) => {
5622
- for (const entry of import_node_fs11.default.readdirSync(root, { withFileTypes: true })) {
5690
+ for (const entry of import_node_fs12.default.readdirSync(root, { withFileTypes: true })) {
5623
5691
  if (!entry.isDirectory() || entry.name === "__MACOSX") continue;
5624
- const full = import_node_path11.default.join(root, entry.name);
5692
+ const full = import_node_path12.default.join(root, entry.name);
5625
5693
  if (entry.name.endsWith(".xcframework")) return full;
5626
5694
  const nested = depth > 0 ? find(full, depth - 1) : null;
5627
5695
  if (nested) return nested;
@@ -5636,67 +5704,67 @@ function xcframework(binary) {
5636
5704
  if (binary.url && (!binary.checksum || !/^[a-f0-9]{64}$/i.test(binary.checksum)))
5637
5705
  throw new Error("remote binary archive requires its Package.swift SHA-256 checksum");
5638
5706
  const expected = binary.checksum?.toLowerCase();
5639
- const dir = import_node_path11.default.join(cacheDir3, "archives", key(binary.url ? expected : binary.dir));
5640
- const archive = import_node_path11.default.join(dir, "archive.zip");
5641
- const fingerprint = import_node_path11.default.join(dir, ".fingerprint");
5707
+ const dir = import_node_path12.default.join(cacheDir3, "archives", key(binary.url ? expected : binary.dir));
5708
+ const archive = import_node_path12.default.join(dir, "archive.zip");
5709
+ const fingerprint = import_node_path12.default.join(dir, ".fingerprint");
5642
5710
  const stored = (() => {
5643
5711
  try {
5644
- const parsed = JSON.parse(import_node_fs11.default.readFileSync(fingerprint, "utf8"));
5712
+ const parsed = JSON.parse(import_node_fs12.default.readFileSync(fingerprint, "utf8"));
5645
5713
  return parsed && typeof parsed === "object" && "sha" in parsed ? parsed : null;
5646
5714
  } catch {
5647
5715
  return null;
5648
5716
  }
5649
5717
  })();
5650
5718
  if (!binary.url) {
5651
- const stat = import_node_fs11.default.statSync(binary.dir);
5719
+ const stat = import_node_fs12.default.statSync(binary.dir);
5652
5720
  const stamp = `${stat.size}:${stat.mtimeMs}`;
5653
5721
  if (stored?.stamp === stamp) {
5654
- const found3 = locateXcframework(import_node_path11.default.join(dir, "tree"));
5722
+ const found3 = locateXcframework(import_node_path12.default.join(dir, "tree"));
5655
5723
  if (found3) return { dir: found3, digest: stored.sha };
5656
5724
  }
5657
- const sha2 = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs11.default.readFileSync(binary.dir)).digest("hex");
5658
- if (sha2 !== stored?.sha || !locateXcframework(import_node_path11.default.join(dir, "tree"))) {
5659
- import_node_fs11.default.rmSync(dir, { recursive: true, force: true });
5660
- import_node_fs11.default.mkdirSync(import_node_path11.default.join(dir, "tree"), { recursive: true });
5661
- exec("unzip", ["-q", binary.dir, "-d", import_node_path11.default.join(dir, "tree")]);
5725
+ const sha2 = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs12.default.readFileSync(binary.dir)).digest("hex");
5726
+ if (sha2 !== stored?.sha || !locateXcframework(import_node_path12.default.join(dir, "tree"))) {
5727
+ import_node_fs12.default.rmSync(dir, { recursive: true, force: true });
5728
+ import_node_fs12.default.mkdirSync(import_node_path12.default.join(dir, "tree"), { recursive: true });
5729
+ exec("unzip", ["-q", binary.dir, "-d", import_node_path12.default.join(dir, "tree")]);
5662
5730
  }
5663
- import_node_fs11.default.writeFileSync(fingerprint, JSON.stringify({ stamp, sha: sha2 }));
5664
- const found2 = locateXcframework(import_node_path11.default.join(dir, "tree"));
5731
+ import_node_fs12.default.writeFileSync(fingerprint, JSON.stringify({ stamp, sha: sha2 }));
5732
+ const found2 = locateXcframework(import_node_path12.default.join(dir, "tree"));
5665
5733
  if (!found2) throw new Error("its archive holds no .xcframework");
5666
5734
  return { dir: found2, digest: sha2 };
5667
5735
  }
5668
- if (stored && import_node_fs11.default.existsSync(archive)) {
5669
- const sha2 = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs11.default.readFileSync(archive)).digest("hex");
5736
+ if (stored && import_node_fs12.default.existsSync(archive)) {
5737
+ const sha2 = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs12.default.readFileSync(archive)).digest("hex");
5670
5738
  if (sha2 !== expected)
5671
5739
  throw new Error(`archive checksum ${sha2} is not the declared checksum ${expected}`);
5672
- const found2 = locateXcframework(import_node_path11.default.join(dir, "tree"));
5740
+ const found2 = locateXcframework(import_node_path12.default.join(dir, "tree"));
5673
5741
  if (found2) return { dir: found2, digest: sha2 };
5674
5742
  }
5675
- import_node_fs11.default.rmSync(dir, { recursive: true, force: true });
5676
- import_node_fs11.default.mkdirSync(import_node_path11.default.join(dir, "tree"), { recursive: true });
5743
+ import_node_fs12.default.rmSync(dir, { recursive: true, force: true });
5744
+ import_node_fs12.default.mkdirSync(import_node_path12.default.join(dir, "tree"), { recursive: true });
5677
5745
  exec("curl", ["-fsSL", "--retry", "2", "-o", archive, binary.url]);
5678
- const sha = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs11.default.readFileSync(archive)).digest("hex");
5746
+ const sha = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs12.default.readFileSync(archive)).digest("hex");
5679
5747
  if (sha !== expected) {
5680
- import_node_fs11.default.rmSync(dir, { recursive: true, force: true });
5748
+ import_node_fs12.default.rmSync(dir, { recursive: true, force: true });
5681
5749
  throw new Error(`archive checksum ${sha} is not the declared checksum ${expected}`);
5682
5750
  }
5683
- exec("unzip", ["-q", archive, "-d", import_node_path11.default.join(dir, "tree")]);
5684
- import_node_fs11.default.writeFileSync(fingerprint, JSON.stringify({ sha }));
5685
- const found = locateXcframework(import_node_path11.default.join(dir, "tree"));
5751
+ exec("unzip", ["-q", archive, "-d", import_node_path12.default.join(dir, "tree")]);
5752
+ import_node_fs12.default.writeFileSync(fingerprint, JSON.stringify({ sha }));
5753
+ const found = locateXcframework(import_node_path12.default.join(dir, "tree"));
5686
5754
  if (!found) throw new Error("its archive holds no .xcframework");
5687
5755
  return { dir: found, digest: sha };
5688
5756
  }
5689
- var files = (dir, test) => import_node_fs11.default.existsSync(dir) ? import_node_fs11.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => test(import_node_path11.default.basename(file))).sort() : [];
5757
+ var files = (dir, test) => import_node_fs12.default.existsSync(dir) ? import_node_fs12.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => test(import_node_path12.default.basename(file))).sort() : [];
5690
5758
  function surfaces(xcframeworkDir) {
5691
- const slice = import_node_fs11.default.readdirSync(xcframeworkDir).filter((name2) => /^ios-.+-simulator$/.test(name2)).sort()[0];
5759
+ const slice = import_node_fs12.default.readdirSync(xcframeworkDir).filter((name2) => /^ios-.+-simulator$/.test(name2)).sort()[0];
5692
5760
  if (!slice) throw new Error("it has no iOS simulator slice");
5693
- const root = import_node_path11.default.join(xcframeworkDir, slice);
5761
+ const root = import_node_path12.default.join(xcframeworkDir, slice);
5694
5762
  const found = [];
5695
- for (const entry of import_node_fs11.default.readdirSync(root).sort()) {
5763
+ for (const entry of import_node_fs12.default.readdirSync(root).sort()) {
5696
5764
  if (!entry.endsWith(".framework")) continue;
5697
5765
  const module2 = entry.slice(0, -".framework".length);
5698
- const framework = import_node_path11.default.join(root, entry);
5699
- const swiftmodule = import_node_path11.default.join(framework, "Modules", `${module2}.swiftmodule`);
5766
+ const framework = import_node_path12.default.join(root, entry);
5767
+ const swiftmodule = import_node_path12.default.join(framework, "Modules", `${module2}.swiftmodule`);
5700
5768
  const interfaces = files(
5701
5769
  swiftmodule,
5702
5770
  (name2) => name2.endsWith(".swiftinterface") && !name2.endsWith(".private.swiftinterface") && !name2.endsWith(".package.swiftinterface")
@@ -5706,41 +5774,41 @@ function surfaces(xcframeworkDir) {
5706
5774
  found.push({
5707
5775
  kind: "swift",
5708
5776
  module: module2,
5709
- interface: import_node_path11.default.join(swiftmodule, chosen)
5777
+ interface: import_node_path12.default.join(swiftmodule, chosen)
5710
5778
  });
5711
5779
  continue;
5712
5780
  }
5713
- const modulemap = import_node_path11.default.join(framework, "Modules", "module.modulemap");
5714
- if (import_node_fs11.default.existsSync(modulemap))
5781
+ const modulemap = import_node_path12.default.join(framework, "Modules", "module.modulemap");
5782
+ if (import_node_fs12.default.existsSync(modulemap))
5715
5783
  found.push({
5716
5784
  kind: "c",
5717
5785
  module: module2,
5718
5786
  modulemap,
5719
- headers: import_node_path11.default.join(framework, "Headers")
5787
+ headers: import_node_path12.default.join(framework, "Headers")
5720
5788
  });
5721
5789
  }
5722
- const headers = import_node_path11.default.join(root, "Headers");
5790
+ const headers = import_node_path12.default.join(root, "Headers");
5723
5791
  for (const map of files(headers, (name2) => name2 === "module.modulemap")) {
5724
- const modulemap = import_node_path11.default.join(headers, map);
5725
- const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs11.default.readFileSync(modulemap, "utf8"))?.[1];
5792
+ const modulemap = import_node_path12.default.join(headers, map);
5793
+ const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs12.default.readFileSync(modulemap, "utf8"))?.[1];
5726
5794
  if (module2) found.push({ kind: "c", module: module2, modulemap, headers });
5727
5795
  }
5728
5796
  return found;
5729
5797
  }
5730
5798
  function peachModuleDirs(toolchain, imports) {
5731
5799
  const { moduleRoot, toolchainBin } = toolchain;
5732
- if (swiftDistributionAt(moduleRoot)) return [import_node_path11.default.join(moduleRoot, "modules")];
5800
+ if (swiftDistributionAt(moduleRoot)) return [import_node_path12.default.join(moduleRoot, "modules")];
5733
5801
  const peach = new Set(swiftPeachModules(moduleRoot));
5734
5802
  const plugins = swiftMacroPlugins(moduleRoot);
5735
5803
  if (plugins.stale)
5736
5804
  exec("sh", [
5737
- import_node_path11.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
5805
+ import_node_path12.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
5738
5806
  toolchainBin,
5739
5807
  plugins.libraries[0]
5740
5808
  ]);
5741
5809
  for (const target of imports.filter((name2) => peach.has(name2)))
5742
5810
  exec(
5743
- import_node_path11.default.join(toolchainBin, "swift"),
5811
+ import_node_path12.default.join(toolchainBin, "swift"),
5744
5812
  [
5745
5813
  "build",
5746
5814
  "--swift-sdk",
@@ -5760,7 +5828,7 @@ function peachModuleDirs(toolchain, imports) {
5760
5828
  ],
5761
5829
  moduleRoot
5762
5830
  );
5763
- return [import_node_path11.default.join(moduleRoot, ".build", TRIPLE, "release", "Modules")];
5831
+ return [import_node_path12.default.join(moduleRoot, ".build", TRIPLE, "release", "Modules")];
5764
5832
  }
5765
5833
  function swiftInterfaceForWasm(text3) {
5766
5834
  return text3.replace(
@@ -5772,11 +5840,11 @@ function swiftInterfaceForWasm(text3) {
5772
5840
  );
5773
5841
  }
5774
5842
  function swiftStandin(surface, binary, toolchain, work) {
5775
- const text3 = swiftInterfaceForWasm(import_node_fs11.default.readFileSync(surface.interface, "utf8"));
5776
- const search = import_node_path11.default.join(work, "interfaces");
5777
- const moduleDir = import_node_path11.default.join(search, `${surface.module}.swiftmodule`);
5778
- import_node_fs11.default.mkdirSync(moduleDir, { recursive: true });
5779
- import_node_fs11.default.writeFileSync(import_node_path11.default.join(moduleDir, `${TRIPLE}.swiftinterface`), text3);
5843
+ const text3 = swiftInterfaceForWasm(import_node_fs12.default.readFileSync(surface.interface, "utf8"));
5844
+ const search = import_node_path12.default.join(work, "interfaces");
5845
+ const moduleDir = import_node_path12.default.join(search, `${surface.module}.swiftmodule`);
5846
+ import_node_fs12.default.mkdirSync(moduleDir, { recursive: true });
5847
+ import_node_fs12.default.writeFileSync(import_node_path12.default.join(moduleDir, `${TRIPLE}.swiftinterface`), text3);
5780
5848
  const imports = [
5781
5849
  ...text3.matchAll(
5782
5850
  /^(?:@_exported[ \t]+)?import[ \t]+(?:(?:struct|class|enum|protocol|typealias|func|var|let)[ \t]+)?(\w+)/gm
@@ -5788,9 +5856,9 @@ function swiftStandin(surface, binary, toolchain, work) {
5788
5856
  );
5789
5857
  const target = ["-target", TRIPLE, "-sdk", sysroot, "-resource-dir", resources];
5790
5858
  const peach = peachModuleDirs(toolchain, imports).flatMap((dir) => ["-I", dir]);
5791
- const out = import_node_path11.default.join(work, "graphs");
5792
- import_node_fs11.default.mkdirSync(out, { recursive: true });
5793
- exec(import_node_path11.default.join(toolchain.toolchainBin, "swift-symbolgraph-extract"), [
5859
+ const out = import_node_path12.default.join(work, "graphs");
5860
+ import_node_fs12.default.mkdirSync(out, { recursive: true });
5861
+ exec(import_node_path12.default.join(toolchain.toolchainBin, "swift-symbolgraph-extract"), [
5794
5862
  "-module-name",
5795
5863
  surface.module,
5796
5864
  ...target,
@@ -5804,10 +5872,10 @@ function swiftStandin(surface, binary, toolchain, work) {
5804
5872
  "-output-dir",
5805
5873
  out
5806
5874
  ]);
5807
- const graphs = import_node_fs11.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs11.default.readFileSync(import_node_path11.default.join(out, name2), "utf8")));
5875
+ const graphs = import_node_fs12.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs12.default.readFileSync(import_node_path12.default.join(out, name2), "utf8")));
5808
5876
  const omit = /* @__PURE__ */ new Map();
5809
5877
  const plain = /* @__PURE__ */ new Set();
5810
- const file = import_node_path11.default.join(work, `${surface.module}.swift`);
5878
+ const file = import_node_path12.default.join(work, `${surface.module}.swift`);
5811
5879
  for (; ; ) {
5812
5880
  const { source, owners } = emitSwiftStandin(graphs, {
5813
5881
  module: surface.module,
@@ -5815,9 +5883,9 @@ function swiftStandin(surface, binary, toolchain, work) {
5815
5883
  omit,
5816
5884
  plain
5817
5885
  });
5818
- import_node_fs11.default.writeFileSync(file, source);
5886
+ import_node_fs12.default.writeFileSync(file, source);
5819
5887
  const check = (0, import_node_child_process7.spawnSync)(
5820
- import_node_path11.default.join(toolchain.toolchainBin, "swiftc"),
5888
+ import_node_path12.default.join(toolchain.toolchainBin, "swiftc"),
5821
5889
  [
5822
5890
  "-typecheck",
5823
5891
  "-parse-as-library",
@@ -5967,21 +6035,21 @@ function splitDeclarators(statement, names) {
5967
6035
  }
5968
6036
  function cStandin(surface, binary, toolchain, work) {
5969
6037
  const named = [
5970
- ...import_node_fs11.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
6038
+ ...import_node_fs12.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
5971
6039
  ].map((match) => match[1]);
5972
6040
  const headers = files(surface.headers, (name2) => name2.endsWith(".h"));
5973
6041
  const texts = new Map(
5974
6042
  headers.map((file) => [
5975
6043
  file,
5976
- import_node_fs11.default.readFileSync(import_node_path11.default.join(surface.headers, file), "utf8")
6044
+ import_node_fs12.default.readFileSync(import_node_path12.default.join(surface.headers, file), "utf8")
5977
6045
  ])
5978
6046
  );
5979
6047
  const objc = headers.find((file) => OBJC.test(texts.get(file)));
5980
6048
  if (objc) throw new Error(`its header ${objc} is Objective-C`);
5981
- const include = import_node_path11.default.join(work, "include");
6049
+ const include = import_node_path12.default.join(work, "include");
5982
6050
  for (const [file, text3] of texts) {
5983
- import_node_fs11.default.mkdirSync(import_node_path11.default.dirname(import_node_path11.default.join(include, file)), { recursive: true });
5984
- import_node_fs11.default.writeFileSync(import_node_path11.default.join(include, file), text3);
6051
+ import_node_fs12.default.mkdirSync(import_node_path12.default.dirname(import_node_path12.default.join(include, file)), { recursive: true });
6052
+ import_node_fs12.default.writeFileSync(import_node_path12.default.join(include, file), text3);
5985
6053
  }
5986
6054
  const roots = named.length > 0 ? named : headers;
5987
6055
  const modulemap = `module ${surface.module} {
@@ -5989,12 +6057,12 @@ ${roots.map((file) => ` header "${file}"
5989
6057
  `).join("")} export *
5990
6058
  }
5991
6059
  `;
5992
- const probe = import_node_path11.default.join(work, "declarations.c");
5993
- import_node_fs11.default.writeFileSync(probe, roots.map((file) => `#include "${file}"
6060
+ const probe = import_node_path12.default.join(work, "declarations.c");
6061
+ import_node_fs12.default.writeFileSync(probe, roots.map((file) => `#include "${file}"
5994
6062
  `).join(""));
5995
6063
  const { sysroot } = swiftSdkPaths(toolchain.moduleRoot, toolchain.toolchainBin);
5996
6064
  const ast = JSON.parse(
5997
- exec(import_node_path11.default.join(toolchain.toolchainBin, "clang"), [
6065
+ exec(import_node_path12.default.join(toolchain.toolchainBin, "clang"), [
5998
6066
  "-target",
5999
6067
  TRIPLE,
6000
6068
  "--sysroot",
@@ -6007,7 +6075,7 @@ ${roots.map((file) => ` header "${file}"
6007
6075
  probe
6008
6076
  ])
6009
6077
  );
6010
- const byPath = new Map(headers.map((file) => [import_node_path11.default.join(include, file), file]));
6078
+ const byPath = new Map(headers.map((file) => [import_node_path12.default.join(include, file), file]));
6011
6079
  const declarations = functionDeclarations(ast, new Set(byPath.keys()));
6012
6080
  const groups = /* @__PURE__ */ new Map();
6013
6081
  for (const declaration of declarations) {
@@ -6054,10 +6122,10 @@ ${roots.map((file) => ` header "${file}"
6054
6122
  "",
6055
6123
  ...definitions
6056
6124
  ].join("\n");
6057
- const out = import_node_path11.default.join(work, `${surface.module}.c`);
6058
- import_node_fs11.default.writeFileSync(out, source);
6125
+ const out = import_node_path12.default.join(work, `${surface.module}.c`);
6126
+ import_node_fs12.default.writeFileSync(out, source);
6059
6127
  try {
6060
- exec(import_node_path11.default.join(toolchain.toolchainBin, "clang"), [
6128
+ exec(import_node_path12.default.join(toolchain.toolchainBin, "clang"), [
6061
6129
  "-target",
6062
6130
  TRIPLE,
6063
6131
  "--sysroot",
@@ -6139,25 +6207,25 @@ function binaryStandins(binary, toolchain, provided) {
6139
6207
  for (const file of surface.kind === "swift" ? [surface.interface] : [
6140
6208
  surface.modulemap,
6141
6209
  ...files(surface.headers, (name2) => name2.endsWith(".h")).map(
6142
- (file2) => import_node_path11.default.join(surface.headers, file2)
6210
+ (file2) => import_node_path12.default.join(surface.headers, file2)
6143
6211
  )
6144
6212
  ])
6145
- hash.update(import_node_fs11.default.readFileSync(file));
6213
+ hash.update(import_node_fs12.default.readFileSync(file));
6146
6214
  }
6147
6215
  const id = hash.digest("hex").slice(0, 32);
6148
6216
  const memo2 = built.get(id);
6149
6217
  if (memo2) return memo2;
6150
- const cached2 = import_node_path11.default.join(cacheDir3, "standins", `${id}.json`);
6151
- if (import_node_fs11.default.existsSync(cached2)) {
6152
- const value = JSON.parse(import_node_fs11.default.readFileSync(cached2, "utf8"));
6218
+ const cached2 = import_node_path12.default.join(cacheDir3, "standins", `${id}.json`);
6219
+ if (import_node_fs12.default.existsSync(cached2)) {
6220
+ const value = JSON.parse(import_node_fs12.default.readFileSync(cached2, "utf8"));
6153
6221
  built.set(id, value);
6154
6222
  return value;
6155
6223
  }
6156
- const work = import_node_fs11.default.mkdtempSync(import_node_path11.default.join(import_node_os7.default.tmpdir(), "peach-standin-"));
6224
+ const work = import_node_fs12.default.mkdtempSync(import_node_path12.default.join(import_node_os7.default.tmpdir(), "peach-standin-"));
6157
6225
  let result;
6158
6226
  try {
6159
6227
  result = found.map((surface) => {
6160
- const dir = import_node_path11.default.join(work, surface.module);
6228
+ const dir = import_node_path12.default.join(work, surface.module);
6161
6229
  try {
6162
6230
  return surface.kind === "swift" ? swiftStandin(surface, binary, toolchain, dir) : cStandin(surface, binary, toolchain, dir);
6163
6231
  } catch (error) {
@@ -6166,13 +6234,13 @@ function binaryStandins(binary, toolchain, provided) {
6166
6234
  );
6167
6235
  }
6168
6236
  });
6169
- import_node_fs11.default.mkdirSync(import_node_path11.default.dirname(cached2), { recursive: true });
6170
- import_node_fs11.default.writeFileSync(cached2, JSON.stringify(result));
6237
+ import_node_fs12.default.mkdirSync(import_node_path12.default.dirname(cached2), { recursive: true });
6238
+ import_node_fs12.default.writeFileSync(cached2, JSON.stringify(result));
6171
6239
  built.set(id, result);
6172
6240
  } catch (error) {
6173
6241
  result = error instanceof Error ? error.message : String(error);
6174
6242
  } finally {
6175
- import_node_fs11.default.rmSync(work, { recursive: true, force: true });
6243
+ import_node_fs12.default.rmSync(work, { recursive: true, force: true });
6176
6244
  }
6177
6245
  return result;
6178
6246
  }
@@ -6314,12 +6382,12 @@ async function compileSwiftProject(submit, work, origin, signal) {
6314
6382
  }
6315
6383
 
6316
6384
  // src/xcode-project.ts
6317
- var import_node_fs12 = __toESM(require("node:fs"), 1);
6318
- var import_node_path13 = __toESM(require("node:path"), 1);
6385
+ var import_node_fs13 = __toESM(require("node:fs"), 1);
6386
+ var import_node_path14 = __toESM(require("node:path"), 1);
6319
6387
  var import_plist = __toESM(require_plist(), 1);
6320
6388
 
6321
6389
  // src/xcode-json-project.ts
6322
- var import_node_path12 = __toESM(require("node:path"), 1);
6390
+ var import_node_path13 = __toESM(require("node:path"), 1);
6323
6391
  var import_json5 = __toESM(require_lib(), 1);
6324
6392
  var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
6325
6393
  var text2 = (value) => typeof value === "string" ? value : void 0;
@@ -6335,7 +6403,7 @@ var PHASE_ISA = {
6335
6403
  function readXcodeJsonProject(xcodeproj, source) {
6336
6404
  const json = import_json5.default.parse(source);
6337
6405
  if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
6338
- const projectDir = import_node_path12.default.dirname(xcodeproj);
6406
+ const projectDir = import_node_path13.default.dirname(xcodeproj);
6339
6407
  const objects = {};
6340
6408
  let next = 0;
6341
6409
  const add = (entry, id) => {
@@ -6348,7 +6416,7 @@ function readXcodeJsonProject(xcodeproj, source) {
6348
6416
  const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
6349
6417
  if (base) {
6350
6418
  if (base[1] === "PROJECT")
6351
- return { sourceTree: "<absolute>", path: import_node_path12.default.join(projectDir, base[2]) };
6419
+ return { sourceTree: "<absolute>", path: import_node_path13.default.join(projectDir, base[2]) };
6352
6420
  if (base[1] === "PRODUCTS")
6353
6421
  return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
6354
6422
  return null;
@@ -6356,7 +6424,7 @@ function readXcodeJsonProject(xcodeproj, source) {
6356
6424
  const unescaped = raw2.replaceAll("\\<", "<");
6357
6425
  if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
6358
6426
  if (unescaped.startsWith("~")) return null;
6359
- return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path12.default.join(groupDir, unescaped) };
6427
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path13.default.join(groupDir, unescaped) };
6360
6428
  };
6361
6429
  const memberships = [];
6362
6430
  const folders = [];
@@ -6367,7 +6435,7 @@ function readXcodeJsonProject(xcodeproj, source) {
6367
6435
  const kind = text2(entry.kind) ?? "file-reference";
6368
6436
  const raw2 = text2(entry.path) ?? "";
6369
6437
  const located = raw2 === "" ? null : locate(raw2, parent.dir);
6370
- const name2 = text2(entry.name) ?? import_node_path12.default.basename(raw2);
6438
+ const name2 = text2(entry.name) ?? import_node_path13.default.basename(raw2);
6371
6439
  const node = { id: "", name: name2, dir: null, parent, children: [] };
6372
6440
  if (kind === "group" || kind === "variant-group" || kind === "version-group") {
6373
6441
  node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
@@ -6482,7 +6550,7 @@ function readXcodeJsonProject(xcodeproj, source) {
6482
6550
  if (!isObject(entry)) continue;
6483
6551
  const repository = text2(entry.repository);
6484
6552
  const local = text2(entry.path);
6485
- const name2 = local !== void 0 ? import_node_path12.default.basename(import_node_path12.default.resolve(import_node_path12.default.dirname(xcodeproj), local)) : import_node_path12.default.basename(repository ?? "").replace(/\.git$/, "");
6553
+ const name2 = local !== void 0 ? import_node_path13.default.basename(import_node_path13.default.resolve(import_node_path13.default.dirname(xcodeproj), local)) : import_node_path13.default.basename(repository ?? "").replace(/\.git$/, "");
6486
6554
  const id = text2(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
6487
6555
  packageIds.set(name2.toLowerCase(), id);
6488
6556
  }
@@ -6759,28 +6827,28 @@ var CONDITIONS = {
6759
6827
  variant: "normal"
6760
6828
  };
6761
6829
  function walkFiles(dir) {
6762
- if (!import_node_fs12.default.existsSync(dir)) return [];
6830
+ if (!import_node_fs13.default.existsSync(dir)) return [];
6763
6831
  const out = [];
6764
- for (const entry of import_node_fs12.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
6832
+ for (const entry of import_node_fs13.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
6765
6833
  if (entry.name.startsWith(".")) continue;
6766
- const full = import_node_path13.default.join(dir, entry.name);
6834
+ const full = import_node_path14.default.join(dir, entry.name);
6767
6835
  if (entry.isDirectory()) out.push(...walkFiles(full));
6768
6836
  else if (entry.isFile()) out.push(full);
6769
6837
  }
6770
6838
  return out;
6771
6839
  }
6772
- var isDirectory = (dir) => import_node_fs12.default.existsSync(dir) && import_node_fs12.default.statSync(dir).isDirectory();
6840
+ var isDirectory = (dir) => import_node_fs13.default.existsSync(dir) && import_node_fs13.default.statSync(dir).isDirectory();
6773
6841
  function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
6774
- if (seen.has(file) || !import_node_fs12.default.existsSync(file)) return {};
6842
+ if (seen.has(file) || !import_node_fs13.default.existsSync(file)) return {};
6775
6843
  seen.add(file);
6776
6844
  const settings = {};
6777
- for (const raw2 of import_node_fs12.default.readFileSync(file, "utf8").split("\n")) {
6845
+ for (const raw2 of import_node_fs13.default.readFileSync(file, "utf8").split("\n")) {
6778
6846
  const line = raw2.replace(/\/\/.*$/, "").trim();
6779
6847
  const include = /^#include\??\s+"([^"]+)"/.exec(line);
6780
6848
  if (include) {
6781
6849
  Object.assign(
6782
6850
  settings,
6783
- readXcconfig(import_node_path13.default.resolve(import_node_path13.default.dirname(file), include[1]), seen)
6851
+ readXcconfig(import_node_path14.default.resolve(import_node_path14.default.dirname(file), include[1]), seen)
6784
6852
  );
6785
6853
  continue;
6786
6854
  }
@@ -6830,22 +6898,22 @@ function decodeXml(text3) {
6830
6898
  return text3.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
6831
6899
  }
6832
6900
  function workspaceReferences(workspace) {
6833
- const data = import_node_path13.default.join(workspace, "contents.xcworkspacedata");
6834
- if (!import_node_fs12.default.existsSync(data))
6901
+ const data = import_node_path14.default.join(workspace, "contents.xcworkspacedata");
6902
+ if (!import_node_fs13.default.existsSync(data))
6835
6903
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
6836
- const container = import_node_path13.default.dirname(workspace);
6904
+ const container = import_node_path14.default.dirname(workspace);
6837
6905
  const locate = (location, base) => {
6838
6906
  const colon = location.indexOf(":");
6839
6907
  const kind = location.slice(0, colon);
6840
6908
  const rest = location.slice(colon + 1);
6841
- if (kind === "group") return import_node_path13.default.resolve(base, rest);
6842
- if (kind === "container" || kind === "self") return import_node_path13.default.resolve(container, rest);
6843
- if (kind === "absolute") return import_node_path13.default.resolve(rest);
6844
- throw new Error(`${import_node_path13.default.basename(workspace)} has an unsupported location ${location}`);
6909
+ if (kind === "group") return import_node_path14.default.resolve(base, rest);
6910
+ if (kind === "container" || kind === "self") return import_node_path14.default.resolve(container, rest);
6911
+ if (kind === "absolute") return import_node_path14.default.resolve(rest);
6912
+ throw new Error(`${import_node_path14.default.basename(workspace)} has an unsupported location ${location}`);
6845
6913
  };
6846
6914
  const groups = [container];
6847
6915
  const references = [];
6848
- for (const [, closing, tag, attributes, selfClosing] of import_node_fs12.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
6916
+ for (const [, closing, tag, attributes, selfClosing] of import_node_fs13.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
6849
6917
  if (closing) {
6850
6918
  if (tag === "Group") groups.pop();
6851
6919
  continue;
@@ -6861,8 +6929,8 @@ function workspaceReferences(workspace) {
6861
6929
  var loaded = /* @__PURE__ */ new Map();
6862
6930
  function xcodeProjectFile(xcodeproj) {
6863
6931
  for (const name2 of ["project.pbxproj", "project.xcproj"]) {
6864
- const file = import_node_path13.default.join(xcodeproj, name2);
6865
- if (import_node_fs12.default.existsSync(file)) return file;
6932
+ const file = import_node_path14.default.join(xcodeproj, name2);
6933
+ if (import_node_fs13.default.existsSync(file)) return file;
6866
6934
  }
6867
6935
  return null;
6868
6936
  }
@@ -6870,10 +6938,10 @@ function loadProject(xcodeproj) {
6870
6938
  const projectFile = xcodeProjectFile(xcodeproj);
6871
6939
  if (!projectFile)
6872
6940
  throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
6873
- const mtimeMs = import_node_fs12.default.statSync(projectFile).mtimeMs;
6941
+ const mtimeMs = import_node_fs13.default.statSync(projectFile).mtimeMs;
6874
6942
  const cached2 = loaded.get(projectFile);
6875
6943
  if (cached2?.mtimeMs === mtimeMs) return cached2.project;
6876
- const source = import_node_fs12.default.readFileSync(projectFile, "utf8");
6944
+ const source = import_node_fs13.default.readFileSync(projectFile, "utf8");
6877
6945
  const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
6878
6946
  if (!isDict(root) || !isDict(root.objects)) {
6879
6947
  throw new Error(`${projectFile} has no objects table`);
@@ -6887,8 +6955,8 @@ function loadProject(xcodeproj) {
6887
6955
  if (!project || project.isa !== "PBXProject") {
6888
6956
  throw new Error(`${projectFile} has no PBXProject root`);
6889
6957
  }
6890
- const projectDir = import_node_fs12.default.realpathSync(
6891
- import_node_path13.default.resolve(import_node_path13.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
6958
+ const projectDir = import_node_fs13.default.realpathSync(
6959
+ import_node_path14.default.resolve(import_node_path14.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
6892
6960
  );
6893
6961
  const parent = /* @__PURE__ */ new Map();
6894
6962
  for (const [id, entry] of Object.entries(objects)) {
@@ -6906,11 +6974,11 @@ function loadProject(xcodeproj) {
6906
6974
  const own = str(entry.path) ?? "";
6907
6975
  const tree = str(entry.sourceTree) ?? "<group>";
6908
6976
  if (tree === "<absolute>") result2 = own;
6909
- else if (tree === "SOURCE_ROOT") result2 = import_node_path13.default.join(projectDir, own);
6977
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path14.default.join(projectDir, own);
6910
6978
  else if (tree === "<group>") {
6911
6979
  const up = parent.get(id);
6912
6980
  const base = up ? resolvePath(up) : projectDir;
6913
- result2 = base === null ? null : import_node_path13.default.join(base, own);
6981
+ result2 = base === null ? null : import_node_path14.default.join(base, own);
6914
6982
  }
6915
6983
  }
6916
6984
  resolvedPaths.set(id, result2);
@@ -7010,7 +7078,7 @@ function targetMembers(ref) {
7010
7078
  const addResource = (file) => {
7011
7079
  if (isDirectory(file)) {
7012
7080
  for (const inner of walkFiles(file)) resources.add(inner);
7013
- } else if (import_node_fs12.default.existsSync(file)) resources.add(file);
7081
+ } else if (import_node_fs13.default.existsSync(file)) resources.add(file);
7014
7082
  };
7015
7083
  const fileRefPaths = (refId) => {
7016
7084
  const entry = project.object(refId);
@@ -7031,7 +7099,7 @@ function targetMembers(ref) {
7031
7099
  for (const buildFileId of list(phase.files)) {
7032
7100
  for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
7033
7101
  if (phase.isa === "PBXSourcesBuildPhase") {
7034
- if (!import_node_fs12.default.existsSync(file)) continue;
7102
+ if (!import_node_fs13.default.existsSync(file)) continue;
7035
7103
  allSources.add(file);
7036
7104
  if (file.endsWith(".swift")) sources.add(file);
7037
7105
  } else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
@@ -7039,7 +7107,7 @@ function targetMembers(ref) {
7039
7107
  }
7040
7108
  }
7041
7109
  const addSynchronized = (folder, relative) => {
7042
- const file = import_node_path13.default.join(folder, relative);
7110
+ const file = import_node_path14.default.join(folder, relative);
7043
7111
  if (NEVER_MEMBER.test(relative)) return;
7044
7112
  if (file.endsWith(".swift")) {
7045
7113
  if (!relative.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
@@ -7064,7 +7132,7 @@ function targetMembers(ref) {
7064
7132
  }
7065
7133
  if (owned.has(groupId)) {
7066
7134
  for (const file of walkFiles(folder)) {
7067
- const relative = import_node_path13.default.relative(folder, file).split(import_node_path13.default.sep).join("/");
7135
+ const relative = import_node_path14.default.relative(folder, file).split(import_node_path14.default.sep).join("/");
7068
7136
  if ([...exceptions].some(
7069
7137
  (exception) => relative === exception || relative.startsWith(`${exception}/`)
7070
7138
  ))
@@ -7073,14 +7141,14 @@ function targetMembers(ref) {
7073
7141
  }
7074
7142
  } else {
7075
7143
  for (const relative of exceptions) {
7076
- const file = import_node_path13.default.join(folder, relative);
7144
+ const file = import_node_path14.default.join(folder, relative);
7077
7145
  if (isDirectory(file)) {
7078
7146
  for (const inner of walkFiles(file))
7079
7147
  addSynchronized(
7080
7148
  folder,
7081
- import_node_path13.default.relative(folder, inner).split(import_node_path13.default.sep).join("/")
7149
+ import_node_path14.default.relative(folder, inner).split(import_node_path14.default.sep).join("/")
7082
7150
  );
7083
- } else if (import_node_fs12.default.existsSync(file)) addSynchronized(folder, relative);
7151
+ } else if (import_node_fs13.default.existsSync(file)) addSynchronized(folder, relative);
7084
7152
  }
7085
7153
  }
7086
7154
  }
@@ -7093,8 +7161,8 @@ function targetMembers(ref) {
7093
7161
  function commonAncestor(dirs) {
7094
7162
  let common = dirs[0];
7095
7163
  for (const dir of dirs) {
7096
- while (common !== import_node_path13.default.dirname(common) && import_node_path13.default.relative(common, dir).startsWith(".."))
7097
- common = import_node_path13.default.dirname(common);
7164
+ while (common !== import_node_path14.default.dirname(common) && import_node_path14.default.relative(common, dir).startsWith(".."))
7165
+ common = import_node_path14.default.dirname(common);
7098
7166
  }
7099
7167
  return common;
7100
7168
  }
@@ -7103,8 +7171,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
7103
7171
  const projects2 = [];
7104
7172
  const projectAt = /* @__PURE__ */ new Map();
7105
7173
  const addProject = (xcodeproj) => {
7106
- const key2 = import_node_path13.default.resolve(xcodeproj);
7107
- if (projectAt.has(key2) || key2.split(import_node_path13.default.sep).includes("Pods")) return;
7174
+ const key2 = import_node_path14.default.resolve(xcodeproj);
7175
+ if (projectAt.has(key2) || key2.split(import_node_path14.default.sep).includes("Pods")) return;
7108
7176
  if (!xcodeProjectFile(key2)) return;
7109
7177
  const project = loadProject(key2);
7110
7178
  projectAt.set(key2, project);
@@ -7121,7 +7189,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
7121
7189
  for (const reference of listed)
7122
7190
  if (reference.endsWith(".xcodeproj")) addProject(reference);
7123
7191
  if (projects2.length === 0) {
7124
- throw new Error(`${import_node_path13.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
7192
+ throw new Error(`${import_node_path14.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
7125
7193
  }
7126
7194
  return { listed, projects: projects2, projectAt };
7127
7195
  }
@@ -7143,7 +7211,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7143
7211
  const allTargets = projects2.flatMap(nativeTargets);
7144
7212
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
7145
7213
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
7146
- const container = import_node_path13.default.basename(xcodeprojOrWorkspace);
7214
+ const container = import_node_path14.default.basename(xcodeprojOrWorkspace);
7147
7215
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
7148
7216
  if (named.length !== 1) {
7149
7217
  throw new Error(
@@ -7155,14 +7223,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7155
7223
  for (const ref of allTargets) {
7156
7224
  const product = ref.project.object(str(ref.target.productReference));
7157
7225
  const file = str(product?.path);
7158
- if (file && !byProduct.has(import_node_path13.default.basename(file)))
7159
- byProduct.set(import_node_path13.default.basename(file), ref);
7226
+ if (file && !byProduct.has(import_node_path14.default.basename(file)))
7227
+ byProduct.set(import_node_path14.default.basename(file), ref);
7160
7228
  }
7161
7229
  const proxied = (project, proxyId) => {
7162
7230
  const proxy = project.object(proxyId);
7163
7231
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
7164
7232
  const portal = str(proxy.containerPortal);
7165
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path13.default.resolve(project.resolvePath(portal ?? "") ?? ""));
7233
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path14.default.resolve(project.resolvePath(portal ?? "") ?? ""));
7166
7234
  const remote = str(proxy.remoteGlobalIDString);
7167
7235
  if (!owner || !remote) return void 0;
7168
7236
  return nativeTargets(owner).find(
@@ -7183,7 +7251,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7183
7251
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
7184
7252
  for (const buildFileId of list(phase.files)) {
7185
7253
  const file = project.object(str(project.object(buildFileId)?.fileRef));
7186
- const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path13.default.basename(str(file.path) ?? "")) : void 0;
7254
+ const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path14.default.basename(str(file.path) ?? "")) : void 0;
7187
7255
  if (resolved) found.push(resolved);
7188
7256
  }
7189
7257
  }
@@ -7204,7 +7272,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7204
7272
  const name2 = str(ref.target.name) ?? ref.id;
7205
7273
  const { get: settings2, keys } = targetSettings(ref, {
7206
7274
  TARGET_NAME: name2,
7207
- PROJECT_NAME: import_node_path13.default.basename(ref.project.xcodeproj, ".xcodeproj"),
7275
+ PROJECT_NAME: import_node_path14.default.basename(ref.project.xcodeproj, ".xcodeproj"),
7208
7276
  SRCROOT: ref.project.projectDir,
7209
7277
  SOURCE_ROOT: ref.project.projectDir,
7210
7278
  PROJECT_DIR: ref.project.projectDir,
@@ -7235,8 +7303,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7235
7303
  }
7236
7304
  return value;
7237
7305
  };
7238
- const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path13.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
7239
- const sourceInfo = infoPlistFile ? import_plist.default.parse(import_node_fs12.default.readFileSync(infoPlistFile, "utf8")) : {};
7306
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path14.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
7307
+ const sourceInfo = infoPlistFile ? import_plist.default.parse(import_node_fs13.default.readFileSync(infoPlistFile, "utf8")) : {};
7240
7308
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
7241
7309
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
7242
7310
  }
@@ -7254,12 +7322,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7254
7322
  };
7255
7323
  }
7256
7324
  const localPackageDirs = [
7257
- ...listed.filter((reference) => import_node_fs12.default.existsSync(import_node_path13.default.join(reference, "Package.swift"))),
7325
+ ...listed.filter((reference) => import_node_fs13.default.existsSync(import_node_path14.default.join(reference, "Package.swift"))),
7258
7326
  ...projects2.flatMap(
7259
7327
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
7260
7328
  if (!isDict(entry)) return [];
7261
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path13.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
7262
- return candidate && import_node_fs12.default.existsSync(import_node_path13.default.join(candidate, "Package.swift")) ? [candidate] : [];
7329
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path14.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
7330
+ return candidate && import_node_fs13.default.existsSync(import_node_path14.default.join(candidate, "Package.swift")) ? [candidate] : [];
7263
7331
  })
7264
7332
  )
7265
7333
  ];
@@ -7283,7 +7351,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7283
7351
  product,
7284
7352
  source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
7285
7353
  kind: "local",
7286
- dir: import_node_path13.default.resolve(
7354
+ dir: import_node_path14.default.resolve(
7287
7355
  project.projectDir,
7288
7356
  str(reference.relativePath) ?? ""
7289
7357
  )
@@ -7305,8 +7373,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7305
7373
  }
7306
7374
  }
7307
7375
  }
7308
- const resolvedFile = import_node_path13.default.join(
7309
- workspace ?? import_node_path13.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
7376
+ const resolvedFile = import_node_path14.default.join(
7377
+ workspace ?? import_node_path14.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
7310
7378
  "xcshareddata",
7311
7379
  "swiftpm",
7312
7380
  "Package.resolved"
@@ -7316,13 +7384,13 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7316
7384
  ...module2,
7317
7385
  rootDir: commonAncestor(
7318
7386
  [
7319
- workspace ? import_node_path13.default.dirname(workspace) : app.project.projectDir,
7387
+ workspace ? import_node_path14.default.dirname(workspace) : app.project.projectDir,
7320
7388
  ...used.map((project) => project.projectDir),
7321
7389
  ...localPackageDirs,
7322
7390
  ...linkedProducts.flatMap(
7323
- ({ source }) => source.kind === "local" && import_node_fs12.default.existsSync(source.dir) ? [source.dir] : []
7391
+ ({ source }) => source.kind === "local" && import_node_fs13.default.existsSync(source.dir) ? [source.dir] : []
7324
7392
  )
7325
- ].map((dir) => import_node_fs12.default.realpathSync(dir))
7393
+ ].map((dir) => import_node_fs13.default.realpathSync(dir))
7326
7394
  ),
7327
7395
  projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
7328
7396
  infoPlist: import_plist.default.build(info),
@@ -7330,10 +7398,10 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7330
7398
  frameworks,
7331
7399
  linkedProducts,
7332
7400
  localPackageDirs: [
7333
- ...new Set(localPackageDirs.map((dir) => import_node_fs12.default.realpathSync(dir)))
7401
+ ...new Set(localPackageDirs.map((dir) => import_node_fs13.default.realpathSync(dir)))
7334
7402
  ].sort(),
7335
7403
  binaryFrameworks: [...binaryFrameworks].sort(),
7336
- packageResolved: import_node_fs12.default.existsSync(resolvedFile) ? resolvedFile : null,
7404
+ packageResolved: import_node_fs13.default.existsSync(resolvedFile) ? resolvedFile : null,
7337
7405
  appTargets: appTargetNames
7338
7406
  };
7339
7407
  }
@@ -7352,17 +7420,17 @@ var SKIP_SOURCE_DIRS = /* @__PURE__ */ new Set([
7352
7420
  var NATIVE_DESCRIPTOR = ".one-native-source.json";
7353
7421
  var NATIVE_GLUE = ".one-native-source.swift.txt";
7354
7422
  function swiftPackageId(packagePath) {
7355
- return import_node_path14.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
7423
+ return import_node_path15.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
7356
7424
  }
7357
7425
  function nativeSourceDescriptor(packagePath) {
7358
- packagePath = import_node_fs13.default.realpathSync(packagePath);
7359
- const file = import_node_path14.default.join(packagePath, NATIVE_DESCRIPTOR);
7360
- if (!import_node_fs13.default.existsSync(file)) return null;
7426
+ packagePath = import_node_fs14.default.realpathSync(packagePath);
7427
+ const file = import_node_path15.default.join(packagePath, NATIVE_DESCRIPTOR);
7428
+ if (!import_node_fs14.default.existsSync(file)) return null;
7361
7429
  const value = JSON.parse(
7362
7430
  readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
7363
7431
  );
7364
7432
  const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
7365
- if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs13.default.existsSync(import_node_path14.default.join(packagePath, NATIVE_GLUE))) {
7433
+ if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs14.default.existsSync(import_node_path15.default.join(packagePath, NATIVE_GLUE))) {
7366
7434
  throw invalid();
7367
7435
  }
7368
7436
  if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
@@ -7374,7 +7442,7 @@ var SwiftMissingModulesError = class extends Error {
7374
7442
  };
7375
7443
  var projects = /* @__PURE__ */ new Map();
7376
7444
  function projectFor(packagePath, hosted) {
7377
- packagePath = import_node_fs13.default.realpathSync(packagePath);
7445
+ packagePath = import_node_fs14.default.realpathSync(packagePath);
7378
7446
  const existing = projects.get(packagePath);
7379
7447
  if (existing) {
7380
7448
  if (hosted && !existing.hosted) {
@@ -7396,14 +7464,14 @@ function projectFor(packagePath, hosted) {
7396
7464
  }
7397
7465
  var xcodeProjects = /* @__PURE__ */ new Map();
7398
7466
  function swiftPackages(entry, app) {
7399
- const stamp = (file) => file && import_node_fs13.default.existsSync(file) ? import_node_fs13.default.statSync(file).mtimeMs : 0;
7467
+ const stamp = (file) => file && import_node_fs14.default.existsSync(file) ? import_node_fs14.default.statSync(file).mtimeMs : 0;
7400
7468
  const key2 = JSON.stringify([
7401
7469
  app.linkedProducts,
7402
7470
  app.packageResolved,
7403
7471
  stamp(app.packageResolved),
7404
- app.localPackageDirs.map((dir) => stamp(import_node_path14.default.join(dir, "Package.swift"))),
7472
+ app.localPackageDirs.map((dir) => stamp(import_node_path15.default.join(dir, "Package.swift"))),
7405
7473
  app.linkedProducts.map(
7406
- ({ source }) => source.kind === "local" ? stamp(import_node_path14.default.join(source.dir, "Package.swift")) : 0
7474
+ ({ source }) => source.kind === "local" ? stamp(import_node_path15.default.join(source.dir, "Package.swift")) : 0
7407
7475
  )
7408
7476
  ]);
7409
7477
  let cached2 = entry.packages;
@@ -7454,11 +7522,11 @@ var XCODE_APP_DIR = "__app__";
7454
7522
  var XCODE_FRAMEWORKS_DIR = "__frameworks__";
7455
7523
  var XCODE_PACKAGES_DIR = "__packages__";
7456
7524
  var XCODE_STANDINS_DIR = "__standins__";
7457
- var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep)}/`;
7525
+ var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)}/`;
7458
7526
  function xcodeInputKey(layout, file, relative) {
7459
7527
  const owner = layout.targetDirs.get(file);
7460
- if (owner) return import_node_path14.default.posix.join(owner, relative);
7461
- return relative.startsWith(CHECKOUTS_PREFIX) ? import_node_path14.default.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length)) : relative;
7528
+ if (owner) return import_node_path15.default.posix.join(owner, relative);
7529
+ return relative.startsWith(CHECKOUTS_PREFIX) ? import_node_path15.default.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length)) : relative;
7462
7530
  }
7463
7531
  function xcodeLayout(root) {
7464
7532
  const registered = xcodeProjects.get(root);
@@ -7469,7 +7537,7 @@ function xcodeLayout(root) {
7469
7537
  const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
7470
7538
  const targets = [];
7471
7539
  for (const framework of app.frameworks) {
7472
- const dir = import_node_path14.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
7540
+ const dir = import_node_path15.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
7473
7541
  for (const file of framework.sources) {
7474
7542
  if (targetDirs.has(file)) continue;
7475
7543
  targetDirs.set(file, dir);
@@ -7489,7 +7557,7 @@ function xcodeLayout(root) {
7489
7557
  for (const standin of standins)
7490
7558
  targets.push({
7491
7559
  name: standin.module,
7492
- path: import_node_path14.default.posix.join(XCODE_STANDINS_DIR, standin.module),
7560
+ path: import_node_path15.default.posix.join(XCODE_STANDINS_DIR, standin.module),
7493
7561
  executable: false,
7494
7562
  resources: false,
7495
7563
  exclude: [],
@@ -7497,19 +7565,19 @@ function xcodeLayout(root) {
7497
7565
  mainActorIsolation: false
7498
7566
  });
7499
7567
  for (const target of packages.targets) {
7500
- const relative = import_node_path14.default.relative(
7501
- target.remote ? import_node_path14.default.join(root, REMOTE_CHECKOUTS) : root,
7568
+ const relative = import_node_path15.default.relative(
7569
+ target.remote ? import_node_path15.default.join(root, REMOTE_CHECKOUTS) : root,
7502
7570
  target.dir
7503
7571
  );
7504
- if (relative === ".." || relative.startsWith(`..${import_node_path14.default.sep}`) || import_node_path14.default.isAbsolute(relative))
7572
+ if (relative === ".." || relative.startsWith(`..${import_node_path15.default.sep}`) || import_node_path15.default.isAbsolute(relative))
7505
7573
  throw new Error(`swift input escapes the selected package: ${target.dir}`);
7506
- const posix = relative.split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep);
7574
+ const posix = relative.split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
7507
7575
  targets.push({
7508
7576
  ...target,
7509
- path: target.remote ? import_node_path14.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
7577
+ path: target.remote ? import_node_path15.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
7510
7578
  exclude: []
7511
7579
  });
7512
- if (!target.remote) files2.add(import_node_path14.default.join(target.packageDir, "Package.swift"));
7580
+ if (!target.remote) files2.add(import_node_path15.default.join(target.packageDir, "Package.swift"));
7513
7581
  for (const file of target.files) files2.add(file);
7514
7582
  }
7515
7583
  for (const target of targets) {
@@ -7539,25 +7607,25 @@ function xcodeManifest(layout) {
7539
7607
  ].join("\n");
7540
7608
  }
7541
7609
  function packageFiles(root) {
7542
- const canonicalRoot = import_node_fs13.default.realpathSync(root);
7610
+ const canonicalRoot = import_node_fs14.default.realpathSync(root);
7543
7611
  const xcode = xcodeLayout(canonicalRoot);
7544
7612
  return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
7545
7613
  }
7546
7614
  function sourceTreeFiles(dir, canonicalRoot) {
7547
7615
  const found = [];
7548
7616
  const walk2 = (dir2) => {
7549
- for (const entry of import_node_fs13.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
7617
+ for (const entry of import_node_fs14.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
7550
7618
  if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
7551
7619
  continue;
7552
- const full = import_node_path14.default.join(dir2, entry.name);
7620
+ const full = import_node_path15.default.join(dir2, entry.name);
7553
7621
  if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
7554
- const real = import_node_fs13.default.realpathSync(full);
7555
- const relative = import_node_path14.default.relative(canonicalRoot, real);
7556
- if (relative.startsWith(`..${import_node_path14.default.sep}`) || relative === ".." || import_node_path14.default.isAbsolute(relative)) {
7622
+ const real = import_node_fs14.default.realpathSync(full);
7623
+ const relative = import_node_path15.default.relative(canonicalRoot, real);
7624
+ if (relative.startsWith(`..${import_node_path15.default.sep}`) || relative === ".." || import_node_path15.default.isAbsolute(relative)) {
7557
7625
  throw new Error(`swift input escapes the selected package: ${full}`);
7558
7626
  }
7559
7627
  if (entry.isDirectory()) {
7560
- if (import_node_fs13.default.existsSync(import_node_path14.default.join(full, "Package.swift"))) continue;
7628
+ if (import_node_fs14.default.existsSync(import_node_path15.default.join(full, "Package.swift"))) continue;
7561
7629
  walk2(full);
7562
7630
  } else if (entry.isFile()) {
7563
7631
  found.push(full);
@@ -7565,56 +7633,15 @@ function sourceTreeFiles(dir, canonicalRoot) {
7565
7633
  }
7566
7634
  }
7567
7635
  };
7568
- if (import_node_fs13.default.existsSync(dir)) walk2(import_node_fs13.default.realpathSync(dir));
7636
+ if (import_node_fs14.default.existsSync(dir)) walk2(import_node_fs14.default.realpathSync(dir));
7569
7637
  return found;
7570
7638
  }
7571
- function readPackageFile(root, file, maxBytes) {
7572
- const canonicalRoot = import_node_fs13.default.realpathSync(root);
7573
- const relative = import_node_path14.default.relative(canonicalRoot, import_node_fs13.default.realpathSync(file));
7574
- if (relative === ".." || relative.startsWith(`..${import_node_path14.default.sep}`) || import_node_path14.default.isAbsolute(relative)) {
7575
- throw new Error(`swift input escapes the selected package: ${file}`);
7576
- }
7577
- let ancestor = import_node_path14.default.resolve(file);
7578
- while (ancestor !== canonicalRoot) {
7579
- if (import_node_fs13.default.lstatSync(ancestor).isSymbolicLink()) {
7580
- throw new Error(`swift input is a symlink: ${ancestor}`);
7581
- }
7582
- const parent = import_node_path14.default.dirname(ancestor);
7583
- if (parent === ancestor)
7584
- throw new Error(`swift input escapes the selected package: ${file}`);
7585
- ancestor = parent;
7586
- }
7587
- const expected = import_node_fs13.default.statSync(file);
7588
- const fd = import_node_fs13.default.openSync(file, import_node_fs13.default.constants.O_RDONLY | import_node_fs13.default.constants.O_NOFOLLOW);
7589
- try {
7590
- const stat = import_node_fs13.default.fstatSync(fd);
7591
- if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
7592
- throw new Error(`swift input changed while opening: ${file}`);
7593
- }
7594
- if (!stat.isFile() || stat.size > maxBytes) {
7595
- throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
7596
- }
7597
- const bytes = Buffer.alloc(stat.size + 1);
7598
- let offset = 0;
7599
- while (offset < bytes.length) {
7600
- const count = import_node_fs13.default.readSync(fd, bytes, offset, bytes.length - offset, null);
7601
- if (count === 0) break;
7602
- offset += count;
7603
- }
7604
- if (offset !== stat.size || import_node_fs13.default.fstatSync(fd).size !== stat.size) {
7605
- throw new Error(`swift input changed while reading: ${file}`);
7606
- }
7607
- return bytes.subarray(0, offset);
7608
- } finally {
7609
- import_node_fs13.default.closeSync(fd);
7610
- }
7611
- }
7612
7639
  function sourceFiles(root) {
7613
7640
  return packageFiles(root).filter((file) => file.endsWith(".swift"));
7614
7641
  }
7615
7642
  function resourceCandidateFiles(root) {
7616
7643
  return packageFiles(root).filter(
7617
- (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path14.default.basename(file))
7644
+ (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path15.default.basename(file))
7618
7645
  );
7619
7646
  }
7620
7647
  var HOSTED_LIMITS = {
@@ -7648,7 +7675,7 @@ function buildSwiftResourceTable(project, baseUrl) {
7648
7675
  const limits = inputLimits(Boolean(project.hosted));
7649
7676
  const absolute = resourceCandidateFiles(project.packagePath);
7650
7677
  const relative = absolute.map(
7651
- (file) => import_node_path14.default.relative(project.packagePath, file).split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep)
7678
+ (file) => import_node_path15.default.relative(project.packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
7652
7679
  );
7653
7680
  const byRelative = new Map(absolute.map((file, index) => [relative[index], file]));
7654
7681
  const readContents = (candidate) => {
@@ -7670,16 +7697,16 @@ function buildSwiftResourceTable(project, baseUrl) {
7670
7697
  for (const { name: name2, file, scale } of found) {
7671
7698
  const disk = byRelative.get(file);
7672
7699
  if (!disk) continue;
7673
- if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs13.default.statSync(disk).size > limits.imageTotalBytes) {
7700
+ if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs14.default.statSync(disk).size > limits.imageTotalBytes) {
7674
7701
  throw new Error("swift image pack exceeds the compile service caps");
7675
7702
  }
7676
7703
  const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
7677
7704
  imageBytes += bytes.length;
7678
7705
  const hash = (0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
7679
- const ext = import_node_path14.default.posix.extname(file).toLowerCase();
7706
+ const ext = import_node_path15.default.posix.extname(file).toLowerCase();
7680
7707
  table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
7681
7708
  images[name2] = {
7682
- file: import_node_path14.default.posix.basename(file),
7709
+ file: import_node_path15.default.posix.basename(file),
7683
7710
  data: bytes.toString("base64")
7684
7711
  };
7685
7712
  watched.push(file);
@@ -7703,10 +7730,10 @@ function buildSwiftResourceTable(project, baseUrl) {
7703
7730
  return { table, images, colors, symbols, watched };
7704
7731
  }
7705
7732
  function buildSwiftBundleFiles(packagePath, hosted) {
7706
- packagePath = import_node_fs13.default.realpathSync(packagePath);
7733
+ packagePath = import_node_fs14.default.realpathSync(packagePath);
7707
7734
  const limits = inputLimits(hosted);
7708
7735
  const relative = resourceCandidateFiles(packagePath).map(
7709
- (file) => import_node_path14.default.relative(packagePath, file).split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep)
7736
+ (file) => import_node_path15.default.relative(packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
7710
7737
  );
7711
7738
  const files2 = {};
7712
7739
  const watched = [];
@@ -7720,13 +7747,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
7720
7747
  total += bytes.length;
7721
7748
  if (xcode.app.infoPlistFile)
7722
7749
  watched.push(
7723
- import_node_path14.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path14.default.sep).join("/")
7750
+ import_node_path15.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path15.default.sep).join("/")
7724
7751
  );
7725
7752
  }
7726
7753
  for (const { base, file } of enumerateBundleJson(relative)) {
7727
7754
  watched.push(file);
7728
- const disk = import_node_path14.default.join(packagePath, ...file.split("/"));
7729
- if (Object.keys(files2).length >= limits.resources || total + import_node_fs13.default.statSync(disk).size > limits.resourceTotalBytes) {
7755
+ const disk = import_node_path15.default.join(packagePath, ...file.split("/"));
7756
+ if (Object.keys(files2).length >= limits.resources || total + import_node_fs14.default.statSync(disk).size > limits.resourceTotalBytes) {
7730
7757
  throw new Error(
7731
7758
  `swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
7732
7759
  );
@@ -7738,12 +7765,12 @@ function buildSwiftBundleFiles(packagePath, hosted) {
7738
7765
  return { files: files2, watched };
7739
7766
  }
7740
7767
  function linkedModuleRoots(packagePath) {
7741
- packagePath = import_node_fs13.default.realpathSync(packagePath);
7768
+ packagePath = import_node_fs14.default.realpathSync(packagePath);
7742
7769
  let manifest;
7743
7770
  try {
7744
7771
  manifest = readPackageFile(
7745
7772
  packagePath,
7746
- import_node_path14.default.join(packagePath, "Package.swift"),
7773
+ import_node_path15.default.join(packagePath, "Package.swift"),
7747
7774
  MAX_SWIFT_COMPILE_SOURCE_BYTES
7748
7775
  ).toString("utf8");
7749
7776
  } catch {
@@ -7752,8 +7779,8 @@ function linkedModuleRoots(packagePath) {
7752
7779
  const roots = /* @__PURE__ */ new Set();
7753
7780
  const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
7754
7781
  for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
7755
- const root = import_node_path14.default.resolve(packagePath, match[1]);
7756
- if (import_node_fs13.default.existsSync(import_node_path14.default.join(root, "Package.swift"))) roots.add(root);
7782
+ const root = import_node_path15.default.resolve(packagePath, match[1]);
7783
+ if (import_node_fs14.default.existsSync(import_node_path15.default.join(root, "Package.swift"))) roots.add(root);
7757
7784
  }
7758
7785
  return [...roots].sort();
7759
7786
  }
@@ -7762,18 +7789,18 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
7762
7789
  hash.update(packagePath);
7763
7790
  const projectInputs = new Set(packageFiles(packagePath));
7764
7791
  for (const file of [...projectInputs].sort()) {
7765
- hash.update(import_node_path14.default.relative(packagePath, file));
7766
- const stat = import_node_fs13.default.statSync(file);
7792
+ hash.update(import_node_path15.default.relative(packagePath, file));
7793
+ const stat = import_node_fs14.default.statSync(file);
7767
7794
  hash.update(`${stat.mtimeMs}/${stat.ctimeMs}/${stat.size}`);
7768
7795
  }
7769
7796
  const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
7770
- (root) => import_node_fs13.default.existsSync(import_node_path14.default.join(root, "toolchain.json"))
7797
+ (root) => import_node_fs14.default.existsSync(import_node_path15.default.join(root, "toolchain.json"))
7771
7798
  );
7772
7799
  if (moduleRoot) {
7773
7800
  hash.update(moduleRoot);
7774
7801
  for (const relative of swiftModuleInputFiles(moduleRoot)) {
7775
7802
  hash.update(relative);
7776
- hash.update(String(import_node_fs13.default.statSync(import_node_path14.default.join(moduleRoot, relative)).mtimeMs));
7803
+ hash.update(String(import_node_fs14.default.statSync(import_node_path15.default.join(moduleRoot, relative)).mtimeMs));
7777
7804
  }
7778
7805
  }
7779
7806
  return hash.digest("hex").slice(0, 16);
@@ -7785,8 +7812,8 @@ function packageSources(packagePath) {
7785
7812
  const xcode = xcodeLayout(packagePath);
7786
7813
  const files2 = {};
7787
7814
  for (const file of sourceFiles(packagePath)) {
7788
- const relative = import_node_path14.default.relative(packagePath, file).split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep);
7789
- if (xcode && import_node_path14.default.basename(file) === "Package.swift") continue;
7815
+ const relative = import_node_path15.default.relative(packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
7816
+ if (xcode && import_node_path15.default.basename(file) === "Package.swift") continue;
7790
7817
  files2[xcode ? xcodeInputKey(xcode, file, relative) : relative] = readPackageFile(
7791
7818
  packagePath,
7792
7819
  file,
@@ -7797,7 +7824,7 @@ function packageSources(packagePath) {
7797
7824
  files2["Package.swift"] = xcodeManifest(xcode);
7798
7825
  for (const standin of xcode.standins)
7799
7826
  for (const [file, text3] of Object.entries(standin.files))
7800
- files2[import_node_path14.default.posix.join(XCODE_STANDINS_DIR, standin.module, file)] = text3;
7827
+ files2[import_node_path15.default.posix.join(XCODE_STANDINS_DIR, standin.module, file)] = text3;
7801
7828
  }
7802
7829
  return files2;
7803
7830
  }
@@ -7808,7 +7835,7 @@ function packageSnapshot(project) {
7808
7835
  files: files2,
7809
7836
  resourcePaths: swiftImplicitResourcePaths(
7810
7837
  resourceCandidateFiles(project.packagePath).map(
7811
- (file) => import_node_path14.default.relative(project.packagePath, file).split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep)
7838
+ (file) => import_node_path15.default.relative(project.packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
7812
7839
  )
7813
7840
  ),
7814
7841
  resources: buildSwiftResourceTable(project, ""),
@@ -7817,7 +7844,7 @@ function packageSnapshot(project) {
7817
7844
  ...native ? {
7818
7845
  glue: readPackageFile(
7819
7846
  project.packagePath,
7820
- import_node_path14.default.join(project.packagePath, NATIVE_GLUE),
7847
+ import_node_path15.default.join(project.packagePath, NATIVE_GLUE),
7821
7848
  MAX_SWIFT_COMPILE_SOURCE_BYTES
7822
7849
  ).toString("utf8")
7823
7850
  } : {}
@@ -7853,7 +7880,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
7853
7880
  package: content
7854
7881
  };
7855
7882
  const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
7856
- (root) => import_node_fs13.default.existsSync(import_node_path14.default.join(root, "toolchain.json"))
7883
+ (root) => import_node_fs14.default.existsSync(import_node_path15.default.join(root, "toolchain.json"))
7857
7884
  ) ?? await swiftDistributionRoot();
7858
7885
  if (!moduleRoot)
7859
7886
  return {
@@ -7880,10 +7907,10 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
7880
7907
  // server and a capture, or two checkouts) build each other's sources. so
7881
7908
  // each app and module checkout gets its own root, which keeps the same
7882
7909
  // app's incremental build across restarts.
7883
- buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path14.default.join(
7910
+ buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path15.default.join(
7884
7911
  import_node_os8.default.tmpdir(),
7885
7912
  "contrast-swift-build",
7886
- (0, import_node_crypto7.createHash)("sha256").update(`${moduleRoot}\0${import_node_path14.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
7913
+ (0, import_node_crypto7.createHash)("sha256").update(`${moduleRoot}\0${import_node_path15.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
7887
7914
  ),
7888
7915
  moduleRoot,
7889
7916
  ...toolchain
@@ -7995,7 +8022,7 @@ async function missingModulesMessage(packagePath, missing) {
7995
8022
  `Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
7996
8023
  ...[...missing].map(([name2, files2]) => {
7997
8024
  const gap = gaps.get(name2);
7998
- return ` ${name2.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path14.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
8025
+ return ` ${name2.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path15.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
7999
8026
  })
8000
8027
  ].join("\n");
8001
8028
  }
@@ -8003,7 +8030,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
8003
8030
  const auth = hosted ? null : resolveCliAuth();
8004
8031
  if (!hosted && (!auth || auth.kind === "github")) {
8005
8032
  throw new Error(
8006
- `compiling ${import_node_path14.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
8033
+ `compiling ${import_node_path15.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
8007
8034
  );
8008
8035
  }
8009
8036
  const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
@@ -8022,7 +8049,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
8022
8049
  const bytes = sources.reduce((total2, text3) => total2 + Buffer.byteLength(text3), 0);
8023
8050
  if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
8024
8051
  throw new Error(
8025
- `${import_node_path14.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`
8052
+ `${import_node_path15.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`
8026
8053
  );
8027
8054
  }
8028
8055
  const descriptor = snapshot.native;
@@ -8041,7 +8068,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
8041
8068
  );
8042
8069
  if (descriptor && address.native?.hash !== descriptor.hash) {
8043
8070
  throw new Error(
8044
- `${import_node_path14.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`
8071
+ `${import_node_path15.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`
8045
8072
  );
8046
8073
  }
8047
8074
  const response = await fetch(address.url, { signal });
@@ -8119,8 +8146,8 @@ var run3 = (0, import_node_util3.promisify)(import_node_child_process8.execFile)
8119
8146
  var scriptEnv = { ...process.env, [RNX_FORKED_SCRIPT_ENV]: "1" };
8120
8147
  var EXPO_SWIFT_ENTRY = "Sources/PeachExpoApp/PeachExpoEntry.swift";
8121
8148
  async function collectExpoSwiftSources(appRoot) {
8122
- appRoot = import_node_fs14.default.realpathSync(appRoot);
8123
- const appRequire = (0, import_node_module.createRequire)(import_node_path15.default.join(appRoot, "package.json"));
8149
+ appRoot = import_node_fs15.default.realpathSync(appRoot);
8150
+ const appRequire = (0, import_node_module.createRequire)(import_node_path16.default.join(appRoot, "package.json"));
8124
8151
  let autolinker;
8125
8152
  try {
8126
8153
  autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
@@ -8134,7 +8161,7 @@ async function collectExpoSwiftSources(appRoot) {
8134
8161
  (command) => run3(
8135
8162
  process.execPath,
8136
8163
  [
8137
- import_node_path15.default.join(import_node_path15.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
8164
+ import_node_path16.default.join(import_node_path16.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
8138
8165
  command,
8139
8166
  "--platform",
8140
8167
  "apple",
@@ -8165,8 +8192,8 @@ async function collectExpoSwiftSources(appRoot) {
8165
8192
  const sourceRoot = Reflect.get(entry, "path");
8166
8193
  if (typeof sourceRoot !== "string")
8167
8194
  throw new Error("Expo autolinking entry has no path");
8168
- const canonical = import_node_fs14.default.realpathSync(sourceRoot);
8169
- if (canonical.split(import_node_path15.default.sep).includes("node_modules")) continue;
8195
+ const canonical = import_node_fs15.default.realpathSync(sourceRoot);
8196
+ if (canonical.split(import_node_path16.default.sep).includes("node_modules")) continue;
8170
8197
  const resolution = resolutions.find(
8171
8198
  (candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
8172
8199
  );
@@ -8193,12 +8220,12 @@ async function collectExpoSwiftSources(appRoot) {
8193
8220
  registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
8194
8221
  });
8195
8222
  }
8196
- const ios = import_node_path15.default.join(canonical, "ios");
8197
- if (import_node_fs14.default.lstatSync(ios).isSymbolicLink())
8223
+ const ios = import_node_path16.default.join(canonical, "ios");
8224
+ if (import_node_fs15.default.lstatSync(ios).isSymbolicLink())
8198
8225
  throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
8199
8226
  const walk2 = (dir) => {
8200
- for (const child of import_node_fs14.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
8201
- const file = import_node_path15.default.join(dir, child.name);
8227
+ for (const child of import_node_fs15.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
8228
+ const file = import_node_path16.default.join(dir, child.name);
8202
8229
  if (child.isSymbolicLink())
8203
8230
  throw new Error(`Expo Swift source is a symlink: ${file}`);
8204
8231
  if (child.isDirectory()) {
@@ -8206,13 +8233,13 @@ async function collectExpoSwiftSources(appRoot) {
8206
8233
  continue;
8207
8234
  }
8208
8235
  if (!child.name.endsWith(".swift")) continue;
8209
- const size = import_node_fs14.default.statSync(file).size;
8236
+ const size = import_node_fs15.default.statSync(file).size;
8210
8237
  bytes += size;
8211
8238
  fileCount++;
8212
8239
  if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
8213
8240
  throw new Error("Expo Swift sources exceed compile service caps");
8214
- files2[`Sources/${namespace}/${import_node_path15.default.relative(ios, file).split(import_node_path15.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
8215
- ${import_node_fs14.default.readFileSync(file, "utf8")}`;
8241
+ files2[`Sources/${namespace}/${import_node_path16.default.relative(ios, file).split(import_node_path16.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
8242
+ ${import_node_fs15.default.readFileSync(file, "utf8")}`;
8216
8243
  }
8217
8244
  };
8218
8245
  walk2(ios);
@@ -8297,7 +8324,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
8297
8324
  modules: [],
8298
8325
  failures: []
8299
8326
  };
8300
- const key2 = (0, import_node_crypto8.createHash)("sha256").update(import_node_fs14.default.realpathSync(root)).digest("hex");
8327
+ const key2 = (0, import_node_crypto8.createHash)("sha256").update(import_node_fs15.default.realpathSync(root)).digest("hex");
8301
8328
  const linked = [];
8302
8329
  for (const unit of units) {
8303
8330
  if (!module2) {
@@ -8307,14 +8334,14 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
8307
8334
  });
8308
8335
  continue;
8309
8336
  }
8310
- const packagePath = import_node_path15.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, unit.moduleId);
8337
+ const packagePath = import_node_path16.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, unit.moduleId);
8311
8338
  let stamp;
8312
8339
  try {
8313
8340
  syncSwiftTree(
8314
8341
  packagePath,
8315
8342
  new Map(
8316
8343
  Object.entries(unit.files).map(([name2, source]) => [
8317
- import_node_path15.default.join(packagePath, name2),
8344
+ import_node_path16.default.join(packagePath, name2),
8318
8345
  source
8319
8346
  ])
8320
8347
  )
@@ -8339,10 +8366,13 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
8339
8366
  const file = JSON.parse(match[1]);
8340
8367
  return typeof file === "string" ? [file] : [];
8341
8368
  });
8342
- const sourceErrors = (diagnostic.match(/^.+:\d+(?::\d+)?: error:.*$/gm) ?? []).filter((line) => appPaths.some((file) => line.startsWith(`${file}:`)));
8343
- if (publishArtifact && sourceErrors.length === 0 && !(error instanceof SwiftMissingModulesError))
8369
+ const errors = diagnostic.match(/^.+:\d+(?::\d+)?: error:.*$/gm) ?? [];
8370
+ const sourceErrors = errors.filter(
8371
+ (line) => appPaths.some((file) => line.startsWith(`${file}:`)) && !/external macro implementation type|failed to load library plugin/.test(line)
8372
+ );
8373
+ if (publishArtifact && (sourceErrors.length === 0 || sourceErrors.length !== errors.length) && !(error instanceof SwiftMissingModulesError))
8344
8374
  throw error;
8345
- if (sourceErrors.length && module2 && stamp && sourceStamp(packagePath, module2.root) === stamp) {
8375
+ if (sourceErrors.length && sourceErrors.length === errors.length && module2 && stamp && sourceStamp(packagePath, module2.root) === stamp) {
8346
8376
  failedCompilations.set(packagePath, {
8347
8377
  stamp,
8348
8378
  diagnostic: sourceErrors.join("\n")
@@ -8372,12 +8402,12 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
8372
8402
  import PackageDescription
8373
8403
  let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.target(name: ${JSON.stringify(name2)}, path: ${JSON.stringify(`Sources/${name2}`)})`).join(", ")}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])
8374
8404
  `;
8375
- const packagePath = import_node_path15.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, "linked-app");
8405
+ const packagePath = import_node_path16.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, "linked-app");
8376
8406
  syncSwiftTree(
8377
8407
  packagePath,
8378
8408
  new Map(
8379
8409
  Object.entries(files2).map(([name2, source]) => [
8380
- import_node_path15.default.join(packagePath, name2),
8410
+ import_node_path16.default.join(packagePath, name2),
8381
8411
  source
8382
8412
  ])
8383
8413
  )