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;
@@ -560,9 +560,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
560
560
  sendJavaScript(
561
561
  req,
562
562
  res,
563
- `${compiled.code}
564
- //# sourceMappingURL=data:application/json;base64,${map}
565
- `
563
+ compiled.code + "\n//# sourceMappingURL=data:application/json;base64," + map + "\n"
566
564
  );
567
565
  } catch (error) {
568
566
  const message = error instanceof Error ? error.message : String(error);
@@ -913,12 +911,12 @@ function resolveFileEntries(entries, configDir) {
913
911
  return Object.fromEntries(
914
912
  Object.entries(entries).map(([name2, resolution]) => [
915
913
  name2,
916
- resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path6.default.resolve(configDir, resolution.file) } : resolution
914
+ resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path7.default.resolve(configDir, resolution.file) } : resolution
917
915
  ])
918
916
  );
919
917
  }
920
918
  function resolveConfigReplacementFiles(config, configPath) {
921
- const configDir = import_node_path6.default.dirname(configPath);
919
+ const configDir = import_node_path7.default.dirname(configPath);
922
920
  return {
923
921
  ...config,
924
922
  modules: resolveFileEntries(config.modules, configDir),
@@ -955,12 +953,12 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
955
953
  const project = resolveAppProject(startDir);
956
954
  return { project, config: await loadRNXAppConfig(project) };
957
955
  }
958
- var import_node_module2, import_node_path6, import_jiti, require2;
956
+ var import_node_module2, import_node_path7, import_jiti, require2;
959
957
  var init_app_config = __esm({
960
958
  "cli/app-config.ts"() {
961
959
  "use strict";
962
960
  import_node_module2 = require("node:module");
963
- import_node_path6 = __toESM(require("node:path"), 1);
961
+ import_node_path7 = __toESM(require("node:path"), 1);
964
962
  import_jiti = require("jiti");
965
963
  init_config();
966
964
  init_public_brand();
@@ -1013,7 +1011,7 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
1013
1011
  if (!entries || typeof entries !== "object") continue;
1014
1012
  for (const resolution of Object.values(entries)) {
1015
1013
  if (resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string") {
1016
- resolution.file = visit(import_node_path7.default.resolve(resolution.file));
1014
+ resolution.file = visit(import_node_path8.default.resolve(resolution.file));
1017
1015
  }
1018
1016
  }
1019
1017
  }
@@ -1037,12 +1035,12 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
1037
1035
  const identityStart = source.lastIndexOf("\nglobalThis.__sootsimModulePaths=");
1038
1036
  return prefix2 + (identityStart < 0 ? source + footer : source.slice(0, identityStart) + footer + source.slice(identityStart));
1039
1037
  }
1040
- var import_node_fs7, import_node_path7, import_sucrase, import_terser;
1038
+ var import_node_fs7, import_node_path8, import_sucrase, import_terser;
1041
1039
  var init_configured_bundle_producer = __esm({
1042
1040
  "src/configured-bundle-producer.ts"() {
1043
1041
  "use strict";
1044
1042
  import_node_fs7 = __toESM(require("node:fs"), 1);
1045
- import_node_path7 = __toESM(require("node:path"), 1);
1043
+ import_node_path8 = __toESM(require("node:path"), 1);
1046
1044
  import_sucrase = require("sucrase");
1047
1045
  import_terser = require("terser");
1048
1046
  init_replacementModule();
@@ -1241,7 +1239,7 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
1241
1239
  }
1242
1240
  function nativeAppIdentityFromIos(files, parseInfoPlist) {
1243
1241
  const pbxprojPath = Object.keys(files).find(
1244
- (path10) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path10)
1242
+ (path11) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path11)
1245
1243
  );
1246
1244
  if (!pbxprojPath) return null;
1247
1245
  const pbxproj = files[pbxprojPath];
@@ -1253,7 +1251,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist) {
1253
1251
  ].map((match) => match[1])
1254
1252
  );
1255
1253
  const appDelegatePattern = /(?:^|\/)ios\/([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
1256
- const targetName = Object.keys(files).filter((path10) => !path10.includes("/Pods/")).map((path10) => path10.match(appDelegatePattern)?.[1]).find((name2) => name2 !== void 0 && applicationTargets.has(name2)) ?? null;
1254
+ const targetName = Object.keys(files).filter((path11) => !path11.includes("/Pods/")).map((path11) => path11.match(appDelegatePattern)?.[1]).find((name2) => name2 !== void 0 && applicationTargets.has(name2)) ?? null;
1257
1255
  if (!targetName) return null;
1258
1256
  const plist3 = files[`ios/${targetName}/Info.plist`];
1259
1257
  if (!plist3) return null;
@@ -1330,7 +1328,7 @@ function extractNativeAppIdentityFromFiles(files, platform, parseInfoPlist) {
1330
1328
  // src/native-firebase-config.ts
1331
1329
  var import_node_fs5 = __toESM(require("node:fs"), 1);
1332
1330
  var import_node_module = require("node:module");
1333
- var import_node_path4 = __toESM(require("node:path"), 1);
1331
+ var import_node_path5 = __toESM(require("node:path"), 1);
1334
1332
  init_is_record();
1335
1333
 
1336
1334
  // src/plist.ts
@@ -1341,7 +1339,7 @@ function parsePlistSource(source) {
1341
1339
 
1342
1340
  // src/xcode-project.ts
1343
1341
  var import_node_fs4 = __toESM(require("node:fs"), 1);
1344
- var import_node_path3 = __toESM(require("node:path"), 1);
1342
+ var import_node_path4 = __toESM(require("node:path"), 1);
1345
1343
  var import_plist2 = __toESM(require_plist(), 1);
1346
1344
 
1347
1345
  // src/swift-package.ts
@@ -1400,7 +1398,7 @@ var NAME = /\bname\s*:\s*"([^"]+)"/;
1400
1398
  function listArgument(call, label) {
1401
1399
  const start = new RegExp(`\\b${label}\\s*:\\s*\\[`).exec(call);
1402
1400
  if (!start) return [];
1403
- const items = [];
1401
+ const items2 = [];
1404
1402
  let depth = 0;
1405
1403
  let inString = false;
1406
1404
  let item = "";
@@ -1417,14 +1415,14 @@ function listArgument(call, label) {
1417
1415
  if (depth === 0) break;
1418
1416
  depth--;
1419
1417
  } else if (ch === "," && depth === 0) {
1420
- items.push(item.trim());
1418
+ items2.push(item.trim());
1421
1419
  item = "";
1422
1420
  continue;
1423
1421
  }
1424
1422
  item += ch;
1425
1423
  }
1426
- if (item.trim()) items.push(item.trim());
1427
- return items;
1424
+ if (item.trim()) items2.push(item.trim());
1425
+ return items2;
1428
1426
  }
1429
1427
  function swiftPackageIdentity(url) {
1430
1428
  return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
@@ -1507,24 +1505,357 @@ function swiftManifestGraph(manifest) {
1507
1505
  return graph;
1508
1506
  }
1509
1507
 
1508
+ // src/xcode-json-project.ts
1509
+ var import_node_path3 = __toESM(require("node:path"), 1);
1510
+ var import_json5 = __toESM(require("json5"), 1);
1511
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1512
+ var text = (value) => typeof value === "string" ? value : void 0;
1513
+ var items = (value) => Array.isArray(value) ? value : [];
1514
+ var PHASE_ISA = {
1515
+ "compile-sources": "PBXSourcesBuildPhase",
1516
+ resources: "PBXResourcesBuildPhase",
1517
+ frameworks: "PBXFrameworksBuildPhase",
1518
+ headers: "PBXHeadersBuildPhase",
1519
+ copy: "PBXCopyFilesBuildPhase",
1520
+ script: "PBXShellScriptBuildPhase"
1521
+ };
1522
+ function readXcodeJsonProject(xcodeproj, source) {
1523
+ const json = import_json5.default.parse(source);
1524
+ if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
1525
+ const projectDir = import_node_path3.default.dirname(xcodeproj);
1526
+ const objects = {};
1527
+ let next = 0;
1528
+ const add = (entry, id) => {
1529
+ const key = id ?? `XCPROJ${(next++).toString(16).toUpperCase().padStart(18, "0")}`;
1530
+ objects[key] = entry;
1531
+ return key;
1532
+ };
1533
+ const locate = (raw, groupDir) => {
1534
+ if (raw.startsWith("<USER:")) return null;
1535
+ const base = /^<([A-Z]+)>\/(.*)$/.exec(raw);
1536
+ if (base) {
1537
+ if (base[1] === "PROJECT")
1538
+ return { sourceTree: "<absolute>", path: import_node_path3.default.join(projectDir, base[2]) };
1539
+ if (base[1] === "PRODUCTS")
1540
+ return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
1541
+ return null;
1542
+ }
1543
+ const unescaped = raw.replaceAll("\\<", "<");
1544
+ if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
1545
+ if (unescaped.startsWith("~")) return null;
1546
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path3.default.join(groupDir, unescaped) };
1547
+ };
1548
+ const memberships = [];
1549
+ const folders = [];
1550
+ const projectFiles = [];
1551
+ const root = { id: "", name: "", dir: projectDir, parent: null, children: [] };
1552
+ const walk = (entries, parent) => entries.flatMap((entry) => {
1553
+ if (!isObject(entry)) return [];
1554
+ const kind = text(entry.kind) ?? "file-reference";
1555
+ const raw = text(entry.path) ?? "";
1556
+ const located = raw === "" ? null : locate(raw, parent.dir);
1557
+ const name2 = text(entry.name) ?? import_node_path3.default.basename(raw);
1558
+ const node = { id: "", name: name2, dir: null, parent, children: [] };
1559
+ if (kind === "group" || kind === "variant-group" || kind === "version-group") {
1560
+ node.dir = raw === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
1561
+ const childIds = walk(items(entry.children), node);
1562
+ node.id = add(
1563
+ kind === "version-group" && located ? {
1564
+ isa: "PBXFileReference",
1565
+ ...located,
1566
+ lastKnownFileType: "wrapper.xcdatamodel"
1567
+ } : {
1568
+ isa: kind === "variant-group" ? "PBXVariantGroup" : "PBXGroup",
1569
+ children: childIds,
1570
+ ...kind === "variant-group" ? {} : { sourceTree: "<absolute>", path: node.dir ?? "" },
1571
+ name: name2
1572
+ },
1573
+ text(entry.id)
1574
+ );
1575
+ } else if (kind === "folder") {
1576
+ node.id = add(
1577
+ {
1578
+ isa: "PBXFileSystemSynchronizedRootGroup",
1579
+ ...located ?? { sourceTree: "SDKROOT", path: raw }
1580
+ },
1581
+ text(entry.id)
1582
+ );
1583
+ folders.push({ id: node.id, folder: entry });
1584
+ } else {
1585
+ node.id = add(
1586
+ {
1587
+ isa: "PBXFileReference",
1588
+ ...located ?? { sourceTree: "SDKROOT", path: raw },
1589
+ name: name2
1590
+ },
1591
+ text(entry.id)
1592
+ );
1593
+ if (located?.sourceTree === "<absolute>" && located.path.endsWith(".xcodeproj"))
1594
+ projectFiles.push(node.id);
1595
+ }
1596
+ parent.children.push(node);
1597
+ for (const membership of items(entry["target-membership"])) {
1598
+ if (kind !== "folder") memberships.push({ refId: node.id, entry: membership });
1599
+ }
1600
+ return [node.id];
1601
+ });
1602
+ const mainGroupChildren = walk(items(json.files), root);
1603
+ const mainGroup = add({
1604
+ isa: "PBXGroup",
1605
+ children: mainGroupChildren,
1606
+ sourceTree: "<absolute>",
1607
+ path: projectDir
1608
+ });
1609
+ root.id = mainGroup;
1610
+ const lookup = (reference, from = root) => {
1611
+ if (isObject(reference)) {
1612
+ const anchor = lookupNode(reference.anchor, root);
1613
+ return anchor ? lookup(reference["relative-path"], anchor) : void 0;
1614
+ }
1615
+ if (Array.isArray(reference)) {
1616
+ return lookupNode(
1617
+ reference.map(
1618
+ (component) => isObject(component) ? text(component.name) ?? "" : text(component) ?? ""
1619
+ ).join("/"),
1620
+ from
1621
+ )?.id;
1622
+ }
1623
+ return lookupNode(reference, from)?.id;
1624
+ };
1625
+ const lookupNode = (reference, from) => {
1626
+ const value = text(reference);
1627
+ if (value === void 0) return void 0;
1628
+ if (value.startsWith("id:")) {
1629
+ const id = value.slice(3);
1630
+ const find = (node2) => node2.id === id ? node2 : node2.children.map(find).find(Boolean);
1631
+ return find(root);
1632
+ }
1633
+ let node = from;
1634
+ for (const component of value.split("/")) {
1635
+ if (!node) return void 0;
1636
+ node = component === "." ? node : component === ".." ? node.parent ?? void 0 : node.children.find((child) => child.name === component);
1637
+ }
1638
+ return node;
1639
+ };
1640
+ const configurations = items(json.configurations).flatMap((entry) => {
1641
+ const name2 = isObject(entry) ? text(entry.name) : text(entry);
1642
+ return name2 ? [{ name: name2, file: isObject(entry) ? entry.file : void 0 }] : [];
1643
+ });
1644
+ const settingsOf = (value) => Object.fromEntries(
1645
+ Object.entries(isObject(value) ? value : {}).flatMap(
1646
+ ([key, setting]) => typeof setting === "string" ? [[key, setting]] : Array.isArray(setting) ? [
1647
+ [
1648
+ key,
1649
+ setting.filter((item) => typeof item === "string")
1650
+ ]
1651
+ ] : []
1652
+ )
1653
+ );
1654
+ const configurationList = (settings, specialized) => add({
1655
+ isa: "XCConfigurationList",
1656
+ defaultConfigurationName: text(json["default-configuration"]) ?? "Debug",
1657
+ buildConfigurations: configurations.map(({ name: name2, file }) => {
1658
+ const base = lookup(specialized.has(name2) ? specialized.get(name2) : file);
1659
+ return add({
1660
+ isa: "XCBuildConfiguration",
1661
+ name: name2,
1662
+ buildSettings: settings,
1663
+ ...base ? { baseConfigurationReference: base } : {}
1664
+ });
1665
+ })
1666
+ });
1667
+ const packageIds = /* @__PURE__ */ new Map();
1668
+ for (const entry of items(json.packages)) {
1669
+ if (!isObject(entry)) continue;
1670
+ const repository = text(entry.repository);
1671
+ const local = text(entry.path);
1672
+ const name2 = local !== void 0 ? import_node_path3.default.basename(import_node_path3.default.resolve(import_node_path3.default.dirname(xcodeproj), local)) : import_node_path3.default.basename(repository ?? "").replace(/\.git$/, "");
1673
+ const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
1674
+ packageIds.set(name2.toLowerCase(), id);
1675
+ }
1676
+ const productDependency = (entry) => add({
1677
+ isa: "XCSwiftPackageProductDependency",
1678
+ productName: text(entry["product-name"]) ?? "",
1679
+ // xcode finds a product by name across packages when none is named
1680
+ ...packageIds.has(text(entry.package)?.toLowerCase() ?? "") ? { package: packageIds.get(text(entry.package).toLowerCase()) } : {}
1681
+ });
1682
+ const proxy = (entry, remote, proxyType) => add({
1683
+ isa: "PBXContainerItemProxy",
1684
+ containerPortal: lookup(entry.project) ?? "",
1685
+ proxyType,
1686
+ remoteGlobalIDString: remote ?? "",
1687
+ remoteInfo: text(entry.target) ?? ""
1688
+ });
1689
+ const phases = /* @__PURE__ */ new Map();
1690
+ const targetIds = /* @__PURE__ */ new Map();
1691
+ const targets = [];
1692
+ for (const entry of items(json.targets)) {
1693
+ if (!isObject(entry)) continue;
1694
+ const name2 = text(entry.name) ?? "";
1695
+ const productType = text(entry["product-type"]);
1696
+ const target = {
1697
+ isa: text(entry.kind) === "aggregate" ? "PBXAggregateTarget" : "PBXNativeTarget",
1698
+ name: name2,
1699
+ productName: name2,
1700
+ productType: productType ? `com.apple.product-type.${productType}` : text(entry["full-product-type"]) ?? "",
1701
+ buildPhases: [],
1702
+ dependencies: [],
1703
+ packageProductDependencies: [],
1704
+ fileSystemSynchronizedGroups: []
1705
+ };
1706
+ const product = lookup(entry.product);
1707
+ if (product) target.productReference = product;
1708
+ const id = add(target, text(entry.id));
1709
+ targetIds.set(name2, id);
1710
+ targets.push({ id, target, entry });
1711
+ for (const phase of items(entry["build-phases"])) {
1712
+ const kind = isObject(phase) ? text(phase.kind) : text(phase);
1713
+ const isa = kind ? PHASE_ISA[kind] : void 0;
1714
+ if (!kind || !isa) continue;
1715
+ const phaseName = isObject(phase) ? text(phase.name) : void 0;
1716
+ const phaseId = add(
1717
+ { isa, files: [] },
1718
+ isObject(phase) ? text(phase.id) : void 0
1719
+ );
1720
+ target.buildPhases.push(phaseId);
1721
+ phases.set([name2, kind, phaseName].filter(Boolean).join("/"), phaseId);
1722
+ phases.set(`id:${phaseId}`, phaseId);
1723
+ }
1724
+ }
1725
+ const phaseFiles = (reference, targetName) => {
1726
+ const value = text(reference);
1727
+ if (value === void 0) return null;
1728
+ const key = value.startsWith("id:") || !targetName ? value : `${targetName}/${value}`;
1729
+ const phase = objects[phases.get(key) ?? ""];
1730
+ return phase && typeof phase === "object" && !Array.isArray(phase) && Array.isArray(phase.files) ? phase.files : null;
1731
+ };
1732
+ for (const { refId, entry } of memberships) {
1733
+ const files = phaseFiles(isObject(entry) ? entry["build-phase"] : entry);
1734
+ files?.push(add({ isa: "PBXBuildFile", fileRef: refId }));
1735
+ }
1736
+ for (const { target, entry } of targets) {
1737
+ const name2 = text(entry.name) ?? "";
1738
+ target.buildConfigurationList = configurationList(
1739
+ settingsOf(entry["build-settings"]),
1740
+ new Map(
1741
+ items(entry["specialized-configurations"]).flatMap(
1742
+ (configuration) => isObject(configuration) && text(configuration.name) ? [[text(configuration.name), configuration.file]] : []
1743
+ )
1744
+ )
1745
+ );
1746
+ for (const dependency of items(entry.dependencies)) {
1747
+ const kind = isObject(dependency) ? text(dependency.kind) ?? "localTarget" : "localTarget";
1748
+ if (kind === "package" && isObject(dependency)) {
1749
+ ;
1750
+ target.dependencies.push(
1751
+ add({ isa: "PBXTargetDependency", productRef: productDependency(dependency) })
1752
+ );
1753
+ } else if (kind === "remoteTarget" && isObject(dependency)) {
1754
+ ;
1755
+ target.dependencies.push(
1756
+ add({
1757
+ isa: "PBXTargetDependency",
1758
+ targetProxy: proxy(dependency, text(dependency["target-id"]), "1")
1759
+ })
1760
+ );
1761
+ } else {
1762
+ const local = isObject(dependency) ? text(dependency.target) : text(dependency);
1763
+ const id = local ? targetIds.get(local) : void 0;
1764
+ if (id)
1765
+ target.dependencies.push(
1766
+ add({ isa: "PBXTargetDependency", target: id })
1767
+ );
1768
+ }
1769
+ }
1770
+ for (const member of items(entry["package-product-members"])) {
1771
+ if (!isObject(member)) continue;
1772
+ const dependency = productDependency(member);
1773
+ target.packageProductDependencies.push(dependency);
1774
+ const buildFile = member["build-phase"];
1775
+ phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name2)?.push(
1776
+ add({ isa: "PBXBuildFile", productRef: dependency })
1777
+ );
1778
+ }
1779
+ }
1780
+ for (const imported of items(json["imported-products"])) {
1781
+ if (!isObject(imported)) continue;
1782
+ const reference = add({
1783
+ isa: "PBXReferenceProxy",
1784
+ path: text(imported.name) ?? text(imported.path) ?? "",
1785
+ sourceTree: "BUILT_PRODUCTS_DIR",
1786
+ remoteRef: proxy(imported, text(imported["product-id"]), "2")
1787
+ });
1788
+ for (const membership of items(imported["target-membership"])) {
1789
+ phaseFiles(isObject(membership) ? membership["build-phase"] : membership)?.push(
1790
+ add({ isa: "PBXBuildFile", fileRef: reference })
1791
+ );
1792
+ }
1793
+ }
1794
+ for (const { id, folder } of folders) {
1795
+ const exceptions = [];
1796
+ for (const exception of items(folder["membership-exceptions"])) {
1797
+ if (!isObject(exception)) continue;
1798
+ const target = targetIds.get(text(exception.target) ?? "");
1799
+ if (!target) continue;
1800
+ exceptions.push(
1801
+ add({
1802
+ isa: "PBXFileSystemSynchronizedBuildFileExceptionSet",
1803
+ target,
1804
+ membershipExceptions: [
1805
+ ...items(exception.exclusions),
1806
+ ...items(exception.inclusions)
1807
+ ].flatMap((member) => typeof member === "string" ? [member] : [])
1808
+ })
1809
+ );
1810
+ }
1811
+ const group = objects[id];
1812
+ if (group && typeof group === "object" && !Array.isArray(group))
1813
+ group.exceptions = exceptions;
1814
+ for (const owner of items(folder["target-membership"])) {
1815
+ const target = targets.find(
1816
+ (candidate) => candidate.id === targetIds.get(text(owner) ?? "")
1817
+ );
1818
+ target?.target.fileSystemSynchronizedGroups?.push(id);
1819
+ }
1820
+ }
1821
+ const localizations = isObject(json.localizations) ? json.localizations : {};
1822
+ const project = add({
1823
+ isa: "PBXProject",
1824
+ mainGroup,
1825
+ projectDirPath: "",
1826
+ developmentRegion: text(localizations.development) ?? "en",
1827
+ buildConfigurationList: configurationList(
1828
+ settingsOf(json["build-settings"]),
1829
+ /* @__PURE__ */ new Map()
1830
+ ),
1831
+ targets: targets.map((entry) => entry.id),
1832
+ packageReferences: [...packageIds.values()],
1833
+ projectReferences: projectFiles.map((ProjectRef) => ({ ProjectRef }))
1834
+ });
1835
+ return { objects, rootObject: project };
1836
+ }
1837
+ function isJsonObject(value) {
1838
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1839
+ }
1840
+
1510
1841
  // src/xcode-project.ts
1511
- function parseOpenStepPlist(text) {
1842
+ function parseOpenStepPlist(text2) {
1512
1843
  let i = 0;
1513
1844
  const fail = (message) => {
1514
- const line = text.slice(0, i).split("\n").length;
1845
+ const line = text2.slice(0, i).split("\n").length;
1515
1846
  throw new Error(`project.pbxproj line ${line}: ${message}`);
1516
1847
  };
1517
1848
  const skip = () => {
1518
1849
  for (; ; ) {
1519
- const ch = text[i];
1850
+ const ch = text2[i];
1520
1851
  if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
1521
- else if (ch === "/" && text[i + 1] === "*") {
1522
- const end = text.indexOf("*/", i + 2);
1852
+ else if (ch === "/" && text2[i + 1] === "*") {
1853
+ const end = text2.indexOf("*/", i + 2);
1523
1854
  if (end < 0) fail("unterminated comment");
1524
1855
  i = end + 2;
1525
- } else if (ch === "/" && text[i + 1] === "/") {
1526
- const end = text.indexOf("\n", i);
1527
- i = end < 0 ? text.length : end + 1;
1856
+ } else if (ch === "/" && text2[i + 1] === "/") {
1857
+ const end = text2.indexOf("\n", i);
1858
+ i = end < 0 ? text2.length : end + 1;
1528
1859
  } else return;
1529
1860
  }
1530
1861
  };
@@ -1532,42 +1863,42 @@ function parseOpenStepPlist(text) {
1532
1863
  i++;
1533
1864
  let out = "";
1534
1865
  for (; ; ) {
1535
- const ch = text[i++];
1866
+ const ch = text2[i++];
1536
1867
  if (ch === void 0) fail("unterminated string");
1537
1868
  if (ch === '"') return out;
1538
1869
  if (ch !== "\\") {
1539
1870
  out += ch;
1540
1871
  continue;
1541
1872
  }
1542
- const next = text[i++];
1873
+ const next = text2[i++];
1543
1874
  if (next === "n") out += "\n";
1544
1875
  else if (next === "t") out += " ";
1545
1876
  else if (next === "r") out += "\r";
1546
1877
  else if (next === "U") {
1547
- out += String.fromCharCode(parseInt(text.slice(i, i + 4), 16));
1878
+ out += String.fromCharCode(parseInt(text2.slice(i, i + 4), 16));
1548
1879
  i += 4;
1549
1880
  } else out += next;
1550
1881
  }
1551
1882
  };
1552
1883
  const value = () => {
1553
1884
  skip();
1554
- const ch = text[i];
1885
+ const ch = text2[i];
1555
1886
  if (ch === "{") {
1556
1887
  i++;
1557
1888
  const dict = {};
1558
1889
  for (; ; ) {
1559
1890
  skip();
1560
- if (text[i] === "}") {
1891
+ if (text2[i] === "}") {
1561
1892
  i++;
1562
1893
  return dict;
1563
1894
  }
1564
1895
  const key = value();
1565
1896
  if (typeof key !== "string") fail("dictionary key is not a string");
1566
1897
  skip();
1567
- if (text[i++] !== "=") fail("expected =");
1898
+ if (text2[i++] !== "=") fail("expected =");
1568
1899
  dict[key] = value();
1569
1900
  skip();
1570
- if (text[i++] !== ";") fail("expected ;");
1901
+ if (text2[i++] !== ";") fail("expected ;");
1571
1902
  }
1572
1903
  }
1573
1904
  if (ch === "(") {
@@ -1575,26 +1906,26 @@ function parseOpenStepPlist(text) {
1575
1906
  const list2 = [];
1576
1907
  for (; ; ) {
1577
1908
  skip();
1578
- if (text[i] === ")") {
1909
+ if (text2[i] === ")") {
1579
1910
  i++;
1580
1911
  return list2;
1581
1912
  }
1582
1913
  list2.push(value());
1583
1914
  skip();
1584
- if (text[i] === ",") i++;
1585
- else if (text[i] !== ")") fail("expected , or )");
1915
+ if (text2[i] === ",") i++;
1916
+ else if (text2[i] !== ")") fail("expected , or )");
1586
1917
  }
1587
1918
  }
1588
1919
  if (ch === '"') return quoted();
1589
1920
  const start = i;
1590
- while (i < text.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text[i])) i++;
1921
+ while (i < text2.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text2[i])) i++;
1591
1922
  if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
1592
- return text.slice(start, i);
1923
+ return text2.slice(start, i);
1593
1924
  };
1594
- if (text.startsWith("// !$*UTF8*$!")) i = text.indexOf("\n") + 1;
1925
+ if (text2.startsWith("// !$*UTF8*$!")) i = text2.indexOf("\n") + 1;
1595
1926
  const root = value();
1596
1927
  skip();
1597
- if (i !== text.length) fail("trailing content");
1928
+ if (i !== text2.length) fail("trailing content");
1598
1929
  return root;
1599
1930
  }
1600
1931
  var isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -1619,7 +1950,7 @@ function walkFiles(dir) {
1619
1950
  const out = [];
1620
1951
  for (const entry of import_node_fs4.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
1621
1952
  if (entry.name.startsWith(".")) continue;
1622
- const full = import_node_path3.default.join(dir, entry.name);
1953
+ const full = import_node_path4.default.join(dir, entry.name);
1623
1954
  if (entry.isDirectory()) out.push(...walkFiles(full));
1624
1955
  else if (entry.isFile()) out.push(full);
1625
1956
  }
@@ -1636,7 +1967,7 @@ function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
1636
1967
  if (include) {
1637
1968
  Object.assign(
1638
1969
  settings,
1639
- readXcconfig(import_node_path3.default.resolve(import_node_path3.default.dirname(file), include[1]), seen)
1970
+ readXcconfig(import_node_path4.default.resolve(import_node_path4.default.dirname(file), include[1]), seen)
1640
1971
  );
1641
1972
  continue;
1642
1973
  }
@@ -1682,22 +2013,22 @@ function applyOperator(value, operator) {
1682
2013
  }
1683
2014
  throw new Error(`unsupported build setting operator :${operator}`);
1684
2015
  }
1685
- function decodeXml(text) {
1686
- return text.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
2016
+ function decodeXml(text2) {
2017
+ return text2.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
1687
2018
  }
1688
2019
  function workspaceReferences(workspace) {
1689
- const data = import_node_path3.default.join(workspace, "contents.xcworkspacedata");
2020
+ const data = import_node_path4.default.join(workspace, "contents.xcworkspacedata");
1690
2021
  if (!import_node_fs4.default.existsSync(data))
1691
2022
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
1692
- const container = import_node_path3.default.dirname(workspace);
2023
+ const container = import_node_path4.default.dirname(workspace);
1693
2024
  const locate = (location, base) => {
1694
2025
  const colon = location.indexOf(":");
1695
2026
  const kind = location.slice(0, colon);
1696
2027
  const rest = location.slice(colon + 1);
1697
- if (kind === "group") return import_node_path3.default.resolve(base, rest);
1698
- if (kind === "container" || kind === "self") return import_node_path3.default.resolve(container, rest);
1699
- if (kind === "absolute") return import_node_path3.default.resolve(rest);
1700
- throw new Error(`${import_node_path3.default.basename(workspace)} has an unsupported location ${location}`);
2028
+ if (kind === "group") return import_node_path4.default.resolve(base, rest);
2029
+ if (kind === "container" || kind === "self") return import_node_path4.default.resolve(container, rest);
2030
+ if (kind === "absolute") return import_node_path4.default.resolve(rest);
2031
+ throw new Error(`${import_node_path4.default.basename(workspace)} has an unsupported location ${location}`);
1701
2032
  };
1702
2033
  const groups = [container];
1703
2034
  const references = [];
@@ -1715,15 +2046,24 @@ function workspaceReferences(workspace) {
1715
2046
  return references;
1716
2047
  }
1717
2048
  var loaded = /* @__PURE__ */ new Map();
2049
+ function xcodeProjectFile(xcodeproj) {
2050
+ for (const name2 of ["project.pbxproj", "project.xcproj"]) {
2051
+ const file = import_node_path4.default.join(xcodeproj, name2);
2052
+ if (import_node_fs4.default.existsSync(file)) return file;
2053
+ }
2054
+ return null;
2055
+ }
1718
2056
  function loadProject(xcodeproj) {
1719
- const pbxproj = import_node_path3.default.join(xcodeproj, "project.pbxproj");
1720
- if (!import_node_fs4.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
1721
- const mtimeMs = import_node_fs4.default.statSync(pbxproj).mtimeMs;
1722
- const cached = loaded.get(pbxproj);
2057
+ const projectFile = xcodeProjectFile(xcodeproj);
2058
+ if (!projectFile)
2059
+ throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
2060
+ const mtimeMs = import_node_fs4.default.statSync(projectFile).mtimeMs;
2061
+ const cached = loaded.get(projectFile);
1723
2062
  if (cached?.mtimeMs === mtimeMs) return cached.project;
1724
- const root = parseOpenStepPlist(import_node_fs4.default.readFileSync(pbxproj, "utf8"));
2063
+ const source = import_node_fs4.default.readFileSync(projectFile, "utf8");
2064
+ const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
1725
2065
  if (!isDict(root) || !isDict(root.objects)) {
1726
- throw new Error(`${pbxproj} has no objects table`);
2066
+ throw new Error(`${projectFile} has no objects table`);
1727
2067
  }
1728
2068
  const objects = root.objects;
1729
2069
  const object = (id) => {
@@ -1732,10 +2072,10 @@ function loadProject(xcodeproj) {
1732
2072
  };
1733
2073
  const project = object(str(root.rootObject));
1734
2074
  if (!project || project.isa !== "PBXProject") {
1735
- throw new Error(`${pbxproj} has no PBXProject root`);
2075
+ throw new Error(`${projectFile} has no PBXProject root`);
1736
2076
  }
1737
2077
  const projectDir = import_node_fs4.default.realpathSync(
1738
- import_node_path3.default.resolve(import_node_path3.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
2078
+ import_node_path4.default.resolve(import_node_path4.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
1739
2079
  );
1740
2080
  const parent = /* @__PURE__ */ new Map();
1741
2081
  for (const [id, entry] of Object.entries(objects)) {
@@ -1753,18 +2093,26 @@ function loadProject(xcodeproj) {
1753
2093
  const own = str(entry.path) ?? "";
1754
2094
  const tree = str(entry.sourceTree) ?? "<group>";
1755
2095
  if (tree === "<absolute>") result2 = own;
1756
- else if (tree === "SOURCE_ROOT") result2 = import_node_path3.default.join(projectDir, own);
2096
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path4.default.join(projectDir, own);
1757
2097
  else if (tree === "<group>") {
1758
2098
  const up = parent.get(id);
1759
2099
  const base = up ? resolvePath(up) : projectDir;
1760
- result2 = base === null ? null : import_node_path3.default.join(base, own);
2100
+ result2 = base === null ? null : import_node_path4.default.join(base, own);
1761
2101
  }
1762
2102
  }
1763
2103
  resolvedPaths.set(id, result2);
1764
2104
  return result2;
1765
2105
  };
1766
- const result = { xcodeproj, pbxproj, objects, project, projectDir, object, resolvePath };
1767
- loaded.set(pbxproj, { mtimeMs, project: result });
2106
+ const result = {
2107
+ xcodeproj,
2108
+ projectFile,
2109
+ objects,
2110
+ project,
2111
+ projectDir,
2112
+ object,
2113
+ resolvePath
2114
+ };
2115
+ loaded.set(projectFile, { mtimeMs, project: result });
1768
2116
  return result;
1769
2117
  }
1770
2118
  function targetSettings(ref, builtins) {
@@ -1878,7 +2226,7 @@ function targetMembers(ref) {
1878
2226
  }
1879
2227
  }
1880
2228
  const addSynchronized = (folder, relative2) => {
1881
- const file = import_node_path3.default.join(folder, relative2);
2229
+ const file = import_node_path4.default.join(folder, relative2);
1882
2230
  if (NEVER_MEMBER.test(relative2)) return;
1883
2231
  if (file.endsWith(".swift")) {
1884
2232
  if (!relative2.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
@@ -1903,7 +2251,7 @@ function targetMembers(ref) {
1903
2251
  }
1904
2252
  if (owned.has(groupId)) {
1905
2253
  for (const file of walkFiles(folder)) {
1906
- const relative2 = import_node_path3.default.relative(folder, file).split(import_node_path3.default.sep).join("/");
2254
+ const relative2 = import_node_path4.default.relative(folder, file).split(import_node_path4.default.sep).join("/");
1907
2255
  if ([...exceptions].some(
1908
2256
  (exception) => relative2 === exception || relative2.startsWith(`${exception}/`)
1909
2257
  ))
@@ -1912,12 +2260,12 @@ function targetMembers(ref) {
1912
2260
  }
1913
2261
  } else {
1914
2262
  for (const relative2 of exceptions) {
1915
- const file = import_node_path3.default.join(folder, relative2);
2263
+ const file = import_node_path4.default.join(folder, relative2);
1916
2264
  if (isDirectory(file)) {
1917
2265
  for (const inner of walkFiles(file))
1918
2266
  addSynchronized(
1919
2267
  folder,
1920
- import_node_path3.default.relative(folder, inner).split(import_node_path3.default.sep).join("/")
2268
+ import_node_path4.default.relative(folder, inner).split(import_node_path4.default.sep).join("/")
1921
2269
  );
1922
2270
  } else if (import_node_fs4.default.existsSync(file)) addSynchronized(folder, relative2);
1923
2271
  }
@@ -1932,8 +2280,8 @@ function targetMembers(ref) {
1932
2280
  function commonAncestor(dirs) {
1933
2281
  let common = dirs[0];
1934
2282
  for (const dir of dirs) {
1935
- while (common !== import_node_path3.default.dirname(common) && import_node_path3.default.relative(common, dir).startsWith(".."))
1936
- common = import_node_path3.default.dirname(common);
2283
+ while (common !== import_node_path4.default.dirname(common) && import_node_path4.default.relative(common, dir).startsWith(".."))
2284
+ common = import_node_path4.default.dirname(common);
1937
2285
  }
1938
2286
  return common;
1939
2287
  }
@@ -1942,9 +2290,9 @@ function workspaceProjects(xcodeprojOrWorkspace) {
1942
2290
  const projects = [];
1943
2291
  const projectAt = /* @__PURE__ */ new Map();
1944
2292
  const addProject = (xcodeproj) => {
1945
- const key = import_node_path3.default.resolve(xcodeproj);
1946
- if (projectAt.has(key) || key.split(import_node_path3.default.sep).includes("Pods")) return;
1947
- if (!import_node_fs4.default.existsSync(import_node_path3.default.join(key, "project.pbxproj"))) return;
2293
+ const key = import_node_path4.default.resolve(xcodeproj);
2294
+ if (projectAt.has(key) || key.split(import_node_path4.default.sep).includes("Pods")) return;
2295
+ if (!xcodeProjectFile(key)) return;
1948
2296
  const project = loadProject(key);
1949
2297
  projectAt.set(key, project);
1950
2298
  projects.push(project);
@@ -1960,14 +2308,22 @@ function workspaceProjects(xcodeprojOrWorkspace) {
1960
2308
  for (const reference of listed)
1961
2309
  if (reference.endsWith(".xcodeproj")) addProject(reference);
1962
2310
  if (projects.length === 0) {
1963
- throw new Error(`${import_node_path3.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
2311
+ throw new Error(`${import_node_path4.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
1964
2312
  }
1965
2313
  return { listed, projects, projectAt };
1966
2314
  }
1967
- var nativeTargets = (project) => list(project.project.targets).flatMap((id) => {
1968
- const target = project.object(id);
1969
- return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
1970
- });
2315
+ var targetRefs = /* @__PURE__ */ new WeakMap();
2316
+ function nativeTargets(project) {
2317
+ let refs = targetRefs.get(project);
2318
+ if (!refs) {
2319
+ refs = list(project.project.targets).flatMap((id) => {
2320
+ const target = project.object(id);
2321
+ return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
2322
+ });
2323
+ targetRefs.set(project, refs);
2324
+ }
2325
+ return refs;
2326
+ }
1971
2327
  function listXcodeAppTargets(xcodeprojOrWorkspace) {
1972
2328
  return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(nativeTargets).filter((ref) => ref.target.productType === APPLICATION).map((ref) => str(ref.target.name) ?? ref.id);
1973
2329
  }
@@ -1977,7 +2333,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
1977
2333
  const allTargets = projects.flatMap(nativeTargets);
1978
2334
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
1979
2335
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
1980
- const container = import_node_path3.default.basename(xcodeprojOrWorkspace);
2336
+ const container = import_node_path4.default.basename(xcodeprojOrWorkspace);
1981
2337
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
1982
2338
  if (named.length !== 1) {
1983
2339
  throw new Error(
@@ -1989,14 +2345,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
1989
2345
  for (const ref of allTargets) {
1990
2346
  const product = ref.project.object(str(ref.target.productReference));
1991
2347
  const file = str(product?.path);
1992
- if (file && !byProduct.has(import_node_path3.default.basename(file)))
1993
- byProduct.set(import_node_path3.default.basename(file), ref);
2348
+ if (file && !byProduct.has(import_node_path4.default.basename(file)))
2349
+ byProduct.set(import_node_path4.default.basename(file), ref);
1994
2350
  }
1995
2351
  const proxied = (project, proxyId) => {
1996
2352
  const proxy = project.object(proxyId);
1997
2353
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
1998
2354
  const portal = str(proxy.containerPortal);
1999
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path3.default.resolve(project.resolvePath(portal ?? "") ?? ""));
2355
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path4.default.resolve(project.resolvePath(portal ?? "") ?? ""));
2000
2356
  const remote = str(proxy.remoteGlobalIDString);
2001
2357
  if (!owner || !remote) return void 0;
2002
2358
  return nativeTargets(owner).find(
@@ -2017,7 +2373,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
2017
2373
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
2018
2374
  for (const buildFileId of list(phase.files)) {
2019
2375
  const file = project.object(str(project.object(buildFileId)?.fileRef));
2020
- const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path3.default.basename(str(file.path) ?? "")) : void 0;
2376
+ const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path4.default.basename(str(file.path) ?? "")) : void 0;
2021
2377
  if (resolved) found.push(resolved);
2022
2378
  }
2023
2379
  }
@@ -2038,7 +2394,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
2038
2394
  const name2 = str(ref.target.name) ?? ref.id;
2039
2395
  const { get: settings2, keys } = targetSettings(ref, {
2040
2396
  TARGET_NAME: name2,
2041
- PROJECT_NAME: import_node_path3.default.basename(ref.project.xcodeproj, ".xcodeproj"),
2397
+ PROJECT_NAME: import_node_path4.default.basename(ref.project.xcodeproj, ".xcodeproj"),
2042
2398
  SRCROOT: ref.project.projectDir,
2043
2399
  SOURCE_ROOT: ref.project.projectDir,
2044
2400
  PROJECT_DIR: ref.project.projectDir,
@@ -2069,7 +2425,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
2069
2425
  }
2070
2426
  return value;
2071
2427
  };
2072
- const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path3.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
2428
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path4.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
2073
2429
  const sourceInfo = infoPlistFile ? import_plist2.default.parse(import_node_fs4.default.readFileSync(infoPlistFile, "utf8")) : {};
2074
2430
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
2075
2431
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
@@ -2088,12 +2444,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
2088
2444
  };
2089
2445
  }
2090
2446
  const localPackageDirs = [
2091
- ...listed.filter((reference) => import_node_fs4.default.existsSync(import_node_path3.default.join(reference, "Package.swift"))),
2447
+ ...listed.filter((reference) => import_node_fs4.default.existsSync(import_node_path4.default.join(reference, "Package.swift"))),
2092
2448
  ...projects.flatMap(
2093
2449
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
2094
2450
  if (!isDict(entry)) return [];
2095
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path3.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
2096
- return candidate && import_node_fs4.default.existsSync(import_node_path3.default.join(candidate, "Package.swift")) ? [candidate] : [];
2451
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path4.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
2452
+ return candidate && import_node_fs4.default.existsSync(import_node_path4.default.join(candidate, "Package.swift")) ? [candidate] : [];
2097
2453
  })
2098
2454
  )
2099
2455
  ];
@@ -2102,7 +2458,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
2102
2458
  const cached = graphs.get(dir);
2103
2459
  if (cached) return cached;
2104
2460
  const graph = swiftManifestGraph(
2105
- import_node_fs4.default.readFileSync(import_node_path3.default.join(dir, "Package.swift"), "utf8")
2461
+ import_node_fs4.default.readFileSync(import_node_path4.default.join(dir, "Package.swift"), "utf8")
2106
2462
  );
2107
2463
  graphs.set(dir, graph);
2108
2464
  return graph;
@@ -2137,7 +2493,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
2137
2493
  });
2138
2494
  } else if (reference?.isa === "XCLocalSwiftPackageReference") {
2139
2495
  localPackages.add(
2140
- import_node_path3.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
2496
+ import_node_path4.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
2141
2497
  );
2142
2498
  } else if (localProducts.has(product)) {
2143
2499
  localPackages.add(localProducts.get(product));
@@ -2149,8 +2505,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
2149
2505
  const dir = pending.pop();
2150
2506
  const graph = graphOf(dir);
2151
2507
  for (const relative2 of graph.packagePaths) {
2152
- const next = import_node_path3.default.resolve(dir, relative2);
2153
- if (localPackages.has(next) || !import_node_fs4.default.existsSync(import_node_path3.default.join(next, "Package.swift")))
2508
+ const next = import_node_path4.default.resolve(dir, relative2);
2509
+ if (localPackages.has(next) || !import_node_fs4.default.existsSync(import_node_path4.default.join(next, "Package.swift")))
2154
2510
  continue;
2155
2511
  localPackages.add(next);
2156
2512
  pending.push(next);
@@ -2164,8 +2520,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
2164
2520
  }
2165
2521
  }
2166
2522
  }
2167
- const resolvedFile = import_node_path3.default.join(
2168
- workspace ?? import_node_path3.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
2523
+ const resolvedFile = import_node_path4.default.join(
2524
+ workspace ?? import_node_path4.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
2169
2525
  "xcshareddata",
2170
2526
  "swiftpm",
2171
2527
  "Package.resolved"
@@ -2175,12 +2531,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
2175
2531
  ...module2,
2176
2532
  rootDir: commonAncestor(
2177
2533
  [
2178
- workspace ? import_node_path3.default.dirname(workspace) : app.project.projectDir,
2534
+ workspace ? import_node_path4.default.dirname(workspace) : app.project.projectDir,
2179
2535
  ...used.map((project) => project.projectDir),
2180
2536
  ...localPackages
2181
2537
  ].map((dir) => import_node_fs4.default.realpathSync(dir))
2182
2538
  ),
2183
- pbxprojs: [...new Set(used.map((project) => project.pbxproj))].sort(),
2539
+ projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
2184
2540
  infoPlist: import_plist2.default.build(info),
2185
2541
  infoPlistFile,
2186
2542
  frameworks,
@@ -2196,7 +2552,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
2196
2552
  function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
2197
2553
  const result = {};
2198
2554
  let config = {};
2199
- const appJsonPath = import_node_path4.default.join(projectRoot, "app.json");
2555
+ const appJsonPath = import_node_path5.default.join(projectRoot, "app.json");
2200
2556
  const appJson = import_node_fs5.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs5.default.readFileSync(appJsonPath, "utf8")) : null;
2201
2557
  const staticExpo = isRecord2(appJson) && (isRecord2(appJson.expo) || [appJson.ios, appJson.android].some(
2202
2558
  (value) => isRecord2(value) && typeof value.googleServicesFile === "string"
@@ -2206,9 +2562,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
2206
2562
  "app.config.ts",
2207
2563
  "app.config.cjs",
2208
2564
  "app.config.mjs"
2209
- ].some((name2) => import_node_fs5.default.existsSync(import_node_path4.default.join(projectRoot, name2)));
2565
+ ].some((name2) => import_node_fs5.default.existsSync(import_node_path5.default.join(projectRoot, name2)));
2210
2566
  if (staticExpo || dynamicExpo) {
2211
- const require3 = (0, import_node_module.createRequire)(import_node_path4.default.join(projectRoot, "package.json"));
2567
+ const require3 = (0, import_node_module.createRequire)(import_node_path5.default.join(projectRoot, "package.json"));
2212
2568
  const configModule = require3("@expo/config");
2213
2569
  if (!isRecord2(configModule) || typeof configModule.getConfig !== "function")
2214
2570
  throw new Error("Expo native configuration is unavailable.");
@@ -2220,20 +2576,20 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
2220
2576
  }
2221
2577
  const ios = config.ios;
2222
2578
  if (platforms.includes("ios") && (!isRecord2(ios) || typeof ios.googleServicesFile !== "string")) {
2223
- const iosRoot = import_node_path4.default.join(projectRoot, "ios");
2579
+ const iosRoot = import_node_path5.default.join(projectRoot, "ios");
2224
2580
  if (import_node_fs5.default.existsSync(iosRoot)) {
2225
2581
  const projects = import_node_fs5.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
2226
2582
  if (projects.length > 1)
2227
2583
  throw new Error("native Firebase configuration requires a selected Xcode project");
2228
2584
  if (projects.length === 1) {
2229
- const xcodeproj = import_node_path4.default.join(iosRoot, projects[0].name);
2585
+ const xcodeproj = import_node_path5.default.join(iosRoot, projects[0].name);
2230
2586
  const appTargets = listXcodeAppTargets(xcodeproj);
2231
2587
  if (appTargets.length > 1)
2232
2588
  throw new Error("native Firebase configuration requires a selected app target");
2233
2589
  if (appTargets.length === 1) {
2234
2590
  const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
2235
2591
  const delegates = app.allSources.filter(
2236
- (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path4.default.basename(file))
2592
+ (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path5.default.basename(file))
2237
2593
  );
2238
2594
  const defaultConfigured = delegates.some((file) => {
2239
2595
  const source = import_node_fs5.default.readFileSync(file, "utf8").replace(
@@ -2264,14 +2620,14 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
2264
2620
  });
2265
2621
  if (defaultConfigured) {
2266
2622
  const resources = app.resources.filter(
2267
- (file) => /^GoogleService-Info\.plist$/.test(import_node_path4.default.basename(file))
2623
+ (file) => /^GoogleService-Info\.plist$/.test(import_node_path5.default.basename(file))
2268
2624
  );
2269
2625
  if (resources.length !== 1)
2270
2626
  throw new Error(
2271
2627
  "native Firebase default initialization requires one GoogleService-Info.plist build resource"
2272
2628
  );
2273
2629
  config.ios = {
2274
- googleServicesFile: import_node_path4.default.relative(
2630
+ googleServicesFile: import_node_path5.default.relative(
2275
2631
  import_node_fs5.default.realpathSync(projectRoot),
2276
2632
  resources[0]
2277
2633
  )
@@ -2286,7 +2642,7 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
2286
2642
  if (!isRecord2(native) || typeof native.googleServicesFile !== "string") continue;
2287
2643
  try {
2288
2644
  const source = import_node_fs5.default.readFileSync(
2289
- import_node_path4.default.resolve(projectRoot, native.googleServicesFile),
2645
+ import_node_path5.default.resolve(projectRoot, native.googleServicesFile),
2290
2646
  "utf8"
2291
2647
  );
2292
2648
  const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
@@ -2428,22 +2784,22 @@ init_version();
2428
2784
  // src/home-paths.ts
2429
2785
  var import_node_fs6 = __toESM(require("node:fs"), 1);
2430
2786
  var import_node_os = require("node:os");
2431
- var import_node_path5 = __toESM(require("node:path"), 1);
2787
+ var import_node_path6 = __toESM(require("node:path"), 1);
2432
2788
  var PEACH_HOME_ENV = "PEACH_HOME";
2433
2789
  var ACTIVE_RUNTIME_FILE = "active";
2434
2790
  function rnxHomeDir() {
2435
2791
  const override = process.env[PEACH_HOME_ENV];
2436
- if (override && override.length > 0) return import_node_path5.default.resolve(override);
2437
- return import_node_path5.default.join((0, import_node_os.homedir)(), ".peach");
2792
+ if (override && override.length > 0) return import_node_path6.default.resolve(override);
2793
+ return import_node_path6.default.join((0, import_node_os.homedir)(), ".peach");
2438
2794
  }
2439
2795
  function runtimesDir() {
2440
- return import_node_path5.default.join(rnxHomeDir(), "runtimes");
2796
+ return import_node_path6.default.join(rnxHomeDir(), "runtimes");
2441
2797
  }
2442
2798
  function runtimeDir(version) {
2443
- return import_node_path5.default.join(runtimesDir(), version);
2799
+ return import_node_path6.default.join(runtimesDir(), version);
2444
2800
  }
2445
2801
  function activeRuntimeFile() {
2446
- return import_node_path5.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
2802
+ return import_node_path6.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
2447
2803
  }
2448
2804
  function readActiveRuntime() {
2449
2805
  try {