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;
@@ -691,8 +691,12 @@ function emitSwiftPackageManifest(args) {
691
691
  (name2) => OPTIONAL_FRAMEWORKS.has(name2) && !targets.some((target) => target.name === name2)
692
692
  ).flatMap((name2) => [name2, ...OPTIONAL_FRAMEWORK_DEPENDENCIES[name2] ?? []])
693
693
  );
694
+ if (spriteKit) {
695
+ reachedFrameworks.add("SpriteKit");
696
+ reachedFrameworks.add("PeachBox2D");
697
+ }
694
698
  const distributionObjects = distribution?.objects.filter(
695
- (object) => [...OPTIONAL_FRAMEWORKS].every(
699
+ (object) => [...OPTIONAL_FRAMEWORKS, "SpriteKit", "PeachBox2D"].every(
696
700
  (name2) => !object.startsWith(`lib/${name2}-`) || reachedFrameworks.has(name2)
697
701
  )
698
702
  );
@@ -1825,7 +1829,17 @@ function compileSwiftProjectUnit(input, options) {
1825
1829
  ])
1826
1830
  ],
1827
1831
  {
1828
- env: BUILD_ENV,
1832
+ env: {
1833
+ ...BUILD_ENV,
1834
+ // shipped host plugins resolve against the selected compiler's runtime.
1835
+ ...process.platform === "linux" ? {
1836
+ LD_LIBRARY_PATH: [
1837
+ import_node_path2.default.resolve(options.toolchainBin, "../lib/swift/linux"),
1838
+ import_node_path2.default.resolve(options.toolchainBin, "../lib/swift/host"),
1839
+ process.env.LD_LIBRARY_PATH
1840
+ ].filter(Boolean).join(":")
1841
+ } : {}
1842
+ },
1829
1843
  maxBuffer: 64 * 1024 * 1024,
1830
1844
  timeout: options.timeoutMs
1831
1845
  }
@@ -1842,7 +1856,7 @@ function compileSwiftProjectUnit(input, options) {
1842
1856
  };
1843
1857
  });
1844
1858
  }
1845
- var import_node_child_process3, import_node_crypto2, import_node_fs2, import_node_os, import_node_path2, import_node_util2, run2, WASM_TRIPLE, cores, BUILD_ENV, BUILD_JOBS, linkedModuleDigests, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, sdkPaths, availableModules, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, MULTI_MANIFEST_VERSION, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, TYPE_AFTER_ATTRIBUTE, DELEGATE_CLASS, REUSABLE_INIT, REUSABLE_VIEW_BASES, CLASS_BASE, FRAME_INIT, APPLE_CLASS, EXTENSION_DECL, CLASS_DECL, MODIFIERS, OVERRIDE_FUNC, OVERRIDE_VAR, compiledSource, ROOT_LOCKS, host, rootLocks;
1859
+ var import_node_child_process3, import_node_crypto2, import_node_fs2, import_node_os, import_node_path2, import_node_util2, run2, WASM_TRIPLE, cores, BUILD_ENV, BUILD_JOBS, linkedModuleDigests, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, sdkPaths, availableModules, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, FOUNDATION_IMPLICIT_MODULES, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, MULTI_MANIFEST_VERSION, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, TYPE_AFTER_ATTRIBUTE, DELEGATE_CLASS, REUSABLE_INIT, REUSABLE_VIEW_BASES, CLASS_BASE, FRAME_INIT, APPLE_CLASS, EXTENSION_DECL, CLASS_DECL, MODIFIERS, OVERRIDE_FUNC, OVERRIDE_VAR, compiledSource, ROOT_LOCKS, host, rootLocks;
1846
1860
  var init_swift_compile = __esm({
1847
1861
  "src/swift-compile.ts"() {
1848
1862
  "use strict";
@@ -1909,9 +1923,18 @@ var init_swift_compile = __esm({
1909
1923
  importsSpriteKit = (files2) => Object.entries(files2).some(
1910
1924
  ([file, contents]) => file.endsWith(".swift") && swiftImportNames(contents).includes("SpriteKit")
1911
1925
  );
1912
- 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"';
1926
+ FOUNDATION_IMPLICIT_MODULES = [
1927
+ "PeachObjC",
1928
+ "Dispatch",
1929
+ "FoundationNetworking",
1930
+ "WASILibc",
1931
+ "wasi_pthread"
1932
+ ];
1933
+ FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
1934
+ (module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
1935
+ ).join("");
1913
1936
  ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
1914
- MULTI_MANIFEST_VERSION = 11;
1937
+ MULTI_MANIFEST_VERSION = 12;
1915
1938
  DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
1916
1939
  OS_IOS = /\bos\(\s*iOS\s*\)/g;
1917
1940
  OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
@@ -2302,8 +2325,8 @@ function pickImagesetFile(images) {
2302
2325
  scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
2303
2326
  };
2304
2327
  }
2305
- function flatScale(path15) {
2306
- const match = /@([23])x\.[^./]+$/.exec(path15);
2328
+ function flatScale(path16) {
2329
+ const match = /@([23])x\.[^./]+$/.exec(path16);
2307
2330
  return match ? Number(match[1]) : 1;
2308
2331
  }
2309
2332
  function providesNamespace(text3) {
@@ -2330,13 +2353,13 @@ function catalogEntryName(contentsPath, kind, readText) {
2330
2353
  }
2331
2354
  return segments.join("/");
2332
2355
  }
2333
- function isFlatResourceImage(path15) {
2334
- return path15.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path15));
2356
+ function isFlatResourceImage(path16) {
2357
+ return path16.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path16));
2335
2358
  }
2336
2359
  function enumerateBundleImages(paths, readText) {
2337
2360
  const table = [];
2338
2361
  const seen = /* @__PURE__ */ new Set();
2339
- const catalogs = paths.filter((path15) => baseOf(path15) === "Contents.json");
2362
+ const catalogs = paths.filter((path16) => baseOf(path16) === "Contents.json");
2340
2363
  for (const contentsPath of catalogs) {
2341
2364
  const name2 = catalogEntryName(contentsPath, ".imageset", readText);
2342
2365
  if (name2 === null || seen.has(name2)) continue;
@@ -2357,12 +2380,12 @@ function enumerateBundleImages(paths, readText) {
2357
2380
  seen.add(name2);
2358
2381
  table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
2359
2382
  }
2360
- for (const path15 of paths) {
2361
- if (!isFlatResourceImage(path15)) continue;
2362
- const name2 = baseOf(path15).slice(0, -extOf(path15).length);
2383
+ for (const path16 of paths) {
2384
+ if (!isFlatResourceImage(path16)) continue;
2385
+ const name2 = baseOf(path16).slice(0, -extOf(path16).length);
2363
2386
  if (name2 === "" || seen.has(name2)) continue;
2364
2387
  seen.add(name2);
2365
- table.push({ name: name2, file: path15, scale: flatScale(path15) });
2388
+ table.push({ name: name2, file: path16, scale: flatScale(path16) });
2366
2389
  }
2367
2390
  return table;
2368
2391
  }
@@ -2391,7 +2414,7 @@ function colorsetValue(color) {
2391
2414
  }
2392
2415
  function enumerateBundleColors(paths, readText) {
2393
2416
  const table = {};
2394
- for (const contentsPath of paths.filter((path15) => baseOf(path15) === "Contents.json")) {
2417
+ for (const contentsPath of paths.filter((path16) => baseOf(path16) === "Contents.json")) {
2395
2418
  const name2 = catalogEntryName(contentsPath, ".colorset", readText);
2396
2419
  if (name2 === null || name2 in table) continue;
2397
2420
  let colors;
@@ -2455,8 +2478,8 @@ function axisExtremes(points) {
2455
2478
  function pathBounds(d) {
2456
2479
  const xs = [];
2457
2480
  const ys = [];
2458
- for (const path15 of d)
2459
- (0, import_svgpath.default)(path15).abs().unshort().unarc().iterate((segment2, _index, x, y) => {
2481
+ for (const path16 of d)
2482
+ (0, import_svgpath.default)(path16).abs().unshort().unarc().iterate((segment2, _index, x, y) => {
2460
2483
  const [command, ...args] = segment2;
2461
2484
  if (command === "M" || command === "L") {
2462
2485
  xs.push(Number(args[0]));
@@ -2483,7 +2506,7 @@ function guide(svg, id, axis) {
2483
2506
  }
2484
2507
  function enumerateBundleSymbols(paths, readText) {
2485
2508
  const table = {};
2486
- for (const contentsPath of paths.filter((path15) => baseOf(path15) === "Contents.json")) {
2509
+ for (const contentsPath of paths.filter((path16) => baseOf(path16) === "Contents.json")) {
2487
2510
  const name2 = catalogEntryName(contentsPath, ".symbolset", readText);
2488
2511
  if (name2 === null || name2 in table) continue;
2489
2512
  let symbols;
@@ -2516,8 +2539,8 @@ function enumerateBundleSymbols(paths, readText) {
2516
2539
  viewBox: "0 0 24 24",
2517
2540
  advance,
2518
2541
  box: [12 - advance / 2, 12 - tall / 2, advance, tall],
2519
- layers: d.map((path15) => ({
2520
- d: (0, import_svgpath.default)(path15).abs().scale(scale).translate(translateX, translateY).round(3).toString()
2542
+ layers: d.map((path16) => ({
2543
+ d: (0, import_svgpath.default)(path16).abs().scale(scale).translate(translateX, translateY).round(3).toString()
2521
2544
  }))
2522
2545
  };
2523
2546
  }
@@ -2527,7 +2550,7 @@ function enumerateBundleJson(paths) {
2527
2550
  const found = [];
2528
2551
  const seen = /* @__PURE__ */ new Set();
2529
2552
  const ordered = [...paths].filter(
2530
- (path15) => path15.split("/").includes("Resources") && path15.split("/").every((segment2) => segment2 !== "" && segment2 !== "..") && (extOf(path15) === ".json" || extOf(path15) === ".xcstrings")
2553
+ (path16) => path16.split("/").includes("Resources") && path16.split("/").every((segment2) => segment2 !== "" && segment2 !== "..") && (extOf(path16) === ".json" || extOf(path16) === ".xcstrings")
2531
2554
  ).sort((a, b) => {
2532
2555
  const aDepth = a.split("/").length;
2533
2556
  const bDepth = b.split("/").length;
@@ -3569,6 +3592,57 @@ var init_swift_packages = __esm({
3569
3592
  }
3570
3593
  });
3571
3594
 
3595
+ // src/swift-source-file.ts
3596
+ function readPackageFile(root, file, maxBytes) {
3597
+ const canonicalRoot = import_node_fs10.default.realpathSync(root);
3598
+ const relative = import_node_path11.default.relative(canonicalRoot, import_node_fs10.default.realpathSync(file));
3599
+ if (relative === ".." || relative.startsWith(`..${import_node_path11.default.sep}`) || import_node_path11.default.isAbsolute(relative)) {
3600
+ throw new Error(`swift input escapes the selected package: ${file}`);
3601
+ }
3602
+ let ancestor = import_node_path11.default.resolve(file);
3603
+ while (ancestor !== canonicalRoot) {
3604
+ if (import_node_fs10.default.lstatSync(ancestor).isSymbolicLink()) {
3605
+ throw new Error(`swift input is a symlink: ${ancestor}`);
3606
+ }
3607
+ const parent = import_node_path11.default.dirname(ancestor);
3608
+ if (parent === ancestor)
3609
+ throw new Error(`swift input escapes the selected package: ${file}`);
3610
+ ancestor = parent;
3611
+ }
3612
+ const expected = import_node_fs10.default.statSync(file);
3613
+ const fd = import_node_fs10.default.openSync(file, import_node_fs10.default.constants.O_RDONLY | import_node_fs10.default.constants.O_NOFOLLOW);
3614
+ try {
3615
+ const stat = import_node_fs10.default.fstatSync(fd);
3616
+ if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
3617
+ throw new Error(`swift input changed while opening: ${file}`);
3618
+ }
3619
+ if (!stat.isFile() || stat.size > maxBytes) {
3620
+ throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
3621
+ }
3622
+ const bytes = Buffer.alloc(stat.size + 1);
3623
+ let offset = 0;
3624
+ while (offset < bytes.length) {
3625
+ const count = import_node_fs10.default.readSync(fd, bytes, offset, bytes.length - offset, null);
3626
+ if (count === 0) break;
3627
+ offset += count;
3628
+ }
3629
+ if (offset !== stat.size || import_node_fs10.default.fstatSync(fd).size !== stat.size) {
3630
+ throw new Error(`swift input changed while reading: ${file}`);
3631
+ }
3632
+ return bytes.subarray(0, offset);
3633
+ } finally {
3634
+ import_node_fs10.default.closeSync(fd);
3635
+ }
3636
+ }
3637
+ var import_node_fs10, import_node_path11;
3638
+ var init_swift_source_file = __esm({
3639
+ "src/swift-source-file.ts"() {
3640
+ "use strict";
3641
+ import_node_fs10 = __toESM(require("node:fs"), 1);
3642
+ import_node_path11 = __toESM(require("node:path"), 1);
3643
+ }
3644
+ });
3645
+
3572
3646
  // src/public-brand.ts
3573
3647
  var name, peachPublicBrand, rnxPublicBrand;
3574
3648
  var init_public_brand = __esm({
@@ -3599,7 +3673,7 @@ function getCliVersion() {
3599
3673
  ];
3600
3674
  for (const resolve2 of candidates) {
3601
3675
  try {
3602
- const version = JSON.parse((0, import_node_fs10.readFileSync)(resolve2(), "utf8")).version;
3676
+ const version = JSON.parse((0, import_node_fs11.readFileSync)(resolve2(), "utf8")).version;
3603
3677
  if (typeof version === "string" && version) {
3604
3678
  cached = version;
3605
3679
  return cached;
@@ -3610,11 +3684,11 @@ function getCliVersion() {
3610
3684
  cached = "0.0.0";
3611
3685
  return cached;
3612
3686
  }
3613
- var import_node_fs10, import_node_url, import_meta, cached;
3687
+ var import_node_fs11, import_node_url, import_meta, cached;
3614
3688
  var init_cli_version = __esm({
3615
3689
  "src/cli-version.ts"() {
3616
3690
  "use strict";
3617
- import_node_fs10 = require("node:fs");
3691
+ import_node_fs11 = require("node:fs");
3618
3692
  import_node_url = require("node:url");
3619
3693
  init_public_brand();
3620
3694
  import_meta = {};
@@ -3770,10 +3844,10 @@ function emitSwiftStandin(graphs, options) {
3770
3844
  owners.push(...physical.map(() => current));
3771
3845
  };
3772
3846
  const scoped = (body) => (symbol, ...rest) => {
3773
- const path15 = pathOf(symbol);
3774
- if (omit.has(path15)) return void skipped.push({ path: path15, reason: omit.get(path15) });
3847
+ const path16 = pathOf(symbol);
3848
+ if (omit.has(path16)) return void skipped.push({ path: path16, reason: omit.get(path16) });
3775
3849
  const previous = current;
3776
- current = path15;
3850
+ current = path16;
3777
3851
  try {
3778
3852
  body(symbol, ...rest);
3779
3853
  } finally {
@@ -3793,14 +3867,14 @@ function emitSwiftStandin(graphs, options) {
3793
3867
  const access = (symbol, openOwner) => symbol.accessLevel === "open" && openOwner ? "open" : "public";
3794
3868
  const emitMember = scoped(
3795
3869
  (member, indent, context) => {
3796
- const path15 = pathOf(member);
3870
+ const path16 = pathOf(member);
3797
3871
  if (TYPE_KINDS.has(member.kind.identifier)) {
3798
3872
  emitType(member, indent);
3799
3873
  return;
3800
3874
  }
3801
3875
  if (member.kind.identifier === "swift.enum.case") return;
3802
3876
  if (!MEMBER_KINDS.has(member.kind.identifier)) {
3803
- skipped.push({ path: path15, reason: `unhandled ${member.kind.identifier}` });
3877
+ skipped.push({ path: path16, reason: `unhandled ${member.kind.identifier}` });
3804
3878
  return;
3805
3879
  }
3806
3880
  const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(member));
@@ -3814,12 +3888,12 @@ function emitSwiftStandin(graphs, options) {
3814
3888
  const final = context.inClass && flags.has("final") ? "final " : "";
3815
3889
  const mutating = flags.has("mutating") ? "mutating " : flags.has("nonmutating") ? "nonmutating " : "";
3816
3890
  let core = `${flags.has("convenience") ? "convenience " : ""}${modifiers[2]}`;
3817
- 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 " : "";
3891
+ 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 " : "";
3818
3892
  const head = `${indent}${attrs}${access(member, context.openOwner)} ${required ? "required " : ""}${final}${override}${mutating}`;
3819
- const measured = behavior.get(path15);
3820
- if (measured) used.add(path15);
3893
+ const measured = behavior.get(path16);
3894
+ if (measured) used.add(path16);
3821
3895
  const overloadBody = /\basync\b/.test(core) ? measured?.asyncBody : /\bResult</.test(core) ? measured?.resultBody : void 0;
3822
- const body = overloadBody ?? measured?.body ?? trap(path15);
3896
+ const body = overloadBody ?? measured?.body ?? trap(path16);
3823
3897
  switch (member.kind.identifier) {
3824
3898
  case "swift.property":
3825
3899
  case "swift.type.property":
@@ -3840,7 +3914,7 @@ function emitSwiftStandin(graphs, options) {
3840
3914
  return;
3841
3915
  }
3842
3916
  emit(
3843
- `${head}${computed} { get${effects} { ${body} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? trap(path15)} }` : ""} }`
3917
+ `${head}${computed} { get${effects} { ${body} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? trap(path16)} }` : ""} }`
3844
3918
  );
3845
3919
  return;
3846
3920
  }
@@ -3893,7 +3967,7 @@ function emitSwiftStandin(graphs, options) {
3893
3967
  };
3894
3968
  const emitType = scoped(
3895
3969
  (symbol, indent) => {
3896
- const path15 = pathOf(symbol);
3970
+ const path16 = pathOf(symbol);
3897
3971
  const id = symbol.identifier.precise;
3898
3972
  const inner = `${indent} `;
3899
3973
  switch (symbol.kind.identifier) {
@@ -3905,10 +3979,10 @@ function emitSwiftStandin(graphs, options) {
3905
3979
  case "swift.class": {
3906
3980
  const shape = header(symbol, "class", indent);
3907
3981
  if (!shape)
3908
- return void skipped.push({ path: path15, reason: `unparsed class ${text(symbol)}` });
3909
- const parent = options.superclasses?.get(path15) ?? superclass.get(id);
3982
+ return void skipped.push({ path: path16, reason: `unparsed class ${text(symbol)}` });
3983
+ const parent = options.superclasses?.get(path16) ?? superclass.get(id);
3910
3984
  const blocked = classBlocked(id);
3911
- if (blocked) return void skipped.push({ path: path15, reason: blocked });
3985
+ if (blocked) return void skipped.push({ path: path16, reason: blocked });
3912
3986
  const ancestors = /* @__PURE__ */ new Set();
3913
3987
  for (let at = superId.get(id); at; at = superId.get(at))
3914
3988
  for (const name2 of conforms.get(at) ?? []) ancestors.add(name2);
@@ -3924,9 +3998,9 @@ function emitSwiftStandin(graphs, options) {
3924
3998
  `${indent}${shape.attrs}${open ? "open" : "public"} class ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${selfConforming(shape.where)} {`
3925
3999
  );
3926
4000
  const members = membersOf(id);
3927
- const extra = options.behavior?.get(path15)?.members;
4001
+ const extra = options.behavior?.get(path16)?.members;
3928
4002
  if (extra) {
3929
- used.add(path15);
4003
+ used.add(path16);
3930
4004
  emit(`${inner}${extra}`);
3931
4005
  }
3932
4006
  for (const member of members)
@@ -3979,13 +4053,13 @@ function emitSwiftStandin(graphs, options) {
3979
4053
  continue;
3980
4054
  have.add(witnessKey(member));
3981
4055
  have.add(sideLeaf(member));
3982
- emitWitness(member, inner, path15);
4056
+ emitWitness(member, inner, path16);
3983
4057
  }
3984
4058
  }
3985
4059
  const coder = members.some((member) => leaf(member) === "init(coder:)");
3986
4060
  if (designated && !coder && externalRoot(id) !== "NSObject" && externalRoot(id) !== null)
3987
4061
  emit(
3988
- `${inner}public required init?(coder: NSCoder) { ${trap(`${path15}.init(coder:)`)} }`
4062
+ `${inner}public required init?(coder: NSCoder) { ${trap(`${path16}.init(coder:)`)} }`
3989
4063
  );
3990
4064
  emit(`${indent}}`);
3991
4065
  return;
@@ -3993,7 +4067,7 @@ function emitSwiftStandin(graphs, options) {
3993
4067
  case "swift.struct": {
3994
4068
  const shape = header(symbol, "struct", indent);
3995
4069
  if (!shape)
3996
- return void skipped.push({ path: path15, reason: `unparsed struct ${text(symbol)}` });
4070
+ return void skipped.push({ path: path16, reason: `unparsed struct ${text(symbol)}` });
3997
4071
  const members = membersOf(id);
3998
4072
  const raw2 = rawType(members);
3999
4073
  const list2 = inheritance(id);
@@ -4044,7 +4118,7 @@ function emitSwiftStandin(graphs, options) {
4044
4118
  case "swift.enum": {
4045
4119
  const shape = header(symbol, "enum", indent);
4046
4120
  if (!shape)
4047
- return void skipped.push({ path: path15, reason: `unparsed enum ${text(symbol)}` });
4121
+ return void skipped.push({ path: path16, reason: `unparsed enum ${text(symbol)}` });
4048
4122
  const members = membersOf(id);
4049
4123
  const raw2 = rawType(members);
4050
4124
  const cases = (children.get(id) ?? []).filter(
@@ -4053,7 +4127,7 @@ function emitSwiftStandin(graphs, options) {
4053
4127
  const missing = raw2 ? cases.filter((member) => !values.has(member.identifier.precise)) : [];
4054
4128
  if (raw2 && isObjC(symbol) && missing.length > 0)
4055
4129
  return void skipped.push({
4056
- path: path15,
4130
+ path: path16,
4057
4131
  reason: `no header value for ${missing.map(leaf).join(", ")}`
4058
4132
  });
4059
4133
  const list2 = inheritance(id, raw2 ?? void 0).filter(
@@ -4094,7 +4168,7 @@ function emitSwiftStandin(graphs, options) {
4094
4168
  const shape = header(symbol, "protocol", indent);
4095
4169
  if (!shape)
4096
4170
  return void skipped.push({
4097
- path: path15,
4171
+ path: path16,
4098
4172
  reason: `unparsed protocol ${text(symbol)}`
4099
4173
  });
4100
4174
  const list2 = [...isObjC(symbol) ? ["AnyObject"] : [], ...inheritance(id)];
@@ -4119,7 +4193,7 @@ function emitSwiftStandin(graphs, options) {
4119
4193
  }
4120
4194
  emit(`${indent}}`);
4121
4195
  if (defaults.length > 0) {
4122
- emit(`${indent}extension ${path15} {`);
4196
+ emit(`${indent}extension ${path16} {`);
4123
4197
  for (const member of defaults) {
4124
4198
  const decl = text(member);
4125
4199
  if (optional.has(member.identifier.precise) && member.kind.identifier === "swift.method" && !decl.replace(/\([^)]*\)/g, "").includes("->") && !/ async\b/.test(decl))
@@ -4166,7 +4240,7 @@ function emitSwiftStandin(graphs, options) {
4166
4240
  return init ? /rawValue:\s*([^)]+)\)/.exec(text(init))?.[1]?.trim() ?? null : null;
4167
4241
  };
4168
4242
  const emitGlobal = scoped((symbol) => {
4169
- const path15 = pathOf(symbol);
4243
+ const path16 = pathOf(symbol);
4170
4244
  const kind = symbol.kind.identifier;
4171
4245
  if (kind === "swift.func" || kind === "swift.func.op" || kind === "swift.method" || kind === "swift.type.method") {
4172
4246
  const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(symbol));
@@ -4177,17 +4251,17 @@ function emitSwiftStandin(graphs, options) {
4177
4251
  if (fix && !/^(?:prefix|infix|postfix)\b/.test(spelled))
4178
4252
  spelled = `${fix} ${spelled}`;
4179
4253
  }
4180
- emit(`${attrs}public ${spelled} { ${trap(path15)} }`);
4254
+ emit(`${attrs}public ${spelled} { ${trap(path16)} }`);
4181
4255
  } else if (kind === "swift.var") {
4182
4256
  const parsed = splitAccessors(text(symbol).replace(/^let /, "var "));
4183
- const measured = behavior.get(path15);
4184
- if (measured) used.add(path15);
4185
- emit(`public ${parsed.decl} { ${measured?.body ?? trap(path15)} }`);
4186
- } else skipped.push({ path: path15, reason: `unhandled top-level ${kind}` });
4257
+ const measured = behavior.get(path16);
4258
+ if (measured) used.add(path16);
4259
+ emit(`public ${parsed.decl} { ${measured?.body ?? trap(path16)} }`);
4260
+ } else skipped.push({ path: path16, reason: `unhandled top-level ${kind}` });
4187
4261
  });
4188
4262
  const roots = [...byId.values()].filter((symbol) => !owner.has(symbol.identifier.precise) && !unavailable(symbol)).sort((a, b) => pathOf(a).localeCompare(pathOf(b)));
4189
4263
  for (const symbol of roots) {
4190
- const path15 = pathOf(symbol);
4264
+ const path16 = pathOf(symbol);
4191
4265
  if (TYPE_KINDS.has(symbol.kind.identifier)) emitType(symbol, "");
4192
4266
  else emitGlobal(symbol);
4193
4267
  }
@@ -4229,9 +4303,9 @@ function emitSwiftStandin(graphs, options) {
4229
4303
  ...imports.map((name2) => `import ${name2}`),
4230
4304
  ""
4231
4305
  ];
4232
- for (const path15 of behavior.keys())
4233
- if (!used.has(path15))
4234
- skipped.push({ path: path15, reason: "behavior names no emitted declaration" });
4306
+ for (const path16 of behavior.keys())
4307
+ if (!used.has(path16))
4308
+ skipped.push({ path: path16, reason: "behavior names no emitted declaration" });
4235
4309
  return {
4236
4310
  source: `${[...banner, ...lines].join("\n")}
4237
4311
  `,
@@ -4317,7 +4391,7 @@ var init_swift_standin_emit = __esm({
4317
4391
  sideLeaf = (symbol) => `${symbol.kind.identifier.startsWith("swift.type.") ? "type" : "instance"}|leaf|${leaf(symbol)}`;
4318
4392
  isObjC = (symbol) => symbol.identifier.precise.startsWith("c:");
4319
4393
  synthesizedEquality = (symbol, conforms) => conforms.includes("Hashable") ? ["==(_:_:)", "hash(into:)", "hashValue"].includes(leaf(symbol)) : conforms.includes("Equatable") && leaf(symbol) === "==(_:_:)";
4320
- trap = (path15) => `fatalError("${path15} is a binary framework peach cannot run")`;
4394
+ trap = (path16) => `fatalError("${path16} is a binary framework peach cannot run")`;
4321
4395
  KEYWORDS = /* @__PURE__ */ new Set([
4322
4396
  "Type",
4323
4397
  "Protocol",
@@ -4375,15 +4449,15 @@ ${"stdout" in error ? String(error.stdout) : ""}` : String(error);
4375
4449
  function treeDigest(root) {
4376
4450
  const names = [];
4377
4451
  const walk2 = (dir) => {
4378
- for (const entry of import_node_fs11.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
4379
- const full = import_node_path11.default.join(dir, entry.name);
4452
+ for (const entry of import_node_fs12.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
4453
+ const full = import_node_path12.default.join(dir, entry.name);
4380
4454
  if (entry.isDirectory()) walk2(full);
4381
- else if (entry.isFile()) names.push(import_node_path11.default.relative(root, full));
4455
+ else if (entry.isFile()) names.push(import_node_path12.default.relative(root, full));
4382
4456
  }
4383
4457
  };
4384
4458
  walk2(root);
4385
4459
  const stamp = names.map((name2) => {
4386
- const stat = import_node_fs11.default.statSync(import_node_path11.default.join(root, name2));
4460
+ const stat = import_node_fs12.default.statSync(import_node_path12.default.join(root, name2));
4387
4461
  return `${name2}\0${stat.size}:${stat.mtimeMs}`;
4388
4462
  }).join("\n");
4389
4463
  const memo2 = digests.get(`tree\0${root}`);
@@ -4391,7 +4465,7 @@ function treeDigest(root) {
4391
4465
  const hash = (0, import_node_crypto6.createHash)("sha256");
4392
4466
  for (const name2 of names) {
4393
4467
  hash.update(`${name2}\0`);
4394
- hash.update(import_node_fs11.default.readFileSync(import_node_path11.default.join(root, name2)));
4468
+ hash.update(import_node_fs12.default.readFileSync(import_node_path12.default.join(root, name2)));
4395
4469
  hash.update("\0");
4396
4470
  }
4397
4471
  const digest2 = hash.digest("hex");
@@ -4400,9 +4474,9 @@ function treeDigest(root) {
4400
4474
  }
4401
4475
  function locateXcframework(tree) {
4402
4476
  const find = (root, depth) => {
4403
- for (const entry of import_node_fs11.default.readdirSync(root, { withFileTypes: true })) {
4477
+ for (const entry of import_node_fs12.default.readdirSync(root, { withFileTypes: true })) {
4404
4478
  if (!entry.isDirectory() || entry.name === "__MACOSX") continue;
4405
- const full = import_node_path11.default.join(root, entry.name);
4479
+ const full = import_node_path12.default.join(root, entry.name);
4406
4480
  if (entry.name.endsWith(".xcframework")) return full;
4407
4481
  const nested = depth > 0 ? find(full, depth - 1) : null;
4408
4482
  if (nested) return nested;
@@ -4417,66 +4491,66 @@ function xcframework(binary) {
4417
4491
  if (binary.url && (!binary.checksum || !/^[a-f0-9]{64}$/i.test(binary.checksum)))
4418
4492
  throw new Error("remote binary archive requires its Package.swift SHA-256 checksum");
4419
4493
  const expected = binary.checksum?.toLowerCase();
4420
- const dir = import_node_path11.default.join(cacheDir3, "archives", key(binary.url ? expected : binary.dir));
4421
- const archive = import_node_path11.default.join(dir, "archive.zip");
4422
- const fingerprint = import_node_path11.default.join(dir, ".fingerprint");
4494
+ const dir = import_node_path12.default.join(cacheDir3, "archives", key(binary.url ? expected : binary.dir));
4495
+ const archive = import_node_path12.default.join(dir, "archive.zip");
4496
+ const fingerprint = import_node_path12.default.join(dir, ".fingerprint");
4423
4497
  const stored = (() => {
4424
4498
  try {
4425
- const parsed = JSON.parse(import_node_fs11.default.readFileSync(fingerprint, "utf8"));
4499
+ const parsed = JSON.parse(import_node_fs12.default.readFileSync(fingerprint, "utf8"));
4426
4500
  return parsed && typeof parsed === "object" && "sha" in parsed ? parsed : null;
4427
4501
  } catch {
4428
4502
  return null;
4429
4503
  }
4430
4504
  })();
4431
4505
  if (!binary.url) {
4432
- const stat = import_node_fs11.default.statSync(binary.dir);
4506
+ const stat = import_node_fs12.default.statSync(binary.dir);
4433
4507
  const stamp = `${stat.size}:${stat.mtimeMs}`;
4434
4508
  if (stored?.stamp === stamp) {
4435
- const found3 = locateXcframework(import_node_path11.default.join(dir, "tree"));
4509
+ const found3 = locateXcframework(import_node_path12.default.join(dir, "tree"));
4436
4510
  if (found3) return { dir: found3, digest: stored.sha };
4437
4511
  }
4438
- const sha2 = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs11.default.readFileSync(binary.dir)).digest("hex");
4439
- if (sha2 !== stored?.sha || !locateXcframework(import_node_path11.default.join(dir, "tree"))) {
4440
- import_node_fs11.default.rmSync(dir, { recursive: true, force: true });
4441
- import_node_fs11.default.mkdirSync(import_node_path11.default.join(dir, "tree"), { recursive: true });
4442
- exec("unzip", ["-q", binary.dir, "-d", import_node_path11.default.join(dir, "tree")]);
4512
+ const sha2 = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs12.default.readFileSync(binary.dir)).digest("hex");
4513
+ if (sha2 !== stored?.sha || !locateXcframework(import_node_path12.default.join(dir, "tree"))) {
4514
+ import_node_fs12.default.rmSync(dir, { recursive: true, force: true });
4515
+ import_node_fs12.default.mkdirSync(import_node_path12.default.join(dir, "tree"), { recursive: true });
4516
+ exec("unzip", ["-q", binary.dir, "-d", import_node_path12.default.join(dir, "tree")]);
4443
4517
  }
4444
- import_node_fs11.default.writeFileSync(fingerprint, JSON.stringify({ stamp, sha: sha2 }));
4445
- const found2 = locateXcframework(import_node_path11.default.join(dir, "tree"));
4518
+ import_node_fs12.default.writeFileSync(fingerprint, JSON.stringify({ stamp, sha: sha2 }));
4519
+ const found2 = locateXcframework(import_node_path12.default.join(dir, "tree"));
4446
4520
  if (!found2) throw new Error("its archive holds no .xcframework");
4447
4521
  return { dir: found2, digest: sha2 };
4448
4522
  }
4449
- if (stored && import_node_fs11.default.existsSync(archive)) {
4450
- const sha2 = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs11.default.readFileSync(archive)).digest("hex");
4523
+ if (stored && import_node_fs12.default.existsSync(archive)) {
4524
+ const sha2 = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs12.default.readFileSync(archive)).digest("hex");
4451
4525
  if (sha2 !== expected)
4452
4526
  throw new Error(`archive checksum ${sha2} is not the declared checksum ${expected}`);
4453
- const found2 = locateXcframework(import_node_path11.default.join(dir, "tree"));
4527
+ const found2 = locateXcframework(import_node_path12.default.join(dir, "tree"));
4454
4528
  if (found2) return { dir: found2, digest: sha2 };
4455
4529
  }
4456
- import_node_fs11.default.rmSync(dir, { recursive: true, force: true });
4457
- import_node_fs11.default.mkdirSync(import_node_path11.default.join(dir, "tree"), { recursive: true });
4530
+ import_node_fs12.default.rmSync(dir, { recursive: true, force: true });
4531
+ import_node_fs12.default.mkdirSync(import_node_path12.default.join(dir, "tree"), { recursive: true });
4458
4532
  exec("curl", ["-fsSL", "--retry", "2", "-o", archive, binary.url]);
4459
- const sha = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs11.default.readFileSync(archive)).digest("hex");
4533
+ const sha = (0, import_node_crypto6.createHash)("sha256").update(import_node_fs12.default.readFileSync(archive)).digest("hex");
4460
4534
  if (sha !== expected) {
4461
- import_node_fs11.default.rmSync(dir, { recursive: true, force: true });
4535
+ import_node_fs12.default.rmSync(dir, { recursive: true, force: true });
4462
4536
  throw new Error(`archive checksum ${sha} is not the declared checksum ${expected}`);
4463
4537
  }
4464
- exec("unzip", ["-q", archive, "-d", import_node_path11.default.join(dir, "tree")]);
4465
- import_node_fs11.default.writeFileSync(fingerprint, JSON.stringify({ sha }));
4466
- const found = locateXcframework(import_node_path11.default.join(dir, "tree"));
4538
+ exec("unzip", ["-q", archive, "-d", import_node_path12.default.join(dir, "tree")]);
4539
+ import_node_fs12.default.writeFileSync(fingerprint, JSON.stringify({ sha }));
4540
+ const found = locateXcframework(import_node_path12.default.join(dir, "tree"));
4467
4541
  if (!found) throw new Error("its archive holds no .xcframework");
4468
4542
  return { dir: found, digest: sha };
4469
4543
  }
4470
4544
  function surfaces(xcframeworkDir) {
4471
- const slice = import_node_fs11.default.readdirSync(xcframeworkDir).filter((name2) => /^ios-.+-simulator$/.test(name2)).sort()[0];
4545
+ const slice = import_node_fs12.default.readdirSync(xcframeworkDir).filter((name2) => /^ios-.+-simulator$/.test(name2)).sort()[0];
4472
4546
  if (!slice) throw new Error("it has no iOS simulator slice");
4473
- const root = import_node_path11.default.join(xcframeworkDir, slice);
4547
+ const root = import_node_path12.default.join(xcframeworkDir, slice);
4474
4548
  const found = [];
4475
- for (const entry of import_node_fs11.default.readdirSync(root).sort()) {
4549
+ for (const entry of import_node_fs12.default.readdirSync(root).sort()) {
4476
4550
  if (!entry.endsWith(".framework")) continue;
4477
4551
  const module2 = entry.slice(0, -".framework".length);
4478
- const framework = import_node_path11.default.join(root, entry);
4479
- const swiftmodule = import_node_path11.default.join(framework, "Modules", `${module2}.swiftmodule`);
4552
+ const framework = import_node_path12.default.join(root, entry);
4553
+ const swiftmodule = import_node_path12.default.join(framework, "Modules", `${module2}.swiftmodule`);
4480
4554
  const interfaces = files(
4481
4555
  swiftmodule,
4482
4556
  (name2) => name2.endsWith(".swiftinterface") && !name2.endsWith(".private.swiftinterface") && !name2.endsWith(".package.swiftinterface")
@@ -4486,41 +4560,41 @@ function surfaces(xcframeworkDir) {
4486
4560
  found.push({
4487
4561
  kind: "swift",
4488
4562
  module: module2,
4489
- interface: import_node_path11.default.join(swiftmodule, chosen)
4563
+ interface: import_node_path12.default.join(swiftmodule, chosen)
4490
4564
  });
4491
4565
  continue;
4492
4566
  }
4493
- const modulemap = import_node_path11.default.join(framework, "Modules", "module.modulemap");
4494
- if (import_node_fs11.default.existsSync(modulemap))
4567
+ const modulemap = import_node_path12.default.join(framework, "Modules", "module.modulemap");
4568
+ if (import_node_fs12.default.existsSync(modulemap))
4495
4569
  found.push({
4496
4570
  kind: "c",
4497
4571
  module: module2,
4498
4572
  modulemap,
4499
- headers: import_node_path11.default.join(framework, "Headers")
4573
+ headers: import_node_path12.default.join(framework, "Headers")
4500
4574
  });
4501
4575
  }
4502
- const headers = import_node_path11.default.join(root, "Headers");
4576
+ const headers = import_node_path12.default.join(root, "Headers");
4503
4577
  for (const map of files(headers, (name2) => name2 === "module.modulemap")) {
4504
- const modulemap = import_node_path11.default.join(headers, map);
4505
- const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs11.default.readFileSync(modulemap, "utf8"))?.[1];
4578
+ const modulemap = import_node_path12.default.join(headers, map);
4579
+ const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs12.default.readFileSync(modulemap, "utf8"))?.[1];
4506
4580
  if (module2) found.push({ kind: "c", module: module2, modulemap, headers });
4507
4581
  }
4508
4582
  return found;
4509
4583
  }
4510
4584
  function peachModuleDirs(toolchain, imports) {
4511
4585
  const { moduleRoot, toolchainBin } = toolchain;
4512
- if (swiftDistributionAt(moduleRoot)) return [import_node_path11.default.join(moduleRoot, "modules")];
4586
+ if (swiftDistributionAt(moduleRoot)) return [import_node_path12.default.join(moduleRoot, "modules")];
4513
4587
  const peach = new Set(swiftPeachModules(moduleRoot));
4514
4588
  const plugins = swiftMacroPlugins(moduleRoot);
4515
4589
  if (plugins.stale)
4516
4590
  exec("sh", [
4517
- import_node_path11.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
4591
+ import_node_path12.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
4518
4592
  toolchainBin,
4519
4593
  plugins.libraries[0]
4520
4594
  ]);
4521
4595
  for (const target of imports.filter((name2) => peach.has(name2)))
4522
4596
  exec(
4523
- import_node_path11.default.join(toolchainBin, "swift"),
4597
+ import_node_path12.default.join(toolchainBin, "swift"),
4524
4598
  [
4525
4599
  "build",
4526
4600
  "--swift-sdk",
@@ -4540,7 +4614,7 @@ function peachModuleDirs(toolchain, imports) {
4540
4614
  ],
4541
4615
  moduleRoot
4542
4616
  );
4543
- return [import_node_path11.default.join(moduleRoot, ".build", TRIPLE, "release", "Modules")];
4617
+ return [import_node_path12.default.join(moduleRoot, ".build", TRIPLE, "release", "Modules")];
4544
4618
  }
4545
4619
  function swiftInterfaceForWasm(text3) {
4546
4620
  return text3.replace(
@@ -4552,11 +4626,11 @@ function swiftInterfaceForWasm(text3) {
4552
4626
  );
4553
4627
  }
4554
4628
  function swiftStandin(surface, binary, toolchain, work) {
4555
- const text3 = swiftInterfaceForWasm(import_node_fs11.default.readFileSync(surface.interface, "utf8"));
4556
- const search = import_node_path11.default.join(work, "interfaces");
4557
- const moduleDir = import_node_path11.default.join(search, `${surface.module}.swiftmodule`);
4558
- import_node_fs11.default.mkdirSync(moduleDir, { recursive: true });
4559
- import_node_fs11.default.writeFileSync(import_node_path11.default.join(moduleDir, `${TRIPLE}.swiftinterface`), text3);
4629
+ const text3 = swiftInterfaceForWasm(import_node_fs12.default.readFileSync(surface.interface, "utf8"));
4630
+ const search = import_node_path12.default.join(work, "interfaces");
4631
+ const moduleDir = import_node_path12.default.join(search, `${surface.module}.swiftmodule`);
4632
+ import_node_fs12.default.mkdirSync(moduleDir, { recursive: true });
4633
+ import_node_fs12.default.writeFileSync(import_node_path12.default.join(moduleDir, `${TRIPLE}.swiftinterface`), text3);
4560
4634
  const imports = [
4561
4635
  ...text3.matchAll(
4562
4636
  /^(?:@_exported[ \t]+)?import[ \t]+(?:(?:struct|class|enum|protocol|typealias|func|var|let)[ \t]+)?(\w+)/gm
@@ -4568,9 +4642,9 @@ function swiftStandin(surface, binary, toolchain, work) {
4568
4642
  );
4569
4643
  const target = ["-target", TRIPLE, "-sdk", sysroot, "-resource-dir", resources];
4570
4644
  const peach = peachModuleDirs(toolchain, imports).flatMap((dir) => ["-I", dir]);
4571
- const out = import_node_path11.default.join(work, "graphs");
4572
- import_node_fs11.default.mkdirSync(out, { recursive: true });
4573
- exec(import_node_path11.default.join(toolchain.toolchainBin, "swift-symbolgraph-extract"), [
4645
+ const out = import_node_path12.default.join(work, "graphs");
4646
+ import_node_fs12.default.mkdirSync(out, { recursive: true });
4647
+ exec(import_node_path12.default.join(toolchain.toolchainBin, "swift-symbolgraph-extract"), [
4574
4648
  "-module-name",
4575
4649
  surface.module,
4576
4650
  ...target,
@@ -4584,10 +4658,10 @@ function swiftStandin(surface, binary, toolchain, work) {
4584
4658
  "-output-dir",
4585
4659
  out
4586
4660
  ]);
4587
- 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")));
4661
+ 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")));
4588
4662
  const omit = /* @__PURE__ */ new Map();
4589
4663
  const plain = /* @__PURE__ */ new Set();
4590
- const file = import_node_path11.default.join(work, `${surface.module}.swift`);
4664
+ const file = import_node_path12.default.join(work, `${surface.module}.swift`);
4591
4665
  for (; ; ) {
4592
4666
  const { source, owners } = emitSwiftStandin(graphs, {
4593
4667
  module: surface.module,
@@ -4595,9 +4669,9 @@ function swiftStandin(surface, binary, toolchain, work) {
4595
4669
  omit,
4596
4670
  plain
4597
4671
  });
4598
- import_node_fs11.default.writeFileSync(file, source);
4672
+ import_node_fs12.default.writeFileSync(file, source);
4599
4673
  const check = (0, import_node_child_process8.spawnSync)(
4600
- import_node_path11.default.join(toolchain.toolchainBin, "swiftc"),
4674
+ import_node_path12.default.join(toolchain.toolchainBin, "swiftc"),
4601
4675
  [
4602
4676
  "-typecheck",
4603
4677
  "-parse-as-library",
@@ -4745,21 +4819,21 @@ function splitDeclarators(statement, names) {
4745
4819
  }
4746
4820
  function cStandin(surface, binary, toolchain, work) {
4747
4821
  const named = [
4748
- ...import_node_fs11.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
4822
+ ...import_node_fs12.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
4749
4823
  ].map((match) => match[1]);
4750
4824
  const headers = files(surface.headers, (name2) => name2.endsWith(".h"));
4751
4825
  const texts = new Map(
4752
4826
  headers.map((file) => [
4753
4827
  file,
4754
- import_node_fs11.default.readFileSync(import_node_path11.default.join(surface.headers, file), "utf8")
4828
+ import_node_fs12.default.readFileSync(import_node_path12.default.join(surface.headers, file), "utf8")
4755
4829
  ])
4756
4830
  );
4757
4831
  const objc = headers.find((file) => OBJC.test(texts.get(file)));
4758
4832
  if (objc) throw new Error(`its header ${objc} is Objective-C`);
4759
- const include = import_node_path11.default.join(work, "include");
4833
+ const include = import_node_path12.default.join(work, "include");
4760
4834
  for (const [file, text3] of texts) {
4761
- import_node_fs11.default.mkdirSync(import_node_path11.default.dirname(import_node_path11.default.join(include, file)), { recursive: true });
4762
- import_node_fs11.default.writeFileSync(import_node_path11.default.join(include, file), text3);
4835
+ import_node_fs12.default.mkdirSync(import_node_path12.default.dirname(import_node_path12.default.join(include, file)), { recursive: true });
4836
+ import_node_fs12.default.writeFileSync(import_node_path12.default.join(include, file), text3);
4763
4837
  }
4764
4838
  const roots = named.length > 0 ? named : headers;
4765
4839
  const modulemap = `module ${surface.module} {
@@ -4767,12 +4841,12 @@ ${roots.map((file) => ` header "${file}"
4767
4841
  `).join("")} export *
4768
4842
  }
4769
4843
  `;
4770
- const probe = import_node_path11.default.join(work, "declarations.c");
4771
- import_node_fs11.default.writeFileSync(probe, roots.map((file) => `#include "${file}"
4844
+ const probe = import_node_path12.default.join(work, "declarations.c");
4845
+ import_node_fs12.default.writeFileSync(probe, roots.map((file) => `#include "${file}"
4772
4846
  `).join(""));
4773
4847
  const { sysroot } = swiftSdkPaths(toolchain.moduleRoot, toolchain.toolchainBin);
4774
4848
  const ast = JSON.parse(
4775
- exec(import_node_path11.default.join(toolchain.toolchainBin, "clang"), [
4849
+ exec(import_node_path12.default.join(toolchain.toolchainBin, "clang"), [
4776
4850
  "-target",
4777
4851
  TRIPLE,
4778
4852
  "--sysroot",
@@ -4785,7 +4859,7 @@ ${roots.map((file) => ` header "${file}"
4785
4859
  probe
4786
4860
  ])
4787
4861
  );
4788
- const byPath = new Map(headers.map((file) => [import_node_path11.default.join(include, file), file]));
4862
+ const byPath = new Map(headers.map((file) => [import_node_path12.default.join(include, file), file]));
4789
4863
  const declarations = functionDeclarations(ast, new Set(byPath.keys()));
4790
4864
  const groups = /* @__PURE__ */ new Map();
4791
4865
  for (const declaration of declarations) {
@@ -4832,10 +4906,10 @@ ${roots.map((file) => ` header "${file}"
4832
4906
  "",
4833
4907
  ...definitions
4834
4908
  ].join("\n");
4835
- const out = import_node_path11.default.join(work, `${surface.module}.c`);
4836
- import_node_fs11.default.writeFileSync(out, source);
4909
+ const out = import_node_path12.default.join(work, `${surface.module}.c`);
4910
+ import_node_fs12.default.writeFileSync(out, source);
4837
4911
  try {
4838
- exec(import_node_path11.default.join(toolchain.toolchainBin, "clang"), [
4912
+ exec(import_node_path12.default.join(toolchain.toolchainBin, "clang"), [
4839
4913
  "-target",
4840
4914
  TRIPLE,
4841
4915
  "--sysroot",
@@ -4916,25 +4990,25 @@ function binaryStandins(binary, toolchain, provided) {
4916
4990
  for (const file of surface.kind === "swift" ? [surface.interface] : [
4917
4991
  surface.modulemap,
4918
4992
  ...files(surface.headers, (name2) => name2.endsWith(".h")).map(
4919
- (file2) => import_node_path11.default.join(surface.headers, file2)
4993
+ (file2) => import_node_path12.default.join(surface.headers, file2)
4920
4994
  )
4921
4995
  ])
4922
- hash.update(import_node_fs11.default.readFileSync(file));
4996
+ hash.update(import_node_fs12.default.readFileSync(file));
4923
4997
  }
4924
4998
  const id = hash.digest("hex").slice(0, 32);
4925
4999
  const memo2 = built.get(id);
4926
5000
  if (memo2) return memo2;
4927
- const cached2 = import_node_path11.default.join(cacheDir3, "standins", `${id}.json`);
4928
- if (import_node_fs11.default.existsSync(cached2)) {
4929
- const value = JSON.parse(import_node_fs11.default.readFileSync(cached2, "utf8"));
5001
+ const cached2 = import_node_path12.default.join(cacheDir3, "standins", `${id}.json`);
5002
+ if (import_node_fs12.default.existsSync(cached2)) {
5003
+ const value = JSON.parse(import_node_fs12.default.readFileSync(cached2, "utf8"));
4930
5004
  built.set(id, value);
4931
5005
  return value;
4932
5006
  }
4933
- const work = import_node_fs11.default.mkdtempSync(import_node_path11.default.join(import_node_os7.default.tmpdir(), "peach-standin-"));
5007
+ const work = import_node_fs12.default.mkdtempSync(import_node_path12.default.join(import_node_os7.default.tmpdir(), "peach-standin-"));
4934
5008
  let result;
4935
5009
  try {
4936
5010
  result = found.map((surface) => {
4937
- const dir = import_node_path11.default.join(work, surface.module);
5011
+ const dir = import_node_path12.default.join(work, surface.module);
4938
5012
  try {
4939
5013
  return surface.kind === "swift" ? swiftStandin(surface, binary, toolchain, dir) : cStandin(surface, binary, toolchain, dir);
4940
5014
  } catch (error) {
@@ -4943,13 +5017,13 @@ function binaryStandins(binary, toolchain, provided) {
4943
5017
  );
4944
5018
  }
4945
5019
  });
4946
- import_node_fs11.default.mkdirSync(import_node_path11.default.dirname(cached2), { recursive: true });
4947
- import_node_fs11.default.writeFileSync(cached2, JSON.stringify(result));
5020
+ import_node_fs12.default.mkdirSync(import_node_path12.default.dirname(cached2), { recursive: true });
5021
+ import_node_fs12.default.writeFileSync(cached2, JSON.stringify(result));
4948
5022
  built.set(id, result);
4949
5023
  } catch (error) {
4950
5024
  result = error instanceof Error ? error.message : String(error);
4951
5025
  } finally {
4952
- import_node_fs11.default.rmSync(work, { recursive: true, force: true });
5026
+ import_node_fs12.default.rmSync(work, { recursive: true, force: true });
4953
5027
  }
4954
5028
  return result;
4955
5029
  }
@@ -4963,23 +5037,23 @@ function swiftStandins(binaries, toolchain, provided = /* @__PURE__ */ new Set()
4963
5037
  }
4964
5038
  return { standins, gaps };
4965
5039
  }
4966
- var import_node_child_process8, import_node_crypto6, import_node_fs11, import_node_os7, import_node_path11, TRIPLE, cacheDir3, key, digests, files, OBJC, identChar, built;
5040
+ var import_node_child_process8, import_node_crypto6, import_node_fs12, import_node_os7, import_node_path12, TRIPLE, cacheDir3, key, digests, files, OBJC, identChar, built;
4967
5041
  var init_swift_standins = __esm({
4968
5042
  "src/swift-standins.ts"() {
4969
5043
  "use strict";
4970
5044
  import_node_child_process8 = require("node:child_process");
4971
5045
  import_node_crypto6 = require("node:crypto");
4972
- import_node_fs11 = __toESM(require("node:fs"), 1);
5046
+ import_node_fs12 = __toESM(require("node:fs"), 1);
4973
5047
  import_node_os7 = __toESM(require("node:os"), 1);
4974
- import_node_path11 = __toESM(require("node:path"), 1);
5048
+ import_node_path12 = __toESM(require("node:path"), 1);
4975
5049
  init_cli_version();
4976
5050
  init_swift_compile();
4977
5051
  init_swift_standin_emit();
4978
5052
  TRIPLE = "wasm32-unknown-wasip1";
4979
- cacheDir3 = import_node_path11.default.join(import_node_os7.default.tmpdir(), "peach-swift-standins");
5053
+ cacheDir3 = import_node_path12.default.join(import_node_os7.default.tmpdir(), "peach-swift-standins");
4980
5054
  key = (...parts) => (0, import_node_crypto6.createHash)("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
4981
5055
  digests = /* @__PURE__ */ new Map();
4982
- 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() : [];
5056
+ 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() : [];
4983
5057
  OBJC = /^\s*(?:@interface|@protocol|@class|@import|#import)\b/m;
4984
5058
  identChar = (char) => char !== void 0 && /[\w$]/.test(char);
4985
5059
  built = /* @__PURE__ */ new Map();
@@ -6473,7 +6547,7 @@ var require_lib = __commonJS({
6473
6547
  function readXcodeJsonProject(xcodeproj, source) {
6474
6548
  const json = import_json5.default.parse(source);
6475
6549
  if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
6476
- const projectDir = import_node_path12.default.dirname(xcodeproj);
6550
+ const projectDir = import_node_path13.default.dirname(xcodeproj);
6477
6551
  const objects = {};
6478
6552
  let next = 0;
6479
6553
  const add = (entry, id) => {
@@ -6486,7 +6560,7 @@ function readXcodeJsonProject(xcodeproj, source) {
6486
6560
  const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
6487
6561
  if (base) {
6488
6562
  if (base[1] === "PROJECT")
6489
- return { sourceTree: "<absolute>", path: import_node_path12.default.join(projectDir, base[2]) };
6563
+ return { sourceTree: "<absolute>", path: import_node_path13.default.join(projectDir, base[2]) };
6490
6564
  if (base[1] === "PRODUCTS")
6491
6565
  return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
6492
6566
  return null;
@@ -6494,7 +6568,7 @@ function readXcodeJsonProject(xcodeproj, source) {
6494
6568
  const unescaped = raw2.replaceAll("\\<", "<");
6495
6569
  if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
6496
6570
  if (unescaped.startsWith("~")) return null;
6497
- return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path12.default.join(groupDir, unescaped) };
6571
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path13.default.join(groupDir, unescaped) };
6498
6572
  };
6499
6573
  const memberships = [];
6500
6574
  const folders = [];
@@ -6505,7 +6579,7 @@ function readXcodeJsonProject(xcodeproj, source) {
6505
6579
  const kind = text2(entry.kind) ?? "file-reference";
6506
6580
  const raw2 = text2(entry.path) ?? "";
6507
6581
  const located = raw2 === "" ? null : locate(raw2, parent.dir);
6508
- const name2 = text2(entry.name) ?? import_node_path12.default.basename(raw2);
6582
+ const name2 = text2(entry.name) ?? import_node_path13.default.basename(raw2);
6509
6583
  const node = { id: "", name: name2, dir: null, parent, children: [] };
6510
6584
  if (kind === "group" || kind === "variant-group" || kind === "version-group") {
6511
6585
  node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
@@ -6620,7 +6694,7 @@ function readXcodeJsonProject(xcodeproj, source) {
6620
6694
  if (!isObject(entry)) continue;
6621
6695
  const repository = text2(entry.repository);
6622
6696
  const local = text2(entry.path);
6623
- 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$/, "");
6697
+ 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$/, "");
6624
6698
  const id = text2(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
6625
6699
  packageIds.set(name2.toLowerCase(), id);
6626
6700
  }
@@ -6788,11 +6862,11 @@ function readXcodeJsonProject(xcodeproj, source) {
6788
6862
  function isJsonObject(value) {
6789
6863
  return typeof value === "object" && value !== null && !Array.isArray(value);
6790
6864
  }
6791
- var import_node_path12, import_json5, isObject, text2, items, PHASE_ISA;
6865
+ var import_node_path13, import_json5, isObject, text2, items, PHASE_ISA;
6792
6866
  var init_xcode_json_project = __esm({
6793
6867
  "src/xcode-json-project.ts"() {
6794
6868
  "use strict";
6795
- import_node_path12 = __toESM(require("node:path"), 1);
6869
+ import_node_path13 = __toESM(require("node:path"), 1);
6796
6870
  import_json5 = __toESM(require_lib(), 1);
6797
6871
  isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
6798
6872
  text2 = (value) => typeof value === "string" ? value : void 0;
@@ -6899,27 +6973,27 @@ function parseOpenStepPlist(text3) {
6899
6973
  return root;
6900
6974
  }
6901
6975
  function walkFiles(dir) {
6902
- if (!import_node_fs12.default.existsSync(dir)) return [];
6976
+ if (!import_node_fs13.default.existsSync(dir)) return [];
6903
6977
  const out = [];
6904
- for (const entry of import_node_fs12.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
6978
+ for (const entry of import_node_fs13.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
6905
6979
  if (entry.name.startsWith(".")) continue;
6906
- const full = import_node_path13.default.join(dir, entry.name);
6980
+ const full = import_node_path14.default.join(dir, entry.name);
6907
6981
  if (entry.isDirectory()) out.push(...walkFiles(full));
6908
6982
  else if (entry.isFile()) out.push(full);
6909
6983
  }
6910
6984
  return out;
6911
6985
  }
6912
6986
  function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
6913
- if (seen.has(file) || !import_node_fs12.default.existsSync(file)) return {};
6987
+ if (seen.has(file) || !import_node_fs13.default.existsSync(file)) return {};
6914
6988
  seen.add(file);
6915
6989
  const settings = {};
6916
- for (const raw2 of import_node_fs12.default.readFileSync(file, "utf8").split("\n")) {
6990
+ for (const raw2 of import_node_fs13.default.readFileSync(file, "utf8").split("\n")) {
6917
6991
  const line = raw2.replace(/\/\/.*$/, "").trim();
6918
6992
  const include = /^#include\??\s+"([^"]+)"/.exec(line);
6919
6993
  if (include) {
6920
6994
  Object.assign(
6921
6995
  settings,
6922
- readXcconfig(import_node_path13.default.resolve(import_node_path13.default.dirname(file), include[1]), seen)
6996
+ readXcconfig(import_node_path14.default.resolve(import_node_path14.default.dirname(file), include[1]), seen)
6923
6997
  );
6924
6998
  continue;
6925
6999
  }
@@ -6969,22 +7043,22 @@ function decodeXml(text3) {
6969
7043
  return text3.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
6970
7044
  }
6971
7045
  function workspaceReferences(workspace) {
6972
- const data = import_node_path13.default.join(workspace, "contents.xcworkspacedata");
6973
- if (!import_node_fs12.default.existsSync(data))
7046
+ const data = import_node_path14.default.join(workspace, "contents.xcworkspacedata");
7047
+ if (!import_node_fs13.default.existsSync(data))
6974
7048
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
6975
- const container = import_node_path13.default.dirname(workspace);
7049
+ const container = import_node_path14.default.dirname(workspace);
6976
7050
  const locate = (location, base) => {
6977
7051
  const colon = location.indexOf(":");
6978
7052
  const kind = location.slice(0, colon);
6979
7053
  const rest = location.slice(colon + 1);
6980
- if (kind === "group") return import_node_path13.default.resolve(base, rest);
6981
- if (kind === "container" || kind === "self") return import_node_path13.default.resolve(container, rest);
6982
- if (kind === "absolute") return import_node_path13.default.resolve(rest);
6983
- throw new Error(`${import_node_path13.default.basename(workspace)} has an unsupported location ${location}`);
7054
+ if (kind === "group") return import_node_path14.default.resolve(base, rest);
7055
+ if (kind === "container" || kind === "self") return import_node_path14.default.resolve(container, rest);
7056
+ if (kind === "absolute") return import_node_path14.default.resolve(rest);
7057
+ throw new Error(`${import_node_path14.default.basename(workspace)} has an unsupported location ${location}`);
6984
7058
  };
6985
7059
  const groups = [container];
6986
7060
  const references = [];
6987
- for (const [, closing, tag, attributes, selfClosing] of import_node_fs12.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
7061
+ for (const [, closing, tag, attributes, selfClosing] of import_node_fs13.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
6988
7062
  if (closing) {
6989
7063
  if (tag === "Group") groups.pop();
6990
7064
  continue;
@@ -6999,8 +7073,8 @@ function workspaceReferences(workspace) {
6999
7073
  }
7000
7074
  function xcodeProjectFile(xcodeproj) {
7001
7075
  for (const name2 of ["project.pbxproj", "project.xcproj"]) {
7002
- const file = import_node_path13.default.join(xcodeproj, name2);
7003
- if (import_node_fs12.default.existsSync(file)) return file;
7076
+ const file = import_node_path14.default.join(xcodeproj, name2);
7077
+ if (import_node_fs13.default.existsSync(file)) return file;
7004
7078
  }
7005
7079
  return null;
7006
7080
  }
@@ -7008,10 +7082,10 @@ function loadProject(xcodeproj) {
7008
7082
  const projectFile = xcodeProjectFile(xcodeproj);
7009
7083
  if (!projectFile)
7010
7084
  throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
7011
- const mtimeMs = import_node_fs12.default.statSync(projectFile).mtimeMs;
7085
+ const mtimeMs = import_node_fs13.default.statSync(projectFile).mtimeMs;
7012
7086
  const cached2 = loaded.get(projectFile);
7013
7087
  if (cached2?.mtimeMs === mtimeMs) return cached2.project;
7014
- const source = import_node_fs12.default.readFileSync(projectFile, "utf8");
7088
+ const source = import_node_fs13.default.readFileSync(projectFile, "utf8");
7015
7089
  const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
7016
7090
  if (!isDict(root) || !isDict(root.objects)) {
7017
7091
  throw new Error(`${projectFile} has no objects table`);
@@ -7025,8 +7099,8 @@ function loadProject(xcodeproj) {
7025
7099
  if (!project || project.isa !== "PBXProject") {
7026
7100
  throw new Error(`${projectFile} has no PBXProject root`);
7027
7101
  }
7028
- const projectDir = import_node_fs12.default.realpathSync(
7029
- import_node_path13.default.resolve(import_node_path13.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
7102
+ const projectDir = import_node_fs13.default.realpathSync(
7103
+ import_node_path14.default.resolve(import_node_path14.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
7030
7104
  );
7031
7105
  const parent = /* @__PURE__ */ new Map();
7032
7106
  for (const [id, entry] of Object.entries(objects)) {
@@ -7044,11 +7118,11 @@ function loadProject(xcodeproj) {
7044
7118
  const own = str(entry.path) ?? "";
7045
7119
  const tree = str(entry.sourceTree) ?? "<group>";
7046
7120
  if (tree === "<absolute>") result2 = own;
7047
- else if (tree === "SOURCE_ROOT") result2 = import_node_path13.default.join(projectDir, own);
7121
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path14.default.join(projectDir, own);
7048
7122
  else if (tree === "<group>") {
7049
7123
  const up = parent.get(id);
7050
7124
  const base = up ? resolvePath(up) : projectDir;
7051
- result2 = base === null ? null : import_node_path13.default.join(base, own);
7125
+ result2 = base === null ? null : import_node_path14.default.join(base, own);
7052
7126
  }
7053
7127
  }
7054
7128
  resolvedPaths.set(id, result2);
@@ -7148,7 +7222,7 @@ function targetMembers(ref) {
7148
7222
  const addResource = (file) => {
7149
7223
  if (isDirectory(file)) {
7150
7224
  for (const inner of walkFiles(file)) resources.add(inner);
7151
- } else if (import_node_fs12.default.existsSync(file)) resources.add(file);
7225
+ } else if (import_node_fs13.default.existsSync(file)) resources.add(file);
7152
7226
  };
7153
7227
  const fileRefPaths = (refId) => {
7154
7228
  const entry = project.object(refId);
@@ -7169,7 +7243,7 @@ function targetMembers(ref) {
7169
7243
  for (const buildFileId of list(phase.files)) {
7170
7244
  for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
7171
7245
  if (phase.isa === "PBXSourcesBuildPhase") {
7172
- if (!import_node_fs12.default.existsSync(file)) continue;
7246
+ if (!import_node_fs13.default.existsSync(file)) continue;
7173
7247
  allSources.add(file);
7174
7248
  if (file.endsWith(".swift")) sources.add(file);
7175
7249
  } else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
@@ -7177,7 +7251,7 @@ function targetMembers(ref) {
7177
7251
  }
7178
7252
  }
7179
7253
  const addSynchronized = (folder, relative) => {
7180
- const file = import_node_path13.default.join(folder, relative);
7254
+ const file = import_node_path14.default.join(folder, relative);
7181
7255
  if (NEVER_MEMBER.test(relative)) return;
7182
7256
  if (file.endsWith(".swift")) {
7183
7257
  if (!relative.split("/").some((segment2) => BUNDLE_DIR.test(segment2))) {
@@ -7202,7 +7276,7 @@ function targetMembers(ref) {
7202
7276
  }
7203
7277
  if (owned.has(groupId)) {
7204
7278
  for (const file of walkFiles(folder)) {
7205
- const relative = import_node_path13.default.relative(folder, file).split(import_node_path13.default.sep).join("/");
7279
+ const relative = import_node_path14.default.relative(folder, file).split(import_node_path14.default.sep).join("/");
7206
7280
  if ([...exceptions].some(
7207
7281
  (exception) => relative === exception || relative.startsWith(`${exception}/`)
7208
7282
  ))
@@ -7211,14 +7285,14 @@ function targetMembers(ref) {
7211
7285
  }
7212
7286
  } else {
7213
7287
  for (const relative of exceptions) {
7214
- const file = import_node_path13.default.join(folder, relative);
7288
+ const file = import_node_path14.default.join(folder, relative);
7215
7289
  if (isDirectory(file)) {
7216
7290
  for (const inner of walkFiles(file))
7217
7291
  addSynchronized(
7218
7292
  folder,
7219
- import_node_path13.default.relative(folder, inner).split(import_node_path13.default.sep).join("/")
7293
+ import_node_path14.default.relative(folder, inner).split(import_node_path14.default.sep).join("/")
7220
7294
  );
7221
- } else if (import_node_fs12.default.existsSync(file)) addSynchronized(folder, relative);
7295
+ } else if (import_node_fs13.default.existsSync(file)) addSynchronized(folder, relative);
7222
7296
  }
7223
7297
  }
7224
7298
  }
@@ -7231,8 +7305,8 @@ function targetMembers(ref) {
7231
7305
  function commonAncestor(dirs) {
7232
7306
  let common = dirs[0];
7233
7307
  for (const dir of dirs) {
7234
- while (common !== import_node_path13.default.dirname(common) && import_node_path13.default.relative(common, dir).startsWith(".."))
7235
- common = import_node_path13.default.dirname(common);
7308
+ while (common !== import_node_path14.default.dirname(common) && import_node_path14.default.relative(common, dir).startsWith(".."))
7309
+ common = import_node_path14.default.dirname(common);
7236
7310
  }
7237
7311
  return common;
7238
7312
  }
@@ -7241,8 +7315,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
7241
7315
  const projects2 = [];
7242
7316
  const projectAt = /* @__PURE__ */ new Map();
7243
7317
  const addProject = (xcodeproj) => {
7244
- const key2 = import_node_path13.default.resolve(xcodeproj);
7245
- if (projectAt.has(key2) || key2.split(import_node_path13.default.sep).includes("Pods")) return;
7318
+ const key2 = import_node_path14.default.resolve(xcodeproj);
7319
+ if (projectAt.has(key2) || key2.split(import_node_path14.default.sep).includes("Pods")) return;
7246
7320
  if (!xcodeProjectFile(key2)) return;
7247
7321
  const project = loadProject(key2);
7248
7322
  projectAt.set(key2, project);
@@ -7259,7 +7333,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
7259
7333
  for (const reference of listed)
7260
7334
  if (reference.endsWith(".xcodeproj")) addProject(reference);
7261
7335
  if (projects2.length === 0) {
7262
- throw new Error(`${import_node_path13.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
7336
+ throw new Error(`${import_node_path14.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
7263
7337
  }
7264
7338
  return { listed, projects: projects2, projectAt };
7265
7339
  }
@@ -7280,7 +7354,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7280
7354
  const allTargets = projects2.flatMap(nativeTargets);
7281
7355
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
7282
7356
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
7283
- const container = import_node_path13.default.basename(xcodeprojOrWorkspace);
7357
+ const container = import_node_path14.default.basename(xcodeprojOrWorkspace);
7284
7358
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
7285
7359
  if (named.length !== 1) {
7286
7360
  throw new Error(
@@ -7292,14 +7366,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7292
7366
  for (const ref of allTargets) {
7293
7367
  const product = ref.project.object(str(ref.target.productReference));
7294
7368
  const file = str(product?.path);
7295
- if (file && !byProduct.has(import_node_path13.default.basename(file)))
7296
- byProduct.set(import_node_path13.default.basename(file), ref);
7369
+ if (file && !byProduct.has(import_node_path14.default.basename(file)))
7370
+ byProduct.set(import_node_path14.default.basename(file), ref);
7297
7371
  }
7298
7372
  const proxied = (project, proxyId) => {
7299
7373
  const proxy = project.object(proxyId);
7300
7374
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
7301
7375
  const portal = str(proxy.containerPortal);
7302
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path13.default.resolve(project.resolvePath(portal ?? "") ?? ""));
7376
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path14.default.resolve(project.resolvePath(portal ?? "") ?? ""));
7303
7377
  const remote = str(proxy.remoteGlobalIDString);
7304
7378
  if (!owner || !remote) return void 0;
7305
7379
  return nativeTargets(owner).find(
@@ -7320,7 +7394,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7320
7394
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
7321
7395
  for (const buildFileId of list(phase.files)) {
7322
7396
  const file = project.object(str(project.object(buildFileId)?.fileRef));
7323
- 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;
7397
+ 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;
7324
7398
  if (resolved) found.push(resolved);
7325
7399
  }
7326
7400
  }
@@ -7341,7 +7415,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7341
7415
  const name2 = str(ref.target.name) ?? ref.id;
7342
7416
  const { get: settings2, keys } = targetSettings(ref, {
7343
7417
  TARGET_NAME: name2,
7344
- PROJECT_NAME: import_node_path13.default.basename(ref.project.xcodeproj, ".xcodeproj"),
7418
+ PROJECT_NAME: import_node_path14.default.basename(ref.project.xcodeproj, ".xcodeproj"),
7345
7419
  SRCROOT: ref.project.projectDir,
7346
7420
  SOURCE_ROOT: ref.project.projectDir,
7347
7421
  PROJECT_DIR: ref.project.projectDir,
@@ -7372,8 +7446,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7372
7446
  }
7373
7447
  return value;
7374
7448
  };
7375
- const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path13.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
7376
- const sourceInfo = infoPlistFile ? import_plist.default.parse(import_node_fs12.default.readFileSync(infoPlistFile, "utf8")) : {};
7449
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path14.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
7450
+ const sourceInfo = infoPlistFile ? import_plist.default.parse(import_node_fs13.default.readFileSync(infoPlistFile, "utf8")) : {};
7377
7451
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
7378
7452
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
7379
7453
  }
@@ -7391,12 +7465,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7391
7465
  };
7392
7466
  }
7393
7467
  const localPackageDirs = [
7394
- ...listed.filter((reference) => import_node_fs12.default.existsSync(import_node_path13.default.join(reference, "Package.swift"))),
7468
+ ...listed.filter((reference) => import_node_fs13.default.existsSync(import_node_path14.default.join(reference, "Package.swift"))),
7395
7469
  ...projects2.flatMap(
7396
7470
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
7397
7471
  if (!isDict(entry)) return [];
7398
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path13.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
7399
- return candidate && import_node_fs12.default.existsSync(import_node_path13.default.join(candidate, "Package.swift")) ? [candidate] : [];
7472
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path14.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
7473
+ return candidate && import_node_fs13.default.existsSync(import_node_path14.default.join(candidate, "Package.swift")) ? [candidate] : [];
7400
7474
  })
7401
7475
  )
7402
7476
  ];
@@ -7420,7 +7494,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7420
7494
  product,
7421
7495
  source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
7422
7496
  kind: "local",
7423
- dir: import_node_path13.default.resolve(
7497
+ dir: import_node_path14.default.resolve(
7424
7498
  project.projectDir,
7425
7499
  str(reference.relativePath) ?? ""
7426
7500
  )
@@ -7442,8 +7516,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7442
7516
  }
7443
7517
  }
7444
7518
  }
7445
- const resolvedFile = import_node_path13.default.join(
7446
- workspace ?? import_node_path13.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
7519
+ const resolvedFile = import_node_path14.default.join(
7520
+ workspace ?? import_node_path14.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
7447
7521
  "xcshareddata",
7448
7522
  "swiftpm",
7449
7523
  "Package.resolved"
@@ -7453,13 +7527,13 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7453
7527
  ...module2,
7454
7528
  rootDir: commonAncestor(
7455
7529
  [
7456
- workspace ? import_node_path13.default.dirname(workspace) : app.project.projectDir,
7530
+ workspace ? import_node_path14.default.dirname(workspace) : app.project.projectDir,
7457
7531
  ...used.map((project) => project.projectDir),
7458
7532
  ...localPackageDirs,
7459
7533
  ...linkedProducts.flatMap(
7460
- ({ source }) => source.kind === "local" && import_node_fs12.default.existsSync(source.dir) ? [source.dir] : []
7534
+ ({ source }) => source.kind === "local" && import_node_fs13.default.existsSync(source.dir) ? [source.dir] : []
7461
7535
  )
7462
- ].map((dir) => import_node_fs12.default.realpathSync(dir))
7536
+ ].map((dir) => import_node_fs13.default.realpathSync(dir))
7463
7537
  ),
7464
7538
  projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
7465
7539
  infoPlist: import_plist.default.build(info),
@@ -7467,19 +7541,19 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
7467
7541
  frameworks,
7468
7542
  linkedProducts,
7469
7543
  localPackageDirs: [
7470
- ...new Set(localPackageDirs.map((dir) => import_node_fs12.default.realpathSync(dir)))
7544
+ ...new Set(localPackageDirs.map((dir) => import_node_fs13.default.realpathSync(dir)))
7471
7545
  ].sort(),
7472
7546
  binaryFrameworks: [...binaryFrameworks].sort(),
7473
- packageResolved: import_node_fs12.default.existsSync(resolvedFile) ? resolvedFile : null,
7547
+ packageResolved: import_node_fs13.default.existsSync(resolvedFile) ? resolvedFile : null,
7474
7548
  appTargets: appTargetNames
7475
7549
  };
7476
7550
  }
7477
- var import_node_fs12, import_node_path13, import_plist, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
7551
+ var import_node_fs13, import_node_path14, import_plist, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
7478
7552
  var init_xcode_project = __esm({
7479
7553
  "src/xcode-project.ts"() {
7480
7554
  "use strict";
7481
- import_node_fs12 = __toESM(require("node:fs"), 1);
7482
- import_node_path13 = __toESM(require("node:path"), 1);
7555
+ import_node_fs13 = __toESM(require("node:fs"), 1);
7556
+ import_node_path14 = __toESM(require("node:path"), 1);
7483
7557
  import_plist = __toESM(require_plist(), 1);
7484
7558
  init_xcode_json_project();
7485
7559
  isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -7499,7 +7573,7 @@ var init_xcode_project = __esm({
7499
7573
  arch: "arm64",
7500
7574
  variant: "normal"
7501
7575
  };
7502
- isDirectory = (dir) => import_node_fs12.default.existsSync(dir) && import_node_fs12.default.statSync(dir).isDirectory();
7576
+ isDirectory = (dir) => import_node_fs13.default.existsSync(dir) && import_node_fs13.default.statSync(dir).isDirectory();
7503
7577
  loaded = /* @__PURE__ */ new Map();
7504
7578
  targetRefs = /* @__PURE__ */ new WeakMap();
7505
7579
  }
@@ -7507,17 +7581,17 @@ var init_xcode_project = __esm({
7507
7581
 
7508
7582
  // src/swift-host.ts
7509
7583
  function swiftPackageId(packagePath) {
7510
- return import_node_path14.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
7584
+ return import_node_path15.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
7511
7585
  }
7512
7586
  function nativeSourceDescriptor(packagePath) {
7513
- packagePath = import_node_fs13.default.realpathSync(packagePath);
7514
- const file = import_node_path14.default.join(packagePath, NATIVE_DESCRIPTOR);
7515
- if (!import_node_fs13.default.existsSync(file)) return null;
7587
+ packagePath = import_node_fs14.default.realpathSync(packagePath);
7588
+ const file = import_node_path15.default.join(packagePath, NATIVE_DESCRIPTOR);
7589
+ if (!import_node_fs14.default.existsSync(file)) return null;
7516
7590
  const value = JSON.parse(
7517
7591
  readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
7518
7592
  );
7519
7593
  const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
7520
- if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs13.default.existsSync(import_node_path14.default.join(packagePath, NATIVE_GLUE))) {
7594
+ if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs14.default.existsSync(import_node_path15.default.join(packagePath, NATIVE_GLUE))) {
7521
7595
  throw invalid();
7522
7596
  }
7523
7597
  if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
@@ -7526,7 +7600,7 @@ function nativeSourceDescriptor(packagePath) {
7526
7600
  return value;
7527
7601
  }
7528
7602
  function projectFor(packagePath, hosted) {
7529
- packagePath = import_node_fs13.default.realpathSync(packagePath);
7603
+ packagePath = import_node_fs14.default.realpathSync(packagePath);
7530
7604
  const existing = projects.get(packagePath);
7531
7605
  if (existing) {
7532
7606
  if (hosted && !existing.hosted) {
@@ -7547,14 +7621,14 @@ function projectFor(packagePath, hosted) {
7547
7621
  return created;
7548
7622
  }
7549
7623
  function swiftPackages(entry, app) {
7550
- const stamp = (file) => file && import_node_fs13.default.existsSync(file) ? import_node_fs13.default.statSync(file).mtimeMs : 0;
7624
+ const stamp = (file) => file && import_node_fs14.default.existsSync(file) ? import_node_fs14.default.statSync(file).mtimeMs : 0;
7551
7625
  const key2 = JSON.stringify([
7552
7626
  app.linkedProducts,
7553
7627
  app.packageResolved,
7554
7628
  stamp(app.packageResolved),
7555
- app.localPackageDirs.map((dir) => stamp(import_node_path14.default.join(dir, "Package.swift"))),
7629
+ app.localPackageDirs.map((dir) => stamp(import_node_path15.default.join(dir, "Package.swift"))),
7556
7630
  app.linkedProducts.map(
7557
- ({ source }) => source.kind === "local" ? stamp(import_node_path14.default.join(source.dir, "Package.swift")) : 0
7631
+ ({ source }) => source.kind === "local" ? stamp(import_node_path15.default.join(source.dir, "Package.swift")) : 0
7558
7632
  )
7559
7633
  ]);
7560
7634
  let cached2 = entry.packages;
@@ -7603,8 +7677,8 @@ function swiftPackages(entry, app) {
7603
7677
  }
7604
7678
  function xcodeInputKey(layout, file, relative) {
7605
7679
  const owner = layout.targetDirs.get(file);
7606
- if (owner) return import_node_path14.default.posix.join(owner, relative);
7607
- return relative.startsWith(CHECKOUTS_PREFIX) ? import_node_path14.default.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length)) : relative;
7680
+ if (owner) return import_node_path15.default.posix.join(owner, relative);
7681
+ return relative.startsWith(CHECKOUTS_PREFIX) ? import_node_path15.default.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length)) : relative;
7608
7682
  }
7609
7683
  function xcodeLayout(root) {
7610
7684
  const registered = xcodeProjects.get(root);
@@ -7615,7 +7689,7 @@ function xcodeLayout(root) {
7615
7689
  const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
7616
7690
  const targets = [];
7617
7691
  for (const framework of app.frameworks) {
7618
- const dir = import_node_path14.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
7692
+ const dir = import_node_path15.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
7619
7693
  for (const file of framework.sources) {
7620
7694
  if (targetDirs.has(file)) continue;
7621
7695
  targetDirs.set(file, dir);
@@ -7635,7 +7709,7 @@ function xcodeLayout(root) {
7635
7709
  for (const standin of standins)
7636
7710
  targets.push({
7637
7711
  name: standin.module,
7638
- path: import_node_path14.default.posix.join(XCODE_STANDINS_DIR, standin.module),
7712
+ path: import_node_path15.default.posix.join(XCODE_STANDINS_DIR, standin.module),
7639
7713
  executable: false,
7640
7714
  resources: false,
7641
7715
  exclude: [],
@@ -7643,19 +7717,19 @@ function xcodeLayout(root) {
7643
7717
  mainActorIsolation: false
7644
7718
  });
7645
7719
  for (const target of packages.targets) {
7646
- const relative = import_node_path14.default.relative(
7647
- target.remote ? import_node_path14.default.join(root, REMOTE_CHECKOUTS) : root,
7720
+ const relative = import_node_path15.default.relative(
7721
+ target.remote ? import_node_path15.default.join(root, REMOTE_CHECKOUTS) : root,
7648
7722
  target.dir
7649
7723
  );
7650
- if (relative === ".." || relative.startsWith(`..${import_node_path14.default.sep}`) || import_node_path14.default.isAbsolute(relative))
7724
+ if (relative === ".." || relative.startsWith(`..${import_node_path15.default.sep}`) || import_node_path15.default.isAbsolute(relative))
7651
7725
  throw new Error(`swift input escapes the selected package: ${target.dir}`);
7652
- const posix = relative.split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep);
7726
+ const posix = relative.split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
7653
7727
  targets.push({
7654
7728
  ...target,
7655
- path: target.remote ? import_node_path14.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
7729
+ path: target.remote ? import_node_path15.default.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
7656
7730
  exclude: []
7657
7731
  });
7658
- if (!target.remote) files2.add(import_node_path14.default.join(target.packageDir, "Package.swift"));
7732
+ if (!target.remote) files2.add(import_node_path15.default.join(target.packageDir, "Package.swift"));
7659
7733
  for (const file of target.files) files2.add(file);
7660
7734
  }
7661
7735
  for (const target of targets) {
@@ -7685,25 +7759,25 @@ function xcodeManifest(layout) {
7685
7759
  ].join("\n");
7686
7760
  }
7687
7761
  function packageFiles(root) {
7688
- const canonicalRoot = import_node_fs13.default.realpathSync(root);
7762
+ const canonicalRoot = import_node_fs14.default.realpathSync(root);
7689
7763
  const xcode = xcodeLayout(canonicalRoot);
7690
7764
  return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
7691
7765
  }
7692
7766
  function sourceTreeFiles(dir, canonicalRoot) {
7693
7767
  const found = [];
7694
7768
  const walk2 = (dir2) => {
7695
- for (const entry of import_node_fs13.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
7769
+ for (const entry of import_node_fs14.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
7696
7770
  if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
7697
7771
  continue;
7698
- const full = import_node_path14.default.join(dir2, entry.name);
7772
+ const full = import_node_path15.default.join(dir2, entry.name);
7699
7773
  if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
7700
- const real = import_node_fs13.default.realpathSync(full);
7701
- const relative = import_node_path14.default.relative(canonicalRoot, real);
7702
- if (relative.startsWith(`..${import_node_path14.default.sep}`) || relative === ".." || import_node_path14.default.isAbsolute(relative)) {
7774
+ const real = import_node_fs14.default.realpathSync(full);
7775
+ const relative = import_node_path15.default.relative(canonicalRoot, real);
7776
+ if (relative.startsWith(`..${import_node_path15.default.sep}`) || relative === ".." || import_node_path15.default.isAbsolute(relative)) {
7703
7777
  throw new Error(`swift input escapes the selected package: ${full}`);
7704
7778
  }
7705
7779
  if (entry.isDirectory()) {
7706
- if (import_node_fs13.default.existsSync(import_node_path14.default.join(full, "Package.swift"))) continue;
7780
+ if (import_node_fs14.default.existsSync(import_node_path15.default.join(full, "Package.swift"))) continue;
7707
7781
  walk2(full);
7708
7782
  } else if (entry.isFile()) {
7709
7783
  found.push(full);
@@ -7711,63 +7785,22 @@ function sourceTreeFiles(dir, canonicalRoot) {
7711
7785
  }
7712
7786
  }
7713
7787
  };
7714
- if (import_node_fs13.default.existsSync(dir)) walk2(import_node_fs13.default.realpathSync(dir));
7788
+ if (import_node_fs14.default.existsSync(dir)) walk2(import_node_fs14.default.realpathSync(dir));
7715
7789
  return found;
7716
7790
  }
7717
- function readPackageFile(root, file, maxBytes) {
7718
- const canonicalRoot = import_node_fs13.default.realpathSync(root);
7719
- const relative = import_node_path14.default.relative(canonicalRoot, import_node_fs13.default.realpathSync(file));
7720
- if (relative === ".." || relative.startsWith(`..${import_node_path14.default.sep}`) || import_node_path14.default.isAbsolute(relative)) {
7721
- throw new Error(`swift input escapes the selected package: ${file}`);
7722
- }
7723
- let ancestor = import_node_path14.default.resolve(file);
7724
- while (ancestor !== canonicalRoot) {
7725
- if (import_node_fs13.default.lstatSync(ancestor).isSymbolicLink()) {
7726
- throw new Error(`swift input is a symlink: ${ancestor}`);
7727
- }
7728
- const parent = import_node_path14.default.dirname(ancestor);
7729
- if (parent === ancestor)
7730
- throw new Error(`swift input escapes the selected package: ${file}`);
7731
- ancestor = parent;
7732
- }
7733
- const expected = import_node_fs13.default.statSync(file);
7734
- const fd = import_node_fs13.default.openSync(file, import_node_fs13.default.constants.O_RDONLY | import_node_fs13.default.constants.O_NOFOLLOW);
7735
- try {
7736
- const stat = import_node_fs13.default.fstatSync(fd);
7737
- if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
7738
- throw new Error(`swift input changed while opening: ${file}`);
7739
- }
7740
- if (!stat.isFile() || stat.size > maxBytes) {
7741
- throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
7742
- }
7743
- const bytes = Buffer.alloc(stat.size + 1);
7744
- let offset = 0;
7745
- while (offset < bytes.length) {
7746
- const count = import_node_fs13.default.readSync(fd, bytes, offset, bytes.length - offset, null);
7747
- if (count === 0) break;
7748
- offset += count;
7749
- }
7750
- if (offset !== stat.size || import_node_fs13.default.fstatSync(fd).size !== stat.size) {
7751
- throw new Error(`swift input changed while reading: ${file}`);
7752
- }
7753
- return bytes.subarray(0, offset);
7754
- } finally {
7755
- import_node_fs13.default.closeSync(fd);
7756
- }
7757
- }
7758
7791
  function sourceFiles(root) {
7759
7792
  return packageFiles(root).filter((file) => file.endsWith(".swift"));
7760
7793
  }
7761
7794
  function resourceCandidateFiles(root) {
7762
7795
  return packageFiles(root).filter(
7763
- (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path14.default.basename(file))
7796
+ (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path15.default.basename(file))
7764
7797
  );
7765
7798
  }
7766
7799
  function buildSwiftResourceTable(project, baseUrl) {
7767
7800
  const limits = inputLimits(Boolean(project.hosted));
7768
7801
  const absolute = resourceCandidateFiles(project.packagePath);
7769
7802
  const relative = absolute.map(
7770
- (file) => import_node_path14.default.relative(project.packagePath, file).split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep)
7803
+ (file) => import_node_path15.default.relative(project.packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
7771
7804
  );
7772
7805
  const byRelative = new Map(absolute.map((file, index) => [relative[index], file]));
7773
7806
  const readContents = (candidate) => {
@@ -7789,16 +7822,16 @@ function buildSwiftResourceTable(project, baseUrl) {
7789
7822
  for (const { name: name2, file, scale } of found) {
7790
7823
  const disk = byRelative.get(file);
7791
7824
  if (!disk) continue;
7792
- if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs13.default.statSync(disk).size > limits.imageTotalBytes) {
7825
+ if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs14.default.statSync(disk).size > limits.imageTotalBytes) {
7793
7826
  throw new Error("swift image pack exceeds the compile service caps");
7794
7827
  }
7795
7828
  const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
7796
7829
  imageBytes += bytes.length;
7797
7830
  const hash = (0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
7798
- const ext = import_node_path14.default.posix.extname(file).toLowerCase();
7831
+ const ext = import_node_path15.default.posix.extname(file).toLowerCase();
7799
7832
  table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
7800
7833
  images[name2] = {
7801
- file: import_node_path14.default.posix.basename(file),
7834
+ file: import_node_path15.default.posix.basename(file),
7802
7835
  data: bytes.toString("base64")
7803
7836
  };
7804
7837
  watched.push(file);
@@ -7822,10 +7855,10 @@ function buildSwiftResourceTable(project, baseUrl) {
7822
7855
  return { table, images, colors, symbols, watched };
7823
7856
  }
7824
7857
  function buildSwiftBundleFiles(packagePath, hosted) {
7825
- packagePath = import_node_fs13.default.realpathSync(packagePath);
7858
+ packagePath = import_node_fs14.default.realpathSync(packagePath);
7826
7859
  const limits = inputLimits(hosted);
7827
7860
  const relative = resourceCandidateFiles(packagePath).map(
7828
- (file) => import_node_path14.default.relative(packagePath, file).split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep)
7861
+ (file) => import_node_path15.default.relative(packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
7829
7862
  );
7830
7863
  const files2 = {};
7831
7864
  const watched = [];
@@ -7839,13 +7872,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
7839
7872
  total += bytes.length;
7840
7873
  if (xcode.app.infoPlistFile)
7841
7874
  watched.push(
7842
- import_node_path14.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path14.default.sep).join("/")
7875
+ import_node_path15.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path15.default.sep).join("/")
7843
7876
  );
7844
7877
  }
7845
7878
  for (const { base, file } of enumerateBundleJson(relative)) {
7846
7879
  watched.push(file);
7847
- const disk = import_node_path14.default.join(packagePath, ...file.split("/"));
7848
- if (Object.keys(files2).length >= limits.resources || total + import_node_fs13.default.statSync(disk).size > limits.resourceTotalBytes) {
7880
+ const disk = import_node_path15.default.join(packagePath, ...file.split("/"));
7881
+ if (Object.keys(files2).length >= limits.resources || total + import_node_fs14.default.statSync(disk).size > limits.resourceTotalBytes) {
7849
7882
  throw new Error(
7850
7883
  `swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
7851
7884
  );
@@ -7857,12 +7890,12 @@ function buildSwiftBundleFiles(packagePath, hosted) {
7857
7890
  return { files: files2, watched };
7858
7891
  }
7859
7892
  function linkedModuleRoots(packagePath) {
7860
- packagePath = import_node_fs13.default.realpathSync(packagePath);
7893
+ packagePath = import_node_fs14.default.realpathSync(packagePath);
7861
7894
  let manifest;
7862
7895
  try {
7863
7896
  manifest = readPackageFile(
7864
7897
  packagePath,
7865
- import_node_path14.default.join(packagePath, "Package.swift"),
7898
+ import_node_path15.default.join(packagePath, "Package.swift"),
7866
7899
  MAX_SWIFT_COMPILE_SOURCE_BYTES
7867
7900
  ).toString("utf8");
7868
7901
  } catch {
@@ -7871,8 +7904,8 @@ function linkedModuleRoots(packagePath) {
7871
7904
  const roots = /* @__PURE__ */ new Set();
7872
7905
  const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
7873
7906
  for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
7874
- const root = import_node_path14.default.resolve(packagePath, match[1]);
7875
- if (import_node_fs13.default.existsSync(import_node_path14.default.join(root, "Package.swift"))) roots.add(root);
7907
+ const root = import_node_path15.default.resolve(packagePath, match[1]);
7908
+ if (import_node_fs14.default.existsSync(import_node_path15.default.join(root, "Package.swift"))) roots.add(root);
7876
7909
  }
7877
7910
  return [...roots].sort();
7878
7911
  }
@@ -7881,18 +7914,18 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
7881
7914
  hash.update(packagePath);
7882
7915
  const projectInputs = new Set(packageFiles(packagePath));
7883
7916
  for (const file of [...projectInputs].sort()) {
7884
- hash.update(import_node_path14.default.relative(packagePath, file));
7885
- const stat = import_node_fs13.default.statSync(file);
7917
+ hash.update(import_node_path15.default.relative(packagePath, file));
7918
+ const stat = import_node_fs14.default.statSync(file);
7886
7919
  hash.update(`${stat.mtimeMs}/${stat.ctimeMs}/${stat.size}`);
7887
7920
  }
7888
7921
  const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
7889
- (root) => import_node_fs13.default.existsSync(import_node_path14.default.join(root, "toolchain.json"))
7922
+ (root) => import_node_fs14.default.existsSync(import_node_path15.default.join(root, "toolchain.json"))
7890
7923
  );
7891
7924
  if (moduleRoot) {
7892
7925
  hash.update(moduleRoot);
7893
7926
  for (const relative of swiftModuleInputFiles(moduleRoot)) {
7894
7927
  hash.update(relative);
7895
- hash.update(String(import_node_fs13.default.statSync(import_node_path14.default.join(moduleRoot, relative)).mtimeMs));
7928
+ hash.update(String(import_node_fs14.default.statSync(import_node_path15.default.join(moduleRoot, relative)).mtimeMs));
7896
7929
  }
7897
7930
  }
7898
7931
  return hash.digest("hex").slice(0, 16);
@@ -7904,8 +7937,8 @@ function packageSources(packagePath) {
7904
7937
  const xcode = xcodeLayout(packagePath);
7905
7938
  const files2 = {};
7906
7939
  for (const file of sourceFiles(packagePath)) {
7907
- const relative = import_node_path14.default.relative(packagePath, file).split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep);
7908
- if (xcode && import_node_path14.default.basename(file) === "Package.swift") continue;
7940
+ const relative = import_node_path15.default.relative(packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
7941
+ if (xcode && import_node_path15.default.basename(file) === "Package.swift") continue;
7909
7942
  files2[xcode ? xcodeInputKey(xcode, file, relative) : relative] = readPackageFile(
7910
7943
  packagePath,
7911
7944
  file,
@@ -7916,7 +7949,7 @@ function packageSources(packagePath) {
7916
7949
  files2["Package.swift"] = xcodeManifest(xcode);
7917
7950
  for (const standin of xcode.standins)
7918
7951
  for (const [file, text3] of Object.entries(standin.files))
7919
- files2[import_node_path14.default.posix.join(XCODE_STANDINS_DIR, standin.module, file)] = text3;
7952
+ files2[import_node_path15.default.posix.join(XCODE_STANDINS_DIR, standin.module, file)] = text3;
7920
7953
  }
7921
7954
  return files2;
7922
7955
  }
@@ -7927,7 +7960,7 @@ function packageSnapshot(project) {
7927
7960
  files: files2,
7928
7961
  resourcePaths: swiftImplicitResourcePaths(
7929
7962
  resourceCandidateFiles(project.packagePath).map(
7930
- (file) => import_node_path14.default.relative(project.packagePath, file).split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep)
7963
+ (file) => import_node_path15.default.relative(project.packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
7931
7964
  )
7932
7965
  ),
7933
7966
  resources: buildSwiftResourceTable(project, ""),
@@ -7936,7 +7969,7 @@ function packageSnapshot(project) {
7936
7969
  ...native ? {
7937
7970
  glue: readPackageFile(
7938
7971
  project.packagePath,
7939
- import_node_path14.default.join(project.packagePath, NATIVE_GLUE),
7972
+ import_node_path15.default.join(project.packagePath, NATIVE_GLUE),
7940
7973
  MAX_SWIFT_COMPILE_SOURCE_BYTES
7941
7974
  ).toString("utf8")
7942
7975
  } : {}
@@ -7972,7 +8005,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
7972
8005
  package: content
7973
8006
  };
7974
8007
  const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
7975
- (root) => import_node_fs13.default.existsSync(import_node_path14.default.join(root, "toolchain.json"))
8008
+ (root) => import_node_fs14.default.existsSync(import_node_path15.default.join(root, "toolchain.json"))
7976
8009
  ) ?? await swiftDistributionRoot();
7977
8010
  if (!moduleRoot)
7978
8011
  return {
@@ -7999,10 +8032,10 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
7999
8032
  // server and a capture, or two checkouts) build each other's sources. so
8000
8033
  // each app and module checkout gets its own root, which keeps the same
8001
8034
  // app's incremental build across restarts.
8002
- buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path14.default.join(
8035
+ buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path15.default.join(
8003
8036
  import_node_os8.default.tmpdir(),
8004
8037
  "contrast-swift-build",
8005
- (0, import_node_crypto7.createHash)("sha256").update(`${moduleRoot}\0${import_node_path14.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
8038
+ (0, import_node_crypto7.createHash)("sha256").update(`${moduleRoot}\0${import_node_path15.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
8006
8039
  ),
8007
8040
  moduleRoot,
8008
8041
  ...toolchain
@@ -8095,7 +8128,7 @@ async function missingModulesMessage(packagePath, missing) {
8095
8128
  `Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
8096
8129
  ...[...missing].map(([name2, files2]) => {
8097
8130
  const gap = gaps.get(name2);
8098
- 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})` : ""}`;
8131
+ 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})` : ""}`;
8099
8132
  })
8100
8133
  ].join("\n");
8101
8134
  }
@@ -8103,7 +8136,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
8103
8136
  const auth = hosted ? null : resolveCliAuth();
8104
8137
  if (!hosted && (!auth || auth.kind === "github")) {
8105
8138
  throw new Error(
8106
- `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`
8139
+ `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`
8107
8140
  );
8108
8141
  }
8109
8142
  const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
@@ -8122,7 +8155,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
8122
8155
  const bytes = sources.reduce((total2, text3) => total2 + Buffer.byteLength(text3), 0);
8123
8156
  if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
8124
8157
  throw new Error(
8125
- `${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`
8158
+ `${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`
8126
8159
  );
8127
8160
  }
8128
8161
  const descriptor = snapshot.native;
@@ -8141,7 +8174,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
8141
8174
  );
8142
8175
  if (descriptor && address.native?.hash !== descriptor.hash) {
8143
8176
  throw new Error(
8144
- `${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`
8177
+ `${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`
8145
8178
  );
8146
8179
  }
8147
8180
  const response = await fetch(address.url, { signal });
@@ -8213,14 +8246,14 @@ function artifactFor(project, entry, moduleRoot) {
8213
8246
  project.building = { stamp, promise: fresh };
8214
8247
  return fresh;
8215
8248
  }
8216
- var import_node_crypto7, import_node_fs13, import_node_os8, import_node_path14, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, SwiftMissingModulesError, projects, xcodeProjects, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, XCODE_STANDINS_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, UNPROVIDED_PLATFORM_MODULES, IOS_SDK_FRAMEWORKS;
8249
+ var import_node_crypto7, import_node_fs14, import_node_os8, import_node_path15, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, SwiftMissingModulesError, projects, xcodeProjects, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, XCODE_STANDINS_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, UNPROVIDED_PLATFORM_MODULES, IOS_SDK_FRAMEWORKS;
8217
8250
  var init_swift_host = __esm({
8218
8251
  "src/swift-host.ts"() {
8219
8252
  "use strict";
8220
8253
  import_node_crypto7 = require("node:crypto");
8221
- import_node_fs13 = __toESM(require("node:fs"), 1);
8254
+ import_node_fs14 = __toESM(require("node:fs"), 1);
8222
8255
  import_node_os8 = __toESM(require("node:os"), 1);
8223
- import_node_path14 = __toESM(require("node:path"), 1);
8256
+ import_node_path15 = __toESM(require("node:path"), 1);
8224
8257
  init_bundleAssets();
8225
8258
  init_auth();
8226
8259
  init_backend_origin();
@@ -8230,6 +8263,7 @@ var init_swift_host = __esm({
8230
8263
  init_swift_distribution();
8231
8264
  init_swift_package();
8232
8265
  init_swift_packages();
8266
+ init_swift_source_file();
8233
8267
  init_swift_standins();
8234
8268
  init_swift_submit();
8235
8269
  init_xcode_project();
@@ -8253,7 +8287,7 @@ var init_swift_host = __esm({
8253
8287
  XCODE_FRAMEWORKS_DIR = "__frameworks__";
8254
8288
  XCODE_PACKAGES_DIR = "__packages__";
8255
8289
  XCODE_STANDINS_DIR = "__standins__";
8256
- CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path14.default.sep).join(import_node_path14.default.posix.sep)}/`;
8290
+ CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)}/`;
8257
8291
  HOSTED_LIMITS = {
8258
8292
  resources: MAX_SWIFT_COMPILE_RESOURCES,
8259
8293
  resourceBytes: MAX_SWIFT_COMPILE_RESOURCE_BYTES,
@@ -8305,8 +8339,8 @@ var init_swift_host = __esm({
8305
8339
 
8306
8340
  // src/expo-swift-host.ts
8307
8341
  async function collectExpoSwiftSources(appRoot) {
8308
- appRoot = import_node_fs14.default.realpathSync(appRoot);
8309
- const appRequire = (0, import_node_module.createRequire)(import_node_path15.default.join(appRoot, "package.json"));
8342
+ appRoot = import_node_fs15.default.realpathSync(appRoot);
8343
+ const appRequire = (0, import_node_module.createRequire)(import_node_path16.default.join(appRoot, "package.json"));
8310
8344
  let autolinker;
8311
8345
  try {
8312
8346
  autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
@@ -8320,7 +8354,7 @@ async function collectExpoSwiftSources(appRoot) {
8320
8354
  (command) => run3(
8321
8355
  process.execPath,
8322
8356
  [
8323
- import_node_path15.default.join(import_node_path15.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
8357
+ import_node_path16.default.join(import_node_path16.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
8324
8358
  command,
8325
8359
  "--platform",
8326
8360
  "apple",
@@ -8351,8 +8385,8 @@ async function collectExpoSwiftSources(appRoot) {
8351
8385
  const sourceRoot = Reflect.get(entry, "path");
8352
8386
  if (typeof sourceRoot !== "string")
8353
8387
  throw new Error("Expo autolinking entry has no path");
8354
- const canonical = import_node_fs14.default.realpathSync(sourceRoot);
8355
- if (canonical.split(import_node_path15.default.sep).includes("node_modules")) continue;
8388
+ const canonical = import_node_fs15.default.realpathSync(sourceRoot);
8389
+ if (canonical.split(import_node_path16.default.sep).includes("node_modules")) continue;
8356
8390
  const resolution = resolutions.find(
8357
8391
  (candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
8358
8392
  );
@@ -8379,12 +8413,12 @@ async function collectExpoSwiftSources(appRoot) {
8379
8413
  registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
8380
8414
  });
8381
8415
  }
8382
- const ios = import_node_path15.default.join(canonical, "ios");
8383
- if (import_node_fs14.default.lstatSync(ios).isSymbolicLink())
8416
+ const ios = import_node_path16.default.join(canonical, "ios");
8417
+ if (import_node_fs15.default.lstatSync(ios).isSymbolicLink())
8384
8418
  throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
8385
8419
  const walk2 = (dir) => {
8386
- for (const child of import_node_fs14.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
8387
- const file = import_node_path15.default.join(dir, child.name);
8420
+ for (const child of import_node_fs15.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
8421
+ const file = import_node_path16.default.join(dir, child.name);
8388
8422
  if (child.isSymbolicLink())
8389
8423
  throw new Error(`Expo Swift source is a symlink: ${file}`);
8390
8424
  if (child.isDirectory()) {
@@ -8392,13 +8426,13 @@ async function collectExpoSwiftSources(appRoot) {
8392
8426
  continue;
8393
8427
  }
8394
8428
  if (!child.name.endsWith(".swift")) continue;
8395
- const size = import_node_fs14.default.statSync(file).size;
8429
+ const size = import_node_fs15.default.statSync(file).size;
8396
8430
  bytes += size;
8397
8431
  fileCount++;
8398
8432
  if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
8399
8433
  throw new Error("Expo Swift sources exceed compile service caps");
8400
- files2[`Sources/${namespace}/${import_node_path15.default.relative(ios, file).split(import_node_path15.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
8401
- ${import_node_fs14.default.readFileSync(file, "utf8")}`;
8434
+ files2[`Sources/${namespace}/${import_node_path16.default.relative(ios, file).split(import_node_path16.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
8435
+ ${import_node_fs15.default.readFileSync(file, "utf8")}`;
8402
8436
  }
8403
8437
  };
8404
8438
  walk2(ios);
@@ -8482,7 +8516,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
8482
8516
  modules: [],
8483
8517
  failures: []
8484
8518
  };
8485
- const key2 = (0, import_node_crypto8.createHash)("sha256").update(import_node_fs14.default.realpathSync(root)).digest("hex");
8519
+ const key2 = (0, import_node_crypto8.createHash)("sha256").update(import_node_fs15.default.realpathSync(root)).digest("hex");
8486
8520
  const linked = [];
8487
8521
  for (const unit of units) {
8488
8522
  if (!module2) {
@@ -8492,14 +8526,14 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
8492
8526
  });
8493
8527
  continue;
8494
8528
  }
8495
- const packagePath = import_node_path15.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, unit.moduleId);
8529
+ const packagePath = import_node_path16.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, unit.moduleId);
8496
8530
  let stamp;
8497
8531
  try {
8498
8532
  syncSwiftTree(
8499
8533
  packagePath,
8500
8534
  new Map(
8501
8535
  Object.entries(unit.files).map(([name2, source]) => [
8502
- import_node_path15.default.join(packagePath, name2),
8536
+ import_node_path16.default.join(packagePath, name2),
8503
8537
  source
8504
8538
  ])
8505
8539
  )
@@ -8524,10 +8558,13 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
8524
8558
  const file = JSON.parse(match[1]);
8525
8559
  return typeof file === "string" ? [file] : [];
8526
8560
  });
8527
- const sourceErrors = (diagnostic.match(/^.+:\d+(?::\d+)?: error:.*$/gm) ?? []).filter((line) => appPaths.some((file) => line.startsWith(`${file}:`)));
8528
- if (publishArtifact && sourceErrors.length === 0 && !(error instanceof SwiftMissingModulesError))
8561
+ const errors = diagnostic.match(/^.+:\d+(?::\d+)?: error:.*$/gm) ?? [];
8562
+ const sourceErrors = errors.filter(
8563
+ (line) => appPaths.some((file) => line.startsWith(`${file}:`)) && !/external macro implementation type|failed to load library plugin/.test(line)
8564
+ );
8565
+ if (publishArtifact && (sourceErrors.length === 0 || sourceErrors.length !== errors.length) && !(error instanceof SwiftMissingModulesError))
8529
8566
  throw error;
8530
- if (sourceErrors.length && module2 && stamp && sourceStamp(packagePath, module2.root) === stamp) {
8567
+ if (sourceErrors.length && sourceErrors.length === errors.length && module2 && stamp && sourceStamp(packagePath, module2.root) === stamp) {
8531
8568
  failedCompilations.set(packagePath, {
8532
8569
  stamp,
8533
8570
  diagnostic: sourceErrors.join("\n")
@@ -8557,12 +8594,12 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
8557
8594
  import PackageDescription
8558
8595
  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")])
8559
8596
  `;
8560
- const packagePath = import_node_path15.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, "linked-app");
8597
+ const packagePath = import_node_path16.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, "linked-app");
8561
8598
  syncSwiftTree(
8562
8599
  packagePath,
8563
8600
  new Map(
8564
8601
  Object.entries(files2).map(([name2, source]) => [
8565
- import_node_path15.default.join(packagePath, name2),
8602
+ import_node_path16.default.join(packagePath, name2),
8566
8603
  source
8567
8604
  ])
8568
8605
  )
@@ -8583,16 +8620,16 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
8583
8620
  }
8584
8621
  return result;
8585
8622
  }
8586
- var import_node_child_process9, import_node_crypto8, import_node_fs14, import_node_module, import_node_os9, import_node_path15, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ENTRY, failedCompilations;
8623
+ var import_node_child_process9, import_node_crypto8, import_node_fs15, import_node_module, import_node_os9, import_node_path16, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ENTRY, failedCompilations;
8587
8624
  var init_expo_swift_host = __esm({
8588
8625
  "src/expo-swift-host.ts"() {
8589
8626
  "use strict";
8590
8627
  import_node_child_process9 = require("node:child_process");
8591
8628
  import_node_crypto8 = require("node:crypto");
8592
- import_node_fs14 = __toESM(require("node:fs"), 1);
8629
+ import_node_fs15 = __toESM(require("node:fs"), 1);
8593
8630
  import_node_module = require("node:module");
8594
8631
  import_node_os9 = __toESM(require("node:os"), 1);
8595
- import_node_path15 = __toESM(require("node:path"), 1);
8632
+ import_node_path16 = __toESM(require("node:path"), 1);
8596
8633
  import_node_util3 = require("node:util");
8597
8634
  init_internal_child();
8598
8635
  init_backend_origin();
@@ -8899,16 +8936,16 @@ function prepareBundleChannel({
8899
8936
  files2.set(asset.path, asset.bytes);
8900
8937
  }
8901
8938
  const identity = (0, import_node_crypto9.createHash)("sha256").update(bundle).update(icon);
8902
- for (const [path15, bytes] of [...files2].sort(
8939
+ for (const [path16, bytes] of [...files2].sort(
8903
8940
  ([a], [b]) => a < b ? -1 : a > b ? 1 : 0
8904
8941
  )) {
8905
- identity.update(JSON.stringify([path15, digest(bytes)]));
8942
+ identity.update(JSON.stringify([path16, digest(bytes)]));
8906
8943
  }
8907
8944
  if (expoSwift) identity.update(JSON.stringify(expoSwift.metadata));
8908
8945
  const releaseKey = `${prefix}/peach/releases/${identity.digest("hex")}`;
8909
8946
  const assetBaseUrl = `${origin.origin}/${releaseKey}/`;
8910
8947
  const directories = new Set(
8911
- [...files2.keys()].map((path15) => path15.slice(0, path15.lastIndexOf("/")))
8948
+ [...files2.keys()].map((path16) => path16.slice(0, path16.lastIndexOf("/")))
8912
8949
  );
8913
8950
  let locations = 0;
8914
8951
  let source = new TextDecoder("utf-8", { fatal: true }).decode(bundle).replace(
@@ -8919,12 +8956,12 @@ function prepareBundleChannel({
8919
8956
  const parsed = new URL(location, "https://packaged.invalid");
8920
8957
  if (parsed.origin !== "https://packaged.invalid")
8921
8958
  throw new Error(`non-packaged asset location: ${location}`);
8922
- const path15 = (parsed.searchParams.get("unstable_path") ?? parsed.pathname).replace(/^\/+/, "").replace(/\.\.\//g, "_");
8923
- if (!directories.has(path15)) {
8959
+ const path16 = (parsed.searchParams.get("unstable_path") ?? parsed.pathname).replace(/^\/+/, "").replace(/\.\.\//g, "_");
8960
+ if (!directories.has(path16)) {
8924
8961
  throw new Error(`bundle asset location has no packaged files: ${location}`);
8925
8962
  }
8926
8963
  locations++;
8927
- return `${property}${JSON.stringify(new URL(path15, assetBaseUrl).href)}`;
8964
+ return `${property}${JSON.stringify(new URL(path16, assetBaseUrl).href)}`;
8928
8965
  }
8929
8966
  );
8930
8967
  if (assets2.length && !locations)
@@ -8963,10 +9000,10 @@ function prepareBundleChannel({
8963
9000
  contentType: "application/javascript"
8964
9001
  },
8965
9002
  { key: `${releaseKey}/icon.png`, bytes: icon, contentType: "image/png" },
8966
- ...[...files2].map(([path15, bytes]) => ({
8967
- key: `${releaseKey}/${path15}`,
9003
+ ...[...files2].map(([path16, bytes]) => ({
9004
+ key: `${releaseKey}/${path16}`,
8968
9005
  bytes,
8969
- contentType: expoSwift?.assets.find((asset) => asset.path === path15)?.contentType ?? {
9006
+ contentType: expoSwift?.assets.find((asset) => asset.path === path16)?.contentType ?? {
8970
9007
  png: "image/png",
8971
9008
  jpg: "image/jpeg",
8972
9009
  jpeg: "image/jpeg",
@@ -8975,7 +9012,7 @@ function prepareBundleChannel({
8975
9012
  ttf: "font/ttf",
8976
9013
  otf: "font/otf",
8977
9014
  wav: "audio/wav"
8978
- }[path15.split(".").pop()] ?? "application/octet-stream"
9015
+ }[path16.split(".").pop()] ?? "application/octet-stream"
8979
9016
  }))
8980
9017
  ];
8981
9018
  return { prefix, origin: origin.origin, metadata, objects };
@@ -9054,15 +9091,15 @@ async function snapshotOneDevBundle(projectRoot, env = {}) {
9054
9091
  for (const [registration] of bundle.toString("utf8").matchAll(/(?<=registerAsset\()\{[^{}]*"__packager_asset": true[^{}]*\}/g)) {
9055
9092
  const asset = JSON.parse(registration);
9056
9093
  for (const file of asset.files) {
9057
- const path15 = `${asset.httpServerLocation.replace(/^\/+/, "")}/${basename2(file)}`;
9058
- if (!assets2.has(path15)) assets2.set(path15, readFileSync5(file));
9094
+ const path16 = `${asset.httpServerLocation.replace(/^\/+/, "")}/${basename2(file)}`;
9095
+ if (!assets2.has(path16)) assets2.set(path16, readFileSync5(file));
9059
9096
  }
9060
9097
  }
9061
9098
  const { buildExpoSwiftBundle: buildExpoSwiftBundle2 } = await Promise.resolve().then(() => (init_expo_swift_bundle(), expo_swift_bundle_exports));
9062
9099
  const expoSwift = await buildExpoSwiftBundle2(projectRoot);
9063
9100
  return {
9064
9101
  bundle,
9065
- assets: [...assets2].map(([path15, bytes]) => ({ path: path15, bytes })),
9102
+ assets: [...assets2].map(([path16, bytes]) => ({ path: path16, bytes })),
9066
9103
  expoSwift
9067
9104
  };
9068
9105
  } finally {