peachsim 0.1.750 → 0.1.752

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/cli/commands/inspect/settling.ts +7 -2
  2. package/dist-lib/agent-daemon-client.cjs +1 -1
  3. package/dist-lib/agent-events.cjs +1 -1
  4. package/dist-lib/agent-identity.cjs +1 -1
  5. package/dist-lib/agent-sessions.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +1 -1
  18. package/dist-lib/cli-constants.cjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +1 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/detox/index.cjs +1 -1
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/home-paths.cjs +1 -1
  29. package/dist-lib/host/bridge-host.cjs +571 -300
  30. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  31. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  32. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  33. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  34. package/dist-lib/host/websocket-proxy.cjs +1 -1
  35. package/dist-lib/index.cjs +5 -3
  36. package/dist-lib/jump-to-source-babel.cjs +1 -1
  37. package/dist-lib/jump-to-source-native.cjs +1 -1
  38. package/dist-lib/kotlin-host.cjs +1 -1
  39. package/dist-lib/menu.cjs +1 -1
  40. package/dist-lib/menu.mjs +1 -1
  41. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  42. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  43. package/dist-lib/metro-production-bundle.cjs +1 -1
  44. package/dist-lib/metro-production-bundle.mjs +1 -1
  45. package/dist-lib/metro.cjs +1 -1
  46. package/dist-lib/native-app-identity.cjs +1 -1
  47. package/dist-lib/native-app-identity.mjs +1 -1
  48. package/dist-lib/native-firebase-metadata.cjs +1 -1
  49. package/dist-lib/native-firebase-metadata.mjs +1 -1
  50. package/dist-lib/plist.cjs +1 -1
  51. package/dist-lib/plist.mjs +1 -1
  52. package/dist-lib/profiles.cjs +1 -1
  53. package/dist-lib/public-brand.cjs +1 -1
  54. package/dist-lib/react-native-host-modules.cjs +1 -1
  55. package/dist-lib/react-native-host-modules.mjs +1 -1
  56. package/dist-lib/render-mode.cjs +1 -1
  57. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  58. package/dist-lib/sdk.cjs +5 -3
  59. package/dist-lib/sdk.mjs +5 -3
  60. package/dist-lib/skills.cjs +752 -479
  61. package/dist-lib/swift-compile.cjs +1 -1
  62. package/dist-lib/swift-compile.mjs +1 -1
  63. package/dist-lib/swift-package.cjs +1 -1
  64. package/dist-lib/swift-package.mjs +1 -1
  65. package/dist-lib/swift-submit.cjs +1 -1
  66. package/dist-lib/swift-submit.mjs +1 -1
  67. package/dist-lib/swift-toolchain.cjs +1 -1
  68. package/dist-lib/swift.cjs +1 -1
  69. package/dist-lib/vite-swift.cjs +465 -194
  70. package/dist-lib/vite.cjs +1 -1
  71. package/package.json +1 -1
  72. package/src/swift-host.ts +51 -18
  73. package/src/vite-plugin.ts +3 -1
  74. package/src/xcode-project.ts +590 -245
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.750 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.752 | (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;
@@ -18490,7 +18490,7 @@ function hasValues(bounds) {
18490
18490
  }
18491
18491
  function parseRange(input) {
18492
18492
  const groups = input.split("||");
18493
- const parsed2 = [];
18493
+ const parsed = [];
18494
18494
  for (const group of groups) {
18495
18495
  const tokens = group.trim().match(COMPARATOR) ?? [];
18496
18496
  if (tokens.length === 0) return null;
@@ -18504,9 +18504,9 @@ function parseRange(input) {
18504
18504
  };
18505
18505
  }
18506
18506
  if (!hasValues(bounds)) return null;
18507
- parsed2.push(bounds);
18507
+ parsed.push(bounds);
18508
18508
  }
18509
- return parsed2;
18509
+ return parsed;
18510
18510
  }
18511
18511
  function containsBounds(container, contained) {
18512
18512
  if (container.lower) {
@@ -18999,12 +18999,12 @@ function parsePort(value) {
18999
18999
  if (typeof value !== "string") return null;
19000
19000
  const trimmed = value.trim();
19001
19001
  if (!trimmed) return null;
19002
- const parsed2 = Number(trimmed);
19003
- return Number.isInteger(parsed2) && parsed2 > 0 ? parsed2 : null;
19002
+ const parsed = Number(trimmed);
19003
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
19004
19004
  }
19005
19005
  function parsePortOffset(value) {
19006
- const parsed2 = parsePort(value);
19007
- return parsed2 === null ? 0 : parsed2;
19006
+ const parsed = parsePort(value);
19007
+ return parsed === null ? 0 : parsed;
19008
19008
  }
19009
19009
  function resolveSootsimBridgePort(input = {}) {
19010
19010
  const explicitPort = parsePort(input.explicitPort);
@@ -19309,9 +19309,9 @@ function resolveContrastBackendOrigin(currentOrigin) {
19309
19309
  const origin = currentOrigin?.trim();
19310
19310
  if (!origin) return DEFAULT_CONTRAST_BACKEND_ORIGIN;
19311
19311
  try {
19312
- const parsed2 = new URL(origin);
19313
- if (isLoopbackHost(parsed2.hostname) || isContrastBackendHost(parsed2.hostname)) {
19314
- return parsed2.origin;
19312
+ const parsed = new URL(origin);
19313
+ if (isLoopbackHost(parsed.hostname) || isContrastBackendHost(parsed.hostname)) {
19314
+ return parsed.origin;
19315
19315
  }
19316
19316
  } catch {
19317
19317
  }
@@ -19359,13 +19359,13 @@ function mergePeachConfig(base, override) {
19359
19359
  };
19360
19360
  }
19361
19361
  function applyPeachConfigToUrl(url, config) {
19362
- const parsed2 = new URL(url);
19362
+ const parsed = new URL(url);
19363
19363
  if (hasPeachConfig(config)) {
19364
- parsed2.searchParams.set(PEACH_CONFIG_QUERY_PARAM, JSON.stringify(config));
19364
+ parsed.searchParams.set(PEACH_CONFIG_QUERY_PARAM, JSON.stringify(config));
19365
19365
  } else {
19366
- parsed2.searchParams.delete(PEACH_CONFIG_QUERY_PARAM);
19366
+ parsed.searchParams.delete(PEACH_CONFIG_QUERY_PARAM);
19367
19367
  }
19368
- return parsed2.toString();
19368
+ return parsed.toString();
19369
19369
  }
19370
19370
  var PEACH_CONFIG_QUERY_PARAM;
19371
19371
  var init_config = __esm({
@@ -19395,25 +19395,25 @@ function alignLoopbackBundleUrlWithProbe(bundleUrl, probeBaseUrl) {
19395
19395
  return bundleUrl;
19396
19396
  }
19397
19397
  }
19398
- function applyPreviewProdBundle(parsed2) {
19398
+ function applyPreviewProdBundle(parsed) {
19399
19399
  if (!process.env.SOOTSIM_PREVIEW_PROD_BUNDLE) return;
19400
- parsed2.searchParams.set("dev", "false");
19401
- parsed2.searchParams.set("minify", "true");
19402
- if (parsed2.searchParams.has("hot")) parsed2.searchParams.set("hot", "false");
19400
+ parsed.searchParams.set("dev", "false");
19401
+ parsed.searchParams.set("minify", "true");
19402
+ if (parsed.searchParams.has("hot")) parsed.searchParams.set("hot", "false");
19403
19403
  }
19404
19404
  function normalizeNativeDevBundleUrl(bundleUrl) {
19405
19405
  try {
19406
19406
  const isAbsolute3 = isAbsoluteHttpUrl(bundleUrl);
19407
- const parsed2 = new URL(bundleUrl, "http://sootsim.local");
19408
- parsed2.pathname = parsed2.pathname.replace(/\.\.bundle$/, ".bundle");
19409
- if (!isNativeDevBundlePath(parsed2.pathname)) return bundleUrl;
19410
- parsed2.searchParams.delete("transform.bytecode");
19411
- if (parsed2.searchParams.get("lazy") === "true") {
19412
- parsed2.searchParams.set("lazy", "false");
19413
- }
19414
- applyPreviewProdBundle(parsed2);
19415
- if (isAbsolute3) return parsed2.toString();
19416
- return `${parsed2.pathname}${parsed2.search}${parsed2.hash}`;
19407
+ const parsed = new URL(bundleUrl, "http://sootsim.local");
19408
+ parsed.pathname = parsed.pathname.replace(/\.\.bundle$/, ".bundle");
19409
+ if (!isNativeDevBundlePath(parsed.pathname)) return bundleUrl;
19410
+ parsed.searchParams.delete("transform.bytecode");
19411
+ if (parsed.searchParams.get("lazy") === "true") {
19412
+ parsed.searchParams.set("lazy", "false");
19413
+ }
19414
+ applyPreviewProdBundle(parsed);
19415
+ if (isAbsolute3) return parsed.toString();
19416
+ return `${parsed.pathname}${parsed.search}${parsed.hash}`;
19417
19417
  } catch {
19418
19418
  return bundleUrl;
19419
19419
  }
@@ -19421,11 +19421,11 @@ function normalizeNativeDevBundleUrl(bundleUrl) {
19421
19421
  function applyHotMode(bundleUrl, hot) {
19422
19422
  try {
19423
19423
  const isAbsolute3 = isAbsoluteHttpUrl(bundleUrl);
19424
- const parsed2 = new URL(bundleUrl, "http://sootsim.local");
19425
- if (!isNativeDevBundlePath(parsed2.pathname)) return bundleUrl;
19426
- parsed2.searchParams.set("hot", hot ? "true" : "false");
19427
- if (isAbsolute3) return parsed2.toString();
19428
- return `${parsed2.pathname}${parsed2.search}${parsed2.hash}`;
19424
+ const parsed = new URL(bundleUrl, "http://sootsim.local");
19425
+ if (!isNativeDevBundlePath(parsed.pathname)) return bundleUrl;
19426
+ parsed.searchParams.set("hot", hot ? "true" : "false");
19427
+ if (isAbsolute3) return parsed.toString();
19428
+ return `${parsed.pathname}${parsed.search}${parsed.hash}`;
19429
19429
  } catch {
19430
19430
  return bundleUrl;
19431
19431
  }
@@ -19819,8 +19819,8 @@ async function parsePlistRecord(path33) {
19819
19819
  const metadata = await (0, import_promises.stat)(path33);
19820
19820
  if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
19821
19821
  const source = await (0, import_promises.readFile)(path33, "utf8");
19822
- const parsed2 = parsePlistSource(source);
19823
- return isRecord(parsed2) ? parsed2 : null;
19822
+ const parsed = parsePlistSource(source);
19823
+ return isRecord(parsed) ? parsed : null;
19824
19824
  } catch {
19825
19825
  return null;
19826
19826
  }
@@ -20368,8 +20368,8 @@ function isDirectOneBundleUrl(bundleUrl) {
20368
20368
  }
20369
20369
  function safeParseManifest(body) {
20370
20370
  try {
20371
- const parsed2 = JSON.parse(body);
20372
- return parsed2 && typeof parsed2 === "object" ? parsed2 : null;
20371
+ const parsed = JSON.parse(body);
20372
+ return parsed && typeof parsed === "object" ? parsed : null;
20373
20373
  } catch {
20374
20374
  return null;
20375
20375
  }
@@ -20417,8 +20417,8 @@ function applyManifest(result, manifestRes, buildIconProxyUrl) {
20417
20417
  if (rawIcon.startsWith("http://") || rawIcon.startsWith("https://")) {
20418
20418
  let isLoopback = false;
20419
20419
  try {
20420
- const parsed2 = new URL(rawIcon);
20421
- isLoopback = isLoopbackHost(parsed2.hostname);
20420
+ const parsed = new URL(rawIcon);
20421
+ isLoopback = isLoopbackHost(parsed.hostname);
20422
20422
  } catch {
20423
20423
  }
20424
20424
  if (buildIconProxyUrl) {
@@ -20488,7 +20488,7 @@ async function fetchManifestEnrichment(result, buildIconProxyUrl) {
20488
20488
  }
20489
20489
  );
20490
20490
  if (!manifestRes || manifestRes.statusCode !== 200) return;
20491
- const parsed2 = applyManifest(
20491
+ const parsed = applyManifest(
20492
20492
  {
20493
20493
  port: result.port,
20494
20494
  framework: "one",
@@ -20498,12 +20498,12 @@ async function fetchManifestEnrichment(result, buildIconProxyUrl) {
20498
20498
  manifestRes,
20499
20499
  buildIconProxyUrl
20500
20500
  );
20501
- if (!parsed2.projectName && !parsed2.iconUrl) return;
20501
+ if (!parsed.projectName && !parsed.iconUrl) return;
20502
20502
  enrichmentCache.set(result.port, {
20503
- projectName: parsed2.projectName,
20504
- iconUrl: parsed2.iconUrl,
20505
- iconPath: parsed2.iconPath,
20506
- bundleId: parsed2.bundleId
20503
+ projectName: parsed.projectName,
20504
+ iconUrl: parsed.iconUrl,
20505
+ iconPath: parsed.iconPath,
20506
+ bundleId: parsed.bundleId
20507
20507
  });
20508
20508
  invalidatePortCache(result.port);
20509
20509
  }
@@ -20973,8 +20973,8 @@ function cliUpdateFilePath() {
20973
20973
  function readSharedConfig() {
20974
20974
  try {
20975
20975
  const raw2 = import_node_fs3.default.readFileSync(configFilePath(), "utf8");
20976
- const parsed2 = JSON.parse(raw2);
20977
- return parsed2 && typeof parsed2 === "object" ? parsed2 : {};
20976
+ const parsed = JSON.parse(raw2);
20977
+ return parsed && typeof parsed === "object" ? parsed : {};
20978
20978
  } catch {
20979
20979
  return {};
20980
20980
  }
@@ -21062,12 +21062,12 @@ function consumeRuntimeUpgradeNotice() {
21062
21062
  try {
21063
21063
  const raw2 = import_node_fs3.default.readFileSync(runtimeUpgradeNoticePath(), "utf8");
21064
21064
  import_node_fs3.default.unlinkSync(runtimeUpgradeNoticePath());
21065
- const parsed2 = JSON.parse(raw2);
21066
- if (typeof parsed2?.to !== "string" || !parsed2.to) return null;
21065
+ const parsed = JSON.parse(raw2);
21066
+ if (typeof parsed?.to !== "string" || !parsed.to) return null;
21067
21067
  return {
21068
- from: typeof parsed2.from === "string" ? parsed2.from : null,
21069
- to: parsed2.to,
21070
- at: typeof parsed2.at === "number" ? parsed2.at : 0
21068
+ from: typeof parsed.from === "string" ? parsed.from : null,
21069
+ to: parsed.to,
21070
+ at: typeof parsed.at === "number" ? parsed.at : 0
21071
21071
  };
21072
21072
  } catch {
21073
21073
  return null;
@@ -21110,9 +21110,9 @@ function readDaemonLockfile() {
21110
21110
  const buf = Buffer.alloc(DAEMON_LOCKFILE_MAX_BYTES);
21111
21111
  const bytesRead = import_node_fs3.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
21112
21112
  const raw2 = buf.subarray(0, bytesRead).toString("utf8");
21113
- const parsed2 = JSON.parse(raw2);
21114
- if (parsed2 && parsed2.schema === 1 && typeof parsed2.pid === "number" && typeof parsed2.bridgePort === "number" && typeof parsed2.runtimePort === "number" && typeof parsed2.startedAt === "number" && typeof parsed2.heartbeatAt === "number" && (parsed2.servedRuntimes === void 0 || Array.isArray(parsed2.servedRuntimes) && parsed2.servedRuntimes.every((version) => typeof version === "string"))) {
21115
- return parsed2;
21113
+ const parsed = JSON.parse(raw2);
21114
+ if (parsed && parsed.schema === 1 && typeof parsed.pid === "number" && typeof parsed.bridgePort === "number" && typeof parsed.runtimePort === "number" && typeof parsed.startedAt === "number" && typeof parsed.heartbeatAt === "number" && (parsed.servedRuntimes === void 0 || Array.isArray(parsed.servedRuntimes) && parsed.servedRuntimes.every((version) => typeof version === "string"))) {
21115
+ return parsed;
21116
21116
  }
21117
21117
  return null;
21118
21118
  } finally {
@@ -21124,9 +21124,9 @@ function readDaemonLockfile() {
21124
21124
  }
21125
21125
  function parseDevBridgeLockfile(raw2) {
21126
21126
  try {
21127
- const parsed2 = JSON.parse(raw2);
21128
- if (parsed2 && parsed2.schema === 1 && parsed2.source === "vite-dev" && typeof parsed2.pid === "number" && typeof parsed2.bridgePort === "number" && typeof parsed2.runtimePort === "number" && typeof parsed2.cwd === "string" && typeof parsed2.startedAt === "number" && typeof parsed2.heartbeatAt === "number" && (parsed2.shellPort === void 0 || typeof parsed2.shellPort === "number") && (parsed2.servedRuntimes === void 0 || Array.isArray(parsed2.servedRuntimes) && parsed2.servedRuntimes.every((version) => typeof version === "string"))) {
21129
- return parsed2;
21127
+ const parsed = JSON.parse(raw2);
21128
+ if (parsed && parsed.schema === 1 && parsed.source === "vite-dev" && typeof parsed.pid === "number" && typeof parsed.bridgePort === "number" && typeof parsed.runtimePort === "number" && typeof parsed.cwd === "string" && typeof parsed.startedAt === "number" && typeof parsed.heartbeatAt === "number" && (parsed.shellPort === void 0 || typeof parsed.shellPort === "number") && (parsed.servedRuntimes === void 0 || Array.isArray(parsed.servedRuntimes) && parsed.servedRuntimes.every((version) => typeof version === "string"))) {
21129
+ return parsed;
21130
21130
  }
21131
21131
  return null;
21132
21132
  } catch {
@@ -23230,10 +23230,10 @@ var init_product = __esm({
23230
23230
  function createRuntimeDelivery(product) {
23231
23231
  function readConfig() {
23232
23232
  try {
23233
- const parsed2 = JSON.parse(
23233
+ const parsed = JSON.parse(
23234
23234
  import_node_fs9.default.readFileSync(product.configFile(), "utf8")
23235
23235
  );
23236
- return parsed2 && typeof parsed2 === "object" ? parsed2 : {};
23236
+ return parsed && typeof parsed === "object" ? parsed : {};
23237
23237
  } catch {
23238
23238
  return {};
23239
23239
  }
@@ -23859,8 +23859,8 @@ function flatScale(path33) {
23859
23859
  function providesNamespace(text) {
23860
23860
  if (text === null) return false;
23861
23861
  try {
23862
- const parsed2 = JSON.parse(text);
23863
- return parsed2?.properties?.["provides-namespace"] === true;
23862
+ const parsed = JSON.parse(text);
23863
+ return parsed?.properties?.["provides-namespace"] === true;
23864
23864
  } catch {
23865
23865
  return false;
23866
23866
  }
@@ -23890,15 +23890,15 @@ function enumerateBundleImages(paths, readText2) {
23890
23890
  for (const contentsPath of catalogs) {
23891
23891
  const name2 = catalogEntryName(contentsPath, ".imageset", readText2);
23892
23892
  if (name2 === null || seen.has(name2)) continue;
23893
- let parsed2;
23893
+ let parsed;
23894
23894
  try {
23895
23895
  const text = readText2(contentsPath);
23896
23896
  if (text === null) continue;
23897
- parsed2 = JSON.parse(text);
23897
+ parsed = JSON.parse(text);
23898
23898
  } catch {
23899
23899
  continue;
23900
23900
  }
23901
- const images = parsed2?.images;
23901
+ const images = parsed?.images;
23902
23902
  if (!Array.isArray(images)) continue;
23903
23903
  const dir = contentsPath.split("/").slice(0, -1).join("/");
23904
23904
  const pick = pickImagesetFile(images);
@@ -23918,8 +23918,8 @@ function enumerateBundleImages(paths, readText2) {
23918
23918
  }
23919
23919
  function colorComponent(value) {
23920
23920
  if (typeof value !== "string") return null;
23921
- const parsed2 = value.startsWith("0x") ? Number.parseInt(value.slice(2), 16) / 255 : value.includes(".") ? Number.parseFloat(value) : Number.parseInt(value, 10) / 255;
23922
- return Number.isFinite(parsed2) ? parsed2 : null;
23921
+ const parsed = value.startsWith("0x") ? Number.parseInt(value.slice(2), 16) / 255 : value.includes(".") ? Number.parseFloat(value) : Number.parseInt(value, 10) / 255;
23922
+ return Number.isFinite(parsed) ? parsed : null;
23923
23923
  }
23924
23924
  function colorsetValue(color) {
23925
23925
  if (typeof color !== "object" || color === null) return null;
@@ -24179,8 +24179,8 @@ function readSharedDesktopAuthSession() {
24179
24179
  const filepath = getSharedDesktopAuthFilePath();
24180
24180
  if (!(0, import_node_fs12.existsSync)(filepath)) return null;
24181
24181
  try {
24182
- const parsed2 = JSON.parse((0, import_node_fs12.readFileSync)(filepath, "utf8"));
24183
- const normalized = normalizeSession(parsed2);
24182
+ const parsed = JSON.parse((0, import_node_fs12.readFileSync)(filepath, "utf8"));
24183
+ const normalized = normalizeSession(parsed);
24184
24184
  if (!normalized) {
24185
24185
  (0, import_node_fs12.rmSync)(filepath, { force: true });
24186
24186
  return null;
@@ -24424,9 +24424,9 @@ function resolveRemotePackages(projectDir, resolved, products, provided) {
24424
24424
  if (!pin) return null;
24425
24425
  const dir = checkout(checkouts, identity, pin);
24426
24426
  const manifest = import_node_fs13.default.readFileSync(import_node_path13.default.join(dir, "Package.swift"), "utf8");
24427
- const loaded = { dir, manifest, graph: swiftManifestGraph(manifest) };
24428
- packages.set(identity, loaded);
24429
- return loaded;
24427
+ const loaded2 = { dir, manifest, graph: swiftManifestGraph(manifest) };
24428
+ packages.set(identity, loaded2);
24429
+ return loaded2;
24430
24430
  };
24431
24431
  const targets = /* @__PURE__ */ new Map();
24432
24432
  const outcomes = /* @__PURE__ */ new Map();
@@ -24784,30 +24784,90 @@ function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
24784
24784
  );
24785
24785
  continue;
24786
24786
  }
24787
- const setting = /^([A-Z_][A-Z0-9_]*)(?:\[[^\]]*\])?\s*=\s*(.*)$/.exec(line);
24788
- if (setting) settings[setting[1]] = setting[2].trim();
24787
+ const setting = /^([A-Za-z_][A-Za-z0-9_]*(?:\[[^\]]*\])*)\s*=\s*(.*)$/.exec(line);
24788
+ if (setting)
24789
+ settings[setting[1].replace(/\s+/g, "")] = setting[2].replace(/;$/, "").trim();
24789
24790
  }
24790
24791
  return settings;
24791
24792
  }
24792
- function c99Identifier(name2) {
24793
- const id = name2.replace(/[^A-Za-z0-9_]/g, "_");
24794
- return /^[0-9]/.test(id) ? `_${id}` : id;
24793
+ function applyConditions(raw2, configuration) {
24794
+ const plain = {};
24795
+ const conditional = {};
24796
+ for (const [key, value] of Object.entries(raw2)) {
24797
+ const bracket = key.indexOf("[");
24798
+ if (bracket === -1) {
24799
+ plain[key] = value;
24800
+ continue;
24801
+ }
24802
+ const matches = [...key.slice(bracket).matchAll(/\[([^=\]]+)=([^\]]*)\]/g)].every(
24803
+ ([, name2, pattern]) => {
24804
+ const actual = name2 === "config" ? configuration : CONDITIONS[name2];
24805
+ return actual !== void 0 && new RegExp(
24806
+ `^${pattern.replace(/[.+^${}()|\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
24807
+ ).test(actual);
24808
+ }
24809
+ );
24810
+ if (matches) conditional[key.slice(0, bracket)] = value;
24811
+ }
24812
+ return { ...plain, ...conditional };
24813
+ }
24814
+ function applyOperator(value, operator) {
24815
+ if (operator.startsWith("default=")) return value === "" ? operator.slice(8) : value;
24816
+ switch (operator) {
24817
+ case "lower":
24818
+ return value.toLowerCase();
24819
+ case "upper":
24820
+ return value.toUpperCase();
24821
+ case "rfc1034identifier":
24822
+ return value.replace(/[^A-Za-z0-9-]/g, "-").replace(/^[0-9]/, "-");
24823
+ case "identifier":
24824
+ case "c99extidentifier":
24825
+ return value.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
24826
+ }
24827
+ throw new Error(`unsupported build setting operator :${operator}`);
24828
+ }
24829
+ function decodeXml(text) {
24830
+ return text.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
24831
+ }
24832
+ function workspaceReferences(workspace) {
24833
+ const data = import_node_path14.default.join(workspace, "contents.xcworkspacedata");
24834
+ if (!import_node_fs14.default.existsSync(data))
24835
+ throw new Error(`${workspace} has no contents.xcworkspacedata`);
24836
+ const container = import_node_path14.default.dirname(workspace);
24837
+ const locate = (location2, base) => {
24838
+ const colon = location2.indexOf(":");
24839
+ const kind = location2.slice(0, colon);
24840
+ const rest = location2.slice(colon + 1);
24841
+ if (kind === "group") return import_node_path14.default.resolve(base, rest);
24842
+ if (kind === "container" || kind === "self") return import_node_path14.default.resolve(container, rest);
24843
+ if (kind === "absolute") return import_node_path14.default.resolve(rest);
24844
+ throw new Error(`${import_node_path14.default.basename(workspace)} has an unsupported location ${location2}`);
24845
+ };
24846
+ const groups = [container];
24847
+ const references = [];
24848
+ for (const [, closing, tag, attributes, selfClosing] of import_node_fs14.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
24849
+ if (closing) {
24850
+ if (tag === "Group") groups.pop();
24851
+ continue;
24852
+ }
24853
+ const base = groups.at(-1);
24854
+ const location2 = /\blocation\s*=\s*"([^"]*)"/.exec(attributes)?.[1];
24855
+ const resolved = location2 ? locate(decodeXml(location2), base) : base;
24856
+ if (tag === "FileRef") references.push(resolved);
24857
+ else if (!selfClosing) groups.push(resolved);
24858
+ }
24859
+ return references;
24795
24860
  }
24796
- function readProject(pbxproj) {
24861
+ function loadProject(xcodeproj) {
24862
+ const pbxproj = import_node_path14.default.join(xcodeproj, "project.pbxproj");
24863
+ if (!import_node_fs14.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
24797
24864
  const mtimeMs = import_node_fs14.default.statSync(pbxproj).mtimeMs;
24798
- const cached4 = parsed.get(pbxproj);
24799
- if (cached4?.mtimeMs === mtimeMs) return cached4.root;
24865
+ const cached4 = loaded.get(pbxproj);
24866
+ if (cached4?.mtimeMs === mtimeMs) return cached4.project;
24800
24867
  const root = parseOpenStepPlist(import_node_fs14.default.readFileSync(pbxproj, "utf8"));
24801
24868
  if (!isDict(root) || !isDict(root.objects)) {
24802
24869
  throw new Error(`${pbxproj} has no objects table`);
24803
24870
  }
24804
- parsed.set(pbxproj, { mtimeMs, root });
24805
- return root;
24806
- }
24807
- function readXcodeAppTarget(xcodeproj, targetName) {
24808
- const pbxproj = import_node_path14.default.join(xcodeproj, "project.pbxproj");
24809
- if (!import_node_fs14.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
24810
- const root = readProject(pbxproj);
24811
24871
  const objects = root.objects;
24812
24872
  const object = (id) => {
24813
24873
  const found = id === void 0 ? void 0 : objects[id];
@@ -24831,141 +24891,131 @@ function readXcodeAppTarget(xcodeproj, targetName) {
24831
24891
  const resolvePath = (id) => {
24832
24892
  if (resolvedPaths.has(id)) return resolvedPaths.get(id);
24833
24893
  const entry = object(id);
24834
- let result = null;
24894
+ let result2 = null;
24835
24895
  if (entry) {
24836
24896
  const own = str(entry.path) ?? "";
24837
24897
  const tree = str(entry.sourceTree) ?? "<group>";
24838
- if (tree === "<absolute>") result = own;
24839
- else if (tree === "SOURCE_ROOT") result = import_node_path14.default.join(projectDir, own);
24898
+ if (tree === "<absolute>") result2 = own;
24899
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path14.default.join(projectDir, own);
24840
24900
  else if (tree === "<group>") {
24841
24901
  const up = parent.get(id);
24842
24902
  const base = up ? resolvePath(up) : projectDir;
24843
- result = base === null ? null : import_node_path14.default.join(base, own);
24903
+ result2 = base === null ? null : import_node_path14.default.join(base, own);
24844
24904
  }
24845
24905
  }
24846
- resolvedPaths.set(id, result);
24847
- return result;
24906
+ resolvedPaths.set(id, result2);
24907
+ return result2;
24848
24908
  };
24849
- const targets = list(project.targets).map((id) => ({ id, target: object(id) })).filter(
24850
- (entry) => entry.target?.isa === "PBXNativeTarget"
24851
- );
24852
- const appTargets = targets.filter((entry) => entry.target.productType === APPLICATION);
24853
- const appTargetNames = appTargets.map((entry) => str(entry.target.name) ?? entry.id);
24854
- const chosen = targetName ? appTargets.find((entry) => entry.target.name === targetName) : appTargets.length === 1 ? appTargets[0] : void 0;
24855
- if (!chosen) {
24856
- throw new Error(
24857
- targetName ? `${import_node_path14.default.basename(xcodeproj)} has no application target ${targetName}; it has ${appTargetNames.join(", ") || "none"}` : `${import_node_path14.default.basename(xcodeproj)} has ${appTargetNames.length} application targets (${appTargetNames.join(", ") || "none"}); pass --target`
24858
- );
24859
- }
24860
- const { id: targetId, target } = chosen;
24861
- const configSettings = (listId) => {
24862
- const configs = list(object(listId)?.buildConfigurations).map(object);
24909
+ const result = { xcodeproj, pbxproj, objects, project, projectDir, object, resolvePath };
24910
+ loaded.set(pbxproj, { mtimeMs, project: result });
24911
+ return result;
24912
+ }
24913
+ function targetSettings(ref, builtins) {
24914
+ const { project, target } = ref;
24915
+ const level = (listId) => {
24916
+ const configs = list(project.object(listId)?.buildConfigurations).map(project.object);
24863
24917
  const config = configs.find((entry) => entry?.name === "Debug") ?? configs.find(Boolean);
24864
- if (!config) return {};
24918
+ if (!config) return [];
24919
+ const name2 = str(config.name) ?? "Debug";
24865
24920
  const base = str(config.baseConfigurationReference);
24866
- const fromFile = base ? readXcconfig(resolvePath(base) ?? "") : {};
24867
24921
  const own = isDict(config.buildSettings) ? config.buildSettings : {};
24868
- return {
24869
- ...fromFile,
24870
- ...Object.fromEntries(
24871
- Object.entries(own).flatMap(
24872
- ([key, value]) => typeof value === "string" ? [[key, value]] : []
24873
- )
24922
+ return [
24923
+ applyConditions(base ? readXcconfig(project.resolvePath(base) ?? "") : {}, name2),
24924
+ applyConditions(
24925
+ Object.fromEntries(
24926
+ Object.entries(own).flatMap(
24927
+ ([key, value]) => typeof value === "string" ? [[key, value]] : Array.isArray(value) ? [[key, list(value).join(" ")]] : []
24928
+ )
24929
+ ),
24930
+ name2
24874
24931
  )
24875
- };
24932
+ ];
24876
24933
  };
24877
- const settings = {
24878
- ...configSettings(str(project.buildConfigurationList)),
24879
- ...configSettings(str(target.buildConfigurationList))
24934
+ const levels = [
24935
+ builtins,
24936
+ ...level(str(project.project.buildConfigurationList)),
24937
+ ...level(str(target.buildConfigurationList))
24938
+ ];
24939
+ const resolving = /* @__PURE__ */ new Set();
24940
+ const valueAt = (key, top) => {
24941
+ let at = top;
24942
+ while (at >= 0 && levels[at][key] === void 0) at--;
24943
+ if (at < 0) return derived(key);
24944
+ const marker = `${key}@${at}`;
24945
+ if (resolving.has(marker))
24946
+ throw new Error(`${str(target.name)} has a cyclic build setting ${key}`);
24947
+ resolving.add(marker);
24948
+ const value = expand(
24949
+ levels[at][key],
24950
+ (name2) => name2 === "inherited" ? valueAt(key, at - 1) : valueAt(name2, levels.length - 1)
24951
+ );
24952
+ resolving.delete(marker);
24953
+ return value;
24880
24954
  };
24881
- const name2 = str(target.name) ?? targetId;
24882
- const productName = (settings.PRODUCT_NAME ?? "$(TARGET_NAME)").replaceAll("$(TARGET_NAME)", name2).replaceAll("${TARGET_NAME}", name2);
24883
- const moduleName = c99Identifier(
24884
- settings.PRODUCT_MODULE_NAME && !settings.PRODUCT_MODULE_NAME.includes("$(") ? settings.PRODUCT_MODULE_NAME : productName
24885
- );
24886
- const variables = {
24887
- ...settings,
24888
- EXECUTABLE_NAME: settings.EXECUTABLE_NAME ?? productName,
24889
- DEVELOPMENT_LANGUAGE: settings.DEVELOPMENT_LANGUAGE ?? str(project.developmentRegion) ?? "en",
24890
- TARGET_NAME: name2,
24891
- PRODUCT_NAME: productName,
24892
- PRODUCT_MODULE_NAME: moduleName,
24893
- SRCROOT: projectDir,
24894
- SOURCE_ROOT: projectDir
24955
+ const derived = (key) => {
24956
+ const get = (name2) => valueAt(name2, levels.length - 1);
24957
+ switch (key) {
24958
+ case "PRODUCT_NAME":
24959
+ return get("TARGET_NAME");
24960
+ case "PRODUCT_MODULE_NAME":
24961
+ return applyOperator(get("PRODUCT_NAME"), "c99extidentifier");
24962
+ case "EXECUTABLE_NAME":
24963
+ return get("PRODUCT_NAME");
24964
+ case "AppIdentifierPrefix":
24965
+ case "TeamIdentifierPrefix": {
24966
+ const team = get("DEVELOPMENT_TEAM");
24967
+ return get("CODE_SIGNING_ALLOWED") !== "NO" && team ? `${team}.` : "";
24968
+ }
24969
+ }
24970
+ return "";
24895
24971
  };
24896
- const expand = (value) => {
24897
- const seen = /* @__PURE__ */ new Set();
24898
- while (/\$[({][A-Za-z_][A-Za-z0-9_]*[)}]/.test(value)) {
24899
- if (seen.has(value)) throw new Error(`${name2} has cyclic Info.plist build settings`);
24900
- seen.add(value);
24901
- value = value.replace(
24902
- /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]/g,
24903
- (match, key) => {
24904
- const replacement = Object.entries(variables).find(
24905
- ([name3]) => name3 === key
24906
- )?.[1];
24907
- if (replacement === void 0)
24908
- throw new Error(`${name2} Info.plist has unresolved setting ${match}`);
24909
- return replacement;
24910
- }
24911
- );
24912
- }
24913
- return value;
24972
+ return {
24973
+ get: (key) => valueAt(key, levels.length - 1),
24974
+ keys: new Set(levels.flatMap((values) => Object.keys(values)))
24914
24975
  };
24915
- const expandValue = (value) => {
24916
- if (typeof value === "string") return expand(value);
24917
- if (Array.isArray(value)) return value.map(expandValue);
24918
- if (typeof value === "object" && !(value instanceof Date) && !Buffer.isBuffer(value)) {
24919
- return Object.fromEntries(
24920
- Object.entries(value).map(([key, value2]) => [key, expandValue(value2)])
24921
- );
24976
+ }
24977
+ function expand(value, lookup) {
24978
+ return value.replace(
24979
+ /\$(?:\(([A-Za-z_][A-Za-z0-9_]*)((?::[^)]*)?)\)|\{([A-Za-z_][A-Za-z0-9_]*)((?::[^}]*)?)\}|([A-Za-z_][A-Za-z0-9_]*))/g,
24980
+ (_match, paren, parenOps, brace, braceOps, bare) => {
24981
+ const name2 = paren ?? brace ?? bare;
24982
+ const operators = parenOps ?? braceOps ?? "";
24983
+ return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name2));
24922
24984
  }
24923
- return value;
24924
- };
24925
- const infoPlistFile = settings.INFOPLIST_FILE ? import_node_path14.default.resolve(projectDir, expand(settings.INFOPLIST_FILE)) : null;
24926
- const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs14.default.readFileSync(infoPlistFile, "utf8")) : {};
24927
- if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
24928
- throw new Error(`${name2} Info.plist must contain a dictionary`);
24929
- }
24930
- const info = {};
24931
- for (const [key, value] of Object.entries(sourceInfo)) info[key] = expandValue(value);
24932
- for (const [key, value] of Object.entries(settings)) {
24933
- if (!key.startsWith("INFOPLIST_KEY_") || key.endsWith("_Generation")) continue;
24934
- info[key.slice("INFOPLIST_KEY_".length)] = value === "YES" ? true : value === "NO" ? false : expand(value);
24935
- }
24936
- if (settings.INFOPLIST_KEY_UIApplicationSceneManifest_Generation === "YES" && info.UIApplicationSceneManifest === void 0) {
24937
- info.UIApplicationSceneManifest = {
24938
- UIApplicationSupportsMultipleScenes: true,
24939
- UISceneConfigurations: {}
24940
- };
24941
- }
24985
+ );
24986
+ }
24987
+ function targetMembers(ref) {
24988
+ const { project, target, id: targetId } = ref;
24942
24989
  const sources = /* @__PURE__ */ new Set();
24990
+ const allSources = /* @__PURE__ */ new Set();
24943
24991
  const resources = /* @__PURE__ */ new Set();
24944
24992
  const addResource = (file) => {
24945
- if (import_node_fs14.default.existsSync(file) && import_node_fs14.default.statSync(file).isDirectory()) {
24993
+ if (isDirectory(file)) {
24946
24994
  for (const inner of walkFiles(file)) resources.add(inner);
24947
24995
  } else if (import_node_fs14.default.existsSync(file)) resources.add(file);
24948
24996
  };
24949
24997
  const fileRefPaths = (refId) => {
24950
- const ref = object(refId);
24951
- if (!ref) return [];
24952
- if (ref.isa === "PBXVariantGroup") {
24953
- return list(ref.children).flatMap((child) => {
24954
- const resolved2 = resolvePath(child);
24998
+ const entry = project.object(refId);
24999
+ if (!entry) return [];
25000
+ if (entry.isa === "PBXVariantGroup") {
25001
+ return list(entry.children).flatMap((child) => {
25002
+ const resolved2 = project.resolvePath(child);
24955
25003
  return resolved2 ? [resolved2] : [];
24956
25004
  });
24957
25005
  }
24958
- const resolved = resolvePath(refId);
25006
+ const resolved = project.resolvePath(refId);
24959
25007
  return resolved ? [resolved] : [];
24960
25008
  };
24961
25009
  for (const phaseId of list(target.buildPhases)) {
24962
- const phase = object(phaseId);
25010
+ const phase = project.object(phaseId);
24963
25011
  if (phase?.isa !== "PBXSourcesBuildPhase" && phase?.isa !== "PBXResourcesBuildPhase")
24964
25012
  continue;
24965
25013
  for (const buildFileId of list(phase.files)) {
24966
- for (const file of fileRefPaths(str(object(buildFileId)?.fileRef) ?? "")) {
24967
- if (phase.isa === "PBXSourcesBuildPhase" && file.endsWith(".swift")) {
24968
- if (import_node_fs14.default.existsSync(file)) sources.add(file);
25014
+ for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
25015
+ if (phase.isa === "PBXSourcesBuildPhase") {
25016
+ if (!import_node_fs14.default.existsSync(file)) continue;
25017
+ allSources.add(file);
25018
+ if (file.endsWith(".swift")) sources.add(file);
24969
25019
  } else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
24970
25020
  }
24971
25021
  }
@@ -24974,20 +25024,22 @@ function readXcodeAppTarget(xcodeproj, targetName) {
24974
25024
  const file = import_node_path14.default.join(folder, relative3);
24975
25025
  if (NEVER_MEMBER.test(relative3)) return;
24976
25026
  if (file.endsWith(".swift")) {
24977
- if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment)))
25027
+ if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
24978
25028
  sources.add(file);
25029
+ allSources.add(file);
25030
+ }
24979
25031
  } else if (/\.(h|m|mm|c|cpp|metal)$/.test(file)) {
24980
- return;
25032
+ if (!file.endsWith(".h")) allSources.add(file);
24981
25033
  } else resources.add(file);
24982
25034
  };
24983
25035
  const owned = new Set(list(target.fileSystemSynchronizedGroups));
24984
- for (const [groupId, group] of Object.entries(objects)) {
25036
+ for (const [groupId, group] of Object.entries(project.objects)) {
24985
25037
  if (!isDict(group) || group.isa !== "PBXFileSystemSynchronizedRootGroup") continue;
24986
- const folder = resolvePath(groupId);
25038
+ const folder = project.resolvePath(groupId);
24987
25039
  if (!folder) continue;
24988
25040
  const exceptions = /* @__PURE__ */ new Set();
24989
25041
  for (const exceptionId of list(group.exceptions)) {
24990
- const exception = object(exceptionId);
25042
+ const exception = project.object(exceptionId);
24991
25043
  if (exception?.target !== targetId) continue;
24992
25044
  for (const relative3 of list(exception.membershipExceptions))
24993
25045
  exceptions.add(relative3);
@@ -25004,7 +25056,7 @@ function readXcodeAppTarget(xcodeproj, targetName) {
25004
25056
  } else {
25005
25057
  for (const relative3 of exceptions) {
25006
25058
  const file = import_node_path14.default.join(folder, relative3);
25007
- if (import_node_fs14.default.existsSync(file) && import_node_fs14.default.statSync(file).isDirectory()) {
25059
+ if (isDirectory(file)) {
25008
25060
  for (const inner of walkFiles(file))
25009
25061
  addSynchronized(
25010
25062
  folder,
@@ -25014,11 +25066,173 @@ function readXcodeAppTarget(xcodeproj, targetName) {
25014
25066
  }
25015
25067
  }
25016
25068
  }
25017
- const localPackageDirs = Object.entries(objects).flatMap(([id, entry]) => {
25018
- if (!isDict(entry)) return [];
25019
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path14.default.resolve(projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" && entry.lastKnownFileType === "wrapper" ? resolvePath(id) : null;
25020
- return candidate && import_node_fs14.default.existsSync(import_node_path14.default.join(candidate, "Package.swift")) ? [candidate] : [];
25021
- });
25069
+ return {
25070
+ sources: [...sources].sort(),
25071
+ resources: [...resources].sort(),
25072
+ allSources: [...allSources].sort()
25073
+ };
25074
+ }
25075
+ function commonAncestor(dirs) {
25076
+ let common = dirs[0];
25077
+ for (const dir of dirs) {
25078
+ while (common !== import_node_path14.default.dirname(common) && import_node_path14.default.relative(common, dir).startsWith(".."))
25079
+ common = import_node_path14.default.dirname(common);
25080
+ }
25081
+ return common;
25082
+ }
25083
+ function workspaceProjects(xcodeprojOrWorkspace) {
25084
+ const listed = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? workspaceReferences(xcodeprojOrWorkspace) : [xcodeprojOrWorkspace];
25085
+ const projects2 = [];
25086
+ const projectAt = /* @__PURE__ */ new Map();
25087
+ const addProject = (xcodeproj) => {
25088
+ const key = import_node_path14.default.resolve(xcodeproj);
25089
+ if (projectAt.has(key) || key.split(import_node_path14.default.sep).includes("Pods")) return;
25090
+ if (!import_node_fs14.default.existsSync(import_node_path14.default.join(key, "project.pbxproj"))) return;
25091
+ const project = loadProject(key);
25092
+ projectAt.set(key, project);
25093
+ projects2.push(project);
25094
+ const nested = project.project.projectReferences;
25095
+ if (Array.isArray(nested)) {
25096
+ for (const entry of nested) {
25097
+ const ref = isDict(entry) ? str(entry.ProjectRef) : void 0;
25098
+ const resolved = ref ? project.resolvePath(ref) : null;
25099
+ if (resolved) addProject(resolved);
25100
+ }
25101
+ }
25102
+ };
25103
+ for (const reference of listed)
25104
+ if (reference.endsWith(".xcodeproj")) addProject(reference);
25105
+ if (projects2.length === 0) {
25106
+ throw new Error(`${import_node_path14.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
25107
+ }
25108
+ return { listed, projects: projects2, projectAt };
25109
+ }
25110
+ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
25111
+ const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
25112
+ const { listed, projects: projects2, projectAt } = workspaceProjects(xcodeprojOrWorkspace);
25113
+ const allTargets = projects2.flatMap(nativeTargets);
25114
+ const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
25115
+ const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
25116
+ const container = import_node_path14.default.basename(xcodeprojOrWorkspace);
25117
+ const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
25118
+ if (named.length !== 1) {
25119
+ throw new Error(
25120
+ targetName && named.length === 0 ? `${container} has no application target ${targetName}; it has ${appTargetNames.join(", ") || "none"}` : targetName ? `${container} has ${named.length} application targets named ${targetName}; open its .xcodeproj` : `${container} has ${appTargetNames.length} application targets (${appTargetNames.join(", ") || "none"}); pass --target`
25121
+ );
25122
+ }
25123
+ const app = named[0];
25124
+ const byProduct = /* @__PURE__ */ new Map();
25125
+ for (const ref of allTargets) {
25126
+ const product = ref.project.object(str(ref.target.productReference));
25127
+ const file = str(product?.path);
25128
+ if (file && !byProduct.has(import_node_path14.default.basename(file)))
25129
+ byProduct.set(import_node_path14.default.basename(file), ref);
25130
+ }
25131
+ const proxied = (project, proxyId) => {
25132
+ const proxy = project.object(proxyId);
25133
+ if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
25134
+ const portal = str(proxy.containerPortal);
25135
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path14.default.resolve(project.resolvePath(portal ?? "") ?? ""));
25136
+ const remote = str(proxy.remoteGlobalIDString);
25137
+ if (!owner || !remote) return void 0;
25138
+ return nativeTargets(owner).find(
25139
+ (ref) => ref.id === remote || str(ref.target.productReference) === remote
25140
+ );
25141
+ };
25142
+ const dependenciesOf = (ref) => {
25143
+ const { project, target } = ref;
25144
+ const found = [];
25145
+ for (const dependencyId of list(target.dependencies)) {
25146
+ const dependency = project.object(dependencyId);
25147
+ const direct = str(dependency?.target);
25148
+ const resolved = direct ? nativeTargets(project).find((candidate) => candidate.id === direct) : proxied(project, str(dependency?.targetProxy));
25149
+ if (resolved) found.push(resolved);
25150
+ }
25151
+ for (const phaseId of list(target.buildPhases)) {
25152
+ const phase = project.object(phaseId);
25153
+ if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
25154
+ for (const buildFileId of list(phase.files)) {
25155
+ const file = project.object(str(project.object(buildFileId)?.fileRef));
25156
+ const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path14.default.basename(str(file.path) ?? "")) : void 0;
25157
+ if (resolved) found.push(resolved);
25158
+ }
25159
+ }
25160
+ return found.filter(
25161
+ (candidate) => MODULE_PRODUCTS.has(str(candidate.target.productType) ?? "")
25162
+ );
25163
+ };
25164
+ const order = [];
25165
+ const visited = /* @__PURE__ */ new Set();
25166
+ const visit = (ref) => {
25167
+ if (visited.has(ref)) return;
25168
+ visited.add(ref);
25169
+ for (const dependency of dependenciesOf(ref)) visit(dependency);
25170
+ order.push(ref);
25171
+ };
25172
+ visit(app);
25173
+ const moduleTarget = (ref) => {
25174
+ const name2 = str(ref.target.name) ?? ref.id;
25175
+ const { get: settings2, keys } = targetSettings(ref, {
25176
+ TARGET_NAME: name2,
25177
+ PROJECT_NAME: import_node_path14.default.basename(ref.project.xcodeproj, ".xcodeproj"),
25178
+ SRCROOT: ref.project.projectDir,
25179
+ SOURCE_ROOT: ref.project.projectDir,
25180
+ PROJECT_DIR: ref.project.projectDir,
25181
+ DEVELOPMENT_LANGUAGE: str(ref.project.project.developmentRegion) ?? "en"
25182
+ });
25183
+ const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
25184
+ return {
25185
+ settings: settings2,
25186
+ keys,
25187
+ module: {
25188
+ name: name2,
25189
+ moduleName: applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier"),
25190
+ ...targetMembers(ref),
25191
+ languageMode: swiftVersion >= 6 ? 6 : 5,
25192
+ mainActorIsolation: settings2("SWIFT_DEFAULT_ACTOR_ISOLATION") === "MainActor"
25193
+ }
25194
+ };
25195
+ };
25196
+ const { settings, keys: settingKeys, module: module2 } = moduleTarget(app);
25197
+ const frameworks = order.slice(0, -1).map((ref) => moduleTarget(ref).module);
25198
+ const expandValue = (value) => {
25199
+ if (typeof value === "string") return expand(value, settings);
25200
+ if (Array.isArray(value)) return value.map(expandValue);
25201
+ if (typeof value === "object" && !(value instanceof Date) && !Buffer.isBuffer(value)) {
25202
+ return Object.fromEntries(
25203
+ Object.entries(value).map(([key, value2]) => [key, expandValue(value2)])
25204
+ );
25205
+ }
25206
+ return value;
25207
+ };
25208
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path14.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
25209
+ const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs14.default.readFileSync(infoPlistFile, "utf8")) : {};
25210
+ if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
25211
+ throw new Error(`${module2.name} Info.plist must contain a dictionary`);
25212
+ }
25213
+ const info = {};
25214
+ for (const [key, value] of Object.entries(sourceInfo)) info[key] = expandValue(value);
25215
+ for (const key of settingKeys) {
25216
+ if (!key.startsWith("INFOPLIST_KEY_") || key.endsWith("_Generation")) continue;
25217
+ const value = settings(key);
25218
+ info[key.slice("INFOPLIST_KEY_".length)] = value === "YES" ? true : value === "NO" ? false : value;
25219
+ }
25220
+ if (settings("INFOPLIST_KEY_UIApplicationSceneManifest_Generation") === "YES" && info.UIApplicationSceneManifest === void 0) {
25221
+ info.UIApplicationSceneManifest = {
25222
+ UIApplicationSupportsMultipleScenes: true,
25223
+ UISceneConfigurations: {}
25224
+ };
25225
+ }
25226
+ const localPackageDirs = [
25227
+ ...listed.filter((reference) => import_node_fs14.default.existsSync(import_node_path14.default.join(reference, "Package.swift"))),
25228
+ ...projects2.flatMap(
25229
+ (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
25230
+ if (!isDict(entry)) return [];
25231
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path14.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
25232
+ return candidate && import_node_fs14.default.existsSync(import_node_path14.default.join(candidate, "Package.swift")) ? [candidate] : [];
25233
+ })
25234
+ )
25235
+ ];
25022
25236
  const graphs = /* @__PURE__ */ new Map();
25023
25237
  const graphOf = (dir) => {
25024
25238
  const cached4 = graphs.get(dir);
@@ -25031,26 +25245,40 @@ function readXcodeAppTarget(xcodeproj, targetName) {
25031
25245
  };
25032
25246
  const localProducts = /* @__PURE__ */ new Map();
25033
25247
  for (const dir of localPackageDirs) {
25034
- for (const product of graphOf(dir).products.keys()) localProducts.set(product, dir);
25248
+ for (const product of graphOf(dir).products.keys()) {
25249
+ if (!localProducts.has(product)) localProducts.set(product, dir);
25250
+ }
25035
25251
  }
25036
25252
  const localPackages = /* @__PURE__ */ new Set();
25037
25253
  const remoteProducts = [];
25038
25254
  const unresolvedProducts = [];
25039
- for (const dependencyId of list(target.packageProductDependencies)) {
25040
- const dependency = object(dependencyId);
25041
- const product = str(dependency?.productName);
25042
- if (!dependency || !product) continue;
25043
- const reference = object(str(dependency.package));
25044
- if (reference?.isa === "XCRemoteSwiftPackageReference") {
25045
- remoteProducts.push({
25046
- product,
25047
- repositoryURL: str(reference.repositoryURL) ?? ""
25048
- });
25049
- } else if (reference?.isa === "XCLocalSwiftPackageReference") {
25050
- localPackages.add(import_node_path14.default.resolve(projectDir, str(reference.relativePath) ?? ""));
25051
- } else if (localProducts.has(product)) {
25052
- localPackages.add(localProducts.get(product));
25053
- } else unresolvedProducts.push(product);
25255
+ for (const { project, target } of order) {
25256
+ const productDependencies = [
25257
+ ...list(target.packageProductDependencies),
25258
+ ...list(target.dependencies).flatMap((id) => {
25259
+ const productRef = str(project.object(id)?.productRef);
25260
+ return productRef ? [productRef] : [];
25261
+ })
25262
+ ];
25263
+ for (const dependencyId of productDependencies) {
25264
+ const dependency = project.object(dependencyId);
25265
+ const product = str(dependency?.productName)?.replace(/^plugin:/, "");
25266
+ if (!dependency || !product) continue;
25267
+ const reference = project.object(str(dependency.package));
25268
+ if (reference?.isa === "XCRemoteSwiftPackageReference") {
25269
+ if (!remoteProducts.some((entry) => entry.product === product))
25270
+ remoteProducts.push({
25271
+ product,
25272
+ repositoryURL: str(reference.repositoryURL) ?? ""
25273
+ });
25274
+ } else if (reference?.isa === "XCLocalSwiftPackageReference") {
25275
+ localPackages.add(
25276
+ import_node_path14.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
25277
+ );
25278
+ } else if (localProducts.has(product)) {
25279
+ localPackages.add(localProducts.get(product));
25280
+ } else if (!unresolvedProducts.includes(product)) unresolvedProducts.push(product);
25281
+ }
25054
25282
  }
25055
25283
  const pending = [...localPackages];
25056
25284
  while (pending.length > 0) {
@@ -25072,32 +25300,34 @@ function readXcodeAppTarget(xcodeproj, targetName) {
25072
25300
  }
25073
25301
  }
25074
25302
  }
25075
- const packageResolved = [
25076
- import_node_path14.default.join(xcodeproj, "project.xcworkspace"),
25077
- ...import_node_fs14.default.readdirSync(projectDir).filter((entry) => entry.endsWith(".xcworkspace")).map((entry) => import_node_path14.default.join(projectDir, entry))
25078
- ].map(
25079
- (workspace) => import_node_path14.default.join(workspace, "xcshareddata", "swiftpm", "Package.resolved")
25080
- ).find((file) => import_node_fs14.default.existsSync(file)) ?? null;
25081
- const swiftVersion = Number.parseFloat(settings.SWIFT_VERSION ?? "5");
25303
+ const resolvedFile = import_node_path14.default.join(
25304
+ workspace ?? import_node_path14.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
25305
+ "xcshareddata",
25306
+ "swiftpm",
25307
+ "Package.resolved"
25308
+ );
25309
+ const used = [app, ...order].map((ref) => ref.project);
25082
25310
  return {
25083
- projectDir,
25084
- pbxproj,
25085
- name: name2,
25086
- moduleName,
25087
- sources: [...sources].sort(),
25088
- resources: [...resources].sort(),
25311
+ ...module2,
25312
+ rootDir: commonAncestor(
25313
+ [
25314
+ workspace ? import_node_path14.default.dirname(workspace) : app.project.projectDir,
25315
+ ...used.map((project) => project.projectDir),
25316
+ ...localPackages
25317
+ ].map((dir) => import_node_fs14.default.realpathSync(dir))
25318
+ ),
25319
+ pbxprojs: [...new Set(used.map((project) => project.pbxproj))].sort(),
25089
25320
  infoPlist: import_plist3.default.build(info),
25090
25321
  infoPlistFile,
25091
- languageMode: swiftVersion >= 6 ? 6 : 5,
25092
- mainActorIsolation: settings.SWIFT_DEFAULT_ACTOR_ISOLATION === "MainActor",
25093
- localPackages: [...localPackages].sort(),
25322
+ frameworks,
25323
+ localPackages: [...localPackages].map((dir) => import_node_fs14.default.realpathSync(dir)).sort(),
25094
25324
  remoteProducts,
25095
- packageResolved,
25325
+ packageResolved: import_node_fs14.default.existsSync(resolvedFile) ? resolvedFile : null,
25096
25326
  unresolvedProducts,
25097
25327
  appTargets: appTargetNames
25098
25328
  };
25099
25329
  }
25100
- var import_node_fs14, import_node_path14, import_plist3, isDict, str, list, APPLICATION, NEVER_MEMBER, BUNDLE_DIR, parsed;
25330
+ var import_node_fs14, import_node_path14, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, nativeTargets;
25101
25331
  var init_xcode_project = __esm({
25102
25332
  "src/xcode-project.ts"() {
25103
25333
  "use strict";
@@ -25109,9 +25339,25 @@ var init_xcode_project = __esm({
25109
25339
  str = (value) => typeof value === "string" ? value : void 0;
25110
25340
  list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
25111
25341
  APPLICATION = "com.apple.product-type.application";
25342
+ MODULE_PRODUCTS = /* @__PURE__ */ new Set([
25343
+ "com.apple.product-type.framework",
25344
+ "com.apple.product-type.framework.static",
25345
+ "com.apple.product-type.library.static",
25346
+ "com.apple.product-type.library.dynamic"
25347
+ ]);
25112
25348
  NEVER_MEMBER = /(?:^|\/)(?:Info\.plist|[^/]+\.entitlements|[^/]+\.xcconfig|\.DS_Store)$/;
25113
25349
  BUNDLE_DIR = /\.(xcassets|bundle|lproj|xcdatamodeld|scnassets|spriteatlas|rcproject|storyboardc|icon)$/;
25114
- parsed = /* @__PURE__ */ new Map();
25350
+ CONDITIONS = {
25351
+ sdk: "iphonesimulator",
25352
+ arch: "arm64",
25353
+ variant: "normal"
25354
+ };
25355
+ isDirectory = (dir) => import_node_fs14.default.existsSync(dir) && import_node_fs14.default.statSync(dir).isDirectory();
25356
+ loaded = /* @__PURE__ */ new Map();
25357
+ nativeTargets = (project) => list(project.project.targets).flatMap((id) => {
25358
+ const target = project.object(id);
25359
+ return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
25360
+ });
25115
25361
  }
25116
25362
  });
25117
25363
 
@@ -25167,7 +25413,7 @@ function remotePackages(entry, app) {
25167
25413
  entry.remote = {
25168
25414
  key,
25169
25415
  packages: resolveRemotePackages(
25170
- import_node_fs15.default.realpathSync(app.projectDir),
25416
+ app.rootDir,
25171
25417
  app.packageResolved,
25172
25418
  app.remoteProducts,
25173
25419
  entry.provided
@@ -25176,25 +25422,47 @@ function remotePackages(entry, app) {
25176
25422
  }
25177
25423
  return entry.remote.packages;
25178
25424
  }
25179
- function xcodeInputKey(appSources, file, relative3) {
25180
- if (appSources.has(file)) return import_node_path15.default.posix.join(XCODE_APP_DIR, relative3);
25425
+ function xcodeInputKey(layout, file, relative3) {
25426
+ const owner = layout.targetDirs.get(file);
25427
+ if (owner) return import_node_path15.default.posix.join(owner, relative3);
25181
25428
  return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path15.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
25182
25429
  }
25183
25430
  function xcodeLayout(root) {
25184
25431
  const registered = xcodeProjects.get(root);
25185
25432
  if (!registered) return null;
25186
25433
  const app = readXcodeAppTarget(registered.xcodeproj, registered.target);
25187
- const files = /* @__PURE__ */ new Set([app.pbxproj, ...app.sources, ...app.resources]);
25434
+ const files = /* @__PURE__ */ new Set([...app.pbxprojs, ...app.sources, ...app.resources]);
25188
25435
  if (app.infoPlistFile) files.add(app.infoPlistFile);
25436
+ const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
25189
25437
  const targets = [];
25438
+ for (const framework of app.frameworks) {
25439
+ const dir = import_node_path15.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
25440
+ for (const file of framework.sources) {
25441
+ if (targetDirs.has(file)) continue;
25442
+ targetDirs.set(file, dir);
25443
+ files.add(file);
25444
+ }
25445
+ targets.push({
25446
+ name: framework.moduleName,
25447
+ path: dir,
25448
+ executable: false,
25449
+ resources: false,
25450
+ languageMode: framework.languageMode,
25451
+ mainActorIsolation: framework.mainActorIsolation
25452
+ });
25453
+ }
25190
25454
  for (const dir of app.localPackages) {
25191
- const manifest = import_node_path15.default.join(dir, "Package.swift");
25192
- files.add(manifest);
25455
+ const manifestFile = import_node_path15.default.join(dir, "Package.swift");
25456
+ files.add(manifestFile);
25457
+ const manifest = import_node_fs15.default.readFileSync(manifestFile, "utf8");
25193
25458
  const prefix = import_node_path15.default.relative(root, dir).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
25194
- const all = packageFiles(dir).map(
25195
- (file) => import_node_path15.default.relative(dir, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
25459
+ const declared = swiftManifestTargets(manifest).filter((target) => !target.executable);
25460
+ const all = declared.flatMap(
25461
+ (target) => sourceTreeFiles(import_node_path15.default.join(dir, target.path), root).map(
25462
+ (file) => import_node_path15.default.relative(dir, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
25463
+ )
25196
25464
  );
25197
- for (const target of swiftManifestTargets(import_node_fs15.default.readFileSync(manifest, "utf8"), all)) {
25465
+ for (const target of swiftManifestTargets(manifest, all)) {
25198
25466
  if (target.executable) continue;
25199
25467
  targets.push({ ...target, path: import_node_path15.default.posix.join(prefix, target.path) });
25200
25468
  for (const relative3 of all) {
@@ -25217,6 +25485,7 @@ function xcodeLayout(root) {
25217
25485
  app,
25218
25486
  targets,
25219
25487
  unavailable: remote.unavailable,
25488
+ targetDirs,
25220
25489
  files: [...files].sort()
25221
25490
  };
25222
25491
  }
@@ -25237,13 +25506,15 @@ function xcodeManifest(layout) {
25237
25506
  function packageFiles(root) {
25238
25507
  const canonicalRoot = import_node_fs15.default.realpathSync(root);
25239
25508
  const xcode = xcodeLayout(canonicalRoot);
25240
- if (xcode) return xcode.files;
25509
+ return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
25510
+ }
25511
+ function sourceTreeFiles(dir, canonicalRoot) {
25241
25512
  const found = [];
25242
- const walk2 = (dir) => {
25243
- for (const entry of import_node_fs15.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
25513
+ const walk2 = (dir2) => {
25514
+ for (const entry of import_node_fs15.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
25244
25515
  if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
25245
25516
  continue;
25246
- const full = import_node_path15.default.join(dir, entry.name);
25517
+ const full = import_node_path15.default.join(dir2, entry.name);
25247
25518
  if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
25248
25519
  const real = import_node_fs15.default.realpathSync(full);
25249
25520
  const relative3 = import_node_path15.default.relative(canonicalRoot, real);
@@ -25259,7 +25530,7 @@ function packageFiles(root) {
25259
25530
  }
25260
25531
  }
25261
25532
  };
25262
- walk2(canonicalRoot);
25533
+ if (import_node_fs15.default.existsSync(dir)) walk2(import_node_fs15.default.realpathSync(dir));
25263
25534
  return found;
25264
25535
  }
25265
25536
  function readPackageFile(root, file, maxBytes) {
@@ -25453,12 +25724,11 @@ function icuUrl(origin, artifact) {
25453
25724
  }
25454
25725
  function packageSources(packagePath) {
25455
25726
  const xcode = xcodeLayout(packagePath);
25456
- const appSources = new Set(xcode?.app.sources);
25457
25727
  const files = {};
25458
25728
  for (const file of sourceFiles(packagePath)) {
25459
25729
  const relative3 = import_node_path15.default.relative(packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
25460
25730
  if (xcode && import_node_path15.default.basename(file) === "Package.swift") continue;
25461
- files[xcode ? xcodeInputKey(appSources, file, relative3) : relative3] = readPackageFile(
25731
+ files[xcode ? xcodeInputKey(xcode, file, relative3) : relative3] = readPackageFile(
25462
25732
  packagePath,
25463
25733
  file,
25464
25734
  MAX_SWIFT_COMPILE_SOURCE_BYTES
@@ -25570,7 +25840,7 @@ function swiftApiGapReport(output) {
25570
25840
  const diagnostic = /^(\S[^:]*\.swift):(\d+):(\d+): error: (.+)$/.exec(line);
25571
25841
  if (!diagnostic || seen.has(line)) continue;
25572
25842
  seen.add(line);
25573
- const file = diagnostic[1].replace(new RegExp(`^${XCODE_APP_DIR}/`), "").replace(new RegExp(`^${XCODE_PACKAGES_DIR}/`), "");
25843
+ const file = diagnostic[1].replace(new RegExp(`^(?:${XCODE_APP_DIR}|${XCODE_FRAMEWORKS_DIR}/[^/]+)/`), "").replace(new RegExp(`^${XCODE_PACKAGES_DIR}/`), "");
25574
25844
  const message = diagnostic[4];
25575
25845
  const rule = API_GAP_PATTERNS.find(([pattern]) => pattern.test(message));
25576
25846
  const key = rule ? rule[1](rule[0].exec(message)) : message;
@@ -25774,7 +26044,7 @@ function serveSwiftPackageAsset(pathname, res) {
25774
26044
  res.end("swift artifact is stale");
25775
26045
  return true;
25776
26046
  }
25777
- var import_node_crypto5, import_node_fs15, import_node_os5, import_node_path15, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, projects, xcodeProjects, XCODE_APP_DIR, XCODE_PACKAGES_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS;
26047
+ var import_node_crypto5, import_node_fs15, import_node_os5, import_node_path15, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, projects, xcodeProjects, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS;
25778
26048
  var init_swift_host = __esm({
25779
26049
  "src/swift-host.ts"() {
25780
26050
  "use strict";
@@ -25807,6 +26077,7 @@ var init_swift_host = __esm({
25807
26077
  projects = /* @__PURE__ */ new Map();
25808
26078
  xcodeProjects = /* @__PURE__ */ new Map();
25809
26079
  XCODE_APP_DIR = "__app__";
26080
+ XCODE_FRAMEWORKS_DIR = "__frameworks__";
25810
26081
  XCODE_PACKAGES_DIR = "__packages__";
25811
26082
  CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)}/`;
25812
26083
  HOSTED_LIMITS = {
@@ -26408,8 +26679,8 @@ function parseAgentEventLine(line) {
26408
26679
  const trimmed = line.trim();
26409
26680
  if (!trimmed) return null;
26410
26681
  try {
26411
- const parsed2 = JSON.parse(trimmed);
26412
- return isAgentEvent(parsed2) ? parsed2 : null;
26682
+ const parsed = JSON.parse(trimmed);
26683
+ return isAgentEvent(parsed) ? parsed : null;
26413
26684
  } catch {
26414
26685
  return null;
26415
26686
  }
@@ -26479,13 +26750,13 @@ function loadStore() {
26479
26750
  throw err;
26480
26751
  }
26481
26752
  try {
26482
- const parsed2 = JSON.parse(raw2);
26483
- if (!parsed2 || typeof parsed2 !== "object") throw new Error("not an object");
26753
+ const parsed = JSON.parse(raw2);
26754
+ if (!parsed || typeof parsed !== "object") throw new Error("not an object");
26484
26755
  return {
26485
26756
  version: 1,
26486
- attachedProjects: Array.isArray(parsed2.attachedProjects) ? parsed2.attachedProjects : [],
26487
- previewAttachments: Array.isArray(parsed2.previewAttachments) ? parsed2.previewAttachments : [],
26488
- agentSessions: Array.isArray(parsed2.agentSessions) ? parsed2.agentSessions : []
26757
+ attachedProjects: Array.isArray(parsed.attachedProjects) ? parsed.attachedProjects : [],
26758
+ previewAttachments: Array.isArray(parsed.previewAttachments) ? parsed.previewAttachments : [],
26759
+ agentSessions: Array.isArray(parsed.agentSessions) ? parsed.agentSessions : []
26489
26760
  };
26490
26761
  } catch (err) {
26491
26762
  const quarantine = `${file}.corrupt-${Date.now()}`;
@@ -26825,8 +27096,8 @@ function resolveSootsimPackageDir() {
26825
27096
  const pkg = import_node_path19.default.join(cur, "package.json");
26826
27097
  try {
26827
27098
  if (import_node_fs19.default.existsSync(pkg)) {
26828
- const parsed2 = JSON.parse(import_node_fs19.default.readFileSync(pkg, "utf8"));
26829
- if (parsed2.name === rnxPublicBrand.packageName) return cur;
27099
+ const parsed = JSON.parse(import_node_fs19.default.readFileSync(pkg, "utf8"));
27100
+ if (parsed.name === rnxPublicBrand.packageName) return cur;
26830
27101
  }
26831
27102
  } catch {
26832
27103
  }
@@ -28074,9 +28345,9 @@ function handleAppApiRequest(req, res) {
28074
28345
  let targetPath = "";
28075
28346
  let targetOrigin = "";
28076
28347
  if (reqUrl.startsWith("/__app-api?")) {
28077
- const parsed2 = new URL(reqUrl, "http://sootsim.local");
28078
- targetPath = parsed2.searchParams.get("path") || "";
28079
- targetOrigin = parsed2.searchParams.get("origin")?.trim() || "";
28348
+ const parsed = new URL(reqUrl, "http://sootsim.local");
28349
+ targetPath = parsed.searchParams.get("path") || "";
28350
+ targetOrigin = parsed.searchParams.get("origin")?.trim() || "";
28080
28351
  } else if (reqUrl.startsWith("/__app-api/")) {
28081
28352
  targetPath = reqUrl.slice("/__app-api".length);
28082
28353
  } else {
@@ -29300,10 +29571,10 @@ function decodeProxyHeaders(encoded) {
29300
29571
  if (!encoded) return {};
29301
29572
  const base64 = encoded.replace(/-/g, "+").replace(/_/g, "/");
29302
29573
  const padded = base64 + "=".repeat((4 - base64.length % 4) % 4);
29303
- const parsed2 = JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
29304
- if (!parsed2 || typeof parsed2 !== "object" || Array.isArray(parsed2)) return {};
29574
+ const parsed = JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
29575
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
29305
29576
  const headers = {};
29306
- for (const [key, value] of Object.entries(parsed2)) {
29577
+ for (const [key, value] of Object.entries(parsed)) {
29307
29578
  if (value == null) continue;
29308
29579
  if (STRIP_UPSTREAM_HEADERS.has(key.toLowerCase())) continue;
29309
29580
  headers[key] = Array.isArray(value) ? value.join(", ") : String(value);
@@ -30801,10 +31072,10 @@ function readStringArray(text, start, end) {
30801
31072
  for (; ; ) {
30802
31073
  cursor = skipTrivia(text, cursor, end);
30803
31074
  if (text[cursor] === "]") return { values, end: cursor + 1 };
30804
- const parsed2 = readQuoted(text, cursor, end);
30805
- if (!parsed2) return null;
30806
- values.push(parsed2.value);
30807
- cursor = skipTrivia(text, parsed2.end, end);
31075
+ const parsed = readQuoted(text, cursor, end);
31076
+ if (!parsed) return null;
31077
+ values.push(parsed.value);
31078
+ cursor = skipTrivia(text, parsed.end, end);
30808
31079
  if (text[cursor] === "]") return { values, end: cursor + 1 };
30809
31080
  if (text[cursor] !== ",") return null;
30810
31081
  cursor++;
@@ -30957,10 +31228,10 @@ function scanAssetDescriptorSites(bundle) {
30957
31228
  continue;
30958
31229
  }
30959
31230
  if (character === '"' || character === "'") {
30960
- const parsed2 = readQuoted(bundle, cursor, bundle.length);
30961
- const after = parsed2?.end ?? quotedEnd(bundle, cursor, bundle.length);
31231
+ const parsed = readQuoted(bundle, cursor, bundle.length);
31232
+ const after = parsed?.end ?? quotedEnd(bundle, cursor, bundle.length);
30962
31233
  const colon = skipTrivia(bundle, after, bundle.length);
30963
- if (parsed2?.value === "__packager_asset" && bundle[colon] === ":" && objects.length > 0) {
31234
+ if (parsed?.value === "__packager_asset" && bundle[colon] === ":" && objects.length > 0) {
30964
31235
  objects[objects.length - 1].hasAssetKey = true;
30965
31236
  }
30966
31237
  cursor = after;
@@ -31263,18 +31534,18 @@ async function embedMetroAssetFiles(bundle, read) {
31263
31534
  }
31264
31535
  const fileUris = [];
31265
31536
  const fileHashes = [];
31266
- const loaded = /* @__PURE__ */ new Map();
31537
+ const loaded2 = /* @__PURE__ */ new Map();
31267
31538
  for (let index = 0; index < site.descriptor.scales.length; index++) {
31268
31539
  const scale = site.descriptor.scales[index];
31269
31540
  const file = await read({ descriptor: site.descriptor, index, scale });
31270
- if (file) loaded.set(scale, file);
31541
+ if (file) loaded2.set(scale, file);
31271
31542
  }
31272
- if (loaded.size === 0) {
31543
+ if (loaded2.size === 0) {
31273
31544
  throw new Error(
31274
31545
  `peach ios --remote found no scale of ${site.descriptor.name}.${site.descriptor.type} in the asset dest graph for ${site.descriptor.httpServerLocation}`
31275
31546
  );
31276
31547
  }
31277
- const scales = [...loaded.keys()].sort((left, right) => left - right);
31548
+ const scales = [...loaded2.keys()].sort((left, right) => left - right);
31278
31549
  if (scales.length !== site.descriptor.scales.length && !site.scalesSpan) {
31279
31550
  throw new Error(
31280
31551
  `peach ios --remote could not narrow the scales of ${site.descriptor.name}.${site.descriptor.type} because its descriptor declares none`
@@ -31282,7 +31553,7 @@ async function embedMetroAssetFiles(bundle, read) {
31282
31553
  }
31283
31554
  let descriptorBytes = 0;
31284
31555
  for (const scale of scales) {
31285
- const file = loaded.get(scale);
31556
+ const file = loaded2.get(scale);
31286
31557
  if (!file) continue;
31287
31558
  fileUris.push(metroAssetDataUri(site.descriptor.type, file));
31288
31559
  fileHashes.push(await sha256HexBytes(file));
@@ -31682,13 +31953,13 @@ async function parseRegistryBytes(args) {
31682
31953
  if (integrity !== args.expectedIntegrity) {
31683
31954
  throw new Error("RNX Metro fingerprint registry integrity mismatch");
31684
31955
  }
31685
- let parsed2;
31956
+ let parsed;
31686
31957
  try {
31687
- parsed2 = JSON.parse(new TextDecoder().decode(args.bytes));
31958
+ parsed = JSON.parse(new TextDecoder().decode(args.bytes));
31688
31959
  } catch {
31689
31960
  throw new Error("RNX Metro fingerprint registry is not valid JSON");
31690
31961
  }
31691
- const registry = (0, import_metro_fingerprint_registry.parseRNXMetroFingerprintRegistry)(parsed2);
31962
+ const registry = (0, import_metro_fingerprint_registry.parseRNXMetroFingerprintRegistry)(parsed);
31692
31963
  if (!registry) throw new Error("RNX Metro fingerprint registry is malformed");
31693
31964
  if (args.expectedRevision && registry.revision !== args.expectedRevision) {
31694
31965
  throw new Error("RNX Metro fingerprint registry revision does not match its pointer");
@@ -31743,13 +32014,13 @@ async function readPointer(response) {
31743
32014
  `RNX Metro fingerprint pointer exceeds ${import_metro_fingerprint_registry.RNX_METRO_FINGERPRINT_MAX_POINTER_BYTES} bytes`
31744
32015
  );
31745
32016
  }
31746
- let parsed2;
32017
+ let parsed;
31747
32018
  try {
31748
- parsed2 = JSON.parse(new TextDecoder().decode(bytes));
32019
+ parsed = JSON.parse(new TextDecoder().decode(bytes));
31749
32020
  } catch {
31750
32021
  throw new Error("RNX Metro fingerprint pointer is not valid JSON");
31751
32022
  }
31752
- const pointer = (0, import_metro_fingerprint_registry.parseRNXMetroFingerprintPointer)(parsed2);
32023
+ const pointer = (0, import_metro_fingerprint_registry.parseRNXMetroFingerprintPointer)(parsed);
31753
32024
  if (!pointer) throw new Error("RNX Metro fingerprint pointer is malformed");
31754
32025
  return pointer;
31755
32026
  }
@@ -32178,16 +32449,16 @@ function canonicalFactoryForDigest(factory, tokens) {
32178
32449
  return cursor === 0 ? factory : canonical + factory.slice(cursor);
32179
32450
  }
32180
32451
  function readDependencyIds(source) {
32181
- let parsed2;
32452
+ let parsed;
32182
32453
  try {
32183
- parsed2 = JSON.parse(source);
32454
+ parsed = JSON.parse(source);
32184
32455
  } catch {
32185
32456
  throw new Error("Metro fingerprint analysis found a noncanonical dependency array");
32186
32457
  }
32187
- if (!Array.isArray(parsed2) || !parsed2.every((dependency) => dependency === null || Number.isSafeInteger(dependency))) {
32458
+ if (!Array.isArray(parsed) || !parsed.every((dependency) => dependency === null || Number.isSafeInteger(dependency))) {
32188
32459
  throw new Error("Metro fingerprint analysis found a noncanonical dependency array");
32189
32460
  }
32190
- return parsed2;
32461
+ return parsed;
32191
32462
  }
32192
32463
  function fnv1a64(value) {
32193
32464
  let hash = 0xcbf29ce484222325n;
@@ -32709,19 +32980,19 @@ var init_cloud_contract = __esm({
32709
32980
 
32710
32981
  // cli/cloud-session.ts
32711
32982
  function normalizeCloudOrigin(source) {
32712
- let parsed2;
32983
+ let parsed;
32713
32984
  try {
32714
- parsed2 = new URL(source);
32985
+ parsed = new URL(source);
32715
32986
  } catch {
32716
32987
  throw new Error(`invalid remote simulator origin: ${source}`);
32717
32988
  }
32718
- if (parsed2.protocol !== "https:" && parsed2.protocol !== "http:" || parsed2.username || parsed2.password || parsed2.pathname !== "/" || parsed2.search || parsed2.hash) {
32989
+ if (parsed.protocol !== "https:" && parsed.protocol !== "http:" || parsed.username || parsed.password || parsed.pathname !== "/" || parsed.search || parsed.hash) {
32719
32990
  throw new Error(`remote simulator origin must be an HTTP(S) origin: ${source}`);
32720
32991
  }
32721
- if (parsed2.protocol === "http:" && !isLoopbackHost(parsed2.hostname)) {
32992
+ if (parsed.protocol === "http:" && !isLoopbackHost(parsed.hostname)) {
32722
32993
  throw new Error(`remote simulator origin requires HTTPS outside loopback: ${source}`);
32723
32994
  }
32724
- return parsed2.origin;
32995
+ return parsed.origin;
32725
32996
  }
32726
32997
  function createCloudSession(input) {
32727
32998
  const boxId = input.boxId?.trim() ?? "";
@@ -32768,34 +33039,34 @@ function parseCloudSession(encoded) {
32768
33039
  if (!value || value.length > MAX_ENCODED_SESSION_BYTES || !/^[A-Za-z0-9_-]+$/.test(value)) {
32769
33040
  throw new Error(`${PEACH_CLOUD_SESSION_ENV} is invalid`);
32770
33041
  }
32771
- let parsed2;
33042
+ let parsed;
32772
33043
  try {
32773
33044
  const bytes = Buffer.from(value, "base64url");
32774
33045
  if (bytes.toString("base64url") !== value) {
32775
33046
  throw new Error("non-canonical cloud session");
32776
33047
  }
32777
- parsed2 = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
33048
+ parsed = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
32778
33049
  } catch {
32779
33050
  throw new Error(`${PEACH_CLOUD_SESSION_ENV} is invalid`);
32780
33051
  }
32781
- if (!isRecord2(parsed2) || parsed2.version !== CLOUD_SESSION_VERSION) {
33052
+ if (!isRecord2(parsed) || parsed.version !== CLOUD_SESSION_VERSION) {
32782
33053
  throw new Error(`${PEACH_CLOUD_SESSION_ENV} is invalid`);
32783
33054
  }
32784
- const apiOrigin = parsed2.apiOrigin;
33055
+ const apiOrigin = parsed.apiOrigin;
32785
33056
  if (typeof apiOrigin !== "string") {
32786
33057
  throw new Error(`${PEACH_CLOUD_SESSION_ENV} is invalid`);
32787
33058
  }
32788
- const platform = parsed2.platform === "ios" || parsed2.platform === "android" ? parsed2.platform : void 0;
32789
- const device = typeof parsed2.device === "string" ? parsed2.device : void 0;
32790
- const artifact = isRecord2(parsed2.artifact) && typeof parsed2.artifact.sha256 === "string" ? {
32791
- sha256: parsed2.artifact.sha256,
32792
- bytes: typeof parsed2.artifact.bytes === "number" ? parsed2.artifact.bytes : void 0
33059
+ const platform = parsed.platform === "ios" || parsed.platform === "android" ? parsed.platform : void 0;
33060
+ const device = typeof parsed.device === "string" ? parsed.device : void 0;
33061
+ const artifact = isRecord2(parsed.artifact) && typeof parsed.artifact.sha256 === "string" ? {
33062
+ sha256: parsed.artifact.sha256,
33063
+ bytes: typeof parsed.artifact.bytes === "number" ? parsed.artifact.bytes : void 0
32793
33064
  } : void 0;
32794
- const streamUrl = typeof parsed2.streamUrl === "string" ? parsed2.streamUrl : void 0;
32795
- const boxId = typeof parsed2.boxId === "string" ? parsed2.boxId : void 0;
32796
- const boxToken = typeof parsed2.boxToken === "string" ? parsed2.boxToken : void 0;
33065
+ const streamUrl = typeof parsed.streamUrl === "string" ? parsed.streamUrl : void 0;
33066
+ const boxId = typeof parsed.boxId === "string" ? parsed.boxId : void 0;
33067
+ const boxToken = typeof parsed.boxToken === "string" ? parsed.boxToken : void 0;
32797
33068
  try {
32798
- if (parsed2.service === "box") {
33069
+ if (parsed.service === "box") {
32799
33070
  if (!boxId || !boxToken) throw new Error("unreadable cloud box session");
32800
33071
  return createCloudBoxSession({
32801
33072
  boxId,
@@ -32806,10 +33077,10 @@ function parseCloudSession(encoded) {
32806
33077
  artifact
32807
33078
  });
32808
33079
  }
32809
- const simId = parsed2.simId;
32810
- const claimId = parsed2.claimId;
32811
- const token = parsed2.token;
32812
- if (parsed2.service !== "sim" || typeof simId !== "string" || typeof claimId !== "string" || typeof token !== "string") {
33080
+ const simId = parsed.simId;
33081
+ const claimId = parsed.claimId;
33082
+ const token = parsed.token;
33083
+ if (parsed.service !== "sim" || typeof simId !== "string" || typeof claimId !== "string" || typeof token !== "string") {
32813
33084
  throw new Error("unreadable cloud session");
32814
33085
  }
32815
33086
  return createCloudSession({
@@ -32906,8 +33177,8 @@ function readProjectJson(path33) {
32906
33177
  }
32907
33178
  }
32908
33179
  function readProjectManifest(dir) {
32909
- const parsed2 = readProjectJson((0, import_node_path24.join)(dir, "package.json"));
32910
- if (!parsed2 || typeof parsed2 !== "object") return null;
33180
+ const parsed = readProjectJson((0, import_node_path24.join)(dir, "package.json"));
33181
+ if (!parsed || typeof parsed !== "object") return null;
32911
33182
  const record = (value) => {
32912
33183
  if (!value || typeof value !== "object") return {};
32913
33184
  return Object.fromEntries(
@@ -32916,11 +33187,11 @@ function readProjectManifest(dir) {
32916
33187
  )
32917
33188
  );
32918
33189
  };
32919
- const name2 = metadataValue(parsed2, "name");
33190
+ const name2 = metadataValue(parsed, "name");
32920
33191
  return {
32921
33192
  ...typeof name2 === "string" ? { name: name2 } : {},
32922
- dependencies: record(metadataValue(parsed2, "dependencies")),
32923
- devDependencies: record(metadataValue(parsed2, "devDependencies"))
33193
+ dependencies: record(metadataValue(parsed, "dependencies")),
33194
+ devDependencies: record(metadataValue(parsed, "devDependencies"))
32924
33195
  };
32925
33196
  }
32926
33197
  var import_node_fs24, import_node_path24, import_json5, import_yaml, CONFIG_EXTENSIONS;
@@ -32937,24 +33208,24 @@ var init_detect = __esm({
32937
33208
 
32938
33209
  // cli/cloud-client.ts
32939
33210
  function failureSentence(text) {
32940
- let parsed2;
33211
+ let parsed;
32941
33212
  try {
32942
- parsed2 = JSON.parse(text);
33213
+ parsed = JSON.parse(text);
32943
33214
  } catch {
32944
33215
  return null;
32945
33216
  }
32946
- if (!isRecord2(parsed2)) return null;
32947
- if (isRecord2(parsed2.error) && typeof parsed2.error.message === "string") {
32948
- const code = typeof parsed2.error.code === "string" && parsed2.error.code ? ` [${parsed2.error.code}]` : "";
32949
- return `${parsed2.error.message}${code}`;
33217
+ if (!isRecord2(parsed)) return null;
33218
+ if (isRecord2(parsed.error) && typeof parsed.error.message === "string") {
33219
+ const code = typeof parsed.error.code === "string" && parsed.error.code ? ` [${parsed.error.code}]` : "";
33220
+ return `${parsed.error.message}${code}`;
32950
33221
  }
32951
- if (typeof parsed2.message === "string") return parsed2.message;
32952
- if (typeof parsed2.error === "string") return parsed2.error;
33222
+ if (typeof parsed.message === "string") return parsed.message;
33223
+ if (typeof parsed.error === "string") return parsed.error;
32953
33224
  return null;
32954
33225
  }
32955
33226
  function responseError(status, text) {
32956
- const parsed2 = text ? failureSentence(text) : null;
32957
- const sentence = parsed2 && ACCOUNT_CHOICE_REFUSALS.has(parsed2) ? CHOOSE_ACCOUNT_HINT : parsed2;
33227
+ const parsed = text ? failureSentence(text) : null;
33228
+ const sentence = parsed && ACCOUNT_CHOICE_REFUSALS.has(parsed) ? CHOOSE_ACCOUNT_HINT : parsed;
32958
33229
  return new Error(
32959
33230
  `remote simulator request failed (${status})${sentence ? `: ${sentence}` : text.trim() ? `: ${text.trim()}` : ""}`
32960
33231
  );
@@ -33458,13 +33729,13 @@ async function createCloudBox(options) {
33458
33729
  }
33459
33730
  const responseText = await response.text();
33460
33731
  if (!response.ok) throw responseError(response.status, responseText);
33461
- let parsed2;
33732
+ let parsed;
33462
33733
  try {
33463
- parsed2 = JSON.parse(responseText);
33734
+ parsed = JSON.parse(responseText);
33464
33735
  } catch {
33465
33736
  throw new Error("remote simulator create returned unreadable JSON");
33466
33737
  }
33467
- const created = readCreateResponse(parsed2, artifact.bytes.length, artifact.sha256);
33738
+ const created = readCreateResponse(parsed, artifact.bytes.length, artifact.sha256);
33468
33739
  const session = createCloudSession({
33469
33740
  boxId: created.receipt.boxId,
33470
33741
  boxToken: created.boxToken,
@@ -33487,20 +33758,20 @@ async function createCloudBox(options) {
33487
33758
  warnings: artifact.warnings
33488
33759
  };
33489
33760
  }
33490
- function resolveCloudSessionForParsed(parsed2) {
33761
+ function resolveCloudSessionForParsed(parsed) {
33491
33762
  const session = readCloudSession();
33492
33763
  if (!session) return null;
33493
33764
  if (session.service === "box") {
33494
- if (parsed2.simIdSource === "flag" && parsed2.simId !== session.boxId) {
33765
+ if (parsed.simIdSource === "flag" && parsed.simId !== session.boxId) {
33495
33766
  throw new Error(
33496
- `this shell is connected to box ${session.boxId}; ${parsed2.simId ? `--sim ${parsed2.simId}` : "the requested simulator"} is not available in this shell`
33767
+ `this shell is connected to box ${session.boxId}; ${parsed.simId ? `--sim ${parsed.simId}` : "the requested simulator"} is not available in this shell`
33497
33768
  );
33498
33769
  }
33499
33770
  return session;
33500
33771
  }
33501
- if (parsed2.simIdSource === "flag" && parsed2.simId !== session.simId) {
33772
+ if (parsed.simIdSource === "flag" && parsed.simId !== session.simId) {
33502
33773
  throw new Error(
33503
- `this shell is connected to remote simulator ${session.simId}; ${parsed2.simId ? `--sim ${parsed2.simId}` : "the requested simulator"} is not available in this shell`
33774
+ `this shell is connected to remote simulator ${session.simId}; ${parsed.simId ? `--sim ${parsed.simId}` : "the requested simulator"} is not available in this shell`
33504
33775
  );
33505
33776
  }
33506
33777
  return session;
@@ -33522,8 +33793,8 @@ function cloudCommand(command) {
33522
33793
  }
33523
33794
  return clean;
33524
33795
  }
33525
- function createCloudBridgeForParsed(parsed2) {
33526
- const session = resolveCloudSessionForParsed(parsed2);
33796
+ function createCloudBridgeForParsed(parsed) {
33797
+ const session = resolveCloudSessionForParsed(parsed);
33527
33798
  if (!session) return null;
33528
33799
  return session.service === "box" ? new CloudBoxBridge(session) : new CloudBridge(session);
33529
33800
  }
@@ -33598,20 +33869,20 @@ var init_cloud_client = __esm({
33598
33869
  }
33599
33870
  const text = await response.text();
33600
33871
  if (!response.ok) throw responseError(response.status, text);
33601
- let parsed2;
33872
+ let parsed;
33602
33873
  try {
33603
- parsed2 = JSON.parse(text);
33874
+ parsed = JSON.parse(text);
33604
33875
  } catch {
33605
33876
  throw new Error("remote simulator command returned unreadable JSON");
33606
33877
  }
33607
- if (!isRecord2(parsed2) || parsed2.id !== body.id) {
33878
+ if (!isRecord2(parsed) || parsed.id !== body.id) {
33608
33879
  throw new Error("remote simulator command returned an invalid command receipt");
33609
33880
  }
33610
- if (typeof parsed2.error === "string" && parsed2.error) throw new Error(parsed2.error);
33611
- if (!Object.hasOwn(parsed2, "result")) {
33881
+ if (typeof parsed.error === "string" && parsed.error) throw new Error(parsed.error);
33882
+ if (!Object.hasOwn(parsed, "result")) {
33612
33883
  throw new Error("remote simulator command receipt has no result");
33613
33884
  }
33614
- return parsed2.result;
33885
+ return parsed.result;
33615
33886
  }
33616
33887
  listSims() {
33617
33888
  return Promise.reject(
@@ -33669,20 +33940,20 @@ var init_cloud_client = __esm({
33669
33940
  }
33670
33941
  const text = await response.text();
33671
33942
  if (!response.ok) throw responseError(response.status, text);
33672
- let parsed2;
33943
+ let parsed;
33673
33944
  try {
33674
- parsed2 = JSON.parse(text);
33945
+ parsed = JSON.parse(text);
33675
33946
  } catch {
33676
33947
  throw new Error("box command returned unreadable JSON");
33677
33948
  }
33678
- if (!isRecord2(parsed2) || parsed2.id !== id) {
33949
+ if (!isRecord2(parsed) || parsed.id !== id) {
33679
33950
  throw new Error("box command returned an invalid command receipt");
33680
33951
  }
33681
- if (typeof parsed2.error === "string" && parsed2.error) throw new Error(parsed2.error);
33682
- if (!Object.hasOwn(parsed2, "result")) {
33952
+ if (typeof parsed.error === "string" && parsed.error) throw new Error(parsed.error);
33953
+ if (!Object.hasOwn(parsed, "result")) {
33683
33954
  throw new Error("box command receipt has no result");
33684
33955
  }
33685
- return parsed2.result;
33956
+ return parsed.result;
33686
33957
  }
33687
33958
  listSims() {
33688
33959
  return Promise.reject(new Error("a box does not expose a local simulator list"));
@@ -34907,12 +35178,12 @@ var init_bridge_host = __esm({
34907
35178
  }
34908
35179
  chunks.push(buffer);
34909
35180
  }
34910
- const parsed2 = JSON.parse(Buffer.concat(chunks).toString("utf8"));
34911
- if (!parsed2 || typeof parsed2 !== "object" || Array.isArray(parsed2)) {
35181
+ const parsed = JSON.parse(Buffer.concat(chunks).toString("utf8"));
35182
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
34912
35183
  throw new Error("shared config patch must be an object");
34913
35184
  }
34914
35185
  const patch = Object.fromEntries(
34915
- Object.entries(parsed2)
35186
+ Object.entries(parsed)
34916
35187
  );
34917
35188
  const next = this.writeAndBroadcastSharedConfig(patch);
34918
35189
  res.writeHead(200, { "Content-Type": "application/json" });
@@ -34951,11 +35222,11 @@ var init_bridge_host = __esm({
34951
35222
  chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
34952
35223
  }
34953
35224
  const text = Buffer.concat(chunks).toString("utf8").trim();
34954
- const parsed2 = text ? JSON.parse(text) : {};
34955
- if (!parsed2 || typeof parsed2 !== "object" || Array.isArray(parsed2)) {
35225
+ const parsed = text ? JSON.parse(text) : {};
35226
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
34956
35227
  throw new Error("send to box needs a json object body");
34957
35228
  }
34958
- const body = { ...parsed2 };
35229
+ const body = { ...parsed };
34959
35230
  const { CHOOSE_ACCOUNT_HINT: CHOOSE_ACCOUNT_HINT2, resolveCliAuth: resolveCliAuth2, authHeaderValue: authHeaderValue2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
34960
35231
  const auth = resolveCliAuth2();
34961
35232
  if (!auth) {
@@ -35921,12 +36192,12 @@ function readProcessTable() {
35921
36192
  stdio: ["ignore", "pipe", "ignore"]
35922
36193
  });
35923
36194
  for (const line of out.split("\n")) {
35924
- const parsed2 = line.trim().match(/^(\d+)\s+(\d+)\s+(\d+)\s+(.*)$/);
35925
- if (!parsed2) continue;
35926
- rows.set(Number(parsed2[1]), {
35927
- ppid: Number(parsed2[2]),
35928
- pgid: Number(parsed2[3]),
35929
- comm: (parsed2[4].split("/").at(-1) ?? "").slice(0, PBI_COMM_LEN)
36195
+ const parsed = line.trim().match(/^(\d+)\s+(\d+)\s+(\d+)\s+(.*)$/);
36196
+ if (!parsed) continue;
36197
+ rows.set(Number(parsed[1]), {
36198
+ ppid: Number(parsed[2]),
36199
+ pgid: Number(parsed[3]),
36200
+ comm: (parsed[4].split("/").at(-1) ?? "").slice(0, PBI_COMM_LEN)
35930
36201
  });
35931
36202
  }
35932
36203
  } catch {
@@ -36133,15 +36404,15 @@ function readCurrentTarget() {
36133
36404
  (0, import_fs4.rmSync)(legacyCloudCredentialDirectory(filepath), { recursive: true, force: true });
36134
36405
  if (!(0, import_fs4.existsSync)(filepath)) return null;
36135
36406
  try {
36136
- const parsed2 = JSON.parse((0, import_fs4.readFileSync)(filepath, "utf8"));
36137
- if (parsed2 === null || typeof parsed2 !== "object") {
36407
+ const parsed = JSON.parse((0, import_fs4.readFileSync)(filepath, "utf8"));
36408
+ if (parsed === null || typeof parsed !== "object") {
36138
36409
  (0, import_fs4.rmSync)(filepath, { force: true });
36139
36410
  return null;
36140
36411
  }
36141
- const version = Reflect.get(parsed2, "version");
36142
- const plane = Reflect.get(parsed2, "plane");
36143
- const simId = Reflect.get(parsed2, "simId");
36144
- const updatedAt = Reflect.get(parsed2, "updatedAt");
36412
+ const version = Reflect.get(parsed, "version");
36413
+ const plane = Reflect.get(parsed, "plane");
36414
+ const simId = Reflect.get(parsed, "simId");
36415
+ const updatedAt = Reflect.get(parsed, "updatedAt");
36145
36416
  if (version !== 1 && version !== CURRENT_SIM_VERSION || version === CURRENT_SIM_VERSION && plane !== "local" || typeof simId !== "string" || !simId.trim() || typeof updatedAt !== "string") {
36146
36417
  (0, import_fs4.rmSync)(filepath, { force: true });
36147
36418
  return null;
@@ -36704,13 +36975,13 @@ function createBridge(wsPort, opts = {}) {
36704
36975
  }
36705
36976
  };
36706
36977
  }
36707
- function createBridgeFromParsed(parsed2) {
36708
- const cloudBridge = createCloudBridgeForParsed(parsed2);
36978
+ function createBridgeFromParsed(parsed) {
36979
+ const cloudBridge = createCloudBridgeForParsed(parsed);
36709
36980
  if (cloudBridge) return cloudBridge;
36710
- return createBridge(parsed2.wsPort, {
36711
- commandTimeoutMs: parsed2.commandTimeoutMs,
36712
- simId: parsed2.simId,
36713
- simIdSource: parsed2.simIdSource
36981
+ return createBridge(parsed.wsPort, {
36982
+ commandTimeoutMs: parsed.commandTimeoutMs,
36983
+ simId: parsed.simId,
36984
+ simIdSource: parsed.simIdSource
36714
36985
  });
36715
36986
  }
36716
36987
  function describeVisibleSimCandidate(sims, currentId) {
@@ -36883,8 +37154,8 @@ function buildBaseUrl(protocol, host2, port) {
36883
37154
  function shouldProxyLoopbackProbe(targetUrl) {
36884
37155
  if (typeof window === "undefined") return false;
36885
37156
  try {
36886
- const parsed2 = new URL(targetUrl);
36887
- return isLoopbackHost(parsed2.hostname) && isLoopbackHost(window.location.hostname) && parsed2.origin !== window.location.origin;
37157
+ const parsed = new URL(targetUrl);
37158
+ return isLoopbackHost(parsed.hostname) && isLoopbackHost(window.location.hostname) && parsed.origin !== window.location.origin;
36888
37159
  } catch {
36889
37160
  return false;
36890
37161
  }
@@ -37036,23 +37307,23 @@ async function resolveConnectionInput(input) {
37036
37307
  throw buildUnresolvedTargetError(`localhost:${port2}`);
37037
37308
  }
37038
37309
  const bundleUrl = trimmed.startsWith("http") ? trimmed : `http://${trimmed}`;
37039
- let parsed2;
37310
+ let parsed;
37040
37311
  try {
37041
- parsed2 = new URL(bundleUrl);
37312
+ parsed = new URL(bundleUrl);
37042
37313
  } catch {
37043
37314
  throw new Error(
37044
37315
  `could not parse "${input}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`
37045
37316
  );
37046
37317
  }
37047
- const protocol = parsed2.protocol || "http:";
37048
- const port = parsed2.port ? parseInt(parsed2.port, 10) : getDefaultPortForProtocol(protocol);
37049
- const baseUrl = buildBaseUrl(protocol, parsed2.hostname, port);
37050
- if (isBaseServerUrl(parsed2)) {
37318
+ const protocol = parsed.protocol || "http:";
37319
+ const port = parsed.port ? parseInt(parsed.port, 10) : getDefaultPortForProtocol(protocol);
37320
+ const baseUrl = buildBaseUrl(protocol, parsed.hostname, port);
37321
+ if (isBaseServerUrl(parsed)) {
37051
37322
  const resolved = await probeBaseUrlBundle(baseUrl, port);
37052
37323
  if (resolved) return resolved;
37053
37324
  throw buildUnresolvedTargetError(baseUrl);
37054
37325
  }
37055
- return { bundleUrl: parsed2.toString(), port, framework: "unknown" };
37326
+ return { bundleUrl: parsed.toString(), port, framework: "unknown" };
37056
37327
  }
37057
37328
  var MANIFEST_PROBE_TIMEOUT_MS, MANIFEST_BOOT_BUDGET_MS, MANIFEST_BOOT_RETRY_MS;
37058
37329
  var init_dev_bundle_resolution = __esm({
@@ -37375,24 +37646,24 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
37375
37646
  import_node_path29.default.resolve(projectRoot, native.googleServicesFile),
37376
37647
  "utf8"
37377
37648
  );
37378
- const parsed2 = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
37379
- if (!isRecord2(parsed2)) throw new Error("Invalid Google services file.");
37649
+ const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
37650
+ if (!isRecord2(parsed)) throw new Error("Invalid Google services file.");
37380
37651
  if (platform === "ios") {
37381
37652
  result[platform] = {
37382
- apiKey: parsed2.API_KEY,
37383
- appId: parsed2.GOOGLE_APP_ID,
37384
- projectId: parsed2.PROJECT_ID,
37385
- databaseURL: parsed2.DATABASE_URL,
37386
- gaTrackingId: parsed2.TRACKING_ID,
37387
- storageBucket: parsed2.STORAGE_BUCKET,
37388
- messagingSenderId: parsed2.GCM_SENDER_ID,
37389
- clientId: parsed2.CLIENT_ID,
37390
- androidClientID: parsed2.ANDROID_CLIENT_ID,
37391
- deepLinkUrlScheme: parsed2.REVERSED_CLIENT_ID
37653
+ apiKey: parsed.API_KEY,
37654
+ appId: parsed.GOOGLE_APP_ID,
37655
+ projectId: parsed.PROJECT_ID,
37656
+ databaseURL: parsed.DATABASE_URL,
37657
+ gaTrackingId: parsed.TRACKING_ID,
37658
+ storageBucket: parsed.STORAGE_BUCKET,
37659
+ messagingSenderId: parsed.GCM_SENDER_ID,
37660
+ clientId: parsed.CLIENT_ID,
37661
+ androidClientID: parsed.ANDROID_CLIENT_ID,
37662
+ deepLinkUrlScheme: parsed.REVERSED_CLIENT_ID
37392
37663
  };
37393
37664
  } else {
37394
- const project = isRecord2(parsed2.project_info) ? parsed2.project_info : {};
37395
- const clients = Array.isArray(parsed2.client) ? parsed2.client : [];
37665
+ const project = isRecord2(parsed.project_info) ? parsed.project_info : {};
37666
+ const clients = Array.isArray(parsed.client) ? parsed.client : [];
37396
37667
  const client = clients.find((value) => {
37397
37668
  if (!isRecord2(value) || !isRecord2(value.client_info)) return false;
37398
37669
  const android = value.client_info.android_client_info;
@@ -37456,13 +37727,13 @@ function playwrightProfileUserDataDir(profileId) {
37456
37727
  }
37457
37728
  function readIndexRaw() {
37458
37729
  try {
37459
- const parsed2 = JSON.parse(
37730
+ const parsed = JSON.parse(
37460
37731
  import_fs5.default.readFileSync(profileIndexPath(), "utf8")
37461
37732
  );
37462
- if (!parsed2 || parsed2.version !== PROFILE_INDEX_VERSION) {
37733
+ if (!parsed || parsed.version !== PROFILE_INDEX_VERSION) {
37463
37734
  return { version: PROFILE_INDEX_VERSION, profiles: [] };
37464
37735
  }
37465
- const profiles = Array.isArray(parsed2.profiles) ? parsed2.profiles.filter(
37736
+ const profiles = Array.isArray(parsed.profiles) ? parsed.profiles.filter(
37466
37737
  (profile) => !!profile && typeof profile.id === "string" && typeof profile.createdAt === "string" && typeof profile.updatedAt === "string"
37467
37738
  ).map((profile) => ({
37468
37739
  id: normalizeProfileId(profile.id),
@@ -37694,11 +37965,11 @@ async function loadRNXAppConfig(project) {
37694
37965
  )
37695
37966
  }
37696
37967
  });
37697
- const loaded = await jiti.import(project.configPath, { default: true });
37698
- if (!isPeachConfig(loaded)) {
37968
+ const loaded2 = await jiti.import(project.configPath, { default: true });
37969
+ if (!isPeachConfig(loaded2)) {
37699
37970
  throw new Error("the default export must be a peach config object");
37700
37971
  }
37701
- return resolveConfigReplacementFiles(loaded, project.configPath);
37972
+ return resolveConfigReplacementFiles(loaded2, project.configPath);
37702
37973
  } catch (error) {
37703
37974
  const message = error instanceof Error ? error.message : String(error);
37704
37975
  throw new Error(`could not load ${project.configPath}: ${message}`);
@@ -37870,14 +38141,14 @@ function discoverNativeLinkedAppFonts(opts) {
37870
38141
  plistPaths.push(import_node_path33.default.join(iosDir, entry.name, "Info.plist"));
37871
38142
  }
37872
38143
  for (const plistPath of plistPaths) {
37873
- let parsed2;
38144
+ let parsed;
37874
38145
  try {
37875
- parsed2 = parsePlistSource(import_node_fs32.default.readFileSync(plistPath, "utf8"));
38146
+ parsed = parsePlistSource(import_node_fs32.default.readFileSync(plistPath, "utf8"));
37876
38147
  } catch {
37877
38148
  continue;
37878
38149
  }
37879
- if (!parsed2 || typeof parsed2 !== "object" || Array.isArray(parsed2)) continue;
37880
- const declaredFonts = Reflect.get(parsed2, "UIAppFonts");
38150
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) continue;
38151
+ const declaredFonts = Reflect.get(parsed, "UIAppFonts");
37881
38152
  if (!Array.isArray(declaredFonts)) continue;
37882
38153
  for (const declaredFont of declaredFonts) {
37883
38154
  if (typeof declaredFont !== "string") continue;
@@ -40492,8 +40763,8 @@ function resolvePlaywright() {
40492
40763
  try {
40493
40764
  const modulePath = requireFromRoot.resolve(spec);
40494
40765
  const packageJsonPath = requireFromRoot.resolve(`${spec}/package.json`);
40495
- const parsed2 = JSON.parse((0, import_node_fs34.readFileSync)(packageJsonPath, "utf8"));
40496
- if (!isRecord2(parsed2) || typeof parsed2.version !== "string") continue;
40766
+ const parsed = JSON.parse((0, import_node_fs34.readFileSync)(packageJsonPath, "utf8"));
40767
+ if (!isRecord2(parsed) || typeof parsed.version !== "string") continue;
40497
40768
  const corePackagePath = (0, import_node_module6.createRequire)(modulePath).resolve(
40498
40769
  "playwright-core/package.json"
40499
40770
  );
@@ -40503,7 +40774,7 @@ function resolvePlaywright() {
40503
40774
  spec,
40504
40775
  modulePath,
40505
40776
  cliPath,
40506
- version: parsed2.version
40777
+ version: parsed.version
40507
40778
  };
40508
40779
  } catch {
40509
40780
  }
@@ -40562,14 +40833,14 @@ function probeBrowser(resolved, env) {
40562
40833
  };
40563
40834
  }
40564
40835
  try {
40565
- const parsed2 = JSON.parse(probe2.stdout);
40566
- if (!isRecord2(parsed2) || typeof parsed2.executablePath !== "string" || typeof parsed2.exists !== "boolean") {
40836
+ const parsed = JSON.parse(probe2.stdout);
40837
+ if (!isRecord2(parsed) || typeof parsed.executablePath !== "string" || typeof parsed.exists !== "boolean") {
40567
40838
  throw new Error("probe returned an invalid result");
40568
40839
  }
40569
40840
  return {
40570
40841
  ok: true,
40571
- executablePath: parsed2.executablePath,
40572
- exists: parsed2.exists && (0, import_node_fs34.existsSync)(parsed2.executablePath)
40842
+ executablePath: parsed.executablePath,
40843
+ exists: parsed.exists && (0, import_node_fs34.existsSync)(parsed.executablePath)
40573
40844
  };
40574
40845
  } catch (error) {
40575
40846
  return {
@@ -41611,8 +41882,8 @@ __export(control_exports, {
41611
41882
  function parsePositiveIntegerEnv(name2) {
41612
41883
  const value = process.env[name2]?.trim();
41613
41884
  if (!value) return null;
41614
- const parsed2 = Number(value);
41615
- return Number.isInteger(parsed2) && parsed2 > 0 ? parsed2 : null;
41885
+ const parsed = Number(value);
41886
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
41616
41887
  }
41617
41888
  function resolveDriverConnectWaitOptions() {
41618
41889
  const timeoutMs = parsePositiveIntegerEnv("SOOTSIM_DRIVER_CONNECT_TIMEOUT_MS") ?? parsePositiveIntegerEnv("SOOTSIM_PW_CONNECT_TIMEOUT_MS") ?? DEFAULT_DRIVER_CONNECT_TIMEOUT_MS;
@@ -42390,25 +42661,25 @@ function printOpenedSim(openUrl2, sim, mode, quiet = false) {
42390
42661
  const [printableOpenUrl, printableSimUrl] = [openUrl2, sim.url].map((value) => {
42391
42662
  if (!value) return value;
42392
42663
  try {
42393
- const parsed2 = new URL(value);
42664
+ const parsed = new URL(value);
42394
42665
  let changed = false;
42395
- if (parsed2.searchParams.has(PEACH_CONFIG_QUERY_PARAM)) {
42396
- parsed2.searchParams.set(PEACH_CONFIG_QUERY_PARAM, "[redacted]");
42666
+ if (parsed.searchParams.has(PEACH_CONFIG_QUERY_PARAM)) {
42667
+ parsed.searchParams.set(PEACH_CONFIG_QUERY_PARAM, "[redacted]");
42397
42668
  changed = true;
42398
42669
  }
42399
- const bundle = parsed2.searchParams.get("bundle");
42670
+ const bundle = parsed.searchParams.get("bundle");
42400
42671
  if (bundle) {
42401
42672
  try {
42402
42673
  const parsedBundle = new URL(bundle);
42403
42674
  if (parsedBundle.searchParams.has(PEACH_CONFIG_QUERY_PARAM)) {
42404
42675
  parsedBundle.searchParams.set(PEACH_CONFIG_QUERY_PARAM, "[redacted]");
42405
- parsed2.searchParams.set("bundle", parsedBundle.toString());
42676
+ parsed.searchParams.set("bundle", parsedBundle.toString());
42406
42677
  changed = true;
42407
42678
  }
42408
42679
  } catch {
42409
42680
  }
42410
42681
  }
42411
- if (changed) return parsed2.toString();
42682
+ if (changed) return parsed.toString();
42412
42683
  } catch {
42413
42684
  }
42414
42685
  return value;
@@ -42511,19 +42782,19 @@ async function waitForTreeStable(wsPort, simId, opts) {
42511
42782
  }
42512
42783
  }
42513
42784
  async function runLinkCommand(args, opts = {}) {
42514
- const parsed2 = parseBridgeCliArgs(args, {
42785
+ const parsed = parseBridgeCliArgs(args, {
42515
42786
  port: opts.port,
42516
42787
  commandTimeoutMs: opts.timeoutMs
42517
42788
  });
42518
- if (parsed2.positional.length !== 1) {
42789
+ if (parsed.positional.length !== 1) {
42519
42790
  console.error(" peach open: expected exactly one <url-or-route>");
42520
42791
  console.error(" examples: peach open /settings | peach open myapp://settings");
42521
42792
  rnxExit(1);
42522
42793
  }
42523
- const bridge = createBridgeFromParsed(parsed2);
42524
- const simHint = parsed2.simId ? ` --sim ${parsed2.simId}` : "";
42794
+ const bridge = createBridgeFromParsed(parsed);
42795
+ const simHint = parsed.simId ? ` --sim ${parsed.simId}` : "";
42525
42796
  try {
42526
- const target = await openAppUrl(bridge, parsed2.positional[0] ?? "");
42797
+ const target = await openAppUrl(bridge, parsed.positional[0] ?? "");
42527
42798
  console.log(` opened deep link: ${target}`);
42528
42799
  } catch (err) {
42529
42800
  console.error(` link failed: ${err instanceof Error ? err.message : String(err)}`);
@@ -42538,7 +42809,7 @@ async function runLinkCommand(args, opts = {}) {
42538
42809
  }
42539
42810
  }
42540
42811
  async function runOpenCommand(args, opts = {}) {
42541
- const parsed2 = parseBridgeCliArgs(args, {
42812
+ const parsed = parseBridgeCliArgs(args, {
42542
42813
  port: opts.port,
42543
42814
  commandTimeoutMs: opts.timeoutMs,
42544
42815
  stripBooleanFlags: [
@@ -42587,13 +42858,13 @@ async function runOpenCommand(args, opts = {}) {
42587
42858
  const profileId = requestedProfileId ? ensureProfile(requestedProfileId).id : void 0;
42588
42859
  const openInNewSim = args.includes("--new") || !!profileId || ephemeralProfile;
42589
42860
  const commandConfig = parseOpenRuntimeConfig(args);
42590
- if (openInNewSim && parsed2.simIdSource === "flag") {
42861
+ if (openInNewSim && parsed.simIdSource === "flag") {
42591
42862
  console.error(
42592
42863
  " peach open: --new, --profile, and --ephemeral cannot be combined with --sim"
42593
42864
  );
42594
42865
  rnxExit(1);
42595
42866
  }
42596
- const target = parsed2.positional[0] || "";
42867
+ const target = parsed.positional[0] || "";
42597
42868
  if (!target && args.includes("--port")) {
42598
42869
  const portValue = args[args.indexOf("--port") + 1] ?? "<number>";
42599
42870
  console.error(
@@ -42665,23 +42936,23 @@ async function runOpenCommand(args, opts = {}) {
42665
42936
  if (explicitBaseUrl) {
42666
42937
  const pinned = resolveBridgePortForPin({
42667
42938
  baseUrl: explicitBaseUrl,
42668
- wsPort: parsed2.wsPort,
42669
- explicitPort: parsed2.explicitPort
42939
+ wsPort: parsed.wsPort,
42940
+ explicitPort: parsed.explicitPort
42670
42941
  });
42671
42942
  if (pinned.error !== void 0) {
42672
42943
  console.error(` error: ${pinned.error}`);
42673
42944
  rnxExit(1);
42674
42945
  } else {
42675
- parsed2.wsPort = pinned.port;
42946
+ parsed.wsPort = pinned.port;
42676
42947
  }
42677
42948
  }
42678
42949
  opts.signal?.throwIfAborted();
42679
- parsed2.wsPort = await ensureBridgeForOpen(
42680
- parsed2.wsPort,
42681
- parsed2.explicitPort,
42950
+ parsed.wsPort = await ensureBridgeForOpen(
42951
+ parsed.wsPort,
42952
+ parsed.explicitPort,
42682
42953
  opts.resources
42683
42954
  );
42684
- if (opts.resources) opts.resources.port = parsed2.wsPort;
42955
+ if (opts.resources) opts.resources.port = parsed.wsPort;
42685
42956
  opts.signal?.throwIfAborted();
42686
42957
  const requestedDriverId = args.find((_, i) => args[i - 1] === "--driver") || "";
42687
42958
  if (requestedDriverId && !isDriverId(requestedDriverId)) {
@@ -42788,20 +43059,20 @@ async function runOpenCommand(args, opts = {}) {
42788
43059
  env: envArgs.length ? envArgs : void 0,
42789
43060
  dotEnv
42790
43061
  };
42791
- const selectedShellBaseUrl = configuredRuntimeVersion ? `http://localhost:${parsed2.wsPort}/` : explicitBaseUrl || resolveShellBaseUrlForBridgePort(parsed2.wsPort);
43062
+ const selectedShellBaseUrl = configuredRuntimeVersion ? `http://localhost:${parsed.wsPort}/` : explicitBaseUrl || resolveShellBaseUrlForBridgePort(parsed.wsPort);
42792
43063
  const baseUrl = applyRuntimeGenerationOrigin(
42793
43064
  selectedShellBaseUrl,
42794
43065
  configuredRuntimeVersion
42795
43066
  );
42796
43067
  const hasExplicitBaseUrl = args.includes("--base-url");
42797
- printBridgeWorldNotice(parsed2.wsPort, baseUrl);
43068
+ printBridgeWorldNotice(parsed.wsPort, baseUrl);
42798
43069
  const savedSimId = readCurrentSimId();
42799
43070
  const shouldReuseCurrentSim = !openInNewSim;
42800
43071
  const token = `cli-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
42801
43072
  const simMatchesToken = (sim) => sim.url?.includes(`inspectOpen=${token}`) ?? false;
42802
43073
  if (shouldReuseCurrentSim) {
42803
- const bridge = createBridgeFromParsed(parsed2);
42804
- const simHint = parsed2.simId ? ` --sim ${parsed2.simId}` : "";
43074
+ const bridge = createBridgeFromParsed(parsed);
43075
+ const simHint = parsed.simId ? ` --sim ${parsed.simId}` : "";
42805
43076
  let fallBackToNewSim = false;
42806
43077
  let navigatedShellUrl = null;
42807
43078
  try {
@@ -42809,22 +43080,22 @@ async function runOpenCommand(args, opts = {}) {
42809
43080
  let targetShellUrl = null;
42810
43081
  try {
42811
43082
  const sims = await bridge.listSims();
42812
- if (parsed2.simIdSource === "saved") {
43083
+ if (parsed.simIdSource === "saved") {
42813
43084
  targetSim = sims.find(
42814
43085
  (sim) => sim.id === savedSimId && sim.readyState === "open" && simUsesDriver(sim, driverId)
42815
43086
  ) ?? null;
42816
43087
  if (!targetSim) {
42817
43088
  clearCurrentSimId();
42818
43089
  }
42819
- } else if (parsed2.simIdSource === "flag") {
42820
- targetSim = resolveTargetSim(sims, parsed2.simId);
43090
+ } else if (parsed.simIdSource === "flag") {
43091
+ targetSim = resolveTargetSim(sims, parsed.simId);
42821
43092
  if (!simUsesDriver(targetSim, driverId)) {
42822
43093
  throw new Error(
42823
43094
  `sim ${targetSim.id} is not managed by the ${driverId} driver`
42824
43095
  );
42825
43096
  }
42826
43097
  }
42827
- if (!targetSim && parsed2.simIdSource !== "flag") {
43098
+ if (!targetSim && parsed.simIdSource !== "flag") {
42828
43099
  targetShellUrl = await buildShellUrl(
42829
43100
  target,
42830
43101
  applyPeachConfigToUrl(baseUrl, runtimeConfig),
@@ -42846,7 +43117,7 @@ async function runOpenCommand(args, opts = {}) {
42846
43117
  }) ?? null;
42847
43118
  }
42848
43119
  if (!targetSim) {
42849
- if (parsed2.simIdSource !== "flag") {
43120
+ if (parsed.simIdSource !== "flag") {
42850
43121
  fallBackToNewSim = true;
42851
43122
  } else {
42852
43123
  throw new Error("no sim connected");
@@ -42881,8 +43152,8 @@ async function runOpenCommand(args, opts = {}) {
42881
43152
  }
42882
43153
  if (!fallBackToNewSim && targetSim && navigatedShellUrl) {
42883
43154
  const navigatedSim = await waitForSimMatch(
42884
- parsed2.wsPort,
42885
- parsed2.commandTimeoutMs,
43155
+ parsed.wsPort,
43156
+ parsed.commandTimeoutMs,
42886
43157
  (sim) => sim.readyState === "open" && simUsesDriver(sim, driverId) && simMatchesToken(sim),
42887
43158
  { attempts: Math.round(30 * flowTimeoutScale()) }
42888
43159
  );
@@ -42899,8 +43170,8 @@ async function runOpenCommand(args, opts = {}) {
42899
43170
  }
42900
43171
  targetSim = navigatedSim;
42901
43172
  const ready = await waitForSimReady(
42902
- parsed2.wsPort,
42903
- parsed2.commandTimeoutMs,
43173
+ parsed.wsPort,
43174
+ parsed.commandTimeoutMs,
42904
43175
  targetSim.id
42905
43176
  );
42906
43177
  if (!ready.bridge) {
@@ -42923,7 +43194,7 @@ async function runOpenCommand(args, opts = {}) {
42923
43194
  "current sim",
42924
43195
  quiet
42925
43196
  );
42926
- await maybeDescribeAfterOpen(parsed2.wsPort, targetSim.id, args);
43197
+ await maybeDescribeAfterOpen(parsed.wsPort, targetSim.id, args);
42927
43198
  printAgentHints(quiet);
42928
43199
  return { simId: targetSim.id, launched: false };
42929
43200
  }
@@ -42955,7 +43226,7 @@ async function runOpenCommand(args, opts = {}) {
42955
43226
  // the shell URL could name a third port, since a bridge with no lockfile
42956
43227
  // resolves back to the default shell URL and that shell may belong to a
42957
43228
  // live world of its own.
42958
- bridgePort: parsed2.wsPort,
43229
+ bridgePort: parsed.wsPort,
42959
43230
  headless: driverHeadless,
42960
43231
  profileId,
42961
43232
  ephemeralProfile,
@@ -42972,8 +43243,8 @@ async function runOpenCommand(args, opts = {}) {
42972
43243
  rnxExit(1);
42973
43244
  }
42974
43245
  const outcome = await waitForSimMatchOrHostExit(
42975
- parsed2.wsPort,
42976
- parsed2.commandTimeoutMs,
43246
+ parsed.wsPort,
43247
+ parsed.commandTimeoutMs,
42977
43248
  simMatchesToken,
42978
43249
  result.pid,
42979
43250
  {
@@ -43013,23 +43284,23 @@ async function runOpenCommand(args, opts = {}) {
43013
43284
  saveCurrentSimId(match.id);
43014
43285
  signalDriverLaunchConnected(result);
43015
43286
  printOpenedSim(openUrl2, match, `${driver.name} driver`, quiet);
43016
- await maybeDescribeAfterOpen(parsed2.wsPort, match.id, args);
43287
+ await maybeDescribeAfterOpen(parsed.wsPort, match.id, args);
43017
43288
  printAgentHints(quiet);
43018
43289
  return { simId: match.id, launched: true };
43019
43290
  }
43020
43291
  async function runUseLikeCommand(args, opts = {}) {
43021
- const parsed2 = parseBridgeCliArgs(args, {
43292
+ const parsed = parseBridgeCliArgs(args, {
43022
43293
  port: opts.port,
43023
43294
  commandTimeoutMs: opts.timeoutMs,
43024
43295
  stripBooleanFlags: ["--force"]
43025
43296
  });
43026
43297
  const force = args.includes("--force");
43027
- const bridge = createBridgeFromParsed(parsed2);
43028
- const simHint = parsed2.simId ? ` --sim ${parsed2.simId}` : "";
43298
+ const bridge = createBridgeFromParsed(parsed);
43299
+ const simHint = parsed.simId ? ` --sim ${parsed.simId}` : "";
43029
43300
  try {
43030
43301
  try {
43031
43302
  const sims = await bridge.listSims();
43032
- const target = resolveTargetSim(sims, parsed2.positional[0] || parsed2.simId);
43303
+ const target = resolveTargetSim(sims, parsed.positional[0] || parsed.simId);
43033
43304
  if (target.lockedBy && !target.lockedByMe && target.lockExpiresAt && target.lockExpiresAt > Date.now()) {
43034
43305
  const secs = Math.max(0, Math.round((target.lockExpiresAt - Date.now()) / 1e3));
43035
43306
  if (target.lockedByKind === "user-active") {
@@ -43070,17 +43341,17 @@ async function runUseCommand(args, opts = {}) {
43070
43341
  await runUseLikeCommand(args, opts);
43071
43342
  }
43072
43343
  async function runClaimCommand(args, opts = {}) {
43073
- const parsed2 = parseBridgeCliArgs(args, {
43344
+ const parsed = parseBridgeCliArgs(args, {
43074
43345
  port: opts.port,
43075
43346
  commandTimeoutMs: opts.timeoutMs,
43076
43347
  stripBooleanFlags: ["--force"]
43077
43348
  });
43078
43349
  const force = args.includes("--force");
43079
- const bridge = createBridgeFromParsed(parsed2);
43350
+ const bridge = createBridgeFromParsed(parsed);
43080
43351
  try {
43081
43352
  try {
43082
43353
  const sims = await bridge.listSims();
43083
- const target = resolveTargetSim(sims, parsed2.positional[0] || parsed2.simId);
43354
+ const target = resolveTargetSim(sims, parsed.positional[0] || parsed.simId);
43084
43355
  const priorHolder = force && target.lockedBy && !target.lockedByMe && target.lockedByKind !== "user-active" ? target.lockedBy : null;
43085
43356
  const result = await bridge.claim(target.id, { force });
43086
43357
  saveCurrentSimId(target.id);
@@ -43191,13 +43462,13 @@ function planBulkCloseTargets(sims, opts) {
43191
43462
  };
43192
43463
  }
43193
43464
  async function runCloseCommand(args, opts = {}) {
43194
- const parsed2 = parseBridgeCliArgs(args, {
43465
+ const parsed = parseBridgeCliArgs(args, {
43195
43466
  port: opts.port,
43196
43467
  commandTimeoutMs: opts.timeoutMs,
43197
43468
  stripBooleanFlags: ["--all", "--others", "--force"]
43198
43469
  });
43199
- const bridge = createBridgeFromParsed(parsed2);
43200
- const simHint = parsed2.simId ? ` --sim ${parsed2.simId}` : "";
43470
+ const bridge = createBridgeFromParsed(parsed);
43471
+ const simHint = parsed.simId ? ` --sim ${parsed.simId}` : "";
43201
43472
  const closeAll = args.includes("--all");
43202
43473
  const closeOthers = args.includes("--others");
43203
43474
  const force = args.includes("--force");
@@ -43205,7 +43476,7 @@ async function runCloseCommand(args, opts = {}) {
43205
43476
  try {
43206
43477
  const sims = await bridge.listSims();
43207
43478
  const savedId = readCurrentSimId();
43208
- const explicitKeepId = parsed2.positional[0] || (parsed2.simIdSource === "flag" ? parsed2.simId : void 0);
43479
+ const explicitKeepId = parsed.positional[0] || (parsed.simIdSource === "flag" ? parsed.simId : void 0);
43209
43480
  const plan = planBulkCloseTargets(sims, {
43210
43481
  closeOthers,
43211
43482
  explicitKeepId,
@@ -43244,8 +43515,8 @@ async function runCloseCommand(args, opts = {}) {
43244
43515
  }
43245
43516
  const result = await closeSimsBulk(
43246
43517
  bridge,
43247
- parsed2.wsPort,
43248
- parsed2.commandTimeoutMs,
43518
+ parsed.wsPort,
43519
+ parsed.commandTimeoutMs,
43249
43520
  plan.targets
43250
43521
  );
43251
43522
  await terminatePlaywrightHostsForSims(sims, plan.targets);
@@ -43272,14 +43543,14 @@ async function runCloseCommand(args, opts = {}) {
43272
43543
  try {
43273
43544
  try {
43274
43545
  const sims = await bridge.listSims();
43275
- const target = resolveTargetSim(sims, parsed2.positional[0] || parsed2.simId);
43546
+ const target = resolveTargetSim(sims, parsed.positional[0] || parsed.simId);
43276
43547
  const fallbackTarget = sims.find(
43277
43548
  (sim) => sim.id !== target.id && sim.readyState === "open"
43278
43549
  );
43279
43550
  await bridge.closeSim(target.id);
43280
43551
  const closed = await waitForSimGone(
43281
- parsed2.wsPort,
43282
- parsed2.commandTimeoutMs,
43552
+ parsed.wsPort,
43553
+ parsed.commandTimeoutMs,
43283
43554
  target.id
43284
43555
  );
43285
43556
  if (!closed) {
@@ -43824,7 +44095,8 @@ async function waitForSootsimIdle({
43824
44095
  const start = Date.now()
43825
44096
  const deadline = start + ${Math.max(0, Math.round(maxMs))}
43826
44097
  const pollMs = ${Math.max(1, Math.round(pollMs))}
43827
- const requiredStablePolls = ${Math.max(1, Math.round(stablePolls))}
44098
+ const requiredStillMs = ${Math.max(1, Math.round(stablePolls)) * Math.max(1, Math.round(pollMs))}
44099
+ const minimumStablePolls = ${Math.min(2, Math.max(1, Math.round(stablePolls)))}
43828
44100
  const strict = ${strict ? "true" : "false"}
43829
44101
  const paintStill = ${paintStill ? "true" : "false"}
43830
44102
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
@@ -43964,7 +44236,8 @@ async function waitForSootsimIdle({
43964
44236
  // network is genuinely quiet OR it has refused to quiet within the
43965
44237
  // grace (continuous background traffic must not block forever).
43966
44238
  if (
43967
- stable >= requiredStablePolls &&
44239
+ stable >= minimumStablePolls &&
44240
+ Date.now() - visuallyStillSince >= requiredStillMs &&
43968
44241
  (networkQuiet || Date.now() - visuallyStillSince >= networkQuietGraceMs)
43969
44242
  ) {
43970
44243
  return { settled: true, elapsed: Date.now() - start, blockedBy: '' }
@@ -44125,15 +44398,15 @@ function executeSyncHttp(url, method, params) {
44125
44398
  if (child.error) {
44126
44399
  throw new Error(`http ${method} ${url} failed: ${child.error.message}`);
44127
44400
  }
44128
- let parsed2;
44401
+ let parsed;
44129
44402
  try {
44130
- parsed2 = JSON.parse(child.stdout || "");
44403
+ parsed = JSON.parse(child.stdout || "");
44131
44404
  } catch {
44132
44405
  throw new Error(
44133
44406
  `http ${method} ${url} failed: no response (${(child.stderr || "").trim().slice(0, 200)})`
44134
44407
  );
44135
44408
  }
44136
- const result = parsed2;
44409
+ const result = parsed;
44137
44410
  if (result.__error) {
44138
44411
  throw new Error(`http ${method} ${url} failed: ${result.__error}`);
44139
44412
  }
@@ -47132,16 +47405,16 @@ var skill2 = {
47132
47405
  if (!fs30.existsSync(packagePath)) {
47133
47406
  return { success: false, message: "No package.json found" };
47134
47407
  }
47135
- const parsed2 = JSON.parse(fs30.readFileSync(packagePath, "utf8"));
47136
- if (!parsed2 || typeof parsed2 !== "object") {
47408
+ const parsed = JSON.parse(fs30.readFileSync(packagePath, "utf8"));
47409
+ if (!parsed || typeof parsed !== "object") {
47137
47410
  return { success: false, message: "package.json is not an object" };
47138
47411
  }
47139
- const dependencies = readDependencies(parsed2);
47412
+ const dependencies = readDependencies(parsed);
47140
47413
  const scan = params.packageName ? scanDeps2({
47141
47414
  dependencies: {
47142
47415
  [params.packageName]: dependencies[params.packageName] ?? "*"
47143
47416
  }
47144
- }) : scanDeps2(parsed2);
47417
+ }) : scanDeps2(parsed);
47145
47418
  const packageResult = params.packageName ? scan.packages[0] : void 0;
47146
47419
  const message = packageResult ? `${params.packageName}: ${formatPackageStatus2(packageResult)}. ${COMPAT_RESULT_CAVEAT2}` : `${formatScanCounts2(scan)}. ${COMPAT_RESULT_CAVEAT2}`;
47147
47420
  const reportPath = path33.join(context.outputDir, "compat-report.json");