peachsim 0.1.769 → 0.1.771

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 (77) hide show
  1. package/cli/main.ts +5 -1
  2. package/cli/outbound-endpoints.ts +14 -0
  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/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cli-constants.cjs +1 -1
  20. package/dist-lib/cloud-contract.cjs +1 -1
  21. package/dist-lib/cloud-contract.mjs +1 -1
  22. package/dist-lib/cloud-test-args.cjs +1 -1
  23. package/dist-lib/cloud-test-args.mjs +1 -1
  24. package/dist-lib/cloud.cjs +1 -1
  25. package/dist-lib/cloud.mjs +1 -1
  26. package/dist-lib/config.cjs +1 -1
  27. package/dist-lib/detox/index.cjs +1 -1
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/home-paths.cjs +1 -1
  30. package/dist-lib/host/bridge-host.cjs +563 -439
  31. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  32. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  33. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  34. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  35. package/dist-lib/host/websocket-proxy.cjs +1 -1
  36. package/dist-lib/index.cjs +1 -1
  37. package/dist-lib/jump-to-source-babel.cjs +1 -1
  38. package/dist-lib/jump-to-source-native.cjs +1 -1
  39. package/dist-lib/kotlin-host.cjs +1 -1
  40. package/dist-lib/menu.cjs +1 -1
  41. package/dist-lib/menu.mjs +1 -1
  42. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  44. package/dist-lib/metro-production-bundle.cjs +1 -1
  45. package/dist-lib/metro-production-bundle.mjs +1 -1
  46. package/dist-lib/metro.cjs +1 -1
  47. package/dist-lib/native-app-identity.cjs +1 -1
  48. package/dist-lib/native-app-identity.mjs +1 -1
  49. package/dist-lib/native-firebase-metadata.cjs +1 -1
  50. package/dist-lib/native-firebase-metadata.mjs +1 -1
  51. package/dist-lib/plist.cjs +1 -1
  52. package/dist-lib/plist.mjs +1 -1
  53. package/dist-lib/profiles.cjs +1 -1
  54. package/dist-lib/public-brand.cjs +1 -1
  55. package/dist-lib/react-native-host-modules.cjs +1 -1
  56. package/dist-lib/react-native-host-modules.mjs +1 -1
  57. package/dist-lib/render-mode.cjs +1 -1
  58. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  59. package/dist-lib/sdk.cjs +1 -1
  60. package/dist-lib/sdk.mjs +1 -1
  61. package/dist-lib/skills.cjs +832 -701
  62. package/dist-lib/swift-compile.cjs +18 -4
  63. package/dist-lib/swift-compile.mjs +17 -4
  64. package/dist-lib/swift-package.cjs +1 -1
  65. package/dist-lib/swift-package.mjs +1 -1
  66. package/dist-lib/swift-submit.cjs +1 -1
  67. package/dist-lib/swift-submit.mjs +1 -1
  68. package/dist-lib/swift-toolchain.cjs +1 -1
  69. package/dist-lib/swift.cjs +1 -1
  70. package/dist-lib/vite-swift.cjs +396 -272
  71. package/dist-lib/vite.cjs +1 -1
  72. package/package.json +1 -1
  73. package/src/swift-binary-modules.ts +116 -0
  74. package/src/swift-compile.ts +28 -3
  75. package/src/swift-host.ts +28 -4
  76. package/src/swift-package-manifest.ts +3 -0
  77. package/src/swift-packages.ts +32 -4
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.769 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.771 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -18532,9 +18532,9 @@ function overlapsBounds(left, right) {
18532
18532
  }
18533
18533
  function resolveCompatVersionRange(availableRegistryRanges, declaredVersion) {
18534
18534
  const declaredGroups = parseRange(declaredVersion);
18535
- const registryGroups = availableRegistryRanges.map((range) => ({
18536
- range,
18537
- bounds: parseRange(range)
18535
+ const registryGroups = availableRegistryRanges.map((range2) => ({
18536
+ range: range2,
18537
+ bounds: parseRange(range2)
18538
18538
  }));
18539
18539
  if (!declaredGroups || registryGroups.some((candidate) => !candidate.bounds)) {
18540
18540
  return {
@@ -19802,9 +19802,9 @@ function safeChildPlistName(value) {
19802
19802
  name: file.toLowerCase().endsWith(".plist") ? file : `${file}.plist`
19803
19803
  };
19804
19804
  }
19805
- async function readableSettingsBundle(path35) {
19805
+ async function readableSettingsBundle(path36) {
19806
19806
  try {
19807
- const root = await (0, import_promises.stat)((0, import_node_path.join)(path35, "Root.plist"));
19807
+ const root = await (0, import_promises.stat)((0, import_node_path.join)(path36, "Root.plist"));
19808
19808
  return root.isFile() && root.size <= MAX_PLIST_BYTES;
19809
19809
  } catch {
19810
19810
  return false;
@@ -19849,11 +19849,11 @@ async function settingsBundleFingerprint(bundlePath) {
19849
19849
  return null;
19850
19850
  }
19851
19851
  }
19852
- async function parsePlistRecord(path35) {
19852
+ async function parsePlistRecord(path36) {
19853
19853
  try {
19854
- const metadata = await (0, import_promises.stat)(path35);
19854
+ const metadata = await (0, import_promises.stat)(path36);
19855
19855
  if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
19856
- const source = await (0, import_promises.readFile)(path35, "utf8");
19856
+ const source = await (0, import_promises.readFile)(path36, "utf8");
19857
19857
  const parsed = parsePlistSource(source);
19858
19858
  return isRecord2(parsed) ? parsed : null;
19859
19859
  } catch {
@@ -20177,7 +20177,7 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
20177
20177
  return null;
20178
20178
  }
20179
20179
  }
20180
- function httpGet(hostname, port, path35, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
20180
+ function httpGet(hostname, port, path36, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
20181
20181
  return new Promise((resolve10) => {
20182
20182
  let settled = false;
20183
20183
  let killing = false;
@@ -20186,7 +20186,7 @@ function httpGet(hostname, port, path35, method = "GET", timeout = TIMEOUT_MS, h
20186
20186
  settled = true;
20187
20187
  resolve10(value);
20188
20188
  };
20189
- const req = import_http.default.request({ hostname, port, path: path35, method, headers }, (res) => {
20189
+ const req = import_http.default.request({ hostname, port, path: path36, method, headers }, (res) => {
20190
20190
  let body = "";
20191
20191
  res.on("data", (c) => body += c.toString());
20192
20192
  const contentType = (() => {
@@ -22021,7 +22021,7 @@ function swiftTargetDependencies(files, targets) {
22021
22021
  }
22022
22022
  function swiftArtifactHash(input, release, moduleRoot) {
22023
22023
  const hash = (0, import_node_crypto3.createHash)("sha256");
22024
- hash.update(`swift-compile/v17
22024
+ hash.update(`swift-compile/v18
22025
22025
  ${release}
22026
22026
  `);
22027
22027
  if (input.oneModule) hash.update("one-module\n");
@@ -22349,14 +22349,14 @@ function liftExtensionOverrides(source, extraObjCExtensions) {
22349
22349
  const args = forwardedArguments(source.slice(open + 1, close));
22350
22350
  if (args === null) continue;
22351
22351
  const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name2}(${args})`;
22352
- const signature = `func ${name2}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
22352
+ const signature2 = `func ${name2}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
22353
22353
  const nameAt = at + rest.indexOf(name2, rest.indexOf("func", "override".length + func[1].length) + 4);
22354
22354
  lifted.push({
22355
22355
  type: top.name,
22356
22356
  member: name2,
22357
22357
  at,
22358
22358
  modifiers,
22359
- decl: signature,
22359
+ decl: signature2,
22360
22360
  forward: `{ ${call} };`,
22361
22361
  nameAt,
22362
22362
  edits: [
@@ -22532,6 +22532,18 @@ function lowerAVAssetURLCluster(source) {
22532
22532
  out = out.slice(0, at) + insert + out.slice(at + remove);
22533
22533
  return out;
22534
22534
  }
22535
+ function lowerNSValueTimeBox(source) {
22536
+ const masked = swiftCodeMask(source);
22537
+ const pattern = /\bNSValue\s*\(\s*time\s*:/g;
22538
+ const edits = [];
22539
+ let hit;
22540
+ while ((hit = pattern.exec(masked)) !== null)
22541
+ edits.push([hit.index, "NSValue".length, "NSValue.boxedTime"]);
22542
+ let out = source;
22543
+ for (const [at, remove, insert] of edits.sort((a, b) => b[0] - a[0]))
22544
+ out = out.slice(0, at) + insert + out.slice(at + remove);
22545
+ return out;
22546
+ }
22535
22547
  function swiftCodeMask(source) {
22536
22548
  const chars = source.split("");
22537
22549
  const blank = (from, to) => {
@@ -22735,8 +22747,8 @@ function swiftSourceAsIOS(original, extraObjCExtensions) {
22735
22747
  out += conditioned.slice(copied, at) + replacement;
22736
22748
  copied = at + match[0].length;
22737
22749
  }
22738
- return lowerAVAssetURLCluster(
22739
- lowerAnyObjectDoubleValue(out + conditioned.slice(copied))
22750
+ return lowerNSValueTimeBox(
22751
+ lowerAVAssetURLCluster(lowerAnyObjectDoubleValue(out + conditioned.slice(copied)))
22740
22752
  );
22741
22753
  }
22742
22754
  function swiftCodeScan(source) {
@@ -23811,8 +23823,8 @@ function pickImagesetFile(images) {
23811
23823
  scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
23812
23824
  };
23813
23825
  }
23814
- function flatScale(path35) {
23815
- const match = /@([23])x\.[^./]+$/.exec(path35);
23826
+ function flatScale(path36) {
23827
+ const match = /@([23])x\.[^./]+$/.exec(path36);
23816
23828
  return match ? Number(match[1]) : 1;
23817
23829
  }
23818
23830
  function providesNamespace(text2) {
@@ -23839,13 +23851,13 @@ function catalogEntryName(contentsPath, kind, readText2) {
23839
23851
  }
23840
23852
  return segments.join("/");
23841
23853
  }
23842
- function isFlatResourceImage(path35) {
23843
- return path35.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path35));
23854
+ function isFlatResourceImage(path36) {
23855
+ return path36.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path36));
23844
23856
  }
23845
23857
  function enumerateBundleImages(paths, readText2) {
23846
23858
  const table = [];
23847
23859
  const seen = /* @__PURE__ */ new Set();
23848
- const catalogs = paths.filter((path35) => baseOf(path35) === "Contents.json");
23860
+ const catalogs = paths.filter((path36) => baseOf(path36) === "Contents.json");
23849
23861
  for (const contentsPath of catalogs) {
23850
23862
  const name2 = catalogEntryName(contentsPath, ".imageset", readText2);
23851
23863
  if (name2 === null || seen.has(name2)) continue;
@@ -23866,12 +23878,12 @@ function enumerateBundleImages(paths, readText2) {
23866
23878
  seen.add(name2);
23867
23879
  table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
23868
23880
  }
23869
- for (const path35 of paths) {
23870
- if (!isFlatResourceImage(path35)) continue;
23871
- const name2 = baseOf(path35).slice(0, -extOf(path35).length);
23881
+ for (const path36 of paths) {
23882
+ if (!isFlatResourceImage(path36)) continue;
23883
+ const name2 = baseOf(path36).slice(0, -extOf(path36).length);
23872
23884
  if (name2 === "" || seen.has(name2)) continue;
23873
23885
  seen.add(name2);
23874
- table.push({ name: name2, file: path35, scale: flatScale(path35) });
23886
+ table.push({ name: name2, file: path36, scale: flatScale(path36) });
23875
23887
  }
23876
23888
  return table;
23877
23889
  }
@@ -23900,7 +23912,7 @@ function colorsetValue(color) {
23900
23912
  }
23901
23913
  function enumerateBundleColors(paths, readText2) {
23902
23914
  const table = {};
23903
- for (const contentsPath of paths.filter((path35) => baseOf(path35) === "Contents.json")) {
23915
+ for (const contentsPath of paths.filter((path36) => baseOf(path36) === "Contents.json")) {
23904
23916
  const name2 = catalogEntryName(contentsPath, ".colorset", readText2);
23905
23917
  if (name2 === null || name2 in table) continue;
23906
23918
  let colors;
@@ -23964,8 +23976,8 @@ function axisExtremes(points) {
23964
23976
  function pathBounds(d) {
23965
23977
  const xs = [];
23966
23978
  const ys = [];
23967
- for (const path35 of d)
23968
- (0, import_svgpath.default)(path35).abs().unshort().unarc().iterate((segment, _index, x, y) => {
23979
+ for (const path36 of d)
23980
+ (0, import_svgpath.default)(path36).abs().unshort().unarc().iterate((segment, _index, x, y) => {
23969
23981
  const [command, ...args] = segment;
23970
23982
  if (command === "M" || command === "L") {
23971
23983
  xs.push(Number(args[0]));
@@ -23992,7 +24004,7 @@ function guide(svg, id, axis) {
23992
24004
  }
23993
24005
  function enumerateBundleSymbols(paths, readText2) {
23994
24006
  const table = {};
23995
- for (const contentsPath of paths.filter((path35) => baseOf(path35) === "Contents.json")) {
24007
+ for (const contentsPath of paths.filter((path36) => baseOf(path36) === "Contents.json")) {
23996
24008
  const name2 = catalogEntryName(contentsPath, ".symbolset", readText2);
23997
24009
  if (name2 === null || name2 in table) continue;
23998
24010
  let symbols;
@@ -24025,8 +24037,8 @@ function enumerateBundleSymbols(paths, readText2) {
24025
24037
  viewBox: "0 0 24 24",
24026
24038
  advance,
24027
24039
  box: [12 - advance / 2, 12 - tall / 2, advance, tall],
24028
- layers: d.map((path35) => ({
24029
- d: (0, import_svgpath.default)(path35).abs().scale(scale).translate(translateX, translateY).round(3).toString()
24040
+ layers: d.map((path36) => ({
24041
+ d: (0, import_svgpath.default)(path36).abs().scale(scale).translate(translateX, translateY).round(3).toString()
24030
24042
  }))
24031
24043
  };
24032
24044
  }
@@ -24036,7 +24048,7 @@ function enumerateBundleJson(paths) {
24036
24048
  const found = [];
24037
24049
  const seen = /* @__PURE__ */ new Set();
24038
24050
  const ordered = [...paths].filter(
24039
- (path35) => path35.split("/").includes("Resources") && path35.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path35) === ".json" || extOf(path35) === ".xcstrings")
24051
+ (path36) => path36.split("/").includes("Resources") && path36.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path36) === ".json" || extOf(path36) === ".xcstrings")
24040
24052
  ).sort((a, b) => {
24041
24053
  const aDepth = a.split("/").length;
24042
24054
  const bDepth = b.split("/").length;
@@ -24601,19 +24613,109 @@ var init_ios_sdk_frameworks = __esm({
24601
24613
  }
24602
24614
  });
24603
24615
 
24616
+ // src/swift-binary-modules.ts
24617
+ function frameworkModules(paths) {
24618
+ const modules = /* @__PURE__ */ new Set();
24619
+ for (const file of paths) {
24620
+ const segment = file.split("/").find((part) => part.endsWith(".framework"));
24621
+ if (segment) modules.add(segment.slice(0, -".framework".length));
24622
+ }
24623
+ return [...modules].sort();
24624
+ }
24625
+ async function range(url, spec) {
24626
+ const response = await fetch(url, {
24627
+ headers: { range: `bytes=${spec}` },
24628
+ signal: AbortSignal.timeout(2e4)
24629
+ });
24630
+ const match = /^bytes (\d+)-\d+\/(\d+)$/.exec(
24631
+ response.headers.get("content-range") ?? ""
24632
+ );
24633
+ if (response.status !== 206 || !match)
24634
+ throw new Error(`${url} answered ${response.status} to a range request`);
24635
+ return {
24636
+ bytes: Buffer.from(await response.arrayBuffer()),
24637
+ start: Number(match[1]),
24638
+ total: Number(match[2])
24639
+ };
24640
+ }
24641
+ async function zipEntries(url) {
24642
+ const { total } = await range(url, "0-0");
24643
+ const tail = await range(url, `${Math.max(0, total - 65558)}-${total - 1}`);
24644
+ const end = signature(tail.bytes, 101010256);
24645
+ if (end < 0) throw new Error(`${url} has no zip end record`);
24646
+ let size = tail.bytes.readUInt32LE(end + 12);
24647
+ let offset = tail.bytes.readUInt32LE(end + 16);
24648
+ if (offset === 4294967295 || size === 4294967295) {
24649
+ const locator = end - 20;
24650
+ if (locator < 0 || tail.bytes.readUInt32LE(locator) !== 117853008)
24651
+ throw new Error(`${url} has no zip64 locator`);
24652
+ const recordAt = Number(tail.bytes.readBigUInt64LE(locator + 8));
24653
+ const record2 = recordAt >= tail.start ? tail.bytes.subarray(recordAt - tail.start) : (await range(url, `${recordAt}-${recordAt + 55}`)).bytes;
24654
+ size = Number(record2.readBigUInt64LE(40));
24655
+ offset = Number(record2.readBigUInt64LE(48));
24656
+ }
24657
+ const directory = offset >= tail.start ? tail.bytes.subarray(offset - tail.start, offset - tail.start + size) : (await range(url, `${offset}-${offset + size - 1}`)).bytes;
24658
+ const names = [];
24659
+ for (let at = 0; at + 46 <= directory.length; ) {
24660
+ if (directory.readUInt32LE(at) !== 33639248) break;
24661
+ const nameLength = directory.readUInt16LE(at + 28);
24662
+ names.push(directory.toString("utf8", at + 46, at + 46 + nameLength));
24663
+ at += 46 + nameLength + directory.readUInt16LE(at + 30) + directory.readUInt16LE(at + 32);
24664
+ }
24665
+ return names;
24666
+ }
24667
+ function localEntries(dir) {
24668
+ if (!import_node_fs13.default.existsSync(dir)) return [];
24669
+ return import_node_fs13.default.readdirSync(dir, { withFileTypes: true }).filter((slice) => slice.isDirectory()).flatMap(
24670
+ (slice) => import_node_fs13.default.readdirSync(import_node_path13.default.join(dir, slice.name)).map((entry) => `${slice.name}/${entry}`)
24671
+ );
24672
+ }
24673
+ async function swiftBinaryModules(binary) {
24674
+ if (!binary.url) return frameworkModules(localEntries(binary.dir));
24675
+ const cached4 = import_node_path13.default.join(
24676
+ cacheDir2,
24677
+ `${(0, import_node_crypto5.createHash)("sha256").update(binary.url).digest("hex").slice(0, 32)}.json`
24678
+ );
24679
+ if (import_node_fs13.default.existsSync(cached4)) {
24680
+ const value = JSON.parse(import_node_fs13.default.readFileSync(cached4, "utf8"));
24681
+ if (Array.isArray(value) && value.every((name2) => typeof name2 === "string"))
24682
+ return value;
24683
+ }
24684
+ const modules = frameworkModules(await zipEntries(binary.url));
24685
+ import_node_fs13.default.mkdirSync(cacheDir2, { recursive: true });
24686
+ import_node_fs13.default.writeFileSync(cached4, JSON.stringify(modules));
24687
+ return modules;
24688
+ }
24689
+ var import_node_crypto5, import_node_fs13, import_node_os5, import_node_path13, cacheDir2, signature;
24690
+ var init_swift_binary_modules = __esm({
24691
+ "src/swift-binary-modules.ts"() {
24692
+ "use strict";
24693
+ import_node_crypto5 = require("node:crypto");
24694
+ import_node_fs13 = __toESM(require("node:fs"), 1);
24695
+ import_node_os5 = __toESM(require("node:os"), 1);
24696
+ import_node_path13 = __toESM(require("node:path"), 1);
24697
+ cacheDir2 = import_node_path13.default.join(import_node_os5.default.tmpdir(), "peach-swift-binary-modules");
24698
+ signature = (bytes, value) => {
24699
+ const needle = Buffer.alloc(4);
24700
+ needle.writeUInt32LE(value);
24701
+ return bytes.lastIndexOf(needle);
24702
+ };
24703
+ }
24704
+ });
24705
+
24604
24706
  // src/swift-package-manifest.ts
24605
24707
  function swiftCommand() {
24606
- return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path13.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
24708
+ return process.platform === "darwin" ? { file: "xcrun", args: ["swift"] } : { file: import_node_path14.default.join(swiftToolchainBin(swift_distribution_lock_default.release), "swift"), args: [] };
24607
24709
  }
24608
24710
  function dump(dir) {
24609
- const manifests = import_node_fs13.default.readdirSync(dir).filter((name2) => /^Package(@swift-[\d.]+)?\.swift$/.test(name2)).sort();
24711
+ const manifests = import_node_fs14.default.readdirSync(dir).filter((name2) => /^Package(@swift-[\d.]+)?\.swift$/.test(name2)).sort();
24610
24712
  const command = swiftCommand();
24611
- const key = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify([command, import_node_path13.default.resolve(dir)])).update(
24612
- manifests.map((name2) => `${name2}\0${import_node_fs13.default.readFileSync(import_node_path13.default.join(dir, name2), "utf8")}`).join("\0")
24713
+ const key = (0, import_node_crypto6.createHash)("sha256").update(JSON.stringify([command, import_node_path14.default.resolve(dir)])).update(
24714
+ manifests.map((name2) => `${name2}\0${import_node_fs14.default.readFileSync(import_node_path14.default.join(dir, name2), "utf8")}`).join("\0")
24613
24715
  ).digest("hex").slice(0, 32);
24614
- const cached4 = import_node_path13.default.join(cacheDir2, `${key}.json`);
24615
- if (import_node_fs13.default.existsSync(cached4))
24616
- return { key, raw: record(JSON.parse(import_node_fs13.default.readFileSync(cached4, "utf8"))) };
24716
+ const cached4 = import_node_path14.default.join(cacheDir3, `${key}.json`);
24717
+ if (import_node_fs14.default.existsSync(cached4))
24718
+ return { key, raw: record(JSON.parse(import_node_fs14.default.readFileSync(cached4, "utf8"))) };
24617
24719
  let output;
24618
24720
  try {
24619
24721
  output = (0, import_node_child_process7.execFileSync)(
@@ -24625,7 +24727,7 @@ function dump(dir) {
24625
24727
  dir,
24626
24728
  // swiftpm's scratch files never land in the app's own package
24627
24729
  "--scratch-path",
24628
- import_node_path13.default.join(cacheDir2, `${key}.build`),
24730
+ import_node_path14.default.join(cacheDir3, `${key}.build`),
24629
24731
  "dump-package"
24630
24732
  ],
24631
24733
  {
@@ -24637,11 +24739,11 @@ function dump(dir) {
24637
24739
  } catch (error) {
24638
24740
  const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
24639
24741
  throw new Error(
24640
- `swiftpm could not evaluate ${import_node_path13.default.join(dir, "Package.swift")}${stderr ? `: ${stderr}` : ""}`
24742
+ `swiftpm could not evaluate ${import_node_path14.default.join(dir, "Package.swift")}${stderr ? `: ${stderr}` : ""}`
24641
24743
  );
24642
24744
  }
24643
- import_node_fs13.default.mkdirSync(cacheDir2, { recursive: true });
24644
- import_node_fs13.default.writeFileSync(cached4, output);
24745
+ import_node_fs14.default.mkdirSync(cacheDir3, { recursive: true });
24746
+ import_node_fs14.default.writeFileSync(cached4, output);
24645
24747
  return { key, raw: record(JSON.parse(output)) };
24646
24748
  }
24647
24749
  function defaultTraits(manifest) {
@@ -24669,7 +24771,7 @@ function linksOnIOS(condition, traits) {
24669
24771
  return gates.length === 0 || gates.some((name2) => traits.has(string(name2) ?? ""));
24670
24772
  }
24671
24773
  function swiftPackageManifest(dir) {
24672
- dir = import_node_fs13.default.realpathSync(dir);
24774
+ dir = import_node_fs14.default.realpathSync(dir);
24673
24775
  const { key, raw: raw2 } = dump(dir);
24674
24776
  const known = evaluated.get(key);
24675
24777
  if (known) return known;
@@ -24717,7 +24819,7 @@ function swiftPackageManifest(dir) {
24717
24819
  if (!name2 || !isTargetType(kind)) continue;
24718
24820
  const declared = string(target.path);
24719
24821
  const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
24720
- const targetDir = declared ? import_node_path13.default.resolve(dir, declared) : roots.map((root) => import_node_path13.default.join(dir, root, name2)).find((candidate) => import_node_fs13.default.existsSync(candidate)) ?? import_node_path13.default.join(dir, roots[0], name2);
24822
+ const targetDir = declared ? import_node_path14.default.resolve(dir, declared) : roots.map((root) => import_node_path14.default.join(dir, root, name2)).find((candidate) => import_node_fs14.default.existsSync(candidate)) ?? import_node_path14.default.join(dir, roots[0], name2);
24721
24823
  const dependencies = [];
24722
24824
  for (const dependency of array(target.dependencies)) {
24723
24825
  const { target: local, product, byName } = record(dependency);
@@ -24759,7 +24861,8 @@ function swiftPackageManifest(dir) {
24759
24861
  dependencies,
24760
24862
  languageMode,
24761
24863
  mainActorIsolation,
24762
- declaresResources: array(target.resources).length > 0
24864
+ declaresResources: array(target.resources).length > 0,
24865
+ url: string(target.url) ?? null
24763
24866
  });
24764
24867
  }
24765
24868
  const manifest = { dir, products, targets, packages };
@@ -24767,36 +24870,36 @@ function swiftPackageManifest(dir) {
24767
24870
  return manifest;
24768
24871
  }
24769
24872
  function walk(dir) {
24770
- if (!import_node_fs13.default.existsSync(dir)) return [];
24771
- if (import_node_fs13.default.statSync(dir).isFile()) return [dir];
24873
+ if (!import_node_fs14.default.existsSync(dir)) return [];
24874
+ if (import_node_fs14.default.statSync(dir).isFile()) return [dir];
24772
24875
  const out = [];
24773
- for (const entry of import_node_fs13.default.readdirSync(dir, { withFileTypes: true })) {
24876
+ for (const entry of import_node_fs14.default.readdirSync(dir, { withFileTypes: true })) {
24774
24877
  if (entry.name.startsWith(".")) continue;
24775
- const full = import_node_path13.default.join(dir, entry.name);
24878
+ const full = import_node_path14.default.join(dir, entry.name);
24776
24879
  if (entry.isDirectory()) out.push(...walk(full));
24777
24880
  else if (entry.isFile()) out.push(full);
24778
24881
  }
24779
24882
  return out;
24780
24883
  }
24781
24884
  function swiftTargetFiles(manifest, target) {
24782
- const included = target.sources ? target.sources.map((source) => import_node_path13.default.resolve(target.dir, source)) : [target.dir];
24885
+ const included = target.sources ? target.sources.map((source) => import_node_path14.default.resolve(target.dir, source)) : [target.dir];
24783
24886
  const excluded = [
24784
- ...target.exclude.map((file) => import_node_path13.default.resolve(target.dir, file)),
24887
+ ...target.exclude.map((file) => import_node_path14.default.resolve(target.dir, file)),
24785
24888
  ...[...manifest.targets.values()].flatMap(
24786
24889
  (other) => other !== target && within(other.dir, [target.dir]) && other.dir !== target.dir ? [other.dir] : []
24787
24890
  )
24788
24891
  ];
24789
24892
  return included.flatMap(walk).filter((file) => !within(file, excluded)).sort();
24790
24893
  }
24791
- var import_node_child_process7, import_node_crypto5, import_node_fs13, import_node_os5, import_node_path13, TARGET_TYPES, isTargetType, record, array, string, cacheDir2, evaluated, within;
24894
+ var import_node_child_process7, import_node_crypto6, import_node_fs14, import_node_os6, import_node_path14, TARGET_TYPES, isTargetType, record, array, string, cacheDir3, evaluated, within;
24792
24895
  var init_swift_package_manifest = __esm({
24793
24896
  "src/swift-package-manifest.ts"() {
24794
24897
  "use strict";
24795
24898
  import_node_child_process7 = require("node:child_process");
24796
- import_node_crypto5 = require("node:crypto");
24797
- import_node_fs13 = __toESM(require("node:fs"), 1);
24798
- import_node_os5 = __toESM(require("node:os"), 1);
24799
- import_node_path13 = __toESM(require("node:path"), 1);
24899
+ import_node_crypto6 = require("node:crypto");
24900
+ import_node_fs14 = __toESM(require("node:fs"), 1);
24901
+ import_node_os6 = __toESM(require("node:os"), 1);
24902
+ import_node_path14 = __toESM(require("node:path"), 1);
24800
24903
  init_swift_distribution_lock();
24801
24904
  init_swift_toolchain();
24802
24905
  TARGET_TYPES = [
@@ -24812,15 +24915,15 @@ var init_swift_package_manifest = __esm({
24812
24915
  record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
24813
24916
  array = (value) => Array.isArray(value) ? value : [];
24814
24917
  string = (value) => typeof value === "string" ? value : void 0;
24815
- cacheDir2 = import_node_path13.default.join(import_node_os5.default.tmpdir(), "peach-swift-manifests");
24918
+ cacheDir3 = import_node_path14.default.join(import_node_os6.default.tmpdir(), "peach-swift-manifests");
24816
24919
  evaluated = /* @__PURE__ */ new Map();
24817
- within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path13.default.sep}`));
24920
+ within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path14.default.sep}`));
24818
24921
  }
24819
24922
  });
24820
24923
 
24821
24924
  // src/swift-packages.ts
24822
24925
  function readPins(resolved) {
24823
- const data = JSON.parse(import_node_fs14.default.readFileSync(resolved, "utf8"));
24926
+ const data = JSON.parse(import_node_fs15.default.readFileSync(resolved, "utf8"));
24824
24927
  const pins = data && typeof data === "object" && "pins" in data && Array.isArray(data.pins) ? data.pins : null;
24825
24928
  if (!pins)
24826
24929
  throw new Error(`${resolved} has no pins; resolve packages in a current Xcode`);
@@ -24835,23 +24938,23 @@ function readPins(resolved) {
24835
24938
  return out;
24836
24939
  }
24837
24940
  function checkout(checkouts, identity, pin) {
24838
- const dir = import_node_path14.default.join(checkouts, identity);
24941
+ const dir = import_node_path15.default.join(checkouts, identity);
24839
24942
  const key = `${dir}\0${pin.revision}`;
24840
24943
  if (verified2.has(key)) return dir;
24841
24944
  const git = (...args) => (0, import_node_child_process8.execFileSync)("git", ["-C", dir, ...args], {
24842
24945
  encoding: "utf8",
24843
24946
  stdio: ["ignore", "pipe", "pipe"]
24844
24947
  }).trim();
24845
- const current = import_node_fs14.default.existsSync(import_node_path14.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
24948
+ const current = import_node_fs15.default.existsSync(import_node_path15.default.join(dir, ".git")) ? git("rev-parse", "HEAD") : "";
24846
24949
  if (current !== pin.revision) {
24847
- import_node_fs14.default.rmSync(dir, { recursive: true, force: true });
24848
- import_node_fs14.default.mkdirSync(dir, { recursive: true });
24950
+ import_node_fs15.default.rmSync(dir, { recursive: true, force: true });
24951
+ import_node_fs15.default.mkdirSync(dir, { recursive: true });
24849
24952
  try {
24850
24953
  git("init", "-q");
24851
24954
  git("fetch", "-q", "--depth", "1", pin.location, pin.revision);
24852
24955
  git("checkout", "-q", "FETCH_HEAD");
24853
24956
  } catch (error) {
24854
- import_node_fs14.default.rmSync(dir, { recursive: true, force: true });
24957
+ import_node_fs15.default.rmSync(dir, { recursive: true, force: true });
24855
24958
  const stderr = error instanceof Error && "stderr" in error ? String(error.stderr).trim() : "";
24856
24959
  throw new Error(
24857
24960
  `could not fetch ${pin.location} at ${pin.revision}${stderr ? `: ${stderr}` : ""}`
@@ -24867,13 +24970,14 @@ function resolveSwiftPackages(options) {
24867
24970
  const result = {
24868
24971
  targets: [],
24869
24972
  unavailable: /* @__PURE__ */ new Map(),
24870
- modules: /* @__PURE__ */ new Map()
24973
+ modules: /* @__PURE__ */ new Map(),
24974
+ binaries: []
24871
24975
  };
24872
24976
  const pins = resolved ? readPins(resolved) : null;
24873
- const checkouts = import_node_path14.default.join(rootDir, REMOTE_CHECKOUTS);
24977
+ const checkouts = import_node_path15.default.join(rootDir, REMOTE_CHECKOUTS);
24874
24978
  const packages = /* @__PURE__ */ new Map();
24875
24979
  const load2 = (source) => {
24876
- const key = source.kind === "local" ? import_node_path14.default.resolve(source.dir) : source.url;
24980
+ const key = source.kind === "local" ? import_node_path15.default.resolve(source.dir) : source.url;
24877
24981
  const cached4 = packages.get(key);
24878
24982
  if (cached4 !== void 0) return cached4;
24879
24983
  let loaded2;
@@ -24885,8 +24989,8 @@ function resolveSwiftPackages(options) {
24885
24989
  if (!pin) {
24886
24990
  loaded2 = pins ? `package ${identity} is not pinned in Package.resolved` : "no Package.resolved pins it; resolve packages in Xcode once";
24887
24991
  } else {
24888
- import_node_fs14.default.mkdirSync(checkouts, { recursive: true });
24889
- import_node_fs14.default.writeFileSync(import_node_path14.default.join(import_node_path14.default.dirname(checkouts), ".gitignore"), "*\n");
24992
+ import_node_fs15.default.mkdirSync(checkouts, { recursive: true });
24993
+ import_node_fs15.default.writeFileSync(import_node_path15.default.join(import_node_path15.default.dirname(checkouts), ".gitignore"), "*\n");
24890
24994
  loaded2 = {
24891
24995
  source: source.url,
24892
24996
  remote: true,
@@ -24906,8 +25010,8 @@ function resolveSwiftPackages(options) {
24906
25010
  const outcome = (() => {
24907
25011
  if (provided.has(name2)) return null;
24908
25012
  const target = pkg.manifest.targets.get(name2);
24909
- if (!target) return `${import_node_path14.default.basename(pkg.manifest.dir)} declares no target ${name2}`;
24910
- if (target.type === "binary") return `${name2} is a binary framework`;
25013
+ if (!target) return `${import_node_path15.default.basename(pkg.manifest.dir)} declares no target ${name2}`;
25014
+ if (target.type === "binary") return `${name2} ${BINARY}`;
24911
25015
  if (target.type === "system") return `${name2} is a system C library`;
24912
25016
  if (target.type !== "regular") return `${name2} is a ${target.type} target`;
24913
25017
  const files = swiftTargetFiles(pkg.manifest, target);
@@ -24918,9 +25022,9 @@ function resolveSwiftPackages(options) {
24918
25022
  const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
24919
25023
  return nested && `${dependency.name}: ${nested}`;
24920
25024
  });
24921
- const blocked = reasons.find((reason) => reason !== null);
25025
+ const blocked = blocker(reasons);
24922
25026
  if (blocked) return blocked;
24923
- const relative3 = files.map((file) => import_node_path14.default.relative(target.dir, file));
25027
+ const relative3 = files.map((file) => import_node_path15.default.relative(target.dir, file));
24924
25028
  targets.set(`${pkg.manifest.dir}\0${name2}`, {
24925
25029
  name: name2,
24926
25030
  path: "",
@@ -24942,7 +25046,7 @@ function resolveSwiftPackages(options) {
24942
25046
  const resolveProduct = (pkg, product) => {
24943
25047
  if (provided.has(product)) return null;
24944
25048
  const roots = pkg.manifest.products.get(product);
24945
- const reason = !roots ? `${import_node_path14.default.basename(pkg.manifest.dir)} has no library ${product}` : roots.map((name2) => resolveTarget(pkg, name2)).find((value) => value !== null) ?? null;
25049
+ const reason = !roots ? `${import_node_path15.default.basename(pkg.manifest.dir)} has no library ${product}` : blocker(roots.map((name2) => resolveTarget(pkg, name2)));
24946
25050
  productOutcomes.set(`${pkg.manifest.dir}\0${product}`, { pkg, reason });
24947
25051
  return reason;
24948
25052
  };
@@ -24950,7 +25054,7 @@ function resolveSwiftPackages(options) {
24950
25054
  if (provided.has(product)) return null;
24951
25055
  const dependency = pkg.manifest.packages.get(packageName);
24952
25056
  if (!dependency)
24953
- return `${import_node_path14.default.basename(pkg.manifest.dir)} names no package ${packageName}`;
25057
+ return `${import_node_path15.default.basename(pkg.manifest.dir)} names no package ${packageName}`;
24954
25058
  if ("dir" in dependency) {
24955
25059
  const loaded3 = load2({ kind: "local", dir: dependency.dir });
24956
25060
  return typeof loaded3 === "string" ? loaded3 : resolveProduct(loaded3, product);
@@ -24977,6 +25081,13 @@ function resolveSwiftPackages(options) {
24977
25081
  if (target.type === "test" || target.type === "plugin" || target.type === "macro")
24978
25082
  continue;
24979
25083
  if (target.type === "executable") continue;
25084
+ if (target.type === "binary")
25085
+ result.binaries.push({
25086
+ target: name2,
25087
+ source: pkg.source,
25088
+ url: target.url,
25089
+ dir: target.dir
25090
+ });
24980
25091
  const reason = resolveTarget(pkg, name2);
24981
25092
  if (reason && !result.modules.has(name2))
24982
25093
  result.modules.set(name2, { source: pkg.source, reason });
@@ -24996,7 +25107,7 @@ function resolveSwiftPackages(options) {
24996
25107
  if (dependency.kind === "target") reach(pkg, dependency.name);
24997
25108
  else {
24998
25109
  const source = pkg.manifest.packages.get(dependency.package);
24999
- const nested = source && ("dir" in source ? packages.get(import_node_path14.default.resolve(source.dir)) : packages.get(source.url));
25110
+ const nested = source && ("dir" in source ? packages.get(import_node_path15.default.resolve(source.dir)) : packages.get(source.url));
25000
25111
  if (nested && typeof nested !== "string")
25001
25112
  for (const root of nested.manifest.products.get(dependency.name) ?? [])
25002
25113
  reach(nested, root);
@@ -25004,24 +25115,26 @@ function resolveSwiftPackages(options) {
25004
25115
  }
25005
25116
  };
25006
25117
  for (const { product, source } of products) {
25007
- const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ? import_node_path14.default.resolve(source.dir) : source.url);
25118
+ const pkg = source.kind === "unnamed" ? unnamed().find((candidate) => candidate.manifest.products.has(product)) : packages.get(source.kind === "local" ? import_node_path15.default.resolve(source.dir) : source.url);
25008
25119
  if (!pkg || typeof pkg === "string") continue;
25009
25120
  for (const root of pkg.manifest.products.get(product) ?? []) reach(pkg, root);
25010
25121
  }
25011
25122
  result.targets = [...targets.entries()].filter(([key]) => reached.has(key)).map(([, target]) => target);
25012
25123
  return result;
25013
25124
  }
25014
- var import_node_child_process8, import_node_fs14, import_node_path14, REMOTE_CHECKOUTS, C_FAMILY, verified2;
25125
+ var import_node_child_process8, import_node_fs15, import_node_path15, REMOTE_CHECKOUTS, C_FAMILY, BINARY, blocker, verified2;
25015
25126
  var init_swift_packages = __esm({
25016
25127
  "src/swift-packages.ts"() {
25017
25128
  "use strict";
25018
25129
  import_node_child_process8 = require("node:child_process");
25019
- import_node_fs14 = __toESM(require("node:fs"), 1);
25020
- import_node_path14 = __toESM(require("node:path"), 1);
25130
+ import_node_fs15 = __toESM(require("node:fs"), 1);
25131
+ import_node_path15 = __toESM(require("node:path"), 1);
25021
25132
  init_swift_package();
25022
25133
  init_swift_package_manifest();
25023
- REMOTE_CHECKOUTS = import_node_path14.default.join(".build", "peach", "checkouts");
25134
+ REMOTE_CHECKOUTS = import_node_path15.default.join(".build", "peach", "checkouts");
25024
25135
  C_FAMILY = /\.(c|cc|cpp|cxx|m|mm|s|S)$/;
25136
+ BINARY = "is a binary framework";
25137
+ blocker = (reasons) => reasons.find((reason) => reason?.includes(BINARY)) ?? reasons.find((reason) => reason !== null) ?? null;
25025
25138
  verified2 = /* @__PURE__ */ new Set();
25026
25139
  }
25027
25140
  });
@@ -25162,7 +25275,7 @@ var init_swift_submit = __esm({
25162
25275
  function readXcodeJsonProject(xcodeproj, source) {
25163
25276
  const json = import_json5.default.parse(source);
25164
25277
  if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
25165
- const projectDir = import_node_path15.default.dirname(xcodeproj);
25278
+ const projectDir = import_node_path16.default.dirname(xcodeproj);
25166
25279
  const objects = {};
25167
25280
  let next = 0;
25168
25281
  const add = (entry, id) => {
@@ -25175,7 +25288,7 @@ function readXcodeJsonProject(xcodeproj, source) {
25175
25288
  const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
25176
25289
  if (base) {
25177
25290
  if (base[1] === "PROJECT")
25178
- return { sourceTree: "<absolute>", path: import_node_path15.default.join(projectDir, base[2]) };
25291
+ return { sourceTree: "<absolute>", path: import_node_path16.default.join(projectDir, base[2]) };
25179
25292
  if (base[1] === "PRODUCTS")
25180
25293
  return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
25181
25294
  return null;
@@ -25183,7 +25296,7 @@ function readXcodeJsonProject(xcodeproj, source) {
25183
25296
  const unescaped = raw2.replaceAll("\\<", "<");
25184
25297
  if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
25185
25298
  if (unescaped.startsWith("~")) return null;
25186
- return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path15.default.join(groupDir, unescaped) };
25299
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path16.default.join(groupDir, unescaped) };
25187
25300
  };
25188
25301
  const memberships = [];
25189
25302
  const folders = [];
@@ -25194,7 +25307,7 @@ function readXcodeJsonProject(xcodeproj, source) {
25194
25307
  const kind = text(entry.kind) ?? "file-reference";
25195
25308
  const raw2 = text(entry.path) ?? "";
25196
25309
  const located = raw2 === "" ? null : locate(raw2, parent.dir);
25197
- const name2 = text(entry.name) ?? import_node_path15.default.basename(raw2);
25310
+ const name2 = text(entry.name) ?? import_node_path16.default.basename(raw2);
25198
25311
  const node = { id: "", name: name2, dir: null, parent, children: [] };
25199
25312
  if (kind === "group" || kind === "variant-group" || kind === "version-group") {
25200
25313
  node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
@@ -25309,7 +25422,7 @@ function readXcodeJsonProject(xcodeproj, source) {
25309
25422
  if (!isObject(entry)) continue;
25310
25423
  const repository = text(entry.repository);
25311
25424
  const local = text(entry.path);
25312
- const name2 = local !== void 0 ? import_node_path15.default.basename(import_node_path15.default.resolve(import_node_path15.default.dirname(xcodeproj), local)) : import_node_path15.default.basename(repository ?? "").replace(/\.git$/, "");
25425
+ const name2 = local !== void 0 ? import_node_path16.default.basename(import_node_path16.default.resolve(import_node_path16.default.dirname(xcodeproj), local)) : import_node_path16.default.basename(repository ?? "").replace(/\.git$/, "");
25313
25426
  const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
25314
25427
  packageIds.set(name2.toLowerCase(), id);
25315
25428
  }
@@ -25477,11 +25590,11 @@ function readXcodeJsonProject(xcodeproj, source) {
25477
25590
  function isJsonObject(value) {
25478
25591
  return typeof value === "object" && value !== null && !Array.isArray(value);
25479
25592
  }
25480
- var import_node_path15, import_json5, isObject, text, items, PHASE_ISA;
25593
+ var import_node_path16, import_json5, isObject, text, items, PHASE_ISA;
25481
25594
  var init_xcode_json_project = __esm({
25482
25595
  "src/xcode-json-project.ts"() {
25483
25596
  "use strict";
25484
- import_node_path15 = __toESM(require("node:path"), 1);
25597
+ import_node_path16 = __toESM(require("node:path"), 1);
25485
25598
  import_json5 = __toESM(require("json5"), 1);
25486
25599
  isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25487
25600
  text = (value) => typeof value === "string" ? value : void 0;
@@ -25588,27 +25701,27 @@ function parseOpenStepPlist(text2) {
25588
25701
  return root;
25589
25702
  }
25590
25703
  function walkFiles(dir) {
25591
- if (!import_node_fs15.default.existsSync(dir)) return [];
25704
+ if (!import_node_fs16.default.existsSync(dir)) return [];
25592
25705
  const out = [];
25593
- for (const entry of import_node_fs15.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
25706
+ for (const entry of import_node_fs16.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
25594
25707
  if (entry.name.startsWith(".")) continue;
25595
- const full = import_node_path16.default.join(dir, entry.name);
25708
+ const full = import_node_path17.default.join(dir, entry.name);
25596
25709
  if (entry.isDirectory()) out.push(...walkFiles(full));
25597
25710
  else if (entry.isFile()) out.push(full);
25598
25711
  }
25599
25712
  return out;
25600
25713
  }
25601
25714
  function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
25602
- if (seen.has(file) || !import_node_fs15.default.existsSync(file)) return {};
25715
+ if (seen.has(file) || !import_node_fs16.default.existsSync(file)) return {};
25603
25716
  seen.add(file);
25604
25717
  const settings = {};
25605
- for (const raw2 of import_node_fs15.default.readFileSync(file, "utf8").split("\n")) {
25718
+ for (const raw2 of import_node_fs16.default.readFileSync(file, "utf8").split("\n")) {
25606
25719
  const line = raw2.replace(/\/\/.*$/, "").trim();
25607
25720
  const include = /^#include\??\s+"([^"]+)"/.exec(line);
25608
25721
  if (include) {
25609
25722
  Object.assign(
25610
25723
  settings,
25611
- readXcconfig(import_node_path16.default.resolve(import_node_path16.default.dirname(file), include[1]), seen)
25724
+ readXcconfig(import_node_path17.default.resolve(import_node_path17.default.dirname(file), include[1]), seen)
25612
25725
  );
25613
25726
  continue;
25614
25727
  }
@@ -25658,22 +25771,22 @@ function decodeXml(text2) {
25658
25771
  return text2.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
25659
25772
  }
25660
25773
  function workspaceReferences(workspace) {
25661
- const data = import_node_path16.default.join(workspace, "contents.xcworkspacedata");
25662
- if (!import_node_fs15.default.existsSync(data))
25774
+ const data = import_node_path17.default.join(workspace, "contents.xcworkspacedata");
25775
+ if (!import_node_fs16.default.existsSync(data))
25663
25776
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
25664
- const container = import_node_path16.default.dirname(workspace);
25777
+ const container = import_node_path17.default.dirname(workspace);
25665
25778
  const locate = (location2, base) => {
25666
25779
  const colon = location2.indexOf(":");
25667
25780
  const kind = location2.slice(0, colon);
25668
25781
  const rest = location2.slice(colon + 1);
25669
- if (kind === "group") return import_node_path16.default.resolve(base, rest);
25670
- if (kind === "container" || kind === "self") return import_node_path16.default.resolve(container, rest);
25671
- if (kind === "absolute") return import_node_path16.default.resolve(rest);
25672
- throw new Error(`${import_node_path16.default.basename(workspace)} has an unsupported location ${location2}`);
25782
+ if (kind === "group") return import_node_path17.default.resolve(base, rest);
25783
+ if (kind === "container" || kind === "self") return import_node_path17.default.resolve(container, rest);
25784
+ if (kind === "absolute") return import_node_path17.default.resolve(rest);
25785
+ throw new Error(`${import_node_path17.default.basename(workspace)} has an unsupported location ${location2}`);
25673
25786
  };
25674
25787
  const groups = [container];
25675
25788
  const references = [];
25676
- for (const [, closing, tag, attributes, selfClosing] of import_node_fs15.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
25789
+ for (const [, closing, tag, attributes, selfClosing] of import_node_fs16.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
25677
25790
  if (closing) {
25678
25791
  if (tag === "Group") groups.pop();
25679
25792
  continue;
@@ -25688,8 +25801,8 @@ function workspaceReferences(workspace) {
25688
25801
  }
25689
25802
  function xcodeProjectFile(xcodeproj) {
25690
25803
  for (const name2 of ["project.pbxproj", "project.xcproj"]) {
25691
- const file = import_node_path16.default.join(xcodeproj, name2);
25692
- if (import_node_fs15.default.existsSync(file)) return file;
25804
+ const file = import_node_path17.default.join(xcodeproj, name2);
25805
+ if (import_node_fs16.default.existsSync(file)) return file;
25693
25806
  }
25694
25807
  return null;
25695
25808
  }
@@ -25697,10 +25810,10 @@ function loadProject(xcodeproj) {
25697
25810
  const projectFile = xcodeProjectFile(xcodeproj);
25698
25811
  if (!projectFile)
25699
25812
  throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
25700
- const mtimeMs = import_node_fs15.default.statSync(projectFile).mtimeMs;
25813
+ const mtimeMs = import_node_fs16.default.statSync(projectFile).mtimeMs;
25701
25814
  const cached4 = loaded.get(projectFile);
25702
25815
  if (cached4?.mtimeMs === mtimeMs) return cached4.project;
25703
- const source = import_node_fs15.default.readFileSync(projectFile, "utf8");
25816
+ const source = import_node_fs16.default.readFileSync(projectFile, "utf8");
25704
25817
  const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
25705
25818
  if (!isDict(root) || !isDict(root.objects)) {
25706
25819
  throw new Error(`${projectFile} has no objects table`);
@@ -25714,8 +25827,8 @@ function loadProject(xcodeproj) {
25714
25827
  if (!project || project.isa !== "PBXProject") {
25715
25828
  throw new Error(`${projectFile} has no PBXProject root`);
25716
25829
  }
25717
- const projectDir = import_node_fs15.default.realpathSync(
25718
- import_node_path16.default.resolve(import_node_path16.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
25830
+ const projectDir = import_node_fs16.default.realpathSync(
25831
+ import_node_path17.default.resolve(import_node_path17.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
25719
25832
  );
25720
25833
  const parent = /* @__PURE__ */ new Map();
25721
25834
  for (const [id, entry] of Object.entries(objects)) {
@@ -25733,11 +25846,11 @@ function loadProject(xcodeproj) {
25733
25846
  const own = str(entry.path) ?? "";
25734
25847
  const tree = str(entry.sourceTree) ?? "<group>";
25735
25848
  if (tree === "<absolute>") result2 = own;
25736
- else if (tree === "SOURCE_ROOT") result2 = import_node_path16.default.join(projectDir, own);
25849
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path17.default.join(projectDir, own);
25737
25850
  else if (tree === "<group>") {
25738
25851
  const up = parent.get(id);
25739
25852
  const base = up ? resolvePath(up) : projectDir;
25740
- result2 = base === null ? null : import_node_path16.default.join(base, own);
25853
+ result2 = base === null ? null : import_node_path17.default.join(base, own);
25741
25854
  }
25742
25855
  }
25743
25856
  resolvedPaths.set(id, result2);
@@ -25837,7 +25950,7 @@ function targetMembers(ref) {
25837
25950
  const addResource = (file) => {
25838
25951
  if (isDirectory(file)) {
25839
25952
  for (const inner of walkFiles(file)) resources.add(inner);
25840
- } else if (import_node_fs15.default.existsSync(file)) resources.add(file);
25953
+ } else if (import_node_fs16.default.existsSync(file)) resources.add(file);
25841
25954
  };
25842
25955
  const fileRefPaths = (refId) => {
25843
25956
  const entry = project.object(refId);
@@ -25858,7 +25971,7 @@ function targetMembers(ref) {
25858
25971
  for (const buildFileId of list(phase.files)) {
25859
25972
  for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
25860
25973
  if (phase.isa === "PBXSourcesBuildPhase") {
25861
- if (!import_node_fs15.default.existsSync(file)) continue;
25974
+ if (!import_node_fs16.default.existsSync(file)) continue;
25862
25975
  allSources.add(file);
25863
25976
  if (file.endsWith(".swift")) sources.add(file);
25864
25977
  } else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
@@ -25866,7 +25979,7 @@ function targetMembers(ref) {
25866
25979
  }
25867
25980
  }
25868
25981
  const addSynchronized = (folder, relative3) => {
25869
- const file = import_node_path16.default.join(folder, relative3);
25982
+ const file = import_node_path17.default.join(folder, relative3);
25870
25983
  if (NEVER_MEMBER.test(relative3)) return;
25871
25984
  if (file.endsWith(".swift")) {
25872
25985
  if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
@@ -25891,7 +26004,7 @@ function targetMembers(ref) {
25891
26004
  }
25892
26005
  if (owned.has(groupId)) {
25893
26006
  for (const file of walkFiles(folder)) {
25894
- const relative3 = import_node_path16.default.relative(folder, file).split(import_node_path16.default.sep).join("/");
26007
+ const relative3 = import_node_path17.default.relative(folder, file).split(import_node_path17.default.sep).join("/");
25895
26008
  if ([...exceptions].some(
25896
26009
  (exception) => relative3 === exception || relative3.startsWith(`${exception}/`)
25897
26010
  ))
@@ -25900,14 +26013,14 @@ function targetMembers(ref) {
25900
26013
  }
25901
26014
  } else {
25902
26015
  for (const relative3 of exceptions) {
25903
- const file = import_node_path16.default.join(folder, relative3);
26016
+ const file = import_node_path17.default.join(folder, relative3);
25904
26017
  if (isDirectory(file)) {
25905
26018
  for (const inner of walkFiles(file))
25906
26019
  addSynchronized(
25907
26020
  folder,
25908
- import_node_path16.default.relative(folder, inner).split(import_node_path16.default.sep).join("/")
26021
+ import_node_path17.default.relative(folder, inner).split(import_node_path17.default.sep).join("/")
25909
26022
  );
25910
- } else if (import_node_fs15.default.existsSync(file)) addSynchronized(folder, relative3);
26023
+ } else if (import_node_fs16.default.existsSync(file)) addSynchronized(folder, relative3);
25911
26024
  }
25912
26025
  }
25913
26026
  }
@@ -25920,8 +26033,8 @@ function targetMembers(ref) {
25920
26033
  function commonAncestor(dirs) {
25921
26034
  let common = dirs[0];
25922
26035
  for (const dir of dirs) {
25923
- while (common !== import_node_path16.default.dirname(common) && import_node_path16.default.relative(common, dir).startsWith(".."))
25924
- common = import_node_path16.default.dirname(common);
26036
+ while (common !== import_node_path17.default.dirname(common) && import_node_path17.default.relative(common, dir).startsWith(".."))
26037
+ common = import_node_path17.default.dirname(common);
25925
26038
  }
25926
26039
  return common;
25927
26040
  }
@@ -25930,8 +26043,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
25930
26043
  const projects2 = [];
25931
26044
  const projectAt = /* @__PURE__ */ new Map();
25932
26045
  const addProject = (xcodeproj) => {
25933
- const key = import_node_path16.default.resolve(xcodeproj);
25934
- if (projectAt.has(key) || key.split(import_node_path16.default.sep).includes("Pods")) return;
26046
+ const key = import_node_path17.default.resolve(xcodeproj);
26047
+ if (projectAt.has(key) || key.split(import_node_path17.default.sep).includes("Pods")) return;
25935
26048
  if (!xcodeProjectFile(key)) return;
25936
26049
  const project = loadProject(key);
25937
26050
  projectAt.set(key, project);
@@ -25948,7 +26061,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
25948
26061
  for (const reference of listed)
25949
26062
  if (reference.endsWith(".xcodeproj")) addProject(reference);
25950
26063
  if (projects2.length === 0) {
25951
- throw new Error(`${import_node_path16.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
26064
+ throw new Error(`${import_node_path17.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
25952
26065
  }
25953
26066
  return { listed, projects: projects2, projectAt };
25954
26067
  }
@@ -25972,7 +26085,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25972
26085
  const allTargets = projects2.flatMap(nativeTargets);
25973
26086
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
25974
26087
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
25975
- const container = import_node_path16.default.basename(xcodeprojOrWorkspace);
26088
+ const container = import_node_path17.default.basename(xcodeprojOrWorkspace);
25976
26089
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
25977
26090
  if (named.length !== 1) {
25978
26091
  throw new Error(
@@ -25984,14 +26097,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25984
26097
  for (const ref of allTargets) {
25985
26098
  const product = ref.project.object(str(ref.target.productReference));
25986
26099
  const file = str(product?.path);
25987
- if (file && !byProduct.has(import_node_path16.default.basename(file)))
25988
- byProduct.set(import_node_path16.default.basename(file), ref);
26100
+ if (file && !byProduct.has(import_node_path17.default.basename(file)))
26101
+ byProduct.set(import_node_path17.default.basename(file), ref);
25989
26102
  }
25990
26103
  const proxied = (project, proxyId) => {
25991
26104
  const proxy = project.object(proxyId);
25992
26105
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
25993
26106
  const portal = str(proxy.containerPortal);
25994
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path16.default.resolve(project.resolvePath(portal ?? "") ?? ""));
26107
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path17.default.resolve(project.resolvePath(portal ?? "") ?? ""));
25995
26108
  const remote = str(proxy.remoteGlobalIDString);
25996
26109
  if (!owner || !remote) return void 0;
25997
26110
  return nativeTargets(owner).find(
@@ -26012,7 +26125,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
26012
26125
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
26013
26126
  for (const buildFileId of list(phase.files)) {
26014
26127
  const file = project.object(str(project.object(buildFileId)?.fileRef));
26015
- const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path16.default.basename(str(file.path) ?? "")) : void 0;
26128
+ const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path17.default.basename(str(file.path) ?? "")) : void 0;
26016
26129
  if (resolved) found.push(resolved);
26017
26130
  }
26018
26131
  }
@@ -26033,7 +26146,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
26033
26146
  const name2 = str(ref.target.name) ?? ref.id;
26034
26147
  const { get: settings2, keys } = targetSettings(ref, {
26035
26148
  TARGET_NAME: name2,
26036
- PROJECT_NAME: import_node_path16.default.basename(ref.project.xcodeproj, ".xcodeproj"),
26149
+ PROJECT_NAME: import_node_path17.default.basename(ref.project.xcodeproj, ".xcodeproj"),
26037
26150
  SRCROOT: ref.project.projectDir,
26038
26151
  SOURCE_ROOT: ref.project.projectDir,
26039
26152
  PROJECT_DIR: ref.project.projectDir,
@@ -26064,8 +26177,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
26064
26177
  }
26065
26178
  return value;
26066
26179
  };
26067
- const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path16.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
26068
- const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs15.default.readFileSync(infoPlistFile, "utf8")) : {};
26180
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path17.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
26181
+ const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs16.default.readFileSync(infoPlistFile, "utf8")) : {};
26069
26182
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
26070
26183
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
26071
26184
  }
@@ -26083,12 +26196,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
26083
26196
  };
26084
26197
  }
26085
26198
  const localPackageDirs = [
26086
- ...listed.filter((reference) => import_node_fs15.default.existsSync(import_node_path16.default.join(reference, "Package.swift"))),
26199
+ ...listed.filter((reference) => import_node_fs16.default.existsSync(import_node_path17.default.join(reference, "Package.swift"))),
26087
26200
  ...projects2.flatMap(
26088
26201
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
26089
26202
  if (!isDict(entry)) return [];
26090
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path16.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
26091
- return candidate && import_node_fs15.default.existsSync(import_node_path16.default.join(candidate, "Package.swift")) ? [candidate] : [];
26203
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path17.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
26204
+ return candidate && import_node_fs16.default.existsSync(import_node_path17.default.join(candidate, "Package.swift")) ? [candidate] : [];
26092
26205
  })
26093
26206
  )
26094
26207
  ];
@@ -26112,7 +26225,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
26112
26225
  product,
26113
26226
  source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
26114
26227
  kind: "local",
26115
- dir: import_node_path16.default.resolve(
26228
+ dir: import_node_path17.default.resolve(
26116
26229
  project.projectDir,
26117
26230
  str(reference.relativePath) ?? ""
26118
26231
  )
@@ -26134,8 +26247,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
26134
26247
  }
26135
26248
  }
26136
26249
  }
26137
- const resolvedFile = import_node_path16.default.join(
26138
- workspace ?? import_node_path16.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
26250
+ const resolvedFile = import_node_path17.default.join(
26251
+ workspace ?? import_node_path17.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
26139
26252
  "xcshareddata",
26140
26253
  "swiftpm",
26141
26254
  "Package.resolved"
@@ -26145,13 +26258,13 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
26145
26258
  ...module2,
26146
26259
  rootDir: commonAncestor(
26147
26260
  [
26148
- workspace ? import_node_path16.default.dirname(workspace) : app.project.projectDir,
26261
+ workspace ? import_node_path17.default.dirname(workspace) : app.project.projectDir,
26149
26262
  ...used.map((project) => project.projectDir),
26150
26263
  ...localPackageDirs,
26151
26264
  ...linkedProducts.flatMap(
26152
- ({ source }) => source.kind === "local" && import_node_fs15.default.existsSync(source.dir) ? [source.dir] : []
26265
+ ({ source }) => source.kind === "local" && import_node_fs16.default.existsSync(source.dir) ? [source.dir] : []
26153
26266
  )
26154
- ].map((dir) => import_node_fs15.default.realpathSync(dir))
26267
+ ].map((dir) => import_node_fs16.default.realpathSync(dir))
26155
26268
  ),
26156
26269
  projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
26157
26270
  infoPlist: import_plist3.default.build(info),
@@ -26159,19 +26272,19 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
26159
26272
  frameworks,
26160
26273
  linkedProducts,
26161
26274
  localPackageDirs: [
26162
- ...new Set(localPackageDirs.map((dir) => import_node_fs15.default.realpathSync(dir)))
26275
+ ...new Set(localPackageDirs.map((dir) => import_node_fs16.default.realpathSync(dir)))
26163
26276
  ].sort(),
26164
26277
  binaryFrameworks: [...binaryFrameworks].sort(),
26165
- packageResolved: import_node_fs15.default.existsSync(resolvedFile) ? resolvedFile : null,
26278
+ packageResolved: import_node_fs16.default.existsSync(resolvedFile) ? resolvedFile : null,
26166
26279
  appTargets: appTargetNames
26167
26280
  };
26168
26281
  }
26169
- var import_node_fs15, import_node_path16, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
26282
+ var import_node_fs16, import_node_path17, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
26170
26283
  var init_xcode_project = __esm({
26171
26284
  "src/xcode-project.ts"() {
26172
26285
  "use strict";
26173
- import_node_fs15 = __toESM(require("node:fs"), 1);
26174
- import_node_path16 = __toESM(require("node:path"), 1);
26286
+ import_node_fs16 = __toESM(require("node:fs"), 1);
26287
+ import_node_path17 = __toESM(require("node:path"), 1);
26175
26288
  import_plist3 = __toESM(require_plist(), 1);
26176
26289
  init_xcode_json_project();
26177
26290
  isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -26191,7 +26304,7 @@ var init_xcode_project = __esm({
26191
26304
  arch: "arm64",
26192
26305
  variant: "normal"
26193
26306
  };
26194
- isDirectory = (dir) => import_node_fs15.default.existsSync(dir) && import_node_fs15.default.statSync(dir).isDirectory();
26307
+ isDirectory = (dir) => import_node_fs16.default.existsSync(dir) && import_node_fs16.default.statSync(dir).isDirectory();
26195
26308
  loaded = /* @__PURE__ */ new Map();
26196
26309
  targetRefs = /* @__PURE__ */ new WeakMap();
26197
26310
  }
@@ -26199,17 +26312,17 @@ var init_xcode_project = __esm({
26199
26312
 
26200
26313
  // src/swift-host.ts
26201
26314
  function swiftPackageId(packagePath) {
26202
- return import_node_path17.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
26315
+ return import_node_path18.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
26203
26316
  }
26204
26317
  function nativeSourceDescriptor(packagePath) {
26205
- packagePath = import_node_fs16.default.realpathSync(packagePath);
26206
- const file = import_node_path17.default.join(packagePath, NATIVE_DESCRIPTOR);
26207
- if (!import_node_fs16.default.existsSync(file)) return null;
26318
+ packagePath = import_node_fs17.default.realpathSync(packagePath);
26319
+ const file = import_node_path18.default.join(packagePath, NATIVE_DESCRIPTOR);
26320
+ if (!import_node_fs17.default.existsSync(file)) return null;
26208
26321
  const value = JSON.parse(
26209
26322
  readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
26210
26323
  );
26211
26324
  const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
26212
- if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs16.default.existsSync(import_node_path17.default.join(packagePath, NATIVE_GLUE))) {
26325
+ if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs17.default.existsSync(import_node_path18.default.join(packagePath, NATIVE_GLUE))) {
26213
26326
  throw invalid();
26214
26327
  }
26215
26328
  if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
@@ -26218,7 +26331,7 @@ function nativeSourceDescriptor(packagePath) {
26218
26331
  return value;
26219
26332
  }
26220
26333
  function projectFor(packagePath, hosted) {
26221
- packagePath = import_node_fs16.default.realpathSync(packagePath);
26334
+ packagePath = import_node_fs17.default.realpathSync(packagePath);
26222
26335
  const existing = projects.get(packagePath);
26223
26336
  if (existing) {
26224
26337
  if (hosted && !existing.hosted) {
@@ -26239,14 +26352,14 @@ function projectFor(packagePath, hosted) {
26239
26352
  return created;
26240
26353
  }
26241
26354
  function swiftPackages(entry, app) {
26242
- const stamp = (file) => file && import_node_fs16.default.existsSync(file) ? import_node_fs16.default.statSync(file).mtimeMs : 0;
26355
+ const stamp = (file) => file && import_node_fs17.default.existsSync(file) ? import_node_fs17.default.statSync(file).mtimeMs : 0;
26243
26356
  const key = JSON.stringify([
26244
26357
  app.linkedProducts,
26245
26358
  app.packageResolved,
26246
26359
  stamp(app.packageResolved),
26247
- app.localPackageDirs.map((dir) => stamp(import_node_path17.default.join(dir, "Package.swift"))),
26360
+ app.localPackageDirs.map((dir) => stamp(import_node_path18.default.join(dir, "Package.swift"))),
26248
26361
  app.linkedProducts.map(
26249
- ({ source }) => source.kind === "local" ? stamp(import_node_path17.default.join(source.dir, "Package.swift")) : 0
26362
+ ({ source }) => source.kind === "local" ? stamp(import_node_path18.default.join(source.dir, "Package.swift")) : 0
26250
26363
  )
26251
26364
  ]);
26252
26365
  if (entry.packages?.key !== key) {
@@ -26265,8 +26378,8 @@ function swiftPackages(entry, app) {
26265
26378
  }
26266
26379
  function xcodeInputKey(layout, file, relative3) {
26267
26380
  const owner = layout.targetDirs.get(file);
26268
- if (owner) return import_node_path17.default.posix.join(owner, relative3);
26269
- return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path17.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
26381
+ if (owner) return import_node_path18.default.posix.join(owner, relative3);
26382
+ return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path18.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
26270
26383
  }
26271
26384
  function xcodeLayout(root) {
26272
26385
  const registered = xcodeProjects.get(root);
@@ -26277,7 +26390,7 @@ function xcodeLayout(root) {
26277
26390
  const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
26278
26391
  const targets = [];
26279
26392
  for (const framework of app.frameworks) {
26280
- const dir = import_node_path17.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
26393
+ const dir = import_node_path18.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
26281
26394
  for (const file of framework.sources) {
26282
26395
  if (targetDirs.has(file)) continue;
26283
26396
  targetDirs.set(file, dir);
@@ -26295,19 +26408,19 @@ function xcodeLayout(root) {
26295
26408
  }
26296
26409
  const packages = swiftPackages(registered, app);
26297
26410
  for (const target of packages.targets) {
26298
- const relative3 = import_node_path17.default.relative(
26299
- target.remote ? import_node_path17.default.join(root, REMOTE_CHECKOUTS) : root,
26411
+ const relative3 = import_node_path18.default.relative(
26412
+ target.remote ? import_node_path18.default.join(root, REMOTE_CHECKOUTS) : root,
26300
26413
  target.dir
26301
26414
  );
26302
- if (relative3 === ".." || relative3.startsWith(`..${import_node_path17.default.sep}`) || import_node_path17.default.isAbsolute(relative3))
26415
+ if (relative3 === ".." || relative3.startsWith(`..${import_node_path18.default.sep}`) || import_node_path18.default.isAbsolute(relative3))
26303
26416
  throw new Error(`swift input escapes the selected package: ${target.dir}`);
26304
- const posix2 = relative3.split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep);
26417
+ const posix2 = relative3.split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep);
26305
26418
  targets.push({
26306
26419
  ...target,
26307
- path: target.remote ? import_node_path17.default.posix.join(XCODE_PACKAGES_DIR, posix2) : posix2,
26420
+ path: target.remote ? import_node_path18.default.posix.join(XCODE_PACKAGES_DIR, posix2) : posix2,
26308
26421
  exclude: []
26309
26422
  });
26310
- if (!target.remote) files.add(import_node_path17.default.join(target.packageDir, "Package.swift"));
26423
+ if (!target.remote) files.add(import_node_path18.default.join(target.packageDir, "Package.swift"));
26311
26424
  for (const file of target.files) files.add(file);
26312
26425
  }
26313
26426
  for (const target of targets) {
@@ -26336,25 +26449,25 @@ function xcodeManifest(layout) {
26336
26449
  ].join("\n");
26337
26450
  }
26338
26451
  function packageFiles(root) {
26339
- const canonicalRoot = import_node_fs16.default.realpathSync(root);
26452
+ const canonicalRoot = import_node_fs17.default.realpathSync(root);
26340
26453
  const xcode = xcodeLayout(canonicalRoot);
26341
26454
  return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
26342
26455
  }
26343
26456
  function sourceTreeFiles(dir, canonicalRoot) {
26344
26457
  const found = [];
26345
26458
  const walk2 = (dir2) => {
26346
- for (const entry of import_node_fs16.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
26459
+ for (const entry of import_node_fs17.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
26347
26460
  if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
26348
26461
  continue;
26349
- const full = import_node_path17.default.join(dir2, entry.name);
26462
+ const full = import_node_path18.default.join(dir2, entry.name);
26350
26463
  if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
26351
- const real = import_node_fs16.default.realpathSync(full);
26352
- const relative3 = import_node_path17.default.relative(canonicalRoot, real);
26353
- if (relative3.startsWith(`..${import_node_path17.default.sep}`) || relative3 === ".." || import_node_path17.default.isAbsolute(relative3)) {
26464
+ const real = import_node_fs17.default.realpathSync(full);
26465
+ const relative3 = import_node_path18.default.relative(canonicalRoot, real);
26466
+ if (relative3.startsWith(`..${import_node_path18.default.sep}`) || relative3 === ".." || import_node_path18.default.isAbsolute(relative3)) {
26354
26467
  throw new Error(`swift input escapes the selected package: ${full}`);
26355
26468
  }
26356
26469
  if (entry.isDirectory()) {
26357
- if (import_node_fs16.default.existsSync(import_node_path17.default.join(full, "Package.swift"))) continue;
26470
+ if (import_node_fs17.default.existsSync(import_node_path18.default.join(full, "Package.swift"))) continue;
26358
26471
  walk2(full);
26359
26472
  } else if (entry.isFile()) {
26360
26473
  found.push(full);
@@ -26362,29 +26475,29 @@ function sourceTreeFiles(dir, canonicalRoot) {
26362
26475
  }
26363
26476
  }
26364
26477
  };
26365
- if (import_node_fs16.default.existsSync(dir)) walk2(import_node_fs16.default.realpathSync(dir));
26478
+ if (import_node_fs17.default.existsSync(dir)) walk2(import_node_fs17.default.realpathSync(dir));
26366
26479
  return found;
26367
26480
  }
26368
26481
  function readPackageFile(root, file, maxBytes) {
26369
- const canonicalRoot = import_node_fs16.default.realpathSync(root);
26370
- const relative3 = import_node_path17.default.relative(canonicalRoot, import_node_fs16.default.realpathSync(file));
26371
- if (relative3 === ".." || relative3.startsWith(`..${import_node_path17.default.sep}`) || import_node_path17.default.isAbsolute(relative3)) {
26482
+ const canonicalRoot = import_node_fs17.default.realpathSync(root);
26483
+ const relative3 = import_node_path18.default.relative(canonicalRoot, import_node_fs17.default.realpathSync(file));
26484
+ if (relative3 === ".." || relative3.startsWith(`..${import_node_path18.default.sep}`) || import_node_path18.default.isAbsolute(relative3)) {
26372
26485
  throw new Error(`swift input escapes the selected package: ${file}`);
26373
26486
  }
26374
- let ancestor = import_node_path17.default.resolve(file);
26487
+ let ancestor = import_node_path18.default.resolve(file);
26375
26488
  while (ancestor !== canonicalRoot) {
26376
- if (import_node_fs16.default.lstatSync(ancestor).isSymbolicLink()) {
26489
+ if (import_node_fs17.default.lstatSync(ancestor).isSymbolicLink()) {
26377
26490
  throw new Error(`swift input is a symlink: ${ancestor}`);
26378
26491
  }
26379
- const parent = import_node_path17.default.dirname(ancestor);
26492
+ const parent = import_node_path18.default.dirname(ancestor);
26380
26493
  if (parent === ancestor)
26381
26494
  throw new Error(`swift input escapes the selected package: ${file}`);
26382
26495
  ancestor = parent;
26383
26496
  }
26384
- const expected = import_node_fs16.default.statSync(file);
26385
- const fd = import_node_fs16.default.openSync(file, import_node_fs16.default.constants.O_RDONLY | import_node_fs16.default.constants.O_NOFOLLOW);
26497
+ const expected = import_node_fs17.default.statSync(file);
26498
+ const fd = import_node_fs17.default.openSync(file, import_node_fs17.default.constants.O_RDONLY | import_node_fs17.default.constants.O_NOFOLLOW);
26386
26499
  try {
26387
- const stat2 = import_node_fs16.default.fstatSync(fd);
26500
+ const stat2 = import_node_fs17.default.fstatSync(fd);
26388
26501
  if (stat2.dev !== expected.dev || stat2.ino !== expected.ino) {
26389
26502
  throw new Error(`swift input changed while opening: ${file}`);
26390
26503
  }
@@ -26394,16 +26507,16 @@ function readPackageFile(root, file, maxBytes) {
26394
26507
  const bytes = Buffer.alloc(stat2.size + 1);
26395
26508
  let offset = 0;
26396
26509
  while (offset < bytes.length) {
26397
- const count = import_node_fs16.default.readSync(fd, bytes, offset, bytes.length - offset, null);
26510
+ const count = import_node_fs17.default.readSync(fd, bytes, offset, bytes.length - offset, null);
26398
26511
  if (count === 0) break;
26399
26512
  offset += count;
26400
26513
  }
26401
- if (offset !== stat2.size || import_node_fs16.default.fstatSync(fd).size !== stat2.size) {
26514
+ if (offset !== stat2.size || import_node_fs17.default.fstatSync(fd).size !== stat2.size) {
26402
26515
  throw new Error(`swift input changed while reading: ${file}`);
26403
26516
  }
26404
26517
  return bytes.subarray(0, offset);
26405
26518
  } finally {
26406
- import_node_fs16.default.closeSync(fd);
26519
+ import_node_fs17.default.closeSync(fd);
26407
26520
  }
26408
26521
  }
26409
26522
  function sourceFiles(root) {
@@ -26411,14 +26524,14 @@ function sourceFiles(root) {
26411
26524
  }
26412
26525
  function resourceCandidateFiles(root) {
26413
26526
  return packageFiles(root).filter(
26414
- (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path17.default.basename(file))
26527
+ (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path18.default.basename(file))
26415
26528
  );
26416
26529
  }
26417
26530
  function buildSwiftResourceTable(project, baseUrl) {
26418
26531
  const limits = inputLimits(Boolean(project.hosted));
26419
26532
  const absolute = resourceCandidateFiles(project.packagePath);
26420
26533
  const relative3 = absolute.map(
26421
- (file) => import_node_path17.default.relative(project.packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)
26534
+ (file) => import_node_path18.default.relative(project.packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)
26422
26535
  );
26423
26536
  const byRelative = new Map(absolute.map((file, index) => [relative3[index], file]));
26424
26537
  const readContents = (candidate) => {
@@ -26440,16 +26553,16 @@ function buildSwiftResourceTable(project, baseUrl) {
26440
26553
  for (const { name: name2, file, scale } of found) {
26441
26554
  const disk = byRelative.get(file);
26442
26555
  if (!disk) continue;
26443
- if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs16.default.statSync(disk).size > limits.imageTotalBytes) {
26556
+ if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs17.default.statSync(disk).size > limits.imageTotalBytes) {
26444
26557
  throw new Error("swift image pack exceeds the compile service caps");
26445
26558
  }
26446
26559
  const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
26447
26560
  imageBytes += bytes.length;
26448
- const hash = (0, import_node_crypto6.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
26449
- const ext = import_node_path17.default.posix.extname(file).toLowerCase();
26561
+ const hash = (0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
26562
+ const ext = import_node_path18.default.posix.extname(file).toLowerCase();
26450
26563
  table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
26451
26564
  images[name2] = {
26452
- file: import_node_path17.default.posix.basename(file),
26565
+ file: import_node_path18.default.posix.basename(file),
26453
26566
  data: bytes.toString("base64")
26454
26567
  };
26455
26568
  watched.push(file);
@@ -26473,10 +26586,10 @@ function buildSwiftResourceTable(project, baseUrl) {
26473
26586
  return { table, images, colors, symbols, watched };
26474
26587
  }
26475
26588
  function buildSwiftBundleFiles(packagePath, hosted) {
26476
- packagePath = import_node_fs16.default.realpathSync(packagePath);
26589
+ packagePath = import_node_fs17.default.realpathSync(packagePath);
26477
26590
  const limits = inputLimits(hosted);
26478
26591
  const relative3 = resourceCandidateFiles(packagePath).map(
26479
- (file) => import_node_path17.default.relative(packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)
26592
+ (file) => import_node_path18.default.relative(packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)
26480
26593
  );
26481
26594
  const files = {};
26482
26595
  const watched = [];
@@ -26490,13 +26603,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
26490
26603
  total += bytes.length;
26491
26604
  if (xcode.app.infoPlistFile)
26492
26605
  watched.push(
26493
- import_node_path17.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path17.default.sep).join("/")
26606
+ import_node_path18.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path18.default.sep).join("/")
26494
26607
  );
26495
26608
  }
26496
26609
  for (const { base, file } of enumerateBundleJson(relative3)) {
26497
26610
  watched.push(file);
26498
- const disk = import_node_path17.default.join(packagePath, ...file.split("/"));
26499
- if (Object.keys(files).length >= limits.resources || total + import_node_fs16.default.statSync(disk).size > limits.resourceTotalBytes) {
26611
+ const disk = import_node_path18.default.join(packagePath, ...file.split("/"));
26612
+ if (Object.keys(files).length >= limits.resources || total + import_node_fs17.default.statSync(disk).size > limits.resourceTotalBytes) {
26500
26613
  throw new Error(
26501
26614
  `swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
26502
26615
  );
@@ -26511,12 +26624,12 @@ function serveSwiftResource(project, key) {
26511
26624
  return project.resourceFiles.get(key) ?? project.resourcesPrevious.get(key) ?? null;
26512
26625
  }
26513
26626
  function linkedModuleRoots(packagePath) {
26514
- packagePath = import_node_fs16.default.realpathSync(packagePath);
26627
+ packagePath = import_node_fs17.default.realpathSync(packagePath);
26515
26628
  let manifest;
26516
26629
  try {
26517
26630
  manifest = readPackageFile(
26518
26631
  packagePath,
26519
- import_node_path17.default.join(packagePath, "Package.swift"),
26632
+ import_node_path18.default.join(packagePath, "Package.swift"),
26520
26633
  MAX_SWIFT_COMPILE_SOURCE_BYTES
26521
26634
  ).toString("utf8");
26522
26635
  } catch {
@@ -26525,28 +26638,28 @@ function linkedModuleRoots(packagePath) {
26525
26638
  const roots = /* @__PURE__ */ new Set();
26526
26639
  const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
26527
26640
  for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
26528
- const root = import_node_path17.default.resolve(packagePath, match[1]);
26529
- if (import_node_fs16.default.existsSync(import_node_path17.default.join(root, "Package.swift"))) roots.add(root);
26641
+ const root = import_node_path18.default.resolve(packagePath, match[1]);
26642
+ if (import_node_fs17.default.existsSync(import_node_path18.default.join(root, "Package.swift"))) roots.add(root);
26530
26643
  }
26531
26644
  return [...roots].sort();
26532
26645
  }
26533
26646
  function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
26534
- const hash = (0, import_node_crypto6.createHash)("sha256");
26647
+ const hash = (0, import_node_crypto7.createHash)("sha256");
26535
26648
  hash.update(packagePath);
26536
26649
  const projectInputs = new Set(packageFiles(packagePath));
26537
26650
  for (const file of [...projectInputs].sort()) {
26538
- hash.update(import_node_path17.default.relative(packagePath, file));
26539
- const stat2 = import_node_fs16.default.statSync(file);
26651
+ hash.update(import_node_path18.default.relative(packagePath, file));
26652
+ const stat2 = import_node_fs17.default.statSync(file);
26540
26653
  hash.update(`${stat2.mtimeMs}/${stat2.ctimeMs}/${stat2.size}`);
26541
26654
  }
26542
26655
  const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
26543
- (root) => import_node_fs16.default.existsSync(import_node_path17.default.join(root, "toolchain.json"))
26656
+ (root) => import_node_fs17.default.existsSync(import_node_path18.default.join(root, "toolchain.json"))
26544
26657
  );
26545
26658
  if (moduleRoot) {
26546
26659
  hash.update(moduleRoot);
26547
26660
  for (const relative3 of swiftModuleInputFiles(moduleRoot)) {
26548
26661
  hash.update(relative3);
26549
- hash.update(String(import_node_fs16.default.statSync(import_node_path17.default.join(moduleRoot, relative3)).mtimeMs));
26662
+ hash.update(String(import_node_fs17.default.statSync(import_node_path18.default.join(moduleRoot, relative3)).mtimeMs));
26550
26663
  }
26551
26664
  }
26552
26665
  return hash.digest("hex").slice(0, 16);
@@ -26558,8 +26671,8 @@ function packageSources(packagePath) {
26558
26671
  const xcode = xcodeLayout(packagePath);
26559
26672
  const files = {};
26560
26673
  for (const file of sourceFiles(packagePath)) {
26561
- const relative3 = import_node_path17.default.relative(packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep);
26562
- if (xcode && import_node_path17.default.basename(file) === "Package.swift") continue;
26674
+ const relative3 = import_node_path18.default.relative(packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep);
26675
+ if (xcode && import_node_path18.default.basename(file) === "Package.swift") continue;
26563
26676
  files[xcode ? xcodeInputKey(xcode, file, relative3) : relative3] = readPackageFile(
26564
26677
  packagePath,
26565
26678
  file,
@@ -26576,7 +26689,7 @@ function packageSnapshot(project) {
26576
26689
  files,
26577
26690
  resourcePaths: swiftImplicitResourcePaths(
26578
26691
  resourceCandidateFiles(project.packagePath).map(
26579
- (file) => import_node_path17.default.relative(project.packagePath, file).split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)
26692
+ (file) => import_node_path18.default.relative(project.packagePath, file).split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)
26580
26693
  )
26581
26694
  ),
26582
26695
  resources: buildSwiftResourceTable(project, ""),
@@ -26585,7 +26698,7 @@ function packageSnapshot(project) {
26585
26698
  ...native ? {
26586
26699
  glue: readPackageFile(
26587
26700
  project.packagePath,
26588
- import_node_path17.default.join(project.packagePath, NATIVE_GLUE),
26701
+ import_node_path18.default.join(project.packagePath, NATIVE_GLUE),
26589
26702
  MAX_SWIFT_COMPILE_SOURCE_BYTES
26590
26703
  ).toString("utf8")
26591
26704
  } : {}
@@ -26621,7 +26734,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
26621
26734
  package: content
26622
26735
  };
26623
26736
  const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
26624
- (root) => import_node_fs16.default.existsSync(import_node_path17.default.join(root, "toolchain.json"))
26737
+ (root) => import_node_fs17.default.existsSync(import_node_path18.default.join(root, "toolchain.json"))
26625
26738
  ) ?? await swiftDistributionRoot();
26626
26739
  if (!moduleRoot)
26627
26740
  return {
@@ -26640,17 +26753,17 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
26640
26753
  ...targets.length > 0 ? targets : ["App"]
26641
26754
  ])
26642
26755
  );
26643
- if (missing.size > 0) throw new Error(missingModulesMessage(packagePath, missing));
26756
+ if (missing.size > 0) throw new Error(await missingModulesMessage(packagePath, missing));
26644
26757
  const artifact = await compileSwiftProjectUnit(input, {
26645
26758
  // the compile rewrites Sources/App in its root before swiftpm builds, and
26646
26759
  // its lock orders one process only: two vites on one root (a lane's dev
26647
26760
  // server and a capture, or two checkouts) build each other's sources. so
26648
26761
  // each app and module checkout gets its own root, which keeps the same
26649
26762
  // app's incremental build across restarts.
26650
- buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path17.default.join(
26651
- import_node_os6.default.tmpdir(),
26763
+ buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path18.default.join(
26764
+ import_node_os7.default.tmpdir(),
26652
26765
  "contrast-swift-build",
26653
- (0, import_node_crypto6.createHash)("sha256").update(`${moduleRoot}\0${import_node_path17.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
26766
+ (0, import_node_crypto7.createHash)("sha256").update(`${moduleRoot}\0${import_node_path18.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
26654
26767
  ),
26655
26768
  moduleRoot,
26656
26769
  ...toolchain
@@ -26699,7 +26812,7 @@ function swiftApiGapReport(output) {
26699
26812
  ...other.size > 0 ? ["other errors, often caused by the ones above:", ...rows(other)] : []
26700
26813
  ].join("\n");
26701
26814
  }
26702
- function missingModulesMessage(packagePath, missing) {
26815
+ async function missingModulesMessage(packagePath, missing) {
26703
26816
  const layout = xcodeLayout(packagePath);
26704
26817
  const gaps = new Map([
26705
26818
  ...(layout?.app.binaryFrameworks ?? []).map(
@@ -26721,12 +26834,29 @@ function missingModulesMessage(packagePath, missing) {
26721
26834
  ...layout?.packages.modules ?? [],
26722
26835
  ...layout?.packages.unavailable ?? []
26723
26836
  ]);
26837
+ const packaged = new Set(
26838
+ [...missing.keys()].filter(
26839
+ (name2) => !UNPROVIDED_PLATFORM_MODULES[name2] && !IOS_SDK_FRAMEWORKS.has(name2)
26840
+ )
26841
+ );
26842
+ if (packaged.size > 0)
26843
+ await Promise.all(
26844
+ (layout?.packages.binaries ?? []).map(async (binary) => {
26845
+ const modules = await swiftBinaryModules(binary).catch(() => []);
26846
+ for (const name2 of modules)
26847
+ if (packaged.has(name2))
26848
+ gaps.set(name2, {
26849
+ source: binary.source,
26850
+ reason: `${binary.target} is a binary framework`
26851
+ });
26852
+ })
26853
+ );
26724
26854
  const width = Math.max(...[...missing.keys()].map((name2) => name2.length));
26725
26855
  return [
26726
26856
  `Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
26727
26857
  ...[...missing].map(([name2, files]) => {
26728
26858
  const gap = gaps.get(name2);
26729
- return ` ${name2.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path17.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
26859
+ return ` ${name2.padEnd(width)} ${files.length} file${files.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path18.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
26730
26860
  })
26731
26861
  ].join("\n");
26732
26862
  }
@@ -26734,7 +26864,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
26734
26864
  const auth = hosted ? null : resolveCliAuth();
26735
26865
  if (!hosted && (!auth || auth.kind === "github")) {
26736
26866
  throw new Error(
26737
- `compiling ${import_node_path17.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
26867
+ `compiling ${import_node_path18.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
26738
26868
  );
26739
26869
  }
26740
26870
  const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
@@ -26753,7 +26883,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
26753
26883
  const bytes = sources.reduce((total2, text2) => total2 + Buffer.byteLength(text2), 0);
26754
26884
  if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
26755
26885
  throw new Error(
26756
- `${import_node_path17.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`
26886
+ `${import_node_path18.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`
26757
26887
  );
26758
26888
  }
26759
26889
  const descriptor = snapshot.native;
@@ -26772,7 +26902,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
26772
26902
  );
26773
26903
  if (descriptor && address.native?.hash !== descriptor.hash) {
26774
26904
  throw new Error(
26775
- `${import_node_path17.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`
26905
+ `${import_node_path18.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`
26776
26906
  );
26777
26907
  }
26778
26908
  const response = await fetch(address.url, { signal });
@@ -26889,18 +27019,19 @@ function serveSwiftPackageAsset(pathname, res) {
26889
27019
  res.end("swift artifact is stale");
26890
27020
  return true;
26891
27021
  }
26892
- var import_node_crypto6, import_node_fs16, import_node_os6, import_node_path17, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, projects, xcodeProjects, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, UNPROVIDED_PLATFORM_MODULES, IOS_SDK_FRAMEWORKS;
27022
+ var import_node_crypto7, import_node_fs17, import_node_os7, import_node_path18, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, projects, xcodeProjects, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, UNPROVIDED_PLATFORM_MODULES, IOS_SDK_FRAMEWORKS;
26893
27023
  var init_swift_host = __esm({
26894
27024
  "src/swift-host.ts"() {
26895
27025
  "use strict";
26896
- import_node_crypto6 = require("node:crypto");
26897
- import_node_fs16 = __toESM(require("node:fs"), 1);
26898
- import_node_os6 = __toESM(require("node:os"), 1);
26899
- import_node_path17 = __toESM(require("node:path"), 1);
27026
+ import_node_crypto7 = require("node:crypto");
27027
+ import_node_fs17 = __toESM(require("node:fs"), 1);
27028
+ import_node_os7 = __toESM(require("node:os"), 1);
27029
+ import_node_path18 = __toESM(require("node:path"), 1);
26900
27030
  init_bundleAssets();
26901
27031
  init_auth();
26902
27032
  init_backend_origin();
26903
27033
  init_ios_sdk_frameworks();
27034
+ init_swift_binary_modules();
26904
27035
  init_swift_compile();
26905
27036
  init_swift_distribution();
26906
27037
  init_swift_package();
@@ -26925,7 +27056,7 @@ var init_swift_host = __esm({
26925
27056
  XCODE_APP_DIR = "__app__";
26926
27057
  XCODE_FRAMEWORKS_DIR = "__frameworks__";
26927
27058
  XCODE_PACKAGES_DIR = "__packages__";
26928
- CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path17.default.sep).join(import_node_path17.default.posix.sep)}/`;
27059
+ CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path18.default.sep).join(import_node_path18.default.posix.sep)}/`;
26929
27060
  HOSTED_LIMITS = {
26930
27061
  resources: MAX_SWIFT_COMPILE_RESOURCES,
26931
27062
  resourceBytes: MAX_SWIFT_COMPILE_RESOURCE_BYTES,
@@ -26977,8 +27108,8 @@ var init_swift_host = __esm({
26977
27108
 
26978
27109
  // src/expo-swift-host.ts
26979
27110
  async function collectExpoSwiftSources(appRoot) {
26980
- appRoot = import_node_fs17.default.realpathSync(appRoot);
26981
- const appRequire = (0, import_node_module.createRequire)(import_node_path18.default.join(appRoot, "package.json"));
27111
+ appRoot = import_node_fs18.default.realpathSync(appRoot);
27112
+ const appRequire = (0, import_node_module.createRequire)(import_node_path19.default.join(appRoot, "package.json"));
26982
27113
  let autolinker;
26983
27114
  try {
26984
27115
  autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
@@ -26992,7 +27123,7 @@ async function collectExpoSwiftSources(appRoot) {
26992
27123
  (command) => run3(
26993
27124
  process.execPath,
26994
27125
  [
26995
- import_node_path18.default.join(import_node_path18.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
27126
+ import_node_path19.default.join(import_node_path19.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
26996
27127
  command,
26997
27128
  "--platform",
26998
27129
  "apple",
@@ -27023,8 +27154,8 @@ async function collectExpoSwiftSources(appRoot) {
27023
27154
  const sourceRoot = Reflect.get(entry, "path");
27024
27155
  if (typeof sourceRoot !== "string")
27025
27156
  throw new Error("Expo autolinking entry has no path");
27026
- const canonical = import_node_fs17.default.realpathSync(sourceRoot);
27027
- if (canonical.split(import_node_path18.default.sep).includes("node_modules")) continue;
27157
+ const canonical = import_node_fs18.default.realpathSync(sourceRoot);
27158
+ if (canonical.split(import_node_path19.default.sep).includes("node_modules")) continue;
27028
27159
  const resolution = resolutions.find(
27029
27160
  (candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
27030
27161
  );
@@ -27050,12 +27181,12 @@ async function collectExpoSwiftSources(appRoot) {
27050
27181
  `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
27051
27182
  );
27052
27183
  }
27053
- const ios = import_node_path18.default.join(canonical, "ios");
27054
- if (import_node_fs17.default.lstatSync(ios).isSymbolicLink())
27184
+ const ios = import_node_path19.default.join(canonical, "ios");
27185
+ if (import_node_fs18.default.lstatSync(ios).isSymbolicLink())
27055
27186
  throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
27056
27187
  const walk2 = (dir) => {
27057
- for (const child of import_node_fs17.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
27058
- const file = import_node_path18.default.join(dir, child.name);
27188
+ for (const child of import_node_fs18.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
27189
+ const file = import_node_path19.default.join(dir, child.name);
27059
27190
  if (child.isSymbolicLink())
27060
27191
  throw new Error(`Expo Swift source is a symlink: ${file}`);
27061
27192
  if (child.isDirectory()) {
@@ -27063,13 +27194,13 @@ async function collectExpoSwiftSources(appRoot) {
27063
27194
  continue;
27064
27195
  }
27065
27196
  if (!child.name.endsWith(".swift")) continue;
27066
- const size = import_node_fs17.default.statSync(file).size;
27197
+ const size = import_node_fs18.default.statSync(file).size;
27067
27198
  bytes += size;
27068
27199
  fileCount++;
27069
27200
  if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
27070
27201
  throw new Error("Expo Swift sources exceed compile service caps");
27071
- files[`Sources/${namespace}/${import_node_path18.default.relative(ios, file).split(import_node_path18.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
27072
- ${import_node_fs17.default.readFileSync(file, "utf8")}`;
27202
+ files[`Sources/${namespace}/${import_node_path19.default.relative(ios, file).split(import_node_path19.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
27203
+ ${import_node_fs18.default.readFileSync(file, "utf8")}`;
27073
27204
  }
27074
27205
  };
27075
27206
  walk2(ios);
@@ -27152,7 +27283,7 @@ async function handleExpoSwiftRequest(req, res) {
27152
27283
  return true;
27153
27284
  }
27154
27285
  const root = url.searchParams.get("root");
27155
- if (!root || !import_node_path18.default.isAbsolute(root)) {
27286
+ if (!root || !import_node_path19.default.isAbsolute(root)) {
27156
27287
  res.writeHead(400);
27157
27288
  res.end("missing absolute app root");
27158
27289
  return true;
@@ -27169,7 +27300,7 @@ async function handleExpoSwiftRequest(req, res) {
27169
27300
  modules: [],
27170
27301
  failures: []
27171
27302
  };
27172
- const key = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs17.default.realpathSync(root)).digest("hex");
27303
+ const key = (0, import_node_crypto8.createHash)("sha256").update(import_node_fs18.default.realpathSync(root)).digest("hex");
27173
27304
  const host2 = req.headers.host;
27174
27305
  if (!host2) throw new Error("Expo Swift request has no host");
27175
27306
  const base = `http://${host2}`;
@@ -27183,8 +27314,8 @@ async function handleExpoSwiftRequest(req, res) {
27183
27314
  continue;
27184
27315
  }
27185
27316
  try {
27186
- const packagePath = import_node_path18.default.join(
27187
- import_node_os7.default.tmpdir(),
27317
+ const packagePath = import_node_path19.default.join(
27318
+ import_node_os8.default.tmpdir(),
27188
27319
  "peach-expo-swift",
27189
27320
  key,
27190
27321
  unit.namespace
@@ -27193,7 +27324,7 @@ async function handleExpoSwiftRequest(req, res) {
27193
27324
  packagePath,
27194
27325
  new Map(
27195
27326
  Object.entries(unit.files).map(([name2, source]) => [
27196
- import_node_path18.default.join(packagePath, name2),
27327
+ import_node_path19.default.join(packagePath, name2),
27197
27328
  source
27198
27329
  ])
27199
27330
  )
@@ -27244,8 +27375,8 @@ async function handleExpoSwiftRequest(req, res) {
27244
27375
  import PackageDescription
27245
27376
  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")])
27246
27377
  `;
27247
- const packagePath = import_node_path18.default.join(
27248
- import_node_os7.default.tmpdir(),
27378
+ const packagePath = import_node_path19.default.join(
27379
+ import_node_os8.default.tmpdir(),
27249
27380
  "peach-expo-swift",
27250
27381
  key,
27251
27382
  "linked-app"
@@ -27254,7 +27385,7 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
27254
27385
  packagePath,
27255
27386
  new Map(
27256
27387
  Object.entries(files).map(([name2, source]) => [
27257
- import_node_path18.default.join(packagePath, name2),
27388
+ import_node_path19.default.join(packagePath, name2),
27258
27389
  source
27259
27390
  ])
27260
27391
  )
@@ -27290,16 +27421,16 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
27290
27421
  }
27291
27422
  return true;
27292
27423
  }
27293
- var import_node_child_process9, import_node_crypto7, import_node_fs17, import_node_module, import_node_os7, import_node_path18, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, compiling, failedCompilations;
27424
+ var import_node_child_process9, import_node_crypto8, import_node_fs18, import_node_module, import_node_os8, import_node_path19, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, compiling, failedCompilations;
27294
27425
  var init_expo_swift_host = __esm({
27295
27426
  "src/expo-swift-host.ts"() {
27296
27427
  "use strict";
27297
27428
  import_node_child_process9 = require("node:child_process");
27298
- import_node_crypto7 = require("node:crypto");
27299
- import_node_fs17 = __toESM(require("node:fs"), 1);
27429
+ import_node_crypto8 = require("node:crypto");
27430
+ import_node_fs18 = __toESM(require("node:fs"), 1);
27300
27431
  import_node_module = require("node:module");
27301
- import_node_os7 = __toESM(require("node:os"), 1);
27302
- import_node_path18 = __toESM(require("node:path"), 1);
27432
+ import_node_os8 = __toESM(require("node:os"), 1);
27433
+ import_node_path19 = __toESM(require("node:path"), 1);
27303
27434
  import_node_util3 = require("node:util");
27304
27435
  init_internal_child();
27305
27436
  init_backend_origin();
@@ -27389,10 +27520,10 @@ function resolveRuntimeRootForHostname(hostname) {
27389
27520
  }
27390
27521
  function sendFileWithRanges(req, res, filePath, total, headers) {
27391
27522
  const head = (req?.method || "GET").toUpperCase() === "HEAD";
27392
- const range = /^bytes=(\d*)-(\d*)$/.exec(req?.headers?.range || "");
27393
- const invalid = range && range[1] && range[2] && Number(range[2]) < Number(range[1]);
27394
- if (range && (range[1] || range[2]) && !invalid) {
27395
- const [, startRaw, endRaw] = range;
27523
+ const range2 = /^bytes=(\d*)-(\d*)$/.exec(req?.headers?.range || "");
27524
+ const invalid = range2 && range2[1] && range2[2] && Number(range2[2]) < Number(range2[1]);
27525
+ if (range2 && (range2[1] || range2[2]) && !invalid) {
27526
+ const [, startRaw, endRaw] = range2;
27396
27527
  const start = startRaw ? Number(startRaw) : Math.max(0, total - Number(endRaw));
27397
27528
  const end = startRaw && endRaw ? Math.min(Number(endRaw), total - 1) : total - 1;
27398
27529
  if (start > end || start >= total) {
@@ -27483,14 +27614,14 @@ var init_standalone = __esm({
27483
27614
  // cli/self-invocation.ts
27484
27615
  function sourceEntryPath() {
27485
27616
  try {
27486
- const candidate = (0, import_node_path19.join)((0, import_node_path19.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
27487
- return (0, import_node_fs18.existsSync)(candidate) ? candidate : null;
27617
+ const candidate = (0, import_node_path20.join)((0, import_node_path20.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
27618
+ return (0, import_node_fs19.existsSync)(candidate) ? candidate : null;
27488
27619
  } catch {
27489
27620
  return null;
27490
27621
  }
27491
27622
  }
27492
- function isCliEntry(path35) {
27493
- const name2 = (0, import_node_path19.basename)(path35);
27623
+ function isCliEntry(path36) {
27624
+ const name2 = (0, import_node_path20.basename)(path36);
27494
27625
  return name2 === "bin.ts" || name2 === "bin.js";
27495
27626
  }
27496
27627
  function rnxSelfInvocation() {
@@ -27508,12 +27639,12 @@ function rnxSelfInvocation() {
27508
27639
  }
27509
27640
  return { executable: process.execPath, prefixArgs: [entry] };
27510
27641
  }
27511
- var import_node_fs18, import_node_path19, import_node_url3;
27642
+ var import_node_fs19, import_node_path20, import_node_url3;
27512
27643
  var init_self_invocation = __esm({
27513
27644
  "cli/self-invocation.ts"() {
27514
27645
  "use strict";
27515
- import_node_fs18 = require("node:fs");
27516
- import_node_path19 = require("node:path");
27646
+ import_node_fs19 = require("node:fs");
27647
+ import_node_path20 = require("node:path");
27517
27648
  import_node_url3 = require("node:url");
27518
27649
  init_public_brand();
27519
27650
  init_standalone();
@@ -27581,7 +27712,7 @@ function getUserDataDir() {
27581
27712
  return userDataDir();
27582
27713
  }
27583
27714
  function storeFile() {
27584
- return import_node_path20.default.join(userDataDir(), "attached-projects.json");
27715
+ return import_node_path21.default.join(userDataDir(), "attached-projects.json");
27585
27716
  }
27586
27717
  function cloneEmpty() {
27587
27718
  return {
@@ -27595,7 +27726,7 @@ function loadStore() {
27595
27726
  const file = storeFile();
27596
27727
  let raw2;
27597
27728
  try {
27598
- raw2 = import_node_fs19.default.readFileSync(file, "utf8");
27729
+ raw2 = import_node_fs20.default.readFileSync(file, "utf8");
27599
27730
  } catch (err) {
27600
27731
  if (err.code === "ENOENT") return cloneEmpty();
27601
27732
  throw err;
@@ -27612,7 +27743,7 @@ function loadStore() {
27612
27743
  } catch (err) {
27613
27744
  const quarantine = `${file}.corrupt-${Date.now()}`;
27614
27745
  try {
27615
- import_node_fs19.default.renameSync(file, quarantine);
27746
+ import_node_fs20.default.renameSync(file, quarantine);
27616
27747
  console.warn(
27617
27748
  `[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
27618
27749
  );
@@ -27623,16 +27754,16 @@ function loadStore() {
27623
27754
  }
27624
27755
  function writeStore(store) {
27625
27756
  const file = storeFile();
27626
- import_node_fs19.default.mkdirSync(import_node_path20.default.dirname(file), { recursive: true });
27757
+ import_node_fs20.default.mkdirSync(import_node_path21.default.dirname(file), { recursive: true });
27627
27758
  const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
27628
- const fd = import_node_fs19.default.openSync(tmp, "w", 384);
27759
+ const fd = import_node_fs20.default.openSync(tmp, "w", 384);
27629
27760
  try {
27630
- import_node_fs19.default.writeFileSync(fd, JSON.stringify(store, null, 2));
27631
- import_node_fs19.default.fsyncSync(fd);
27761
+ import_node_fs20.default.writeFileSync(fd, JSON.stringify(store, null, 2));
27762
+ import_node_fs20.default.fsyncSync(fd);
27632
27763
  } finally {
27633
- import_node_fs19.default.closeSync(fd);
27764
+ import_node_fs20.default.closeSync(fd);
27634
27765
  }
27635
- import_node_fs19.default.renameSync(tmp, file);
27766
+ import_node_fs20.default.renameSync(tmp, file);
27636
27767
  }
27637
27768
  function mutateStore(fn) {
27638
27769
  const store = loadStore();
@@ -27641,13 +27772,13 @@ function mutateStore(fn) {
27641
27772
  return store;
27642
27773
  }
27643
27774
  function projectIdForCwd(cwd) {
27644
- return (0, import_node_crypto8.createHash)("sha256").update(import_node_path20.default.resolve(cwd)).digest("hex").slice(0, 16);
27775
+ return (0, import_node_crypto9.createHash)("sha256").update(import_node_path21.default.resolve(cwd)).digest("hex").slice(0, 16);
27645
27776
  }
27646
27777
  function newSessionId() {
27647
- return `s_${(0, import_node_crypto8.randomBytes)(10).toString("hex")}`;
27778
+ return `s_${(0, import_node_crypto9.randomBytes)(10).toString("hex")}`;
27648
27779
  }
27649
27780
  function upsertProject(input) {
27650
- const cwd = import_node_path20.default.resolve(input.cwd);
27781
+ const cwd = import_node_path21.default.resolve(input.cwd);
27651
27782
  const id = projectIdForCwd(cwd);
27652
27783
  let result;
27653
27784
  mutateStore((store) => {
@@ -27673,7 +27804,7 @@ function upsertProject(input) {
27673
27804
  const now = Date.now();
27674
27805
  const created = {
27675
27806
  id,
27676
- name: input.name ?? import_node_path20.default.basename(cwd),
27807
+ name: input.name ?? import_node_path21.default.basename(cwd),
27677
27808
  cwd,
27678
27809
  repoRoot: input.repoRoot,
27679
27810
  sourceRoots: input.sourceRoots ?? [cwd],
@@ -27818,8 +27949,8 @@ async function seedFromDemoAppRegistry() {
27818
27949
  if (apps.length === 0) return;
27819
27950
  mutateStore((store) => {
27820
27951
  for (const app of apps) {
27821
- if (!import_node_fs19.default.existsSync(app.dir)) continue;
27822
- const cwd = import_node_path20.default.resolve(app.dir);
27952
+ if (!import_node_fs20.default.existsSync(app.dir)) continue;
27953
+ const cwd = import_node_path21.default.resolve(app.dir);
27823
27954
  const id = projectIdForCwd(cwd);
27824
27955
  if (store.attachedProjects.some((p) => p.id === id)) continue;
27825
27956
  const now = Date.now();
@@ -27840,13 +27971,13 @@ async function seedFromDemoAppRegistry() {
27840
27971
  }
27841
27972
  });
27842
27973
  }
27843
- var import_node_crypto8, import_node_fs19, import_node_path20, overrideDir, COST_HISTORY_MAX_AGE_MS;
27974
+ var import_node_crypto9, import_node_fs20, import_node_path21, overrideDir, COST_HISTORY_MAX_AGE_MS;
27844
27975
  var init_attached_projects = __esm({
27845
27976
  "src/attached-projects.ts"() {
27846
27977
  "use strict";
27847
- import_node_crypto8 = require("node:crypto");
27848
- import_node_fs19 = __toESM(require("node:fs"), 1);
27849
- import_node_path20 = __toESM(require("node:path"), 1);
27978
+ import_node_crypto9 = require("node:crypto");
27979
+ import_node_fs20 = __toESM(require("node:fs"), 1);
27980
+ import_node_path21 = __toESM(require("node:path"), 1);
27850
27981
  init_home_paths();
27851
27982
  overrideDir = null;
27852
27983
  COST_HISTORY_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
@@ -27855,16 +27986,16 @@ var init_attached_projects = __esm({
27855
27986
 
27856
27987
  // src/agent-sessions.ts
27857
27988
  function sessionDir(sessionId) {
27858
- return import_node_path21.default.join(getUserDataDir(), "sessions", sessionId);
27989
+ return import_node_path22.default.join(getUserDataDir(), "sessions", sessionId);
27859
27990
  }
27860
27991
  function promptFifoPath(sessionId) {
27861
- return import_node_path21.default.join(sessionDir(sessionId), "prompt.in");
27992
+ return import_node_path22.default.join(sessionDir(sessionId), "prompt.in");
27862
27993
  }
27863
27994
  function eventsFifoPath(sessionId) {
27864
- return import_node_path21.default.join(sessionDir(sessionId), "events.out");
27995
+ return import_node_path22.default.join(sessionDir(sessionId), "events.out");
27865
27996
  }
27866
27997
  function transcriptPath(sessionId) {
27867
- return import_node_path21.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
27998
+ return import_node_path22.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
27868
27999
  }
27869
28000
  function pidIsAlive(pid, sessionId) {
27870
28001
  if (!pid) return false;
@@ -27874,7 +28005,7 @@ function pidIsAlive(pid, sessionId) {
27874
28005
  return false;
27875
28006
  }
27876
28007
  if (sessionId) {
27877
- if (!import_node_fs20.default.existsSync(sessionDir(sessionId))) return false;
28008
+ if (!import_node_fs21.default.existsSync(sessionDir(sessionId))) return false;
27878
28009
  }
27879
28010
  return true;
27880
28011
  }
@@ -27887,11 +28018,11 @@ function resolveSootsimInvocation() {
27887
28018
  const resourcesPath = process.resourcesPath;
27888
28019
  if (resourcesPath) {
27889
28020
  const candidates = [
27890
- import_node_path21.default.join(resourcesPath, "bin", "sootsim"),
27891
- import_node_path21.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
28021
+ import_node_path22.default.join(resourcesPath, "bin", "sootsim"),
28022
+ import_node_path22.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
27892
28023
  ];
27893
28024
  for (const c of candidates) {
27894
- if (import_node_fs20.default.existsSync(c)) return { executable: c, prefixArgs: [] };
28025
+ if (import_node_fs21.default.existsSync(c)) return { executable: c, prefixArgs: [] };
27895
28026
  }
27896
28027
  }
27897
28028
  }
@@ -27910,15 +28041,15 @@ function tryWorkspaceSootsim() {
27910
28041
  const sootsimDir = resolveSootsimPackageDir();
27911
28042
  if (!sootsimDir) return null;
27912
28043
  const binaryName = `peach-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`;
27913
- const distBinary = import_node_path21.default.join(sootsimDir, "dist-bin", binaryName);
27914
- if (import_node_fs20.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
27915
- const distBin = import_node_path21.default.join(sootsimDir, "dist-cli", "bin.js");
27916
- if (import_node_fs20.default.existsSync(distBin)) {
28044
+ const distBinary = import_node_path22.default.join(sootsimDir, "dist-bin", binaryName);
28045
+ if (import_node_fs21.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
28046
+ const distBin = import_node_path22.default.join(sootsimDir, "dist-cli", "bin.js");
28047
+ if (import_node_fs21.default.existsSync(distBin)) {
27917
28048
  try {
27918
- const src = import_node_path21.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
27919
- if (import_node_fs20.default.existsSync(src)) {
27920
- const srcMtime = import_node_fs20.default.statSync(src).mtimeMs;
27921
- const buildMtime = import_node_fs20.default.statSync(distBin).mtimeMs;
28049
+ const src = import_node_path22.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
28050
+ if (import_node_fs21.default.existsSync(src)) {
28051
+ const srcMtime = import_node_fs21.default.statSync(src).mtimeMs;
28052
+ const buildMtime = import_node_fs21.default.statSync(distBin).mtimeMs;
27922
28053
  if (buildMtime < srcMtime) {
27923
28054
  console.warn(
27924
28055
  `[peach] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with \`bun run --cwd packages/peachsim build:cli\`.`
@@ -27937,22 +28068,22 @@ function tryWorkspaceSootsim() {
27937
28068
  function resolveSootsimPackageDir() {
27938
28069
  try {
27939
28070
  const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
27940
- return import_node_path21.default.dirname(resolved);
28071
+ return import_node_path22.default.dirname(resolved);
27941
28072
  } catch {
27942
28073
  }
27943
28074
  const here = fileFromImportMeta();
27944
28075
  if (!here) return null;
27945
- let cur = import_node_path21.default.dirname(here);
28076
+ let cur = import_node_path22.default.dirname(here);
27946
28077
  for (let i = 0; i < 8; i++) {
27947
- const pkg = import_node_path21.default.join(cur, "package.json");
28078
+ const pkg = import_node_path22.default.join(cur, "package.json");
27948
28079
  try {
27949
- if (import_node_fs20.default.existsSync(pkg)) {
27950
- const parsed = JSON.parse(import_node_fs20.default.readFileSync(pkg, "utf8"));
28080
+ if (import_node_fs21.default.existsSync(pkg)) {
28081
+ const parsed = JSON.parse(import_node_fs21.default.readFileSync(pkg, "utf8"));
27951
28082
  if (parsed.name === rnxPublicBrand.packageName) return cur;
27952
28083
  }
27953
28084
  } catch {
27954
28085
  }
27955
- const parent = import_node_path21.default.dirname(cur);
28086
+ const parent = import_node_path22.default.dirname(cur);
27956
28087
  if (parent === cur) break;
27957
28088
  cur = parent;
27958
28089
  }
@@ -27968,28 +28099,28 @@ function fileFromImportMeta() {
27968
28099
  }
27969
28100
  }
27970
28101
  async function withStartLock(projectId, provider, fn) {
27971
- const lockDir = import_node_path21.default.join(getUserDataDir(), "locks");
27972
- import_node_fs20.default.mkdirSync(lockDir, { recursive: true });
28102
+ const lockDir = import_node_path22.default.join(getUserDataDir(), "locks");
28103
+ import_node_fs21.default.mkdirSync(lockDir, { recursive: true });
27973
28104
  try {
27974
- import_node_fs20.default.chmodSync(lockDir, 448);
28105
+ import_node_fs21.default.chmodSync(lockDir, 448);
27975
28106
  } catch {
27976
28107
  }
27977
- const lockPath = import_node_path21.default.join(lockDir, `start-${projectId}-${provider}.lock`);
28108
+ const lockPath = import_node_path22.default.join(lockDir, `start-${projectId}-${provider}.lock`);
27978
28109
  const deadline = Date.now() + 4e3;
27979
28110
  let fd = null;
27980
28111
  while (fd === null) {
27981
28112
  try {
27982
- fd = import_node_fs20.default.openSync(
28113
+ fd = import_node_fs21.default.openSync(
27983
28114
  lockPath,
27984
- import_node_fs20.constants.O_WRONLY | import_node_fs20.constants.O_CREAT | import_node_fs20.constants.O_EXCL,
28115
+ import_node_fs21.constants.O_WRONLY | import_node_fs21.constants.O_CREAT | import_node_fs21.constants.O_EXCL,
27985
28116
  384
27986
28117
  );
27987
28118
  } catch (err) {
27988
28119
  if (err.code !== "EEXIST") throw err;
27989
28120
  try {
27990
- const stale = Number(import_node_fs20.default.readFileSync(lockPath, "utf8").trim());
28121
+ const stale = Number(import_node_fs21.default.readFileSync(lockPath, "utf8").trim());
27991
28122
  if (stale && !isProcessAlive(stale)) {
27992
- import_node_fs20.default.unlinkSync(lockPath);
28123
+ import_node_fs21.default.unlinkSync(lockPath);
27993
28124
  continue;
27994
28125
  }
27995
28126
  } catch {
@@ -28003,15 +28134,15 @@ async function withStartLock(projectId, provider, fn) {
28003
28134
  }
28004
28135
  }
28005
28136
  try {
28006
- import_node_fs20.default.writeFileSync(fd, String(process.pid));
28137
+ import_node_fs21.default.writeFileSync(fd, String(process.pid));
28007
28138
  return await fn();
28008
28139
  } finally {
28009
28140
  try {
28010
- import_node_fs20.default.closeSync(fd);
28141
+ import_node_fs21.default.closeSync(fd);
28011
28142
  } catch {
28012
28143
  }
28013
28144
  try {
28014
- import_node_fs20.default.unlinkSync(lockPath);
28145
+ import_node_fs21.default.unlinkSync(lockPath);
28015
28146
  } catch {
28016
28147
  }
28017
28148
  }
@@ -28025,25 +28156,25 @@ function isProcessAlive(pid) {
28025
28156
  }
28026
28157
  }
28027
28158
  function mkfifoSync(p) {
28028
- const parent = import_node_path21.default.dirname(p);
28029
- import_node_fs20.default.mkdirSync(parent, { recursive: true });
28159
+ const parent = import_node_path22.default.dirname(p);
28160
+ import_node_fs21.default.mkdirSync(parent, { recursive: true });
28030
28161
  try {
28031
- import_node_fs20.default.chmodSync(parent, 448);
28162
+ import_node_fs21.default.chmodSync(parent, 448);
28032
28163
  } catch {
28033
28164
  }
28034
- if (import_node_fs20.default.existsSync(p)) {
28165
+ if (import_node_fs21.default.existsSync(p)) {
28035
28166
  try {
28036
- const stat2 = import_node_fs20.default.statSync(p);
28167
+ const stat2 = import_node_fs21.default.statSync(p);
28037
28168
  if (stat2.isFIFO()) {
28038
28169
  try {
28039
- import_node_fs20.default.chmodSync(p, 384);
28170
+ import_node_fs21.default.chmodSync(p, 384);
28040
28171
  } catch {
28041
28172
  }
28042
28173
  return;
28043
28174
  }
28044
- import_node_fs20.default.unlinkSync(p);
28175
+ import_node_fs21.default.unlinkSync(p);
28045
28176
  } catch {
28046
- import_node_fs20.default.unlinkSync(p);
28177
+ import_node_fs21.default.unlinkSync(p);
28047
28178
  }
28048
28179
  }
28049
28180
  const result = (0, import_node_child_process10.spawnSync)("mkfifo", ["-m", "600", p]);
@@ -28069,7 +28200,7 @@ async function startSession(opts) {
28069
28200
  `session already running for project=${project.id} provider=${provider} (session ${existingLive.id}, pid ${existingLive.wrapperPid}). end it first with \`peach agent end <sessionId>\`.`
28070
28201
  );
28071
28202
  }
28072
- const claudeSessionUuid = provider === "claude" ? (0, import_node_crypto9.randomUUID)() : void 0;
28203
+ const claudeSessionUuid = provider === "claude" ? (0, import_node_crypto10.randomUUID)() : void 0;
28073
28204
  const session = upsertSession({
28074
28205
  projectId: project.id,
28075
28206
  provider,
@@ -28083,10 +28214,10 @@ async function startSession(opts) {
28083
28214
  const transcript = transcriptPath(session.id);
28084
28215
  mkfifoSync(promptIn);
28085
28216
  mkfifoSync(eventsOut);
28086
- const transcriptDir = import_node_path21.default.dirname(transcript);
28087
- import_node_fs20.default.mkdirSync(transcriptDir, { recursive: true });
28217
+ const transcriptDir = import_node_path22.default.dirname(transcript);
28218
+ import_node_fs21.default.mkdirSync(transcriptDir, { recursive: true });
28088
28219
  try {
28089
- import_node_fs20.default.chmodSync(transcriptDir, 448);
28220
+ import_node_fs21.default.chmodSync(transcriptDir, 448);
28090
28221
  } catch {
28091
28222
  }
28092
28223
  const { executable, prefixArgs } = resolveSootsimInvocation();
@@ -28137,7 +28268,7 @@ async function startSession(opts) {
28137
28268
  }
28138
28269
  }
28139
28270
  try {
28140
- import_node_fs20.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
28271
+ import_node_fs21.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
28141
28272
  } catch {
28142
28273
  }
28143
28274
  updateSessionStatus(session.id, { status: "ended" });
@@ -28165,18 +28296,18 @@ async function sendPrompt(sessionId, prompt) {
28165
28296
  );
28166
28297
  }
28167
28298
  const fifo = promptFifoPath(sessionId);
28168
- if (!import_node_fs20.default.existsSync(fifo)) {
28299
+ if (!import_node_fs21.default.existsSync(fifo)) {
28169
28300
  throw new AgentSessionError("NO_FIFO", `prompt FIFO missing: ${fifo}`);
28170
28301
  }
28171
- const fd = import_node_fs20.default.openSync(fifo, import_node_fs20.constants.O_WRONLY);
28302
+ const fd = import_node_fs21.default.openSync(fifo, import_node_fs21.constants.O_WRONLY);
28172
28303
  try {
28173
28304
  const wireText = encodeAgentPromptEnvelope(prompt);
28174
28305
  if (!wireText) {
28175
28306
  throw new AgentSessionError("EMPTY_PROMPT", "prompt text is empty");
28176
28307
  }
28177
- import_node_fs20.default.writeSync(fd, wireText + "\n");
28308
+ import_node_fs21.default.writeSync(fd, wireText + "\n");
28178
28309
  } finally {
28179
- import_node_fs20.default.closeSync(fd);
28310
+ import_node_fs21.default.closeSync(fd);
28180
28311
  }
28181
28312
  updateSessionStatus(sessionId, {
28182
28313
  lastPrompt: prompt.displayText ?? prompt.text,
@@ -28198,7 +28329,7 @@ async function endSession(sessionId) {
28198
28329
  const base = getUserDataDir();
28199
28330
  if (dir.startsWith(base)) {
28200
28331
  try {
28201
- import_node_fs20.default.rmSync(dir, { recursive: true, force: true });
28332
+ import_node_fs21.default.rmSync(dir, { recursive: true, force: true });
28202
28333
  } catch {
28203
28334
  }
28204
28335
  }
@@ -28206,11 +28337,11 @@ async function endSession(sessionId) {
28206
28337
  }
28207
28338
  function subscribeEvents(sessionId, onEvent) {
28208
28339
  const fifo = eventsFifoPath(sessionId);
28209
- if (!import_node_fs20.default.existsSync(fifo)) {
28340
+ if (!import_node_fs21.default.existsSync(fifo)) {
28210
28341
  throw new AgentSessionError("NO_FIFO", `events FIFO missing: ${fifo}`);
28211
28342
  }
28212
- const fd = import_node_fs20.default.openSync(fifo, import_node_fs20.constants.O_RDWR);
28213
- const stream = import_node_fs20.default.createReadStream("", { fd, autoClose: true });
28343
+ const fd = import_node_fs21.default.openSync(fifo, import_node_fs21.constants.O_RDWR);
28344
+ const stream = import_node_fs21.default.createReadStream("", { fd, autoClose: true });
28214
28345
  const rl = import_node_readline.default.createInterface({ input: stream, crlfDelay: Infinity });
28215
28346
  rl.on("line", (line) => {
28216
28347
  const event = parseAgentEventLine(line);
@@ -28221,7 +28352,7 @@ function subscribeEvents(sessionId, onEvent) {
28221
28352
  if (closed) return;
28222
28353
  closed = true;
28223
28354
  try {
28224
- import_node_fs20.default.writeSync(fd, "\n");
28355
+ import_node_fs21.default.writeSync(fd, "\n");
28225
28356
  } catch {
28226
28357
  }
28227
28358
  try {
@@ -28235,7 +28366,7 @@ function subscribeEvents(sessionId, onEvent) {
28235
28366
  };
28236
28367
  }
28237
28368
  async function waitForFirstEvent(fifo, predicate, timeoutMs) {
28238
- const fd = import_node_fs20.default.openSync(fifo, import_node_fs20.constants.O_RDWR | import_node_fs20.constants.O_NONBLOCK);
28369
+ const fd = import_node_fs21.default.openSync(fifo, import_node_fs21.constants.O_RDWR | import_node_fs21.constants.O_NONBLOCK);
28239
28370
  const buf = Buffer.alloc(8192);
28240
28371
  let leftover = "";
28241
28372
  const deadline = Date.now() + timeoutMs;
@@ -28243,7 +28374,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
28243
28374
  while (Date.now() < deadline) {
28244
28375
  let n = 0;
28245
28376
  try {
28246
- n = import_node_fs20.default.readSync(fd, buf, 0, buf.length, null);
28377
+ n = import_node_fs21.default.readSync(fd, buf, 0, buf.length, null);
28247
28378
  } catch (err) {
28248
28379
  if (err.code !== "EAGAIN") throw err;
28249
28380
  n = 0;
@@ -28263,17 +28394,17 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
28263
28394
  }
28264
28395
  return null;
28265
28396
  } finally {
28266
- import_node_fs20.default.closeSync(fd);
28397
+ import_node_fs21.default.closeSync(fd);
28267
28398
  }
28268
28399
  }
28269
- var import_node_child_process10, import_node_crypto9, import_node_fs20, import_node_path21, import_node_readline, AgentSessionError;
28400
+ var import_node_child_process10, import_node_crypto10, import_node_fs21, import_node_path22, import_node_readline, AgentSessionError;
28270
28401
  var init_agent_sessions = __esm({
28271
28402
  "src/agent-sessions.ts"() {
28272
28403
  "use strict";
28273
28404
  import_node_child_process10 = require("node:child_process");
28274
- import_node_crypto9 = require("node:crypto");
28275
- import_node_fs20 = __toESM(require("node:fs"), 1);
28276
- import_node_path21 = __toESM(require("node:path"), 1);
28405
+ import_node_crypto10 = require("node:crypto");
28406
+ import_node_fs21 = __toESM(require("node:fs"), 1);
28407
+ import_node_path22 = __toESM(require("node:path"), 1);
28277
28408
  import_node_readline = __toESM(require("node:readline"), 1);
28278
28409
  init_self_invocation();
28279
28410
  init_standalone();
@@ -28304,13 +28435,13 @@ function mapFrameworkToProjectFramework(fw) {
28304
28435
  if (fw === "one" || fw === "vxrn") return "one";
28305
28436
  return "unknown";
28306
28437
  }
28307
- var import_node_crypto10, import_node_fs21, import_node_path22, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
28438
+ var import_node_crypto11, import_node_fs22, import_node_path23, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
28308
28439
  var init_agent_host = __esm({
28309
28440
  "src/host/agent-host.ts"() {
28310
28441
  "use strict";
28311
- import_node_crypto10 = require("node:crypto");
28312
- import_node_fs21 = __toESM(require("node:fs"), 1);
28313
- import_node_path22 = __toESM(require("node:path"), 1);
28442
+ import_node_crypto11 = require("node:crypto");
28443
+ import_node_fs22 = __toESM(require("node:fs"), 1);
28444
+ import_node_path23 = __toESM(require("node:path"), 1);
28314
28445
  init_dev_server_scanner();
28315
28446
  init_agent_sessions();
28316
28447
  init_attached_projects();
@@ -28510,7 +28641,7 @@ var init_agent_host = __esm({
28510
28641
  throw new AgentSessionError("EMPTY_PROMPT", "inspect message cannot be empty");
28511
28642
  }
28512
28643
  const message = {
28513
- id: `inspect-${(0, import_node_crypto10.randomUUID)()}`,
28644
+ id: `inspect-${(0, import_node_crypto11.randomUUID)()}`,
28514
28645
  simId,
28515
28646
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
28516
28647
  prompt
@@ -28556,7 +28687,7 @@ var init_agent_host = __esm({
28556
28687
  );
28557
28688
  const project = upsertProject({
28558
28689
  cwd: match.cwd,
28559
- name: match.projectName ?? import_node_path22.default.basename(match.cwd),
28690
+ name: match.projectName ?? import_node_path23.default.basename(match.cwd),
28560
28691
  preferredProvider: input.provider ?? existing?.preferredProvider,
28561
28692
  sourceRoots: existing?.sourceRoots ?? [match.cwd],
28562
28693
  knownBundleUrls,
@@ -28567,18 +28698,18 @@ var init_agent_host = __esm({
28567
28698
  }
28568
28699
  getTranscript(sessionId) {
28569
28700
  const p = transcriptPath(sessionId);
28570
- if (!import_node_fs21.default.existsSync(p)) {
28701
+ if (!import_node_fs22.default.existsSync(p)) {
28571
28702
  return { error: "transcript not found", code: "NO_TRANSCRIPT" };
28572
28703
  }
28573
- return import_node_fs21.default.readFileSync(p, "utf8");
28704
+ return import_node_fs22.default.readFileSync(p, "utf8");
28574
28705
  }
28575
28706
  getPaths() {
28576
28707
  const dir = getUserDataDir();
28577
28708
  return {
28578
28709
  userDataDir: dir,
28579
- storeFile: import_node_path22.default.join(dir, "attached-projects.json"),
28580
- sessionsDir: import_node_path22.default.join(dir, "sessions"),
28581
- transcriptsDir: import_node_path22.default.join(dir, "transcripts")
28710
+ storeFile: import_node_path23.default.join(dir, "attached-projects.json"),
28711
+ sessionsDir: import_node_path23.default.join(dir, "sessions"),
28712
+ transcriptsDir: import_node_path23.default.join(dir, "transcripts")
28582
28713
  };
28583
28714
  }
28584
28715
  // --- subscription management ---
@@ -29292,7 +29423,7 @@ async function startFetchProxyTransport() {
29292
29423
  const keys = await crypto.subtle.generateKey(algorithm, true, ["sign", "verify"]);
29293
29424
  const certificate = await import_x509.X509CertificateGenerator.createSelfSigned(
29294
29425
  {
29295
- serialNumber: (0, import_node_crypto11.randomBytes)(16).toString("hex"),
29426
+ serialNumber: (0, import_node_crypto12.randomBytes)(16).toString("hex"),
29296
29427
  name: "CN=localhost",
29297
29428
  notBefore: new Date(Date.now() - 6e4),
29298
29429
  notAfter: new Date(Date.now() + 365 * 24 * 60 * 6e4),
@@ -29305,7 +29436,7 @@ async function startFetchProxyTransport() {
29305
29436
  crypto
29306
29437
  );
29307
29438
  const privateKey = Buffer.from(await crypto.subtle.exportKey("pkcs8", keys.privateKey));
29308
- const spki = (0, import_node_crypto11.createHash)("sha256").update(Buffer.from(await crypto.subtle.exportKey("spki", keys.publicKey))).digest("base64");
29439
+ const spki = (0, import_node_crypto12.createHash)("sha256").update(Buffer.from(await crypto.subtle.exportKey("spki", keys.publicKey))).digest("base64");
29309
29440
  const sessions = /* @__PURE__ */ new Set();
29310
29441
  const server = (0, import_node_http22.createSecureServer)(
29311
29442
  {
@@ -29351,11 +29482,11 @@ ${privateKey.toString("base64").match(/.{1,64}/g)?.join("\n")}
29351
29482
  }
29352
29483
  };
29353
29484
  }
29354
- var import_node_crypto11, import_node_http22, import_x509;
29485
+ var import_node_crypto12, import_node_http22, import_x509;
29355
29486
  var init_fetch_proxy_transport = __esm({
29356
29487
  "src/host/fetch-proxy-transport.ts"() {
29357
29488
  "use strict";
29358
- import_node_crypto11 = require("node:crypto");
29489
+ import_node_crypto12 = require("node:crypto");
29359
29490
  import_node_http22 = require("node:http2");
29360
29491
  import_x509 = require("@peculiar/x509");
29361
29492
  init_fetch_proxy_handler();
@@ -29572,23 +29703,23 @@ function looksBinary(filePath, size) {
29572
29703
  if (size === 0) return false;
29573
29704
  let fd;
29574
29705
  try {
29575
- fd = import_node_fs22.default.openSync(filePath, "r");
29706
+ fd = import_node_fs23.default.openSync(filePath, "r");
29576
29707
  const buffer = Buffer.alloc(Math.min(BINARY_SNIFF_BYTES, size));
29577
- const read = import_node_fs22.default.readSync(fd, buffer, 0, buffer.length, 0);
29708
+ const read = import_node_fs23.default.readSync(fd, buffer, 0, buffer.length, 0);
29578
29709
  return buffer.subarray(0, read).includes(0);
29579
29710
  } catch {
29580
29711
  return false;
29581
29712
  } finally {
29582
- if (fd !== void 0) import_node_fs22.default.closeSync(fd);
29713
+ if (fd !== void 0) import_node_fs23.default.closeSync(fd);
29583
29714
  }
29584
29715
  }
29585
- var import_node_child_process11, import_node_fs22, import_node_path23, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, LIST_FILES_ATTEMPTS, LIST_FILES_RETRY_MS, CheckoutFilePlane;
29716
+ var import_node_child_process11, import_node_fs23, import_node_path24, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, LIST_FILES_ATTEMPTS, LIST_FILES_RETRY_MS, CheckoutFilePlane;
29586
29717
  var init_checkout_plane = __esm({
29587
29718
  "cli/commands/box/checkout-plane.ts"() {
29588
29719
  "use strict";
29589
29720
  import_node_child_process11 = require("node:child_process");
29590
- import_node_fs22 = __toESM(require("node:fs"), 1);
29591
- import_node_path23 = __toESM(require("node:path"), 1);
29721
+ import_node_fs23 = __toESM(require("node:fs"), 1);
29722
+ import_node_path24 = __toESM(require("node:path"), 1);
29592
29723
  CheckoutRequiresGitError = class extends Error {
29593
29724
  };
29594
29725
  BINARY_SNIFF_BYTES = 8192;
@@ -29605,7 +29736,7 @@ var init_checkout_plane = __esm({
29605
29736
  listTimeoutMs;
29606
29737
  trackedOnly;
29607
29738
  constructor(root, options = {}) {
29608
- this.root = import_node_path23.default.resolve(root);
29739
+ this.root = import_node_path24.default.resolve(root);
29609
29740
  this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
29610
29741
  this.trackedOnly = options.trackedOnly ?? false;
29611
29742
  }
@@ -29667,13 +29798,13 @@ var init_checkout_plane = __esm({
29667
29798
  if (!relative3) continue;
29668
29799
  let stat2;
29669
29800
  try {
29670
- stat2 = import_node_fs22.default.statSync(import_node_path23.default.join(this.root, relative3));
29801
+ stat2 = import_node_fs23.default.statSync(import_node_path24.default.join(this.root, relative3));
29671
29802
  } catch {
29672
29803
  continue;
29673
29804
  }
29674
29805
  if (!stat2.isFile()) continue;
29675
29806
  const seen = this.sniffed.get(relative3);
29676
- const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path23.default.join(this.root, relative3), stat2.size);
29807
+ const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path24.default.join(this.root, relative3), stat2.size);
29677
29808
  nextSniffed.set(relative3, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary });
29678
29809
  next.set(relative3, {
29679
29810
  size: stat2.size,
@@ -29687,22 +29818,22 @@ var init_checkout_plane = __esm({
29687
29818
  this.sniffed = nextSniffed;
29688
29819
  }
29689
29820
  absolute(planePath) {
29690
- const resolved = import_node_path23.default.resolve(this.root, planePath);
29691
- if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path23.default.sep}`)) {
29821
+ const resolved = import_node_path24.default.resolve(this.root, planePath);
29822
+ if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path24.default.sep}`)) {
29692
29823
  throw new Error(`path escapes the project: ${planePath}`);
29693
29824
  }
29694
29825
  return resolved;
29695
29826
  }
29696
29827
  async read(planePath) {
29697
- return import_node_fs22.default.promises.readFile(this.absolute(planePath), "utf8");
29828
+ return import_node_fs23.default.promises.readFile(this.absolute(planePath), "utf8");
29698
29829
  }
29699
29830
  async readBytes(planePath) {
29700
- return import_node_fs22.default.promises.readFile(this.absolute(planePath));
29831
+ return import_node_fs23.default.promises.readFile(this.absolute(planePath));
29701
29832
  }
29702
29833
  async write(planePath, content) {
29703
29834
  const absolute = this.absolute(planePath);
29704
- await import_node_fs22.default.promises.mkdir(import_node_path23.default.dirname(absolute), { recursive: true });
29705
- await import_node_fs22.default.promises.writeFile(absolute, content);
29835
+ await import_node_fs23.default.promises.mkdir(import_node_path24.default.dirname(absolute), { recursive: true });
29836
+ await import_node_fs23.default.promises.writeFile(absolute, content);
29706
29837
  this.entries.set(planePath, {
29707
29838
  size: content.byteLength,
29708
29839
  readOnly: false,
@@ -29711,7 +29842,7 @@ var init_checkout_plane = __esm({
29711
29842
  });
29712
29843
  }
29713
29844
  async delete(planePath) {
29714
- await import_node_fs22.default.promises.rm(this.absolute(planePath), { force: true });
29845
+ await import_node_fs23.default.promises.rm(this.absolute(planePath), { force: true });
29715
29846
  this.entries.delete(planePath);
29716
29847
  }
29717
29848
  };
@@ -29719,12 +29850,12 @@ var init_checkout_plane = __esm({
29719
29850
  });
29720
29851
 
29721
29852
  // src/host/plane-host.ts
29722
- var import_node_fs23, import_node_path24, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
29853
+ var import_node_fs24, import_node_path25, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
29723
29854
  var init_plane_host = __esm({
29724
29855
  "src/host/plane-host.ts"() {
29725
29856
  "use strict";
29726
- import_node_fs23 = __toESM(require("node:fs"), 1);
29727
- import_node_path24 = __toESM(require("node:path"), 1);
29857
+ import_node_fs24 = __toESM(require("node:fs"), 1);
29858
+ import_node_path25 = __toESM(require("node:path"), 1);
29728
29859
  init_plane();
29729
29860
  init_checkout_plane();
29730
29861
  WS_OPEN2 = 1;
@@ -29847,14 +29978,14 @@ var init_plane_host = __esm({
29847
29978
  // root and an opened one cannot disagree about the same directory.
29848
29979
  realRoot(root) {
29849
29980
  if (!root) throw new Error("root is required");
29850
- const resolved = import_node_path24.default.resolve(root);
29981
+ const resolved = import_node_path25.default.resolve(root);
29851
29982
  let real;
29852
29983
  try {
29853
- real = import_node_fs23.default.realpathSync(resolved);
29984
+ real = import_node_fs24.default.realpathSync(resolved);
29854
29985
  } catch {
29855
29986
  throw new Error(`no such directory: ${resolved}`);
29856
29987
  }
29857
- if (!import_node_fs23.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
29988
+ if (!import_node_fs24.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
29858
29989
  return real;
29859
29990
  }
29860
29991
  respond(ws, id, result) {
@@ -30210,16 +30341,16 @@ function sendJavaScript(req, res, source) {
30210
30341
  res.end(req.method === "HEAD" ? void 0 : source);
30211
30342
  }
30212
30343
  function resolveReplacementModuleFile(fromFile, specifier) {
30213
- const base = import_node_path25.default.resolve(import_node_path25.default.dirname(fromFile), specifier);
30344
+ const base = import_node_path26.default.resolve(import_node_path26.default.dirname(fromFile), specifier);
30214
30345
  const candidates = [
30215
30346
  ...REPLACEMENT_MODULE_EXTENSIONS.some(
30216
- (ext) => ext === import_node_path25.default.extname(base).toLowerCase()
30347
+ (ext) => ext === import_node_path26.default.extname(base).toLowerCase()
30217
30348
  ) ? [base] : [],
30218
30349
  ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
30219
- ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path25.default.join(base, `index${ext}`))
30350
+ ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path26.default.join(base, `index${ext}`))
30220
30351
  ];
30221
30352
  const found = candidates.find(
30222
- (candidate) => (0, import_node_fs24.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
30353
+ (candidate) => (0, import_node_fs25.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
30223
30354
  );
30224
30355
  if (!found) {
30225
30356
  throw new Error(
@@ -30274,13 +30405,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
30274
30405
  res.end("missing path param");
30275
30406
  return true;
30276
30407
  }
30277
- const extension = import_node_path25.default.extname(targetPath).toLowerCase();
30408
+ const extension = import_node_path26.default.extname(targetPath).toLowerCase();
30278
30409
  if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
30279
30410
  res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
30280
30411
  res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
30281
30412
  return true;
30282
30413
  }
30283
- if (!import_node_path25.default.isAbsolute(targetPath)) {
30414
+ if (!import_node_path26.default.isAbsolute(targetPath)) {
30284
30415
  res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
30285
30416
  res.end("replacement file path must be absolute");
30286
30417
  return true;
@@ -30288,10 +30419,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
30288
30419
  const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
30289
30420
  let resolvedProjectRoot;
30290
30421
  if (options.projectRoot) {
30291
- const lexicalProjectRoot = import_node_path25.default.resolve(options.projectRoot);
30422
+ const lexicalProjectRoot = import_node_path26.default.resolve(options.projectRoot);
30292
30423
  resolvedProjectRoot = await import_promises5.default.realpath(options.projectRoot);
30293
- const lexicalTarget = import_node_path25.default.relative(lexicalProjectRoot, targetPath);
30294
- if (lexicalTarget.startsWith("..") || import_node_path25.default.isAbsolute(lexicalTarget)) {
30424
+ const lexicalTarget = import_node_path26.default.relative(lexicalProjectRoot, targetPath);
30425
+ if (lexicalTarget.startsWith("..") || import_node_path26.default.isAbsolute(lexicalTarget)) {
30295
30426
  res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
30296
30427
  res.end("replacement file must be inside the project root");
30297
30428
  return true;
@@ -30307,8 +30438,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
30307
30438
  return true;
30308
30439
  }
30309
30440
  if (resolvedProjectRoot) {
30310
- const relativeTarget = import_node_path25.default.relative(resolvedProjectRoot, resolvedTargetPath);
30311
- if (relativeTarget.startsWith("..") || import_node_path25.default.isAbsolute(relativeTarget)) {
30441
+ const relativeTarget = import_node_path26.default.relative(resolvedProjectRoot, resolvedTargetPath);
30442
+ if (relativeTarget.startsWith("..") || import_node_path26.default.isAbsolute(relativeTarget)) {
30312
30443
  res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
30313
30444
  res.end("replacement file must be inside the project root");
30314
30445
  return true;
@@ -30343,13 +30474,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
30343
30474
  }
30344
30475
  return true;
30345
30476
  }
30346
- var import_node_fs24, import_promises5, import_node_path25, REPLACEMENT_MODULE_ROUTE;
30477
+ var import_node_fs25, import_promises5, import_node_path26, REPLACEMENT_MODULE_ROUTE;
30347
30478
  var init_replacement_module_handler = __esm({
30348
30479
  "src/host/replacement-module-handler.ts"() {
30349
30480
  "use strict";
30350
- import_node_fs24 = require("node:fs");
30481
+ import_node_fs25 = require("node:fs");
30351
30482
  import_promises5 = __toESM(require("node:fs/promises"), 1);
30352
- import_node_path25 = __toESM(require("node:path"), 1);
30483
+ import_node_path26 = __toESM(require("node:path"), 1);
30353
30484
  init_replacementModule();
30354
30485
  init_backend_origin();
30355
30486
  REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
@@ -32325,8 +32456,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
32325
32456
  }
32326
32457
  const out = [];
32327
32458
  for (const dir of dirs) {
32328
- const path35 = `${dir}/${filename}`;
32329
- if (!out.includes(path35)) out.push(path35);
32459
+ const path36 = `${dir}/${filename}`;
32460
+ if (!out.includes(path36)) out.push(path36);
32330
32461
  }
32331
32462
  if (!out.includes(filename)) out.push(filename);
32332
32463
  return out;
@@ -33280,13 +33411,13 @@ function readFactoryStringLiterals(factory) {
33280
33411
  return literals;
33281
33412
  }
33282
33413
  function normalizeFingerprintLiteral(literal) {
33283
- const path35 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
33414
+ const path36 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
33284
33415
  const nodeModulesMarker = "/node_modules/";
33285
- const nodeModulesIndex = path35.lastIndexOf(nodeModulesMarker);
33416
+ const nodeModulesIndex = path36.lastIndexOf(nodeModulesMarker);
33286
33417
  if (nodeModulesIndex >= 0) {
33287
- return `node_modules/${path35.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
33418
+ return `node_modules/${path36.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
33288
33419
  }
33289
- if ((path35.startsWith("/") || /^[A-Za-z]:\//.test(path35) || path35.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path35)) {
33420
+ if ((path36.startsWith("/") || /^[A-Za-z]:\//.test(path36) || path36.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path36)) {
33290
33421
  return null;
33291
33422
  }
33292
33423
  return literal;
@@ -33524,10 +33655,10 @@ function templateAssignment(template, embeddings) {
33524
33655
  if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
33525
33656
  nodesByModuleId.set(moduleId, nodeIndex);
33526
33657
  const node = template.nodes[nodeIndex];
33527
- const path35 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
33658
+ const path36 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
33528
33659
  const existingPath = pathsByModuleId.get(moduleId);
33529
- if (existingPath !== void 0 && existingPath !== path35) return null;
33530
- pathsByModuleId.set(moduleId, path35);
33660
+ if (existingPath !== void 0 && existingPath !== path36) return null;
33661
+ pathsByModuleId.set(moduleId, path36);
33531
33662
  }
33532
33663
  }
33533
33664
  return {
@@ -33689,14 +33820,14 @@ async function inferMetroModuleIdentity(args) {
33689
33820
  const packageClaims = claimsByPackage.values().next().value;
33690
33821
  if (!packageClaims) continue;
33691
33822
  const exactClaims = packageClaims.filter((assignment2) => {
33692
- const path35 = assignment2.pathsByModuleId.get(moduleId);
33693
- return path35 !== void 0 && !path35.includes("/__rnx_inferred__/");
33823
+ const path36 = assignment2.pathsByModuleId.get(moduleId);
33824
+ return path36 !== void 0 && !path36.includes("/__rnx_inferred__/");
33694
33825
  });
33695
33826
  const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
33696
33827
  const routes = new Set(
33697
33828
  preferredClaims.flatMap((assignment2) => {
33698
- const path35 = assignment2.pathsByModuleId.get(moduleId);
33699
- return path35 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path35)] : [];
33829
+ const path36 = assignment2.pathsByModuleId.get(moduleId);
33830
+ return path36 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path36)] : [];
33700
33831
  })
33701
33832
  );
33702
33833
  if (routes.size !== 1) continue;
@@ -33991,8 +34122,8 @@ function detectFramework2(deps) {
33991
34122
  return "unknown";
33992
34123
  }
33993
34124
  function detectProject(dir) {
33994
- const pkgPath = (0, import_node_path26.join)(dir, "package.json");
33995
- if (!(0, import_node_fs25.existsSync)(pkgPath)) return null;
34125
+ const pkgPath = (0, import_node_path27.join)(dir, "package.json");
34126
+ if (!(0, import_node_fs26.existsSync)(pkgPath)) return null;
33996
34127
  const pkg = readProjectManifest(dir);
33997
34128
  if (!pkg) return null;
33998
34129
  const deps = { ...pkg.dependencies, ...pkg.devDependencies };
@@ -34004,25 +34135,25 @@ function detectProject(dir) {
34004
34135
  if (framework === "unknown") return null;
34005
34136
  return {
34006
34137
  dir,
34007
- name: pkg.name || (0, import_node_path26.basename)(dir),
34138
+ name: pkg.name || (0, import_node_path27.basename)(dir),
34008
34139
  framework,
34009
34140
  // a config file is a config file whatever module system it declares. real
34010
34141
  // apps write .cjs as often as .js, and missing one reads as "this project
34011
34142
  // has no bundler config" and sends the user to create a second one.
34012
34143
  hasViteConfig: CONFIG_EXTENSIONS.some(
34013
- (ext) => (0, import_node_fs25.existsSync)((0, import_node_path26.join)(dir, `vite.config.${ext}`))
34144
+ (ext) => (0, import_node_fs26.existsSync)((0, import_node_path27.join)(dir, `vite.config.${ext}`))
34014
34145
  ),
34015
34146
  hasMetroConfig: CONFIG_EXTENSIONS.some(
34016
- (ext) => (0, import_node_fs25.existsSync)((0, import_node_path26.join)(dir, `metro.config.${ext}`))
34147
+ (ext) => (0, import_node_fs26.existsSync)((0, import_node_path27.join)(dir, `metro.config.${ext}`))
34017
34148
  ),
34018
34149
  devCommand: typeof devCommand === "string" ? devCommand : null
34019
34150
  };
34020
34151
  }
34021
- function readProjectMetadata(path35) {
34152
+ function readProjectMetadata(path36) {
34022
34153
  try {
34023
- const info = (0, import_node_fs25.lstatSync)(path35);
34154
+ const info = (0, import_node_fs26.lstatSync)(path36);
34024
34155
  if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
34025
- return (0, import_node_fs25.readFileSync)(path35, "utf8");
34156
+ return (0, import_node_fs26.readFileSync)(path36, "utf8");
34026
34157
  } catch {
34027
34158
  return null;
34028
34159
  }
@@ -34031,8 +34162,8 @@ function metadataValue(value, key) {
34031
34162
  if (!value || typeof value !== "object") return void 0;
34032
34163
  return Object.getOwnPropertyDescriptor(value, key)?.value;
34033
34164
  }
34034
- function readProjectJson(path35) {
34035
- const text2 = readProjectMetadata(path35);
34165
+ function readProjectJson(path36) {
34166
+ const text2 = readProjectMetadata(path36);
34036
34167
  if (text2 === null) return null;
34037
34168
  try {
34038
34169
  const value = JSON.parse(text2);
@@ -34042,7 +34173,7 @@ function readProjectJson(path35) {
34042
34173
  }
34043
34174
  }
34044
34175
  function readProjectManifest(dir) {
34045
- const parsed = readProjectJson((0, import_node_path26.join)(dir, "package.json"));
34176
+ const parsed = readProjectJson((0, import_node_path27.join)(dir, "package.json"));
34046
34177
  if (!parsed || typeof parsed !== "object") return null;
34047
34178
  const record2 = (value) => {
34048
34179
  if (!value || typeof value !== "object") return {};
@@ -34059,12 +34190,12 @@ function readProjectManifest(dir) {
34059
34190
  devDependencies: record2(metadataValue(parsed, "devDependencies"))
34060
34191
  };
34061
34192
  }
34062
- var import_node_fs25, import_node_path26, import_json52, import_yaml, CONFIG_EXTENSIONS;
34193
+ var import_node_fs26, import_node_path27, import_json52, import_yaml, CONFIG_EXTENSIONS;
34063
34194
  var init_detect = __esm({
34064
34195
  "cli/commands/detect.ts"() {
34065
34196
  "use strict";
34066
- import_node_fs25 = require("node:fs");
34067
- import_node_path26 = require("node:path");
34197
+ import_node_fs26 = require("node:fs");
34198
+ import_node_path27 = require("node:path");
34068
34199
  import_json52 = __toESM(require("json5"), 1);
34069
34200
  import_yaml = require("yaml");
34070
34201
  CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
@@ -34101,21 +34232,21 @@ function resolveCloudOrigin(value) {
34101
34232
  return normalizeCloudOrigin(source);
34102
34233
  }
34103
34234
  function readImmutableBundleSource(bundlePath) {
34104
- const filepath = (0, import_node_path27.resolve)(bundlePath);
34105
- if ((0, import_node_path27.extname)(filepath) !== ".js") {
34235
+ const filepath = (0, import_node_path28.resolve)(bundlePath);
34236
+ if ((0, import_node_path28.extname)(filepath) !== ".js") {
34106
34237
  throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
34107
34238
  }
34108
- const descriptor = (0, import_node_fs26.openSync)(filepath, "r");
34239
+ const descriptor = (0, import_node_fs27.openSync)(filepath, "r");
34109
34240
  try {
34110
- const before = (0, import_node_fs26.fstatSync)(descriptor, { bigint: true });
34241
+ const before = (0, import_node_fs27.fstatSync)(descriptor, { bigint: true });
34111
34242
  if (!before.isFile()) {
34112
34243
  throw new Error(`${REMOTE_COMMAND} bundle must be a regular local file`);
34113
34244
  }
34114
34245
  if (before.size <= 0n) {
34115
34246
  throw new Error(`${REMOTE_COMMAND} bundle is empty`);
34116
34247
  }
34117
- const bytes = (0, import_node_fs26.readFileSync)(descriptor);
34118
- const after = (0, import_node_fs26.fstatSync)(descriptor, { bigint: true });
34248
+ const bytes = (0, import_node_fs27.readFileSync)(descriptor);
34249
+ const after = (0, import_node_fs27.fstatSync)(descriptor, { bigint: true });
34119
34250
  if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
34120
34251
  throw new Error(`${REMOTE_COMMAND} bundle changed while it was being read`);
34121
34252
  }
@@ -34130,7 +34261,7 @@ function readImmutableBundleSource(bundlePath) {
34130
34261
  }
34131
34262
  return source;
34132
34263
  } finally {
34133
- (0, import_node_fs26.closeSync)(descriptor);
34264
+ (0, import_node_fs27.closeSync)(descriptor);
34134
34265
  }
34135
34266
  }
34136
34267
  async function fetchBundleSource(bundleUrl) {
@@ -34177,15 +34308,15 @@ async function loadBundleSource(bundleInput) {
34177
34308
  return readImmutableBundleSource(bundleInput);
34178
34309
  }
34179
34310
  function listMetroAssetDest(assetsPath) {
34180
- const directory = (0, import_node_path27.resolve)(assetsPath);
34181
- if (!(0, import_node_fs26.existsSync)(directory)) return { directory, files: [], truncated: false };
34182
- const skipNested = (0, import_node_fs26.existsSync)((0, import_node_path27.join)(directory, "package.json"));
34311
+ const directory = (0, import_node_path28.resolve)(assetsPath);
34312
+ if (!(0, import_node_fs27.existsSync)(directory)) return { directory, files: [], truncated: false };
34313
+ const skipNested = (0, import_node_fs27.existsSync)((0, import_node_path28.join)(directory, "package.json"));
34183
34314
  const files = [];
34184
34315
  let truncated = false;
34185
34316
  const walk2 = (dir, prefix) => {
34186
34317
  let entries;
34187
34318
  try {
34188
- entries = (0, import_node_fs26.readdirSync)(dir, { withFileTypes: true });
34319
+ entries = (0, import_node_fs27.readdirSync)(dir, { withFileTypes: true });
34189
34320
  } catch {
34190
34321
  return;
34191
34322
  }
@@ -34197,7 +34328,7 @@ function listMetroAssetDest(assetsPath) {
34197
34328
  if (entry.isDirectory()) {
34198
34329
  if (entry.name === ".git") continue;
34199
34330
  if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
34200
- walk2((0, import_node_path27.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
34331
+ walk2((0, import_node_path28.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
34201
34332
  } else if (entry.isFile()) {
34202
34333
  files.push(prefix ? `${prefix}/${entry.name}` : entry.name);
34203
34334
  }
@@ -34207,7 +34338,7 @@ function listMetroAssetDest(assetsPath) {
34207
34338
  return { directory, files, truncated };
34208
34339
  }
34209
34340
  function metroDescriptorHash(scaleBytes) {
34210
- const hasher = (0, import_node_crypto12.createHash)("md5");
34341
+ const hasher = (0, import_node_crypto13.createHash)("md5");
34211
34342
  for (const bytes of scaleBytes) hasher.update(bytes);
34212
34343
  return hasher.digest("hex");
34213
34344
  }
@@ -34232,11 +34363,11 @@ function distinctByContent(directory, options) {
34232
34363
  for (const relative3 of options) {
34233
34364
  let bytes;
34234
34365
  try {
34235
- bytes = (0, import_node_fs26.readFileSync)((0, import_node_path27.join)(directory, relative3));
34366
+ bytes = (0, import_node_fs27.readFileSync)((0, import_node_path28.join)(directory, relative3));
34236
34367
  } catch {
34237
34368
  continue;
34238
34369
  }
34239
- const digest = (0, import_node_crypto12.createHash)("md5").update(bytes).digest("hex");
34370
+ const digest = (0, import_node_crypto13.createHash)("md5").update(bytes).digest("hex");
34240
34371
  if (!byContent.has(digest)) byContent.set(digest, relative3);
34241
34372
  }
34242
34373
  return [...byContent.values()];
@@ -34264,13 +34395,13 @@ function placeMetroDescriptor(listing, descriptor) {
34264
34395
  let bytes;
34265
34396
  try {
34266
34397
  bytes = combination.map(
34267
- (relative3) => (0, import_node_fs26.readFileSync)((0, import_node_path27.join)(listing.directory, relative3))
34398
+ (relative3) => (0, import_node_fs27.readFileSync)((0, import_node_path28.join)(listing.directory, relative3))
34268
34399
  );
34269
34400
  } catch {
34270
34401
  continue;
34271
34402
  }
34272
34403
  const identical = fileHashes ? bytes.every((file, index) => {
34273
- const digest = (0, import_node_crypto12.createHash)("md5").update(file).digest("hex");
34404
+ const digest = (0, import_node_crypto13.createHash)("md5").update(file).digest("hex");
34274
34405
  return descriptor.scales.some(
34275
34406
  (scale, declared) => scale === scales[index] && fileHashes[declared] === digest
34276
34407
  );
@@ -34292,10 +34423,10 @@ function unverifiedContentKey(dest, fileDigests) {
34292
34423
  return JSON.stringify(
34293
34424
  dest.placements.map(
34294
34425
  (placement) => placement.verified ? null : [...placement.files].map(([scale, relative3]) => {
34295
- const file = (0, import_node_path27.join)(dest.directory, relative3);
34426
+ const file = (0, import_node_path28.join)(dest.directory, relative3);
34296
34427
  let digest = fileDigests.get(file);
34297
34428
  if (digest === void 0) {
34298
- digest = (0, import_node_crypto12.createHash)("sha256").update((0, import_node_fs26.readFileSync)(file)).digest("hex");
34429
+ digest = (0, import_node_crypto13.createHash)("sha256").update((0, import_node_fs27.readFileSync)(file)).digest("hex");
34299
34430
  fileDigests.set(file, digest);
34300
34431
  }
34301
34432
  return [scale, digest];
@@ -34304,22 +34435,22 @@ function unverifiedContentKey(dest, fileDigests) {
34304
34435
  );
34305
34436
  }
34306
34437
  function searchMetroAssetDest(bundlePath, descriptors) {
34307
- const bundleDirectory = (0, import_node_path27.dirname)((0, import_node_path27.resolve)(bundlePath));
34438
+ const bundleDirectory = (0, import_node_path28.dirname)((0, import_node_path28.resolve)(bundlePath));
34308
34439
  const candidates = [
34309
- (0, import_node_path27.join)(bundleDirectory, "assets"),
34440
+ (0, import_node_path28.join)(bundleDirectory, "assets"),
34310
34441
  bundleDirectory,
34311
- (0, import_node_path27.resolve)(bundleDirectory, "..", "assets")
34442
+ (0, import_node_path28.resolve)(bundleDirectory, "..", "assets")
34312
34443
  ];
34313
34444
  const cwd = process.cwd();
34314
34445
  let projectDirectory = null;
34315
34446
  for (const start of [bundleDirectory, cwd]) {
34316
- let directory = (0, import_node_path27.resolve)(start);
34447
+ let directory = (0, import_node_path28.resolve)(start);
34317
34448
  while (true) {
34318
34449
  if (detectProject(directory)?.hasMetroConfig) {
34319
34450
  projectDirectory = directory;
34320
34451
  break;
34321
34452
  }
34322
- const parent = (0, import_node_path27.dirname)(directory);
34453
+ const parent = (0, import_node_path28.dirname)(directory);
34323
34454
  if (parent === directory) break;
34324
34455
  directory = parent;
34325
34456
  }
@@ -34327,11 +34458,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
34327
34458
  }
34328
34459
  if (projectDirectory) {
34329
34460
  candidates.push(
34330
- (0, import_node_path27.join)(projectDirectory, "assets"),
34331
- (0, import_node_path27.join)(projectDirectory, "dist"),
34332
- (0, import_node_path27.join)(projectDirectory, "dist", "assets"),
34333
- (0, import_node_path27.join)(projectDirectory, "build"),
34334
- (0, import_node_path27.join)(projectDirectory, "build", "assets")
34461
+ (0, import_node_path28.join)(projectDirectory, "assets"),
34462
+ (0, import_node_path28.join)(projectDirectory, "dist"),
34463
+ (0, import_node_path28.join)(projectDirectory, "dist", "assets"),
34464
+ (0, import_node_path28.join)(projectDirectory, "build"),
34465
+ (0, import_node_path28.join)(projectDirectory, "build", "assets")
34335
34466
  );
34336
34467
  }
34337
34468
  const searched = [];
@@ -34339,7 +34470,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
34339
34470
  const stale = [];
34340
34471
  let truncated = false;
34341
34472
  for (const candidate of candidates) {
34342
- const directory = (0, import_node_path27.resolve)(candidate);
34473
+ const directory = (0, import_node_path28.resolve)(candidate);
34343
34474
  if (searched.includes(directory)) continue;
34344
34475
  searched.push(directory);
34345
34476
  const listing = listMetroAssetDest(directory);
@@ -34448,7 +34579,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
34448
34579
  );
34449
34580
  }
34450
34581
  const relative3 = placement?.files.get(variant.scale);
34451
- if (relative3 && dest) return (0, import_node_fs26.readFileSync)((0, import_node_path27.join)(dest.directory, relative3));
34582
+ if (relative3 && dest) return (0, import_node_fs27.readFileSync)((0, import_node_path28.join)(dest.directory, relative3));
34452
34583
  if (placement && placement.files.size > 0) return null;
34453
34584
  if (placement && placement.ambiguous.length > 0 && dest) {
34454
34585
  throw new Error(
@@ -34477,7 +34608,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
34477
34608
  );
34478
34609
  const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
34479
34610
  throw new Error(
34480
- `${command} could not read ${(0, import_node_path27.join)(dest?.directory ?? ".", classic)} for ${variant.descriptor.name}.${variant.descriptor.type} at scale ${variant.scale}, and has no stand-in for a .${variant.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
34611
+ `${command} could not read ${(0, import_node_path28.join)(dest?.directory ?? ".", classic)} for ${variant.descriptor.name}.${variant.descriptor.type} at scale ${variant.scale}, and has no stand-in for a .${variant.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
34481
34612
  );
34482
34613
  });
34483
34614
  return {
@@ -34518,7 +34649,7 @@ async function produceArtifact(bundlePath, maxBytes, command, assetPolicy) {
34518
34649
  }
34519
34650
  return {
34520
34651
  bytes,
34521
- sha256: (0, import_node_crypto12.createHash)("sha256").update(bytes).digest("hex"),
34652
+ sha256: (0, import_node_crypto13.createHash)("sha256").update(bytes).digest("hex"),
34522
34653
  receipt: artifact.receipt,
34523
34654
  assetsDirectory: prepared.dest?.directory ?? null,
34524
34655
  warnings
@@ -34663,13 +34794,13 @@ function createCloudBridgeForParsed(parsed) {
34663
34794
  if (!session) return null;
34664
34795
  return session.service === "box" ? new CloudBoxBridge(session) : new CloudBridge(session);
34665
34796
  }
34666
- var import_node_crypto12, import_node_fs26, import_node_path27, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS, CloudBridge, CloudBoxBridge;
34797
+ var import_node_crypto13, import_node_fs27, import_node_path28, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS, CloudBridge, CloudBoxBridge;
34667
34798
  var init_cloud_client = __esm({
34668
34799
  "cli/cloud-client.ts"() {
34669
34800
  "use strict";
34670
- import_node_crypto12 = require("node:crypto");
34671
- import_node_fs26 = require("node:fs");
34672
- import_node_path27 = require("node:path");
34801
+ import_node_crypto13 = require("node:crypto");
34802
+ import_node_fs27 = require("node:fs");
34803
+ import_node_path28 = require("node:path");
34673
34804
  init_metroAssetArtifact();
34674
34805
  init_metroCloudArtifact();
34675
34806
  init_metro_fingerprint_registry_client();
@@ -34709,7 +34840,7 @@ var init_cloud_client = __esm({
34709
34840
  plane = "cloud";
34710
34841
  async send(command, options) {
34711
34842
  const body = {
34712
- id: (0, import_node_crypto12.randomUUID)(),
34843
+ id: (0, import_node_crypto13.randomUUID)(),
34713
34844
  claimId: this.session.claimId,
34714
34845
  command: cloudCommand(command)
34715
34846
  };
@@ -34779,7 +34910,7 @@ var init_cloud_client = __esm({
34779
34910
  }
34780
34911
  plane = "cloud";
34781
34912
  async send(command, options) {
34782
- const id = (0, import_node_crypto12.randomUUID)();
34913
+ const id = (0, import_node_crypto13.randomUUID)();
34783
34914
  const payload = {};
34784
34915
  for (const [key, value] of Object.entries(command)) {
34785
34916
  if (key !== "id" && key !== "simId") payload[key] = value;
@@ -37181,31 +37312,31 @@ var init_parent_pid = __esm({
37181
37312
 
37182
37313
  // cli/secure-file.ts
37183
37314
  function writeSecureJsonAtomic(filepath, value) {
37184
- (0, import_node_fs27.mkdirSync)((0, import_node_path28.dirname)(filepath), { recursive: true });
37185
- const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto13.randomUUID)()}`;
37315
+ (0, import_node_fs28.mkdirSync)((0, import_node_path29.dirname)(filepath), { recursive: true });
37316
+ const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto14.randomUUID)()}`;
37186
37317
  let descriptor = null;
37187
37318
  try {
37188
- descriptor = (0, import_node_fs27.openSync)(temporary, "wx", 384);
37189
- (0, import_node_fs27.fchmodSync)(descriptor, 384);
37190
- (0, import_node_fs27.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
37319
+ descriptor = (0, import_node_fs28.openSync)(temporary, "wx", 384);
37320
+ (0, import_node_fs28.fchmodSync)(descriptor, 384);
37321
+ (0, import_node_fs28.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
37191
37322
  `);
37192
- (0, import_node_fs27.fsyncSync)(descriptor);
37193
- (0, import_node_fs27.closeSync)(descriptor);
37323
+ (0, import_node_fs28.fsyncSync)(descriptor);
37324
+ (0, import_node_fs28.closeSync)(descriptor);
37194
37325
  descriptor = null;
37195
- (0, import_node_fs27.renameSync)(temporary, filepath);
37326
+ (0, import_node_fs28.renameSync)(temporary, filepath);
37196
37327
  } catch (error) {
37197
- if (descriptor !== null) (0, import_node_fs27.closeSync)(descriptor);
37198
- (0, import_node_fs27.rmSync)(temporary, { force: true });
37328
+ if (descriptor !== null) (0, import_node_fs28.closeSync)(descriptor);
37329
+ (0, import_node_fs28.rmSync)(temporary, { force: true });
37199
37330
  throw error;
37200
37331
  }
37201
37332
  }
37202
- var import_node_crypto13, import_node_fs27, import_node_path28;
37333
+ var import_node_crypto14, import_node_fs28, import_node_path29;
37203
37334
  var init_secure_file = __esm({
37204
37335
  "cli/secure-file.ts"() {
37205
37336
  "use strict";
37206
- import_node_crypto13 = require("node:crypto");
37207
- import_node_fs27 = require("node:fs");
37208
- import_node_path28 = require("node:path");
37337
+ import_node_crypto14 = require("node:crypto");
37338
+ import_node_fs28 = require("node:fs");
37339
+ import_node_path29 = require("node:path");
37209
37340
  }
37210
37341
  });
37211
37342
 
@@ -37390,17 +37521,17 @@ function liveDevBridgeLockfiles() {
37390
37521
  return readDevBridgeLockfiles().filter((lockfile) => isDevBridgeLockfileFresh(lockfile));
37391
37522
  }
37392
37523
  function checkoutRoot(cwd) {
37393
- let current = import_node_path29.default.resolve(cwd);
37524
+ let current = import_node_path30.default.resolve(cwd);
37394
37525
  while (true) {
37395
- if (import_node_fs28.default.existsSync(import_node_path29.default.join(current, ".git"))) return current;
37396
- const parent = import_node_path29.default.dirname(current);
37526
+ if (import_node_fs29.default.existsSync(import_node_path30.default.join(current, ".git"))) return current;
37527
+ const parent = import_node_path30.default.dirname(current);
37397
37528
  if (parent === current) return null;
37398
37529
  current = parent;
37399
37530
  }
37400
37531
  }
37401
37532
  function pathContains(parent, child) {
37402
- const relative3 = import_node_path29.default.relative(parent, child);
37403
- return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path29.default.sep}`) && !import_node_path29.default.isAbsolute(relative3);
37533
+ const relative3 = import_node_path30.default.relative(parent, child);
37534
+ return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path30.default.sep}`) && !import_node_path30.default.isAbsolute(relative3);
37404
37535
  }
37405
37536
  function resolveDefaultDevBridgeLockfile() {
37406
37537
  const lockfiles = liveDevBridgeLockfiles();
@@ -37900,18 +38031,18 @@ async function evalInBridge(bridge, code, opts = {}) {
37900
38031
  if (opts.acquireLock) payload.acquireLock = true;
37901
38032
  return bridge.send(payload);
37902
38033
  }
37903
- async function callInBridge(bridge, path35, ...args) {
37904
- return bridge.send({ type: "call", path: path35, args });
38034
+ async function callInBridge(bridge, path36, ...args) {
38035
+ return bridge.send({ type: "call", path: path36, args });
37905
38036
  }
37906
- async function callInBridgeWrite(bridge, path35, ...args) {
37907
- return bridge.send({ type: "call", path: path35, args, acquireLock: true });
38037
+ async function callInBridgeWrite(bridge, path36, ...args) {
38038
+ return bridge.send({ type: "call", path: path36, args, acquireLock: true });
37908
38039
  }
37909
- var import_node_fs28, import_node_path29, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
38040
+ var import_node_fs29, import_node_path30, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
37910
38041
  var init_ws_bridge = __esm({
37911
38042
  "cli/ws-bridge.ts"() {
37912
38043
  "use strict";
37913
- import_node_fs28 = __toESM(require("node:fs"), 1);
37914
- import_node_path29 = __toESM(require("node:path"), 1);
38044
+ import_node_fs29 = __toESM(require("node:fs"), 1);
38045
+ import_node_path30 = __toESM(require("node:path"), 1);
37915
38046
  import_ws2 = require("ws");
37916
38047
  init_bridge_constants();
37917
38048
  init_cli_constants();
@@ -38039,8 +38170,8 @@ function getDefaultPortForProtocol(protocol) {
38039
38170
  return protocol === "https:" ? 443 : 80;
38040
38171
  }
38041
38172
  function isBaseServerUrl(url) {
38042
- const path35 = url.pathname || "/";
38043
- return (path35 === "/" || path35 === "") && !url.search && !url.hash;
38173
+ const path36 = url.pathname || "/";
38174
+ return (path36 === "/" || path36 === "") && !url.search && !url.hash;
38044
38175
  }
38045
38176
  async function resolvePortViaServerScan(port) {
38046
38177
  try {
@@ -38204,8 +38335,8 @@ var init_dev_bundle_resolution = __esm({
38204
38335
 
38205
38336
  // src/dot-env.ts
38206
38337
  function selectEnvFile(env, notices) {
38207
- if (import_node_fs29.default.existsSync("/tmp/envfile")) {
38208
- return { name: import_node_fs29.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
38338
+ if (import_node_fs30.default.existsSync("/tmp/envfile")) {
38339
+ return { name: import_node_fs30.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
38209
38340
  }
38210
38341
  const requested = env.ENVFILE;
38211
38342
  if (!requested) return { name: DEFAULT_ENV_FILE, fromEnvfile: false };
@@ -38268,16 +38399,16 @@ function readProjectDotEnv(envsRoot, env = process.env) {
38268
38399
  const notices = [];
38269
38400
  const selection = selectEnvFile(env, notices);
38270
38401
  const requestedPaths = [
38271
- import_node_path30.default.resolve(import_node_path30.default.join(envsRoot, selection.name)),
38272
- import_node_path30.default.resolve(selection.name)
38402
+ import_node_path31.default.resolve(import_node_path31.default.join(envsRoot, selection.name)),
38403
+ import_node_path31.default.resolve(selection.name)
38273
38404
  ];
38274
38405
  const candidates = [
38275
38406
  ...requestedPaths,
38276
- import_node_path30.default.resolve(import_node_path30.default.join(envsRoot, DEFAULT_ENV_FILE))
38407
+ import_node_path31.default.resolve(import_node_path31.default.join(envsRoot, DEFAULT_ENV_FILE))
38277
38408
  ];
38278
- if (!import_node_fs29.default.existsSync(candidates[2])) candidates.push(import_node_path30.default.resolve(DEFAULT_ENV_FILE));
38409
+ if (!import_node_fs30.default.existsSync(candidates[2])) candidates.push(import_node_path31.default.resolve(DEFAULT_ENV_FILE));
38279
38410
  const tried = [...new Set(candidates)];
38280
- const resolved = tried.find((candidate) => import_node_fs29.default.existsSync(candidate));
38411
+ const resolved = tried.find((candidate) => import_node_fs30.default.existsSync(candidate));
38281
38412
  if (!resolved) {
38282
38413
  notices.push(
38283
38414
  "*** Missing .env file ****",
@@ -38297,7 +38428,7 @@ function readProjectDotEnv(envsRoot, env = process.env) {
38297
38428
  );
38298
38429
  }
38299
38430
  const config = {};
38300
- for (const line of import_node_fs29.default.readFileSync(resolved, "utf8").split("\n")) {
38431
+ for (const line of import_node_fs30.default.readFileSync(resolved, "utf8").split("\n")) {
38301
38432
  if (!line.trim()) continue;
38302
38433
  if (/^[ \t\n\v\f\r]*#/.test(line)) continue;
38303
38434
  const match = DOTENV_PATTERN.exec(line);
@@ -38307,12 +38438,12 @@ function readProjectDotEnv(envsRoot, env = process.env) {
38307
38438
  }
38308
38439
  return { config, notices };
38309
38440
  }
38310
- var import_node_fs29, import_node_path30, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
38441
+ var import_node_fs30, import_node_path31, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
38311
38442
  var init_dot_env = __esm({
38312
38443
  "src/dot-env.ts"() {
38313
38444
  "use strict";
38314
- import_node_fs29 = __toESM(require("node:fs"), 1);
38315
- import_node_path30 = __toESM(require("node:path"), 1);
38445
+ import_node_fs30 = __toESM(require("node:fs"), 1);
38446
+ import_node_path31 = __toESM(require("node:path"), 1);
38316
38447
  DEFAULT_ENV_FILE = ".env";
38317
38448
  DOTENV_PATTERN = /^(?:export[ \t\n\v\f\r]+|)(?<key>[\p{Alphabetic}\p{Nd}_]+)[ \t\n\v\f\r]*=[ \t\n\v\f\r]*((?<quote>["'])?(?<val>[^\n]*?[^\\\n])\k<quote>?|)$/u;
38318
38449
  BUILD_SETTING_PATTERN = /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]|\$([A-Za-z_][A-Za-z0-9_]*)/g;
@@ -38336,8 +38467,8 @@ var init_flow_timeout_scale = __esm({
38336
38467
  function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
38337
38468
  const result = {};
38338
38469
  let config = {};
38339
- const appJsonPath = import_node_path31.default.join(projectRoot, "app.json");
38340
- const appJson = import_node_fs30.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs30.default.readFileSync(appJsonPath, "utf8")) : null;
38470
+ const appJsonPath = import_node_path32.default.join(projectRoot, "app.json");
38471
+ const appJson = import_node_fs31.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs31.default.readFileSync(appJsonPath, "utf8")) : null;
38341
38472
  const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
38342
38473
  (value) => isRecord(value) && typeof value.googleServicesFile === "string"
38343
38474
  ));
@@ -38346,9 +38477,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
38346
38477
  "app.config.ts",
38347
38478
  "app.config.cjs",
38348
38479
  "app.config.mjs"
38349
- ].some((name2) => import_node_fs30.default.existsSync(import_node_path31.default.join(projectRoot, name2)));
38480
+ ].some((name2) => import_node_fs31.default.existsSync(import_node_path32.default.join(projectRoot, name2)));
38350
38481
  if (staticExpo || dynamicExpo) {
38351
- const require5 = (0, import_node_module2.createRequire)(import_node_path31.default.join(projectRoot, "package.json"));
38482
+ const require5 = (0, import_node_module2.createRequire)(import_node_path32.default.join(projectRoot, "package.json"));
38352
38483
  const configModule = require5("@expo/config");
38353
38484
  if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
38354
38485
  throw new Error("Expo native configuration is unavailable.");
@@ -38360,23 +38491,23 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
38360
38491
  }
38361
38492
  const ios = config.ios;
38362
38493
  if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
38363
- const iosRoot = import_node_path31.default.join(projectRoot, "ios");
38364
- if (import_node_fs30.default.existsSync(iosRoot)) {
38365
- const projects2 = import_node_fs30.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
38494
+ const iosRoot = import_node_path32.default.join(projectRoot, "ios");
38495
+ if (import_node_fs31.default.existsSync(iosRoot)) {
38496
+ const projects2 = import_node_fs31.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
38366
38497
  if (projects2.length > 1)
38367
38498
  throw new Error("native Firebase configuration requires a selected Xcode project");
38368
38499
  if (projects2.length === 1) {
38369
- const xcodeproj = import_node_path31.default.join(iosRoot, projects2[0].name);
38500
+ const xcodeproj = import_node_path32.default.join(iosRoot, projects2[0].name);
38370
38501
  const appTargets = listXcodeAppTargets(xcodeproj);
38371
38502
  if (appTargets.length > 1)
38372
38503
  throw new Error("native Firebase configuration requires a selected app target");
38373
38504
  if (appTargets.length === 1) {
38374
38505
  const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
38375
38506
  const delegates = app.allSources.filter(
38376
- (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path31.default.basename(file))
38507
+ (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path32.default.basename(file))
38377
38508
  );
38378
38509
  const defaultConfigured = delegates.some((file) => {
38379
- const source = import_node_fs30.default.readFileSync(file, "utf8").replace(
38510
+ const source = import_node_fs31.default.readFileSync(file, "utf8").replace(
38380
38511
  /\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
38381
38512
  (token) => token.startsWith('"') ? '""' : token.replace(/[^\n]/g, " ")
38382
38513
  );
@@ -38404,15 +38535,15 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
38404
38535
  });
38405
38536
  if (defaultConfigured) {
38406
38537
  const resources = app.resources.filter(
38407
- (file) => /^GoogleService-Info\.plist$/.test(import_node_path31.default.basename(file))
38538
+ (file) => /^GoogleService-Info\.plist$/.test(import_node_path32.default.basename(file))
38408
38539
  );
38409
38540
  if (resources.length !== 1)
38410
38541
  throw new Error(
38411
38542
  "native Firebase default initialization requires one GoogleService-Info.plist build resource"
38412
38543
  );
38413
38544
  config.ios = {
38414
- googleServicesFile: import_node_path31.default.relative(
38415
- import_node_fs30.default.realpathSync(projectRoot),
38545
+ googleServicesFile: import_node_path32.default.relative(
38546
+ import_node_fs31.default.realpathSync(projectRoot),
38416
38547
  resources[0]
38417
38548
  )
38418
38549
  };
@@ -38425,8 +38556,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
38425
38556
  const native = config[platform];
38426
38557
  if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
38427
38558
  try {
38428
- const source = import_node_fs30.default.readFileSync(
38429
- import_node_path31.default.resolve(projectRoot, native.googleServicesFile),
38559
+ const source = import_node_fs31.default.readFileSync(
38560
+ import_node_path32.default.resolve(projectRoot, native.googleServicesFile),
38430
38561
  "utf8"
38431
38562
  );
38432
38563
  const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
@@ -38478,13 +38609,13 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
38478
38609
  }
38479
38610
  return result;
38480
38611
  }
38481
- var import_node_fs30, import_node_module2, import_node_path31;
38612
+ var import_node_fs31, import_node_module2, import_node_path32;
38482
38613
  var init_native_firebase_config = __esm({
38483
38614
  "src/native-firebase-config.ts"() {
38484
38615
  "use strict";
38485
- import_node_fs30 = __toESM(require("node:fs"), 1);
38616
+ import_node_fs31 = __toESM(require("node:fs"), 1);
38486
38617
  import_node_module2 = require("node:module");
38487
- import_node_path31 = __toESM(require("node:path"), 1);
38618
+ import_node_path32 = __toESM(require("node:path"), 1);
38488
38619
  init_is_record();
38489
38620
  init_plist();
38490
38621
  init_xcode_project();
@@ -38598,59 +38729,59 @@ var init_profiles = __esm({
38598
38729
  // cli/app-catalog.ts
38599
38730
  function listDir(dir) {
38600
38731
  try {
38601
- return import_node_fs31.default.readdirSync(dir, { withFileTypes: true });
38732
+ return import_node_fs32.default.readdirSync(dir, { withFileTypes: true });
38602
38733
  } catch {
38603
38734
  return [];
38604
38735
  }
38605
38736
  }
38606
38737
  function readText(file) {
38607
38738
  try {
38608
- return import_node_fs31.default.readFileSync(file, "utf8");
38739
+ return import_node_fs32.default.readFileSync(file, "utf8");
38609
38740
  } catch {
38610
38741
  return null;
38611
38742
  }
38612
38743
  }
38613
38744
  function catalogFiles(dir, found) {
38614
38745
  for (const entry of listDir(dir)) {
38615
- const full = import_node_path32.default.join(dir, entry.name);
38746
+ const full = import_node_path33.default.join(dir, entry.name);
38616
38747
  if (entry.isDirectory()) catalogFiles(full, found);
38617
38748
  else if (entry.name === "Contents.json") found.push(full);
38618
38749
  }
38619
38750
  }
38620
38751
  function discoverAppCatalog(appDir) {
38621
- const iosDir = import_node_path32.default.join(appDir, "ios");
38752
+ const iosDir = import_node_path33.default.join(appDir, "ios");
38622
38753
  const target = listDir(iosDir).find(
38623
- (entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path32.default.join(iosDir, entry.name)).some(
38754
+ (entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path33.default.join(iosDir, entry.name)).some(
38624
38755
  (file) => /^AppDelegate\.(swift|mm|m)$/.test(file.name)
38625
38756
  )
38626
38757
  );
38627
38758
  if (!target) return null;
38628
- const targetDir = import_node_path32.default.join(iosDir, target.name);
38759
+ const targetDir = import_node_path33.default.join(iosDir, target.name);
38629
38760
  const files = [];
38630
38761
  for (const entry of listDir(targetDir)) {
38631
38762
  if (entry.isDirectory() && entry.name.endsWith(".xcassets"))
38632
- catalogFiles(import_node_path32.default.join(targetDir, entry.name), files);
38763
+ catalogFiles(import_node_path33.default.join(targetDir, entry.name), files);
38633
38764
  }
38634
38765
  const relative3 = files.map(
38635
- (file) => import_node_path32.default.relative(targetDir, file).split(import_node_path32.default.sep).join(import_node_path32.default.posix.sep)
38766
+ (file) => import_node_path33.default.relative(targetDir, file).split(import_node_path33.default.sep).join(import_node_path33.default.posix.sep)
38636
38767
  );
38637
38768
  const colors = enumerateBundleColors(
38638
38769
  relative3,
38639
- (candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path32.default.join(targetDir, candidate)) : null
38770
+ (candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path33.default.join(targetDir, candidate)) : null
38640
38771
  );
38641
38772
  const pbxproj = listDir(iosDir).find((entry) => entry.name.endsWith(".xcodeproj"));
38642
- const accentName = readText(import_node_path32.default.join(targetDir, "Info.plist"))?.match(PLIST_ACCENT)?.[1] ?? (pbxproj ? readText(import_node_path32.default.join(iosDir, pbxproj.name, "project.pbxproj"))?.match(
38773
+ const accentName = readText(import_node_path33.default.join(targetDir, "Info.plist"))?.match(PLIST_ACCENT)?.[1] ?? (pbxproj ? readText(import_node_path33.default.join(iosDir, pbxproj.name, "project.pbxproj"))?.match(
38643
38774
  ACCENT_BUILD_SETTING
38644
38775
  )?.[1] : void 0) ?? null;
38645
38776
  if (accentName === null && Object.keys(colors).length === 0) return null;
38646
38777
  return { colors, accentName };
38647
38778
  }
38648
- var import_node_fs31, import_node_path32, ACCENT_BUILD_SETTING, PLIST_ACCENT;
38779
+ var import_node_fs32, import_node_path33, ACCENT_BUILD_SETTING, PLIST_ACCENT;
38649
38780
  var init_app_catalog = __esm({
38650
38781
  "cli/app-catalog.ts"() {
38651
38782
  "use strict";
38652
- import_node_fs31 = __toESM(require("node:fs"), 1);
38653
- import_node_path32 = __toESM(require("node:path"), 1);
38783
+ import_node_fs32 = __toESM(require("node:fs"), 1);
38784
+ import_node_path33 = __toESM(require("node:path"), 1);
38654
38785
  init_bundleAssets();
38655
38786
  ACCENT_BUILD_SETTING = /ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "?([^";]+)"?;/;
38656
38787
  PLIST_ACCENT = /<key>NSAccentColorName<\/key>\s*<string>([^<]+)<\/string>/;
@@ -38660,9 +38791,9 @@ var init_app_catalog = __esm({
38660
38791
  // cli/app-project.ts
38661
38792
  function firstNamedFile(dir, names) {
38662
38793
  for (const name2 of names) {
38663
- const candidate = import_node_path33.default.join(dir, name2);
38794
+ const candidate = import_node_path34.default.join(dir, name2);
38664
38795
  try {
38665
- if (import_node_fs32.default.statSync(candidate).isFile()) return candidate;
38796
+ if (import_node_fs33.default.statSync(candidate).isFile()) return candidate;
38666
38797
  } catch {
38667
38798
  }
38668
38799
  }
@@ -38675,24 +38806,24 @@ function findRNXAppConfig(dir) {
38675
38806
  return firstNamedFile(dir, PEACH_APP_CONFIG_NAMES);
38676
38807
  }
38677
38808
  function resolveAppProject(projectRoot) {
38678
- const appDir = import_node_path33.default.resolve(projectRoot);
38809
+ const appDir = import_node_path34.default.resolve(projectRoot);
38679
38810
  try {
38680
- if (!import_node_fs32.default.statSync(appDir).isDirectory()) return null;
38811
+ if (!import_node_fs33.default.statSync(appDir).isDirectory()) return null;
38681
38812
  } catch {
38682
38813
  return null;
38683
38814
  }
38684
38815
  const configPath = findRNXAppConfig(appDir);
38685
- if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs32.default.existsSync(import_node_path33.default.join(appDir, "package.json"))) {
38816
+ if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs33.default.existsSync(import_node_path34.default.join(appDir, "package.json"))) {
38686
38817
  return null;
38687
38818
  }
38688
38819
  return { appDir, configPath };
38689
38820
  }
38690
- var import_node_fs32, import_node_path33, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
38821
+ var import_node_fs33, import_node_path34, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
38691
38822
  var init_app_project = __esm({
38692
38823
  "cli/app-project.ts"() {
38693
38824
  "use strict";
38694
- import_node_fs32 = __toESM(require("node:fs"), 1);
38695
- import_node_path33 = __toESM(require("node:path"), 1);
38825
+ import_node_fs33 = __toESM(require("node:fs"), 1);
38826
+ import_node_path34 = __toESM(require("node:path"), 1);
38696
38827
  EXPO_APP_CONFIG_NAMES = [
38697
38828
  "app.config.js",
38698
38829
  "app.config.ts",
@@ -38715,12 +38846,12 @@ function resolveFileEntries(entries, configDir) {
38715
38846
  return Object.fromEntries(
38716
38847
  Object.entries(entries).map(([name2, resolution]) => [
38717
38848
  name2,
38718
- resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path34.default.resolve(configDir, resolution.file) } : resolution
38849
+ resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path35.default.resolve(configDir, resolution.file) } : resolution
38719
38850
  ])
38720
38851
  );
38721
38852
  }
38722
38853
  function resolveConfigReplacementFiles(config, configPath) {
38723
- const configDir = import_node_path34.default.dirname(configPath);
38854
+ const configDir = import_node_path35.default.dirname(configPath);
38724
38855
  return {
38725
38856
  ...config,
38726
38857
  modules: resolveFileEntries(config.modules, configDir),
@@ -38757,12 +38888,12 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
38757
38888
  const project = resolveAppProject(startDir);
38758
38889
  return { project, config: await loadRNXAppConfig(project) };
38759
38890
  }
38760
- var import_node_module3, import_node_path34, import_jiti, require2;
38891
+ var import_node_module3, import_node_path35, import_jiti, require2;
38761
38892
  var init_app_config = __esm({
38762
38893
  "cli/app-config.ts"() {
38763
38894
  "use strict";
38764
38895
  import_node_module3 = require("node:module");
38765
- import_node_path34 = __toESM(require("node:path"), 1);
38896
+ import_node_path35 = __toESM(require("node:path"), 1);
38766
38897
  import_jiti = require("jiti");
38767
38898
  init_config();
38768
38899
  init_public_brand();
@@ -38819,13 +38950,13 @@ function discoverNativeLinkedAppFonts(opts) {
38819
38950
  scannedFontDirectories++;
38820
38951
  let entries;
38821
38952
  try {
38822
- entries = import_node_fs33.default.readdirSync(current.dir, { withFileTypes: true });
38953
+ entries = import_node_fs34.default.readdirSync(current.dir, { withFileTypes: true });
38823
38954
  } catch {
38824
38955
  continue;
38825
38956
  }
38826
38957
  for (const entry of entries) {
38827
38958
  if (entry.isSymbolicLink()) continue;
38828
- const fullPath = import_node_path35.default.join(current.dir, entry.name);
38959
+ const fullPath = import_node_path36.default.join(current.dir, entry.name);
38829
38960
  if (entry.isDirectory()) {
38830
38961
  if (current.depth < 4 && pending.length < 64 && !entry.name.startsWith(".")) {
38831
38962
  pending.push({ dir: fullPath, depth: current.depth + 1 });
@@ -38833,15 +38964,15 @@ function discoverNativeLinkedAppFonts(opts) {
38833
38964
  continue;
38834
38965
  }
38835
38966
  if (!entry.isFile() || !/\.(ttf|otf|woff|woff2)$/i.test(entry.name)) continue;
38836
- const relative3 = import_node_path35.default.relative(root, fullPath).split(import_node_path35.default.sep).join("/");
38837
- fontPaths.push(import_node_path35.default.posix.join(metroPathPrefix, relative3));
38967
+ const relative3 = import_node_path36.default.relative(root, fullPath).split(import_node_path36.default.sep).join("/");
38968
+ fontPaths.push(import_node_path36.default.posix.join(metroPathPrefix, relative3));
38838
38969
  if (fontPaths.length >= 256) break;
38839
38970
  }
38840
38971
  }
38841
38972
  };
38842
38973
  try {
38843
38974
  const packageJson = JSON.parse(
38844
- import_node_fs33.default.readFileSync(import_node_path35.default.join(selectedAppDir, "package.json"), "utf8")
38975
+ import_node_fs34.default.readFileSync(import_node_path36.default.join(selectedAppDir, "package.json"), "utf8")
38845
38976
  );
38846
38977
  const dependencyNames = /* @__PURE__ */ new Set();
38847
38978
  for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
@@ -38856,32 +38987,32 @@ function discoverNativeLinkedAppFonts(opts) {
38856
38987
  const config = Reflect.get(packageJson, "reactNativeVectorIcons");
38857
38988
  const configuredFontDir = config && typeof config === "object" ? Reflect.get(config, "fontDir") : null;
38858
38989
  const configuredDir = typeof configuredFontDir === "string" ? configuredFontDir : "rnvi-fonts";
38859
- const root = import_node_path35.default.resolve(selectedAppDir, configuredDir);
38860
- const relativeRoot = import_node_path35.default.relative(selectedAppDir, root);
38861
- if (!relativeRoot.startsWith("..") && !import_node_path35.default.isAbsolute(relativeRoot)) {
38862
- collectFontFiles(root, relativeRoot.split(import_node_path35.default.sep).join("/"));
38990
+ const root = import_node_path36.default.resolve(selectedAppDir, configuredDir);
38991
+ const relativeRoot = import_node_path36.default.relative(selectedAppDir, root);
38992
+ if (!relativeRoot.startsWith("..") && !import_node_path36.default.isAbsolute(relativeRoot)) {
38993
+ collectFontFiles(root, relativeRoot.split(import_node_path36.default.sep).join("/"));
38863
38994
  }
38864
- const bundleDir = import_node_path35.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
38865
- const appRelativeDir = bundleDir.split("/").join(import_node_path35.default.sep);
38995
+ const bundleDir = import_node_path36.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
38996
+ const appRelativeDir = bundleDir.split("/").join(import_node_path36.default.sep);
38866
38997
  const metroRootCandidates = [selectedAppDir];
38867
- if (bundleDir && selectedAppDir.endsWith(import_node_path35.default.sep + appRelativeDir)) {
38998
+ if (bundleDir && selectedAppDir.endsWith(import_node_path36.default.sep + appRelativeDir)) {
38868
38999
  metroRootCandidates.push(selectedAppDir.slice(0, -appRelativeDir.length - 1));
38869
39000
  }
38870
- const vectorIconRequire = (0, import_node_module4.createRequire)(import_node_path35.default.join(selectedAppDir, "package.json"));
39001
+ const vectorIconRequire = (0, import_node_module4.createRequire)(import_node_path36.default.join(selectedAppDir, "package.json"));
38871
39002
  for (const dependencyName of vectorIconDependencies) {
38872
39003
  try {
38873
39004
  const entryPath = vectorIconRequire.resolve(dependencyName);
38874
- const dependencyPath = dependencyName.split("/").join(import_node_path35.default.sep);
38875
- const marker = `${import_node_path35.default.sep}node_modules${import_node_path35.default.sep}${dependencyPath}${import_node_path35.default.sep}`;
39005
+ const dependencyPath = dependencyName.split("/").join(import_node_path36.default.sep);
39006
+ const marker = `${import_node_path36.default.sep}node_modules${import_node_path36.default.sep}${dependencyPath}${import_node_path36.default.sep}`;
38876
39007
  const markerIndex = entryPath.lastIndexOf(marker);
38877
39008
  if (markerIndex === -1) continue;
38878
39009
  const packageRoot = entryPath.slice(0, markerIndex + marker.length - 1);
38879
39010
  const fontsDir = dependencyName === "react-native-vector-icons" ? "Fonts" : "fonts";
38880
- const fontsRoot = import_node_path35.default.join(packageRoot, fontsDir);
39011
+ const fontsRoot = import_node_path36.default.join(packageRoot, fontsDir);
38881
39012
  for (const metroRoot of metroRootCandidates) {
38882
39013
  collectFontFiles(
38883
39014
  fontsRoot,
38884
- import_node_path35.default.relative(metroRoot, fontsRoot).split(import_node_path35.default.sep).join("/")
39015
+ import_node_path36.default.relative(metroRoot, fontsRoot).split(import_node_path36.default.sep).join("/")
38885
39016
  );
38886
39017
  }
38887
39018
  } catch {
@@ -38891,37 +39022,37 @@ function discoverNativeLinkedAppFonts(opts) {
38891
39022
  } catch {
38892
39023
  }
38893
39024
  try {
38894
- const configPath = import_node_path35.default.join(selectedAppDir, "react-native.config.js");
38895
- if (import_node_fs33.default.statSync(configPath).isFile()) {
38896
- const appConfigRequire = (0, import_node_module4.createRequire)(import_node_path35.default.join(selectedAppDir, "package.json"));
39025
+ const configPath = import_node_path36.default.join(selectedAppDir, "react-native.config.js");
39026
+ if (import_node_fs34.default.statSync(configPath).isFile()) {
39027
+ const appConfigRequire = (0, import_node_module4.createRequire)(import_node_path36.default.join(selectedAppDir, "package.json"));
38897
39028
  const rnConfig = appConfigRequire(configPath);
38898
39029
  const assets2 = rnConfig && typeof rnConfig === "object" ? Reflect.get(rnConfig, "assets") : null;
38899
39030
  if (Array.isArray(assets2)) {
38900
39031
  for (const assetDir of assets2) {
38901
39032
  if (typeof assetDir !== "string") continue;
38902
- const root = import_node_path35.default.resolve(selectedAppDir, assetDir);
38903
- const relativeRoot = import_node_path35.default.relative(selectedAppDir, root);
38904
- if (relativeRoot.startsWith("..") || import_node_path35.default.isAbsolute(relativeRoot)) continue;
38905
- collectFontFiles(root, relativeRoot.split(import_node_path35.default.sep).join("/"));
39033
+ const root = import_node_path36.default.resolve(selectedAppDir, assetDir);
39034
+ const relativeRoot = import_node_path36.default.relative(selectedAppDir, root);
39035
+ if (relativeRoot.startsWith("..") || import_node_path36.default.isAbsolute(relativeRoot)) continue;
39036
+ collectFontFiles(root, relativeRoot.split(import_node_path36.default.sep).join("/"));
38906
39037
  }
38907
39038
  }
38908
39039
  }
38909
39040
  } catch {
38910
39041
  }
38911
39042
  if (platform === "ios") {
38912
- const iosDir = import_node_path35.default.join(selectedAppDir, "ios");
39043
+ const iosDir = import_node_path36.default.join(selectedAppDir, "ios");
38913
39044
  try {
38914
- const targetDirs = import_node_fs33.default.readdirSync(iosDir, { withFileTypes: true }).filter(
39045
+ const targetDirs = import_node_fs34.default.readdirSync(iosDir, { withFileTypes: true }).filter(
38915
39046
  (entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
38916
39047
  ).slice(0, 64);
38917
- const plistPaths = [import_node_path35.default.join(iosDir, "Info.plist")];
39048
+ const plistPaths = [import_node_path36.default.join(iosDir, "Info.plist")];
38918
39049
  for (const entry of targetDirs) {
38919
- plistPaths.push(import_node_path35.default.join(iosDir, entry.name, "Info.plist"));
39050
+ plistPaths.push(import_node_path36.default.join(iosDir, entry.name, "Info.plist"));
38920
39051
  }
38921
39052
  for (const plistPath of plistPaths) {
38922
39053
  let parsed;
38923
39054
  try {
38924
- parsed = parsePlistSource(import_node_fs33.default.readFileSync(plistPath, "utf8"));
39055
+ parsed = parsePlistSource(import_node_fs34.default.readFileSync(plistPath, "utf8"));
38925
39056
  } catch {
38926
39057
  continue;
38927
39058
  }
@@ -38931,21 +39062,21 @@ function discoverNativeLinkedAppFonts(opts) {
38931
39062
  for (const declaredFont of declaredFonts) {
38932
39063
  if (typeof declaredFont !== "string") continue;
38933
39064
  const candidates = [
38934
- import_node_path35.default.resolve(import_node_path35.default.dirname(plistPath), declaredFont),
38935
- import_node_path35.default.resolve(iosDir, declaredFont)
39065
+ import_node_path36.default.resolve(import_node_path36.default.dirname(plistPath), declaredFont),
39066
+ import_node_path36.default.resolve(iosDir, declaredFont)
38936
39067
  ];
38937
39068
  const fontPath = candidates.find((candidate) => {
38938
- const relative3 = import_node_path35.default.relative(selectedAppDir, candidate);
38939
- if (relative3.startsWith("..") || import_node_path35.default.isAbsolute(relative3)) return false;
39069
+ const relative3 = import_node_path36.default.relative(selectedAppDir, candidate);
39070
+ if (relative3.startsWith("..") || import_node_path36.default.isAbsolute(relative3)) return false;
38940
39071
  try {
38941
- return import_node_fs33.default.statSync(candidate).isFile();
39072
+ return import_node_fs34.default.statSync(candidate).isFile();
38942
39073
  } catch {
38943
39074
  return false;
38944
39075
  }
38945
39076
  });
38946
39077
  if (!fontPath) continue;
38947
39078
  fontPaths.push(
38948
- import_node_path35.default.relative(selectedAppDir, fontPath).split(import_node_path35.default.sep).join("/")
39079
+ import_node_path36.default.relative(selectedAppDir, fontPath).split(import_node_path36.default.sep).join("/")
38949
39080
  );
38950
39081
  }
38951
39082
  }
@@ -38987,13 +39118,13 @@ async function resolveMetroProjectRoot(bundleUrl, opts) {
38987
39118
  function encodeAppFontsWire(specs) {
38988
39119
  return specs.map((spec) => `${encodeURIComponent(spec.url)}::${encodeURIComponent(spec.family)}`).join(",");
38989
39120
  }
38990
- var import_node_fs33, import_node_module4, import_node_path35, import_config_plugin_fonts, require3;
39121
+ var import_node_fs34, import_node_module4, import_node_path36, import_config_plugin_fonts, require3;
38991
39122
  var init_app_fonts = __esm({
38992
39123
  "cli/app-fonts.ts"() {
38993
39124
  "use strict";
38994
- import_node_fs33 = __toESM(require("node:fs"), 1);
39125
+ import_node_fs34 = __toESM(require("node:fs"), 1);
38995
39126
  import_node_module4 = require("node:module");
38996
- import_node_path35 = __toESM(require("node:path"), 1);
39127
+ import_node_path36 = __toESM(require("node:path"), 1);
38997
39128
  import_config_plugin_fonts = require("peach-engine/engine/config-plugin-fonts");
38998
39129
  init_dev_server_scanner();
38999
39130
  init_backend_origin();
@@ -39925,7 +40056,7 @@ var init_bridge_diagnostics = __esm({
39925
40056
  function bundleValue(app, key) {
39926
40057
  const read = (0, import_node_child_process12.spawnSync)(
39927
40058
  "plutil",
39928
- ["-extract", key, "raw", "-o", "-", import_node_path36.default.join(app, "Contents/Info.plist")],
40059
+ ["-extract", key, "raw", "-o", "-", import_node_path37.default.join(app, "Contents/Info.plist")],
39929
40060
  { encoding: "utf8" }
39930
40061
  );
39931
40062
  return read.status === 0 ? read.stdout.trim() : null;
@@ -39939,12 +40070,12 @@ function placedHostVersion() {
39939
40070
  function activeDesktopHostApp() {
39940
40071
  return placedHostVersion() ? MAC_HOST_APP : null;
39941
40072
  }
39942
- var import_node_child_process12, import_node_path36, MAC_HOST_APP, HOST_BUNDLE_ID;
40073
+ var import_node_child_process12, import_node_path37, MAC_HOST_APP, HOST_BUNDLE_ID;
39943
40074
  var init_desktop_host_delivery = __esm({
39944
40075
  "src/desktop-host-delivery.ts"() {
39945
40076
  "use strict";
39946
40077
  import_node_child_process12 = require("node:child_process");
39947
- import_node_path36 = __toESM(require("node:path"), 1);
40078
+ import_node_path37 = __toESM(require("node:path"), 1);
39948
40079
  init_src();
39949
40080
  init_home_paths();
39950
40081
  MAC_HOST_APP = "/Applications/Peach.app";
@@ -41491,8 +41622,8 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
41491
41622
  };
41492
41623
  }
41493
41624
  const lock = parseLinuxBrowserLibsLock(linux_browser_libs_lock_default);
41494
- const dir = (0, import_node_path37.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
41495
- if (!(0, import_node_fs34.existsSync)((0, import_node_path37.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
41625
+ const dir = (0, import_node_path38.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
41626
+ if (!(0, import_node_fs35.existsSync)((0, import_node_path38.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
41496
41627
  const url = `${DEFAULT_CLI_RELEASE_ORIGIN}/${linuxBrowserLibsKey(lock.id, arch)}`;
41497
41628
  process.stderr.write(
41498
41629
  `peach: this system lacks ${missing.length} shared libraries ${browser} links; downloading them\u2026
@@ -41520,7 +41651,7 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
41520
41651
  };
41521
41652
  }
41522
41653
  }
41523
- const libraryPath = [(0, import_node_path37.join)(dir, "lib"), (0, import_node_path37.join)(dir, "lib", "nss")].join(":");
41654
+ const libraryPath = [(0, import_node_path38.join)(dir, "lib"), (0, import_node_path38.join)(dir, "lib", "nss")].join(":");
41524
41655
  const stillMissing = missingLibraries(executablePath, libraryPath);
41525
41656
  if (stillMissing.length) {
41526
41657
  return {
@@ -41530,13 +41661,13 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
41530
41661
  }
41531
41662
  return { ok: true, libraryPath };
41532
41663
  }
41533
- var import_node_child_process13, import_node_fs34, import_node_path37, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
41664
+ var import_node_child_process13, import_node_fs35, import_node_path38, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
41534
41665
  var init_linux_browser_libs = __esm({
41535
41666
  "cli/drivers/linux-browser-libs.ts"() {
41536
41667
  "use strict";
41537
41668
  import_node_child_process13 = require("node:child_process");
41538
- import_node_fs34 = require("node:fs");
41539
- import_node_path37 = require("node:path");
41669
+ import_node_fs35 = require("node:fs");
41670
+ import_node_path38 = require("node:path");
41540
41671
  init_src();
41541
41672
  init_home_paths();
41542
41673
  init_is_record();
@@ -41560,13 +41691,13 @@ function resolvePlaywright() {
41560
41691
  try {
41561
41692
  const modulePath = requireFromRoot.resolve(spec);
41562
41693
  const packageJsonPath = requireFromRoot.resolve(`${spec}/package.json`);
41563
- const parsed = JSON.parse((0, import_node_fs35.readFileSync)(packageJsonPath, "utf8"));
41694
+ const parsed = JSON.parse((0, import_node_fs36.readFileSync)(packageJsonPath, "utf8"));
41564
41695
  if (!isRecord(parsed) || typeof parsed.version !== "string") continue;
41565
41696
  const corePackagePath = (0, import_node_module6.createRequire)(modulePath).resolve(
41566
41697
  "playwright-core/package.json"
41567
41698
  );
41568
- const cliPath = (0, import_node_path38.join)((0, import_node_path38.dirname)(corePackagePath), "cli.js");
41569
- if (!(0, import_node_fs35.existsSync)(cliPath)) continue;
41699
+ const cliPath = (0, import_node_path39.join)((0, import_node_path39.dirname)(corePackagePath), "cli.js");
41700
+ if (!(0, import_node_fs36.existsSync)(cliPath)) continue;
41570
41701
  return {
41571
41702
  spec,
41572
41703
  modulePath,
@@ -41594,7 +41725,7 @@ async function provisionPlaywright() {
41594
41725
  await installVerifiedTarball({
41595
41726
  url: `https://registry.npmjs.org/playwright-core/-/playwright-core-${version}.tgz`,
41596
41727
  digest: { algorithm, encoding: "base64", value: digest },
41597
- destDir: (0, import_node_path38.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
41728
+ destDir: (0, import_node_path39.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
41598
41729
  installedMarker: "package.json",
41599
41730
  // npm tarballs hold the package under a leading `package/`
41600
41731
  stripComponents: 1,
@@ -41637,7 +41768,7 @@ function probeBrowser(resolved, env) {
41637
41768
  return {
41638
41769
  ok: true,
41639
41770
  executablePath: parsed.executablePath,
41640
- exists: parsed.exists && (0, import_node_fs35.existsSync)(parsed.executablePath)
41771
+ exists: parsed.exists && (0, import_node_fs36.existsSync)(parsed.executablePath)
41641
41772
  };
41642
41773
  } catch (error) {
41643
41774
  return {
@@ -41705,14 +41836,14 @@ ${detail}` : ""}`
41705
41836
  libraryPath: libraries.libraryPath
41706
41837
  };
41707
41838
  }
41708
- var import_node_child_process14, import_node_fs35, import_node_module6, import_node_path38;
41839
+ var import_node_child_process14, import_node_fs36, import_node_module6, import_node_path39;
41709
41840
  var init_playwright_provisioning = __esm({
41710
41841
  "cli/drivers/playwright-provisioning.ts"() {
41711
41842
  "use strict";
41712
41843
  import_node_child_process14 = require("node:child_process");
41713
- import_node_fs35 = require("node:fs");
41844
+ import_node_fs36 = require("node:fs");
41714
41845
  import_node_module6 = require("node:module");
41715
- import_node_path38 = require("node:path");
41846
+ import_node_path39 = require("node:path");
41716
41847
  init_src();
41717
41848
  init_home_paths();
41718
41849
  init_is_record();
@@ -42099,7 +42230,7 @@ var init_parse_args = __esm({
42099
42230
  // cli/telemetry.ts
42100
42231
  function sanitizeDiagnosticMessage(value) {
42101
42232
  const firstLine = value.slice(0, 2048).split(/[\r\n\u2028\u2029]/, 1)[0] ?? "";
42102
- return firstLine.split((0, import_node_os8.homedir)()).join("<home>").replace(
42233
+ return firstLine.split((0, import_node_os9.homedir)()).join("<home>").replace(
42103
42234
  /<package:(?:@[\w.-]+\/)?[\w.-]+>|(?:https?:\/\/|file:\/\/|[A-Za-z]:[\\/]|<home>[\\/]|\/|\.{1,2}[\\/]|\b[\w.-]+[\\/])(?:[^\s"'<>]|\s(?=[^"'<>]*[\\/]))+/g,
42104
42235
  (location2) => {
42105
42236
  if (location2.startsWith("<package:")) return location2;
@@ -42126,11 +42257,11 @@ function trackCliDiagnostic(diagnostic) {
42126
42257
  if (queue.some((queued) => JSON.stringify(queued) === JSON.stringify(entry))) return;
42127
42258
  queue.push(entry);
42128
42259
  }
42129
- var import_node_os8, import_crash_fingerprint, observedRuntimeVersion, queue, CRASH_REPORT_EVERY_MS;
42260
+ var import_node_os9, import_crash_fingerprint, observedRuntimeVersion, queue, CRASH_REPORT_EVERY_MS;
42130
42261
  var init_telemetry = __esm({
42131
42262
  "cli/telemetry.ts"() {
42132
42263
  "use strict";
42133
- import_node_os8 = require("node:os");
42264
+ import_node_os9 = require("node:os");
42134
42265
  import_crash_fingerprint = require("peach-engine/crash-fingerprint");
42135
42266
  init_cli_version();
42136
42267
  init_home_paths();
@@ -42196,12 +42327,12 @@ var init_runtime_diagnostics = __esm({
42196
42327
  // cli/commands/skills.ts
42197
42328
  function getSkillsDir() {
42198
42329
  if (typeof __PEACH_BUNDLED_SKILLS__ !== "undefined") {
42199
- const dir = path31.join(rnxHomeDir(), "skills", getCliVersion());
42330
+ const dir = path32.join(rnxHomeDir(), "skills", getCliVersion());
42200
42331
  for (const [file, body] of Object.entries(__PEACH_BUNDLED_SKILLS__)) {
42201
- const target = path31.join(dir, file);
42202
- if (fs26.existsSync(target)) continue;
42203
- fs26.mkdirSync(path31.dirname(target), { recursive: true });
42204
- fs26.writeFileSync(target, body);
42332
+ const target = path32.join(dir, file);
42333
+ if (fs27.existsSync(target)) continue;
42334
+ fs27.mkdirSync(path32.dirname(target), { recursive: true });
42335
+ fs27.writeFileSync(target, body);
42205
42336
  }
42206
42337
  return dir;
42207
42338
  }
@@ -42209,10 +42340,10 @@ function getSkillsDir() {
42209
42340
  const pkgPath = (0, import_url3.fileURLToPath)(
42210
42341
  import_meta4.resolve(`${rnxPublicBrand.packageName}/package.json`)
42211
42342
  );
42212
- return primaryCheckoutPath(path31.join(path31.dirname(pkgPath), "skills"));
42343
+ return primaryCheckoutPath(path32.join(path32.dirname(pkgPath), "skills"));
42213
42344
  } catch {
42214
- const __dirname = path31.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
42215
- return primaryCheckoutPath(path31.resolve(__dirname, "../../skills"));
42345
+ const __dirname = path32.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
42346
+ return primaryCheckoutPath(path32.resolve(__dirname, "../../skills"));
42216
42347
  }
42217
42348
  }
42218
42349
  function primaryCheckoutPath(dir) {
@@ -42235,17 +42366,17 @@ function primaryCheckoutPath(dir) {
42235
42366
  } catch {
42236
42367
  return dir;
42237
42368
  }
42238
- if (path31.basename(common) !== ".git") return dir;
42239
- const primary = path31.join(path31.dirname(common), path31.relative(top, dir));
42240
- return fs26.existsSync(primary) ? primary : dir;
42369
+ if (path32.basename(common) !== ".git") return dir;
42370
+ const primary = path32.join(path32.dirname(common), path32.relative(top, dir));
42371
+ return fs27.existsSync(primary) ? primary : dir;
42241
42372
  }
42242
42373
  function skillsDir() {
42243
42374
  skillsDirPath ??= getSkillsDir();
42244
42375
  return skillsDirPath;
42245
42376
  }
42246
42377
  function targetFromHome(envName, fallbackDir) {
42247
- const home = process.env[envName] || path31.join(os7.homedir(), fallbackDir);
42248
- return path31.join(home, "skills");
42378
+ const home = process.env[envName] || path32.join(os8.homedir(), fallbackDir);
42379
+ return path32.join(home, "skills");
42249
42380
  }
42250
42381
  function defaultAgentTargets() {
42251
42382
  return [
@@ -42258,7 +42389,7 @@ function hasInstalledPeachSkills() {
42258
42389
  (file) => /^([^/]+)\/SKILL\.md$/.exec(file)?.[1] ?? []
42259
42390
  ) : listSkills().map((skill7) => skill7.name);
42260
42391
  return defaultAgentTargets().some(
42261
- ({ dir }) => names.some((name2) => fs26.existsSync(path31.join(dir, name2, "SKILL.md")))
42392
+ ({ dir }) => names.some((name2) => fs27.existsSync(path32.join(dir, name2, "SKILL.md")))
42262
42393
  );
42263
42394
  }
42264
42395
  function parseSkillFrontmatter(content) {
@@ -42301,26 +42432,26 @@ function readFrontmatterField(frontmatter, field) {
42301
42432
  return null;
42302
42433
  }
42303
42434
  function listSkills() {
42304
- if (!fs26.existsSync(skillsDir())) return [];
42435
+ if (!fs27.existsSync(skillsDir())) return [];
42305
42436
  const skills = [];
42306
- for (const entry of fs26.readdirSync(skillsDir())) {
42307
- const skillMd = path31.join(skillsDir(), entry, "SKILL.md");
42308
- if (!fs26.existsSync(skillMd)) continue;
42309
- const meta = parseSkillFrontmatter(fs26.readFileSync(skillMd, "utf8"));
42437
+ for (const entry of fs27.readdirSync(skillsDir())) {
42438
+ const skillMd = path32.join(skillsDir(), entry, "SKILL.md");
42439
+ if (!fs27.existsSync(skillMd)) continue;
42440
+ const meta = parseSkillFrontmatter(fs27.readFileSync(skillMd, "utf8"));
42310
42441
  if (meta) {
42311
42442
  skills.push({ name: entry, description: meta.description });
42312
42443
  }
42313
42444
  }
42314
42445
  return skills.sort((a, b) => a.name.localeCompare(b.name));
42315
42446
  }
42316
- var import_child_process7, fs26, os7, path31, import_url3, import_meta4, skillsDirPath;
42447
+ var import_child_process7, fs27, os8, path32, import_url3, import_meta4, skillsDirPath;
42317
42448
  var init_skills = __esm({
42318
42449
  "cli/commands/skills.ts"() {
42319
42450
  "use strict";
42320
42451
  import_child_process7 = require("child_process");
42321
- fs26 = __toESM(require("fs"), 1);
42322
- os7 = __toESM(require("os"), 1);
42323
- path31 = __toESM(require("path"), 1);
42452
+ fs27 = __toESM(require("fs"), 1);
42453
+ os8 = __toESM(require("os"), 1);
42454
+ path32 = __toESM(require("path"), 1);
42324
42455
  import_url3 = require("url");
42325
42456
  init_cli_version();
42326
42457
  init_home_paths();
@@ -42807,7 +42938,7 @@ function assertExplicitBridgeLock(preferredPort, explicitPort, lock) {
42807
42938
  async function ensureRuntimeForOpen() {
42808
42939
  if (resolveDevCheckoutRuntimeRoot()) return;
42809
42940
  const active = readActiveRuntime();
42810
- if (active && import_node_fs36.default.existsSync(runtimeDir(active))) return;
42941
+ if (active && import_node_fs37.default.existsSync(runtimeDir(active))) return;
42811
42942
  console.error(" installing peach engine runtime...");
42812
42943
  const { runRuntime: runRuntime2 } = await Promise.resolve().then(() => (init_runtime(), runtime_exports));
42813
42944
  await runRuntime2(["install"], {});
@@ -42961,10 +43092,10 @@ async function buildResolvedBundleOpenUrl(target, baseUrl, opts = {}) {
42961
43092
  }
42962
43093
  function normalizeReplacementPath(filePath) {
42963
43094
  if (filePath.startsWith("~/")) {
42964
- return import_node_path39.default.join(import_node_os9.default.homedir(), filePath.slice(2));
43095
+ return import_node_path40.default.join(import_node_os10.default.homedir(), filePath.slice(2));
42965
43096
  }
42966
- if (import_node_path39.default.isAbsolute(filePath)) return filePath;
42967
- return import_node_path39.default.resolve(process.cwd(), filePath);
43097
+ if (import_node_path40.default.isAbsolute(filePath)) return filePath;
43098
+ return import_node_path40.default.resolve(process.cwd(), filePath);
42968
43099
  }
42969
43100
  function parseOpenRuntimeConfig(args) {
42970
43101
  const modules = {};
@@ -42983,7 +43114,7 @@ function parseOpenRuntimeConfig(args) {
42983
43114
  }
42984
43115
  const moduleName = raw2.slice(0, eqIndex).trim();
42985
43116
  const filePath = normalizeReplacementPath(raw2.slice(eqIndex + 1).trim());
42986
- if (!import_node_fs36.default.existsSync(filePath)) {
43117
+ if (!import_node_fs37.default.existsSync(filePath)) {
42987
43118
  console.error(` peach open: replacement file not found: ${filePath}`);
42988
43119
  rnxExit(1);
42989
43120
  }
@@ -43014,7 +43145,7 @@ async function resolveAppProjectForBundleUrl(bundleUrl) {
43014
43145
  return advertisedRoot ? resolveAppProject(advertisedRoot) : null;
43015
43146
  }
43016
43147
  async function ensureConfiguredRuntime(version) {
43017
- if (import_node_fs36.default.existsSync(import_node_path39.default.join(runtimeDir(version), "index.html"))) return;
43148
+ if (import_node_fs37.default.existsSync(import_node_path40.default.join(runtimeDir(version), "index.html"))) return;
43018
43149
  console.error(` installing configured engine runtime ${version}...`);
43019
43150
  const result = await rnxRuntime.install({
43020
43151
  version,
@@ -43350,7 +43481,7 @@ function playwrightHostPidForSim(sim) {
43350
43481
  function signalDriverLaunchConnected(result) {
43351
43482
  if (!result.connectAckFile) return false;
43352
43483
  try {
43353
- import_node_fs36.default.writeFileSync(
43484
+ import_node_fs37.default.writeFileSync(
43354
43485
  result.connectAckFile,
43355
43486
  `${JSON.stringify({ connectedAt: Date.now(), pid: result.pid ?? null })}
43356
43487
  `,
@@ -43364,7 +43495,7 @@ function signalDriverLaunchConnected(result) {
43364
43495
  function readUnservedUrl(result) {
43365
43496
  if (!result.diagnosticLogPath) return null;
43366
43497
  try {
43367
- const detail = import_node_fs36.default.readFileSync(result.diagnosticLogPath, "utf8");
43498
+ const detail = import_node_fs37.default.readFileSync(result.diagnosticLogPath, "utf8");
43368
43499
  const match = detail.match(/\[unserved\] nothing serves (\S+)/);
43369
43500
  return match ? match[1] : null;
43370
43501
  } catch {
@@ -43374,19 +43505,19 @@ function readUnservedUrl(result) {
43374
43505
  function printDriverDiagnosticLogTail(result) {
43375
43506
  if (!result.diagnosticLogPath) return;
43376
43507
  try {
43377
- const detail = import_node_fs36.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
43508
+ const detail = import_node_fs37.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
43378
43509
  if (!detail) {
43379
- console.error(` ${import_node_path39.default.basename(result.diagnosticLogPath)} was empty`);
43510
+ console.error(` ${import_node_path40.default.basename(result.diagnosticLogPath)} was empty`);
43380
43511
  return;
43381
43512
  }
43382
43513
  const shown = detail.length > 4e3 ? `\u2026
43383
43514
  ${detail.slice(-4e3)}` : detail;
43384
- console.error(` ${import_node_path39.default.basename(result.diagnosticLogPath)}:`);
43515
+ console.error(` ${import_node_path40.default.basename(result.diagnosticLogPath)}:`);
43385
43516
  console.error(shown);
43386
43517
  } catch (err) {
43387
43518
  const message = err instanceof Error ? err.message : String(err);
43388
43519
  console.error(
43389
- ` failed to read ${import_node_path39.default.basename(result.diagnosticLogPath)}: ${message}`
43520
+ ` failed to read ${import_node_path40.default.basename(result.diagnosticLogPath)}: ${message}`
43390
43521
  );
43391
43522
  }
43392
43523
  }
@@ -44385,14 +44516,14 @@ async function runCloseCommand(args, opts = {}) {
44385
44516
  bridge.close();
44386
44517
  }
44387
44518
  }
44388
- var import_node_child_process15, import_node_fs36, import_node_os9, import_node_path39, import_app_catalog_wire, import_devices2, import_ws4, DEFAULT_DRIVER_CONNECT_TIMEOUT_MS, DRIVER_CONNECT_INTERVAL_MS, DRIVER_CONNECT_HOST_GRACE_MS, OPEN_BRIDGE_SPAWN_TIMEOUT_MS, SHELL_APPS, DEV_BUNDLE_RESOLVE_ATTEMPTS, DEV_BUNDLE_RESOLVE_INTERVAL_MS;
44519
+ var import_node_child_process15, import_node_fs37, import_node_os10, import_node_path40, import_app_catalog_wire, import_devices2, import_ws4, DEFAULT_DRIVER_CONNECT_TIMEOUT_MS, DRIVER_CONNECT_INTERVAL_MS, DRIVER_CONNECT_HOST_GRACE_MS, OPEN_BRIDGE_SPAWN_TIMEOUT_MS, SHELL_APPS, DEV_BUNDLE_RESOLVE_ATTEMPTS, DEV_BUNDLE_RESOLVE_INTERVAL_MS;
44389
44520
  var init_control = __esm({
44390
44521
  "cli/commands/control.ts"() {
44391
44522
  "use strict";
44392
44523
  import_node_child_process15 = require("node:child_process");
44393
- import_node_fs36 = __toESM(require("node:fs"), 1);
44394
- import_node_os9 = __toESM(require("node:os"), 1);
44395
- import_node_path39 = __toESM(require("node:path"), 1);
44524
+ import_node_fs37 = __toESM(require("node:fs"), 1);
44525
+ import_node_os10 = __toESM(require("node:os"), 1);
44526
+ import_node_path40 = __toESM(require("node:path"), 1);
44396
44527
  import_app_catalog_wire = require("peach-engine/engine/app-catalog-wire");
44397
44528
  import_devices2 = require("peach-engine/settings/devices");
44398
44529
  import_ws4 = require("ws");
@@ -45847,16 +45978,16 @@ function readRecentShellAppId(state) {
45847
45978
  }
45848
45979
  function resolveProjectRelativeFlowBase(flowDir) {
45849
45980
  if (!flowDir) return process.cwd();
45850
- return path33.basename(flowDir) === ".maestro" ? path33.dirname(flowDir) : flowDir;
45981
+ return path34.basename(flowDir) === ".maestro" ? path34.dirname(flowDir) : flowDir;
45851
45982
  }
45852
45983
  function resolveFlowScreenshotPathWithMode(screenshotDir, name2, opts) {
45853
45984
  const normalizedName = name2.endsWith(".png") ? name2 : `${name2}.png`;
45854
- if (path33.isAbsolute(normalizedName)) return normalizedName;
45985
+ if (path34.isAbsolute(normalizedName)) return normalizedName;
45855
45986
  if (opts.mode === "flow" && /[\\/]/.test(normalizedName)) {
45856
45987
  const baseDir = normalizedName.startsWith("./") || normalizedName.startsWith("../") ? opts.flowDir ?? process.cwd() : resolveProjectRelativeFlowBase(opts.flowDir);
45857
- return path33.resolve(baseDir, normalizedName);
45988
+ return path34.resolve(baseDir, normalizedName);
45858
45989
  }
45859
- return path33.join(screenshotDir, normalizedName);
45990
+ return path34.join(screenshotDir, normalizedName);
45860
45991
  }
45861
45992
  function normalizeFlowScreenshotSpec(step) {
45862
45993
  if (typeof step === "string") {
@@ -45910,12 +46041,12 @@ function normalizeBareStringStep(verb) {
45910
46041
  function parseFlowSteps(content) {
45911
46042
  return parseFlowFile(content).steps;
45912
46043
  }
45913
- var fs29, path33, import_devices4, import_proof_frame, DEFAULT_TIMEOUT, ASSERTION_LOOKUP_MS, FLOW_TIMEOUT_SCALE, scaledTimeout, MAESTRO_SELECTOR_KEYS, SELECTOR_FILTER_KEYS, UNSUPPORTED_SELECTOR_KEYS, ACCESSIBILITY_SELECTOR_KEYS, ACCESSIBILITY_TRAIT_FILTERS, MAESTRO_PERMISSION_KINDS, MAESTRO_PERMISSION_STATUS, SootSimBridgeFlowRunner;
46044
+ var fs30, path34, import_devices4, import_proof_frame, DEFAULT_TIMEOUT, ASSERTION_LOOKUP_MS, FLOW_TIMEOUT_SCALE, scaledTimeout, MAESTRO_SELECTOR_KEYS, SELECTOR_FILTER_KEYS, UNSUPPORTED_SELECTOR_KEYS, ACCESSIBILITY_SELECTOR_KEYS, ACCESSIBILITY_TRAIT_FILTERS, MAESTRO_PERMISSION_KINDS, MAESTRO_PERMISSION_STATUS, SootSimBridgeFlowRunner;
45914
46045
  var init_bridge_flow_runner = __esm({
45915
46046
  "cli/bridge-flow-runner.ts"() {
45916
46047
  "use strict";
45917
- fs29 = __toESM(require("fs"), 1);
45918
- path33 = __toESM(require("path"), 1);
46048
+ fs30 = __toESM(require("fs"), 1);
46049
+ path34 = __toESM(require("path"), 1);
45919
46050
  import_devices4 = require("peach-engine/settings/devices");
45920
46051
  import_proof_frame = __toESM(require_proof_frame(), 1);
45921
46052
  init_flow_timeout_scale();
@@ -46240,14 +46371,14 @@ var init_bridge_flow_runner = __esm({
46240
46371
  if (chunks.length === 0) {
46241
46372
  throw new Error("recording requested but no video buffer was produced");
46242
46373
  }
46243
- fs29.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
46374
+ fs30.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
46244
46375
  const videoMime = stopped.mime || this.opts.recordingFormat || "video/webm";
46245
46376
  const extension = videoMime.includes("mp4") ? "mp4" : "webm";
46246
- const outputPath = path33.join(
46377
+ const outputPath = path34.join(
46247
46378
  this.opts.recordingOutputDir,
46248
46379
  `peach-${Date.now()}.${extension}`
46249
46380
  );
46250
- fs29.writeFileSync(outputPath, Buffer.concat(chunks));
46381
+ fs30.writeFileSync(outputPath, Buffer.concat(chunks));
46251
46382
  return outputPath;
46252
46383
  }
46253
46384
  async waitForRecordingTail(opts) {
@@ -46923,7 +47054,7 @@ var init_bridge_flow_runner = __esm({
46923
47054
  flowDir: this.opts.flowDir
46924
47055
  }
46925
47056
  );
46926
- fs29.mkdirSync(path33.dirname(outputPath), { recursive: true });
47057
+ fs30.mkdirSync(path34.dirname(outputPath), { recursive: true });
46927
47058
  const layers = spec.layers ?? this.opts.screenshotLayers;
46928
47059
  const screenshotRequest = {
46929
47060
  type: "screenshot",
@@ -46958,11 +47089,11 @@ var init_bridge_flow_runner = __esm({
46958
47089
  throw new Error("could not read current device model for framed screenshot");
46959
47090
  }
46960
47091
  const framed = await composeFramedScreenshot(rawBuffer, model);
46961
- fs29.writeFileSync(outputPath, framed);
47092
+ fs30.writeFileSync(outputPath, framed);
46962
47093
  console.log(`[flow] screenshot: ${outputPath} (frame: ${model})`);
46963
47094
  return outputPath;
46964
47095
  }
46965
- fs29.writeFileSync(outputPath, rawBuffer);
47096
+ fs30.writeFileSync(outputPath, rawBuffer);
46966
47097
  console.log(`[flow] screenshot: ${outputPath}`);
46967
47098
  return outputPath;
46968
47099
  }
@@ -46984,10 +47115,10 @@ var init_bridge_flow_runner = __esm({
46984
47115
  // + a11y tree + console errors/warnings + failed network requests +
46985
47116
  // shell state, all under one directory so post-mortem is one grep away.
46986
47117
  async captureFailureBundle(outputDir, context) {
46987
- fs29.mkdirSync(outputDir, { recursive: true });
47118
+ fs30.mkdirSync(outputDir, { recursive: true });
46988
47119
  const write = (name2, content) => {
46989
47120
  try {
46990
- fs29.writeFileSync(path33.join(outputDir, name2), content);
47121
+ fs30.writeFileSync(path34.join(outputDir, name2), content);
46991
47122
  } catch {
46992
47123
  }
46993
47124
  };
@@ -47580,8 +47711,8 @@ var init_bridge_flow_runner = __esm({
47580
47711
  runScript(target) {
47581
47712
  const spec = typeof target === "string" ? { file: target } : target;
47582
47713
  if (!spec.file) throw new Error("runScript requires a file");
47583
- const scriptPath = path33.resolve(this.opts.flowDir, spec.file);
47584
- const source = fs29.readFileSync(scriptPath, "utf8");
47714
+ const scriptPath = path34.resolve(this.opts.flowDir, spec.file);
47715
+ const source = fs30.readFileSync(scriptPath, "utf8");
47585
47716
  this.js.evaluate(source, { env: spec.env });
47586
47717
  console.log(`[flow] runScript: ${spec.file} done`);
47587
47718
  }
@@ -47941,14 +48072,14 @@ var init_bridge_flow_runner = __esm({
47941
48072
  for (const [k, v] of Object.entries(env)) this.js.putEnv(k, v);
47942
48073
  }
47943
48074
  if (file) {
47944
- const flowPath = path33.resolve(this.opts.flowDir, file);
47945
- const flowContent = fs29.readFileSync(flowPath, "utf8");
48075
+ const flowPath = path34.resolve(this.opts.flowDir, file);
48076
+ const flowContent = fs30.readFileSync(flowPath, "utf8");
47946
48077
  const { frontmatter } = parseFlowFile(flowContent);
47947
48078
  if (frontmatter.env && typeof frontmatter.env === "object") {
47948
48079
  this.js.defineVariables(frontmatter.env);
47949
48080
  }
47950
48081
  const previousDir = this.opts.flowDir;
47951
- this.opts.flowDir = path33.dirname(flowPath);
48082
+ this.opts.flowDir = path34.dirname(flowPath);
47952
48083
  try {
47953
48084
  await this.runFlow(parseFlowSteps(flowContent));
47954
48085
  } finally {
@@ -48119,8 +48250,8 @@ __export(registry_exports, {
48119
48250
  skillRegistry: () => skillRegistry
48120
48251
  });
48121
48252
  module.exports = __toCommonJS(registry_exports);
48122
- var fs30 = __toESM(require("fs"), 1);
48123
- var path34 = __toESM(require("path"), 1);
48253
+ var fs31 = __toESM(require("fs"), 1);
48254
+ var path35 = __toESM(require("path"), 1);
48124
48255
 
48125
48256
  // src/skills/builtin/a11y-review.ts
48126
48257
  init_reap_browser();
@@ -48139,8 +48270,8 @@ var skill = {
48139
48270
  },
48140
48271
  async execute(params, context) {
48141
48272
  const { chromium } = await import("playwright");
48142
- const path35 = await import("path");
48143
- const fs31 = await import("fs");
48273
+ const path36 = await import("path");
48274
+ const fs32 = await import("fs");
48144
48275
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
48145
48276
  headless: true
48146
48277
  });
@@ -48197,9 +48328,9 @@ var skill = {
48197
48328
  warnings: issues.filter((i) => i.severity === "warning").length,
48198
48329
  tree: typeof tree === "string" ? tree : JSON.stringify(tree)
48199
48330
  };
48200
- const reportPath = path35.join(context.outputDir, "a11y-report.json");
48201
- fs31.mkdirSync(path35.dirname(reportPath), { recursive: true });
48202
- fs31.writeFileSync(reportPath, JSON.stringify(report, null, 2));
48331
+ const reportPath = path36.join(context.outputDir, "a11y-report.json");
48332
+ fs32.mkdirSync(path36.dirname(reportPath), { recursive: true });
48333
+ fs32.writeFileSync(reportPath, JSON.stringify(report, null, 2));
48203
48334
  return {
48204
48335
  success: issues.filter((i) => i.severity === "error").length === 0,
48205
48336
  message: `${report.errors} errors, ${report.warnings} warnings across ${report.nodeCount} nodes`,
@@ -48232,14 +48363,14 @@ var skill2 = {
48232
48363
  }
48233
48364
  },
48234
48365
  async execute(params, context) {
48235
- const fs31 = await import("node:fs");
48236
- const path35 = await import("node:path");
48366
+ const fs32 = await import("node:fs");
48367
+ const path36 = await import("node:path");
48237
48368
  const { COMPAT_RESULT_CAVEAT: COMPAT_RESULT_CAVEAT2, formatPackageStatus: formatPackageStatus2, formatScanCounts: formatScanCounts2, scanDeps: scanDeps2 } = await Promise.resolve().then(() => (init_web(), web_exports));
48238
- const packagePath = path35.join(context.projectDir, "package.json");
48239
- if (!fs31.existsSync(packagePath)) {
48369
+ const packagePath = path36.join(context.projectDir, "package.json");
48370
+ if (!fs32.existsSync(packagePath)) {
48240
48371
  return { success: false, message: "No package.json found" };
48241
48372
  }
48242
- const parsed = JSON.parse(fs31.readFileSync(packagePath, "utf8"));
48373
+ const parsed = JSON.parse(fs32.readFileSync(packagePath, "utf8"));
48243
48374
  if (!parsed || typeof parsed !== "object") {
48244
48375
  return { success: false, message: "package.json is not an object" };
48245
48376
  }
@@ -48251,9 +48382,9 @@ var skill2 = {
48251
48382
  }) : scanDeps2(parsed);
48252
48383
  const packageResult = params.packageName ? scan.packages[0] : void 0;
48253
48384
  const message = packageResult ? `${params.packageName}: ${formatPackageStatus2(packageResult)}. ${COMPAT_RESULT_CAVEAT2}` : `${formatScanCounts2(scan)}. ${COMPAT_RESULT_CAVEAT2}`;
48254
- const reportPath = path35.join(context.outputDir, "compat-report.json");
48255
- fs31.mkdirSync(path35.dirname(reportPath), { recursive: true });
48256
- fs31.writeFileSync(reportPath, `${JSON.stringify(scan, null, 2)}
48385
+ const reportPath = path36.join(context.outputDir, "compat-report.json");
48386
+ fs32.mkdirSync(path36.dirname(reportPath), { recursive: true });
48387
+ fs32.writeFileSync(reportPath, `${JSON.stringify(scan, null, 2)}
48257
48388
  `);
48258
48389
  return {
48259
48390
  success: true,
@@ -48295,8 +48426,8 @@ var skill3 = {
48295
48426
  record: { type: "boolean", description: "Record video of the flow" }
48296
48427
  },
48297
48428
  async execute(params, context) {
48298
- const fs31 = await import("fs");
48299
- const path35 = await import("path");
48429
+ const fs32 = await import("fs");
48430
+ const path36 = await import("path");
48300
48431
  const yaml2 = await import("yaml");
48301
48432
  const { DEFAULT_SOOTSIM_BRIDGE_PORT: DEFAULT_SOOTSIM_BRIDGE_PORT3 } = await Promise.resolve().then(() => (init_bridge_constants(), bridge_constants_exports));
48302
48433
  const { SootSimBridgeHost: SootSimBridgeHost2 } = await Promise.resolve().then(() => (init_bridge_host(), bridge_host_exports));
@@ -48306,7 +48437,7 @@ var skill3 = {
48306
48437
  const host2 = new SootSimBridgeHost2({ port: DEFAULT_SOOTSIM_BRIDGE_PORT3 });
48307
48438
  host2.start({ silent: true });
48308
48439
  try {
48309
- const flowContent = fs31.readFileSync(params.flowPath, "utf8");
48440
+ const flowContent = fs32.readFileSync(params.flowPath, "utf8");
48310
48441
  const fmMatch = flowContent.match(/^---\n([\s\S]*?)\n---\n?/);
48311
48442
  const stepsBody = fmMatch ? flowContent.slice(fmMatch[0].length) : flowContent;
48312
48443
  const steps = yaml2.parse(stepsBody);
@@ -48333,7 +48464,7 @@ var skill3 = {
48333
48464
  });
48334
48465
  const driver = new SootSimBridgeFlowRunner2(bridge, {
48335
48466
  screenshotDir: context.outputDir,
48336
- flowDir: path35.dirname(path35.resolve(params.flowPath)),
48467
+ flowDir: path36.dirname(path36.resolve(params.flowPath)),
48337
48468
  simId,
48338
48469
  recordingOutputDir: params.record ? context.outputDir : void 0
48339
48470
  });
@@ -48355,7 +48486,7 @@ var skill3 = {
48355
48486
  simId,
48356
48487
  videoPath: videoPath || void 0
48357
48488
  },
48358
- artifacts: videoPath ? [{ type: "video", name: path35.basename(videoPath), path: videoPath }] : void 0
48489
+ artifacts: videoPath ? [{ type: "video", name: path36.basename(videoPath), path: videoPath }] : void 0
48359
48490
  };
48360
48491
  } finally {
48361
48492
  try {
@@ -48402,8 +48533,8 @@ var skill4 = {
48402
48533
  },
48403
48534
  async execute(params, context) {
48404
48535
  const { chromium } = await import("playwright");
48405
- const path35 = await import("path");
48406
- const fs31 = await import("fs");
48536
+ const path36 = await import("path");
48537
+ const fs32 = await import("fs");
48407
48538
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
48408
48539
  headless: true
48409
48540
  });
@@ -48431,9 +48562,9 @@ var skill4 = {
48431
48562
  ...profile,
48432
48563
  fps: syncCount > 0 ? (syncCount / (duration / 1e3)).toFixed(1) : "0"
48433
48564
  };
48434
- const reportPath = path35.join(context.outputDir, "perf-report.json");
48435
- fs31.mkdirSync(path35.dirname(reportPath), { recursive: true });
48436
- fs31.writeFileSync(reportPath, JSON.stringify(report, null, 2));
48565
+ const reportPath = path36.join(context.outputDir, "perf-report.json");
48566
+ fs32.mkdirSync(path36.dirname(reportPath), { recursive: true });
48567
+ fs32.writeFileSync(reportPath, JSON.stringify(report, null, 2));
48437
48568
  return {
48438
48569
  success: true,
48439
48570
  message: `${report.fps} fps, ${profile.avgSyncMs?.toFixed(1)}ms avg sync, ${nodeCount} nodes`,
@@ -48466,8 +48597,8 @@ var skill5 = {
48466
48597
  },
48467
48598
  async execute(params, context) {
48468
48599
  const { chromium } = await import("playwright");
48469
- const path35 = await import("path");
48470
- const fs31 = await import("fs");
48600
+ const path36 = await import("path");
48601
+ const fs32 = await import("fs");
48471
48602
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
48472
48603
  headless: true
48473
48604
  });
@@ -48475,8 +48606,8 @@ var skill5 = {
48475
48606
  try {
48476
48607
  await page.goto(context.url, { waitUntil: "networkidle" });
48477
48608
  await page.waitForTimeout(2e3);
48478
- const outputPath = path35.join(context.outputDir, `${params.name}.png`);
48479
- fs31.mkdirSync(path35.dirname(outputPath), { recursive: true });
48609
+ const outputPath = path36.join(context.outputDir, `${params.name}.png`);
48610
+ fs32.mkdirSync(path36.dirname(outputPath), { recursive: true });
48480
48611
  await page.screenshot({ path: outputPath });
48481
48612
  return {
48482
48613
  success: true,
@@ -48517,8 +48648,8 @@ var skill6 = {
48517
48648
  },
48518
48649
  async execute(params, context) {
48519
48650
  const { chromium } = await import("playwright");
48520
- const path35 = await import("path");
48521
- const fs31 = await import("fs");
48651
+ const path36 = await import("path");
48652
+ const fs32 = await import("fs");
48522
48653
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
48523
48654
  headless: true
48524
48655
  });
@@ -48526,14 +48657,14 @@ var skill6 = {
48526
48657
  try {
48527
48658
  await page.goto(context.url, { waitUntil: "networkidle" });
48528
48659
  await page.waitForTimeout(2e3);
48529
- const currentPath = path35.join(context.outputDir, `${params.name}-current.png`);
48530
- fs31.mkdirSync(path35.dirname(currentPath), { recursive: true });
48660
+ const currentPath = path36.join(context.outputDir, `${params.name}-current.png`);
48661
+ fs32.mkdirSync(path36.dirname(currentPath), { recursive: true });
48531
48662
  await page.screenshot({ path: currentPath });
48532
48663
  try {
48533
48664
  const { PNG } = await import("pngjs");
48534
48665
  const pixelmatch = (await import("pixelmatch")).default;
48535
- const baseline = PNG.sync.read(fs31.readFileSync(params.baseline));
48536
- const current = PNG.sync.read(fs31.readFileSync(currentPath));
48666
+ const baseline = PNG.sync.read(fs32.readFileSync(params.baseline));
48667
+ const current = PNG.sync.read(fs32.readFileSync(currentPath));
48537
48668
  const { width, height } = baseline;
48538
48669
  const diff = new PNG({ width, height });
48539
48670
  const numDiffPixels = pixelmatch(
@@ -48544,8 +48675,8 @@ var skill6 = {
48544
48675
  height,
48545
48676
  { threshold: params.threshold || 0.1 }
48546
48677
  );
48547
- const diffPath = path35.join(context.outputDir, `${params.name}-diff.png`);
48548
- fs31.writeFileSync(diffPath, PNG.sync.write(diff));
48678
+ const diffPath = path36.join(context.outputDir, `${params.name}-diff.png`);
48679
+ fs32.writeFileSync(diffPath, PNG.sync.write(diff));
48549
48680
  const totalPixels = width * height;
48550
48681
  const diffPercent = (numDiffPixels / totalPixels * 100).toFixed(2);
48551
48682
  return {
@@ -48609,10 +48740,10 @@ var skillRegistry = {
48609
48740
  },
48610
48741
  // load skills from a project manifest (rnx-skills.json)
48611
48742
  async loadFromManifest(projectDir) {
48612
- const manifestPath = path34.join(projectDir, "rnx-skills.json");
48613
- if (!fs30.existsSync(manifestPath)) return;
48743
+ const manifestPath = path35.join(projectDir, "rnx-skills.json");
48744
+ if (!fs31.existsSync(manifestPath)) return;
48614
48745
  try {
48615
- const manifest = JSON.parse(fs30.readFileSync(manifestPath, "utf8"));
48746
+ const manifest = JSON.parse(fs31.readFileSync(manifestPath, "utf8"));
48616
48747
  if (Array.isArray(manifest.skills)) {
48617
48748
  for (const entry of manifest.skills) {
48618
48749
  if (typeof entry === "string") {
@@ -48623,7 +48754,7 @@ var skillRegistry = {
48623
48754
  }
48624
48755
  } else if (entry.file) {
48625
48756
  try {
48626
- const mod = await import(path34.resolve(projectDir, entry.file));
48757
+ const mod = await import(path35.resolve(projectDir, entry.file));
48627
48758
  if (mod.skill) this.register(mod.skill);
48628
48759
  } catch {
48629
48760
  }
@@ -48636,10 +48767,10 @@ var skillRegistry = {
48636
48767
  // auto-discover skills based on project dependencies
48637
48768
  suggestSkills(projectDir) {
48638
48769
  const suggestions = [];
48639
- const pkgPath = path34.join(projectDir, "package.json");
48640
- if (!fs30.existsSync(pkgPath)) return suggestions;
48770
+ const pkgPath = path35.join(projectDir, "package.json");
48771
+ if (!fs31.existsSync(pkgPath)) return suggestions;
48641
48772
  try {
48642
- const pkg = JSON.parse(fs30.readFileSync(pkgPath, "utf8"));
48773
+ const pkg = JSON.parse(fs31.readFileSync(pkgPath, "utf8"));
48643
48774
  const deps = { ...pkg.dependencies, ...pkg.devDependencies };
48644
48775
  if (deps["detox"] || deps["maestro"]) {
48645
48776
  suggestions.push("maestro-test");