peachsim 0.1.757 → 0.1.759

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 (74) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/agent-identity.cjs +1 -1
  4. package/dist-lib/agent-sessions.cjs +1 -1
  5. package/dist-lib/attached-projects.cjs +1 -1
  6. package/dist-lib/auth/shared-session.cjs +1 -1
  7. package/dist-lib/backend-origin.cjs +1 -1
  8. package/dist-lib/beta.cjs +1 -1
  9. package/dist-lib/beta.mjs +1 -1
  10. package/dist-lib/bridge-constants.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.mjs +1 -1
  13. package/dist-lib/bridge-contract.cjs +1 -1
  14. package/dist-lib/bridge-contract.mjs +1 -1
  15. package/dist-lib/capture-contract.cjs +1 -1
  16. package/dist-lib/capture-contract.mjs +1 -1
  17. package/dist-lib/cli-constants.cjs +1 -1
  18. package/dist-lib/cloud-contract.cjs +1 -1
  19. package/dist-lib/cloud-contract.mjs +1 -1
  20. package/dist-lib/cloud-test-args.cjs +1 -1
  21. package/dist-lib/cloud-test-args.mjs +1 -1
  22. package/dist-lib/cloud.cjs +1 -1
  23. package/dist-lib/cloud.mjs +1 -1
  24. package/dist-lib/config.cjs +1 -1
  25. package/dist-lib/detox/index.cjs +1 -1
  26. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  27. package/dist-lib/home-paths.cjs +1 -1
  28. package/dist-lib/host/bridge-host.cjs +729 -371
  29. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  30. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  31. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  32. package/dist-lib/host/replacement-module-handler.cjs +2 -4
  33. package/dist-lib/host/websocket-proxy.cjs +1 -1
  34. package/dist-lib/index.cjs +495 -139
  35. package/dist-lib/jump-to-source-babel.cjs +1 -1
  36. package/dist-lib/jump-to-source-native.cjs +1 -1
  37. package/dist-lib/kotlin-host.cjs +1 -1
  38. package/dist-lib/menu.cjs +1 -1
  39. package/dist-lib/menu.mjs +1 -1
  40. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  41. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  42. package/dist-lib/metro-production-bundle.cjs +1 -1
  43. package/dist-lib/metro-production-bundle.mjs +1 -1
  44. package/dist-lib/metro.cjs +466 -110
  45. package/dist-lib/native-app-identity.cjs +1 -1
  46. package/dist-lib/native-app-identity.mjs +1 -1
  47. package/dist-lib/native-firebase-metadata.cjs +1 -1
  48. package/dist-lib/native-firebase-metadata.mjs +1 -1
  49. package/dist-lib/plist.cjs +1 -1
  50. package/dist-lib/plist.mjs +1 -1
  51. package/dist-lib/profiles.cjs +1 -1
  52. package/dist-lib/public-brand.cjs +1 -1
  53. package/dist-lib/react-native-host-modules.cjs +1 -1
  54. package/dist-lib/react-native-host-modules.mjs +1 -1
  55. package/dist-lib/render-mode.cjs +1 -1
  56. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  57. package/dist-lib/sdk.cjs +1 -1
  58. package/dist-lib/sdk.mjs +1 -1
  59. package/dist-lib/skills.cjs +921 -558
  60. package/dist-lib/swift-compile.cjs +1 -1
  61. package/dist-lib/swift-compile.mjs +1 -1
  62. package/dist-lib/swift-package.cjs +1 -1
  63. package/dist-lib/swift-package.mjs +1 -1
  64. package/dist-lib/swift-submit.cjs +1 -1
  65. package/dist-lib/swift-submit.mjs +1 -1
  66. package/dist-lib/swift-toolchain.cjs +1 -1
  67. package/dist-lib/swift.cjs +1 -1
  68. package/dist-lib/vite-swift.cjs +539 -179
  69. package/dist-lib/vite.cjs +2 -4
  70. package/package.json +1 -1
  71. package/src/host/replacement-module-handler.ts +2 -1
  72. package/src/swift-host.ts +4 -2
  73. package/src/xcode-json-project.ts +450 -0
  74. package/src/xcode-project.ts +55 -22
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.757 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.759 | (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;
@@ -6293,7 +6293,7 @@ var init_registry = __esm({
6293
6293
  coverage: 0.95,
6294
6294
  note: "upstream package JS runs against ExpoCrypto and ExpoCryptoAES native-module seams",
6295
6295
  working: "upstream Crypto.ts/Crypto.types/aes wrappers, getRandomBytes, getRandomBytesAsync, getRandomValues, digestStringAsync (hex/base64), digest ArrayBuffer, randomUUID, AES-GCM key generation/import/export, encrypt/decrypt, sealed data helpers",
6296
- missing: "MD2/MD4/MD5 digest algorithms are unavailable through Web Crypto; AES-192 is browser-dependent and not guaranteed"
6296
+ missing: "MD2/MD4 digest algorithms are unavailable through Web Crypto; AES-192 is browser-dependent and not guaranteed"
6297
6297
  }
6298
6298
  ]
6299
6299
  },
@@ -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(path33) {
19805
+ async function readableSettingsBundle(path34) {
19806
19806
  try {
19807
- const root = await (0, import_promises.stat)((0, import_node_path.join)(path33, "Root.plist"));
19807
+ const root = await (0, import_promises.stat)((0, import_node_path.join)(path34, "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(path33) {
19852
+ async function parsePlistRecord(path34) {
19853
19853
  try {
19854
- const metadata = await (0, import_promises.stat)(path33);
19854
+ const metadata = await (0, import_promises.stat)(path34);
19855
19855
  if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
19856
- const source = await (0, import_promises.readFile)(path33, "utf8");
19856
+ const source = await (0, import_promises.readFile)(path34, "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, path33, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
20180
+ function httpGet(hostname, port, path34, 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, path33, 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: path33, method, headers }, (res) => {
20189
+ const req = import_http.default.request({ hostname, port, path: path34, method, headers }, (res) => {
20190
20190
  let body = "";
20191
20191
  res.on("data", (c) => body += c.toString());
20192
20192
  const contentType = (() => {
@@ -21713,7 +21713,7 @@ function manifestCalls(manifest, kinds) {
21713
21713
  function listArgument(call, label) {
21714
21714
  const start = new RegExp(`\\b${label}\\s*:\\s*\\[`).exec(call);
21715
21715
  if (!start) return [];
21716
- const items = [];
21716
+ const items2 = [];
21717
21717
  let depth = 0;
21718
21718
  let inString = false;
21719
21719
  let item = "";
@@ -21730,14 +21730,14 @@ function listArgument(call, label) {
21730
21730
  if (depth === 0) break;
21731
21731
  depth--;
21732
21732
  } else if (ch === "," && depth === 0) {
21733
- items.push(item.trim());
21733
+ items2.push(item.trim());
21734
21734
  item = "";
21735
21735
  continue;
21736
21736
  }
21737
21737
  item += ch;
21738
21738
  }
21739
- if (item.trim()) items.push(item.trim());
21740
- return items;
21739
+ if (item.trim()) items2.push(item.trim());
21740
+ return items2;
21741
21741
  }
21742
21742
  function swiftPackageIdentity(url) {
21743
21743
  return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
@@ -22194,21 +22194,21 @@ function syncSwiftTree(base, files) {
22194
22194
  (0, import_node_fs7.writeFileSync)(full, contents, "utf8");
22195
22195
  }
22196
22196
  }
22197
- function splitTopLevel(text) {
22197
+ function splitTopLevel(text2) {
22198
22198
  const parts = [];
22199
22199
  let depth = 0;
22200
22200
  let start = 0;
22201
- for (let i = 0; i < text.length; i++) {
22202
- const char = text[i];
22201
+ for (let i = 0; i < text2.length; i++) {
22202
+ const char = text2[i];
22203
22203
  if (char === "(" || char === "[" || char === "<") depth++;
22204
- else if (char === ")" || char === "]" || char === ">" && text[i - 1] !== "-")
22204
+ else if (char === ")" || char === "]" || char === ">" && text2[i - 1] !== "-")
22205
22205
  depth--;
22206
22206
  else if (char === "," && depth === 0) {
22207
- parts.push(text.slice(start, i));
22207
+ parts.push(text2.slice(start, i));
22208
22208
  start = i + 1;
22209
22209
  }
22210
22210
  }
22211
- parts.push(text.slice(start));
22211
+ parts.push(text2.slice(start));
22212
22212
  return parts.map((part) => part.trim()).filter((part) => part !== "");
22213
22213
  }
22214
22214
  function forwardedArguments(parameters) {
@@ -23860,14 +23860,14 @@ function pickImagesetFile(images) {
23860
23860
  scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
23861
23861
  };
23862
23862
  }
23863
- function flatScale(path33) {
23864
- const match = /@([23])x\.[^./]+$/.exec(path33);
23863
+ function flatScale(path34) {
23864
+ const match = /@([23])x\.[^./]+$/.exec(path34);
23865
23865
  return match ? Number(match[1]) : 1;
23866
23866
  }
23867
- function providesNamespace(text) {
23868
- if (text === null) return false;
23867
+ function providesNamespace(text2) {
23868
+ if (text2 === null) return false;
23869
23869
  try {
23870
- const parsed = JSON.parse(text);
23870
+ const parsed = JSON.parse(text2);
23871
23871
  return parsed?.properties?.["provides-namespace"] === true;
23872
23872
  } catch {
23873
23873
  return false;
@@ -23888,21 +23888,21 @@ function catalogEntryName(contentsPath, kind, readText2) {
23888
23888
  }
23889
23889
  return segments.join("/");
23890
23890
  }
23891
- function isFlatResourceImage(path33) {
23892
- return path33.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path33));
23891
+ function isFlatResourceImage(path34) {
23892
+ return path34.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path34));
23893
23893
  }
23894
23894
  function enumerateBundleImages(paths, readText2) {
23895
23895
  const table = [];
23896
23896
  const seen = /* @__PURE__ */ new Set();
23897
- const catalogs = paths.filter((path33) => baseOf(path33) === "Contents.json");
23897
+ const catalogs = paths.filter((path34) => baseOf(path34) === "Contents.json");
23898
23898
  for (const contentsPath of catalogs) {
23899
23899
  const name2 = catalogEntryName(contentsPath, ".imageset", readText2);
23900
23900
  if (name2 === null || seen.has(name2)) continue;
23901
23901
  let parsed;
23902
23902
  try {
23903
- const text = readText2(contentsPath);
23904
- if (text === null) continue;
23905
- parsed = JSON.parse(text);
23903
+ const text2 = readText2(contentsPath);
23904
+ if (text2 === null) continue;
23905
+ parsed = JSON.parse(text2);
23906
23906
  } catch {
23907
23907
  continue;
23908
23908
  }
@@ -23915,12 +23915,12 @@ function enumerateBundleImages(paths, readText2) {
23915
23915
  seen.add(name2);
23916
23916
  table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
23917
23917
  }
23918
- for (const path33 of paths) {
23919
- if (!isFlatResourceImage(path33)) continue;
23920
- const name2 = baseOf(path33).slice(0, -extOf(path33).length);
23918
+ for (const path34 of paths) {
23919
+ if (!isFlatResourceImage(path34)) continue;
23920
+ const name2 = baseOf(path34).slice(0, -extOf(path34).length);
23921
23921
  if (name2 === "" || seen.has(name2)) continue;
23922
23922
  seen.add(name2);
23923
- table.push({ name: name2, file: path33, scale: flatScale(path33) });
23923
+ table.push({ name: name2, file: path34, scale: flatScale(path34) });
23924
23924
  }
23925
23925
  return table;
23926
23926
  }
@@ -23949,14 +23949,14 @@ function colorsetValue(color) {
23949
23949
  }
23950
23950
  function enumerateBundleColors(paths, readText2) {
23951
23951
  const table = {};
23952
- for (const contentsPath of paths.filter((path33) => baseOf(path33) === "Contents.json")) {
23952
+ for (const contentsPath of paths.filter((path34) => baseOf(path34) === "Contents.json")) {
23953
23953
  const name2 = catalogEntryName(contentsPath, ".colorset", readText2);
23954
23954
  if (name2 === null || name2 in table) continue;
23955
23955
  let colors;
23956
23956
  try {
23957
- const text = readText2(contentsPath);
23958
- if (text === null) continue;
23959
- colors = Reflect.get(JSON.parse(text), "colors");
23957
+ const text2 = readText2(contentsPath);
23958
+ if (text2 === null) continue;
23959
+ colors = Reflect.get(JSON.parse(text2), "colors");
23960
23960
  } catch {
23961
23961
  continue;
23962
23962
  }
@@ -24013,8 +24013,8 @@ function axisExtremes(points) {
24013
24013
  function pathBounds(d) {
24014
24014
  const xs = [];
24015
24015
  const ys = [];
24016
- for (const path33 of d)
24017
- (0, import_svgpath.default)(path33).abs().unshort().unarc().iterate((segment, _index, x, y) => {
24016
+ for (const path34 of d)
24017
+ (0, import_svgpath.default)(path34).abs().unshort().unarc().iterate((segment, _index, x, y) => {
24018
24018
  const [command, ...args] = segment;
24019
24019
  if (command === "M" || command === "L") {
24020
24020
  xs.push(Number(args[0]));
@@ -24041,7 +24041,7 @@ function guide(svg, id, axis) {
24041
24041
  }
24042
24042
  function enumerateBundleSymbols(paths, readText2) {
24043
24043
  const table = {};
24044
- for (const contentsPath of paths.filter((path33) => baseOf(path33) === "Contents.json")) {
24044
+ for (const contentsPath of paths.filter((path34) => baseOf(path34) === "Contents.json")) {
24045
24045
  const name2 = catalogEntryName(contentsPath, ".symbolset", readText2);
24046
24046
  if (name2 === null || name2 in table) continue;
24047
24047
  let symbols;
@@ -24074,8 +24074,8 @@ function enumerateBundleSymbols(paths, readText2) {
24074
24074
  viewBox: "0 0 24 24",
24075
24075
  advance,
24076
24076
  box: [12 - advance / 2, 12 - tall / 2, advance, tall],
24077
- layers: d.map((path33) => ({
24078
- d: (0, import_svgpath.default)(path33).abs().scale(scale).translate(translateX, translateY).round(3).toString()
24077
+ layers: d.map((path34) => ({
24078
+ d: (0, import_svgpath.default)(path34).abs().scale(scale).translate(translateX, translateY).round(3).toString()
24079
24079
  }))
24080
24080
  };
24081
24081
  }
@@ -24085,7 +24085,7 @@ function enumerateBundleJson(paths) {
24085
24085
  const found = [];
24086
24086
  const seen = /* @__PURE__ */ new Set();
24087
24087
  const ordered = [...paths].filter(
24088
- (path33) => path33.split("/").includes("Resources") && path33.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path33) === ".json" || extOf(path33) === ".xcstrings")
24088
+ (path34) => path34.split("/").includes("Resources") && path34.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path34) === ".json" || extOf(path34) === ".xcstrings")
24089
24089
  ).sort((a, b) => {
24090
24090
  const aDepth = a.split("/").length;
24091
24091
  const bDepth = b.split("/").length;
@@ -24677,24 +24677,363 @@ var init_swift_submit = __esm({
24677
24677
  }
24678
24678
  });
24679
24679
 
24680
+ // src/xcode-json-project.ts
24681
+ function readXcodeJsonProject(xcodeproj, source) {
24682
+ const json = import_json5.default.parse(source);
24683
+ if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
24684
+ const projectDir = import_node_path14.default.dirname(xcodeproj);
24685
+ const objects = {};
24686
+ let next = 0;
24687
+ const add = (entry, id) => {
24688
+ const key = id ?? `XCPROJ${(next++).toString(16).toUpperCase().padStart(18, "0")}`;
24689
+ objects[key] = entry;
24690
+ return key;
24691
+ };
24692
+ const locate = (raw2, groupDir) => {
24693
+ if (raw2.startsWith("<USER:")) return null;
24694
+ const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
24695
+ if (base) {
24696
+ if (base[1] === "PROJECT")
24697
+ return { sourceTree: "<absolute>", path: import_node_path14.default.join(projectDir, base[2]) };
24698
+ if (base[1] === "PRODUCTS")
24699
+ return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
24700
+ return null;
24701
+ }
24702
+ const unescaped = raw2.replaceAll("\\<", "<");
24703
+ if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
24704
+ if (unescaped.startsWith("~")) return null;
24705
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path14.default.join(groupDir, unescaped) };
24706
+ };
24707
+ const memberships = [];
24708
+ const folders = [];
24709
+ const projectFiles = [];
24710
+ const root = { id: "", name: "", dir: projectDir, parent: null, children: [] };
24711
+ const walk2 = (entries, parent) => entries.flatMap((entry) => {
24712
+ if (!isObject(entry)) return [];
24713
+ const kind = text(entry.kind) ?? "file-reference";
24714
+ const raw2 = text(entry.path) ?? "";
24715
+ const located = raw2 === "" ? null : locate(raw2, parent.dir);
24716
+ const name2 = text(entry.name) ?? import_node_path14.default.basename(raw2);
24717
+ const node = { id: "", name: name2, dir: null, parent, children: [] };
24718
+ if (kind === "group" || kind === "variant-group" || kind === "version-group") {
24719
+ node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
24720
+ const childIds = walk2(items(entry.children), node);
24721
+ node.id = add(
24722
+ kind === "version-group" && located ? {
24723
+ isa: "PBXFileReference",
24724
+ ...located,
24725
+ lastKnownFileType: "wrapper.xcdatamodel"
24726
+ } : {
24727
+ isa: kind === "variant-group" ? "PBXVariantGroup" : "PBXGroup",
24728
+ children: childIds,
24729
+ ...kind === "variant-group" ? {} : { sourceTree: "<absolute>", path: node.dir ?? "" },
24730
+ name: name2
24731
+ },
24732
+ text(entry.id)
24733
+ );
24734
+ } else if (kind === "folder") {
24735
+ node.id = add(
24736
+ {
24737
+ isa: "PBXFileSystemSynchronizedRootGroup",
24738
+ ...located ?? { sourceTree: "SDKROOT", path: raw2 }
24739
+ },
24740
+ text(entry.id)
24741
+ );
24742
+ folders.push({ id: node.id, folder: entry });
24743
+ } else {
24744
+ node.id = add(
24745
+ {
24746
+ isa: "PBXFileReference",
24747
+ ...located ?? { sourceTree: "SDKROOT", path: raw2 },
24748
+ name: name2
24749
+ },
24750
+ text(entry.id)
24751
+ );
24752
+ if (located?.sourceTree === "<absolute>" && located.path.endsWith(".xcodeproj"))
24753
+ projectFiles.push(node.id);
24754
+ }
24755
+ parent.children.push(node);
24756
+ for (const membership of items(entry["target-membership"])) {
24757
+ if (kind !== "folder") memberships.push({ refId: node.id, entry: membership });
24758
+ }
24759
+ return [node.id];
24760
+ });
24761
+ const mainGroupChildren = walk2(items(json.files), root);
24762
+ const mainGroup = add({
24763
+ isa: "PBXGroup",
24764
+ children: mainGroupChildren,
24765
+ sourceTree: "<absolute>",
24766
+ path: projectDir
24767
+ });
24768
+ root.id = mainGroup;
24769
+ const lookup = (reference, from = root) => {
24770
+ if (isObject(reference)) {
24771
+ const anchor = lookupNode(reference.anchor, root);
24772
+ return anchor ? lookup(reference["relative-path"], anchor) : void 0;
24773
+ }
24774
+ if (Array.isArray(reference)) {
24775
+ return lookupNode(
24776
+ reference.map(
24777
+ (component) => isObject(component) ? text(component.name) ?? "" : text(component) ?? ""
24778
+ ).join("/"),
24779
+ from
24780
+ )?.id;
24781
+ }
24782
+ return lookupNode(reference, from)?.id;
24783
+ };
24784
+ const lookupNode = (reference, from) => {
24785
+ const value = text(reference);
24786
+ if (value === void 0) return void 0;
24787
+ if (value.startsWith("id:")) {
24788
+ const id = value.slice(3);
24789
+ const find = (node2) => node2.id === id ? node2 : node2.children.map(find).find(Boolean);
24790
+ return find(root);
24791
+ }
24792
+ let node = from;
24793
+ for (const component of value.split("/")) {
24794
+ if (!node) return void 0;
24795
+ node = component === "." ? node : component === ".." ? node.parent ?? void 0 : node.children.find((child) => child.name === component);
24796
+ }
24797
+ return node;
24798
+ };
24799
+ const configurations = items(json.configurations).flatMap((entry) => {
24800
+ const name2 = isObject(entry) ? text(entry.name) : text(entry);
24801
+ return name2 ? [{ name: name2, file: isObject(entry) ? entry.file : void 0 }] : [];
24802
+ });
24803
+ const settingsOf = (value) => Object.fromEntries(
24804
+ Object.entries(isObject(value) ? value : {}).flatMap(
24805
+ ([key, setting]) => typeof setting === "string" ? [[key, setting]] : Array.isArray(setting) ? [
24806
+ [
24807
+ key,
24808
+ setting.filter((item) => typeof item === "string")
24809
+ ]
24810
+ ] : []
24811
+ )
24812
+ );
24813
+ const configurationList = (settings, specialized) => add({
24814
+ isa: "XCConfigurationList",
24815
+ defaultConfigurationName: text(json["default-configuration"]) ?? "Debug",
24816
+ buildConfigurations: configurations.map(({ name: name2, file }) => {
24817
+ const base = lookup(specialized.has(name2) ? specialized.get(name2) : file);
24818
+ return add({
24819
+ isa: "XCBuildConfiguration",
24820
+ name: name2,
24821
+ buildSettings: settings,
24822
+ ...base ? { baseConfigurationReference: base } : {}
24823
+ });
24824
+ })
24825
+ });
24826
+ const packageIds = /* @__PURE__ */ new Map();
24827
+ for (const entry of items(json.packages)) {
24828
+ if (!isObject(entry)) continue;
24829
+ const repository = text(entry.repository);
24830
+ const local = text(entry.path);
24831
+ const name2 = local !== void 0 ? import_node_path14.default.basename(import_node_path14.default.resolve(import_node_path14.default.dirname(xcodeproj), local)) : import_node_path14.default.basename(repository ?? "").replace(/\.git$/, "");
24832
+ const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
24833
+ packageIds.set(name2.toLowerCase(), id);
24834
+ }
24835
+ const productDependency = (entry) => add({
24836
+ isa: "XCSwiftPackageProductDependency",
24837
+ productName: text(entry["product-name"]) ?? "",
24838
+ // xcode finds a product by name across packages when none is named
24839
+ ...packageIds.has(text(entry.package)?.toLowerCase() ?? "") ? { package: packageIds.get(text(entry.package).toLowerCase()) } : {}
24840
+ });
24841
+ const proxy = (entry, remote, proxyType) => add({
24842
+ isa: "PBXContainerItemProxy",
24843
+ containerPortal: lookup(entry.project) ?? "",
24844
+ proxyType,
24845
+ remoteGlobalIDString: remote ?? "",
24846
+ remoteInfo: text(entry.target) ?? ""
24847
+ });
24848
+ const phases = /* @__PURE__ */ new Map();
24849
+ const targetIds = /* @__PURE__ */ new Map();
24850
+ const targets = [];
24851
+ for (const entry of items(json.targets)) {
24852
+ if (!isObject(entry)) continue;
24853
+ const name2 = text(entry.name) ?? "";
24854
+ const productType = text(entry["product-type"]);
24855
+ const target = {
24856
+ isa: text(entry.kind) === "aggregate" ? "PBXAggregateTarget" : "PBXNativeTarget",
24857
+ name: name2,
24858
+ productName: name2,
24859
+ productType: productType ? `com.apple.product-type.${productType}` : text(entry["full-product-type"]) ?? "",
24860
+ buildPhases: [],
24861
+ dependencies: [],
24862
+ packageProductDependencies: [],
24863
+ fileSystemSynchronizedGroups: []
24864
+ };
24865
+ const product = lookup(entry.product);
24866
+ if (product) target.productReference = product;
24867
+ const id = add(target, text(entry.id));
24868
+ targetIds.set(name2, id);
24869
+ targets.push({ id, target, entry });
24870
+ for (const phase of items(entry["build-phases"])) {
24871
+ const kind = isObject(phase) ? text(phase.kind) : text(phase);
24872
+ const isa = kind ? PHASE_ISA[kind] : void 0;
24873
+ if (!kind || !isa) continue;
24874
+ const phaseName = isObject(phase) ? text(phase.name) : void 0;
24875
+ const phaseId = add(
24876
+ { isa, files: [] },
24877
+ isObject(phase) ? text(phase.id) : void 0
24878
+ );
24879
+ target.buildPhases.push(phaseId);
24880
+ phases.set([name2, kind, phaseName].filter(Boolean).join("/"), phaseId);
24881
+ phases.set(`id:${phaseId}`, phaseId);
24882
+ }
24883
+ }
24884
+ const phaseFiles = (reference, targetName) => {
24885
+ const value = text(reference);
24886
+ if (value === void 0) return null;
24887
+ const key = value.startsWith("id:") || !targetName ? value : `${targetName}/${value}`;
24888
+ const phase = objects[phases.get(key) ?? ""];
24889
+ return phase && typeof phase === "object" && !Array.isArray(phase) && Array.isArray(phase.files) ? phase.files : null;
24890
+ };
24891
+ for (const { refId, entry } of memberships) {
24892
+ const files = phaseFiles(isObject(entry) ? entry["build-phase"] : entry);
24893
+ files?.push(add({ isa: "PBXBuildFile", fileRef: refId }));
24894
+ }
24895
+ for (const { target, entry } of targets) {
24896
+ const name2 = text(entry.name) ?? "";
24897
+ target.buildConfigurationList = configurationList(
24898
+ settingsOf(entry["build-settings"]),
24899
+ new Map(
24900
+ items(entry["specialized-configurations"]).flatMap(
24901
+ (configuration) => isObject(configuration) && text(configuration.name) ? [[text(configuration.name), configuration.file]] : []
24902
+ )
24903
+ )
24904
+ );
24905
+ for (const dependency of items(entry.dependencies)) {
24906
+ const kind = isObject(dependency) ? text(dependency.kind) ?? "localTarget" : "localTarget";
24907
+ if (kind === "package" && isObject(dependency)) {
24908
+ ;
24909
+ target.dependencies.push(
24910
+ add({ isa: "PBXTargetDependency", productRef: productDependency(dependency) })
24911
+ );
24912
+ } else if (kind === "remoteTarget" && isObject(dependency)) {
24913
+ ;
24914
+ target.dependencies.push(
24915
+ add({
24916
+ isa: "PBXTargetDependency",
24917
+ targetProxy: proxy(dependency, text(dependency["target-id"]), "1")
24918
+ })
24919
+ );
24920
+ } else {
24921
+ const local = isObject(dependency) ? text(dependency.target) : text(dependency);
24922
+ const id = local ? targetIds.get(local) : void 0;
24923
+ if (id)
24924
+ target.dependencies.push(
24925
+ add({ isa: "PBXTargetDependency", target: id })
24926
+ );
24927
+ }
24928
+ }
24929
+ for (const member of items(entry["package-product-members"])) {
24930
+ if (!isObject(member)) continue;
24931
+ const dependency = productDependency(member);
24932
+ target.packageProductDependencies.push(dependency);
24933
+ const buildFile = member["build-phase"];
24934
+ phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name2)?.push(
24935
+ add({ isa: "PBXBuildFile", productRef: dependency })
24936
+ );
24937
+ }
24938
+ }
24939
+ for (const imported of items(json["imported-products"])) {
24940
+ if (!isObject(imported)) continue;
24941
+ const reference = add({
24942
+ isa: "PBXReferenceProxy",
24943
+ path: text(imported.name) ?? text(imported.path) ?? "",
24944
+ sourceTree: "BUILT_PRODUCTS_DIR",
24945
+ remoteRef: proxy(imported, text(imported["product-id"]), "2")
24946
+ });
24947
+ for (const membership of items(imported["target-membership"])) {
24948
+ phaseFiles(isObject(membership) ? membership["build-phase"] : membership)?.push(
24949
+ add({ isa: "PBXBuildFile", fileRef: reference })
24950
+ );
24951
+ }
24952
+ }
24953
+ for (const { id, folder } of folders) {
24954
+ const exceptions = [];
24955
+ for (const exception of items(folder["membership-exceptions"])) {
24956
+ if (!isObject(exception)) continue;
24957
+ const target = targetIds.get(text(exception.target) ?? "");
24958
+ if (!target) continue;
24959
+ exceptions.push(
24960
+ add({
24961
+ isa: "PBXFileSystemSynchronizedBuildFileExceptionSet",
24962
+ target,
24963
+ membershipExceptions: [
24964
+ ...items(exception.exclusions),
24965
+ ...items(exception.inclusions)
24966
+ ].flatMap((member) => typeof member === "string" ? [member] : [])
24967
+ })
24968
+ );
24969
+ }
24970
+ const group = objects[id];
24971
+ if (group && typeof group === "object" && !Array.isArray(group))
24972
+ group.exceptions = exceptions;
24973
+ for (const owner of items(folder["target-membership"])) {
24974
+ const target = targets.find(
24975
+ (candidate) => candidate.id === targetIds.get(text(owner) ?? "")
24976
+ );
24977
+ target?.target.fileSystemSynchronizedGroups?.push(id);
24978
+ }
24979
+ }
24980
+ const localizations = isObject(json.localizations) ? json.localizations : {};
24981
+ const project = add({
24982
+ isa: "PBXProject",
24983
+ mainGroup,
24984
+ projectDirPath: "",
24985
+ developmentRegion: text(localizations.development) ?? "en",
24986
+ buildConfigurationList: configurationList(
24987
+ settingsOf(json["build-settings"]),
24988
+ /* @__PURE__ */ new Map()
24989
+ ),
24990
+ targets: targets.map((entry) => entry.id),
24991
+ packageReferences: [...packageIds.values()],
24992
+ projectReferences: projectFiles.map((ProjectRef) => ({ ProjectRef }))
24993
+ });
24994
+ return { objects, rootObject: project };
24995
+ }
24996
+ function isJsonObject(value) {
24997
+ return typeof value === "object" && value !== null && !Array.isArray(value);
24998
+ }
24999
+ var import_node_path14, import_json5, isObject, text, items, PHASE_ISA;
25000
+ var init_xcode_json_project = __esm({
25001
+ "src/xcode-json-project.ts"() {
25002
+ "use strict";
25003
+ import_node_path14 = __toESM(require("node:path"), 1);
25004
+ import_json5 = __toESM(require("json5"), 1);
25005
+ isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25006
+ text = (value) => typeof value === "string" ? value : void 0;
25007
+ items = (value) => Array.isArray(value) ? value : [];
25008
+ PHASE_ISA = {
25009
+ "compile-sources": "PBXSourcesBuildPhase",
25010
+ resources: "PBXResourcesBuildPhase",
25011
+ frameworks: "PBXFrameworksBuildPhase",
25012
+ headers: "PBXHeadersBuildPhase",
25013
+ copy: "PBXCopyFilesBuildPhase",
25014
+ script: "PBXShellScriptBuildPhase"
25015
+ };
25016
+ }
25017
+ });
25018
+
24680
25019
  // src/xcode-project.ts
24681
- function parseOpenStepPlist(text) {
25020
+ function parseOpenStepPlist(text2) {
24682
25021
  let i = 0;
24683
25022
  const fail = (message) => {
24684
- const line = text.slice(0, i).split("\n").length;
25023
+ const line = text2.slice(0, i).split("\n").length;
24685
25024
  throw new Error(`project.pbxproj line ${line}: ${message}`);
24686
25025
  };
24687
25026
  const skip = () => {
24688
25027
  for (; ; ) {
24689
- const ch = text[i];
25028
+ const ch = text2[i];
24690
25029
  if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
24691
- else if (ch === "/" && text[i + 1] === "*") {
24692
- const end = text.indexOf("*/", i + 2);
25030
+ else if (ch === "/" && text2[i + 1] === "*") {
25031
+ const end = text2.indexOf("*/", i + 2);
24693
25032
  if (end < 0) fail("unterminated comment");
24694
25033
  i = end + 2;
24695
- } else if (ch === "/" && text[i + 1] === "/") {
24696
- const end = text.indexOf("\n", i);
24697
- i = end < 0 ? text.length : end + 1;
25034
+ } else if (ch === "/" && text2[i + 1] === "/") {
25035
+ const end = text2.indexOf("\n", i);
25036
+ i = end < 0 ? text2.length : end + 1;
24698
25037
  } else return;
24699
25038
  }
24700
25039
  };
@@ -24702,42 +25041,42 @@ function parseOpenStepPlist(text) {
24702
25041
  i++;
24703
25042
  let out = "";
24704
25043
  for (; ; ) {
24705
- const ch = text[i++];
25044
+ const ch = text2[i++];
24706
25045
  if (ch === void 0) fail("unterminated string");
24707
25046
  if (ch === '"') return out;
24708
25047
  if (ch !== "\\") {
24709
25048
  out += ch;
24710
25049
  continue;
24711
25050
  }
24712
- const next = text[i++];
25051
+ const next = text2[i++];
24713
25052
  if (next === "n") out += "\n";
24714
25053
  else if (next === "t") out += " ";
24715
25054
  else if (next === "r") out += "\r";
24716
25055
  else if (next === "U") {
24717
- out += String.fromCharCode(parseInt(text.slice(i, i + 4), 16));
25056
+ out += String.fromCharCode(parseInt(text2.slice(i, i + 4), 16));
24718
25057
  i += 4;
24719
25058
  } else out += next;
24720
25059
  }
24721
25060
  };
24722
25061
  const value = () => {
24723
25062
  skip();
24724
- const ch = text[i];
25063
+ const ch = text2[i];
24725
25064
  if (ch === "{") {
24726
25065
  i++;
24727
25066
  const dict = {};
24728
25067
  for (; ; ) {
24729
25068
  skip();
24730
- if (text[i] === "}") {
25069
+ if (text2[i] === "}") {
24731
25070
  i++;
24732
25071
  return dict;
24733
25072
  }
24734
25073
  const key = value();
24735
25074
  if (typeof key !== "string") fail("dictionary key is not a string");
24736
25075
  skip();
24737
- if (text[i++] !== "=") fail("expected =");
25076
+ if (text2[i++] !== "=") fail("expected =");
24738
25077
  dict[key] = value();
24739
25078
  skip();
24740
- if (text[i++] !== ";") fail("expected ;");
25079
+ if (text2[i++] !== ";") fail("expected ;");
24741
25080
  }
24742
25081
  }
24743
25082
  if (ch === "(") {
@@ -24745,26 +25084,26 @@ function parseOpenStepPlist(text) {
24745
25084
  const list2 = [];
24746
25085
  for (; ; ) {
24747
25086
  skip();
24748
- if (text[i] === ")") {
25087
+ if (text2[i] === ")") {
24749
25088
  i++;
24750
25089
  return list2;
24751
25090
  }
24752
25091
  list2.push(value());
24753
25092
  skip();
24754
- if (text[i] === ",") i++;
24755
- else if (text[i] !== ")") fail("expected , or )");
25093
+ if (text2[i] === ",") i++;
25094
+ else if (text2[i] !== ")") fail("expected , or )");
24756
25095
  }
24757
25096
  }
24758
25097
  if (ch === '"') return quoted();
24759
25098
  const start = i;
24760
- while (i < text.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text[i])) i++;
25099
+ while (i < text2.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text2[i])) i++;
24761
25100
  if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
24762
- return text.slice(start, i);
25101
+ return text2.slice(start, i);
24763
25102
  };
24764
- if (text.startsWith("// !$*UTF8*$!")) i = text.indexOf("\n") + 1;
25103
+ if (text2.startsWith("// !$*UTF8*$!")) i = text2.indexOf("\n") + 1;
24765
25104
  const root = value();
24766
25105
  skip();
24767
- if (i !== text.length) fail("trailing content");
25106
+ if (i !== text2.length) fail("trailing content");
24768
25107
  return root;
24769
25108
  }
24770
25109
  function walkFiles(dir) {
@@ -24772,7 +25111,7 @@ function walkFiles(dir) {
24772
25111
  const out = [];
24773
25112
  for (const entry of import_node_fs14.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
24774
25113
  if (entry.name.startsWith(".")) continue;
24775
- const full = import_node_path14.default.join(dir, entry.name);
25114
+ const full = import_node_path15.default.join(dir, entry.name);
24776
25115
  if (entry.isDirectory()) out.push(...walkFiles(full));
24777
25116
  else if (entry.isFile()) out.push(full);
24778
25117
  }
@@ -24788,7 +25127,7 @@ function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
24788
25127
  if (include) {
24789
25128
  Object.assign(
24790
25129
  settings,
24791
- readXcconfig(import_node_path14.default.resolve(import_node_path14.default.dirname(file), include[1]), seen)
25130
+ readXcconfig(import_node_path15.default.resolve(import_node_path15.default.dirname(file), include[1]), seen)
24792
25131
  );
24793
25132
  continue;
24794
25133
  }
@@ -24834,22 +25173,22 @@ function applyOperator(value, operator) {
24834
25173
  }
24835
25174
  throw new Error(`unsupported build setting operator :${operator}`);
24836
25175
  }
24837
- function decodeXml(text) {
24838
- return text.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
25176
+ function decodeXml(text2) {
25177
+ return text2.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
24839
25178
  }
24840
25179
  function workspaceReferences(workspace) {
24841
- const data = import_node_path14.default.join(workspace, "contents.xcworkspacedata");
25180
+ const data = import_node_path15.default.join(workspace, "contents.xcworkspacedata");
24842
25181
  if (!import_node_fs14.default.existsSync(data))
24843
25182
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
24844
- const container = import_node_path14.default.dirname(workspace);
25183
+ const container = import_node_path15.default.dirname(workspace);
24845
25184
  const locate = (location2, base) => {
24846
25185
  const colon = location2.indexOf(":");
24847
25186
  const kind = location2.slice(0, colon);
24848
25187
  const rest = location2.slice(colon + 1);
24849
- if (kind === "group") return import_node_path14.default.resolve(base, rest);
24850
- if (kind === "container" || kind === "self") return import_node_path14.default.resolve(container, rest);
24851
- if (kind === "absolute") return import_node_path14.default.resolve(rest);
24852
- throw new Error(`${import_node_path14.default.basename(workspace)} has an unsupported location ${location2}`);
25188
+ if (kind === "group") return import_node_path15.default.resolve(base, rest);
25189
+ if (kind === "container" || kind === "self") return import_node_path15.default.resolve(container, rest);
25190
+ if (kind === "absolute") return import_node_path15.default.resolve(rest);
25191
+ throw new Error(`${import_node_path15.default.basename(workspace)} has an unsupported location ${location2}`);
24853
25192
  };
24854
25193
  const groups = [container];
24855
25194
  const references = [];
@@ -24866,15 +25205,24 @@ function workspaceReferences(workspace) {
24866
25205
  }
24867
25206
  return references;
24868
25207
  }
25208
+ function xcodeProjectFile(xcodeproj) {
25209
+ for (const name2 of ["project.pbxproj", "project.xcproj"]) {
25210
+ const file = import_node_path15.default.join(xcodeproj, name2);
25211
+ if (import_node_fs14.default.existsSync(file)) return file;
25212
+ }
25213
+ return null;
25214
+ }
24869
25215
  function loadProject(xcodeproj) {
24870
- const pbxproj = import_node_path14.default.join(xcodeproj, "project.pbxproj");
24871
- if (!import_node_fs14.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
24872
- const mtimeMs = import_node_fs14.default.statSync(pbxproj).mtimeMs;
24873
- const cached4 = loaded.get(pbxproj);
25216
+ const projectFile = xcodeProjectFile(xcodeproj);
25217
+ if (!projectFile)
25218
+ throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
25219
+ const mtimeMs = import_node_fs14.default.statSync(projectFile).mtimeMs;
25220
+ const cached4 = loaded.get(projectFile);
24874
25221
  if (cached4?.mtimeMs === mtimeMs) return cached4.project;
24875
- const root = parseOpenStepPlist(import_node_fs14.default.readFileSync(pbxproj, "utf8"));
25222
+ const source = import_node_fs14.default.readFileSync(projectFile, "utf8");
25223
+ const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
24876
25224
  if (!isDict(root) || !isDict(root.objects)) {
24877
- throw new Error(`${pbxproj} has no objects table`);
25225
+ throw new Error(`${projectFile} has no objects table`);
24878
25226
  }
24879
25227
  const objects = root.objects;
24880
25228
  const object = (id) => {
@@ -24883,10 +25231,10 @@ function loadProject(xcodeproj) {
24883
25231
  };
24884
25232
  const project = object(str(root.rootObject));
24885
25233
  if (!project || project.isa !== "PBXProject") {
24886
- throw new Error(`${pbxproj} has no PBXProject root`);
25234
+ throw new Error(`${projectFile} has no PBXProject root`);
24887
25235
  }
24888
25236
  const projectDir = import_node_fs14.default.realpathSync(
24889
- import_node_path14.default.resolve(import_node_path14.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
25237
+ import_node_path15.default.resolve(import_node_path15.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
24890
25238
  );
24891
25239
  const parent = /* @__PURE__ */ new Map();
24892
25240
  for (const [id, entry] of Object.entries(objects)) {
@@ -24904,18 +25252,26 @@ function loadProject(xcodeproj) {
24904
25252
  const own = str(entry.path) ?? "";
24905
25253
  const tree = str(entry.sourceTree) ?? "<group>";
24906
25254
  if (tree === "<absolute>") result2 = own;
24907
- else if (tree === "SOURCE_ROOT") result2 = import_node_path14.default.join(projectDir, own);
25255
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path15.default.join(projectDir, own);
24908
25256
  else if (tree === "<group>") {
24909
25257
  const up = parent.get(id);
24910
25258
  const base = up ? resolvePath(up) : projectDir;
24911
- result2 = base === null ? null : import_node_path14.default.join(base, own);
25259
+ result2 = base === null ? null : import_node_path15.default.join(base, own);
24912
25260
  }
24913
25261
  }
24914
25262
  resolvedPaths.set(id, result2);
24915
25263
  return result2;
24916
25264
  };
24917
- const result = { xcodeproj, pbxproj, objects, project, projectDir, object, resolvePath };
24918
- loaded.set(pbxproj, { mtimeMs, project: result });
25265
+ const result = {
25266
+ xcodeproj,
25267
+ projectFile,
25268
+ objects,
25269
+ project,
25270
+ projectDir,
25271
+ object,
25272
+ resolvePath
25273
+ };
25274
+ loaded.set(projectFile, { mtimeMs, project: result });
24919
25275
  return result;
24920
25276
  }
24921
25277
  function targetSettings(ref, builtins) {
@@ -25029,7 +25385,7 @@ function targetMembers(ref) {
25029
25385
  }
25030
25386
  }
25031
25387
  const addSynchronized = (folder, relative3) => {
25032
- const file = import_node_path14.default.join(folder, relative3);
25388
+ const file = import_node_path15.default.join(folder, relative3);
25033
25389
  if (NEVER_MEMBER.test(relative3)) return;
25034
25390
  if (file.endsWith(".swift")) {
25035
25391
  if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
@@ -25054,7 +25410,7 @@ function targetMembers(ref) {
25054
25410
  }
25055
25411
  if (owned.has(groupId)) {
25056
25412
  for (const file of walkFiles(folder)) {
25057
- const relative3 = import_node_path14.default.relative(folder, file).split(import_node_path14.default.sep).join("/");
25413
+ const relative3 = import_node_path15.default.relative(folder, file).split(import_node_path15.default.sep).join("/");
25058
25414
  if ([...exceptions].some(
25059
25415
  (exception) => relative3 === exception || relative3.startsWith(`${exception}/`)
25060
25416
  ))
@@ -25063,12 +25419,12 @@ function targetMembers(ref) {
25063
25419
  }
25064
25420
  } else {
25065
25421
  for (const relative3 of exceptions) {
25066
- const file = import_node_path14.default.join(folder, relative3);
25422
+ const file = import_node_path15.default.join(folder, relative3);
25067
25423
  if (isDirectory(file)) {
25068
25424
  for (const inner of walkFiles(file))
25069
25425
  addSynchronized(
25070
25426
  folder,
25071
- import_node_path14.default.relative(folder, inner).split(import_node_path14.default.sep).join("/")
25427
+ import_node_path15.default.relative(folder, inner).split(import_node_path15.default.sep).join("/")
25072
25428
  );
25073
25429
  } else if (import_node_fs14.default.existsSync(file)) addSynchronized(folder, relative3);
25074
25430
  }
@@ -25083,8 +25439,8 @@ function targetMembers(ref) {
25083
25439
  function commonAncestor(dirs) {
25084
25440
  let common = dirs[0];
25085
25441
  for (const dir of dirs) {
25086
- while (common !== import_node_path14.default.dirname(common) && import_node_path14.default.relative(common, dir).startsWith(".."))
25087
- common = import_node_path14.default.dirname(common);
25442
+ while (common !== import_node_path15.default.dirname(common) && import_node_path15.default.relative(common, dir).startsWith(".."))
25443
+ common = import_node_path15.default.dirname(common);
25088
25444
  }
25089
25445
  return common;
25090
25446
  }
@@ -25093,9 +25449,9 @@ function workspaceProjects(xcodeprojOrWorkspace) {
25093
25449
  const projects2 = [];
25094
25450
  const projectAt = /* @__PURE__ */ new Map();
25095
25451
  const addProject = (xcodeproj) => {
25096
- const key = import_node_path14.default.resolve(xcodeproj);
25097
- if (projectAt.has(key) || key.split(import_node_path14.default.sep).includes("Pods")) return;
25098
- if (!import_node_fs14.default.existsSync(import_node_path14.default.join(key, "project.pbxproj"))) return;
25452
+ const key = import_node_path15.default.resolve(xcodeproj);
25453
+ if (projectAt.has(key) || key.split(import_node_path15.default.sep).includes("Pods")) return;
25454
+ if (!xcodeProjectFile(key)) return;
25099
25455
  const project = loadProject(key);
25100
25456
  projectAt.set(key, project);
25101
25457
  projects2.push(project);
@@ -25111,10 +25467,21 @@ function workspaceProjects(xcodeprojOrWorkspace) {
25111
25467
  for (const reference of listed)
25112
25468
  if (reference.endsWith(".xcodeproj")) addProject(reference);
25113
25469
  if (projects2.length === 0) {
25114
- throw new Error(`${import_node_path14.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
25470
+ throw new Error(`${import_node_path15.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
25115
25471
  }
25116
25472
  return { listed, projects: projects2, projectAt };
25117
25473
  }
25474
+ function nativeTargets(project) {
25475
+ let refs = targetRefs.get(project);
25476
+ if (!refs) {
25477
+ refs = list(project.project.targets).flatMap((id) => {
25478
+ const target = project.object(id);
25479
+ return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
25480
+ });
25481
+ targetRefs.set(project, refs);
25482
+ }
25483
+ return refs;
25484
+ }
25118
25485
  function listXcodeAppTargets(xcodeprojOrWorkspace) {
25119
25486
  return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(nativeTargets).filter((ref) => ref.target.productType === APPLICATION).map((ref) => str(ref.target.name) ?? ref.id);
25120
25487
  }
@@ -25124,7 +25491,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25124
25491
  const allTargets = projects2.flatMap(nativeTargets);
25125
25492
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
25126
25493
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
25127
- const container = import_node_path14.default.basename(xcodeprojOrWorkspace);
25494
+ const container = import_node_path15.default.basename(xcodeprojOrWorkspace);
25128
25495
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
25129
25496
  if (named.length !== 1) {
25130
25497
  throw new Error(
@@ -25136,14 +25503,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25136
25503
  for (const ref of allTargets) {
25137
25504
  const product = ref.project.object(str(ref.target.productReference));
25138
25505
  const file = str(product?.path);
25139
- if (file && !byProduct.has(import_node_path14.default.basename(file)))
25140
- byProduct.set(import_node_path14.default.basename(file), ref);
25506
+ if (file && !byProduct.has(import_node_path15.default.basename(file)))
25507
+ byProduct.set(import_node_path15.default.basename(file), ref);
25141
25508
  }
25142
25509
  const proxied = (project, proxyId) => {
25143
25510
  const proxy = project.object(proxyId);
25144
25511
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
25145
25512
  const portal = str(proxy.containerPortal);
25146
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path14.default.resolve(project.resolvePath(portal ?? "") ?? ""));
25513
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path15.default.resolve(project.resolvePath(portal ?? "") ?? ""));
25147
25514
  const remote = str(proxy.remoteGlobalIDString);
25148
25515
  if (!owner || !remote) return void 0;
25149
25516
  return nativeTargets(owner).find(
@@ -25164,7 +25531,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25164
25531
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
25165
25532
  for (const buildFileId of list(phase.files)) {
25166
25533
  const file = project.object(str(project.object(buildFileId)?.fileRef));
25167
- const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path14.default.basename(str(file.path) ?? "")) : void 0;
25534
+ const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path15.default.basename(str(file.path) ?? "")) : void 0;
25168
25535
  if (resolved) found.push(resolved);
25169
25536
  }
25170
25537
  }
@@ -25185,7 +25552,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25185
25552
  const name2 = str(ref.target.name) ?? ref.id;
25186
25553
  const { get: settings2, keys } = targetSettings(ref, {
25187
25554
  TARGET_NAME: name2,
25188
- PROJECT_NAME: import_node_path14.default.basename(ref.project.xcodeproj, ".xcodeproj"),
25555
+ PROJECT_NAME: import_node_path15.default.basename(ref.project.xcodeproj, ".xcodeproj"),
25189
25556
  SRCROOT: ref.project.projectDir,
25190
25557
  SOURCE_ROOT: ref.project.projectDir,
25191
25558
  PROJECT_DIR: ref.project.projectDir,
@@ -25216,7 +25583,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25216
25583
  }
25217
25584
  return value;
25218
25585
  };
25219
- const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path14.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
25586
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path15.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
25220
25587
  const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs14.default.readFileSync(infoPlistFile, "utf8")) : {};
25221
25588
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
25222
25589
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
@@ -25235,12 +25602,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25235
25602
  };
25236
25603
  }
25237
25604
  const localPackageDirs = [
25238
- ...listed.filter((reference) => import_node_fs14.default.existsSync(import_node_path14.default.join(reference, "Package.swift"))),
25605
+ ...listed.filter((reference) => import_node_fs14.default.existsSync(import_node_path15.default.join(reference, "Package.swift"))),
25239
25606
  ...projects2.flatMap(
25240
25607
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
25241
25608
  if (!isDict(entry)) return [];
25242
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path14.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
25243
- return candidate && import_node_fs14.default.existsSync(import_node_path14.default.join(candidate, "Package.swift")) ? [candidate] : [];
25609
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path15.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
25610
+ return candidate && import_node_fs14.default.existsSync(import_node_path15.default.join(candidate, "Package.swift")) ? [candidate] : [];
25244
25611
  })
25245
25612
  )
25246
25613
  ];
@@ -25249,7 +25616,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25249
25616
  const cached4 = graphs.get(dir);
25250
25617
  if (cached4) return cached4;
25251
25618
  const graph = swiftManifestGraph(
25252
- import_node_fs14.default.readFileSync(import_node_path14.default.join(dir, "Package.swift"), "utf8")
25619
+ import_node_fs14.default.readFileSync(import_node_path15.default.join(dir, "Package.swift"), "utf8")
25253
25620
  );
25254
25621
  graphs.set(dir, graph);
25255
25622
  return graph;
@@ -25284,7 +25651,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25284
25651
  });
25285
25652
  } else if (reference?.isa === "XCLocalSwiftPackageReference") {
25286
25653
  localPackages.add(
25287
- import_node_path14.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
25654
+ import_node_path15.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
25288
25655
  );
25289
25656
  } else if (localProducts.has(product)) {
25290
25657
  localPackages.add(localProducts.get(product));
@@ -25296,8 +25663,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25296
25663
  const dir = pending.pop();
25297
25664
  const graph = graphOf(dir);
25298
25665
  for (const relative3 of graph.packagePaths) {
25299
- const next = import_node_path14.default.resolve(dir, relative3);
25300
- if (localPackages.has(next) || !import_node_fs14.default.existsSync(import_node_path14.default.join(next, "Package.swift")))
25666
+ const next = import_node_path15.default.resolve(dir, relative3);
25667
+ if (localPackages.has(next) || !import_node_fs14.default.existsSync(import_node_path15.default.join(next, "Package.swift")))
25301
25668
  continue;
25302
25669
  localPackages.add(next);
25303
25670
  pending.push(next);
@@ -25311,8 +25678,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25311
25678
  }
25312
25679
  }
25313
25680
  }
25314
- const resolvedFile = import_node_path14.default.join(
25315
- workspace ?? import_node_path14.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
25681
+ const resolvedFile = import_node_path15.default.join(
25682
+ workspace ?? import_node_path15.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
25316
25683
  "xcshareddata",
25317
25684
  "swiftpm",
25318
25685
  "Package.resolved"
@@ -25322,12 +25689,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25322
25689
  ...module2,
25323
25690
  rootDir: commonAncestor(
25324
25691
  [
25325
- workspace ? import_node_path14.default.dirname(workspace) : app.project.projectDir,
25692
+ workspace ? import_node_path15.default.dirname(workspace) : app.project.projectDir,
25326
25693
  ...used.map((project) => project.projectDir),
25327
25694
  ...localPackages
25328
25695
  ].map((dir) => import_node_fs14.default.realpathSync(dir))
25329
25696
  ),
25330
- pbxprojs: [...new Set(used.map((project) => project.pbxproj))].sort(),
25697
+ projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
25331
25698
  infoPlist: import_plist3.default.build(info),
25332
25699
  infoPlistFile,
25333
25700
  frameworks,
@@ -25338,14 +25705,15 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25338
25705
  appTargets: appTargetNames
25339
25706
  };
25340
25707
  }
25341
- var import_node_fs14, import_node_path14, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, nativeTargets;
25708
+ var import_node_fs14, import_node_path15, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
25342
25709
  var init_xcode_project = __esm({
25343
25710
  "src/xcode-project.ts"() {
25344
25711
  "use strict";
25345
25712
  import_node_fs14 = __toESM(require("node:fs"), 1);
25346
- import_node_path14 = __toESM(require("node:path"), 1);
25713
+ import_node_path15 = __toESM(require("node:path"), 1);
25347
25714
  import_plist3 = __toESM(require_plist(), 1);
25348
25715
  init_swift_package();
25716
+ init_xcode_json_project();
25349
25717
  isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25350
25718
  str = (value) => typeof value === "string" ? value : void 0;
25351
25719
  list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
@@ -25365,26 +25733,23 @@ var init_xcode_project = __esm({
25365
25733
  };
25366
25734
  isDirectory = (dir) => import_node_fs14.default.existsSync(dir) && import_node_fs14.default.statSync(dir).isDirectory();
25367
25735
  loaded = /* @__PURE__ */ new Map();
25368
- nativeTargets = (project) => list(project.project.targets).flatMap((id) => {
25369
- const target = project.object(id);
25370
- return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
25371
- });
25736
+ targetRefs = /* @__PURE__ */ new WeakMap();
25372
25737
  }
25373
25738
  });
25374
25739
 
25375
25740
  // src/swift-host.ts
25376
25741
  function swiftPackageId(packagePath) {
25377
- return import_node_path15.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
25742
+ return import_node_path16.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
25378
25743
  }
25379
25744
  function nativeSourceDescriptor(packagePath) {
25380
25745
  packagePath = import_node_fs15.default.realpathSync(packagePath);
25381
- const file = import_node_path15.default.join(packagePath, NATIVE_DESCRIPTOR);
25746
+ const file = import_node_path16.default.join(packagePath, NATIVE_DESCRIPTOR);
25382
25747
  if (!import_node_fs15.default.existsSync(file)) return null;
25383
25748
  const value = JSON.parse(
25384
25749
  readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
25385
25750
  );
25386
25751
  const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
25387
- if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs15.default.existsSync(import_node_path15.default.join(packagePath, NATIVE_GLUE))) {
25752
+ if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs15.default.existsSync(import_node_path16.default.join(packagePath, NATIVE_GLUE))) {
25388
25753
  throw invalid();
25389
25754
  }
25390
25755
  if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
@@ -25435,19 +25800,19 @@ function remotePackages(entry, app) {
25435
25800
  }
25436
25801
  function xcodeInputKey(layout, file, relative3) {
25437
25802
  const owner = layout.targetDirs.get(file);
25438
- if (owner) return import_node_path15.default.posix.join(owner, relative3);
25439
- return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path15.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
25803
+ if (owner) return import_node_path16.default.posix.join(owner, relative3);
25804
+ return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path16.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
25440
25805
  }
25441
25806
  function xcodeLayout(root) {
25442
25807
  const registered = xcodeProjects.get(root);
25443
25808
  if (!registered) return null;
25444
25809
  const app = readXcodeAppTarget(registered.xcodeproj, registered.target);
25445
- const files = /* @__PURE__ */ new Set([...app.pbxprojs, ...app.sources, ...app.resources]);
25810
+ const files = /* @__PURE__ */ new Set([...app.projectFiles, ...app.sources, ...app.resources]);
25446
25811
  if (app.infoPlistFile) files.add(app.infoPlistFile);
25447
25812
  const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
25448
25813
  const targets = [];
25449
25814
  for (const framework of app.frameworks) {
25450
- const dir = import_node_path15.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
25815
+ const dir = import_node_path16.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
25451
25816
  for (const file of framework.sources) {
25452
25817
  if (targetDirs.has(file)) continue;
25453
25818
  targetDirs.set(file, dir);
@@ -25463,21 +25828,21 @@ function xcodeLayout(root) {
25463
25828
  });
25464
25829
  }
25465
25830
  for (const dir of app.localPackages) {
25466
- const manifestFile = import_node_path15.default.join(dir, "Package.swift");
25831
+ const manifestFile = import_node_path16.default.join(dir, "Package.swift");
25467
25832
  files.add(manifestFile);
25468
25833
  const manifest = import_node_fs15.default.readFileSync(manifestFile, "utf8");
25469
- const prefix = import_node_path15.default.relative(root, dir).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
25834
+ const prefix = import_node_path16.default.relative(root, dir).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep);
25470
25835
  const declared = swiftManifestTargets(manifest).filter((target) => !target.executable);
25471
25836
  const all = declared.flatMap(
25472
- (target) => sourceTreeFiles(import_node_path15.default.join(dir, target.path), root).map(
25473
- (file) => import_node_path15.default.relative(dir, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
25837
+ (target) => sourceTreeFiles(import_node_path16.default.join(dir, target.path), root).map(
25838
+ (file) => import_node_path16.default.relative(dir, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
25474
25839
  )
25475
25840
  );
25476
25841
  for (const target of swiftManifestTargets(manifest, all)) {
25477
25842
  if (target.executable) continue;
25478
- targets.push({ ...target, path: import_node_path15.default.posix.join(prefix, target.path) });
25843
+ targets.push({ ...target, path: import_node_path16.default.posix.join(prefix, target.path) });
25479
25844
  for (const relative3 of all) {
25480
- if (relative3.startsWith(`${target.path}/`)) files.add(import_node_path15.default.join(dir, relative3));
25845
+ if (relative3.startsWith(`${target.path}/`)) files.add(import_node_path16.default.join(dir, relative3));
25481
25846
  }
25482
25847
  }
25483
25848
  }
@@ -25485,9 +25850,9 @@ function xcodeLayout(root) {
25485
25850
  for (const target of remote.targets) {
25486
25851
  targets.push({
25487
25852
  ...target,
25488
- path: import_node_path15.default.posix.join(
25853
+ path: import_node_path16.default.posix.join(
25489
25854
  XCODE_PACKAGES_DIR,
25490
- import_node_path15.default.relative(import_node_path15.default.join(root, REMOTE_CHECKOUTS), target.dir).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
25855
+ import_node_path16.default.relative(import_node_path16.default.join(root, REMOTE_CHECKOUTS), target.dir).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
25491
25856
  )
25492
25857
  });
25493
25858
  for (const file of target.files) files.add(file);
@@ -25525,15 +25890,15 @@ function sourceTreeFiles(dir, canonicalRoot) {
25525
25890
  for (const entry of import_node_fs15.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
25526
25891
  if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
25527
25892
  continue;
25528
- const full = import_node_path15.default.join(dir2, entry.name);
25893
+ const full = import_node_path16.default.join(dir2, entry.name);
25529
25894
  if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
25530
25895
  const real = import_node_fs15.default.realpathSync(full);
25531
- const relative3 = import_node_path15.default.relative(canonicalRoot, real);
25532
- if (relative3.startsWith(`..${import_node_path15.default.sep}`) || relative3 === ".." || import_node_path15.default.isAbsolute(relative3)) {
25896
+ const relative3 = import_node_path16.default.relative(canonicalRoot, real);
25897
+ if (relative3.startsWith(`..${import_node_path16.default.sep}`) || relative3 === ".." || import_node_path16.default.isAbsolute(relative3)) {
25533
25898
  throw new Error(`swift input escapes the selected package: ${full}`);
25534
25899
  }
25535
25900
  if (entry.isDirectory()) {
25536
- if (import_node_fs15.default.existsSync(import_node_path15.default.join(full, "Package.swift"))) continue;
25901
+ if (import_node_fs15.default.existsSync(import_node_path16.default.join(full, "Package.swift"))) continue;
25537
25902
  walk2(full);
25538
25903
  } else if (entry.isFile()) {
25539
25904
  found.push(full);
@@ -25546,16 +25911,16 @@ function sourceTreeFiles(dir, canonicalRoot) {
25546
25911
  }
25547
25912
  function readPackageFile(root, file, maxBytes) {
25548
25913
  const canonicalRoot = import_node_fs15.default.realpathSync(root);
25549
- const relative3 = import_node_path15.default.relative(canonicalRoot, import_node_fs15.default.realpathSync(file));
25550
- if (relative3 === ".." || relative3.startsWith(`..${import_node_path15.default.sep}`) || import_node_path15.default.isAbsolute(relative3)) {
25914
+ const relative3 = import_node_path16.default.relative(canonicalRoot, import_node_fs15.default.realpathSync(file));
25915
+ if (relative3 === ".." || relative3.startsWith(`..${import_node_path16.default.sep}`) || import_node_path16.default.isAbsolute(relative3)) {
25551
25916
  throw new Error(`swift input escapes the selected package: ${file}`);
25552
25917
  }
25553
- let ancestor = import_node_path15.default.resolve(file);
25918
+ let ancestor = import_node_path16.default.resolve(file);
25554
25919
  while (ancestor !== canonicalRoot) {
25555
25920
  if (import_node_fs15.default.lstatSync(ancestor).isSymbolicLink()) {
25556
25921
  throw new Error(`swift input is a symlink: ${ancestor}`);
25557
25922
  }
25558
- const parent = import_node_path15.default.dirname(ancestor);
25923
+ const parent = import_node_path16.default.dirname(ancestor);
25559
25924
  if (parent === ancestor)
25560
25925
  throw new Error(`swift input escapes the selected package: ${file}`);
25561
25926
  ancestor = parent;
@@ -25590,14 +25955,14 @@ function sourceFiles(root) {
25590
25955
  }
25591
25956
  function resourceCandidateFiles(root) {
25592
25957
  return packageFiles(root).filter(
25593
- (file) => !file.endsWith(".swift") && import_node_path15.default.basename(file) !== "project.pbxproj"
25958
+ (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path16.default.basename(file))
25594
25959
  );
25595
25960
  }
25596
25961
  function buildSwiftResourceTable(project, baseUrl) {
25597
25962
  const limits = inputLimits(Boolean(project.hosted));
25598
25963
  const absolute = resourceCandidateFiles(project.packagePath);
25599
25964
  const relative3 = absolute.map(
25600
- (file) => import_node_path15.default.relative(project.packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
25965
+ (file) => import_node_path16.default.relative(project.packagePath, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
25601
25966
  );
25602
25967
  const byRelative = new Map(absolute.map((file, index) => [relative3[index], file]));
25603
25968
  const readContents = (candidate) => {
@@ -25625,10 +25990,10 @@ function buildSwiftResourceTable(project, baseUrl) {
25625
25990
  const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
25626
25991
  imageBytes += bytes.length;
25627
25992
  const hash = (0, import_node_crypto5.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
25628
- const ext = import_node_path15.default.posix.extname(file).toLowerCase();
25993
+ const ext = import_node_path16.default.posix.extname(file).toLowerCase();
25629
25994
  table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
25630
25995
  images[name2] = {
25631
- file: import_node_path15.default.posix.basename(file),
25996
+ file: import_node_path16.default.posix.basename(file),
25632
25997
  data: bytes.toString("base64")
25633
25998
  };
25634
25999
  watched.push(file);
@@ -25655,7 +26020,7 @@ function buildSwiftBundleFiles(packagePath, hosted) {
25655
26020
  packagePath = import_node_fs15.default.realpathSync(packagePath);
25656
26021
  const limits = inputLimits(hosted);
25657
26022
  const relative3 = resourceCandidateFiles(packagePath).map(
25658
- (file) => import_node_path15.default.relative(packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
26023
+ (file) => import_node_path16.default.relative(packagePath, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
25659
26024
  );
25660
26025
  const files = {};
25661
26026
  const watched = [];
@@ -25669,12 +26034,12 @@ function buildSwiftBundleFiles(packagePath, hosted) {
25669
26034
  total += bytes.length;
25670
26035
  if (xcode.app.infoPlistFile)
25671
26036
  watched.push(
25672
- import_node_path15.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path15.default.sep).join("/")
26037
+ import_node_path16.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path16.default.sep).join("/")
25673
26038
  );
25674
26039
  }
25675
26040
  for (const { base, file } of enumerateBundleJson(relative3)) {
25676
26041
  watched.push(file);
25677
- const disk = import_node_path15.default.join(packagePath, ...file.split("/"));
26042
+ const disk = import_node_path16.default.join(packagePath, ...file.split("/"));
25678
26043
  if (Object.keys(files).length >= limits.resources || total + import_node_fs15.default.statSync(disk).size > limits.resourceTotalBytes) {
25679
26044
  throw new Error(
25680
26045
  `swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
@@ -25695,7 +26060,7 @@ function linkedModuleRoots(packagePath) {
25695
26060
  try {
25696
26061
  manifest = readPackageFile(
25697
26062
  packagePath,
25698
- import_node_path15.default.join(packagePath, "Package.swift"),
26063
+ import_node_path16.default.join(packagePath, "Package.swift"),
25699
26064
  MAX_SWIFT_COMPILE_SOURCE_BYTES
25700
26065
  ).toString("utf8");
25701
26066
  } catch {
@@ -25704,8 +26069,8 @@ function linkedModuleRoots(packagePath) {
25704
26069
  const roots = /* @__PURE__ */ new Set();
25705
26070
  const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
25706
26071
  for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
25707
- const root = import_node_path15.default.resolve(packagePath, match[1]);
25708
- if (import_node_fs15.default.existsSync(import_node_path15.default.join(root, "Package.swift"))) roots.add(root);
26072
+ const root = import_node_path16.default.resolve(packagePath, match[1]);
26073
+ if (import_node_fs15.default.existsSync(import_node_path16.default.join(root, "Package.swift"))) roots.add(root);
25709
26074
  }
25710
26075
  return [...roots].sort();
25711
26076
  }
@@ -25714,18 +26079,18 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
25714
26079
  hash.update(packagePath);
25715
26080
  const projectInputs = new Set(packageFiles(packagePath));
25716
26081
  for (const file of [...projectInputs].sort()) {
25717
- hash.update(import_node_path15.default.relative(packagePath, file));
26082
+ hash.update(import_node_path16.default.relative(packagePath, file));
25718
26083
  const stat2 = import_node_fs15.default.statSync(file);
25719
26084
  hash.update(`${stat2.mtimeMs}/${stat2.ctimeMs}/${stat2.size}`);
25720
26085
  }
25721
26086
  const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
25722
- (root) => import_node_fs15.default.existsSync(import_node_path15.default.join(root, "toolchain.json"))
26087
+ (root) => import_node_fs15.default.existsSync(import_node_path16.default.join(root, "toolchain.json"))
25723
26088
  );
25724
26089
  if (moduleRoot) {
25725
26090
  hash.update(moduleRoot);
25726
26091
  for (const relative3 of swiftModuleInputFiles(moduleRoot)) {
25727
26092
  hash.update(relative3);
25728
- hash.update(String(import_node_fs15.default.statSync(import_node_path15.default.join(moduleRoot, relative3)).mtimeMs));
26093
+ hash.update(String(import_node_fs15.default.statSync(import_node_path16.default.join(moduleRoot, relative3)).mtimeMs));
25729
26094
  }
25730
26095
  }
25731
26096
  return hash.digest("hex").slice(0, 16);
@@ -25737,8 +26102,8 @@ function packageSources(packagePath) {
25737
26102
  const xcode = xcodeLayout(packagePath);
25738
26103
  const files = {};
25739
26104
  for (const file of sourceFiles(packagePath)) {
25740
- const relative3 = import_node_path15.default.relative(packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
25741
- if (xcode && import_node_path15.default.basename(file) === "Package.swift") continue;
26105
+ const relative3 = import_node_path16.default.relative(packagePath, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep);
26106
+ if (xcode && import_node_path16.default.basename(file) === "Package.swift") continue;
25742
26107
  files[xcode ? xcodeInputKey(xcode, file, relative3) : relative3] = readPackageFile(
25743
26108
  packagePath,
25744
26109
  file,
@@ -25755,7 +26120,7 @@ function packageSnapshot(project) {
25755
26120
  files,
25756
26121
  resourcePaths: swiftImplicitResourcePaths(
25757
26122
  resourceCandidateFiles(project.packagePath).map(
25758
- (file) => import_node_path15.default.relative(project.packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
26123
+ (file) => import_node_path16.default.relative(project.packagePath, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
25759
26124
  )
25760
26125
  ),
25761
26126
  resources: buildSwiftResourceTable(project, ""),
@@ -25764,7 +26129,7 @@ function packageSnapshot(project) {
25764
26129
  ...native ? {
25765
26130
  glue: readPackageFile(
25766
26131
  project.packagePath,
25767
- import_node_path15.default.join(project.packagePath, NATIVE_GLUE),
26132
+ import_node_path16.default.join(project.packagePath, NATIVE_GLUE),
25768
26133
  MAX_SWIFT_COMPILE_SOURCE_BYTES
25769
26134
  ).toString("utf8")
25770
26135
  } : {}
@@ -25800,7 +26165,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
25800
26165
  package: content
25801
26166
  };
25802
26167
  const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
25803
- (root) => import_node_fs15.default.existsSync(import_node_path15.default.join(root, "toolchain.json"))
26168
+ (root) => import_node_fs15.default.existsSync(import_node_path16.default.join(root, "toolchain.json"))
25804
26169
  ) ?? await swiftDistributionRoot();
25805
26170
  if (!moduleRoot)
25806
26171
  return {
@@ -25826,10 +26191,10 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
25826
26191
  // server and a capture, or two checkouts) build each other's sources. so
25827
26192
  // each app and module checkout gets its own root, which keeps the same
25828
26193
  // app's incremental build across restarts.
25829
- buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path15.default.join(
26194
+ buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path16.default.join(
25830
26195
  import_node_os5.default.tmpdir(),
25831
26196
  "contrast-swift-build",
25832
- (0, import_node_crypto5.createHash)("sha256").update(`${moduleRoot}\0${import_node_path15.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
26197
+ (0, import_node_crypto5.createHash)("sha256").update(`${moduleRoot}\0${import_node_path16.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
25833
26198
  ),
25834
26199
  moduleRoot,
25835
26200
  ...toolchain
@@ -25900,7 +26265,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
25900
26265
  const auth = hosted ? null : resolveCliAuth();
25901
26266
  if (!hosted && (!auth || auth.kind === "github")) {
25902
26267
  throw new Error(
25903
- `compiling ${import_node_path15.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
26268
+ `compiling ${import_node_path16.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
25904
26269
  );
25905
26270
  }
25906
26271
  const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
@@ -25916,10 +26281,10 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
25916
26281
  });
25917
26282
  if (!submit) throw new Error("swift compile: no credential to submit with");
25918
26283
  const sources = Object.values(snapshot.files);
25919
- const bytes = sources.reduce((total2, text) => total2 + Buffer.byteLength(text), 0);
26284
+ const bytes = sources.reduce((total2, text2) => total2 + Buffer.byteLength(text2), 0);
25920
26285
  if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
25921
26286
  throw new Error(
25922
- `${import_node_path15.default.basename(packagePath)} has ${sources.length} Swift files (${bytes} bytes), over Contrast's compile limits of ${MAX_SWIFT_COMPILE_FILES} files and ${MAX_SWIFT_COMPILE_SOURCE_BYTES} bytes; compile it on this machine with the Swift distribution instead`
26287
+ `${import_node_path16.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`
25923
26288
  );
25924
26289
  }
25925
26290
  const descriptor = snapshot.native;
@@ -25938,7 +26303,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
25938
26303
  );
25939
26304
  if (descriptor && address.native?.hash !== descriptor.hash) {
25940
26305
  throw new Error(
25941
- `${import_node_path15.default.basename(packagePath)}: Contrast compiled native contract ${address.native?.hash ?? "none"} but one typegen wrote ${descriptor.hash}; the app's One and the compile host's differ, or the compile host is older than this peachsim`
26306
+ `${import_node_path16.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`
25942
26307
  );
25943
26308
  }
25944
26309
  const response = await fetch(address.url, { signal });
@@ -26055,14 +26420,14 @@ function serveSwiftPackageAsset(pathname, res) {
26055
26420
  res.end("swift artifact is stale");
26056
26421
  return true;
26057
26422
  }
26058
- var import_node_crypto5, import_node_fs15, import_node_os5, import_node_path15, 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;
26423
+ var import_node_crypto5, import_node_fs15, import_node_os5, import_node_path16, 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;
26059
26424
  var init_swift_host = __esm({
26060
26425
  "src/swift-host.ts"() {
26061
26426
  "use strict";
26062
26427
  import_node_crypto5 = require("node:crypto");
26063
26428
  import_node_fs15 = __toESM(require("node:fs"), 1);
26064
26429
  import_node_os5 = __toESM(require("node:os"), 1);
26065
- import_node_path15 = __toESM(require("node:path"), 1);
26430
+ import_node_path16 = __toESM(require("node:path"), 1);
26066
26431
  init_bundleAssets();
26067
26432
  init_auth();
26068
26433
  init_backend_origin();
@@ -26090,7 +26455,7 @@ var init_swift_host = __esm({
26090
26455
  XCODE_APP_DIR = "__app__";
26091
26456
  XCODE_FRAMEWORKS_DIR = "__frameworks__";
26092
26457
  XCODE_PACKAGES_DIR = "__packages__";
26093
- CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)}/`;
26458
+ CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)}/`;
26094
26459
  HOSTED_LIMITS = {
26095
26460
  resources: MAX_SWIFT_COMPILE_RESOURCES,
26096
26461
  resourceBytes: MAX_SWIFT_COMPILE_RESOURCE_BYTES,
@@ -26138,7 +26503,7 @@ var init_swift_host = __esm({
26138
26503
  // src/expo-swift-host.ts
26139
26504
  async function collectExpoSwiftSources(appRoot) {
26140
26505
  appRoot = import_node_fs16.default.realpathSync(appRoot);
26141
- const appRequire = (0, import_node_module.createRequire)(import_node_path16.default.join(appRoot, "package.json"));
26506
+ const appRequire = (0, import_node_module.createRequire)(import_node_path17.default.join(appRoot, "package.json"));
26142
26507
  let autolinker;
26143
26508
  try {
26144
26509
  autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
@@ -26152,7 +26517,7 @@ async function collectExpoSwiftSources(appRoot) {
26152
26517
  (command) => run3(
26153
26518
  process.execPath,
26154
26519
  [
26155
- import_node_path16.default.join(import_node_path16.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
26520
+ import_node_path17.default.join(import_node_path17.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
26156
26521
  command,
26157
26522
  "--platform",
26158
26523
  "apple",
@@ -26184,7 +26549,7 @@ async function collectExpoSwiftSources(appRoot) {
26184
26549
  if (typeof sourceRoot !== "string")
26185
26550
  throw new Error("Expo autolinking entry has no path");
26186
26551
  const canonical = import_node_fs16.default.realpathSync(sourceRoot);
26187
- if (canonical.split(import_node_path16.default.sep).includes("node_modules")) continue;
26552
+ if (canonical.split(import_node_path17.default.sep).includes("node_modules")) continue;
26188
26553
  const resolution = resolutions.find(
26189
26554
  (candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
26190
26555
  );
@@ -26210,12 +26575,12 @@ async function collectExpoSwiftSources(appRoot) {
26210
26575
  `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
26211
26576
  );
26212
26577
  }
26213
- const ios = import_node_path16.default.join(canonical, "ios");
26578
+ const ios = import_node_path17.default.join(canonical, "ios");
26214
26579
  if (import_node_fs16.default.lstatSync(ios).isSymbolicLink())
26215
26580
  throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
26216
26581
  const walk2 = (dir) => {
26217
26582
  for (const child of import_node_fs16.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
26218
- const file = import_node_path16.default.join(dir, child.name);
26583
+ const file = import_node_path17.default.join(dir, child.name);
26219
26584
  if (child.isSymbolicLink())
26220
26585
  throw new Error(`Expo Swift source is a symlink: ${file}`);
26221
26586
  if (child.isDirectory()) {
@@ -26228,7 +26593,7 @@ async function collectExpoSwiftSources(appRoot) {
26228
26593
  fileCount++;
26229
26594
  if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
26230
26595
  throw new Error("Expo Swift sources exceed compile service caps");
26231
- files[`Sources/${namespace}/${import_node_path16.default.relative(ios, file).split(import_node_path16.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
26596
+ files[`Sources/${namespace}/${import_node_path17.default.relative(ios, file).split(import_node_path17.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
26232
26597
  ${import_node_fs16.default.readFileSync(file, "utf8")}`;
26233
26598
  }
26234
26599
  };
@@ -26312,7 +26677,7 @@ async function handleExpoSwiftRequest(req, res) {
26312
26677
  return true;
26313
26678
  }
26314
26679
  const root = url.searchParams.get("root");
26315
- if (!root || !import_node_path16.default.isAbsolute(root)) {
26680
+ if (!root || !import_node_path17.default.isAbsolute(root)) {
26316
26681
  res.writeHead(400);
26317
26682
  res.end("missing absolute app root");
26318
26683
  return true;
@@ -26343,7 +26708,7 @@ async function handleExpoSwiftRequest(req, res) {
26343
26708
  continue;
26344
26709
  }
26345
26710
  try {
26346
- const packagePath = import_node_path16.default.join(
26711
+ const packagePath = import_node_path17.default.join(
26347
26712
  import_node_os6.default.tmpdir(),
26348
26713
  "peach-expo-swift",
26349
26714
  key,
@@ -26353,7 +26718,7 @@ async function handleExpoSwiftRequest(req, res) {
26353
26718
  packagePath,
26354
26719
  new Map(
26355
26720
  Object.entries(unit.files).map(([name2, source]) => [
26356
- import_node_path16.default.join(packagePath, name2),
26721
+ import_node_path17.default.join(packagePath, name2),
26357
26722
  source
26358
26723
  ])
26359
26724
  )
@@ -26404,7 +26769,7 @@ async function handleExpoSwiftRequest(req, res) {
26404
26769
  import PackageDescription
26405
26770
  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")])
26406
26771
  `;
26407
- const packagePath = import_node_path16.default.join(
26772
+ const packagePath = import_node_path17.default.join(
26408
26773
  import_node_os6.default.tmpdir(),
26409
26774
  "peach-expo-swift",
26410
26775
  key,
@@ -26414,7 +26779,7 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
26414
26779
  packagePath,
26415
26780
  new Map(
26416
26781
  Object.entries(files).map(([name2, source]) => [
26417
- import_node_path16.default.join(packagePath, name2),
26782
+ import_node_path17.default.join(packagePath, name2),
26418
26783
  source
26419
26784
  ])
26420
26785
  )
@@ -26450,7 +26815,7 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
26450
26815
  }
26451
26816
  return true;
26452
26817
  }
26453
- var import_node_child_process8, import_node_crypto6, import_node_fs16, import_node_module, import_node_os6, import_node_path16, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, compiling, failedCompilations;
26818
+ var import_node_child_process8, import_node_crypto6, import_node_fs16, import_node_module, import_node_os6, import_node_path17, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, compiling, failedCompilations;
26454
26819
  var init_expo_swift_host = __esm({
26455
26820
  "src/expo-swift-host.ts"() {
26456
26821
  "use strict";
@@ -26459,7 +26824,7 @@ var init_expo_swift_host = __esm({
26459
26824
  import_node_fs16 = __toESM(require("node:fs"), 1);
26460
26825
  import_node_module = require("node:module");
26461
26826
  import_node_os6 = __toESM(require("node:os"), 1);
26462
- import_node_path16 = __toESM(require("node:path"), 1);
26827
+ import_node_path17 = __toESM(require("node:path"), 1);
26463
26828
  import_node_util3 = require("node:util");
26464
26829
  init_internal_child();
26465
26830
  init_backend_origin();
@@ -26643,14 +27008,14 @@ var init_standalone = __esm({
26643
27008
  // cli/self-invocation.ts
26644
27009
  function sourceEntryPath() {
26645
27010
  try {
26646
- const candidate = (0, import_node_path17.join)((0, import_node_path17.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
27011
+ const candidate = (0, import_node_path18.join)((0, import_node_path18.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
26647
27012
  return (0, import_node_fs17.existsSync)(candidate) ? candidate : null;
26648
27013
  } catch {
26649
27014
  return null;
26650
27015
  }
26651
27016
  }
26652
- function isCliEntry(path33) {
26653
- const name2 = (0, import_node_path17.basename)(path33);
27017
+ function isCliEntry(path34) {
27018
+ const name2 = (0, import_node_path18.basename)(path34);
26654
27019
  return name2 === "bin.ts" || name2 === "bin.js";
26655
27020
  }
26656
27021
  function rnxSelfInvocation() {
@@ -26668,12 +27033,12 @@ function rnxSelfInvocation() {
26668
27033
  }
26669
27034
  return { executable: process.execPath, prefixArgs: [entry] };
26670
27035
  }
26671
- var import_node_fs17, import_node_path17, import_node_url3;
27036
+ var import_node_fs17, import_node_path18, import_node_url3;
26672
27037
  var init_self_invocation = __esm({
26673
27038
  "cli/self-invocation.ts"() {
26674
27039
  "use strict";
26675
27040
  import_node_fs17 = require("node:fs");
26676
- import_node_path17 = require("node:path");
27041
+ import_node_path18 = require("node:path");
26677
27042
  import_node_url3 = require("node:url");
26678
27043
  init_public_brand();
26679
27044
  init_standalone();
@@ -26707,16 +27072,16 @@ function cleanPromptText(value) {
26707
27072
  return typeof value === "string" ? value.trim() : "";
26708
27073
  }
26709
27074
  function encodeAgentPromptEnvelope(input) {
26710
- const text = cleanPromptText(input.text);
26711
- if (!text) return "";
27075
+ const text2 = cleanPromptText(input.text);
27076
+ if (!text2) return "";
26712
27077
  const displayText = cleanPromptText(input.displayText);
26713
27078
  const inspectSummary = cleanPromptText(input.inspectSummary);
26714
27079
  const inspectTrace = cleanPromptText(input.inspectTrace);
26715
- const needsEnvelope = !!inspectSummary || !!inspectTrace || /[\r\n]/.test(text) || !!displayText && displayText !== text;
26716
- if (!needsEnvelope) return text;
27080
+ const needsEnvelope = !!inspectSummary || !!inspectTrace || /[\r\n]/.test(text2) || !!displayText && displayText !== text2;
27081
+ if (!needsEnvelope) return text2;
26717
27082
  return JSON.stringify({
26718
27083
  __sootsimAgentPrompt: ENVELOPE_MARKER,
26719
- text,
27084
+ text: text2,
26720
27085
  displayText,
26721
27086
  inspectSummary,
26722
27087
  inspectTrace
@@ -26741,7 +27106,7 @@ function getUserDataDir() {
26741
27106
  return userDataDir();
26742
27107
  }
26743
27108
  function storeFile() {
26744
- return import_node_path18.default.join(userDataDir(), "attached-projects.json");
27109
+ return import_node_path19.default.join(userDataDir(), "attached-projects.json");
26745
27110
  }
26746
27111
  function cloneEmpty() {
26747
27112
  return {
@@ -26783,7 +27148,7 @@ function loadStore() {
26783
27148
  }
26784
27149
  function writeStore(store) {
26785
27150
  const file = storeFile();
26786
- import_node_fs18.default.mkdirSync(import_node_path18.default.dirname(file), { recursive: true });
27151
+ import_node_fs18.default.mkdirSync(import_node_path19.default.dirname(file), { recursive: true });
26787
27152
  const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
26788
27153
  const fd = import_node_fs18.default.openSync(tmp, "w", 384);
26789
27154
  try {
@@ -26801,13 +27166,13 @@ function mutateStore(fn) {
26801
27166
  return store;
26802
27167
  }
26803
27168
  function projectIdForCwd(cwd) {
26804
- return (0, import_node_crypto7.createHash)("sha256").update(import_node_path18.default.resolve(cwd)).digest("hex").slice(0, 16);
27169
+ return (0, import_node_crypto7.createHash)("sha256").update(import_node_path19.default.resolve(cwd)).digest("hex").slice(0, 16);
26805
27170
  }
26806
27171
  function newSessionId() {
26807
27172
  return `s_${(0, import_node_crypto7.randomBytes)(10).toString("hex")}`;
26808
27173
  }
26809
27174
  function upsertProject(input) {
26810
- const cwd = import_node_path18.default.resolve(input.cwd);
27175
+ const cwd = import_node_path19.default.resolve(input.cwd);
26811
27176
  const id = projectIdForCwd(cwd);
26812
27177
  let result;
26813
27178
  mutateStore((store) => {
@@ -26833,7 +27198,7 @@ function upsertProject(input) {
26833
27198
  const now = Date.now();
26834
27199
  const created = {
26835
27200
  id,
26836
- name: input.name ?? import_node_path18.default.basename(cwd),
27201
+ name: input.name ?? import_node_path19.default.basename(cwd),
26837
27202
  cwd,
26838
27203
  repoRoot: input.repoRoot,
26839
27204
  sourceRoots: input.sourceRoots ?? [cwd],
@@ -26979,7 +27344,7 @@ async function seedFromDemoAppRegistry() {
26979
27344
  mutateStore((store) => {
26980
27345
  for (const app of apps) {
26981
27346
  if (!import_node_fs18.default.existsSync(app.dir)) continue;
26982
- const cwd = import_node_path18.default.resolve(app.dir);
27347
+ const cwd = import_node_path19.default.resolve(app.dir);
26983
27348
  const id = projectIdForCwd(cwd);
26984
27349
  if (store.attachedProjects.some((p) => p.id === id)) continue;
26985
27350
  const now = Date.now();
@@ -27000,13 +27365,13 @@ async function seedFromDemoAppRegistry() {
27000
27365
  }
27001
27366
  });
27002
27367
  }
27003
- var import_node_crypto7, import_node_fs18, import_node_path18, overrideDir, COST_HISTORY_MAX_AGE_MS;
27368
+ var import_node_crypto7, import_node_fs18, import_node_path19, overrideDir, COST_HISTORY_MAX_AGE_MS;
27004
27369
  var init_attached_projects = __esm({
27005
27370
  "src/attached-projects.ts"() {
27006
27371
  "use strict";
27007
27372
  import_node_crypto7 = require("node:crypto");
27008
27373
  import_node_fs18 = __toESM(require("node:fs"), 1);
27009
- import_node_path18 = __toESM(require("node:path"), 1);
27374
+ import_node_path19 = __toESM(require("node:path"), 1);
27010
27375
  init_home_paths();
27011
27376
  overrideDir = null;
27012
27377
  COST_HISTORY_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
@@ -27015,16 +27380,16 @@ var init_attached_projects = __esm({
27015
27380
 
27016
27381
  // src/agent-sessions.ts
27017
27382
  function sessionDir(sessionId) {
27018
- return import_node_path19.default.join(getUserDataDir(), "sessions", sessionId);
27383
+ return import_node_path20.default.join(getUserDataDir(), "sessions", sessionId);
27019
27384
  }
27020
27385
  function promptFifoPath(sessionId) {
27021
- return import_node_path19.default.join(sessionDir(sessionId), "prompt.in");
27386
+ return import_node_path20.default.join(sessionDir(sessionId), "prompt.in");
27022
27387
  }
27023
27388
  function eventsFifoPath(sessionId) {
27024
- return import_node_path19.default.join(sessionDir(sessionId), "events.out");
27389
+ return import_node_path20.default.join(sessionDir(sessionId), "events.out");
27025
27390
  }
27026
27391
  function transcriptPath(sessionId) {
27027
- return import_node_path19.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
27392
+ return import_node_path20.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
27028
27393
  }
27029
27394
  function pidIsAlive(pid, sessionId) {
27030
27395
  if (!pid) return false;
@@ -27047,8 +27412,8 @@ function resolveSootsimInvocation() {
27047
27412
  const resourcesPath = process.resourcesPath;
27048
27413
  if (resourcesPath) {
27049
27414
  const candidates = [
27050
- import_node_path19.default.join(resourcesPath, "bin", "sootsim"),
27051
- import_node_path19.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
27415
+ import_node_path20.default.join(resourcesPath, "bin", "sootsim"),
27416
+ import_node_path20.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
27052
27417
  ];
27053
27418
  for (const c of candidates) {
27054
27419
  if (import_node_fs19.default.existsSync(c)) return { executable: c, prefixArgs: [] };
@@ -27070,12 +27435,12 @@ function tryWorkspaceSootsim() {
27070
27435
  const sootsimDir = resolveSootsimPackageDir();
27071
27436
  if (!sootsimDir) return null;
27072
27437
  const binaryName = `peach-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`;
27073
- const distBinary = import_node_path19.default.join(sootsimDir, "dist-bin", binaryName);
27438
+ const distBinary = import_node_path20.default.join(sootsimDir, "dist-bin", binaryName);
27074
27439
  if (import_node_fs19.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
27075
- const distBin = import_node_path19.default.join(sootsimDir, "dist-cli", "bin.js");
27440
+ const distBin = import_node_path20.default.join(sootsimDir, "dist-cli", "bin.js");
27076
27441
  if (import_node_fs19.default.existsSync(distBin)) {
27077
27442
  try {
27078
- const src = import_node_path19.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
27443
+ const src = import_node_path20.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
27079
27444
  if (import_node_fs19.default.existsSync(src)) {
27080
27445
  const srcMtime = import_node_fs19.default.statSync(src).mtimeMs;
27081
27446
  const buildMtime = import_node_fs19.default.statSync(distBin).mtimeMs;
@@ -27097,14 +27462,14 @@ function tryWorkspaceSootsim() {
27097
27462
  function resolveSootsimPackageDir() {
27098
27463
  try {
27099
27464
  const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
27100
- return import_node_path19.default.dirname(resolved);
27465
+ return import_node_path20.default.dirname(resolved);
27101
27466
  } catch {
27102
27467
  }
27103
27468
  const here = fileFromImportMeta();
27104
27469
  if (!here) return null;
27105
- let cur = import_node_path19.default.dirname(here);
27470
+ let cur = import_node_path20.default.dirname(here);
27106
27471
  for (let i = 0; i < 8; i++) {
27107
- const pkg = import_node_path19.default.join(cur, "package.json");
27472
+ const pkg = import_node_path20.default.join(cur, "package.json");
27108
27473
  try {
27109
27474
  if (import_node_fs19.default.existsSync(pkg)) {
27110
27475
  const parsed = JSON.parse(import_node_fs19.default.readFileSync(pkg, "utf8"));
@@ -27112,7 +27477,7 @@ function resolveSootsimPackageDir() {
27112
27477
  }
27113
27478
  } catch {
27114
27479
  }
27115
- const parent = import_node_path19.default.dirname(cur);
27480
+ const parent = import_node_path20.default.dirname(cur);
27116
27481
  if (parent === cur) break;
27117
27482
  cur = parent;
27118
27483
  }
@@ -27128,13 +27493,13 @@ function fileFromImportMeta() {
27128
27493
  }
27129
27494
  }
27130
27495
  async function withStartLock(projectId, provider, fn) {
27131
- const lockDir = import_node_path19.default.join(getUserDataDir(), "locks");
27496
+ const lockDir = import_node_path20.default.join(getUserDataDir(), "locks");
27132
27497
  import_node_fs19.default.mkdirSync(lockDir, { recursive: true });
27133
27498
  try {
27134
27499
  import_node_fs19.default.chmodSync(lockDir, 448);
27135
27500
  } catch {
27136
27501
  }
27137
- const lockPath = import_node_path19.default.join(lockDir, `start-${projectId}-${provider}.lock`);
27502
+ const lockPath = import_node_path20.default.join(lockDir, `start-${projectId}-${provider}.lock`);
27138
27503
  const deadline = Date.now() + 4e3;
27139
27504
  let fd = null;
27140
27505
  while (fd === null) {
@@ -27185,7 +27550,7 @@ function isProcessAlive(pid) {
27185
27550
  }
27186
27551
  }
27187
27552
  function mkfifoSync(p) {
27188
- const parent = import_node_path19.default.dirname(p);
27553
+ const parent = import_node_path20.default.dirname(p);
27189
27554
  import_node_fs19.default.mkdirSync(parent, { recursive: true });
27190
27555
  try {
27191
27556
  import_node_fs19.default.chmodSync(parent, 448);
@@ -27243,7 +27608,7 @@ async function startSession(opts) {
27243
27608
  const transcript = transcriptPath(session.id);
27244
27609
  mkfifoSync(promptIn);
27245
27610
  mkfifoSync(eventsOut);
27246
- const transcriptDir = import_node_path19.default.dirname(transcript);
27611
+ const transcriptDir = import_node_path20.default.dirname(transcript);
27247
27612
  import_node_fs19.default.mkdirSync(transcriptDir, { recursive: true });
27248
27613
  try {
27249
27614
  import_node_fs19.default.chmodSync(transcriptDir, 448);
@@ -27426,14 +27791,14 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
27426
27791
  import_node_fs19.default.closeSync(fd);
27427
27792
  }
27428
27793
  }
27429
- var import_node_child_process9, import_node_crypto8, import_node_fs19, import_node_path19, import_node_readline, AgentSessionError;
27794
+ var import_node_child_process9, import_node_crypto8, import_node_fs19, import_node_path20, import_node_readline, AgentSessionError;
27430
27795
  var init_agent_sessions = __esm({
27431
27796
  "src/agent-sessions.ts"() {
27432
27797
  "use strict";
27433
27798
  import_node_child_process9 = require("node:child_process");
27434
27799
  import_node_crypto8 = require("node:crypto");
27435
27800
  import_node_fs19 = __toESM(require("node:fs"), 1);
27436
- import_node_path19 = __toESM(require("node:path"), 1);
27801
+ import_node_path20 = __toESM(require("node:path"), 1);
27437
27802
  import_node_readline = __toESM(require("node:readline"), 1);
27438
27803
  init_self_invocation();
27439
27804
  init_standalone();
@@ -27464,13 +27829,13 @@ function mapFrameworkToProjectFramework(fw) {
27464
27829
  if (fw === "one" || fw === "vxrn") return "one";
27465
27830
  return "unknown";
27466
27831
  }
27467
- var import_node_crypto9, import_node_fs20, import_node_path20, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
27832
+ var import_node_crypto9, import_node_fs20, import_node_path21, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
27468
27833
  var init_agent_host = __esm({
27469
27834
  "src/host/agent-host.ts"() {
27470
27835
  "use strict";
27471
27836
  import_node_crypto9 = require("node:crypto");
27472
27837
  import_node_fs20 = __toESM(require("node:fs"), 1);
27473
- import_node_path20 = __toESM(require("node:path"), 1);
27838
+ import_node_path21 = __toESM(require("node:path"), 1);
27474
27839
  init_dev_server_scanner();
27475
27840
  init_agent_sessions();
27476
27841
  init_attached_projects();
@@ -27716,7 +28081,7 @@ var init_agent_host = __esm({
27716
28081
  );
27717
28082
  const project = upsertProject({
27718
28083
  cwd: match.cwd,
27719
- name: match.projectName ?? import_node_path20.default.basename(match.cwd),
28084
+ name: match.projectName ?? import_node_path21.default.basename(match.cwd),
27720
28085
  preferredProvider: input.provider ?? existing?.preferredProvider,
27721
28086
  sourceRoots: existing?.sourceRoots ?? [match.cwd],
27722
28087
  knownBundleUrls,
@@ -27736,9 +28101,9 @@ var init_agent_host = __esm({
27736
28101
  const dir = getUserDataDir();
27737
28102
  return {
27738
28103
  userDataDir: dir,
27739
- storeFile: import_node_path20.default.join(dir, "attached-projects.json"),
27740
- sessionsDir: import_node_path20.default.join(dir, "sessions"),
27741
- transcriptsDir: import_node_path20.default.join(dir, "transcripts")
28104
+ storeFile: import_node_path21.default.join(dir, "attached-projects.json"),
28105
+ sessionsDir: import_node_path21.default.join(dir, "sessions"),
28106
+ transcriptsDir: import_node_path21.default.join(dir, "transcripts")
27742
28107
  };
27743
28108
  }
27744
28109
  // --- subscription management ---
@@ -28742,13 +29107,13 @@ function looksBinary(filePath, size) {
28742
29107
  if (fd !== void 0) import_node_fs21.default.closeSync(fd);
28743
29108
  }
28744
29109
  }
28745
- var import_node_child_process10, import_node_fs21, import_node_path21, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, LIST_FILES_ATTEMPTS, LIST_FILES_RETRY_MS, CheckoutFilePlane;
29110
+ var import_node_child_process10, import_node_fs21, import_node_path22, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, LIST_FILES_ATTEMPTS, LIST_FILES_RETRY_MS, CheckoutFilePlane;
28746
29111
  var init_checkout_plane = __esm({
28747
29112
  "cli/commands/box/checkout-plane.ts"() {
28748
29113
  "use strict";
28749
29114
  import_node_child_process10 = require("node:child_process");
28750
29115
  import_node_fs21 = __toESM(require("node:fs"), 1);
28751
- import_node_path21 = __toESM(require("node:path"), 1);
29116
+ import_node_path22 = __toESM(require("node:path"), 1);
28752
29117
  CheckoutRequiresGitError = class extends Error {
28753
29118
  };
28754
29119
  BINARY_SNIFF_BYTES = 8192;
@@ -28765,7 +29130,7 @@ var init_checkout_plane = __esm({
28765
29130
  listTimeoutMs;
28766
29131
  trackedOnly;
28767
29132
  constructor(root, options = {}) {
28768
- this.root = import_node_path21.default.resolve(root);
29133
+ this.root = import_node_path22.default.resolve(root);
28769
29134
  this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
28770
29135
  this.trackedOnly = options.trackedOnly ?? false;
28771
29136
  }
@@ -28827,13 +29192,13 @@ var init_checkout_plane = __esm({
28827
29192
  if (!relative3) continue;
28828
29193
  let stat2;
28829
29194
  try {
28830
- stat2 = import_node_fs21.default.statSync(import_node_path21.default.join(this.root, relative3));
29195
+ stat2 = import_node_fs21.default.statSync(import_node_path22.default.join(this.root, relative3));
28831
29196
  } catch {
28832
29197
  continue;
28833
29198
  }
28834
29199
  if (!stat2.isFile()) continue;
28835
29200
  const seen = this.sniffed.get(relative3);
28836
- const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path21.default.join(this.root, relative3), stat2.size);
29201
+ const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path22.default.join(this.root, relative3), stat2.size);
28837
29202
  nextSniffed.set(relative3, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary });
28838
29203
  next.set(relative3, {
28839
29204
  size: stat2.size,
@@ -28847,8 +29212,8 @@ var init_checkout_plane = __esm({
28847
29212
  this.sniffed = nextSniffed;
28848
29213
  }
28849
29214
  absolute(planePath) {
28850
- const resolved = import_node_path21.default.resolve(this.root, planePath);
28851
- if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path21.default.sep}`)) {
29215
+ const resolved = import_node_path22.default.resolve(this.root, planePath);
29216
+ if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path22.default.sep}`)) {
28852
29217
  throw new Error(`path escapes the project: ${planePath}`);
28853
29218
  }
28854
29219
  return resolved;
@@ -28861,7 +29226,7 @@ var init_checkout_plane = __esm({
28861
29226
  }
28862
29227
  async write(planePath, content) {
28863
29228
  const absolute = this.absolute(planePath);
28864
- await import_node_fs21.default.promises.mkdir(import_node_path21.default.dirname(absolute), { recursive: true });
29229
+ await import_node_fs21.default.promises.mkdir(import_node_path22.default.dirname(absolute), { recursive: true });
28865
29230
  await import_node_fs21.default.promises.writeFile(absolute, content);
28866
29231
  this.entries.set(planePath, {
28867
29232
  size: content.byteLength,
@@ -28879,12 +29244,12 @@ var init_checkout_plane = __esm({
28879
29244
  });
28880
29245
 
28881
29246
  // src/host/plane-host.ts
28882
- var import_node_fs22, import_node_path22, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
29247
+ var import_node_fs22, import_node_path23, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
28883
29248
  var init_plane_host = __esm({
28884
29249
  "src/host/plane-host.ts"() {
28885
29250
  "use strict";
28886
29251
  import_node_fs22 = __toESM(require("node:fs"), 1);
28887
- import_node_path22 = __toESM(require("node:path"), 1);
29252
+ import_node_path23 = __toESM(require("node:path"), 1);
28888
29253
  init_plane();
28889
29254
  init_checkout_plane();
28890
29255
  WS_OPEN2 = 1;
@@ -29007,7 +29372,7 @@ var init_plane_host = __esm({
29007
29372
  // root and an opened one cannot disagree about the same directory.
29008
29373
  realRoot(root) {
29009
29374
  if (!root) throw new Error("root is required");
29010
- const resolved = import_node_path22.default.resolve(root);
29375
+ const resolved = import_node_path23.default.resolve(root);
29011
29376
  let real;
29012
29377
  try {
29013
29378
  real = import_node_fs22.default.realpathSync(resolved);
@@ -29370,13 +29735,13 @@ function sendJavaScript(req, res, source) {
29370
29735
  res.end(req.method === "HEAD" ? void 0 : source);
29371
29736
  }
29372
29737
  function resolveReplacementModuleFile(fromFile, specifier) {
29373
- const base = import_node_path23.default.resolve(import_node_path23.default.dirname(fromFile), specifier);
29738
+ const base = import_node_path24.default.resolve(import_node_path24.default.dirname(fromFile), specifier);
29374
29739
  const candidates = [
29375
29740
  ...REPLACEMENT_MODULE_EXTENSIONS.some(
29376
- (ext) => ext === import_node_path23.default.extname(base).toLowerCase()
29741
+ (ext) => ext === import_node_path24.default.extname(base).toLowerCase()
29377
29742
  ) ? [base] : [],
29378
29743
  ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
29379
- ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path23.default.join(base, `index${ext}`))
29744
+ ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path24.default.join(base, `index${ext}`))
29380
29745
  ];
29381
29746
  const found = candidates.find(
29382
29747
  (candidate) => (0, import_node_fs23.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
@@ -29434,13 +29799,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
29434
29799
  res.end("missing path param");
29435
29800
  return true;
29436
29801
  }
29437
- const extension = import_node_path23.default.extname(targetPath).toLowerCase();
29802
+ const extension = import_node_path24.default.extname(targetPath).toLowerCase();
29438
29803
  if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
29439
29804
  res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
29440
29805
  res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
29441
29806
  return true;
29442
29807
  }
29443
- if (!import_node_path23.default.isAbsolute(targetPath)) {
29808
+ if (!import_node_path24.default.isAbsolute(targetPath)) {
29444
29809
  res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
29445
29810
  res.end("replacement file path must be absolute");
29446
29811
  return true;
@@ -29448,10 +29813,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
29448
29813
  const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
29449
29814
  let resolvedProjectRoot;
29450
29815
  if (options.projectRoot) {
29451
- const lexicalProjectRoot = import_node_path23.default.resolve(options.projectRoot);
29816
+ const lexicalProjectRoot = import_node_path24.default.resolve(options.projectRoot);
29452
29817
  resolvedProjectRoot = await import_promises5.default.realpath(options.projectRoot);
29453
- const lexicalTarget = import_node_path23.default.relative(lexicalProjectRoot, targetPath);
29454
- if (lexicalTarget.startsWith("..") || import_node_path23.default.isAbsolute(lexicalTarget)) {
29818
+ const lexicalTarget = import_node_path24.default.relative(lexicalProjectRoot, targetPath);
29819
+ if (lexicalTarget.startsWith("..") || import_node_path24.default.isAbsolute(lexicalTarget)) {
29455
29820
  res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
29456
29821
  res.end("replacement file must be inside the project root");
29457
29822
  return true;
@@ -29467,8 +29832,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
29467
29832
  return true;
29468
29833
  }
29469
29834
  if (resolvedProjectRoot) {
29470
- const relativeTarget = import_node_path23.default.relative(resolvedProjectRoot, resolvedTargetPath);
29471
- if (relativeTarget.startsWith("..") || import_node_path23.default.isAbsolute(relativeTarget)) {
29835
+ const relativeTarget = import_node_path24.default.relative(resolvedProjectRoot, resolvedTargetPath);
29836
+ if (relativeTarget.startsWith("..") || import_node_path24.default.isAbsolute(relativeTarget)) {
29472
29837
  res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
29473
29838
  res.end("replacement file must be inside the project root");
29474
29839
  return true;
@@ -29494,9 +29859,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
29494
29859
  sendJavaScript(
29495
29860
  req,
29496
29861
  res,
29497
- `${compiled.code}
29498
- //# sourceMappingURL=data:application/json;base64,${map}
29499
- `
29862
+ compiled.code + "\n//# sourceMappingURL=data:application/json;base64," + map + "\n"
29500
29863
  );
29501
29864
  } catch (error) {
29502
29865
  const message = error instanceof Error ? error.message : String(error);
@@ -29505,13 +29868,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
29505
29868
  }
29506
29869
  return true;
29507
29870
  }
29508
- var import_node_fs23, import_promises5, import_node_path23, REPLACEMENT_MODULE_ROUTE;
29871
+ var import_node_fs23, import_promises5, import_node_path24, REPLACEMENT_MODULE_ROUTE;
29509
29872
  var init_replacement_module_handler = __esm({
29510
29873
  "src/host/replacement-module-handler.ts"() {
29511
29874
  "use strict";
29512
29875
  import_node_fs23 = require("node:fs");
29513
29876
  import_promises5 = __toESM(require("node:fs/promises"), 1);
29514
- import_node_path23 = __toESM(require("node:path"), 1);
29877
+ import_node_path24 = __toESM(require("node:path"), 1);
29515
29878
  init_replacementModule();
29516
29879
  init_backend_origin();
29517
29880
  REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
@@ -30947,35 +31310,35 @@ function identifierStart(character) {
30947
31310
  function identifierPart(character) {
30948
31311
  return character != null && /[A-Za-z0-9_$]/.test(character);
30949
31312
  }
30950
- function skipLineComment(text, start, end) {
31313
+ function skipLineComment(text2, start, end) {
30951
31314
  let cursor = start + 2;
30952
- while (cursor < end && text[cursor] !== "\n" && text[cursor] !== "\r") cursor++;
31315
+ while (cursor < end && text2[cursor] !== "\n" && text2[cursor] !== "\r") cursor++;
30953
31316
  return cursor;
30954
31317
  }
30955
- function skipBlockComment(text, start, end) {
30956
- const close = text.indexOf("*/", start + 2);
31318
+ function skipBlockComment(text2, start, end) {
31319
+ const close = text2.indexOf("*/", start + 2);
30957
31320
  return close === -1 || close >= end ? end : close + 2;
30958
31321
  }
30959
- function skipTrivia(text, start, end) {
31322
+ function skipTrivia(text2, start, end) {
30960
31323
  let cursor = start;
30961
31324
  for (; ; ) {
30962
- while (cursor < end && /\s/.test(text[cursor] ?? "")) cursor++;
30963
- if (text[cursor] === "/" && text[cursor + 1] === "/") {
30964
- cursor = skipLineComment(text, cursor, end);
31325
+ while (cursor < end && /\s/.test(text2[cursor] ?? "")) cursor++;
31326
+ if (text2[cursor] === "/" && text2[cursor + 1] === "/") {
31327
+ cursor = skipLineComment(text2, cursor, end);
30965
31328
  continue;
30966
31329
  }
30967
- if (text[cursor] === "/" && text[cursor + 1] === "*") {
30968
- cursor = skipBlockComment(text, cursor, end);
31330
+ if (text2[cursor] === "/" && text2[cursor + 1] === "*") {
31331
+ cursor = skipBlockComment(text2, cursor, end);
30969
31332
  continue;
30970
31333
  }
30971
31334
  return cursor;
30972
31335
  }
30973
31336
  }
30974
- function quotedEnd(text, start, end) {
30975
- const quote = text[start];
31337
+ function quotedEnd(text2, start, end) {
31338
+ const quote = text2[start];
30976
31339
  let cursor = start + 1;
30977
31340
  while (cursor < end) {
30978
- const character = text[cursor];
31341
+ const character = text2[cursor];
30979
31342
  if (character === "\\") {
30980
31343
  cursor += 2;
30981
31344
  continue;
@@ -31034,38 +31397,38 @@ function decodeSingleQuoted(contents) {
31034
31397
  }
31035
31398
  return value;
31036
31399
  }
31037
- function readQuoted(text, start, end) {
31038
- const quote = text[start];
31400
+ function readQuoted(text2, start, end) {
31401
+ const quote = text2[start];
31039
31402
  if (quote !== '"' && quote !== "'") return null;
31040
- const after = quotedEnd(text, start, end);
31041
- if (after > end || text[after - 1] !== quote) return null;
31042
- const contents = text.slice(start + 1, after - 1);
31403
+ const after = quotedEnd(text2, start, end);
31404
+ if (after > end || text2[after - 1] !== quote) return null;
31405
+ const contents = text2.slice(start + 1, after - 1);
31043
31406
  if (quote === "'") {
31044
31407
  const value = decodeSingleQuoted(contents);
31045
31408
  return value == null ? null : { value, end: after };
31046
31409
  }
31047
31410
  try {
31048
- const value = JSON.parse(text.slice(start, after));
31411
+ const value = JSON.parse(text2.slice(start, after));
31049
31412
  return typeof value === "string" ? { value, end: after } : null;
31050
31413
  } catch {
31051
31414
  return null;
31052
31415
  }
31053
31416
  }
31054
- function skipTemplate(text, start, end) {
31417
+ function skipTemplate(text2, start, end) {
31055
31418
  let cursor = start + 1;
31056
31419
  while (cursor < end) {
31057
- const character = text[cursor];
31420
+ const character = text2[cursor];
31058
31421
  if (character === "\\") cursor += 2;
31059
31422
  else if (character === "`") return cursor + 1;
31060
31423
  else cursor++;
31061
31424
  }
31062
31425
  return end;
31063
31426
  }
31064
- function skipRegex(text, start, end) {
31427
+ function skipRegex(text2, start, end) {
31065
31428
  let cursor = start + 1;
31066
31429
  let inClass = false;
31067
31430
  while (cursor < end) {
31068
- const character = text[cursor];
31431
+ const character = text2[cursor];
31069
31432
  if (character === "\\") cursor += 2;
31070
31433
  else if (character === "[") {
31071
31434
  inClass = true;
@@ -31075,7 +31438,7 @@ function skipRegex(text, start, end) {
31075
31438
  cursor++;
31076
31439
  } else if (character === "/" && !inClass) {
31077
31440
  cursor++;
31078
- while (/[A-Za-z]/.test(text[cursor] ?? "")) cursor++;
31441
+ while (/[A-Za-z]/.test(text2[cursor] ?? "")) cursor++;
31079
31442
  return cursor;
31080
31443
  } else if (character === "\n" || character === "\r") {
31081
31444
  return cursor;
@@ -31083,43 +31446,43 @@ function skipRegex(text, start, end) {
31083
31446
  }
31084
31447
  return end;
31085
31448
  }
31086
- function readStringArray(text, start, end) {
31087
- if (text[start] !== "[") return null;
31449
+ function readStringArray(text2, start, end) {
31450
+ if (text2[start] !== "[") return null;
31088
31451
  const values = [];
31089
31452
  let cursor = start + 1;
31090
31453
  for (; ; ) {
31091
- cursor = skipTrivia(text, cursor, end);
31092
- if (text[cursor] === "]") return { values, end: cursor + 1 };
31093
- const parsed = readQuoted(text, cursor, end);
31454
+ cursor = skipTrivia(text2, cursor, end);
31455
+ if (text2[cursor] === "]") return { values, end: cursor + 1 };
31456
+ const parsed = readQuoted(text2, cursor, end);
31094
31457
  if (!parsed) return null;
31095
31458
  values.push(parsed.value);
31096
- cursor = skipTrivia(text, parsed.end, end);
31097
- if (text[cursor] === "]") return { values, end: cursor + 1 };
31098
- if (text[cursor] !== ",") return null;
31459
+ cursor = skipTrivia(text2, parsed.end, end);
31460
+ if (text2[cursor] === "]") return { values, end: cursor + 1 };
31461
+ if (text2[cursor] !== ",") return null;
31099
31462
  cursor++;
31100
31463
  }
31101
31464
  }
31102
- function readNumberArray(text, start, end) {
31103
- if (text[start] !== "[") return null;
31465
+ function readNumberArray(text2, start, end) {
31466
+ if (text2[start] !== "[") return null;
31104
31467
  const values = [];
31105
31468
  let cursor = start + 1;
31106
31469
  for (; ; ) {
31107
- cursor = skipTrivia(text, cursor, end);
31108
- if (text[cursor] === "]") return { values, end: cursor + 1 };
31470
+ cursor = skipTrivia(text2, cursor, end);
31471
+ if (text2[cursor] === "]") return { values, end: cursor + 1 };
31109
31472
  const match = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/i.exec(
31110
- text.slice(cursor, end)
31473
+ text2.slice(cursor, end)
31111
31474
  );
31112
31475
  if (!match) return null;
31113
31476
  const value = Number(match[0]);
31114
31477
  if (!Number.isFinite(value)) return null;
31115
31478
  values.push(value);
31116
- cursor = skipTrivia(text, cursor + match[0].length, end);
31117
- if (text[cursor] === "]") return { values, end: cursor + 1 };
31118
- if (text[cursor] !== ",") return null;
31479
+ cursor = skipTrivia(text2, cursor + match[0].length, end);
31480
+ if (text2[cursor] === "]") return { values, end: cursor + 1 };
31481
+ if (text2[cursor] !== ",") return null;
31119
31482
  cursor++;
31120
31483
  }
31121
31484
  }
31122
- function readDescriptorObject(text, start, end, pairSpans) {
31485
+ function readDescriptorObject(text2, start, end, pairSpans) {
31123
31486
  const strings = {};
31124
31487
  let scales;
31125
31488
  let fileUris;
@@ -31130,27 +31493,27 @@ function readDescriptorObject(text, start, end, pairSpans) {
31130
31493
  let parenDepth = 0;
31131
31494
  let canStartRegex = true;
31132
31495
  while (cursor < end - 1) {
31133
- cursor = skipTrivia(text, cursor, end - 1);
31134
- const character = text[cursor];
31496
+ cursor = skipTrivia(text2, cursor, end - 1);
31497
+ const character = text2[cursor];
31135
31498
  if (character == null) break;
31136
31499
  if (braceDepth === 1 && bracketDepth === 0 && parenDepth === 0) {
31137
31500
  let key = null;
31138
31501
  const pairStart = cursor;
31139
31502
  let afterKey = cursor;
31140
- const quoted = readQuoted(text, cursor, end - 1);
31503
+ const quoted = readQuoted(text2, cursor, end - 1);
31141
31504
  if (quoted) {
31142
31505
  key = quoted.value;
31143
31506
  afterKey = quoted.end;
31144
31507
  } else if (identifierStart(character)) {
31145
31508
  afterKey++;
31146
- while (identifierPart(text[afterKey])) afterKey++;
31147
- key = text.slice(cursor, afterKey);
31509
+ while (identifierPart(text2[afterKey])) afterKey++;
31510
+ key = text2.slice(cursor, afterKey);
31148
31511
  }
31149
- const colon = key == null ? afterKey : skipTrivia(text, afterKey, end - 1);
31150
- if (key != null && text[colon] === ":") {
31151
- const valueStart = skipTrivia(text, colon + 1, end - 1);
31512
+ const colon = key == null ? afterKey : skipTrivia(text2, afterKey, end - 1);
31513
+ if (key != null && text2[colon] === ":") {
31514
+ const valueStart = skipTrivia(text2, colon + 1, end - 1);
31152
31515
  if (key === "httpServerLocation" || key === "name" || key === "type" || key === "hash") {
31153
- const value = readQuoted(text, valueStart, end - 1);
31516
+ const value = readQuoted(text2, valueStart, end - 1);
31154
31517
  if (!value) return null;
31155
31518
  strings[key] = value.value;
31156
31519
  cursor = value.end;
@@ -31158,7 +31521,7 @@ function readDescriptorObject(text, start, end, pairSpans) {
31158
31521
  continue;
31159
31522
  }
31160
31523
  if (key === "scales") {
31161
- const value = readNumberArray(text, valueStart, end - 1);
31524
+ const value = readNumberArray(text2, valueStart, end - 1);
31162
31525
  if (!value) return null;
31163
31526
  scales = value.values;
31164
31527
  if (pairSpans) pairSpans.scales = { start: pairStart, end: value.end };
@@ -31167,7 +31530,7 @@ function readDescriptorObject(text, start, end, pairSpans) {
31167
31530
  continue;
31168
31531
  }
31169
31532
  if (key === "fileUris" || key === "fileHashes") {
31170
- const value = readStringArray(text, valueStart, end - 1);
31533
+ const value = readStringArray(text2, valueStart, end - 1);
31171
31534
  if (!value) return null;
31172
31535
  if (key === "fileUris") fileUris = value.values;
31173
31536
  else fileHashes = value.values;
@@ -31179,24 +31542,24 @@ function readDescriptorObject(text, start, end, pairSpans) {
31179
31542
  }
31180
31543
  }
31181
31544
  if (character === '"' || character === "'") {
31182
- cursor = quotedEnd(text, cursor, end - 1);
31545
+ cursor = quotedEnd(text2, cursor, end - 1);
31183
31546
  canStartRegex = false;
31184
31547
  continue;
31185
31548
  }
31186
31549
  if (character === "`") {
31187
- cursor = skipTemplate(text, cursor, end - 1);
31550
+ cursor = skipTemplate(text2, cursor, end - 1);
31188
31551
  canStartRegex = false;
31189
31552
  continue;
31190
31553
  }
31191
31554
  if (character === "/" && canStartRegex) {
31192
- cursor = skipRegex(text, cursor, end - 1);
31555
+ cursor = skipRegex(text2, cursor, end - 1);
31193
31556
  canStartRegex = false;
31194
31557
  continue;
31195
31558
  }
31196
31559
  if (identifierStart(character)) {
31197
31560
  const tokenStart = cursor++;
31198
- while (identifierPart(text[cursor])) cursor++;
31199
- canStartRegex = EXPRESSION_KEYWORDS.has(text.slice(tokenStart, cursor));
31561
+ while (identifierPart(text2[cursor])) cursor++;
31562
+ canStartRegex = EXPRESSION_KEYWORDS.has(text2.slice(tokenStart, cursor));
31200
31563
  continue;
31201
31564
  }
31202
31565
  if (character === "{") braceDepth++;
@@ -31480,8 +31843,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
31480
31843
  }
31481
31844
  const out = [];
31482
31845
  for (const dir of dirs) {
31483
- const path33 = `${dir}/${filename}`;
31484
- if (!out.includes(path33)) out.push(path33);
31846
+ const path34 = `${dir}/${filename}`;
31847
+ if (!out.includes(path34)) out.push(path34);
31485
31848
  }
31486
31849
  if (!out.includes(filename)) out.push(filename);
31487
31850
  return out;
@@ -31611,10 +31974,10 @@ async function embedMetroAssetFiles(bundle, read) {
31611
31974
  }
31612
31975
  };
31613
31976
  }
31614
- function countNewlines(text) {
31977
+ function countNewlines(text2) {
31615
31978
  let total = 0;
31616
- for (let index = 0; index < text.length; index++) {
31617
- if (text.charCodeAt(index) === 10) total++;
31979
+ for (let index = 0; index < text2.length; index++) {
31980
+ if (text2.charCodeAt(index) === 10) total++;
31618
31981
  }
31619
31982
  return total;
31620
31983
  }
@@ -31790,10 +32153,10 @@ function encodedAssetBytes(bundle) {
31790
32153
  }
31791
32154
  return total;
31792
32155
  }
31793
- function countLines(text) {
32156
+ function countLines(text2) {
31794
32157
  let lines = 0;
31795
- for (let index = 0; index < text.length; index++) {
31796
- if (text.charCodeAt(index) === 10) lines++;
32158
+ for (let index = 0; index < text2.length; index++) {
32159
+ if (text2.charCodeAt(index) === 10) lines++;
31797
32160
  }
31798
32161
  return lines;
31799
32162
  }
@@ -31842,14 +32205,14 @@ async function buildRnxCloudArtifact(bundle, options = {}) {
31842
32205
  const pieces = await Promise.all([
31843
32206
  minify(layout.prelude, 0, MINIFY_OPTIONS, development),
31844
32207
  ...layout.statements.map((statement) => {
31845
- const text = identity.source.slice(statement.start, statement.end);
32208
+ const text2 = identity.source.slice(statement.start, statement.end);
31846
32209
  return statement.kind === "define" ? minifyDefine(
31847
- text,
32210
+ text2,
31848
32211
  statement.moduleId,
31849
32212
  statement.lineIndex,
31850
32213
  MINIFY_OPTIONS,
31851
32214
  development
31852
- ) : minify(text, statement.lineIndex, MINIFY_OPTIONS, development);
32215
+ ) : minify(text2, statement.lineIndex, MINIFY_OPTIONS, development);
31853
32216
  })
31854
32217
  ]);
31855
32218
  const body = pieces.map((piece) => piece.code).join("\n");
@@ -32435,13 +32798,13 @@ function readFactoryStringLiterals(factory) {
32435
32798
  return literals;
32436
32799
  }
32437
32800
  function normalizeFingerprintLiteral(literal) {
32438
- const path33 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
32801
+ const path34 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
32439
32802
  const nodeModulesMarker = "/node_modules/";
32440
- const nodeModulesIndex = path33.lastIndexOf(nodeModulesMarker);
32803
+ const nodeModulesIndex = path34.lastIndexOf(nodeModulesMarker);
32441
32804
  if (nodeModulesIndex >= 0) {
32442
- return `node_modules/${path33.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
32805
+ return `node_modules/${path34.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
32443
32806
  }
32444
- if ((path33.startsWith("/") || /^[A-Za-z]:\//.test(path33) || path33.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path33)) {
32807
+ if ((path34.startsWith("/") || /^[A-Za-z]:\//.test(path34) || path34.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path34)) {
32445
32808
  return null;
32446
32809
  }
32447
32810
  return literal;
@@ -32679,10 +33042,10 @@ function templateAssignment(template, embeddings) {
32679
33042
  if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
32680
33043
  nodesByModuleId.set(moduleId, nodeIndex);
32681
33044
  const node = template.nodes[nodeIndex];
32682
- const path33 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
33045
+ const path34 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
32683
33046
  const existingPath = pathsByModuleId.get(moduleId);
32684
- if (existingPath !== void 0 && existingPath !== path33) return null;
32685
- pathsByModuleId.set(moduleId, path33);
33047
+ if (existingPath !== void 0 && existingPath !== path34) return null;
33048
+ pathsByModuleId.set(moduleId, path34);
32686
33049
  }
32687
33050
  }
32688
33051
  return {
@@ -32844,14 +33207,14 @@ async function inferMetroModuleIdentity(args) {
32844
33207
  const packageClaims = claimsByPackage.values().next().value;
32845
33208
  if (!packageClaims) continue;
32846
33209
  const exactClaims = packageClaims.filter((assignment2) => {
32847
- const path33 = assignment2.pathsByModuleId.get(moduleId);
32848
- return path33 !== void 0 && !path33.includes("/__rnx_inferred__/");
33210
+ const path34 = assignment2.pathsByModuleId.get(moduleId);
33211
+ return path34 !== void 0 && !path34.includes("/__rnx_inferred__/");
32849
33212
  });
32850
33213
  const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
32851
33214
  const routes = new Set(
32852
33215
  preferredClaims.flatMap((assignment2) => {
32853
- const path33 = assignment2.pathsByModuleId.get(moduleId);
32854
- return path33 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path33)] : [];
33216
+ const path34 = assignment2.pathsByModuleId.get(moduleId);
33217
+ return path34 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path34)] : [];
32855
33218
  })
32856
33219
  );
32857
33220
  if (routes.size !== 1) continue;
@@ -33146,7 +33509,7 @@ function detectFramework2(deps) {
33146
33509
  return "unknown";
33147
33510
  }
33148
33511
  function detectProject(dir) {
33149
- const pkgPath = (0, import_node_path24.join)(dir, "package.json");
33512
+ const pkgPath = (0, import_node_path25.join)(dir, "package.json");
33150
33513
  if (!(0, import_node_fs24.existsSync)(pkgPath)) return null;
33151
33514
  const pkg = readProjectManifest(dir);
33152
33515
  if (!pkg) return null;
@@ -33159,25 +33522,25 @@ function detectProject(dir) {
33159
33522
  if (framework === "unknown") return null;
33160
33523
  return {
33161
33524
  dir,
33162
- name: pkg.name || (0, import_node_path24.basename)(dir),
33525
+ name: pkg.name || (0, import_node_path25.basename)(dir),
33163
33526
  framework,
33164
33527
  // a config file is a config file whatever module system it declares. real
33165
33528
  // apps write .cjs as often as .js, and missing one reads as "this project
33166
33529
  // has no bundler config" and sends the user to create a second one.
33167
33530
  hasViteConfig: CONFIG_EXTENSIONS.some(
33168
- (ext) => (0, import_node_fs24.existsSync)((0, import_node_path24.join)(dir, `vite.config.${ext}`))
33531
+ (ext) => (0, import_node_fs24.existsSync)((0, import_node_path25.join)(dir, `vite.config.${ext}`))
33169
33532
  ),
33170
33533
  hasMetroConfig: CONFIG_EXTENSIONS.some(
33171
- (ext) => (0, import_node_fs24.existsSync)((0, import_node_path24.join)(dir, `metro.config.${ext}`))
33534
+ (ext) => (0, import_node_fs24.existsSync)((0, import_node_path25.join)(dir, `metro.config.${ext}`))
33172
33535
  ),
33173
33536
  devCommand: typeof devCommand === "string" ? devCommand : null
33174
33537
  };
33175
33538
  }
33176
- function readProjectMetadata(path33) {
33539
+ function readProjectMetadata(path34) {
33177
33540
  try {
33178
- const info = (0, import_node_fs24.lstatSync)(path33);
33541
+ const info = (0, import_node_fs24.lstatSync)(path34);
33179
33542
  if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
33180
- return (0, import_node_fs24.readFileSync)(path33, "utf8");
33543
+ return (0, import_node_fs24.readFileSync)(path34, "utf8");
33181
33544
  } catch {
33182
33545
  return null;
33183
33546
  }
@@ -33186,18 +33549,18 @@ function metadataValue(value, key) {
33186
33549
  if (!value || typeof value !== "object") return void 0;
33187
33550
  return Object.getOwnPropertyDescriptor(value, key)?.value;
33188
33551
  }
33189
- function readProjectJson(path33) {
33190
- const text = readProjectMetadata(path33);
33191
- if (text === null) return null;
33552
+ function readProjectJson(path34) {
33553
+ const text2 = readProjectMetadata(path34);
33554
+ if (text2 === null) return null;
33192
33555
  try {
33193
- const value = JSON.parse(text);
33556
+ const value = JSON.parse(text2);
33194
33557
  return value;
33195
33558
  } catch {
33196
33559
  return null;
33197
33560
  }
33198
33561
  }
33199
33562
  function readProjectManifest(dir) {
33200
- const parsed = readProjectJson((0, import_node_path24.join)(dir, "package.json"));
33563
+ const parsed = readProjectJson((0, import_node_path25.join)(dir, "package.json"));
33201
33564
  if (!parsed || typeof parsed !== "object") return null;
33202
33565
  const record = (value) => {
33203
33566
  if (!value || typeof value !== "object") return {};
@@ -33214,23 +33577,23 @@ function readProjectManifest(dir) {
33214
33577
  devDependencies: record(metadataValue(parsed, "devDependencies"))
33215
33578
  };
33216
33579
  }
33217
- var import_node_fs24, import_node_path24, import_json5, import_yaml, CONFIG_EXTENSIONS;
33580
+ var import_node_fs24, import_node_path25, import_json52, import_yaml, CONFIG_EXTENSIONS;
33218
33581
  var init_detect = __esm({
33219
33582
  "cli/commands/detect.ts"() {
33220
33583
  "use strict";
33221
33584
  import_node_fs24 = require("node:fs");
33222
- import_node_path24 = require("node:path");
33223
- import_json5 = __toESM(require("json5"), 1);
33585
+ import_node_path25 = require("node:path");
33586
+ import_json52 = __toESM(require("json5"), 1);
33224
33587
  import_yaml = require("yaml");
33225
33588
  CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
33226
33589
  }
33227
33590
  });
33228
33591
 
33229
33592
  // cli/cloud-client.ts
33230
- function failureSentence(text) {
33593
+ function failureSentence(text2) {
33231
33594
  let parsed;
33232
33595
  try {
33233
- parsed = JSON.parse(text);
33596
+ parsed = JSON.parse(text2);
33234
33597
  } catch {
33235
33598
  return null;
33236
33599
  }
@@ -33243,11 +33606,11 @@ function failureSentence(text) {
33243
33606
  if (typeof parsed.error === "string") return parsed.error;
33244
33607
  return null;
33245
33608
  }
33246
- function responseError(status, text) {
33247
- const parsed = text ? failureSentence(text) : null;
33609
+ function responseError(status, text2) {
33610
+ const parsed = text2 ? failureSentence(text2) : null;
33248
33611
  const sentence = parsed && ACCOUNT_CHOICE_REFUSALS.has(parsed) ? CHOOSE_ACCOUNT_HINT : parsed;
33249
33612
  return new Error(
33250
- `remote simulator request failed (${status})${sentence ? `: ${sentence}` : text.trim() ? `: ${text.trim()}` : ""}`
33613
+ `remote simulator request failed (${status})${sentence ? `: ${sentence}` : text2.trim() ? `: ${text2.trim()}` : ""}`
33251
33614
  );
33252
33615
  }
33253
33616
  function resolveCloudOrigin(value) {
@@ -33256,8 +33619,8 @@ function resolveCloudOrigin(value) {
33256
33619
  return normalizeCloudOrigin(source);
33257
33620
  }
33258
33621
  function readImmutableBundleSource(bundlePath) {
33259
- const filepath = (0, import_node_path25.resolve)(bundlePath);
33260
- if ((0, import_node_path25.extname)(filepath) !== ".js") {
33622
+ const filepath = (0, import_node_path26.resolve)(bundlePath);
33623
+ if ((0, import_node_path26.extname)(filepath) !== ".js") {
33261
33624
  throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
33262
33625
  }
33263
33626
  const descriptor = (0, import_node_fs25.openSync)(filepath, "r");
@@ -33302,14 +33665,14 @@ async function fetchBundleSource(bundleUrl) {
33302
33665
  `${REMOTE_COMMAND} could not fetch bundle from ${bundleUrl}: HTTP ${response.status}${response.statusText ? ` ${response.statusText}` : ""}`
33303
33666
  );
33304
33667
  }
33305
- const text = await response.text();
33306
- if (text.length === 0) {
33668
+ const text2 = await response.text();
33669
+ if (text2.length === 0) {
33307
33670
  throw new Error(`${REMOTE_COMMAND} bundle is empty`);
33308
33671
  }
33309
- if (text.includes("\0") || !text.includes("__d(") || !text.includes("__r(")) {
33672
+ if (text2.includes("\0") || !text2.includes("__d(") || !text2.includes("__r(")) {
33310
33673
  throw new Error(`${REMOTE_COMMAND} requires a Metro JavaScript bundle`);
33311
33674
  }
33312
- return text;
33675
+ return text2;
33313
33676
  }
33314
33677
  function isLoopbackBundleUrl(bundleInput) {
33315
33678
  if (!bundleInput.startsWith("http://")) return false;
@@ -33332,9 +33695,9 @@ async function loadBundleSource(bundleInput) {
33332
33695
  return readImmutableBundleSource(bundleInput);
33333
33696
  }
33334
33697
  function listMetroAssetDest(assetsPath) {
33335
- const directory = (0, import_node_path25.resolve)(assetsPath);
33698
+ const directory = (0, import_node_path26.resolve)(assetsPath);
33336
33699
  if (!(0, import_node_fs25.existsSync)(directory)) return { directory, files: [], truncated: false };
33337
- const skipNested = (0, import_node_fs25.existsSync)((0, import_node_path25.join)(directory, "package.json"));
33700
+ const skipNested = (0, import_node_fs25.existsSync)((0, import_node_path26.join)(directory, "package.json"));
33338
33701
  const files = [];
33339
33702
  let truncated = false;
33340
33703
  const walk2 = (dir, prefix) => {
@@ -33352,7 +33715,7 @@ function listMetroAssetDest(assetsPath) {
33352
33715
  if (entry.isDirectory()) {
33353
33716
  if (entry.name === ".git") continue;
33354
33717
  if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
33355
- walk2((0, import_node_path25.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
33718
+ walk2((0, import_node_path26.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
33356
33719
  } else if (entry.isFile()) {
33357
33720
  files.push(prefix ? `${prefix}/${entry.name}` : entry.name);
33358
33721
  }
@@ -33387,7 +33750,7 @@ function distinctByContent(directory, options) {
33387
33750
  for (const relative3 of options) {
33388
33751
  let bytes;
33389
33752
  try {
33390
- bytes = (0, import_node_fs25.readFileSync)((0, import_node_path25.join)(directory, relative3));
33753
+ bytes = (0, import_node_fs25.readFileSync)((0, import_node_path26.join)(directory, relative3));
33391
33754
  } catch {
33392
33755
  continue;
33393
33756
  }
@@ -33419,7 +33782,7 @@ function placeMetroDescriptor(listing, descriptor) {
33419
33782
  let bytes;
33420
33783
  try {
33421
33784
  bytes = combination.map(
33422
- (relative3) => (0, import_node_fs25.readFileSync)((0, import_node_path25.join)(listing.directory, relative3))
33785
+ (relative3) => (0, import_node_fs25.readFileSync)((0, import_node_path26.join)(listing.directory, relative3))
33423
33786
  );
33424
33787
  } catch {
33425
33788
  continue;
@@ -33447,7 +33810,7 @@ function unverifiedContentKey(dest, fileDigests) {
33447
33810
  return JSON.stringify(
33448
33811
  dest.placements.map(
33449
33812
  (placement) => placement.verified ? null : [...placement.files].map(([scale, relative3]) => {
33450
- const file = (0, import_node_path25.join)(dest.directory, relative3);
33813
+ const file = (0, import_node_path26.join)(dest.directory, relative3);
33451
33814
  let digest = fileDigests.get(file);
33452
33815
  if (digest === void 0) {
33453
33816
  digest = (0, import_node_crypto11.createHash)("sha256").update((0, import_node_fs25.readFileSync)(file)).digest("hex");
@@ -33459,22 +33822,22 @@ function unverifiedContentKey(dest, fileDigests) {
33459
33822
  );
33460
33823
  }
33461
33824
  function searchMetroAssetDest(bundlePath, descriptors) {
33462
- const bundleDirectory = (0, import_node_path25.dirname)((0, import_node_path25.resolve)(bundlePath));
33825
+ const bundleDirectory = (0, import_node_path26.dirname)((0, import_node_path26.resolve)(bundlePath));
33463
33826
  const candidates = [
33464
- (0, import_node_path25.join)(bundleDirectory, "assets"),
33827
+ (0, import_node_path26.join)(bundleDirectory, "assets"),
33465
33828
  bundleDirectory,
33466
- (0, import_node_path25.resolve)(bundleDirectory, "..", "assets")
33829
+ (0, import_node_path26.resolve)(bundleDirectory, "..", "assets")
33467
33830
  ];
33468
33831
  const cwd = process.cwd();
33469
33832
  let projectDirectory = null;
33470
33833
  for (const start of [bundleDirectory, cwd]) {
33471
- let directory = (0, import_node_path25.resolve)(start);
33834
+ let directory = (0, import_node_path26.resolve)(start);
33472
33835
  while (true) {
33473
33836
  if (detectProject(directory)?.hasMetroConfig) {
33474
33837
  projectDirectory = directory;
33475
33838
  break;
33476
33839
  }
33477
- const parent = (0, import_node_path25.dirname)(directory);
33840
+ const parent = (0, import_node_path26.dirname)(directory);
33478
33841
  if (parent === directory) break;
33479
33842
  directory = parent;
33480
33843
  }
@@ -33482,11 +33845,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
33482
33845
  }
33483
33846
  if (projectDirectory) {
33484
33847
  candidates.push(
33485
- (0, import_node_path25.join)(projectDirectory, "assets"),
33486
- (0, import_node_path25.join)(projectDirectory, "dist"),
33487
- (0, import_node_path25.join)(projectDirectory, "dist", "assets"),
33488
- (0, import_node_path25.join)(projectDirectory, "build"),
33489
- (0, import_node_path25.join)(projectDirectory, "build", "assets")
33848
+ (0, import_node_path26.join)(projectDirectory, "assets"),
33849
+ (0, import_node_path26.join)(projectDirectory, "dist"),
33850
+ (0, import_node_path26.join)(projectDirectory, "dist", "assets"),
33851
+ (0, import_node_path26.join)(projectDirectory, "build"),
33852
+ (0, import_node_path26.join)(projectDirectory, "build", "assets")
33490
33853
  );
33491
33854
  }
33492
33855
  const searched = [];
@@ -33494,7 +33857,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
33494
33857
  const stale = [];
33495
33858
  let truncated = false;
33496
33859
  for (const candidate of candidates) {
33497
- const directory = (0, import_node_path25.resolve)(candidate);
33860
+ const directory = (0, import_node_path26.resolve)(candidate);
33498
33861
  if (searched.includes(directory)) continue;
33499
33862
  searched.push(directory);
33500
33863
  const listing = listMetroAssetDest(directory);
@@ -33603,7 +33966,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
33603
33966
  );
33604
33967
  }
33605
33968
  const relative3 = placement?.files.get(variant.scale);
33606
- if (relative3 && dest) return (0, import_node_fs25.readFileSync)((0, import_node_path25.join)(dest.directory, relative3));
33969
+ if (relative3 && dest) return (0, import_node_fs25.readFileSync)((0, import_node_path26.join)(dest.directory, relative3));
33607
33970
  if (placement && placement.files.size > 0) return null;
33608
33971
  if (placement && placement.ambiguous.length > 0 && dest) {
33609
33972
  throw new Error(
@@ -33632,7 +33995,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
33632
33995
  );
33633
33996
  const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
33634
33997
  throw new Error(
33635
- `${command} could not read ${(0, import_node_path25.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\`.`
33998
+ `${command} could not read ${(0, import_node_path26.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\`.`
33636
33999
  );
33637
34000
  });
33638
34001
  return {
@@ -33818,13 +34181,13 @@ function createCloudBridgeForParsed(parsed) {
33818
34181
  if (!session) return null;
33819
34182
  return session.service === "box" ? new CloudBoxBridge(session) : new CloudBridge(session);
33820
34183
  }
33821
- var import_node_crypto11, import_node_fs25, import_node_path25, 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;
34184
+ var import_node_crypto11, import_node_fs25, import_node_path26, 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;
33822
34185
  var init_cloud_client = __esm({
33823
34186
  "cli/cloud-client.ts"() {
33824
34187
  "use strict";
33825
34188
  import_node_crypto11 = require("node:crypto");
33826
34189
  import_node_fs25 = require("node:fs");
33827
- import_node_path25 = require("node:path");
34190
+ import_node_path26 = require("node:path");
33828
34191
  init_metroAssetArtifact();
33829
34192
  init_metroCloudArtifact();
33830
34193
  init_metro_fingerprint_registry_client();
@@ -33887,11 +34250,11 @@ var init_cloud_client = __esm({
33887
34250
  `could not reach the remote simulator at ${this.session.apiOrigin}: ${error instanceof Error ? error.message : String(error)}`
33888
34251
  );
33889
34252
  }
33890
- const text = await response.text();
33891
- if (!response.ok) throw responseError(response.status, text);
34253
+ const text2 = await response.text();
34254
+ if (!response.ok) throw responseError(response.status, text2);
33892
34255
  let parsed;
33893
34256
  try {
33894
- parsed = JSON.parse(text);
34257
+ parsed = JSON.parse(text2);
33895
34258
  } catch {
33896
34259
  throw new Error("remote simulator command returned unreadable JSON");
33897
34260
  }
@@ -33958,11 +34321,11 @@ var init_cloud_client = __esm({
33958
34321
  `could not reach box ${this.session.boxId} at ${this.session.apiOrigin}: ${error instanceof Error ? error.message : String(error)}`
33959
34322
  );
33960
34323
  }
33961
- const text = await response.text();
33962
- if (!response.ok) throw responseError(response.status, text);
34324
+ const text2 = await response.text();
34325
+ if (!response.ok) throw responseError(response.status, text2);
33963
34326
  let parsed;
33964
34327
  try {
33965
- parsed = JSON.parse(text);
34328
+ parsed = JSON.parse(text2);
33966
34329
  } catch {
33967
34330
  throw new Error("box command returned unreadable JSON");
33968
34331
  }
@@ -35241,8 +35604,8 @@ var init_bridge_host = __esm({
35241
35604
  for await (const chunk of req) {
35242
35605
  chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
35243
35606
  }
35244
- const text = Buffer.concat(chunks).toString("utf8").trim();
35245
- const parsed = text ? JSON.parse(text) : {};
35607
+ const text2 = Buffer.concat(chunks).toString("utf8").trim();
35608
+ const parsed = text2 ? JSON.parse(text2) : {};
35246
35609
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
35247
35610
  throw new Error("send to box needs a json object body");
35248
35611
  }
@@ -36336,7 +36699,7 @@ var init_parent_pid = __esm({
36336
36699
 
36337
36700
  // cli/secure-file.ts
36338
36701
  function writeSecureJsonAtomic(filepath, value) {
36339
- (0, import_node_fs26.mkdirSync)((0, import_node_path26.dirname)(filepath), { recursive: true });
36702
+ (0, import_node_fs26.mkdirSync)((0, import_node_path27.dirname)(filepath), { recursive: true });
36340
36703
  const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto12.randomUUID)()}`;
36341
36704
  let descriptor = null;
36342
36705
  try {
@@ -36354,13 +36717,13 @@ function writeSecureJsonAtomic(filepath, value) {
36354
36717
  throw error;
36355
36718
  }
36356
36719
  }
36357
- var import_node_crypto12, import_node_fs26, import_node_path26;
36720
+ var import_node_crypto12, import_node_fs26, import_node_path27;
36358
36721
  var init_secure_file = __esm({
36359
36722
  "cli/secure-file.ts"() {
36360
36723
  "use strict";
36361
36724
  import_node_crypto12 = require("node:crypto");
36362
36725
  import_node_fs26 = require("node:fs");
36363
- import_node_path26 = require("node:path");
36726
+ import_node_path27 = require("node:path");
36364
36727
  }
36365
36728
  });
36366
36729
 
@@ -36545,17 +36908,17 @@ function liveDevBridgeLockfiles() {
36545
36908
  return readDevBridgeLockfiles().filter((lockfile) => isDevBridgeLockfileFresh(lockfile));
36546
36909
  }
36547
36910
  function checkoutRoot(cwd) {
36548
- let current = import_node_path27.default.resolve(cwd);
36911
+ let current = import_node_path28.default.resolve(cwd);
36549
36912
  while (true) {
36550
- if (import_node_fs27.default.existsSync(import_node_path27.default.join(current, ".git"))) return current;
36551
- const parent = import_node_path27.default.dirname(current);
36913
+ if (import_node_fs27.default.existsSync(import_node_path28.default.join(current, ".git"))) return current;
36914
+ const parent = import_node_path28.default.dirname(current);
36552
36915
  if (parent === current) return null;
36553
36916
  current = parent;
36554
36917
  }
36555
36918
  }
36556
36919
  function pathContains(parent, child) {
36557
- const relative3 = import_node_path27.default.relative(parent, child);
36558
- return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path27.default.sep}`) && !import_node_path27.default.isAbsolute(relative3);
36920
+ const relative3 = import_node_path28.default.relative(parent, child);
36921
+ return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path28.default.sep}`) && !import_node_path28.default.isAbsolute(relative3);
36559
36922
  }
36560
36923
  function resolveDefaultDevBridgeLockfile() {
36561
36924
  const lockfiles = liveDevBridgeLockfiles();
@@ -37055,18 +37418,18 @@ async function evalInBridge(bridge, code, opts = {}) {
37055
37418
  if (opts.acquireLock) payload.acquireLock = true;
37056
37419
  return bridge.send(payload);
37057
37420
  }
37058
- async function callInBridge(bridge, path33, ...args) {
37059
- return bridge.send({ type: "call", path: path33, args });
37421
+ async function callInBridge(bridge, path34, ...args) {
37422
+ return bridge.send({ type: "call", path: path34, args });
37060
37423
  }
37061
- async function callInBridgeWrite(bridge, path33, ...args) {
37062
- return bridge.send({ type: "call", path: path33, args, acquireLock: true });
37424
+ async function callInBridgeWrite(bridge, path34, ...args) {
37425
+ return bridge.send({ type: "call", path: path34, args, acquireLock: true });
37063
37426
  }
37064
- var import_node_fs27, import_node_path27, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
37427
+ var import_node_fs27, import_node_path28, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
37065
37428
  var init_ws_bridge = __esm({
37066
37429
  "cli/ws-bridge.ts"() {
37067
37430
  "use strict";
37068
37431
  import_node_fs27 = __toESM(require("node:fs"), 1);
37069
- import_node_path27 = __toESM(require("node:path"), 1);
37432
+ import_node_path28 = __toESM(require("node:path"), 1);
37070
37433
  import_ws2 = require("ws");
37071
37434
  init_bridge_constants();
37072
37435
  init_cli_constants();
@@ -37194,8 +37557,8 @@ function getDefaultPortForProtocol(protocol) {
37194
37557
  return protocol === "https:" ? 443 : 80;
37195
37558
  }
37196
37559
  function isBaseServerUrl(url) {
37197
- const path33 = url.pathname || "/";
37198
- return (path33 === "/" || path33 === "") && !url.search && !url.hash;
37560
+ const path34 = url.pathname || "/";
37561
+ return (path34 === "/" || path34 === "") && !url.search && !url.hash;
37199
37562
  }
37200
37563
  async function resolvePortViaServerScan(port) {
37201
37564
  try {
@@ -37423,14 +37786,14 @@ function readProjectDotEnv(envsRoot, env = process.env) {
37423
37786
  const notices = [];
37424
37787
  const selection = selectEnvFile(env, notices);
37425
37788
  const requestedPaths = [
37426
- import_node_path28.default.resolve(import_node_path28.default.join(envsRoot, selection.name)),
37427
- import_node_path28.default.resolve(selection.name)
37789
+ import_node_path29.default.resolve(import_node_path29.default.join(envsRoot, selection.name)),
37790
+ import_node_path29.default.resolve(selection.name)
37428
37791
  ];
37429
37792
  const candidates = [
37430
37793
  ...requestedPaths,
37431
- import_node_path28.default.resolve(import_node_path28.default.join(envsRoot, DEFAULT_ENV_FILE))
37794
+ import_node_path29.default.resolve(import_node_path29.default.join(envsRoot, DEFAULT_ENV_FILE))
37432
37795
  ];
37433
- if (!import_node_fs28.default.existsSync(candidates[2])) candidates.push(import_node_path28.default.resolve(DEFAULT_ENV_FILE));
37796
+ if (!import_node_fs28.default.existsSync(candidates[2])) candidates.push(import_node_path29.default.resolve(DEFAULT_ENV_FILE));
37434
37797
  const tried = [...new Set(candidates)];
37435
37798
  const resolved = tried.find((candidate) => import_node_fs28.default.existsSync(candidate));
37436
37799
  if (!resolved) {
@@ -37462,12 +37825,12 @@ function readProjectDotEnv(envsRoot, env = process.env) {
37462
37825
  }
37463
37826
  return { config, notices };
37464
37827
  }
37465
- var import_node_fs28, import_node_path28, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
37828
+ var import_node_fs28, import_node_path29, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
37466
37829
  var init_dot_env = __esm({
37467
37830
  "src/dot-env.ts"() {
37468
37831
  "use strict";
37469
37832
  import_node_fs28 = __toESM(require("node:fs"), 1);
37470
- import_node_path28 = __toESM(require("node:path"), 1);
37833
+ import_node_path29 = __toESM(require("node:path"), 1);
37471
37834
  DEFAULT_ENV_FILE = ".env";
37472
37835
  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;
37473
37836
  BUILD_SETTING_PATTERN = /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]|\$([A-Za-z_][A-Za-z0-9_]*)/g;
@@ -37491,7 +37854,7 @@ var init_flow_timeout_scale = __esm({
37491
37854
  function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
37492
37855
  const result = {};
37493
37856
  let config = {};
37494
- const appJsonPath = import_node_path29.default.join(projectRoot, "app.json");
37857
+ const appJsonPath = import_node_path30.default.join(projectRoot, "app.json");
37495
37858
  const appJson = import_node_fs29.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs29.default.readFileSync(appJsonPath, "utf8")) : null;
37496
37859
  const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
37497
37860
  (value) => isRecord(value) && typeof value.googleServicesFile === "string"
@@ -37501,9 +37864,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
37501
37864
  "app.config.ts",
37502
37865
  "app.config.cjs",
37503
37866
  "app.config.mjs"
37504
- ].some((name2) => import_node_fs29.default.existsSync(import_node_path29.default.join(projectRoot, name2)));
37867
+ ].some((name2) => import_node_fs29.default.existsSync(import_node_path30.default.join(projectRoot, name2)));
37505
37868
  if (staticExpo || dynamicExpo) {
37506
- const require5 = (0, import_node_module2.createRequire)(import_node_path29.default.join(projectRoot, "package.json"));
37869
+ const require5 = (0, import_node_module2.createRequire)(import_node_path30.default.join(projectRoot, "package.json"));
37507
37870
  const configModule = require5("@expo/config");
37508
37871
  if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
37509
37872
  throw new Error("Expo native configuration is unavailable.");
@@ -37515,20 +37878,20 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
37515
37878
  }
37516
37879
  const ios = config.ios;
37517
37880
  if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
37518
- const iosRoot = import_node_path29.default.join(projectRoot, "ios");
37881
+ const iosRoot = import_node_path30.default.join(projectRoot, "ios");
37519
37882
  if (import_node_fs29.default.existsSync(iosRoot)) {
37520
37883
  const projects2 = import_node_fs29.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
37521
37884
  if (projects2.length > 1)
37522
37885
  throw new Error("native Firebase configuration requires a selected Xcode project");
37523
37886
  if (projects2.length === 1) {
37524
- const xcodeproj = import_node_path29.default.join(iosRoot, projects2[0].name);
37887
+ const xcodeproj = import_node_path30.default.join(iosRoot, projects2[0].name);
37525
37888
  const appTargets = listXcodeAppTargets(xcodeproj);
37526
37889
  if (appTargets.length > 1)
37527
37890
  throw new Error("native Firebase configuration requires a selected app target");
37528
37891
  if (appTargets.length === 1) {
37529
37892
  const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
37530
37893
  const delegates = app.allSources.filter(
37531
- (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path29.default.basename(file))
37894
+ (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path30.default.basename(file))
37532
37895
  );
37533
37896
  const defaultConfigured = delegates.some((file) => {
37534
37897
  const source = import_node_fs29.default.readFileSync(file, "utf8").replace(
@@ -37559,14 +37922,14 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
37559
37922
  });
37560
37923
  if (defaultConfigured) {
37561
37924
  const resources = app.resources.filter(
37562
- (file) => /^GoogleService-Info\.plist$/.test(import_node_path29.default.basename(file))
37925
+ (file) => /^GoogleService-Info\.plist$/.test(import_node_path30.default.basename(file))
37563
37926
  );
37564
37927
  if (resources.length !== 1)
37565
37928
  throw new Error(
37566
37929
  "native Firebase default initialization requires one GoogleService-Info.plist build resource"
37567
37930
  );
37568
37931
  config.ios = {
37569
- googleServicesFile: import_node_path29.default.relative(
37932
+ googleServicesFile: import_node_path30.default.relative(
37570
37933
  import_node_fs29.default.realpathSync(projectRoot),
37571
37934
  resources[0]
37572
37935
  )
@@ -37581,7 +37944,7 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
37581
37944
  if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
37582
37945
  try {
37583
37946
  const source = import_node_fs29.default.readFileSync(
37584
- import_node_path29.default.resolve(projectRoot, native.googleServicesFile),
37947
+ import_node_path30.default.resolve(projectRoot, native.googleServicesFile),
37585
37948
  "utf8"
37586
37949
  );
37587
37950
  const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
@@ -37633,13 +37996,13 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
37633
37996
  }
37634
37997
  return result;
37635
37998
  }
37636
- var import_node_fs29, import_node_module2, import_node_path29;
37999
+ var import_node_fs29, import_node_module2, import_node_path30;
37637
38000
  var init_native_firebase_config = __esm({
37638
38001
  "src/native-firebase-config.ts"() {
37639
38002
  "use strict";
37640
38003
  import_node_fs29 = __toESM(require("node:fs"), 1);
37641
38004
  import_node_module2 = require("node:module");
37642
- import_node_path29 = __toESM(require("node:path"), 1);
38005
+ import_node_path30 = __toESM(require("node:path"), 1);
37643
38006
  init_is_record();
37644
38007
  init_plist();
37645
38008
  init_xcode_project();
@@ -37767,45 +38130,45 @@ function readText(file) {
37767
38130
  }
37768
38131
  function catalogFiles(dir, found) {
37769
38132
  for (const entry of listDir(dir)) {
37770
- const full = import_node_path30.default.join(dir, entry.name);
38133
+ const full = import_node_path31.default.join(dir, entry.name);
37771
38134
  if (entry.isDirectory()) catalogFiles(full, found);
37772
38135
  else if (entry.name === "Contents.json") found.push(full);
37773
38136
  }
37774
38137
  }
37775
38138
  function discoverAppCatalog(appDir) {
37776
- const iosDir = import_node_path30.default.join(appDir, "ios");
38139
+ const iosDir = import_node_path31.default.join(appDir, "ios");
37777
38140
  const target = listDir(iosDir).find(
37778
- (entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path30.default.join(iosDir, entry.name)).some(
38141
+ (entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path31.default.join(iosDir, entry.name)).some(
37779
38142
  (file) => /^AppDelegate\.(swift|mm|m)$/.test(file.name)
37780
38143
  )
37781
38144
  );
37782
38145
  if (!target) return null;
37783
- const targetDir = import_node_path30.default.join(iosDir, target.name);
38146
+ const targetDir = import_node_path31.default.join(iosDir, target.name);
37784
38147
  const files = [];
37785
38148
  for (const entry of listDir(targetDir)) {
37786
38149
  if (entry.isDirectory() && entry.name.endsWith(".xcassets"))
37787
- catalogFiles(import_node_path30.default.join(targetDir, entry.name), files);
38150
+ catalogFiles(import_node_path31.default.join(targetDir, entry.name), files);
37788
38151
  }
37789
38152
  const relative3 = files.map(
37790
- (file) => import_node_path30.default.relative(targetDir, file).split(import_node_path30.default.sep).join(import_node_path30.default.posix.sep)
38153
+ (file) => import_node_path31.default.relative(targetDir, file).split(import_node_path31.default.sep).join(import_node_path31.default.posix.sep)
37791
38154
  );
37792
38155
  const colors = enumerateBundleColors(
37793
38156
  relative3,
37794
- (candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path30.default.join(targetDir, candidate)) : null
38157
+ (candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path31.default.join(targetDir, candidate)) : null
37795
38158
  );
37796
38159
  const pbxproj = listDir(iosDir).find((entry) => entry.name.endsWith(".xcodeproj"));
37797
- const accentName = readText(import_node_path30.default.join(targetDir, "Info.plist"))?.match(PLIST_ACCENT)?.[1] ?? (pbxproj ? readText(import_node_path30.default.join(iosDir, pbxproj.name, "project.pbxproj"))?.match(
38160
+ const accentName = readText(import_node_path31.default.join(targetDir, "Info.plist"))?.match(PLIST_ACCENT)?.[1] ?? (pbxproj ? readText(import_node_path31.default.join(iosDir, pbxproj.name, "project.pbxproj"))?.match(
37798
38161
  ACCENT_BUILD_SETTING
37799
38162
  )?.[1] : void 0) ?? null;
37800
38163
  if (accentName === null && Object.keys(colors).length === 0) return null;
37801
38164
  return { colors, accentName };
37802
38165
  }
37803
- var import_node_fs30, import_node_path30, ACCENT_BUILD_SETTING, PLIST_ACCENT;
38166
+ var import_node_fs30, import_node_path31, ACCENT_BUILD_SETTING, PLIST_ACCENT;
37804
38167
  var init_app_catalog = __esm({
37805
38168
  "cli/app-catalog.ts"() {
37806
38169
  "use strict";
37807
38170
  import_node_fs30 = __toESM(require("node:fs"), 1);
37808
- import_node_path30 = __toESM(require("node:path"), 1);
38171
+ import_node_path31 = __toESM(require("node:path"), 1);
37809
38172
  init_bundleAssets();
37810
38173
  ACCENT_BUILD_SETTING = /ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "?([^";]+)"?;/;
37811
38174
  PLIST_ACCENT = /<key>NSAccentColorName<\/key>\s*<string>([^<]+)<\/string>/;
@@ -37815,7 +38178,7 @@ var init_app_catalog = __esm({
37815
38178
  // cli/app-project.ts
37816
38179
  function firstNamedFile(dir, names) {
37817
38180
  for (const name2 of names) {
37818
- const candidate = import_node_path31.default.join(dir, name2);
38181
+ const candidate = import_node_path32.default.join(dir, name2);
37819
38182
  try {
37820
38183
  if (import_node_fs31.default.statSync(candidate).isFile()) return candidate;
37821
38184
  } catch {
@@ -37830,24 +38193,24 @@ function findRNXAppConfig(dir) {
37830
38193
  return firstNamedFile(dir, PEACH_APP_CONFIG_NAMES);
37831
38194
  }
37832
38195
  function resolveAppProject(projectRoot) {
37833
- const appDir = import_node_path31.default.resolve(projectRoot);
38196
+ const appDir = import_node_path32.default.resolve(projectRoot);
37834
38197
  try {
37835
38198
  if (!import_node_fs31.default.statSync(appDir).isDirectory()) return null;
37836
38199
  } catch {
37837
38200
  return null;
37838
38201
  }
37839
38202
  const configPath = findRNXAppConfig(appDir);
37840
- if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs31.default.existsSync(import_node_path31.default.join(appDir, "package.json"))) {
38203
+ if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs31.default.existsSync(import_node_path32.default.join(appDir, "package.json"))) {
37841
38204
  return null;
37842
38205
  }
37843
38206
  return { appDir, configPath };
37844
38207
  }
37845
- var import_node_fs31, import_node_path31, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
38208
+ var import_node_fs31, import_node_path32, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
37846
38209
  var init_app_project = __esm({
37847
38210
  "cli/app-project.ts"() {
37848
38211
  "use strict";
37849
38212
  import_node_fs31 = __toESM(require("node:fs"), 1);
37850
- import_node_path31 = __toESM(require("node:path"), 1);
38213
+ import_node_path32 = __toESM(require("node:path"), 1);
37851
38214
  EXPO_APP_CONFIG_NAMES = [
37852
38215
  "app.config.js",
37853
38216
  "app.config.ts",
@@ -37870,12 +38233,12 @@ function resolveFileEntries(entries, configDir) {
37870
38233
  return Object.fromEntries(
37871
38234
  Object.entries(entries).map(([name2, resolution]) => [
37872
38235
  name2,
37873
- resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path32.default.resolve(configDir, resolution.file) } : resolution
38236
+ resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path33.default.resolve(configDir, resolution.file) } : resolution
37874
38237
  ])
37875
38238
  );
37876
38239
  }
37877
38240
  function resolveConfigReplacementFiles(config, configPath) {
37878
- const configDir = import_node_path32.default.dirname(configPath);
38241
+ const configDir = import_node_path33.default.dirname(configPath);
37879
38242
  return {
37880
38243
  ...config,
37881
38244
  modules: resolveFileEntries(config.modules, configDir),
@@ -37912,12 +38275,12 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
37912
38275
  const project = resolveAppProject(startDir);
37913
38276
  return { project, config: await loadRNXAppConfig(project) };
37914
38277
  }
37915
- var import_node_module3, import_node_path32, import_jiti, require2;
38278
+ var import_node_module3, import_node_path33, import_jiti, require2;
37916
38279
  var init_app_config = __esm({
37917
38280
  "cli/app-config.ts"() {
37918
38281
  "use strict";
37919
38282
  import_node_module3 = require("node:module");
37920
- import_node_path32 = __toESM(require("node:path"), 1);
38283
+ import_node_path33 = __toESM(require("node:path"), 1);
37921
38284
  import_jiti = require("jiti");
37922
38285
  init_config();
37923
38286
  init_public_brand();
@@ -37980,7 +38343,7 @@ function discoverNativeLinkedAppFonts(opts) {
37980
38343
  }
37981
38344
  for (const entry of entries) {
37982
38345
  if (entry.isSymbolicLink()) continue;
37983
- const fullPath = import_node_path33.default.join(current.dir, entry.name);
38346
+ const fullPath = import_node_path34.default.join(current.dir, entry.name);
37984
38347
  if (entry.isDirectory()) {
37985
38348
  if (current.depth < 4 && pending.length < 64 && !entry.name.startsWith(".")) {
37986
38349
  pending.push({ dir: fullPath, depth: current.depth + 1 });
@@ -37988,15 +38351,15 @@ function discoverNativeLinkedAppFonts(opts) {
37988
38351
  continue;
37989
38352
  }
37990
38353
  if (!entry.isFile() || !/\.(ttf|otf|woff|woff2)$/i.test(entry.name)) continue;
37991
- const relative3 = import_node_path33.default.relative(root, fullPath).split(import_node_path33.default.sep).join("/");
37992
- fontPaths.push(import_node_path33.default.posix.join(metroPathPrefix, relative3));
38354
+ const relative3 = import_node_path34.default.relative(root, fullPath).split(import_node_path34.default.sep).join("/");
38355
+ fontPaths.push(import_node_path34.default.posix.join(metroPathPrefix, relative3));
37993
38356
  if (fontPaths.length >= 256) break;
37994
38357
  }
37995
38358
  }
37996
38359
  };
37997
38360
  try {
37998
38361
  const packageJson = JSON.parse(
37999
- import_node_fs32.default.readFileSync(import_node_path33.default.join(selectedAppDir, "package.json"), "utf8")
38362
+ import_node_fs32.default.readFileSync(import_node_path34.default.join(selectedAppDir, "package.json"), "utf8")
38000
38363
  );
38001
38364
  const dependencyNames = /* @__PURE__ */ new Set();
38002
38365
  for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
@@ -38011,32 +38374,32 @@ function discoverNativeLinkedAppFonts(opts) {
38011
38374
  const config = Reflect.get(packageJson, "reactNativeVectorIcons");
38012
38375
  const configuredFontDir = config && typeof config === "object" ? Reflect.get(config, "fontDir") : null;
38013
38376
  const configuredDir = typeof configuredFontDir === "string" ? configuredFontDir : "rnvi-fonts";
38014
- const root = import_node_path33.default.resolve(selectedAppDir, configuredDir);
38015
- const relativeRoot = import_node_path33.default.relative(selectedAppDir, root);
38016
- if (!relativeRoot.startsWith("..") && !import_node_path33.default.isAbsolute(relativeRoot)) {
38017
- collectFontFiles(root, relativeRoot.split(import_node_path33.default.sep).join("/"));
38377
+ const root = import_node_path34.default.resolve(selectedAppDir, configuredDir);
38378
+ const relativeRoot = import_node_path34.default.relative(selectedAppDir, root);
38379
+ if (!relativeRoot.startsWith("..") && !import_node_path34.default.isAbsolute(relativeRoot)) {
38380
+ collectFontFiles(root, relativeRoot.split(import_node_path34.default.sep).join("/"));
38018
38381
  }
38019
- const bundleDir = import_node_path33.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
38020
- const appRelativeDir = bundleDir.split("/").join(import_node_path33.default.sep);
38382
+ const bundleDir = import_node_path34.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
38383
+ const appRelativeDir = bundleDir.split("/").join(import_node_path34.default.sep);
38021
38384
  const metroRootCandidates = [selectedAppDir];
38022
- if (bundleDir && selectedAppDir.endsWith(import_node_path33.default.sep + appRelativeDir)) {
38385
+ if (bundleDir && selectedAppDir.endsWith(import_node_path34.default.sep + appRelativeDir)) {
38023
38386
  metroRootCandidates.push(selectedAppDir.slice(0, -appRelativeDir.length - 1));
38024
38387
  }
38025
- const vectorIconRequire = (0, import_node_module4.createRequire)(import_node_path33.default.join(selectedAppDir, "package.json"));
38388
+ const vectorIconRequire = (0, import_node_module4.createRequire)(import_node_path34.default.join(selectedAppDir, "package.json"));
38026
38389
  for (const dependencyName of vectorIconDependencies) {
38027
38390
  try {
38028
38391
  const entryPath = vectorIconRequire.resolve(dependencyName);
38029
- const dependencyPath = dependencyName.split("/").join(import_node_path33.default.sep);
38030
- const marker = `${import_node_path33.default.sep}node_modules${import_node_path33.default.sep}${dependencyPath}${import_node_path33.default.sep}`;
38392
+ const dependencyPath = dependencyName.split("/").join(import_node_path34.default.sep);
38393
+ const marker = `${import_node_path34.default.sep}node_modules${import_node_path34.default.sep}${dependencyPath}${import_node_path34.default.sep}`;
38031
38394
  const markerIndex = entryPath.lastIndexOf(marker);
38032
38395
  if (markerIndex === -1) continue;
38033
38396
  const packageRoot = entryPath.slice(0, markerIndex + marker.length - 1);
38034
38397
  const fontsDir = dependencyName === "react-native-vector-icons" ? "Fonts" : "fonts";
38035
- const fontsRoot = import_node_path33.default.join(packageRoot, fontsDir);
38398
+ const fontsRoot = import_node_path34.default.join(packageRoot, fontsDir);
38036
38399
  for (const metroRoot of metroRootCandidates) {
38037
38400
  collectFontFiles(
38038
38401
  fontsRoot,
38039
- import_node_path33.default.relative(metroRoot, fontsRoot).split(import_node_path33.default.sep).join("/")
38402
+ import_node_path34.default.relative(metroRoot, fontsRoot).split(import_node_path34.default.sep).join("/")
38040
38403
  );
38041
38404
  }
38042
38405
  } catch {
@@ -38046,32 +38409,32 @@ function discoverNativeLinkedAppFonts(opts) {
38046
38409
  } catch {
38047
38410
  }
38048
38411
  try {
38049
- const configPath = import_node_path33.default.join(selectedAppDir, "react-native.config.js");
38412
+ const configPath = import_node_path34.default.join(selectedAppDir, "react-native.config.js");
38050
38413
  if (import_node_fs32.default.statSync(configPath).isFile()) {
38051
- const appConfigRequire = (0, import_node_module4.createRequire)(import_node_path33.default.join(selectedAppDir, "package.json"));
38414
+ const appConfigRequire = (0, import_node_module4.createRequire)(import_node_path34.default.join(selectedAppDir, "package.json"));
38052
38415
  const rnConfig = appConfigRequire(configPath);
38053
38416
  const assets2 = rnConfig && typeof rnConfig === "object" ? Reflect.get(rnConfig, "assets") : null;
38054
38417
  if (Array.isArray(assets2)) {
38055
38418
  for (const assetDir of assets2) {
38056
38419
  if (typeof assetDir !== "string") continue;
38057
- const root = import_node_path33.default.resolve(selectedAppDir, assetDir);
38058
- const relativeRoot = import_node_path33.default.relative(selectedAppDir, root);
38059
- if (relativeRoot.startsWith("..") || import_node_path33.default.isAbsolute(relativeRoot)) continue;
38060
- collectFontFiles(root, relativeRoot.split(import_node_path33.default.sep).join("/"));
38420
+ const root = import_node_path34.default.resolve(selectedAppDir, assetDir);
38421
+ const relativeRoot = import_node_path34.default.relative(selectedAppDir, root);
38422
+ if (relativeRoot.startsWith("..") || import_node_path34.default.isAbsolute(relativeRoot)) continue;
38423
+ collectFontFiles(root, relativeRoot.split(import_node_path34.default.sep).join("/"));
38061
38424
  }
38062
38425
  }
38063
38426
  }
38064
38427
  } catch {
38065
38428
  }
38066
38429
  if (platform === "ios") {
38067
- const iosDir = import_node_path33.default.join(selectedAppDir, "ios");
38430
+ const iosDir = import_node_path34.default.join(selectedAppDir, "ios");
38068
38431
  try {
38069
38432
  const targetDirs = import_node_fs32.default.readdirSync(iosDir, { withFileTypes: true }).filter(
38070
38433
  (entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
38071
38434
  ).slice(0, 64);
38072
- const plistPaths = [import_node_path33.default.join(iosDir, "Info.plist")];
38435
+ const plistPaths = [import_node_path34.default.join(iosDir, "Info.plist")];
38073
38436
  for (const entry of targetDirs) {
38074
- plistPaths.push(import_node_path33.default.join(iosDir, entry.name, "Info.plist"));
38437
+ plistPaths.push(import_node_path34.default.join(iosDir, entry.name, "Info.plist"));
38075
38438
  }
38076
38439
  for (const plistPath of plistPaths) {
38077
38440
  let parsed;
@@ -38086,12 +38449,12 @@ function discoverNativeLinkedAppFonts(opts) {
38086
38449
  for (const declaredFont of declaredFonts) {
38087
38450
  if (typeof declaredFont !== "string") continue;
38088
38451
  const candidates = [
38089
- import_node_path33.default.resolve(import_node_path33.default.dirname(plistPath), declaredFont),
38090
- import_node_path33.default.resolve(iosDir, declaredFont)
38452
+ import_node_path34.default.resolve(import_node_path34.default.dirname(plistPath), declaredFont),
38453
+ import_node_path34.default.resolve(iosDir, declaredFont)
38091
38454
  ];
38092
38455
  const fontPath = candidates.find((candidate) => {
38093
- const relative3 = import_node_path33.default.relative(selectedAppDir, candidate);
38094
- if (relative3.startsWith("..") || import_node_path33.default.isAbsolute(relative3)) return false;
38456
+ const relative3 = import_node_path34.default.relative(selectedAppDir, candidate);
38457
+ if (relative3.startsWith("..") || import_node_path34.default.isAbsolute(relative3)) return false;
38095
38458
  try {
38096
38459
  return import_node_fs32.default.statSync(candidate).isFile();
38097
38460
  } catch {
@@ -38100,7 +38463,7 @@ function discoverNativeLinkedAppFonts(opts) {
38100
38463
  });
38101
38464
  if (!fontPath) continue;
38102
38465
  fontPaths.push(
38103
- import_node_path33.default.relative(selectedAppDir, fontPath).split(import_node_path33.default.sep).join("/")
38466
+ import_node_path34.default.relative(selectedAppDir, fontPath).split(import_node_path34.default.sep).join("/")
38104
38467
  );
38105
38468
  }
38106
38469
  }
@@ -38142,13 +38505,13 @@ async function resolveMetroProjectRoot(bundleUrl, opts) {
38142
38505
  function encodeAppFontsWire(specs) {
38143
38506
  return specs.map((spec) => `${encodeURIComponent(spec.url)}::${encodeURIComponent(spec.family)}`).join(",");
38144
38507
  }
38145
- var import_node_fs32, import_node_module4, import_node_path33, import_config_plugin_fonts, require3;
38508
+ var import_node_fs32, import_node_module4, import_node_path34, import_config_plugin_fonts, require3;
38146
38509
  var init_app_fonts = __esm({
38147
38510
  "cli/app-fonts.ts"() {
38148
38511
  "use strict";
38149
38512
  import_node_fs32 = __toESM(require("node:fs"), 1);
38150
38513
  import_node_module4 = require("node:module");
38151
- import_node_path33 = __toESM(require("node:path"), 1);
38514
+ import_node_path34 = __toESM(require("node:path"), 1);
38152
38515
  import_config_plugin_fonts = require("peach-engine/engine/config-plugin-fonts");
38153
38516
  init_dev_server_scanner();
38154
38517
  init_backend_origin();
@@ -38303,8 +38666,8 @@ function formatSemanticTree(nodes, opts = {}) {
38303
38666
  node.role ? `[${node.role}]` : node.pressable ? "[tap]" : `<${node.type}>`
38304
38667
  ];
38305
38668
  if (node.text) {
38306
- const text = opts.fullText || node.text.length <= 50 ? node.text : `${node.text.slice(0, 49).trimEnd()}\u2026`;
38307
- parts.push(JSON.stringify(text));
38669
+ const text2 = opts.fullText || node.text.length <= 50 ? node.text : `${node.text.slice(0, 49).trimEnd()}\u2026`;
38670
+ parts.push(JSON.stringify(text2));
38308
38671
  }
38309
38672
  if (node.testID) parts.push(`#${node.testID}`);
38310
38673
  if (node.label && node.label !== node.text) {
@@ -38716,8 +39079,8 @@ function isPeachAccessibilityTree(value) {
38716
39079
  if (field !== void 0 && (typeof field !== "number" || !Number.isFinite(field)))
38717
39080
  return false;
38718
39081
  }
38719
- const text = Reflect.get(value2, "text");
38720
- if (text !== void 0 && typeof text !== "string") return false;
39082
+ const text2 = Reflect.get(value2, "text");
39083
+ if (text2 !== void 0 && typeof text2 !== "string") return false;
38721
39084
  }
38722
39085
  if (!isSemanticGeometry(Reflect.get(node, "frame"))) return false;
38723
39086
  return isPeachAccessibilityTree(Reflect.get(node, "children"));
@@ -39080,7 +39443,7 @@ var init_bridge_diagnostics = __esm({
39080
39443
  function bundleValue(app, key) {
39081
39444
  const read = (0, import_node_child_process11.spawnSync)(
39082
39445
  "plutil",
39083
- ["-extract", key, "raw", "-o", "-", import_node_path34.default.join(app, "Contents/Info.plist")],
39446
+ ["-extract", key, "raw", "-o", "-", import_node_path35.default.join(app, "Contents/Info.plist")],
39084
39447
  { encoding: "utf8" }
39085
39448
  );
39086
39449
  return read.status === 0 ? read.stdout.trim() : null;
@@ -39094,12 +39457,12 @@ function placedHostVersion() {
39094
39457
  function activeDesktopHostApp() {
39095
39458
  return placedHostVersion() ? MAC_HOST_APP : null;
39096
39459
  }
39097
- var import_node_child_process11, import_node_path34, MAC_HOST_APP, HOST_BUNDLE_ID;
39460
+ var import_node_child_process11, import_node_path35, MAC_HOST_APP, HOST_BUNDLE_ID;
39098
39461
  var init_desktop_host_delivery = __esm({
39099
39462
  "src/desktop-host-delivery.ts"() {
39100
39463
  "use strict";
39101
39464
  import_node_child_process11 = require("node:child_process");
39102
- import_node_path34 = __toESM(require("node:path"), 1);
39465
+ import_node_path35 = __toESM(require("node:path"), 1);
39103
39466
  init_src();
39104
39467
  init_home_paths();
39105
39468
  MAC_HOST_APP = "/Applications/Peach.app";
@@ -40646,8 +41009,8 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
40646
41009
  };
40647
41010
  }
40648
41011
  const lock = parseLinuxBrowserLibsLock(linux_browser_libs_lock_default);
40649
- const dir = (0, import_node_path35.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
40650
- if (!(0, import_node_fs33.existsSync)((0, import_node_path35.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
41012
+ const dir = (0, import_node_path36.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
41013
+ if (!(0, import_node_fs33.existsSync)((0, import_node_path36.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
40651
41014
  const url = `${DEFAULT_CLI_RELEASE_ORIGIN}/${linuxBrowserLibsKey(lock.id, arch)}`;
40652
41015
  process.stderr.write(
40653
41016
  `peach: this system lacks ${missing.length} shared libraries ${browser} links; downloading them\u2026
@@ -40675,7 +41038,7 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
40675
41038
  };
40676
41039
  }
40677
41040
  }
40678
- const libraryPath = [(0, import_node_path35.join)(dir, "lib"), (0, import_node_path35.join)(dir, "lib", "nss")].join(":");
41041
+ const libraryPath = [(0, import_node_path36.join)(dir, "lib"), (0, import_node_path36.join)(dir, "lib", "nss")].join(":");
40679
41042
  const stillMissing = missingLibraries(executablePath, libraryPath);
40680
41043
  if (stillMissing.length) {
40681
41044
  return {
@@ -40685,13 +41048,13 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
40685
41048
  }
40686
41049
  return { ok: true, libraryPath };
40687
41050
  }
40688
- var import_node_child_process12, import_node_fs33, import_node_path35, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
41051
+ var import_node_child_process12, import_node_fs33, import_node_path36, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
40689
41052
  var init_linux_browser_libs = __esm({
40690
41053
  "cli/drivers/linux-browser-libs.ts"() {
40691
41054
  "use strict";
40692
41055
  import_node_child_process12 = require("node:child_process");
40693
41056
  import_node_fs33 = require("node:fs");
40694
- import_node_path35 = require("node:path");
41057
+ import_node_path36 = require("node:path");
40695
41058
  init_src();
40696
41059
  init_home_paths();
40697
41060
  init_is_record();
@@ -40720,7 +41083,7 @@ function resolvePlaywright() {
40720
41083
  const corePackagePath = (0, import_node_module6.createRequire)(modulePath).resolve(
40721
41084
  "playwright-core/package.json"
40722
41085
  );
40723
- const cliPath = (0, import_node_path36.join)((0, import_node_path36.dirname)(corePackagePath), "cli.js");
41086
+ const cliPath = (0, import_node_path37.join)((0, import_node_path37.dirname)(corePackagePath), "cli.js");
40724
41087
  if (!(0, import_node_fs34.existsSync)(cliPath)) continue;
40725
41088
  return {
40726
41089
  spec,
@@ -40749,7 +41112,7 @@ async function provisionPlaywright() {
40749
41112
  await installVerifiedTarball({
40750
41113
  url: `https://registry.npmjs.org/playwright-core/-/playwright-core-${version}.tgz`,
40751
41114
  digest: { algorithm, encoding: "base64", value: digest },
40752
- destDir: (0, import_node_path36.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
41115
+ destDir: (0, import_node_path37.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
40753
41116
  installedMarker: "package.json",
40754
41117
  // npm tarballs hold the package under a leading `package/`
40755
41118
  stripComponents: 1,
@@ -40860,14 +41223,14 @@ ${detail}` : ""}`
40860
41223
  libraryPath: libraries.libraryPath
40861
41224
  };
40862
41225
  }
40863
- var import_node_child_process13, import_node_fs34, import_node_module6, import_node_path36;
41226
+ var import_node_child_process13, import_node_fs34, import_node_module6, import_node_path37;
40864
41227
  var init_playwright_provisioning = __esm({
40865
41228
  "cli/drivers/playwright-provisioning.ts"() {
40866
41229
  "use strict";
40867
41230
  import_node_child_process13 = require("node:child_process");
40868
41231
  import_node_fs34 = require("node:fs");
40869
41232
  import_node_module6 = require("node:module");
40870
- import_node_path36 = require("node:path");
41233
+ import_node_path37 = require("node:path");
40871
41234
  init_src();
40872
41235
  init_home_paths();
40873
41236
  init_is_record();
@@ -41351,11 +41714,11 @@ var init_runtime_diagnostics = __esm({
41351
41714
  // cli/commands/skills.ts
41352
41715
  function getSkillsDir() {
41353
41716
  if (typeof __PEACH_BUNDLED_SKILLS__ !== "undefined") {
41354
- const dir = path29.join(rnxHomeDir(), "skills", getCliVersion());
41717
+ const dir = path30.join(rnxHomeDir(), "skills", getCliVersion());
41355
41718
  for (const [file, body] of Object.entries(__PEACH_BUNDLED_SKILLS__)) {
41356
- const target = path29.join(dir, file);
41719
+ const target = path30.join(dir, file);
41357
41720
  if (fs25.existsSync(target)) continue;
41358
- fs25.mkdirSync(path29.dirname(target), { recursive: true });
41721
+ fs25.mkdirSync(path30.dirname(target), { recursive: true });
41359
41722
  fs25.writeFileSync(target, body);
41360
41723
  }
41361
41724
  return dir;
@@ -41364,10 +41727,10 @@ function getSkillsDir() {
41364
41727
  const pkgPath = (0, import_url3.fileURLToPath)(
41365
41728
  import_meta4.resolve(`${rnxPublicBrand.packageName}/package.json`)
41366
41729
  );
41367
- return primaryCheckoutPath(path29.join(path29.dirname(pkgPath), "skills"));
41730
+ return primaryCheckoutPath(path30.join(path30.dirname(pkgPath), "skills"));
41368
41731
  } catch {
41369
- const __dirname = path29.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
41370
- return primaryCheckoutPath(path29.resolve(__dirname, "../../skills"));
41732
+ const __dirname = path30.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
41733
+ return primaryCheckoutPath(path30.resolve(__dirname, "../../skills"));
41371
41734
  }
41372
41735
  }
41373
41736
  function primaryCheckoutPath(dir) {
@@ -41390,8 +41753,8 @@ function primaryCheckoutPath(dir) {
41390
41753
  } catch {
41391
41754
  return dir;
41392
41755
  }
41393
- if (path29.basename(common) !== ".git") return dir;
41394
- const primary = path29.join(path29.dirname(common), path29.relative(top, dir));
41756
+ if (path30.basename(common) !== ".git") return dir;
41757
+ const primary = path30.join(path30.dirname(common), path30.relative(top, dir));
41395
41758
  return fs25.existsSync(primary) ? primary : dir;
41396
41759
  }
41397
41760
  function skillsDir() {
@@ -41399,8 +41762,8 @@ function skillsDir() {
41399
41762
  return skillsDirPath;
41400
41763
  }
41401
41764
  function targetFromHome(envName, fallbackDir) {
41402
- const home = process.env[envName] || path29.join(os6.homedir(), fallbackDir);
41403
- return path29.join(home, "skills");
41765
+ const home = process.env[envName] || path30.join(os6.homedir(), fallbackDir);
41766
+ return path30.join(home, "skills");
41404
41767
  }
41405
41768
  function defaultAgentTargets() {
41406
41769
  return [
@@ -41413,7 +41776,7 @@ function hasInstalledPeachSkills() {
41413
41776
  (file) => /^([^/]+)\/SKILL\.md$/.exec(file)?.[1] ?? []
41414
41777
  ) : listSkills().map((skill7) => skill7.name);
41415
41778
  return defaultAgentTargets().some(
41416
- ({ dir }) => names.some((name2) => fs25.existsSync(path29.join(dir, name2, "SKILL.md")))
41779
+ ({ dir }) => names.some((name2) => fs25.existsSync(path30.join(dir, name2, "SKILL.md")))
41417
41780
  );
41418
41781
  }
41419
41782
  function parseSkillFrontmatter(content) {
@@ -41459,7 +41822,7 @@ function listSkills() {
41459
41822
  if (!fs25.existsSync(skillsDir())) return [];
41460
41823
  const skills = [];
41461
41824
  for (const entry of fs25.readdirSync(skillsDir())) {
41462
- const skillMd = path29.join(skillsDir(), entry, "SKILL.md");
41825
+ const skillMd = path30.join(skillsDir(), entry, "SKILL.md");
41463
41826
  if (!fs25.existsSync(skillMd)) continue;
41464
41827
  const meta = parseSkillFrontmatter(fs25.readFileSync(skillMd, "utf8"));
41465
41828
  if (meta) {
@@ -41468,14 +41831,14 @@ function listSkills() {
41468
41831
  }
41469
41832
  return skills.sort((a, b) => a.name.localeCompare(b.name));
41470
41833
  }
41471
- var import_child_process7, fs25, os6, path29, import_url3, import_meta4, skillsDirPath;
41834
+ var import_child_process7, fs25, os6, path30, import_url3, import_meta4, skillsDirPath;
41472
41835
  var init_skills = __esm({
41473
41836
  "cli/commands/skills.ts"() {
41474
41837
  "use strict";
41475
41838
  import_child_process7 = require("child_process");
41476
41839
  fs25 = __toESM(require("fs"), 1);
41477
41840
  os6 = __toESM(require("os"), 1);
41478
- path29 = __toESM(require("path"), 1);
41841
+ path30 = __toESM(require("path"), 1);
41479
41842
  import_url3 = require("url");
41480
41843
  init_cli_version();
41481
41844
  init_home_paths();
@@ -42116,10 +42479,10 @@ async function buildResolvedBundleOpenUrl(target, baseUrl, opts = {}) {
42116
42479
  }
42117
42480
  function normalizeReplacementPath(filePath) {
42118
42481
  if (filePath.startsWith("~/")) {
42119
- return import_node_path37.default.join(import_node_os8.default.homedir(), filePath.slice(2));
42482
+ return import_node_path38.default.join(import_node_os8.default.homedir(), filePath.slice(2));
42120
42483
  }
42121
- if (import_node_path37.default.isAbsolute(filePath)) return filePath;
42122
- return import_node_path37.default.resolve(process.cwd(), filePath);
42484
+ if (import_node_path38.default.isAbsolute(filePath)) return filePath;
42485
+ return import_node_path38.default.resolve(process.cwd(), filePath);
42123
42486
  }
42124
42487
  function parseOpenRuntimeConfig(args) {
42125
42488
  const modules = {};
@@ -42169,7 +42532,7 @@ async function resolveAppProjectForBundleUrl(bundleUrl) {
42169
42532
  return advertisedRoot ? resolveAppProject(advertisedRoot) : null;
42170
42533
  }
42171
42534
  async function ensureConfiguredRuntime(version) {
42172
- if (import_node_fs35.default.existsSync(import_node_path37.default.join(runtimeDir(version), "index.html"))) return;
42535
+ if (import_node_fs35.default.existsSync(import_node_path38.default.join(runtimeDir(version), "index.html"))) return;
42173
42536
  console.error(` installing configured engine runtime ${version}...`);
42174
42537
  const result = await rnxRuntime.install({
42175
42538
  version,
@@ -42531,17 +42894,17 @@ function printDriverDiagnosticLogTail(result) {
42531
42894
  try {
42532
42895
  const detail = import_node_fs35.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
42533
42896
  if (!detail) {
42534
- console.error(` ${import_node_path37.default.basename(result.diagnosticLogPath)} was empty`);
42897
+ console.error(` ${import_node_path38.default.basename(result.diagnosticLogPath)} was empty`);
42535
42898
  return;
42536
42899
  }
42537
42900
  const shown = detail.length > 4e3 ? `\u2026
42538
42901
  ${detail.slice(-4e3)}` : detail;
42539
- console.error(` ${import_node_path37.default.basename(result.diagnosticLogPath)}:`);
42902
+ console.error(` ${import_node_path38.default.basename(result.diagnosticLogPath)}:`);
42540
42903
  console.error(shown);
42541
42904
  } catch (err) {
42542
42905
  const message = err instanceof Error ? err.message : String(err);
42543
42906
  console.error(
42544
- ` failed to read ${import_node_path37.default.basename(result.diagnosticLogPath)}: ${message}`
42907
+ ` failed to read ${import_node_path38.default.basename(result.diagnosticLogPath)}: ${message}`
42545
42908
  );
42546
42909
  }
42547
42910
  }
@@ -43540,14 +43903,14 @@ async function runCloseCommand(args, opts = {}) {
43540
43903
  bridge.close();
43541
43904
  }
43542
43905
  }
43543
- var import_node_child_process14, import_node_fs35, import_node_os8, import_node_path37, 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;
43906
+ var import_node_child_process14, import_node_fs35, import_node_os8, import_node_path38, 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;
43544
43907
  var init_control = __esm({
43545
43908
  "cli/commands/control.ts"() {
43546
43909
  "use strict";
43547
43910
  import_node_child_process14 = require("node:child_process");
43548
43911
  import_node_fs35 = __toESM(require("node:fs"), 1);
43549
43912
  import_node_os8 = __toESM(require("node:os"), 1);
43550
- import_node_path37 = __toESM(require("node:path"), 1);
43913
+ import_node_path38 = __toESM(require("node:path"), 1);
43551
43914
  import_app_catalog_wire = require("peach-engine/engine/app-catalog-wire");
43552
43915
  import_devices2 = require("peach-engine/settings/devices");
43553
43916
  import_ws4 = require("ws");
@@ -44389,11 +44752,11 @@ function stringifyJs(value) {
44389
44752
  function scriptConditionIsTruthy(value) {
44390
44753
  if (value === void 0 || value === null) return false;
44391
44754
  if (typeof value === "boolean") return value;
44392
- const text = String(value);
44393
- if (text.trim().length === 0) return false;
44394
- if (text.toLowerCase() === "false") return false;
44395
- if (text === "undefined" || text === "null") return false;
44396
- const num = Number(text);
44755
+ const text2 = String(value);
44756
+ if (text2.trim().length === 0) return false;
44757
+ if (text2.toLowerCase() === "false") return false;
44758
+ if (text2 === "undefined" || text2 === "null") return false;
44759
+ const num = Number(text2);
44397
44760
  if (!Number.isNaN(num) && num === 0) return false;
44398
44761
  return true;
44399
44762
  }
@@ -44467,8 +44830,8 @@ var init_maestro_js = __esm({
44467
44830
  );
44468
44831
  for (const [key, value] of evaluated) this.envBinding.set(key, value);
44469
44832
  }
44470
- setCopiedText(text) {
44471
- this.maestro.copiedText = text;
44833
+ setCopiedText(text2) {
44834
+ this.maestro.copiedText = text2;
44472
44835
  }
44473
44836
  enterEnvScope() {
44474
44837
  this.envScopeStack.push(new Map(this.envBinding));
@@ -44656,11 +45019,11 @@ async function ensureCliRecordingEntitlement(commandLabel, opts = {}) {
44656
45019
  rnxExit(1);
44657
45020
  }
44658
45021
  if (!res.ok) {
44659
- const text = await res.text().catch(() => "");
45022
+ const text2 = await res.text().catch(() => "");
44660
45023
  process.stderr.write(
44661
45024
  `
44662
45025
  peach ${commandLabel} couldn't verify recording access (${res.status}).
44663
- ${text || "unexpected billing response"}
45026
+ ${text2 || "unexpected billing response"}
44664
45027
 
44665
45028
  `
44666
45029
  );
@@ -44970,16 +45333,16 @@ function readRecentShellAppId(state) {
44970
45333
  }
44971
45334
  function resolveProjectRelativeFlowBase(flowDir) {
44972
45335
  if (!flowDir) return process.cwd();
44973
- return path31.basename(flowDir) === ".maestro" ? path31.dirname(flowDir) : flowDir;
45336
+ return path32.basename(flowDir) === ".maestro" ? path32.dirname(flowDir) : flowDir;
44974
45337
  }
44975
45338
  function resolveFlowScreenshotPathWithMode(screenshotDir, name2, opts) {
44976
45339
  const normalizedName = name2.endsWith(".png") ? name2 : `${name2}.png`;
44977
- if (path31.isAbsolute(normalizedName)) return normalizedName;
45340
+ if (path32.isAbsolute(normalizedName)) return normalizedName;
44978
45341
  if (opts.mode === "flow" && /[\\/]/.test(normalizedName)) {
44979
45342
  const baseDir = normalizedName.startsWith("./") || normalizedName.startsWith("../") ? opts.flowDir ?? process.cwd() : resolveProjectRelativeFlowBase(opts.flowDir);
44980
- return path31.resolve(baseDir, normalizedName);
45343
+ return path32.resolve(baseDir, normalizedName);
44981
45344
  }
44982
- return path31.join(screenshotDir, normalizedName);
45345
+ return path32.join(screenshotDir, normalizedName);
44983
45346
  }
44984
45347
  function normalizeFlowScreenshotSpec(step) {
44985
45348
  if (typeof step === "string") {
@@ -45033,12 +45396,12 @@ function normalizeBareStringStep(verb) {
45033
45396
  function parseFlowSteps(content) {
45034
45397
  return parseFlowFile(content).steps;
45035
45398
  }
45036
- var fs28, path31, 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;
45399
+ var fs28, path32, 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;
45037
45400
  var init_bridge_flow_runner = __esm({
45038
45401
  "cli/bridge-flow-runner.ts"() {
45039
45402
  "use strict";
45040
45403
  fs28 = __toESM(require("fs"), 1);
45041
- path31 = __toESM(require("path"), 1);
45404
+ path32 = __toESM(require("path"), 1);
45042
45405
  import_devices4 = require("peach-engine/settings/devices");
45043
45406
  import_proof_frame = __toESM(require_proof_frame(), 1);
45044
45407
  init_flow_timeout_scale();
@@ -45366,7 +45729,7 @@ var init_bridge_flow_runner = __esm({
45366
45729
  fs28.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
45367
45730
  const videoMime = stopped.mime || this.opts.recordingFormat || "video/webm";
45368
45731
  const extension = videoMime.includes("mp4") ? "mp4" : "webm";
45369
- const outputPath = path31.join(
45732
+ const outputPath = path32.join(
45370
45733
  this.opts.recordingOutputDir,
45371
45734
  `peach-${Date.now()}.${extension}`
45372
45735
  );
@@ -45915,7 +46278,7 @@ var init_bridge_flow_runner = __esm({
45915
46278
  }
45916
46279
  return frame.width > 0 && frame.height > 0 && frame.area > 0;
45917
46280
  }
45918
- async inputText(text) {
46281
+ async inputText(text2) {
45919
46282
  if (!await this.waitForFocusedTextInput()) {
45920
46283
  throw new Error(
45921
46284
  "inputText: no focused TextInput; tap the input and wait for focus before typing"
@@ -45925,7 +46288,7 @@ var init_bridge_flow_runner = __esm({
45925
46288
  type: "keyboard",
45926
46289
  simId: this.opts.simId,
45927
46290
  action: "type",
45928
- text
46291
+ text: text2
45929
46292
  });
45930
46293
  await sleep(200);
45931
46294
  }
@@ -46046,7 +46409,7 @@ var init_bridge_flow_runner = __esm({
46046
46409
  flowDir: this.opts.flowDir
46047
46410
  }
46048
46411
  );
46049
- fs28.mkdirSync(path31.dirname(outputPath), { recursive: true });
46412
+ fs28.mkdirSync(path32.dirname(outputPath), { recursive: true });
46050
46413
  const layers = spec.layers ?? this.opts.screenshotLayers;
46051
46414
  const screenshotRequest = {
46052
46415
  type: "screenshot",
@@ -46110,7 +46473,7 @@ var init_bridge_flow_runner = __esm({
46110
46473
  fs28.mkdirSync(outputDir, { recursive: true });
46111
46474
  const write = (name2, content) => {
46112
46475
  try {
46113
- fs28.writeFileSync(path31.join(outputDir, name2), content);
46476
+ fs28.writeFileSync(path32.join(outputDir, name2), content);
46114
46477
  } catch {
46115
46478
  }
46116
46479
  };
@@ -46704,7 +47067,7 @@ var init_bridge_flow_runner = __esm({
46704
47067
  runScript(target) {
46705
47068
  const spec = typeof target === "string" ? { file: target } : target;
46706
47069
  if (!spec.file) throw new Error("runScript requires a file");
46707
- const scriptPath = path31.resolve(this.opts.flowDir, spec.file);
47070
+ const scriptPath = path32.resolve(this.opts.flowDir, spec.file);
46708
47071
  const source = fs28.readFileSync(scriptPath, "utf8");
46709
47072
  this.js.evaluate(source, { env: spec.env });
46710
47073
  console.log(`[flow] runScript: ${spec.file} done`);
@@ -47065,14 +47428,14 @@ var init_bridge_flow_runner = __esm({
47065
47428
  for (const [k, v] of Object.entries(env)) this.js.putEnv(k, v);
47066
47429
  }
47067
47430
  if (file) {
47068
- const flowPath = path31.resolve(this.opts.flowDir, file);
47431
+ const flowPath = path32.resolve(this.opts.flowDir, file);
47069
47432
  const flowContent = fs28.readFileSync(flowPath, "utf8");
47070
47433
  const { frontmatter } = parseFlowFile(flowContent);
47071
47434
  if (frontmatter.env && typeof frontmatter.env === "object") {
47072
47435
  this.js.defineVariables(frontmatter.env);
47073
47436
  }
47074
47437
  const previousDir = this.opts.flowDir;
47075
- this.opts.flowDir = path31.dirname(flowPath);
47438
+ this.opts.flowDir = path32.dirname(flowPath);
47076
47439
  try {
47077
47440
  await this.runFlow(parseFlowSteps(flowContent));
47078
47441
  } finally {
@@ -47244,7 +47607,7 @@ __export(registry_exports, {
47244
47607
  });
47245
47608
  module.exports = __toCommonJS(registry_exports);
47246
47609
  var fs29 = __toESM(require("fs"), 1);
47247
- var path32 = __toESM(require("path"), 1);
47610
+ var path33 = __toESM(require("path"), 1);
47248
47611
 
47249
47612
  // src/skills/builtin/a11y-review.ts
47250
47613
  init_reap_browser();
@@ -47263,7 +47626,7 @@ var skill = {
47263
47626
  },
47264
47627
  async execute(params, context) {
47265
47628
  const { chromium } = await import("playwright");
47266
- const path33 = await import("path");
47629
+ const path34 = await import("path");
47267
47630
  const fs30 = await import("fs");
47268
47631
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
47269
47632
  headless: true
@@ -47321,8 +47684,8 @@ var skill = {
47321
47684
  warnings: issues.filter((i) => i.severity === "warning").length,
47322
47685
  tree: typeof tree === "string" ? tree : JSON.stringify(tree)
47323
47686
  };
47324
- const reportPath = path33.join(context.outputDir, "a11y-report.json");
47325
- fs30.mkdirSync(path33.dirname(reportPath), { recursive: true });
47687
+ const reportPath = path34.join(context.outputDir, "a11y-report.json");
47688
+ fs30.mkdirSync(path34.dirname(reportPath), { recursive: true });
47326
47689
  fs30.writeFileSync(reportPath, JSON.stringify(report, null, 2));
47327
47690
  return {
47328
47691
  success: issues.filter((i) => i.severity === "error").length === 0,
@@ -47357,9 +47720,9 @@ var skill2 = {
47357
47720
  },
47358
47721
  async execute(params, context) {
47359
47722
  const fs30 = await import("node:fs");
47360
- const path33 = await import("node:path");
47723
+ const path34 = await import("node:path");
47361
47724
  const { COMPAT_RESULT_CAVEAT: COMPAT_RESULT_CAVEAT2, formatPackageStatus: formatPackageStatus2, formatScanCounts: formatScanCounts2, scanDeps: scanDeps2 } = await Promise.resolve().then(() => (init_web(), web_exports));
47362
- const packagePath = path33.join(context.projectDir, "package.json");
47725
+ const packagePath = path34.join(context.projectDir, "package.json");
47363
47726
  if (!fs30.existsSync(packagePath)) {
47364
47727
  return { success: false, message: "No package.json found" };
47365
47728
  }
@@ -47375,8 +47738,8 @@ var skill2 = {
47375
47738
  }) : scanDeps2(parsed);
47376
47739
  const packageResult = params.packageName ? scan.packages[0] : void 0;
47377
47740
  const message = packageResult ? `${params.packageName}: ${formatPackageStatus2(packageResult)}. ${COMPAT_RESULT_CAVEAT2}` : `${formatScanCounts2(scan)}. ${COMPAT_RESULT_CAVEAT2}`;
47378
- const reportPath = path33.join(context.outputDir, "compat-report.json");
47379
- fs30.mkdirSync(path33.dirname(reportPath), { recursive: true });
47741
+ const reportPath = path34.join(context.outputDir, "compat-report.json");
47742
+ fs30.mkdirSync(path34.dirname(reportPath), { recursive: true });
47380
47743
  fs30.writeFileSync(reportPath, `${JSON.stringify(scan, null, 2)}
47381
47744
  `);
47382
47745
  return {
@@ -47420,7 +47783,7 @@ var skill3 = {
47420
47783
  },
47421
47784
  async execute(params, context) {
47422
47785
  const fs30 = await import("fs");
47423
- const path33 = await import("path");
47786
+ const path34 = await import("path");
47424
47787
  const yaml2 = await import("yaml");
47425
47788
  const { DEFAULT_SOOTSIM_BRIDGE_PORT: DEFAULT_SOOTSIM_BRIDGE_PORT3 } = await Promise.resolve().then(() => (init_bridge_constants(), bridge_constants_exports));
47426
47789
  const { SootSimBridgeHost: SootSimBridgeHost2 } = await Promise.resolve().then(() => (init_bridge_host(), bridge_host_exports));
@@ -47457,7 +47820,7 @@ var skill3 = {
47457
47820
  });
47458
47821
  const driver = new SootSimBridgeFlowRunner2(bridge, {
47459
47822
  screenshotDir: context.outputDir,
47460
- flowDir: path33.dirname(path33.resolve(params.flowPath)),
47823
+ flowDir: path34.dirname(path34.resolve(params.flowPath)),
47461
47824
  simId,
47462
47825
  recordingOutputDir: params.record ? context.outputDir : void 0
47463
47826
  });
@@ -47479,7 +47842,7 @@ var skill3 = {
47479
47842
  simId,
47480
47843
  videoPath: videoPath || void 0
47481
47844
  },
47482
- artifacts: videoPath ? [{ type: "video", name: path33.basename(videoPath), path: videoPath }] : void 0
47845
+ artifacts: videoPath ? [{ type: "video", name: path34.basename(videoPath), path: videoPath }] : void 0
47483
47846
  };
47484
47847
  } finally {
47485
47848
  try {
@@ -47526,7 +47889,7 @@ var skill4 = {
47526
47889
  },
47527
47890
  async execute(params, context) {
47528
47891
  const { chromium } = await import("playwright");
47529
- const path33 = await import("path");
47892
+ const path34 = await import("path");
47530
47893
  const fs30 = await import("fs");
47531
47894
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
47532
47895
  headless: true
@@ -47555,8 +47918,8 @@ var skill4 = {
47555
47918
  ...profile,
47556
47919
  fps: syncCount > 0 ? (syncCount / (duration / 1e3)).toFixed(1) : "0"
47557
47920
  };
47558
- const reportPath = path33.join(context.outputDir, "perf-report.json");
47559
- fs30.mkdirSync(path33.dirname(reportPath), { recursive: true });
47921
+ const reportPath = path34.join(context.outputDir, "perf-report.json");
47922
+ fs30.mkdirSync(path34.dirname(reportPath), { recursive: true });
47560
47923
  fs30.writeFileSync(reportPath, JSON.stringify(report, null, 2));
47561
47924
  return {
47562
47925
  success: true,
@@ -47590,7 +47953,7 @@ var skill5 = {
47590
47953
  },
47591
47954
  async execute(params, context) {
47592
47955
  const { chromium } = await import("playwright");
47593
- const path33 = await import("path");
47956
+ const path34 = await import("path");
47594
47957
  const fs30 = await import("fs");
47595
47958
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
47596
47959
  headless: true
@@ -47599,8 +47962,8 @@ var skill5 = {
47599
47962
  try {
47600
47963
  await page.goto(context.url, { waitUntil: "networkidle" });
47601
47964
  await page.waitForTimeout(2e3);
47602
- const outputPath = path33.join(context.outputDir, `${params.name}.png`);
47603
- fs30.mkdirSync(path33.dirname(outputPath), { recursive: true });
47965
+ const outputPath = path34.join(context.outputDir, `${params.name}.png`);
47966
+ fs30.mkdirSync(path34.dirname(outputPath), { recursive: true });
47604
47967
  await page.screenshot({ path: outputPath });
47605
47968
  return {
47606
47969
  success: true,
@@ -47641,7 +48004,7 @@ var skill6 = {
47641
48004
  },
47642
48005
  async execute(params, context) {
47643
48006
  const { chromium } = await import("playwright");
47644
- const path33 = await import("path");
48007
+ const path34 = await import("path");
47645
48008
  const fs30 = await import("fs");
47646
48009
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
47647
48010
  headless: true
@@ -47650,8 +48013,8 @@ var skill6 = {
47650
48013
  try {
47651
48014
  await page.goto(context.url, { waitUntil: "networkidle" });
47652
48015
  await page.waitForTimeout(2e3);
47653
- const currentPath = path33.join(context.outputDir, `${params.name}-current.png`);
47654
- fs30.mkdirSync(path33.dirname(currentPath), { recursive: true });
48016
+ const currentPath = path34.join(context.outputDir, `${params.name}-current.png`);
48017
+ fs30.mkdirSync(path34.dirname(currentPath), { recursive: true });
47655
48018
  await page.screenshot({ path: currentPath });
47656
48019
  try {
47657
48020
  const { PNG } = await import("pngjs");
@@ -47668,7 +48031,7 @@ var skill6 = {
47668
48031
  height,
47669
48032
  { threshold: params.threshold || 0.1 }
47670
48033
  );
47671
- const diffPath = path33.join(context.outputDir, `${params.name}-diff.png`);
48034
+ const diffPath = path34.join(context.outputDir, `${params.name}-diff.png`);
47672
48035
  fs30.writeFileSync(diffPath, PNG.sync.write(diff));
47673
48036
  const totalPixels = width * height;
47674
48037
  const diffPercent = (numDiffPixels / totalPixels * 100).toFixed(2);
@@ -47733,7 +48096,7 @@ var skillRegistry = {
47733
48096
  },
47734
48097
  // load skills from a project manifest (rnx-skills.json)
47735
48098
  async loadFromManifest(projectDir) {
47736
- const manifestPath = path32.join(projectDir, "rnx-skills.json");
48099
+ const manifestPath = path33.join(projectDir, "rnx-skills.json");
47737
48100
  if (!fs29.existsSync(manifestPath)) return;
47738
48101
  try {
47739
48102
  const manifest = JSON.parse(fs29.readFileSync(manifestPath, "utf8"));
@@ -47747,7 +48110,7 @@ var skillRegistry = {
47747
48110
  }
47748
48111
  } else if (entry.file) {
47749
48112
  try {
47750
- const mod = await import(path32.resolve(projectDir, entry.file));
48113
+ const mod = await import(path33.resolve(projectDir, entry.file));
47751
48114
  if (mod.skill) this.register(mod.skill);
47752
48115
  } catch {
47753
48116
  }
@@ -47760,7 +48123,7 @@ var skillRegistry = {
47760
48123
  // auto-discover skills based on project dependencies
47761
48124
  suggestSkills(projectDir) {
47762
48125
  const suggestions = [];
47763
- const pkgPath = path32.join(projectDir, "package.json");
48126
+ const pkgPath = path33.join(projectDir, "package.json");
47764
48127
  if (!fs29.existsSync(pkgPath)) return suggestions;
47765
48128
  try {
47766
48129
  const pkg = JSON.parse(fs29.readFileSync(pkgPath, "utf8"));