peachsim 0.1.758 → 0.1.760

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 (79) 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 +1316 -863
  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 +509 -336
  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 +480 -307
  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 +1637 -1173
  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 -110
  63. package/dist-lib/swift-package.mjs +1 -109
  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 +1013 -558
  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/native-seam-manifest.ts +8 -0
  73. package/src/swift-host.ts +68 -66
  74. package/src/swift-package-manifest.ts +307 -0
  75. package/src/swift-package.ts +2 -135
  76. package/src/swift-packages.ts +341 -0
  77. package/src/xcode-json-project.ts +450 -0
  78. package/src/xcode-project.ts +112 -92
  79. package/src/swift-remote-packages.ts +0 -255
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.758 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.760 | (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;
@@ -535,9 +535,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
535
535
  sendJavaScript(
536
536
  req,
537
537
  res,
538
- `${compiled.code}
539
- //# sourceMappingURL=data:application/json;base64,${map}
540
- `
538
+ compiled.code + "\n//# sourceMappingURL=data:application/json;base64," + map + "\n"
541
539
  );
542
540
  } catch (error) {
543
541
  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_path9.default.resolve(configDir, resolution.file) } : resolution
914
+ resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path10.default.resolve(configDir, resolution.file) } : resolution
917
915
  ])
918
916
  );
919
917
  }
920
918
  function resolveConfigReplacementFiles(config, configPath) {
921
- const configDir = import_node_path9.default.dirname(configPath);
919
+ const configDir = import_node_path10.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_module3, import_node_path9, import_jiti, require2;
956
+ var import_node_module3, import_node_path10, import_jiti, require2;
959
957
  var init_app_config = __esm({
960
958
  "cli/app-config.ts"() {
961
959
  "use strict";
962
960
  import_node_module3 = require("node:module");
963
- import_node_path9 = __toESM(require("node:path"), 1);
961
+ import_node_path10 = __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_path10.default.resolve(resolution.file));
1014
+ resolution.file = visit(import_node_path11.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_fs9, import_node_path10, import_sucrase, import_terser;
1038
+ var import_node_fs9, import_node_path11, 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_fs9 = __toESM(require("node:fs"), 1);
1045
- import_node_path10 = __toESM(require("node:path"), 1);
1043
+ import_node_path11 = __toESM(require("node:path"), 1);
1046
1044
  import_sucrase = require("sucrase");
1047
1045
  import_terser = require("terser");
1048
1046
  init_replacementModule();
@@ -1454,10 +1452,10 @@ var import_yaml = require("yaml");
1454
1452
 
1455
1453
  // cli/cloud-client.ts
1456
1454
  var DEFAULT_RNX_CLOUD_ORIGIN = rnxPublicBrand.origin;
1457
- function failureSentence(text) {
1455
+ function failureSentence(text2) {
1458
1456
  let parsed;
1459
1457
  try {
1460
- parsed = JSON.parse(text);
1458
+ parsed = JSON.parse(text2);
1461
1459
  } catch {
1462
1460
  return null;
1463
1461
  }
@@ -1474,11 +1472,11 @@ var ACCOUNT_CHOICE_REFUSALS = /* @__PURE__ */ new Set([
1474
1472
  "accountId is required",
1475
1473
  "you do not have access to this account"
1476
1474
  ]);
1477
- function responseError(status, text) {
1478
- const parsed = text ? failureSentence(text) : null;
1475
+ function responseError(status, text2) {
1476
+ const parsed = text2 ? failureSentence(text2) : null;
1479
1477
  const sentence = parsed && ACCOUNT_CHOICE_REFUSALS.has(parsed) ? CHOOSE_ACCOUNT_HINT : parsed;
1480
1478
  return new Error(
1481
- `remote simulator request failed (${status})${sentence ? `: ${sentence}` : text.trim() ? `: ${text.trim()}` : ""}`
1479
+ `remote simulator request failed (${status})${sentence ? `: ${sentence}` : text2.trim() ? `: ${text2.trim()}` : ""}`
1482
1480
  );
1483
1481
  }
1484
1482
  function resolveCloudSessionForParsed(parsed) {
@@ -1546,11 +1544,11 @@ var CloudBridge = class {
1546
1544
  `could not reach the remote simulator at ${this.session.apiOrigin}: ${error instanceof Error ? error.message : String(error)}`
1547
1545
  );
1548
1546
  }
1549
- const text = await response.text();
1550
- if (!response.ok) throw responseError(response.status, text);
1547
+ const text2 = await response.text();
1548
+ if (!response.ok) throw responseError(response.status, text2);
1551
1549
  let parsed;
1552
1550
  try {
1553
- parsed = JSON.parse(text);
1551
+ parsed = JSON.parse(text2);
1554
1552
  } catch {
1555
1553
  throw new Error("remote simulator command returned unreadable JSON");
1556
1554
  }
@@ -1617,11 +1615,11 @@ var CloudBoxBridge = class {
1617
1615
  `could not reach box ${this.session.boxId} at ${this.session.apiOrigin}: ${error instanceof Error ? error.message : String(error)}`
1618
1616
  );
1619
1617
  }
1620
- const text = await response.text();
1621
- if (!response.ok) throw responseError(response.status, text);
1618
+ const text2 = await response.text();
1619
+ if (!response.ok) throw responseError(response.status, text2);
1622
1620
  let parsed;
1623
1621
  try {
1624
- parsed = JSON.parse(text);
1622
+ parsed = JSON.parse(text2);
1625
1623
  } catch {
1626
1624
  throw new Error("box command returned unreadable JSON");
1627
1625
  }
@@ -2499,8 +2497,8 @@ function formatSemanticTree(nodes, opts = {}) {
2499
2497
  node.role ? `[${node.role}]` : node.pressable ? "[tap]" : `<${node.type}>`
2500
2498
  ];
2501
2499
  if (node.text) {
2502
- const text = opts.fullText || node.text.length <= 50 ? node.text : `${node.text.slice(0, 49).trimEnd()}\u2026`;
2503
- parts.push(JSON.stringify(text));
2500
+ const text2 = opts.fullText || node.text.length <= 50 ? node.text : `${node.text.slice(0, 49).trimEnd()}\u2026`;
2501
+ parts.push(JSON.stringify(text2));
2504
2502
  }
2505
2503
  if (node.testID) parts.push(`#${node.testID}`);
2506
2504
  if (node.label && node.label !== node.text) {
@@ -2913,8 +2911,8 @@ function isPeachAccessibilityTree(value) {
2913
2911
  if (field !== void 0 && (typeof field !== "number" || !Number.isFinite(field)))
2914
2912
  return false;
2915
2913
  }
2916
- const text = Reflect.get(value2, "text");
2917
- if (text !== void 0 && typeof text !== "string") return false;
2914
+ const text2 = Reflect.get(value2, "text");
2915
+ if (text2 !== void 0 && typeof text2 !== "string") return false;
2918
2916
  }
2919
2917
  if (!isSemanticGeometry(Reflect.get(node, "frame"))) return false;
2920
2918
  return isPeachAccessibilityTree(Reflect.get(node, "children"));
@@ -3114,9 +3112,9 @@ async function inspectLogs(bridge) {
3114
3112
  const recentLogs = state && typeof state === "object" && Array.isArray(Reflect.get(state, "recentLogs")) ? Reflect.get(state, "recentLogs") : [];
3115
3113
  return recentLogs.flatMap((entry, index) => {
3116
3114
  if (!entry || typeof entry !== "object") return [];
3117
- const text = Reflect.get(entry, "text");
3115
+ const text2 = Reflect.get(entry, "text");
3118
3116
  const rawLevel = Reflect.get(entry, "level");
3119
- if (typeof text !== "string") return [];
3117
+ if (typeof text2 !== "string") return [];
3120
3118
  const level = rawLevel === "log" || rawLevel === "info" || rawLevel === "warn" || rawLevel === "error" || rawLevel === "debug" ? rawLevel : "error";
3121
3119
  const at = Reflect.get(entry, "at");
3122
3120
  const ts = typeof at === "number" && Number.isFinite(at) ? at : 0;
@@ -3126,7 +3124,7 @@ async function inspectLogs(bridge) {
3126
3124
  source: "peach-cloud",
3127
3125
  level,
3128
3126
  ts,
3129
- args: [text],
3127
+ args: [text2],
3130
3128
  stack: null
3131
3129
  }
3132
3130
  ];
@@ -3632,14 +3630,14 @@ function payloadFromResolved(resolved, match, extra = {}) {
3632
3630
  function collectTextCandidates(nodes, ancestors = [], pressableOwnerText = "", actionableAncestor = false, actionableRole) {
3633
3631
  const out = [];
3634
3632
  for (const node of nodes) {
3635
- const text = nodeText(node);
3636
- const caption = !!text && text === pressableOwnerText && !node.pressable;
3633
+ const text2 = nodeText(node);
3634
+ const caption = !!text2 && text2 === pressableOwnerText && !node.pressable;
3637
3635
  const actionable = !!node.pressable || actionableAncestor;
3638
3636
  const role = node.role ?? actionableRole;
3639
3637
  if (!caption) out.push({ node, ancestorTestIDs: ancestors, actionable, role });
3640
3638
  if (node.children?.length) {
3641
3639
  const next = node.testID ? [...ancestors, node.testID] : ancestors;
3642
- const owner = text ? node.pressable ? text : "" : pressableOwnerText;
3640
+ const owner = text2 ? node.pressable ? text2 : "" : pressableOwnerText;
3643
3641
  out.push(
3644
3642
  ...collectTextCandidates(
3645
3643
  node.children,
@@ -3681,9 +3679,9 @@ async function resolveTextTapTarget(bridge, query, options = {}) {
3681
3679
  const needle = options.exact ? query : query.toLowerCase();
3682
3680
  let candidates = collectTextCandidates(tree).filter(
3683
3681
  ({ node: node2, ancestorTestIDs, role }) => {
3684
- const text = nodeText(node2);
3685
- if (!text) return false;
3686
- if (options.exact ? text !== needle : !text.toLowerCase().includes(needle)) {
3682
+ const text2 = nodeText(node2);
3683
+ if (!text2) return false;
3684
+ if (options.exact ? text2 !== needle : !text2.toLowerCase().includes(needle)) {
3687
3685
  return false;
3688
3686
  }
3689
3687
  if (options.role && role !== options.role) return false;
@@ -4103,8 +4101,8 @@ var SimClient = class {
4103
4101
  return this.throwUnlessTapped(await tapById(this, target.testId), target.testId);
4104
4102
  }
4105
4103
  if (isTextTapTarget(target)) {
4106
- const { text, ...textOpts } = target;
4107
- return this.throwUnlessTapped(await tapByText(this, text, textOpts), text);
4104
+ const { text: text2, ...textOpts } = target;
4105
+ return this.throwUnlessTapped(await tapByText(this, text2, textOpts), text2);
4108
4106
  }
4109
4107
  if ("testID" in target && typeof target.testID === "string" && typeof target.nodeId !== "number") {
4110
4108
  return this.throwUnlessTapped(await tapById(this, target.testID), target.testID);
@@ -4138,9 +4136,9 @@ var SimClient = class {
4138
4136
  }
4139
4137
  }
4140
4138
  /** type through the visual iOS keyboard. requires a focused input. */
4141
- async type(text) {
4139
+ async type(text2) {
4142
4140
  await this.requireVisibleKeyboard("type");
4143
- await this.send({ type: "keyboard", action: "type", text });
4141
+ await this.send({ type: "keyboard", action: "type", text: text2 });
4144
4142
  }
4145
4143
  /** press a keyboard key ('return', 'delete', 'space', …). */
4146
4144
  async press(key) {
@@ -5347,7 +5345,7 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
5347
5345
  }
5348
5346
  function nativeAppIdentityFromIos(files, parseInfoPlist) {
5349
5347
  const pbxprojPath = Object.keys(files).find(
5350
- (path13) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path13)
5348
+ (path14) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path14)
5351
5349
  );
5352
5350
  if (!pbxprojPath) return null;
5353
5351
  const pbxproj = files[pbxprojPath];
@@ -5359,7 +5357,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist) {
5359
5357
  ].map((match) => match[1])
5360
5358
  );
5361
5359
  const appDelegatePattern = /(?:^|\/)ios\/([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
5362
- const targetName = Object.keys(files).filter((path13) => !path13.includes("/Pods/")).map((path13) => path13.match(appDelegatePattern)?.[1]).find((name2) => name2 !== void 0 && applicationTargets.has(name2)) ?? null;
5360
+ const targetName = Object.keys(files).filter((path14) => !path14.includes("/Pods/")).map((path14) => path14.match(appDelegatePattern)?.[1]).find((name2) => name2 !== void 0 && applicationTargets.has(name2)) ?? null;
5363
5361
  if (!targetName) return null;
5364
5362
  const plist3 = files[`ios/${targetName}/Info.plist`];
5365
5363
  if (!plist3) return null;
@@ -5436,7 +5434,7 @@ function extractNativeAppIdentityFromFiles(files, platform, parseInfoPlist) {
5436
5434
  // src/native-firebase-config.ts
5437
5435
  var import_node_fs8 = __toESM(require("node:fs"), 1);
5438
5436
  var import_node_module2 = require("node:module");
5439
- var import_node_path8 = __toESM(require("node:path"), 1);
5437
+ var import_node_path9 = __toESM(require("node:path"), 1);
5440
5438
  init_is_record();
5441
5439
 
5442
5440
  // src/plist.ts
@@ -5447,190 +5445,360 @@ function parsePlistSource(source) {
5447
5445
 
5448
5446
  // src/xcode-project.ts
5449
5447
  var import_node_fs7 = __toESM(require("node:fs"), 1);
5450
- var import_node_path7 = __toESM(require("node:path"), 1);
5448
+ var import_node_path8 = __toESM(require("node:path"), 1);
5451
5449
  var import_plist2 = __toESM(require_plist(), 1);
5452
5450
 
5453
- // src/swift-package.ts
5454
- var MANIFEST_DECLARATIONS = [
5455
- "executableTarget",
5456
- "testTarget",
5457
- "binaryTarget",
5458
- "systemLibrary",
5459
- "macro",
5460
- "plugin",
5461
- "target",
5462
- "library",
5463
- "executable",
5464
- "package"
5465
- ];
5466
- function manifestCalls(manifest, kinds) {
5467
- const code = manifest.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:"])\/\/[^\n]*/g, "$1");
5468
- const calls = [];
5469
- const pattern = new RegExp(`\\.(${MANIFEST_DECLARATIONS.join("|")})\\s*\\(`, "g");
5470
- let match;
5471
- while ((match = pattern.exec(code)) !== null) {
5472
- let depth = 1;
5473
- const start = pattern.lastIndex;
5474
- let i = start;
5475
- let inString = false;
5476
- let escaped = false;
5477
- let flat = "";
5478
- while (i < code.length && depth > 0) {
5479
- const ch = code[i];
5480
- if (inString) {
5481
- if (escaped) escaped = false;
5482
- else if (ch === "\\") escaped = true;
5483
- else if (ch === '"') inString = false;
5484
- if (depth === 1) flat += ch;
5485
- } else if (ch === '"') {
5486
- inString = true;
5487
- if (depth === 1) flat += ch;
5488
- } else if (ch === "(") {
5489
- depth++;
5490
- if (depth === 1) flat += ch;
5491
- } else if (ch === ")") {
5492
- depth--;
5493
- if (depth >= 1) flat += ch;
5494
- } else if (depth === 1) {
5495
- flat += ch;
5496
- }
5497
- i++;
5451
+ // src/xcode-json-project.ts
5452
+ var import_node_path7 = __toESM(require("node:path"), 1);
5453
+ var import_json52 = __toESM(require("json5"), 1);
5454
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5455
+ var text = (value) => typeof value === "string" ? value : void 0;
5456
+ var items = (value) => Array.isArray(value) ? value : [];
5457
+ var PHASE_ISA = {
5458
+ "compile-sources": "PBXSourcesBuildPhase",
5459
+ resources: "PBXResourcesBuildPhase",
5460
+ frameworks: "PBXFrameworksBuildPhase",
5461
+ headers: "PBXHeadersBuildPhase",
5462
+ copy: "PBXCopyFilesBuildPhase",
5463
+ script: "PBXShellScriptBuildPhase"
5464
+ };
5465
+ function readXcodeJsonProject(xcodeproj, source) {
5466
+ const json = import_json52.default.parse(source);
5467
+ if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
5468
+ const projectDir = import_node_path7.default.dirname(xcodeproj);
5469
+ const objects = {};
5470
+ let next = 0;
5471
+ const add = (entry, id) => {
5472
+ const key = id ?? `XCPROJ${(next++).toString(16).toUpperCase().padStart(18, "0")}`;
5473
+ objects[key] = entry;
5474
+ return key;
5475
+ };
5476
+ const locate = (raw, groupDir) => {
5477
+ if (raw.startsWith("<USER:")) return null;
5478
+ const base = /^<([A-Z]+)>\/(.*)$/.exec(raw);
5479
+ if (base) {
5480
+ if (base[1] === "PROJECT")
5481
+ return { sourceTree: "<absolute>", path: import_node_path7.default.join(projectDir, base[2]) };
5482
+ if (base[1] === "PRODUCTS")
5483
+ return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
5484
+ return null;
5498
5485
  }
5499
- if (kinds.includes(match[1]))
5500
- calls.push({ kind: match[1], flat, call: code.slice(start, i) });
5501
- pattern.lastIndex = i;
5502
- }
5503
- return calls;
5504
- }
5505
- var NAME = /\bname\s*:\s*"([^"]+)"/;
5506
- function listArgument(call, label) {
5507
- const start = new RegExp(`\\b${label}\\s*:\\s*\\[`).exec(call);
5508
- if (!start) return [];
5509
- const items = [];
5510
- let depth = 0;
5511
- let inString = false;
5512
- let item = "";
5513
- for (let i = start.index + start[0].length; i < call.length; i++) {
5514
- const ch = call[i];
5515
- if (inString) {
5516
- item += ch;
5517
- if (ch === '"' && call[i - 1] !== "\\") inString = false;
5518
- continue;
5486
+ const unescaped = raw.replaceAll("\\<", "<");
5487
+ if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
5488
+ if (unescaped.startsWith("~")) return null;
5489
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path7.default.join(groupDir, unescaped) };
5490
+ };
5491
+ const memberships = [];
5492
+ const folders = [];
5493
+ const projectFiles = [];
5494
+ const root = { id: "", name: "", dir: projectDir, parent: null, children: [] };
5495
+ const walk = (entries, parent) => entries.flatMap((entry) => {
5496
+ if (!isObject(entry)) return [];
5497
+ const kind = text(entry.kind) ?? "file-reference";
5498
+ const raw = text(entry.path) ?? "";
5499
+ const located = raw === "" ? null : locate(raw, parent.dir);
5500
+ const name2 = text(entry.name) ?? import_node_path7.default.basename(raw);
5501
+ const node = { id: "", name: name2, dir: null, parent, children: [] };
5502
+ if (kind === "group" || kind === "variant-group" || kind === "version-group") {
5503
+ node.dir = raw === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
5504
+ const childIds = walk(items(entry.children), node);
5505
+ node.id = add(
5506
+ kind === "version-group" && located ? {
5507
+ isa: "PBXFileReference",
5508
+ ...located,
5509
+ lastKnownFileType: "wrapper.xcdatamodel"
5510
+ } : {
5511
+ isa: kind === "variant-group" ? "PBXVariantGroup" : "PBXGroup",
5512
+ children: childIds,
5513
+ ...kind === "variant-group" ? {} : { sourceTree: "<absolute>", path: node.dir ?? "" },
5514
+ name: name2
5515
+ },
5516
+ text(entry.id)
5517
+ );
5518
+ } else if (kind === "folder") {
5519
+ node.id = add(
5520
+ {
5521
+ isa: "PBXFileSystemSynchronizedRootGroup",
5522
+ ...located ?? { sourceTree: "SDKROOT", path: raw }
5523
+ },
5524
+ text(entry.id)
5525
+ );
5526
+ folders.push({ id: node.id, folder: entry });
5527
+ } else {
5528
+ node.id = add(
5529
+ {
5530
+ isa: "PBXFileReference",
5531
+ ...located ?? { sourceTree: "SDKROOT", path: raw },
5532
+ name: name2
5533
+ },
5534
+ text(entry.id)
5535
+ );
5536
+ if (located?.sourceTree === "<absolute>" && located.path.endsWith(".xcodeproj"))
5537
+ projectFiles.push(node.id);
5519
5538
  }
5520
- if (ch === '"') inString = true;
5521
- else if (ch === "(" || ch === "[") depth++;
5522
- else if (ch === ")" || ch === "]") {
5523
- if (depth === 0) break;
5524
- depth--;
5525
- } else if (ch === "," && depth === 0) {
5526
- items.push(item.trim());
5527
- item = "";
5528
- continue;
5539
+ parent.children.push(node);
5540
+ for (const membership of items(entry["target-membership"])) {
5541
+ if (kind !== "folder") memberships.push({ refId: node.id, entry: membership });
5529
5542
  }
5530
- item += ch;
5531
- }
5532
- if (item.trim()) items.push(item.trim());
5533
- return items;
5534
- }
5535
- function swiftPackageIdentity(url) {
5536
- return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
5537
- }
5538
- function swiftManifestGraph(manifest) {
5539
- const graph = {
5540
- products: /* @__PURE__ */ new Map(),
5541
- dependencies: /* @__PURE__ */ new Map(),
5542
- binaryTargets: /* @__PURE__ */ new Set(),
5543
- systemLibraries: /* @__PURE__ */ new Set(),
5544
- packageURLs: /* @__PURE__ */ new Map(),
5545
- packagePaths: []
5543
+ return [node.id];
5544
+ });
5545
+ const mainGroupChildren = walk(items(json.files), root);
5546
+ const mainGroup = add({
5547
+ isa: "PBXGroup",
5548
+ children: mainGroupChildren,
5549
+ sourceTree: "<absolute>",
5550
+ path: projectDir
5551
+ });
5552
+ root.id = mainGroup;
5553
+ const lookup = (reference, from = root) => {
5554
+ if (isObject(reference)) {
5555
+ const anchor = lookupNode(reference.anchor, root);
5556
+ return anchor ? lookup(reference["relative-path"], anchor) : void 0;
5557
+ }
5558
+ if (Array.isArray(reference)) {
5559
+ return lookupNode(
5560
+ reference.map(
5561
+ (component) => isObject(component) ? text(component.name) ?? "" : text(component) ?? ""
5562
+ ).join("/"),
5563
+ from
5564
+ )?.id;
5565
+ }
5566
+ return lookupNode(reference, from)?.id;
5546
5567
  };
5547
- for (const { kind, flat, call } of manifestCalls(manifest, [
5548
- "library",
5549
- "executableTarget",
5550
- "target",
5551
- "binaryTarget",
5552
- "systemLibrary",
5553
- "package"
5554
- ])) {
5555
- if (kind === "package") {
5556
- const local = /\bpath\s*:\s*"([^"]+)"/.exec(flat)?.[1];
5557
- if (local) graph.packagePaths.push(local);
5558
- const url = /\burl\s*:\s*"([^"]+)"/.exec(flat)?.[1];
5559
- if (!url) continue;
5560
- graph.packageURLs.set(swiftPackageIdentity(url), url);
5561
- const name3 = NAME.exec(flat)?.[1];
5562
- if (name3) graph.packageURLs.set(name3.toLowerCase(), url);
5563
- continue;
5568
+ const lookupNode = (reference, from) => {
5569
+ const value = text(reference);
5570
+ if (value === void 0) return void 0;
5571
+ if (value.startsWith("id:")) {
5572
+ const id = value.slice(3);
5573
+ const find = (node2) => node2.id === id ? node2 : node2.children.map(find).find(Boolean);
5574
+ return find(root);
5575
+ }
5576
+ let node = from;
5577
+ for (const component of value.split("/")) {
5578
+ if (!node) return void 0;
5579
+ node = component === "." ? node : component === ".." ? node.parent ?? void 0 : node.children.find((child) => child.name === component);
5580
+ }
5581
+ return node;
5582
+ };
5583
+ const configurations = items(json.configurations).flatMap((entry) => {
5584
+ const name2 = isObject(entry) ? text(entry.name) : text(entry);
5585
+ return name2 ? [{ name: name2, file: isObject(entry) ? entry.file : void 0 }] : [];
5586
+ });
5587
+ const settingsOf = (value) => Object.fromEntries(
5588
+ Object.entries(isObject(value) ? value : {}).flatMap(
5589
+ ([key, setting]) => typeof setting === "string" ? [[key, setting]] : Array.isArray(setting) ? [
5590
+ [
5591
+ key,
5592
+ setting.filter((item) => typeof item === "string")
5593
+ ]
5594
+ ] : []
5595
+ )
5596
+ );
5597
+ const configurationList = (settings, specialized) => add({
5598
+ isa: "XCConfigurationList",
5599
+ defaultConfigurationName: text(json["default-configuration"]) ?? "Debug",
5600
+ buildConfigurations: configurations.map(({ name: name2, file }) => {
5601
+ const base = lookup(specialized.has(name2) ? specialized.get(name2) : file);
5602
+ return add({
5603
+ isa: "XCBuildConfiguration",
5604
+ name: name2,
5605
+ buildSettings: settings,
5606
+ ...base ? { baseConfigurationReference: base } : {}
5607
+ });
5608
+ })
5609
+ });
5610
+ const packageIds = /* @__PURE__ */ new Map();
5611
+ for (const entry of items(json.packages)) {
5612
+ if (!isObject(entry)) continue;
5613
+ const repository = text(entry.repository);
5614
+ const local = text(entry.path);
5615
+ const name2 = local !== void 0 ? import_node_path7.default.basename(import_node_path7.default.resolve(import_node_path7.default.dirname(xcodeproj), local)) : import_node_path7.default.basename(repository ?? "").replace(/\.git$/, "");
5616
+ const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
5617
+ packageIds.set(name2.toLowerCase(), id);
5618
+ }
5619
+ const productDependency = (entry) => add({
5620
+ isa: "XCSwiftPackageProductDependency",
5621
+ productName: text(entry["product-name"]) ?? "",
5622
+ // xcode finds a product by name across packages when none is named
5623
+ ...packageIds.has(text(entry.package)?.toLowerCase() ?? "") ? { package: packageIds.get(text(entry.package).toLowerCase()) } : {}
5624
+ });
5625
+ const proxy = (entry, remote, proxyType) => add({
5626
+ isa: "PBXContainerItemProxy",
5627
+ containerPortal: lookup(entry.project) ?? "",
5628
+ proxyType,
5629
+ remoteGlobalIDString: remote ?? "",
5630
+ remoteInfo: text(entry.target) ?? ""
5631
+ });
5632
+ const phases = /* @__PURE__ */ new Map();
5633
+ const targetIds = /* @__PURE__ */ new Map();
5634
+ const targets = [];
5635
+ for (const entry of items(json.targets)) {
5636
+ if (!isObject(entry)) continue;
5637
+ const name2 = text(entry.name) ?? "";
5638
+ const productType = text(entry["product-type"]);
5639
+ const target = {
5640
+ isa: text(entry.kind) === "aggregate" ? "PBXAggregateTarget" : "PBXNativeTarget",
5641
+ name: name2,
5642
+ productName: name2,
5643
+ productType: productType ? `com.apple.product-type.${productType}` : text(entry["full-product-type"]) ?? "",
5644
+ buildPhases: [],
5645
+ dependencies: [],
5646
+ packageProductDependencies: [],
5647
+ fileSystemSynchronizedGroups: []
5648
+ };
5649
+ const product = lookup(entry.product);
5650
+ if (product) target.productReference = product;
5651
+ const id = add(target, text(entry.id));
5652
+ targetIds.set(name2, id);
5653
+ targets.push({ id, target, entry });
5654
+ for (const phase of items(entry["build-phases"])) {
5655
+ const kind = isObject(phase) ? text(phase.kind) : text(phase);
5656
+ const isa = kind ? PHASE_ISA[kind] : void 0;
5657
+ if (!kind || !isa) continue;
5658
+ const phaseName = isObject(phase) ? text(phase.name) : void 0;
5659
+ const phaseId = add(
5660
+ { isa, files: [] },
5661
+ isObject(phase) ? text(phase.id) : void 0
5662
+ );
5663
+ target.buildPhases.push(phaseId);
5664
+ phases.set([name2, kind, phaseName].filter(Boolean).join("/"), phaseId);
5665
+ phases.set(`id:${phaseId}`, phaseId);
5564
5666
  }
5565
- const name2 = NAME.exec(flat)?.[1];
5566
- if (!name2) continue;
5567
- if (kind === "library") {
5568
- graph.products.set(
5569
- name2,
5570
- listArgument(call, "targets").flatMap(
5571
- (item) => /^"([^"]+)"$/.exec(item)?.[1] ?? []
5667
+ }
5668
+ const phaseFiles = (reference, targetName) => {
5669
+ const value = text(reference);
5670
+ if (value === void 0) return null;
5671
+ const key = value.startsWith("id:") || !targetName ? value : `${targetName}/${value}`;
5672
+ const phase = objects[phases.get(key) ?? ""];
5673
+ return phase && typeof phase === "object" && !Array.isArray(phase) && Array.isArray(phase.files) ? phase.files : null;
5674
+ };
5675
+ for (const { refId, entry } of memberships) {
5676
+ const files = phaseFiles(isObject(entry) ? entry["build-phase"] : entry);
5677
+ files?.push(add({ isa: "PBXBuildFile", fileRef: refId }));
5678
+ }
5679
+ for (const { target, entry } of targets) {
5680
+ const name2 = text(entry.name) ?? "";
5681
+ target.buildConfigurationList = configurationList(
5682
+ settingsOf(entry["build-settings"]),
5683
+ new Map(
5684
+ items(entry["specialized-configurations"]).flatMap(
5685
+ (configuration) => isObject(configuration) && text(configuration.name) ? [[text(configuration.name), configuration.file]] : []
5572
5686
  )
5573
- );
5574
- continue;
5687
+ )
5688
+ );
5689
+ for (const dependency of items(entry.dependencies)) {
5690
+ const kind = isObject(dependency) ? text(dependency.kind) ?? "localTarget" : "localTarget";
5691
+ if (kind === "package" && isObject(dependency)) {
5692
+ ;
5693
+ target.dependencies.push(
5694
+ add({ isa: "PBXTargetDependency", productRef: productDependency(dependency) })
5695
+ );
5696
+ } else if (kind === "remoteTarget" && isObject(dependency)) {
5697
+ ;
5698
+ target.dependencies.push(
5699
+ add({
5700
+ isa: "PBXTargetDependency",
5701
+ targetProxy: proxy(dependency, text(dependency["target-id"]), "1")
5702
+ })
5703
+ );
5704
+ } else {
5705
+ const local = isObject(dependency) ? text(dependency.target) : text(dependency);
5706
+ const id = local ? targetIds.get(local) : void 0;
5707
+ if (id)
5708
+ target.dependencies.push(
5709
+ add({ isa: "PBXTargetDependency", target: id })
5710
+ );
5711
+ }
5575
5712
  }
5576
- if (kind === "binaryTarget") graph.binaryTargets.add(name2);
5577
- if (kind === "systemLibrary") graph.systemLibraries.add(name2);
5578
- const dependencies = [];
5579
- for (const item of listArgument(call, "dependencies")) {
5580
- const platforms = /condition\s*:\s*\.when\(\s*platforms\s*:\s*\[([^\]]*)\]/.exec(
5581
- item
5582
- )?.[1];
5583
- if (platforms !== void 0 && !/\.iOS\b/.test(platforms)) continue;
5584
- if (/condition\s*:\s*\.when\([^)]*\btraits\s*:/.test(item)) continue;
5585
- const plain = /^"([^"]+)"$/.exec(item)?.[1];
5586
- const product = /^\.product(?:Item)?\(\s*name\s*:\s*"([^"]+)"\s*,\s*package\s*:\s*"([^"]+)"/.exec(
5587
- item
5713
+ for (const member of items(entry["package-product-members"])) {
5714
+ if (!isObject(member)) continue;
5715
+ const dependency = productDependency(member);
5716
+ target.packageProductDependencies.push(dependency);
5717
+ const buildFile = member["build-phase"];
5718
+ phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name2)?.push(
5719
+ add({ isa: "PBXBuildFile", productRef: dependency })
5588
5720
  );
5589
- const target = /^\.(?:target|byName)(?:Item)?\(\s*name\s*:\s*"([^"]+)"/.exec(
5590
- item
5591
- )?.[1];
5592
- if (plain) dependencies.push({ kind: "target", name: plain });
5593
- else if (product)
5594
- dependencies.push({
5595
- kind: "product",
5596
- name: product[1],
5597
- package: product[2].toLowerCase()
5598
- });
5599
- else if (target) dependencies.push({ kind: "target", name: target });
5600
5721
  }
5601
- graph.dependencies.set(name2, dependencies);
5602
5722
  }
5603
- for (const dependencies of graph.dependencies.values()) {
5604
- for (const [index, dependency] of dependencies.entries()) {
5605
- if (dependency.kind === "target" && !graph.dependencies.has(dependency.name))
5606
- dependencies[index] = {
5607
- kind: "product",
5608
- name: dependency.name,
5609
- package: dependency.name.toLowerCase()
5610
- };
5723
+ for (const imported of items(json["imported-products"])) {
5724
+ if (!isObject(imported)) continue;
5725
+ const reference = add({
5726
+ isa: "PBXReferenceProxy",
5727
+ path: text(imported.name) ?? text(imported.path) ?? "",
5728
+ sourceTree: "BUILT_PRODUCTS_DIR",
5729
+ remoteRef: proxy(imported, text(imported["product-id"]), "2")
5730
+ });
5731
+ for (const membership of items(imported["target-membership"])) {
5732
+ phaseFiles(isObject(membership) ? membership["build-phase"] : membership)?.push(
5733
+ add({ isa: "PBXBuildFile", fileRef: reference })
5734
+ );
5611
5735
  }
5612
5736
  }
5613
- return graph;
5737
+ for (const { id, folder } of folders) {
5738
+ const exceptions = [];
5739
+ for (const exception of items(folder["membership-exceptions"])) {
5740
+ if (!isObject(exception)) continue;
5741
+ const target = targetIds.get(text(exception.target) ?? "");
5742
+ if (!target) continue;
5743
+ exceptions.push(
5744
+ add({
5745
+ isa: "PBXFileSystemSynchronizedBuildFileExceptionSet",
5746
+ target,
5747
+ membershipExceptions: [
5748
+ ...items(exception.exclusions),
5749
+ ...items(exception.inclusions)
5750
+ ].flatMap((member) => typeof member === "string" ? [member] : [])
5751
+ })
5752
+ );
5753
+ }
5754
+ const group = objects[id];
5755
+ if (group && typeof group === "object" && !Array.isArray(group))
5756
+ group.exceptions = exceptions;
5757
+ for (const owner of items(folder["target-membership"])) {
5758
+ const target = targets.find(
5759
+ (candidate) => candidate.id === targetIds.get(text(owner) ?? "")
5760
+ );
5761
+ target?.target.fileSystemSynchronizedGroups?.push(id);
5762
+ }
5763
+ }
5764
+ const localizations = isObject(json.localizations) ? json.localizations : {};
5765
+ const project = add({
5766
+ isa: "PBXProject",
5767
+ mainGroup,
5768
+ projectDirPath: "",
5769
+ developmentRegion: text(localizations.development) ?? "en",
5770
+ buildConfigurationList: configurationList(
5771
+ settingsOf(json["build-settings"]),
5772
+ /* @__PURE__ */ new Map()
5773
+ ),
5774
+ targets: targets.map((entry) => entry.id),
5775
+ packageReferences: [...packageIds.values()],
5776
+ projectReferences: projectFiles.map((ProjectRef) => ({ ProjectRef }))
5777
+ });
5778
+ return { objects, rootObject: project };
5779
+ }
5780
+ function isJsonObject(value) {
5781
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5614
5782
  }
5615
5783
 
5616
5784
  // src/xcode-project.ts
5617
- function parseOpenStepPlist(text) {
5785
+ function parseOpenStepPlist(text2) {
5618
5786
  let i = 0;
5619
5787
  const fail = (message) => {
5620
- const line = text.slice(0, i).split("\n").length;
5788
+ const line = text2.slice(0, i).split("\n").length;
5621
5789
  throw new Error(`project.pbxproj line ${line}: ${message}`);
5622
5790
  };
5623
5791
  const skip = () => {
5624
5792
  for (; ; ) {
5625
- const ch = text[i];
5793
+ const ch = text2[i];
5626
5794
  if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
5627
- else if (ch === "/" && text[i + 1] === "*") {
5628
- const end = text.indexOf("*/", i + 2);
5795
+ else if (ch === "/" && text2[i + 1] === "*") {
5796
+ const end = text2.indexOf("*/", i + 2);
5629
5797
  if (end < 0) fail("unterminated comment");
5630
5798
  i = end + 2;
5631
- } else if (ch === "/" && text[i + 1] === "/") {
5632
- const end = text.indexOf("\n", i);
5633
- i = end < 0 ? text.length : end + 1;
5799
+ } else if (ch === "/" && text2[i + 1] === "/") {
5800
+ const end = text2.indexOf("\n", i);
5801
+ i = end < 0 ? text2.length : end + 1;
5634
5802
  } else return;
5635
5803
  }
5636
5804
  };
@@ -5638,42 +5806,42 @@ function parseOpenStepPlist(text) {
5638
5806
  i++;
5639
5807
  let out = "";
5640
5808
  for (; ; ) {
5641
- const ch = text[i++];
5809
+ const ch = text2[i++];
5642
5810
  if (ch === void 0) fail("unterminated string");
5643
5811
  if (ch === '"') return out;
5644
5812
  if (ch !== "\\") {
5645
5813
  out += ch;
5646
5814
  continue;
5647
5815
  }
5648
- const next = text[i++];
5816
+ const next = text2[i++];
5649
5817
  if (next === "n") out += "\n";
5650
5818
  else if (next === "t") out += " ";
5651
5819
  else if (next === "r") out += "\r";
5652
5820
  else if (next === "U") {
5653
- out += String.fromCharCode(parseInt(text.slice(i, i + 4), 16));
5821
+ out += String.fromCharCode(parseInt(text2.slice(i, i + 4), 16));
5654
5822
  i += 4;
5655
5823
  } else out += next;
5656
5824
  }
5657
5825
  };
5658
5826
  const value = () => {
5659
5827
  skip();
5660
- const ch = text[i];
5828
+ const ch = text2[i];
5661
5829
  if (ch === "{") {
5662
5830
  i++;
5663
5831
  const dict = {};
5664
5832
  for (; ; ) {
5665
5833
  skip();
5666
- if (text[i] === "}") {
5834
+ if (text2[i] === "}") {
5667
5835
  i++;
5668
5836
  return dict;
5669
5837
  }
5670
5838
  const key = value();
5671
5839
  if (typeof key !== "string") fail("dictionary key is not a string");
5672
5840
  skip();
5673
- if (text[i++] !== "=") fail("expected =");
5841
+ if (text2[i++] !== "=") fail("expected =");
5674
5842
  dict[key] = value();
5675
5843
  skip();
5676
- if (text[i++] !== ";") fail("expected ;");
5844
+ if (text2[i++] !== ";") fail("expected ;");
5677
5845
  }
5678
5846
  }
5679
5847
  if (ch === "(") {
@@ -5681,26 +5849,26 @@ function parseOpenStepPlist(text) {
5681
5849
  const list2 = [];
5682
5850
  for (; ; ) {
5683
5851
  skip();
5684
- if (text[i] === ")") {
5852
+ if (text2[i] === ")") {
5685
5853
  i++;
5686
5854
  return list2;
5687
5855
  }
5688
5856
  list2.push(value());
5689
5857
  skip();
5690
- if (text[i] === ",") i++;
5691
- else if (text[i] !== ")") fail("expected , or )");
5858
+ if (text2[i] === ",") i++;
5859
+ else if (text2[i] !== ")") fail("expected , or )");
5692
5860
  }
5693
5861
  }
5694
5862
  if (ch === '"') return quoted();
5695
5863
  const start = i;
5696
- while (i < text.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text[i])) i++;
5864
+ while (i < text2.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text2[i])) i++;
5697
5865
  if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
5698
- return text.slice(start, i);
5866
+ return text2.slice(start, i);
5699
5867
  };
5700
- if (text.startsWith("// !$*UTF8*$!")) i = text.indexOf("\n") + 1;
5868
+ if (text2.startsWith("// !$*UTF8*$!")) i = text2.indexOf("\n") + 1;
5701
5869
  const root = value();
5702
5870
  skip();
5703
- if (i !== text.length) fail("trailing content");
5871
+ if (i !== text2.length) fail("trailing content");
5704
5872
  return root;
5705
5873
  }
5706
5874
  var isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -5725,7 +5893,7 @@ function walkFiles(dir) {
5725
5893
  const out = [];
5726
5894
  for (const entry of import_node_fs7.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
5727
5895
  if (entry.name.startsWith(".")) continue;
5728
- const full = import_node_path7.default.join(dir, entry.name);
5896
+ const full = import_node_path8.default.join(dir, entry.name);
5729
5897
  if (entry.isDirectory()) out.push(...walkFiles(full));
5730
5898
  else if (entry.isFile()) out.push(full);
5731
5899
  }
@@ -5742,7 +5910,7 @@ function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
5742
5910
  if (include) {
5743
5911
  Object.assign(
5744
5912
  settings,
5745
- readXcconfig(import_node_path7.default.resolve(import_node_path7.default.dirname(file), include[1]), seen)
5913
+ readXcconfig(import_node_path8.default.resolve(import_node_path8.default.dirname(file), include[1]), seen)
5746
5914
  );
5747
5915
  continue;
5748
5916
  }
@@ -5788,22 +5956,22 @@ function applyOperator(value, operator) {
5788
5956
  }
5789
5957
  throw new Error(`unsupported build setting operator :${operator}`);
5790
5958
  }
5791
- function decodeXml(text) {
5792
- return text.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
5959
+ function decodeXml(text2) {
5960
+ return text2.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
5793
5961
  }
5794
5962
  function workspaceReferences(workspace) {
5795
- const data = import_node_path7.default.join(workspace, "contents.xcworkspacedata");
5963
+ const data = import_node_path8.default.join(workspace, "contents.xcworkspacedata");
5796
5964
  if (!import_node_fs7.default.existsSync(data))
5797
5965
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
5798
- const container = import_node_path7.default.dirname(workspace);
5966
+ const container = import_node_path8.default.dirname(workspace);
5799
5967
  const locate = (location, base) => {
5800
5968
  const colon = location.indexOf(":");
5801
5969
  const kind = location.slice(0, colon);
5802
5970
  const rest = location.slice(colon + 1);
5803
- if (kind === "group") return import_node_path7.default.resolve(base, rest);
5804
- if (kind === "container" || kind === "self") return import_node_path7.default.resolve(container, rest);
5805
- if (kind === "absolute") return import_node_path7.default.resolve(rest);
5806
- throw new Error(`${import_node_path7.default.basename(workspace)} has an unsupported location ${location}`);
5971
+ if (kind === "group") return import_node_path8.default.resolve(base, rest);
5972
+ if (kind === "container" || kind === "self") return import_node_path8.default.resolve(container, rest);
5973
+ if (kind === "absolute") return import_node_path8.default.resolve(rest);
5974
+ throw new Error(`${import_node_path8.default.basename(workspace)} has an unsupported location ${location}`);
5807
5975
  };
5808
5976
  const groups = [container];
5809
5977
  const references = [];
@@ -5821,15 +5989,24 @@ function workspaceReferences(workspace) {
5821
5989
  return references;
5822
5990
  }
5823
5991
  var loaded = /* @__PURE__ */ new Map();
5992
+ function xcodeProjectFile(xcodeproj) {
5993
+ for (const name2 of ["project.pbxproj", "project.xcproj"]) {
5994
+ const file = import_node_path8.default.join(xcodeproj, name2);
5995
+ if (import_node_fs7.default.existsSync(file)) return file;
5996
+ }
5997
+ return null;
5998
+ }
5824
5999
  function loadProject(xcodeproj) {
5825
- const pbxproj = import_node_path7.default.join(xcodeproj, "project.pbxproj");
5826
- if (!import_node_fs7.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
5827
- const mtimeMs = import_node_fs7.default.statSync(pbxproj).mtimeMs;
5828
- const cached2 = loaded.get(pbxproj);
6000
+ const projectFile = xcodeProjectFile(xcodeproj);
6001
+ if (!projectFile)
6002
+ throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
6003
+ const mtimeMs = import_node_fs7.default.statSync(projectFile).mtimeMs;
6004
+ const cached2 = loaded.get(projectFile);
5829
6005
  if (cached2?.mtimeMs === mtimeMs) return cached2.project;
5830
- const root = parseOpenStepPlist(import_node_fs7.default.readFileSync(pbxproj, "utf8"));
6006
+ const source = import_node_fs7.default.readFileSync(projectFile, "utf8");
6007
+ const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
5831
6008
  if (!isDict(root) || !isDict(root.objects)) {
5832
- throw new Error(`${pbxproj} has no objects table`);
6009
+ throw new Error(`${projectFile} has no objects table`);
5833
6010
  }
5834
6011
  const objects = root.objects;
5835
6012
  const object = (id) => {
@@ -5838,10 +6015,10 @@ function loadProject(xcodeproj) {
5838
6015
  };
5839
6016
  const project = object(str(root.rootObject));
5840
6017
  if (!project || project.isa !== "PBXProject") {
5841
- throw new Error(`${pbxproj} has no PBXProject root`);
6018
+ throw new Error(`${projectFile} has no PBXProject root`);
5842
6019
  }
5843
6020
  const projectDir = import_node_fs7.default.realpathSync(
5844
- import_node_path7.default.resolve(import_node_path7.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
6021
+ import_node_path8.default.resolve(import_node_path8.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
5845
6022
  );
5846
6023
  const parent = /* @__PURE__ */ new Map();
5847
6024
  for (const [id, entry] of Object.entries(objects)) {
@@ -5859,18 +6036,26 @@ function loadProject(xcodeproj) {
5859
6036
  const own = str(entry.path) ?? "";
5860
6037
  const tree = str(entry.sourceTree) ?? "<group>";
5861
6038
  if (tree === "<absolute>") result2 = own;
5862
- else if (tree === "SOURCE_ROOT") result2 = import_node_path7.default.join(projectDir, own);
6039
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path8.default.join(projectDir, own);
5863
6040
  else if (tree === "<group>") {
5864
6041
  const up = parent.get(id);
5865
6042
  const base = up ? resolvePath(up) : projectDir;
5866
- result2 = base === null ? null : import_node_path7.default.join(base, own);
6043
+ result2 = base === null ? null : import_node_path8.default.join(base, own);
5867
6044
  }
5868
6045
  }
5869
6046
  resolvedPaths.set(id, result2);
5870
6047
  return result2;
5871
6048
  };
5872
- const result = { xcodeproj, pbxproj, objects, project, projectDir, object, resolvePath };
5873
- loaded.set(pbxproj, { mtimeMs, project: result });
6049
+ const result = {
6050
+ xcodeproj,
6051
+ projectFile,
6052
+ objects,
6053
+ project,
6054
+ projectDir,
6055
+ object,
6056
+ resolvePath
6057
+ };
6058
+ loaded.set(projectFile, { mtimeMs, project: result });
5874
6059
  return result;
5875
6060
  }
5876
6061
  function targetSettings(ref, builtins) {
@@ -5984,7 +6169,7 @@ function targetMembers(ref) {
5984
6169
  }
5985
6170
  }
5986
6171
  const addSynchronized = (folder, relative2) => {
5987
- const file = import_node_path7.default.join(folder, relative2);
6172
+ const file = import_node_path8.default.join(folder, relative2);
5988
6173
  if (NEVER_MEMBER.test(relative2)) return;
5989
6174
  if (file.endsWith(".swift")) {
5990
6175
  if (!relative2.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
@@ -6009,7 +6194,7 @@ function targetMembers(ref) {
6009
6194
  }
6010
6195
  if (owned.has(groupId)) {
6011
6196
  for (const file of walkFiles(folder)) {
6012
- const relative2 = import_node_path7.default.relative(folder, file).split(import_node_path7.default.sep).join("/");
6197
+ const relative2 = import_node_path8.default.relative(folder, file).split(import_node_path8.default.sep).join("/");
6013
6198
  if ([...exceptions].some(
6014
6199
  (exception) => relative2 === exception || relative2.startsWith(`${exception}/`)
6015
6200
  ))
@@ -6018,12 +6203,12 @@ function targetMembers(ref) {
6018
6203
  }
6019
6204
  } else {
6020
6205
  for (const relative2 of exceptions) {
6021
- const file = import_node_path7.default.join(folder, relative2);
6206
+ const file = import_node_path8.default.join(folder, relative2);
6022
6207
  if (isDirectory(file)) {
6023
6208
  for (const inner of walkFiles(file))
6024
6209
  addSynchronized(
6025
6210
  folder,
6026
- import_node_path7.default.relative(folder, inner).split(import_node_path7.default.sep).join("/")
6211
+ import_node_path8.default.relative(folder, inner).split(import_node_path8.default.sep).join("/")
6027
6212
  );
6028
6213
  } else if (import_node_fs7.default.existsSync(file)) addSynchronized(folder, relative2);
6029
6214
  }
@@ -6038,8 +6223,8 @@ function targetMembers(ref) {
6038
6223
  function commonAncestor(dirs) {
6039
6224
  let common = dirs[0];
6040
6225
  for (const dir of dirs) {
6041
- while (common !== import_node_path7.default.dirname(common) && import_node_path7.default.relative(common, dir).startsWith(".."))
6042
- common = import_node_path7.default.dirname(common);
6226
+ while (common !== import_node_path8.default.dirname(common) && import_node_path8.default.relative(common, dir).startsWith(".."))
6227
+ common = import_node_path8.default.dirname(common);
6043
6228
  }
6044
6229
  return common;
6045
6230
  }
@@ -6048,9 +6233,9 @@ function workspaceProjects(xcodeprojOrWorkspace) {
6048
6233
  const projects = [];
6049
6234
  const projectAt = /* @__PURE__ */ new Map();
6050
6235
  const addProject = (xcodeproj) => {
6051
- const key = import_node_path7.default.resolve(xcodeproj);
6052
- if (projectAt.has(key) || key.split(import_node_path7.default.sep).includes("Pods")) return;
6053
- if (!import_node_fs7.default.existsSync(import_node_path7.default.join(key, "project.pbxproj"))) return;
6236
+ const key = import_node_path8.default.resolve(xcodeproj);
6237
+ if (projectAt.has(key) || key.split(import_node_path8.default.sep).includes("Pods")) return;
6238
+ if (!xcodeProjectFile(key)) return;
6054
6239
  const project = loadProject(key);
6055
6240
  projectAt.set(key, project);
6056
6241
  projects.push(project);
@@ -6066,14 +6251,22 @@ function workspaceProjects(xcodeprojOrWorkspace) {
6066
6251
  for (const reference of listed)
6067
6252
  if (reference.endsWith(".xcodeproj")) addProject(reference);
6068
6253
  if (projects.length === 0) {
6069
- throw new Error(`${import_node_path7.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
6254
+ throw new Error(`${import_node_path8.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
6070
6255
  }
6071
6256
  return { listed, projects, projectAt };
6072
6257
  }
6073
- var nativeTargets = (project) => list(project.project.targets).flatMap((id) => {
6074
- const target = project.object(id);
6075
- return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
6076
- });
6258
+ var targetRefs = /* @__PURE__ */ new WeakMap();
6259
+ function nativeTargets(project) {
6260
+ let refs = targetRefs.get(project);
6261
+ if (!refs) {
6262
+ refs = list(project.project.targets).flatMap((id) => {
6263
+ const target = project.object(id);
6264
+ return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
6265
+ });
6266
+ targetRefs.set(project, refs);
6267
+ }
6268
+ return refs;
6269
+ }
6077
6270
  function listXcodeAppTargets(xcodeprojOrWorkspace) {
6078
6271
  return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(nativeTargets).filter((ref) => ref.target.productType === APPLICATION).map((ref) => str(ref.target.name) ?? ref.id);
6079
6272
  }
@@ -6083,7 +6276,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
6083
6276
  const allTargets = projects.flatMap(nativeTargets);
6084
6277
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
6085
6278
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
6086
- const container = import_node_path7.default.basename(xcodeprojOrWorkspace);
6279
+ const container = import_node_path8.default.basename(xcodeprojOrWorkspace);
6087
6280
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
6088
6281
  if (named.length !== 1) {
6089
6282
  throw new Error(
@@ -6095,14 +6288,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
6095
6288
  for (const ref of allTargets) {
6096
6289
  const product = ref.project.object(str(ref.target.productReference));
6097
6290
  const file = str(product?.path);
6098
- if (file && !byProduct.has(import_node_path7.default.basename(file)))
6099
- byProduct.set(import_node_path7.default.basename(file), ref);
6291
+ if (file && !byProduct.has(import_node_path8.default.basename(file)))
6292
+ byProduct.set(import_node_path8.default.basename(file), ref);
6100
6293
  }
6101
6294
  const proxied = (project, proxyId) => {
6102
6295
  const proxy = project.object(proxyId);
6103
6296
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
6104
6297
  const portal = str(proxy.containerPortal);
6105
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path7.default.resolve(project.resolvePath(portal ?? "") ?? ""));
6298
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path8.default.resolve(project.resolvePath(portal ?? "") ?? ""));
6106
6299
  const remote = str(proxy.remoteGlobalIDString);
6107
6300
  if (!owner || !remote) return void 0;
6108
6301
  return nativeTargets(owner).find(
@@ -6123,7 +6316,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
6123
6316
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
6124
6317
  for (const buildFileId of list(phase.files)) {
6125
6318
  const file = project.object(str(project.object(buildFileId)?.fileRef));
6126
- const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path7.default.basename(str(file.path) ?? "")) : void 0;
6319
+ const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path8.default.basename(str(file.path) ?? "")) : void 0;
6127
6320
  if (resolved) found.push(resolved);
6128
6321
  }
6129
6322
  }
@@ -6144,7 +6337,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
6144
6337
  const name2 = str(ref.target.name) ?? ref.id;
6145
6338
  const { get: settings2, keys } = targetSettings(ref, {
6146
6339
  TARGET_NAME: name2,
6147
- PROJECT_NAME: import_node_path7.default.basename(ref.project.xcodeproj, ".xcodeproj"),
6340
+ PROJECT_NAME: import_node_path8.default.basename(ref.project.xcodeproj, ".xcodeproj"),
6148
6341
  SRCROOT: ref.project.projectDir,
6149
6342
  SOURCE_ROOT: ref.project.projectDir,
6150
6343
  PROJECT_DIR: ref.project.projectDir,
@@ -6175,7 +6368,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
6175
6368
  }
6176
6369
  return value;
6177
6370
  };
6178
- const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path7.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
6371
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path8.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
6179
6372
  const sourceInfo = infoPlistFile ? import_plist2.default.parse(import_node_fs7.default.readFileSync(infoPlistFile, "utf8")) : {};
6180
6373
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
6181
6374
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
@@ -6194,34 +6387,17 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
6194
6387
  };
6195
6388
  }
6196
6389
  const localPackageDirs = [
6197
- ...listed.filter((reference) => import_node_fs7.default.existsSync(import_node_path7.default.join(reference, "Package.swift"))),
6390
+ ...listed.filter((reference) => import_node_fs7.default.existsSync(import_node_path8.default.join(reference, "Package.swift"))),
6198
6391
  ...projects.flatMap(
6199
6392
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
6200
6393
  if (!isDict(entry)) return [];
6201
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path7.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
6202
- return candidate && import_node_fs7.default.existsSync(import_node_path7.default.join(candidate, "Package.swift")) ? [candidate] : [];
6394
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path8.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
6395
+ return candidate && import_node_fs7.default.existsSync(import_node_path8.default.join(candidate, "Package.swift")) ? [candidate] : [];
6203
6396
  })
6204
6397
  )
6205
6398
  ];
6206
- const graphs = /* @__PURE__ */ new Map();
6207
- const graphOf = (dir) => {
6208
- const cached2 = graphs.get(dir);
6209
- if (cached2) return cached2;
6210
- const graph = swiftManifestGraph(
6211
- import_node_fs7.default.readFileSync(import_node_path7.default.join(dir, "Package.swift"), "utf8")
6212
- );
6213
- graphs.set(dir, graph);
6214
- return graph;
6215
- };
6216
- const localProducts = /* @__PURE__ */ new Map();
6217
- for (const dir of localPackageDirs) {
6218
- for (const product of graphOf(dir).products.keys()) {
6219
- if (!localProducts.has(product)) localProducts.set(product, dir);
6220
- }
6221
- }
6222
- const localPackages = /* @__PURE__ */ new Set();
6223
- const remoteProducts = [];
6224
- const unresolvedProducts = [];
6399
+ const linkedProducts = [];
6400
+ const binaryFrameworks = /* @__PURE__ */ new Set();
6225
6401
  for (const { project, target } of order) {
6226
6402
  const productDependencies = [
6227
6403
  ...list(target.packageProductDependencies),
@@ -6233,45 +6409,37 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
6233
6409
  for (const dependencyId of productDependencies) {
6234
6410
  const dependency = project.object(dependencyId);
6235
6411
  const product = str(dependency?.productName)?.replace(/^plugin:/, "");
6236
- if (!dependency || !product) continue;
6237
- const reference = project.object(str(dependency.package));
6238
- if (reference?.isa === "XCRemoteSwiftPackageReference") {
6239
- if (!remoteProducts.some((entry) => entry.product === product))
6240
- remoteProducts.push({
6241
- product,
6242
- repositoryURL: str(reference.repositoryURL) ?? ""
6243
- });
6244
- } else if (reference?.isa === "XCLocalSwiftPackageReference") {
6245
- localPackages.add(
6246
- import_node_path7.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
6247
- );
6248
- } else if (localProducts.has(product)) {
6249
- localPackages.add(localProducts.get(product));
6250
- } else if (!unresolvedProducts.includes(product)) unresolvedProducts.push(product);
6251
- }
6252
- }
6253
- const pending = [...localPackages];
6254
- while (pending.length > 0) {
6255
- const dir = pending.pop();
6256
- const graph = graphOf(dir);
6257
- for (const relative2 of graph.packagePaths) {
6258
- const next = import_node_path7.default.resolve(dir, relative2);
6259
- if (localPackages.has(next) || !import_node_fs7.default.existsSync(import_node_path7.default.join(next, "Package.swift")))
6412
+ if (!dependency || !product || linkedProducts.some((entry) => entry.product === product))
6260
6413
  continue;
6261
- localPackages.add(next);
6262
- pending.push(next);
6263
- }
6264
- for (const dependencies of graph.dependencies.values()) {
6265
- for (const dependency of dependencies) {
6266
- if (dependency.kind !== "product") continue;
6267
- const url = graph.packageURLs.get(dependency.package);
6268
- if (url && !remoteProducts.some((entry) => entry.product === dependency.name))
6269
- remoteProducts.push({ product: dependency.name, repositoryURL: url });
6414
+ const reference = project.object(str(dependency.package));
6415
+ linkedProducts.push({
6416
+ product,
6417
+ source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
6418
+ kind: "local",
6419
+ dir: import_node_path8.default.resolve(
6420
+ project.projectDir,
6421
+ str(reference.relativePath) ?? ""
6422
+ )
6423
+ } : { kind: "unnamed" }
6424
+ });
6425
+ }
6426
+ for (const phaseId of list(target.buildPhases)) {
6427
+ const phase = project.object(phaseId);
6428
+ if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
6429
+ for (const buildFileId of list(phase.files)) {
6430
+ const fileId = str(project.object(buildFileId)?.fileRef);
6431
+ const file = project.object(fileId);
6432
+ const tree = str(file?.sourceTree);
6433
+ const name2 = /([^/]+)\.(xc)?framework$/.exec(str(file?.path) ?? "")?.[1];
6434
+ if (file?.isa !== "PBXFileReference" || !name2) continue;
6435
+ if (tree === "BUILT_PRODUCTS_DIR" || tree === "SDKROOT" || tree === "DEVELOPER_DIR")
6436
+ continue;
6437
+ binaryFrameworks.add(name2);
6270
6438
  }
6271
6439
  }
6272
6440
  }
6273
- const resolvedFile = import_node_path7.default.join(
6274
- workspace ?? import_node_path7.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
6441
+ const resolvedFile = import_node_path8.default.join(
6442
+ workspace ?? import_node_path8.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
6275
6443
  "xcshareddata",
6276
6444
  "swiftpm",
6277
6445
  "Package.resolved"
@@ -6281,19 +6449,24 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
6281
6449
  ...module2,
6282
6450
  rootDir: commonAncestor(
6283
6451
  [
6284
- workspace ? import_node_path7.default.dirname(workspace) : app.project.projectDir,
6452
+ workspace ? import_node_path8.default.dirname(workspace) : app.project.projectDir,
6285
6453
  ...used.map((project) => project.projectDir),
6286
- ...localPackages
6454
+ ...localPackageDirs,
6455
+ ...linkedProducts.flatMap(
6456
+ ({ source }) => source.kind === "local" && import_node_fs7.default.existsSync(source.dir) ? [source.dir] : []
6457
+ )
6287
6458
  ].map((dir) => import_node_fs7.default.realpathSync(dir))
6288
6459
  ),
6289
- pbxprojs: [...new Set(used.map((project) => project.pbxproj))].sort(),
6460
+ projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
6290
6461
  infoPlist: import_plist2.default.build(info),
6291
6462
  infoPlistFile,
6292
6463
  frameworks,
6293
- localPackages: [...localPackages].map((dir) => import_node_fs7.default.realpathSync(dir)).sort(),
6294
- remoteProducts,
6464
+ linkedProducts,
6465
+ localPackageDirs: [
6466
+ ...new Set(localPackageDirs.map((dir) => import_node_fs7.default.realpathSync(dir)))
6467
+ ].sort(),
6468
+ binaryFrameworks: [...binaryFrameworks].sort(),
6295
6469
  packageResolved: import_node_fs7.default.existsSync(resolvedFile) ? resolvedFile : null,
6296
- unresolvedProducts,
6297
6470
  appTargets: appTargetNames
6298
6471
  };
6299
6472
  }
@@ -6302,7 +6475,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
6302
6475
  function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
6303
6476
  const result = {};
6304
6477
  let config = {};
6305
- const appJsonPath = import_node_path8.default.join(projectRoot, "app.json");
6478
+ const appJsonPath = import_node_path9.default.join(projectRoot, "app.json");
6306
6479
  const appJson = import_node_fs8.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs8.default.readFileSync(appJsonPath, "utf8")) : null;
6307
6480
  const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
6308
6481
  (value) => isRecord(value) && typeof value.googleServicesFile === "string"
@@ -6312,9 +6485,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
6312
6485
  "app.config.ts",
6313
6486
  "app.config.cjs",
6314
6487
  "app.config.mjs"
6315
- ].some((name2) => import_node_fs8.default.existsSync(import_node_path8.default.join(projectRoot, name2)));
6488
+ ].some((name2) => import_node_fs8.default.existsSync(import_node_path9.default.join(projectRoot, name2)));
6316
6489
  if (staticExpo || dynamicExpo) {
6317
- const require3 = (0, import_node_module2.createRequire)(import_node_path8.default.join(projectRoot, "package.json"));
6490
+ const require3 = (0, import_node_module2.createRequire)(import_node_path9.default.join(projectRoot, "package.json"));
6318
6491
  const configModule = require3("@expo/config");
6319
6492
  if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
6320
6493
  throw new Error("Expo native configuration is unavailable.");
@@ -6326,20 +6499,20 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
6326
6499
  }
6327
6500
  const ios = config.ios;
6328
6501
  if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
6329
- const iosRoot = import_node_path8.default.join(projectRoot, "ios");
6502
+ const iosRoot = import_node_path9.default.join(projectRoot, "ios");
6330
6503
  if (import_node_fs8.default.existsSync(iosRoot)) {
6331
6504
  const projects = import_node_fs8.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
6332
6505
  if (projects.length > 1)
6333
6506
  throw new Error("native Firebase configuration requires a selected Xcode project");
6334
6507
  if (projects.length === 1) {
6335
- const xcodeproj = import_node_path8.default.join(iosRoot, projects[0].name);
6508
+ const xcodeproj = import_node_path9.default.join(iosRoot, projects[0].name);
6336
6509
  const appTargets = listXcodeAppTargets(xcodeproj);
6337
6510
  if (appTargets.length > 1)
6338
6511
  throw new Error("native Firebase configuration requires a selected app target");
6339
6512
  if (appTargets.length === 1) {
6340
6513
  const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
6341
6514
  const delegates = app.allSources.filter(
6342
- (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path8.default.basename(file))
6515
+ (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path9.default.basename(file))
6343
6516
  );
6344
6517
  const defaultConfigured = delegates.some((file) => {
6345
6518
  const source = import_node_fs8.default.readFileSync(file, "utf8").replace(
@@ -6370,14 +6543,14 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
6370
6543
  });
6371
6544
  if (defaultConfigured) {
6372
6545
  const resources = app.resources.filter(
6373
- (file) => /^GoogleService-Info\.plist$/.test(import_node_path8.default.basename(file))
6546
+ (file) => /^GoogleService-Info\.plist$/.test(import_node_path9.default.basename(file))
6374
6547
  );
6375
6548
  if (resources.length !== 1)
6376
6549
  throw new Error(
6377
6550
  "native Firebase default initialization requires one GoogleService-Info.plist build resource"
6378
6551
  );
6379
6552
  config.ios = {
6380
- googleServicesFile: import_node_path8.default.relative(
6553
+ googleServicesFile: import_node_path9.default.relative(
6381
6554
  import_node_fs8.default.realpathSync(projectRoot),
6382
6555
  resources[0]
6383
6556
  )
@@ -6392,7 +6565,7 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
6392
6565
  if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
6393
6566
  try {
6394
6567
  const source = import_node_fs8.default.readFileSync(
6395
- import_node_path8.default.resolve(projectRoot, native.googleServicesFile),
6568
+ import_node_path9.default.resolve(projectRoot, native.googleServicesFile),
6396
6569
  "utf8"
6397
6570
  );
6398
6571
  const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
@@ -6795,13 +6968,13 @@ function resolveMetroPort(server) {
6795
6968
  var metro_plugin_default = withRNX;
6796
6969
 
6797
6970
  // src/jump-to-source-babel.ts
6798
- function normalizeSourcePath(path13) {
6799
- const queryStart = path13.indexOf("?");
6800
- const clean = queryStart >= 0 ? path13.slice(0, queryStart) : path13;
6971
+ function normalizeSourcePath(path14) {
6972
+ const queryStart = path14.indexOf("?");
6973
+ const clean = queryStart >= 0 ? path14.slice(0, queryStart) : path14;
6801
6974
  return clean.replace(/\\/g, "/");
6802
6975
  }
6803
- function matchesPath(path13, matcher) {
6804
- return typeof matcher === "string" ? path13.includes(matcher) : matcher.test(path13);
6976
+ function matchesPath(path14, matcher) {
6977
+ return typeof matcher === "string" ? path14.includes(matcher) : matcher.test(path14);
6805
6978
  }
6806
6979
  function shouldStampFile(filename, options) {
6807
6980
  const normalized = normalizeSourcePath(filename);
@@ -6834,11 +7007,11 @@ function sootsimJumpToSourceBabelPlugin(api, options = {}) {
6834
7007
  return {
6835
7008
  name: "sootsim-jump-to-source",
6836
7009
  visitor: {
6837
- JSXOpeningElement(path13, state) {
7010
+ JSXOpeningElement(path14, state) {
6838
7011
  if (options.enabled === false) return;
6839
7012
  const filename = state.file?.opts?.filename;
6840
7013
  if (!filename || !shouldStampFile(filename, options)) return;
6841
- const node = path13.node;
7014
+ const node = path14.node;
6842
7015
  const tagName = getJSXName(node.name);
6843
7016
  if (!tagName || tagName === "Fragment" || tagName.endsWith(".Fragment")) return;
6844
7017
  if (hasAttribute(node, attrName)) return;