peachsim 0.1.758 → 0.1.759

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/agent-identity.cjs +1 -1
  4. package/dist-lib/agent-sessions.cjs +1 -1
  5. package/dist-lib/attached-projects.cjs +1 -1
  6. package/dist-lib/auth/shared-session.cjs +1 -1
  7. package/dist-lib/backend-origin.cjs +1 -1
  8. package/dist-lib/beta.cjs +1 -1
  9. package/dist-lib/beta.mjs +1 -1
  10. package/dist-lib/bridge-constants.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.mjs +1 -1
  13. package/dist-lib/bridge-contract.cjs +1 -1
  14. package/dist-lib/bridge-contract.mjs +1 -1
  15. package/dist-lib/capture-contract.cjs +1 -1
  16. package/dist-lib/capture-contract.mjs +1 -1
  17. package/dist-lib/cli-constants.cjs +1 -1
  18. package/dist-lib/cloud-contract.cjs +1 -1
  19. package/dist-lib/cloud-contract.mjs +1 -1
  20. package/dist-lib/cloud-test-args.cjs +1 -1
  21. package/dist-lib/cloud-test-args.mjs +1 -1
  22. package/dist-lib/cloud.cjs +1 -1
  23. package/dist-lib/cloud.mjs +1 -1
  24. package/dist-lib/config.cjs +1 -1
  25. package/dist-lib/detox/index.cjs +1 -1
  26. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  27. package/dist-lib/home-paths.cjs +1 -1
  28. package/dist-lib/host/bridge-host.cjs +729 -371
  29. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  30. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  31. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  32. package/dist-lib/host/replacement-module-handler.cjs +2 -4
  33. package/dist-lib/host/websocket-proxy.cjs +1 -1
  34. package/dist-lib/index.cjs +495 -139
  35. package/dist-lib/jump-to-source-babel.cjs +1 -1
  36. package/dist-lib/jump-to-source-native.cjs +1 -1
  37. package/dist-lib/kotlin-host.cjs +1 -1
  38. package/dist-lib/menu.cjs +1 -1
  39. package/dist-lib/menu.mjs +1 -1
  40. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  41. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  42. package/dist-lib/metro-production-bundle.cjs +1 -1
  43. package/dist-lib/metro-production-bundle.mjs +1 -1
  44. package/dist-lib/metro.cjs +466 -110
  45. package/dist-lib/native-app-identity.cjs +1 -1
  46. package/dist-lib/native-app-identity.mjs +1 -1
  47. package/dist-lib/native-firebase-metadata.cjs +1 -1
  48. package/dist-lib/native-firebase-metadata.mjs +1 -1
  49. package/dist-lib/plist.cjs +1 -1
  50. package/dist-lib/plist.mjs +1 -1
  51. package/dist-lib/profiles.cjs +1 -1
  52. package/dist-lib/public-brand.cjs +1 -1
  53. package/dist-lib/react-native-host-modules.cjs +1 -1
  54. package/dist-lib/react-native-host-modules.mjs +1 -1
  55. package/dist-lib/render-mode.cjs +1 -1
  56. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  57. package/dist-lib/sdk.cjs +1 -1
  58. package/dist-lib/sdk.mjs +1 -1
  59. package/dist-lib/skills.cjs +920 -557
  60. package/dist-lib/swift-compile.cjs +1 -1
  61. package/dist-lib/swift-compile.mjs +1 -1
  62. package/dist-lib/swift-package.cjs +1 -1
  63. package/dist-lib/swift-package.mjs +1 -1
  64. package/dist-lib/swift-submit.cjs +1 -1
  65. package/dist-lib/swift-submit.mjs +1 -1
  66. package/dist-lib/swift-toolchain.cjs +1 -1
  67. package/dist-lib/swift.cjs +1 -1
  68. package/dist-lib/vite-swift.cjs +539 -179
  69. package/dist-lib/vite.cjs +2 -4
  70. package/package.json +1 -1
  71. package/src/host/replacement-module-handler.ts +2 -1
  72. package/src/swift-host.ts +4 -2
  73. package/src/xcode-json-project.ts +450 -0
  74. package/src/xcode-project.ts +55 -22
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.758 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.759 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -2156,35 +2156,35 @@ function identifierStart(character) {
2156
2156
  function identifierPart(character) {
2157
2157
  return character != null && /[A-Za-z0-9_$]/.test(character);
2158
2158
  }
2159
- function skipLineComment(text, start, end) {
2159
+ function skipLineComment(text2, start, end) {
2160
2160
  let cursor = start + 2;
2161
- while (cursor < end && text[cursor] !== "\n" && text[cursor] !== "\r") cursor++;
2161
+ while (cursor < end && text2[cursor] !== "\n" && text2[cursor] !== "\r") cursor++;
2162
2162
  return cursor;
2163
2163
  }
2164
- function skipBlockComment(text, start, end) {
2165
- const close = text.indexOf("*/", start + 2);
2164
+ function skipBlockComment(text2, start, end) {
2165
+ const close = text2.indexOf("*/", start + 2);
2166
2166
  return close === -1 || close >= end ? end : close + 2;
2167
2167
  }
2168
- function skipTrivia(text, start, end) {
2168
+ function skipTrivia(text2, start, end) {
2169
2169
  let cursor = start;
2170
2170
  for (; ; ) {
2171
- while (cursor < end && /\s/.test(text[cursor] ?? "")) cursor++;
2172
- if (text[cursor] === "/" && text[cursor + 1] === "/") {
2173
- cursor = skipLineComment(text, cursor, end);
2171
+ while (cursor < end && /\s/.test(text2[cursor] ?? "")) cursor++;
2172
+ if (text2[cursor] === "/" && text2[cursor + 1] === "/") {
2173
+ cursor = skipLineComment(text2, cursor, end);
2174
2174
  continue;
2175
2175
  }
2176
- if (text[cursor] === "/" && text[cursor + 1] === "*") {
2177
- cursor = skipBlockComment(text, cursor, end);
2176
+ if (text2[cursor] === "/" && text2[cursor + 1] === "*") {
2177
+ cursor = skipBlockComment(text2, cursor, end);
2178
2178
  continue;
2179
2179
  }
2180
2180
  return cursor;
2181
2181
  }
2182
2182
  }
2183
- function quotedEnd(text, start, end) {
2184
- const quote = text[start];
2183
+ function quotedEnd(text2, start, end) {
2184
+ const quote = text2[start];
2185
2185
  let cursor = start + 1;
2186
2186
  while (cursor < end) {
2187
- const character = text[cursor];
2187
+ const character = text2[cursor];
2188
2188
  if (character === "\\") {
2189
2189
  cursor += 2;
2190
2190
  continue;
@@ -2243,38 +2243,38 @@ function decodeSingleQuoted(contents) {
2243
2243
  }
2244
2244
  return value;
2245
2245
  }
2246
- function readQuoted(text, start, end) {
2247
- const quote = text[start];
2246
+ function readQuoted(text2, start, end) {
2247
+ const quote = text2[start];
2248
2248
  if (quote !== '"' && quote !== "'") return null;
2249
- const after = quotedEnd(text, start, end);
2250
- if (after > end || text[after - 1] !== quote) return null;
2251
- const contents = text.slice(start + 1, after - 1);
2249
+ const after = quotedEnd(text2, start, end);
2250
+ if (after > end || text2[after - 1] !== quote) return null;
2251
+ const contents = text2.slice(start + 1, after - 1);
2252
2252
  if (quote === "'") {
2253
2253
  const value = decodeSingleQuoted(contents);
2254
2254
  return value == null ? null : { value, end: after };
2255
2255
  }
2256
2256
  try {
2257
- const value = JSON.parse(text.slice(start, after));
2257
+ const value = JSON.parse(text2.slice(start, after));
2258
2258
  return typeof value === "string" ? { value, end: after } : null;
2259
2259
  } catch {
2260
2260
  return null;
2261
2261
  }
2262
2262
  }
2263
- function skipTemplate(text, start, end) {
2263
+ function skipTemplate(text2, start, end) {
2264
2264
  let cursor = start + 1;
2265
2265
  while (cursor < end) {
2266
- const character = text[cursor];
2266
+ const character = text2[cursor];
2267
2267
  if (character === "\\") cursor += 2;
2268
2268
  else if (character === "`") return cursor + 1;
2269
2269
  else cursor++;
2270
2270
  }
2271
2271
  return end;
2272
2272
  }
2273
- function skipRegex(text, start, end) {
2273
+ function skipRegex(text2, start, end) {
2274
2274
  let cursor = start + 1;
2275
2275
  let inClass = false;
2276
2276
  while (cursor < end) {
2277
- const character = text[cursor];
2277
+ const character = text2[cursor];
2278
2278
  if (character === "\\") cursor += 2;
2279
2279
  else if (character === "[") {
2280
2280
  inClass = true;
@@ -2284,7 +2284,7 @@ function skipRegex(text, start, end) {
2284
2284
  cursor++;
2285
2285
  } else if (character === "/" && !inClass) {
2286
2286
  cursor++;
2287
- while (/[A-Za-z]/.test(text[cursor] ?? "")) cursor++;
2287
+ while (/[A-Za-z]/.test(text2[cursor] ?? "")) cursor++;
2288
2288
  return cursor;
2289
2289
  } else if (character === "\n" || character === "\r") {
2290
2290
  return cursor;
@@ -2292,43 +2292,43 @@ function skipRegex(text, start, end) {
2292
2292
  }
2293
2293
  return end;
2294
2294
  }
2295
- function readStringArray(text, start, end) {
2296
- if (text[start] !== "[") return null;
2295
+ function readStringArray(text2, start, end) {
2296
+ if (text2[start] !== "[") return null;
2297
2297
  const values = [];
2298
2298
  let cursor = start + 1;
2299
2299
  for (; ; ) {
2300
- cursor = skipTrivia(text, cursor, end);
2301
- if (text[cursor] === "]") return { values, end: cursor + 1 };
2302
- const parsed = readQuoted(text, cursor, end);
2300
+ cursor = skipTrivia(text2, cursor, end);
2301
+ if (text2[cursor] === "]") return { values, end: cursor + 1 };
2302
+ const parsed = readQuoted(text2, cursor, end);
2303
2303
  if (!parsed) return null;
2304
2304
  values.push(parsed.value);
2305
- cursor = skipTrivia(text, parsed.end, end);
2306
- if (text[cursor] === "]") return { values, end: cursor + 1 };
2307
- if (text[cursor] !== ",") return null;
2305
+ cursor = skipTrivia(text2, parsed.end, end);
2306
+ if (text2[cursor] === "]") return { values, end: cursor + 1 };
2307
+ if (text2[cursor] !== ",") return null;
2308
2308
  cursor++;
2309
2309
  }
2310
2310
  }
2311
- function readNumberArray(text, start, end) {
2312
- if (text[start] !== "[") return null;
2311
+ function readNumberArray(text2, start, end) {
2312
+ if (text2[start] !== "[") return null;
2313
2313
  const values = [];
2314
2314
  let cursor = start + 1;
2315
2315
  for (; ; ) {
2316
- cursor = skipTrivia(text, cursor, end);
2317
- if (text[cursor] === "]") return { values, end: cursor + 1 };
2316
+ cursor = skipTrivia(text2, cursor, end);
2317
+ if (text2[cursor] === "]") return { values, end: cursor + 1 };
2318
2318
  const match = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/i.exec(
2319
- text.slice(cursor, end)
2319
+ text2.slice(cursor, end)
2320
2320
  );
2321
2321
  if (!match) return null;
2322
2322
  const value = Number(match[0]);
2323
2323
  if (!Number.isFinite(value)) return null;
2324
2324
  values.push(value);
2325
- cursor = skipTrivia(text, cursor + match[0].length, end);
2326
- if (text[cursor] === "]") return { values, end: cursor + 1 };
2327
- if (text[cursor] !== ",") return null;
2325
+ cursor = skipTrivia(text2, cursor + match[0].length, end);
2326
+ if (text2[cursor] === "]") return { values, end: cursor + 1 };
2327
+ if (text2[cursor] !== ",") return null;
2328
2328
  cursor++;
2329
2329
  }
2330
2330
  }
2331
- function readDescriptorObject(text, start, end, pairSpans) {
2331
+ function readDescriptorObject(text2, start, end, pairSpans) {
2332
2332
  const strings = {};
2333
2333
  let scales;
2334
2334
  let fileUris;
@@ -2339,27 +2339,27 @@ function readDescriptorObject(text, start, end, pairSpans) {
2339
2339
  let parenDepth = 0;
2340
2340
  let canStartRegex = true;
2341
2341
  while (cursor < end - 1) {
2342
- cursor = skipTrivia(text, cursor, end - 1);
2343
- const character = text[cursor];
2342
+ cursor = skipTrivia(text2, cursor, end - 1);
2343
+ const character = text2[cursor];
2344
2344
  if (character == null) break;
2345
2345
  if (braceDepth === 1 && bracketDepth === 0 && parenDepth === 0) {
2346
2346
  let key = null;
2347
2347
  const pairStart = cursor;
2348
2348
  let afterKey = cursor;
2349
- const quoted = readQuoted(text, cursor, end - 1);
2349
+ const quoted = readQuoted(text2, cursor, end - 1);
2350
2350
  if (quoted) {
2351
2351
  key = quoted.value;
2352
2352
  afterKey = quoted.end;
2353
2353
  } else if (identifierStart(character)) {
2354
2354
  afterKey++;
2355
- while (identifierPart(text[afterKey])) afterKey++;
2356
- key = text.slice(cursor, afterKey);
2355
+ while (identifierPart(text2[afterKey])) afterKey++;
2356
+ key = text2.slice(cursor, afterKey);
2357
2357
  }
2358
- const colon = key == null ? afterKey : skipTrivia(text, afterKey, end - 1);
2359
- if (key != null && text[colon] === ":") {
2360
- const valueStart = skipTrivia(text, colon + 1, end - 1);
2358
+ const colon = key == null ? afterKey : skipTrivia(text2, afterKey, end - 1);
2359
+ if (key != null && text2[colon] === ":") {
2360
+ const valueStart = skipTrivia(text2, colon + 1, end - 1);
2361
2361
  if (key === "httpServerLocation" || key === "name" || key === "type" || key === "hash") {
2362
- const value = readQuoted(text, valueStart, end - 1);
2362
+ const value = readQuoted(text2, valueStart, end - 1);
2363
2363
  if (!value) return null;
2364
2364
  strings[key] = value.value;
2365
2365
  cursor = value.end;
@@ -2367,7 +2367,7 @@ function readDescriptorObject(text, start, end, pairSpans) {
2367
2367
  continue;
2368
2368
  }
2369
2369
  if (key === "scales") {
2370
- const value = readNumberArray(text, valueStart, end - 1);
2370
+ const value = readNumberArray(text2, valueStart, end - 1);
2371
2371
  if (!value) return null;
2372
2372
  scales = value.values;
2373
2373
  if (pairSpans) pairSpans.scales = { start: pairStart, end: value.end };
@@ -2376,7 +2376,7 @@ function readDescriptorObject(text, start, end, pairSpans) {
2376
2376
  continue;
2377
2377
  }
2378
2378
  if (key === "fileUris" || key === "fileHashes") {
2379
- const value = readStringArray(text, valueStart, end - 1);
2379
+ const value = readStringArray(text2, valueStart, end - 1);
2380
2380
  if (!value) return null;
2381
2381
  if (key === "fileUris") fileUris = value.values;
2382
2382
  else fileHashes = value.values;
@@ -2388,24 +2388,24 @@ function readDescriptorObject(text, start, end, pairSpans) {
2388
2388
  }
2389
2389
  }
2390
2390
  if (character === '"' || character === "'") {
2391
- cursor = quotedEnd(text, cursor, end - 1);
2391
+ cursor = quotedEnd(text2, cursor, end - 1);
2392
2392
  canStartRegex = false;
2393
2393
  continue;
2394
2394
  }
2395
2395
  if (character === "`") {
2396
- cursor = skipTemplate(text, cursor, end - 1);
2396
+ cursor = skipTemplate(text2, cursor, end - 1);
2397
2397
  canStartRegex = false;
2398
2398
  continue;
2399
2399
  }
2400
2400
  if (character === "/" && canStartRegex) {
2401
- cursor = skipRegex(text, cursor, end - 1);
2401
+ cursor = skipRegex(text2, cursor, end - 1);
2402
2402
  canStartRegex = false;
2403
2403
  continue;
2404
2404
  }
2405
2405
  if (identifierStart(character)) {
2406
2406
  const tokenStart = cursor++;
2407
- while (identifierPart(text[cursor])) cursor++;
2408
- canStartRegex = EXPRESSION_KEYWORDS.has(text.slice(tokenStart, cursor));
2407
+ while (identifierPart(text2[cursor])) cursor++;
2408
+ canStartRegex = EXPRESSION_KEYWORDS.has(text2.slice(tokenStart, cursor));
2409
2409
  continue;
2410
2410
  }
2411
2411
  if (character === "{") braceDepth++;
@@ -2689,8 +2689,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
2689
2689
  }
2690
2690
  const out = [];
2691
2691
  for (const dir of dirs) {
2692
- const path20 = `${dir}/${filename}`;
2693
- if (!out.includes(path20)) out.push(path20);
2692
+ const path21 = `${dir}/${filename}`;
2693
+ if (!out.includes(path21)) out.push(path21);
2694
2694
  }
2695
2695
  if (!out.includes(filename)) out.push(filename);
2696
2696
  return out;
@@ -2820,10 +2820,10 @@ async function embedMetroAssetFiles(bundle, read) {
2820
2820
  }
2821
2821
  };
2822
2822
  }
2823
- function countNewlines(text) {
2823
+ function countNewlines(text2) {
2824
2824
  let total = 0;
2825
- for (let index = 0; index < text.length; index++) {
2826
- if (text.charCodeAt(index) === 10) total++;
2825
+ for (let index = 0; index < text2.length; index++) {
2826
+ if (text2.charCodeAt(index) === 10) total++;
2827
2827
  }
2828
2828
  return total;
2829
2829
  }
@@ -2999,10 +2999,10 @@ function encodedAssetBytes(bundle) {
2999
2999
  }
3000
3000
  return total;
3001
3001
  }
3002
- function countLines(text) {
3002
+ function countLines(text2) {
3003
3003
  let lines = 0;
3004
- for (let index = 0; index < text.length; index++) {
3005
- if (text.charCodeAt(index) === 10) lines++;
3004
+ for (let index = 0; index < text2.length; index++) {
3005
+ if (text2.charCodeAt(index) === 10) lines++;
3006
3006
  }
3007
3007
  return lines;
3008
3008
  }
@@ -3051,14 +3051,14 @@ async function buildRnxCloudArtifact(bundle, options = {}) {
3051
3051
  const pieces = await Promise.all([
3052
3052
  minify(layout.prelude, 0, MINIFY_OPTIONS, development),
3053
3053
  ...layout.statements.map((statement) => {
3054
- const text = identity.source.slice(statement.start, statement.end);
3054
+ const text2 = identity.source.slice(statement.start, statement.end);
3055
3055
  return statement.kind === "define" ? minifyDefine(
3056
- text,
3056
+ text2,
3057
3057
  statement.moduleId,
3058
3058
  statement.lineIndex,
3059
3059
  MINIFY_OPTIONS,
3060
3060
  development
3061
- ) : minify(text, statement.lineIndex, MINIFY_OPTIONS, development);
3061
+ ) : minify(text2, statement.lineIndex, MINIFY_OPTIONS, development);
3062
3062
  })
3063
3063
  ]);
3064
3064
  const body = pieces.map((piece) => piece.code).join("\n");
@@ -3644,13 +3644,13 @@ function readFactoryStringLiterals(factory) {
3644
3644
  return literals;
3645
3645
  }
3646
3646
  function normalizeFingerprintLiteral(literal) {
3647
- const path20 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
3647
+ const path21 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
3648
3648
  const nodeModulesMarker = "/node_modules/";
3649
- const nodeModulesIndex = path20.lastIndexOf(nodeModulesMarker);
3649
+ const nodeModulesIndex = path21.lastIndexOf(nodeModulesMarker);
3650
3650
  if (nodeModulesIndex >= 0) {
3651
- return `node_modules/${path20.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
3651
+ return `node_modules/${path21.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
3652
3652
  }
3653
- if ((path20.startsWith("/") || /^[A-Za-z]:\//.test(path20) || path20.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path20)) {
3653
+ if ((path21.startsWith("/") || /^[A-Za-z]:\//.test(path21) || path21.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path21)) {
3654
3654
  return null;
3655
3655
  }
3656
3656
  return literal;
@@ -3888,10 +3888,10 @@ function templateAssignment(template, embeddings) {
3888
3888
  if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
3889
3889
  nodesByModuleId.set(moduleId, nodeIndex);
3890
3890
  const node = template.nodes[nodeIndex];
3891
- const path20 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
3891
+ const path21 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
3892
3892
  const existingPath = pathsByModuleId.get(moduleId);
3893
- if (existingPath !== void 0 && existingPath !== path20) return null;
3894
- pathsByModuleId.set(moduleId, path20);
3893
+ if (existingPath !== void 0 && existingPath !== path21) return null;
3894
+ pathsByModuleId.set(moduleId, path21);
3895
3895
  }
3896
3896
  }
3897
3897
  return {
@@ -4053,14 +4053,14 @@ async function inferMetroModuleIdentity(args) {
4053
4053
  const packageClaims = claimsByPackage.values().next().value;
4054
4054
  if (!packageClaims) continue;
4055
4055
  const exactClaims = packageClaims.filter((assignment2) => {
4056
- const path20 = assignment2.pathsByModuleId.get(moduleId);
4057
- return path20 !== void 0 && !path20.includes("/__rnx_inferred__/");
4056
+ const path21 = assignment2.pathsByModuleId.get(moduleId);
4057
+ return path21 !== void 0 && !path21.includes("/__rnx_inferred__/");
4058
4058
  });
4059
4059
  const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
4060
4060
  const routes = new Set(
4061
4061
  preferredClaims.flatMap((assignment2) => {
4062
- const path20 = assignment2.pathsByModuleId.get(moduleId);
4063
- return path20 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path20)] : [];
4062
+ const path21 = assignment2.pathsByModuleId.get(moduleId);
4063
+ return path21 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path21)] : [];
4064
4064
  })
4065
4065
  );
4066
4066
  if (routes.size !== 1) continue;
@@ -4260,7 +4260,7 @@ function detectFramework(deps) {
4260
4260
  return "unknown";
4261
4261
  }
4262
4262
  function detectProject(dir) {
4263
- const pkgPath = (0, import_node_path24.join)(dir, "package.json");
4263
+ const pkgPath = (0, import_node_path25.join)(dir, "package.json");
4264
4264
  if (!(0, import_node_fs24.existsSync)(pkgPath)) return null;
4265
4265
  const pkg = readProjectManifest(dir);
4266
4266
  if (!pkg) return null;
@@ -4273,25 +4273,25 @@ function detectProject(dir) {
4273
4273
  if (framework === "unknown") return null;
4274
4274
  return {
4275
4275
  dir,
4276
- name: pkg.name || (0, import_node_path24.basename)(dir),
4276
+ name: pkg.name || (0, import_node_path25.basename)(dir),
4277
4277
  framework,
4278
4278
  // a config file is a config file whatever module system it declares. real
4279
4279
  // apps write .cjs as often as .js, and missing one reads as "this project
4280
4280
  // has no bundler config" and sends the user to create a second one.
4281
4281
  hasViteConfig: CONFIG_EXTENSIONS.some(
4282
- (ext) => (0, import_node_fs24.existsSync)((0, import_node_path24.join)(dir, `vite.config.${ext}`))
4282
+ (ext) => (0, import_node_fs24.existsSync)((0, import_node_path25.join)(dir, `vite.config.${ext}`))
4283
4283
  ),
4284
4284
  hasMetroConfig: CONFIG_EXTENSIONS.some(
4285
- (ext) => (0, import_node_fs24.existsSync)((0, import_node_path24.join)(dir, `metro.config.${ext}`))
4285
+ (ext) => (0, import_node_fs24.existsSync)((0, import_node_path25.join)(dir, `metro.config.${ext}`))
4286
4286
  ),
4287
4287
  devCommand: typeof devCommand === "string" ? devCommand : null
4288
4288
  };
4289
4289
  }
4290
- function readProjectMetadata(path20) {
4290
+ function readProjectMetadata(path21) {
4291
4291
  try {
4292
- const info = (0, import_node_fs24.lstatSync)(path20);
4292
+ const info = (0, import_node_fs24.lstatSync)(path21);
4293
4293
  if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
4294
- return (0, import_node_fs24.readFileSync)(path20, "utf8");
4294
+ return (0, import_node_fs24.readFileSync)(path21, "utf8");
4295
4295
  } catch {
4296
4296
  return null;
4297
4297
  }
@@ -4300,18 +4300,18 @@ function metadataValue(value, key) {
4300
4300
  if (!value || typeof value !== "object") return void 0;
4301
4301
  return Object.getOwnPropertyDescriptor(value, key)?.value;
4302
4302
  }
4303
- function readProjectJson(path20) {
4304
- const text = readProjectMetadata(path20);
4305
- if (text === null) return null;
4303
+ function readProjectJson(path21) {
4304
+ const text2 = readProjectMetadata(path21);
4305
+ if (text2 === null) return null;
4306
4306
  try {
4307
- const value = JSON.parse(text);
4307
+ const value = JSON.parse(text2);
4308
4308
  return value;
4309
4309
  } catch {
4310
4310
  return null;
4311
4311
  }
4312
4312
  }
4313
4313
  function readProjectManifest(dir) {
4314
- const parsed = readProjectJson((0, import_node_path24.join)(dir, "package.json"));
4314
+ const parsed = readProjectJson((0, import_node_path25.join)(dir, "package.json"));
4315
4315
  if (!parsed || typeof parsed !== "object") return null;
4316
4316
  const record = (value) => {
4317
4317
  if (!value || typeof value !== "object") return {};
@@ -4328,23 +4328,23 @@ function readProjectManifest(dir) {
4328
4328
  devDependencies: record(metadataValue(parsed, "devDependencies"))
4329
4329
  };
4330
4330
  }
4331
- var import_node_fs24, import_node_path24, import_json5, import_yaml, CONFIG_EXTENSIONS;
4331
+ var import_node_fs24, import_node_path25, import_json52, import_yaml, CONFIG_EXTENSIONS;
4332
4332
  var init_detect = __esm({
4333
4333
  "cli/commands/detect.ts"() {
4334
4334
  "use strict";
4335
4335
  import_node_fs24 = require("node:fs");
4336
- import_node_path24 = require("node:path");
4337
- import_json5 = __toESM(require("json5"), 1);
4336
+ import_node_path25 = require("node:path");
4337
+ import_json52 = __toESM(require("json5"), 1);
4338
4338
  import_yaml = require("yaml");
4339
4339
  CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
4340
4340
  }
4341
4341
  });
4342
4342
 
4343
4343
  // cli/cloud-client.ts
4344
- function failureSentence(text) {
4344
+ function failureSentence(text2) {
4345
4345
  let parsed;
4346
4346
  try {
4347
- parsed = JSON.parse(text);
4347
+ parsed = JSON.parse(text2);
4348
4348
  } catch {
4349
4349
  return null;
4350
4350
  }
@@ -4357,11 +4357,11 @@ function failureSentence(text) {
4357
4357
  if (typeof parsed.error === "string") return parsed.error;
4358
4358
  return null;
4359
4359
  }
4360
- function responseError(status, text) {
4361
- const parsed = text ? failureSentence(text) : null;
4360
+ function responseError(status, text2) {
4361
+ const parsed = text2 ? failureSentence(text2) : null;
4362
4362
  const sentence = parsed && ACCOUNT_CHOICE_REFUSALS.has(parsed) ? CHOOSE_ACCOUNT_HINT : parsed;
4363
4363
  return new Error(
4364
- `remote simulator request failed (${status})${sentence ? `: ${sentence}` : text.trim() ? `: ${text.trim()}` : ""}`
4364
+ `remote simulator request failed (${status})${sentence ? `: ${sentence}` : text2.trim() ? `: ${text2.trim()}` : ""}`
4365
4365
  );
4366
4366
  }
4367
4367
  function resolveCloudOrigin(value) {
@@ -4370,8 +4370,8 @@ function resolveCloudOrigin(value) {
4370
4370
  return normalizeCloudOrigin(source);
4371
4371
  }
4372
4372
  function readImmutableBundleSource(bundlePath) {
4373
- const filepath = (0, import_node_path25.resolve)(bundlePath);
4374
- if ((0, import_node_path25.extname)(filepath) !== ".js") {
4373
+ const filepath = (0, import_node_path26.resolve)(bundlePath);
4374
+ if ((0, import_node_path26.extname)(filepath) !== ".js") {
4375
4375
  throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
4376
4376
  }
4377
4377
  const descriptor = (0, import_node_fs25.openSync)(filepath, "r");
@@ -4416,14 +4416,14 @@ async function fetchBundleSource(bundleUrl) {
4416
4416
  `${REMOTE_COMMAND} could not fetch bundle from ${bundleUrl}: HTTP ${response.status}${response.statusText ? ` ${response.statusText}` : ""}`
4417
4417
  );
4418
4418
  }
4419
- const text = await response.text();
4420
- if (text.length === 0) {
4419
+ const text2 = await response.text();
4420
+ if (text2.length === 0) {
4421
4421
  throw new Error(`${REMOTE_COMMAND} bundle is empty`);
4422
4422
  }
4423
- if (text.includes("\0") || !text.includes("__d(") || !text.includes("__r(")) {
4423
+ if (text2.includes("\0") || !text2.includes("__d(") || !text2.includes("__r(")) {
4424
4424
  throw new Error(`${REMOTE_COMMAND} requires a Metro JavaScript bundle`);
4425
4425
  }
4426
- return text;
4426
+ return text2;
4427
4427
  }
4428
4428
  function isLoopbackBundleUrl(bundleInput) {
4429
4429
  if (!bundleInput.startsWith("http://")) return false;
@@ -4446,9 +4446,9 @@ async function loadBundleSource(bundleInput) {
4446
4446
  return readImmutableBundleSource(bundleInput);
4447
4447
  }
4448
4448
  function listMetroAssetDest(assetsPath) {
4449
- const directory = (0, import_node_path25.resolve)(assetsPath);
4449
+ const directory = (0, import_node_path26.resolve)(assetsPath);
4450
4450
  if (!(0, import_node_fs25.existsSync)(directory)) return { directory, files: [], truncated: false };
4451
- const skipNested = (0, import_node_fs25.existsSync)((0, import_node_path25.join)(directory, "package.json"));
4451
+ const skipNested = (0, import_node_fs25.existsSync)((0, import_node_path26.join)(directory, "package.json"));
4452
4452
  const files = [];
4453
4453
  let truncated = false;
4454
4454
  const walk2 = (dir, prefix) => {
@@ -4466,7 +4466,7 @@ function listMetroAssetDest(assetsPath) {
4466
4466
  if (entry.isDirectory()) {
4467
4467
  if (entry.name === ".git") continue;
4468
4468
  if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
4469
- walk2((0, import_node_path25.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
4469
+ walk2((0, import_node_path26.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
4470
4470
  } else if (entry.isFile()) {
4471
4471
  files.push(prefix ? `${prefix}/${entry.name}` : entry.name);
4472
4472
  }
@@ -4501,7 +4501,7 @@ function distinctByContent(directory, options) {
4501
4501
  for (const relative2 of options) {
4502
4502
  let bytes;
4503
4503
  try {
4504
- bytes = (0, import_node_fs25.readFileSync)((0, import_node_path25.join)(directory, relative2));
4504
+ bytes = (0, import_node_fs25.readFileSync)((0, import_node_path26.join)(directory, relative2));
4505
4505
  } catch {
4506
4506
  continue;
4507
4507
  }
@@ -4533,7 +4533,7 @@ function placeMetroDescriptor(listing, descriptor) {
4533
4533
  let bytes;
4534
4534
  try {
4535
4535
  bytes = combination.map(
4536
- (relative2) => (0, import_node_fs25.readFileSync)((0, import_node_path25.join)(listing.directory, relative2))
4536
+ (relative2) => (0, import_node_fs25.readFileSync)((0, import_node_path26.join)(listing.directory, relative2))
4537
4537
  );
4538
4538
  } catch {
4539
4539
  continue;
@@ -4561,7 +4561,7 @@ function unverifiedContentKey(dest, fileDigests) {
4561
4561
  return JSON.stringify(
4562
4562
  dest.placements.map(
4563
4563
  (placement) => placement.verified ? null : [...placement.files].map(([scale, relative2]) => {
4564
- const file = (0, import_node_path25.join)(dest.directory, relative2);
4564
+ const file = (0, import_node_path26.join)(dest.directory, relative2);
4565
4565
  let digest = fileDigests.get(file);
4566
4566
  if (digest === void 0) {
4567
4567
  digest = (0, import_node_crypto11.createHash)("sha256").update((0, import_node_fs25.readFileSync)(file)).digest("hex");
@@ -4573,22 +4573,22 @@ function unverifiedContentKey(dest, fileDigests) {
4573
4573
  );
4574
4574
  }
4575
4575
  function searchMetroAssetDest(bundlePath, descriptors) {
4576
- const bundleDirectory = (0, import_node_path25.dirname)((0, import_node_path25.resolve)(bundlePath));
4576
+ const bundleDirectory = (0, import_node_path26.dirname)((0, import_node_path26.resolve)(bundlePath));
4577
4577
  const candidates = [
4578
- (0, import_node_path25.join)(bundleDirectory, "assets"),
4578
+ (0, import_node_path26.join)(bundleDirectory, "assets"),
4579
4579
  bundleDirectory,
4580
- (0, import_node_path25.resolve)(bundleDirectory, "..", "assets")
4580
+ (0, import_node_path26.resolve)(bundleDirectory, "..", "assets")
4581
4581
  ];
4582
4582
  const cwd = process.cwd();
4583
4583
  let projectDirectory = null;
4584
4584
  for (const start of [bundleDirectory, cwd]) {
4585
- let directory = (0, import_node_path25.resolve)(start);
4585
+ let directory = (0, import_node_path26.resolve)(start);
4586
4586
  while (true) {
4587
4587
  if (detectProject(directory)?.hasMetroConfig) {
4588
4588
  projectDirectory = directory;
4589
4589
  break;
4590
4590
  }
4591
- const parent = (0, import_node_path25.dirname)(directory);
4591
+ const parent = (0, import_node_path26.dirname)(directory);
4592
4592
  if (parent === directory) break;
4593
4593
  directory = parent;
4594
4594
  }
@@ -4596,11 +4596,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
4596
4596
  }
4597
4597
  if (projectDirectory) {
4598
4598
  candidates.push(
4599
- (0, import_node_path25.join)(projectDirectory, "assets"),
4600
- (0, import_node_path25.join)(projectDirectory, "dist"),
4601
- (0, import_node_path25.join)(projectDirectory, "dist", "assets"),
4602
- (0, import_node_path25.join)(projectDirectory, "build"),
4603
- (0, import_node_path25.join)(projectDirectory, "build", "assets")
4599
+ (0, import_node_path26.join)(projectDirectory, "assets"),
4600
+ (0, import_node_path26.join)(projectDirectory, "dist"),
4601
+ (0, import_node_path26.join)(projectDirectory, "dist", "assets"),
4602
+ (0, import_node_path26.join)(projectDirectory, "build"),
4603
+ (0, import_node_path26.join)(projectDirectory, "build", "assets")
4604
4604
  );
4605
4605
  }
4606
4606
  const searched = [];
@@ -4608,7 +4608,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
4608
4608
  const stale = [];
4609
4609
  let truncated = false;
4610
4610
  for (const candidate of candidates) {
4611
- const directory = (0, import_node_path25.resolve)(candidate);
4611
+ const directory = (0, import_node_path26.resolve)(candidate);
4612
4612
  if (searched.includes(directory)) continue;
4613
4613
  searched.push(directory);
4614
4614
  const listing = listMetroAssetDest(directory);
@@ -4717,7 +4717,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
4717
4717
  );
4718
4718
  }
4719
4719
  const relative2 = placement?.files.get(variant.scale);
4720
- if (relative2 && dest) return (0, import_node_fs25.readFileSync)((0, import_node_path25.join)(dest.directory, relative2));
4720
+ if (relative2 && dest) return (0, import_node_fs25.readFileSync)((0, import_node_path26.join)(dest.directory, relative2));
4721
4721
  if (placement && placement.files.size > 0) return null;
4722
4722
  if (placement && placement.ambiguous.length > 0 && dest) {
4723
4723
  throw new Error(
@@ -4746,7 +4746,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
4746
4746
  );
4747
4747
  const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
4748
4748
  throw new Error(
4749
- `${command} could not read ${(0, import_node_path25.join)(dest?.directory ?? ".", classic)} for ${variant.descriptor.name}.${variant.descriptor.type} at scale ${variant.scale}, and has no stand-in for a .${variant.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
4749
+ `${command} could not read ${(0, import_node_path26.join)(dest?.directory ?? ".", classic)} for ${variant.descriptor.name}.${variant.descriptor.type} at scale ${variant.scale}, and has no stand-in for a .${variant.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
4750
4750
  );
4751
4751
  });
4752
4752
  return {
@@ -4892,13 +4892,13 @@ async function createCloudBox(options) {
4892
4892
  warnings: artifact.warnings
4893
4893
  };
4894
4894
  }
4895
- var import_node_crypto11, import_node_fs25, import_node_path25, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS;
4895
+ var import_node_crypto11, import_node_fs25, import_node_path26, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS;
4896
4896
  var init_cloud_client = __esm({
4897
4897
  "cli/cloud-client.ts"() {
4898
4898
  "use strict";
4899
4899
  import_node_crypto11 = require("node:crypto");
4900
4900
  import_node_fs25 = require("node:fs");
4901
- import_node_path25 = require("node:path");
4901
+ import_node_path26 = require("node:path");
4902
4902
  init_metroAssetArtifact();
4903
4903
  init_metroCloudArtifact();
4904
4904
  init_metro_fingerprint_registry_client();
@@ -5336,9 +5336,9 @@ function safeChildPlistName(value) {
5336
5336
  name: file.toLowerCase().endsWith(".plist") ? file : `${file}.plist`
5337
5337
  };
5338
5338
  }
5339
- async function readableSettingsBundle(path20) {
5339
+ async function readableSettingsBundle(path21) {
5340
5340
  try {
5341
- const root = await (0, import_promises.stat)((0, import_node_path.join)(path20, "Root.plist"));
5341
+ const root = await (0, import_promises.stat)((0, import_node_path.join)(path21, "Root.plist"));
5342
5342
  return root.isFile() && root.size <= MAX_PLIST_BYTES;
5343
5343
  } catch {
5344
5344
  return false;
@@ -5383,11 +5383,11 @@ async function settingsBundleFingerprint(bundlePath) {
5383
5383
  return null;
5384
5384
  }
5385
5385
  }
5386
- async function parsePlistRecord(path20) {
5386
+ async function parsePlistRecord(path21) {
5387
5387
  try {
5388
- const metadata = await (0, import_promises.stat)(path20);
5388
+ const metadata = await (0, import_promises.stat)(path21);
5389
5389
  if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
5390
- const source = await (0, import_promises.readFile)(path20, "utf8");
5390
+ const source = await (0, import_promises.readFile)(path21, "utf8");
5391
5391
  const parsed = parsePlistSource(source);
5392
5392
  return isRecord2(parsed) ? parsed : null;
5393
5393
  } catch {
@@ -5649,7 +5649,7 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
5649
5649
  return null;
5650
5650
  }
5651
5651
  }
5652
- function httpGet(hostname, port, path20, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
5652
+ function httpGet(hostname, port, path21, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
5653
5653
  return new Promise((resolve5) => {
5654
5654
  let settled = false;
5655
5655
  let killing = false;
@@ -5658,7 +5658,7 @@ function httpGet(hostname, port, path20, method = "GET", timeout = TIMEOUT_MS, h
5658
5658
  settled = true;
5659
5659
  resolve5(value);
5660
5660
  };
5661
- const req = import_http.default.request({ hostname, port, path: path20, method, headers }, (res) => {
5661
+ const req = import_http.default.request({ hostname, port, path: path21, method, headers }, (res) => {
5662
5662
  let body = "";
5663
5663
  res.on("data", (c) => body += c.toString());
5664
5664
  const contentType = (() => {
@@ -6342,7 +6342,7 @@ var import_node_crypto6 = require("node:crypto");
6342
6342
  var import_node_fs16 = __toESM(require("node:fs"), 1);
6343
6343
  var import_node_module = require("node:module");
6344
6344
  var import_node_os6 = __toESM(require("node:os"), 1);
6345
- var import_node_path16 = __toESM(require("node:path"), 1);
6345
+ var import_node_path17 = __toESM(require("node:path"), 1);
6346
6346
  var import_node_util3 = require("node:util");
6347
6347
 
6348
6348
  // cli/internal-child.ts
@@ -6584,7 +6584,7 @@ var NAME = /\bname\s*:\s*"([^"]+)"/;
6584
6584
  function listArgument(call, label) {
6585
6585
  const start = new RegExp(`\\b${label}\\s*:\\s*\\[`).exec(call);
6586
6586
  if (!start) return [];
6587
- const items = [];
6587
+ const items2 = [];
6588
6588
  let depth = 0;
6589
6589
  let inString = false;
6590
6590
  let item = "";
@@ -6601,14 +6601,14 @@ function listArgument(call, label) {
6601
6601
  if (depth === 0) break;
6602
6602
  depth--;
6603
6603
  } else if (ch === "," && depth === 0) {
6604
- items.push(item.trim());
6604
+ items2.push(item.trim());
6605
6605
  item = "";
6606
6606
  continue;
6607
6607
  }
6608
6608
  item += ch;
6609
6609
  }
6610
- if (item.trim()) items.push(item.trim());
6611
- return items;
6610
+ if (item.trim()) items2.push(item.trim());
6611
+ return items2;
6612
6612
  }
6613
6613
  function swiftPackageIdentity(url) {
6614
6614
  return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
@@ -7108,21 +7108,21 @@ var CLASS_DECL = /^class\s+(?!(?:func|var|let|subscript)\b)([A-Za-z_]\w*)/;
7108
7108
  var MODIFIERS = /(?:^|\s)(public|open|internal|fileprivate|private|final|nonisolated|@MainActor)(?=\s)/g;
7109
7109
  var OVERRIDE_FUNC = /^override((?:\s+(?:public|open|internal|fileprivate|private|final|nonisolated|dynamic|@\w+))*)\s+func\s+([A-Za-z_]\w*)\s*(<[^>{}]*>)?\s*\(/;
7110
7110
  var OVERRIDE_VAR = /^override((?:\s+(?:public|open|internal|fileprivate|private|final|nonisolated|dynamic|@\w+))*)\s+var\s+([A-Za-z_]\w*)\s*:\s*([^{=]+?)\s*\{/;
7111
- function splitTopLevel(text) {
7111
+ function splitTopLevel(text2) {
7112
7112
  const parts = [];
7113
7113
  let depth = 0;
7114
7114
  let start = 0;
7115
- for (let i = 0; i < text.length; i++) {
7116
- const char = text[i];
7115
+ for (let i = 0; i < text2.length; i++) {
7116
+ const char = text2[i];
7117
7117
  if (char === "(" || char === "[" || char === "<") depth++;
7118
- else if (char === ")" || char === "]" || char === ">" && text[i - 1] !== "-")
7118
+ else if (char === ")" || char === "]" || char === ">" && text2[i - 1] !== "-")
7119
7119
  depth--;
7120
7120
  else if (char === "," && depth === 0) {
7121
- parts.push(text.slice(start, i));
7121
+ parts.push(text2.slice(start, i));
7122
7122
  start = i + 1;
7123
7123
  }
7124
7124
  }
7125
- parts.push(text.slice(start));
7125
+ parts.push(text2.slice(start));
7126
7126
  return parts.map((part) => part.trim()).filter((part) => part !== "");
7127
7127
  }
7128
7128
  function forwardedArguments(parameters) {
@@ -8649,7 +8649,7 @@ function swiftModuleToolchain(root) {
8649
8649
  var import_node_crypto5 = require("node:crypto");
8650
8650
  var import_node_fs15 = __toESM(require("node:fs"), 1);
8651
8651
  var import_node_os5 = __toESM(require("node:os"), 1);
8652
- var import_node_path15 = __toESM(require("node:path"), 1);
8652
+ var import_node_path16 = __toESM(require("node:path"), 1);
8653
8653
 
8654
8654
  // ../sootsim-swift/src/bundleAssets.ts
8655
8655
  var import_svgpath = __toESM(require("svgpath"), 1);
@@ -8683,14 +8683,14 @@ function pickImagesetFile(images) {
8683
8683
  scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
8684
8684
  };
8685
8685
  }
8686
- function flatScale(path20) {
8687
- const match = /@([23])x\.[^./]+$/.exec(path20);
8686
+ function flatScale(path21) {
8687
+ const match = /@([23])x\.[^./]+$/.exec(path21);
8688
8688
  return match ? Number(match[1]) : 1;
8689
8689
  }
8690
- function providesNamespace(text) {
8691
- if (text === null) return false;
8690
+ function providesNamespace(text2) {
8691
+ if (text2 === null) return false;
8692
8692
  try {
8693
- const parsed = JSON.parse(text);
8693
+ const parsed = JSON.parse(text2);
8694
8694
  return parsed?.properties?.["provides-namespace"] === true;
8695
8695
  } catch {
8696
8696
  return false;
@@ -8711,21 +8711,21 @@ function catalogEntryName(contentsPath, kind, readText) {
8711
8711
  }
8712
8712
  return segments.join("/");
8713
8713
  }
8714
- function isFlatResourceImage(path20) {
8715
- return path20.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path20));
8714
+ function isFlatResourceImage(path21) {
8715
+ return path21.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path21));
8716
8716
  }
8717
8717
  function enumerateBundleImages(paths, readText) {
8718
8718
  const table = [];
8719
8719
  const seen = /* @__PURE__ */ new Set();
8720
- const catalogs = paths.filter((path20) => baseOf(path20) === "Contents.json");
8720
+ const catalogs = paths.filter((path21) => baseOf(path21) === "Contents.json");
8721
8721
  for (const contentsPath of catalogs) {
8722
8722
  const name2 = catalogEntryName(contentsPath, ".imageset", readText);
8723
8723
  if (name2 === null || seen.has(name2)) continue;
8724
8724
  let parsed;
8725
8725
  try {
8726
- const text = readText(contentsPath);
8727
- if (text === null) continue;
8728
- parsed = JSON.parse(text);
8726
+ const text2 = readText(contentsPath);
8727
+ if (text2 === null) continue;
8728
+ parsed = JSON.parse(text2);
8729
8729
  } catch {
8730
8730
  continue;
8731
8731
  }
@@ -8738,12 +8738,12 @@ function enumerateBundleImages(paths, readText) {
8738
8738
  seen.add(name2);
8739
8739
  table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
8740
8740
  }
8741
- for (const path20 of paths) {
8742
- if (!isFlatResourceImage(path20)) continue;
8743
- const name2 = baseOf(path20).slice(0, -extOf(path20).length);
8741
+ for (const path21 of paths) {
8742
+ if (!isFlatResourceImage(path21)) continue;
8743
+ const name2 = baseOf(path21).slice(0, -extOf(path21).length);
8744
8744
  if (name2 === "" || seen.has(name2)) continue;
8745
8745
  seen.add(name2);
8746
- table.push({ name: name2, file: path20, scale: flatScale(path20) });
8746
+ table.push({ name: name2, file: path21, scale: flatScale(path21) });
8747
8747
  }
8748
8748
  return table;
8749
8749
  }
@@ -8772,14 +8772,14 @@ function colorsetValue(color) {
8772
8772
  }
8773
8773
  function enumerateBundleColors(paths, readText) {
8774
8774
  const table = {};
8775
- for (const contentsPath of paths.filter((path20) => baseOf(path20) === "Contents.json")) {
8775
+ for (const contentsPath of paths.filter((path21) => baseOf(path21) === "Contents.json")) {
8776
8776
  const name2 = catalogEntryName(contentsPath, ".colorset", readText);
8777
8777
  if (name2 === null || name2 in table) continue;
8778
8778
  let colors;
8779
8779
  try {
8780
- const text = readText(contentsPath);
8781
- if (text === null) continue;
8782
- colors = Reflect.get(JSON.parse(text), "colors");
8780
+ const text2 = readText(contentsPath);
8781
+ if (text2 === null) continue;
8782
+ colors = Reflect.get(JSON.parse(text2), "colors");
8783
8783
  } catch {
8784
8784
  continue;
8785
8785
  }
@@ -8837,8 +8837,8 @@ function axisExtremes(points) {
8837
8837
  function pathBounds(d) {
8838
8838
  const xs = [];
8839
8839
  const ys = [];
8840
- for (const path20 of d)
8841
- (0, import_svgpath.default)(path20).abs().unshort().unarc().iterate((segment, _index, x, y) => {
8840
+ for (const path21 of d)
8841
+ (0, import_svgpath.default)(path21).abs().unshort().unarc().iterate((segment, _index, x, y) => {
8842
8842
  const [command, ...args] = segment;
8843
8843
  if (command === "M" || command === "L") {
8844
8844
  xs.push(Number(args[0]));
@@ -8865,7 +8865,7 @@ function guide(svg, id, axis) {
8865
8865
  }
8866
8866
  function enumerateBundleSymbols(paths, readText) {
8867
8867
  const table = {};
8868
- for (const contentsPath of paths.filter((path20) => baseOf(path20) === "Contents.json")) {
8868
+ for (const contentsPath of paths.filter((path21) => baseOf(path21) === "Contents.json")) {
8869
8869
  const name2 = catalogEntryName(contentsPath, ".symbolset", readText);
8870
8870
  if (name2 === null || name2 in table) continue;
8871
8871
  let symbols;
@@ -8898,8 +8898,8 @@ function enumerateBundleSymbols(paths, readText) {
8898
8898
  viewBox: "0 0 24 24",
8899
8899
  advance,
8900
8900
  box: [12 - advance / 2, 12 - tall / 2, advance, tall],
8901
- layers: d.map((path20) => ({
8902
- d: (0, import_svgpath.default)(path20).abs().scale(scale).translate(translateX, translateY).round(3).toString()
8901
+ layers: d.map((path21) => ({
8902
+ d: (0, import_svgpath.default)(path21).abs().scale(scale).translate(translateX, translateY).round(3).toString()
8903
8903
  }))
8904
8904
  };
8905
8905
  }
@@ -8909,7 +8909,7 @@ function enumerateBundleJson(paths) {
8909
8909
  const found = [];
8910
8910
  const seen = /* @__PURE__ */ new Set();
8911
8911
  const ordered = [...paths].filter(
8912
- (path20) => path20.split("/").includes("Resources") && path20.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path20) === ".json" || extOf(path20) === ".xcstrings")
8912
+ (path21) => path21.split("/").includes("Resources") && path21.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path21) === ".json" || extOf(path21) === ".xcstrings")
8913
8913
  ).sort((a, b) => {
8914
8914
  const aDepth = a.split("/").length;
8915
8915
  const bDepth = b.split("/").length;
@@ -9240,25 +9240,360 @@ async function compileSwiftProject(submit, work, origin, signal) {
9240
9240
 
9241
9241
  // src/xcode-project.ts
9242
9242
  var import_node_fs14 = __toESM(require("node:fs"), 1);
9243
- var import_node_path14 = __toESM(require("node:path"), 1);
9243
+ var import_node_path15 = __toESM(require("node:path"), 1);
9244
9244
  var import_plist3 = __toESM(require_plist(), 1);
9245
- function parseOpenStepPlist(text) {
9245
+
9246
+ // src/xcode-json-project.ts
9247
+ var import_node_path14 = __toESM(require("node:path"), 1);
9248
+ var import_json5 = __toESM(require("json5"), 1);
9249
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
9250
+ var text = (value) => typeof value === "string" ? value : void 0;
9251
+ var items = (value) => Array.isArray(value) ? value : [];
9252
+ var PHASE_ISA = {
9253
+ "compile-sources": "PBXSourcesBuildPhase",
9254
+ resources: "PBXResourcesBuildPhase",
9255
+ frameworks: "PBXFrameworksBuildPhase",
9256
+ headers: "PBXHeadersBuildPhase",
9257
+ copy: "PBXCopyFilesBuildPhase",
9258
+ script: "PBXShellScriptBuildPhase"
9259
+ };
9260
+ function readXcodeJsonProject(xcodeproj, source) {
9261
+ const json = import_json5.default.parse(source);
9262
+ if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
9263
+ const projectDir = import_node_path14.default.dirname(xcodeproj);
9264
+ const objects = {};
9265
+ let next = 0;
9266
+ const add = (entry, id) => {
9267
+ const key = id ?? `XCPROJ${(next++).toString(16).toUpperCase().padStart(18, "0")}`;
9268
+ objects[key] = entry;
9269
+ return key;
9270
+ };
9271
+ const locate = (raw2, groupDir) => {
9272
+ if (raw2.startsWith("<USER:")) return null;
9273
+ const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
9274
+ if (base) {
9275
+ if (base[1] === "PROJECT")
9276
+ return { sourceTree: "<absolute>", path: import_node_path14.default.join(projectDir, base[2]) };
9277
+ if (base[1] === "PRODUCTS")
9278
+ return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
9279
+ return null;
9280
+ }
9281
+ const unescaped = raw2.replaceAll("\\<", "<");
9282
+ if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
9283
+ if (unescaped.startsWith("~")) return null;
9284
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path14.default.join(groupDir, unescaped) };
9285
+ };
9286
+ const memberships = [];
9287
+ const folders = [];
9288
+ const projectFiles = [];
9289
+ const root = { id: "", name: "", dir: projectDir, parent: null, children: [] };
9290
+ const walk2 = (entries, parent) => entries.flatMap((entry) => {
9291
+ if (!isObject(entry)) return [];
9292
+ const kind = text(entry.kind) ?? "file-reference";
9293
+ const raw2 = text(entry.path) ?? "";
9294
+ const located = raw2 === "" ? null : locate(raw2, parent.dir);
9295
+ const name2 = text(entry.name) ?? import_node_path14.default.basename(raw2);
9296
+ const node = { id: "", name: name2, dir: null, parent, children: [] };
9297
+ if (kind === "group" || kind === "variant-group" || kind === "version-group") {
9298
+ node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
9299
+ const childIds = walk2(items(entry.children), node);
9300
+ node.id = add(
9301
+ kind === "version-group" && located ? {
9302
+ isa: "PBXFileReference",
9303
+ ...located,
9304
+ lastKnownFileType: "wrapper.xcdatamodel"
9305
+ } : {
9306
+ isa: kind === "variant-group" ? "PBXVariantGroup" : "PBXGroup",
9307
+ children: childIds,
9308
+ ...kind === "variant-group" ? {} : { sourceTree: "<absolute>", path: node.dir ?? "" },
9309
+ name: name2
9310
+ },
9311
+ text(entry.id)
9312
+ );
9313
+ } else if (kind === "folder") {
9314
+ node.id = add(
9315
+ {
9316
+ isa: "PBXFileSystemSynchronizedRootGroup",
9317
+ ...located ?? { sourceTree: "SDKROOT", path: raw2 }
9318
+ },
9319
+ text(entry.id)
9320
+ );
9321
+ folders.push({ id: node.id, folder: entry });
9322
+ } else {
9323
+ node.id = add(
9324
+ {
9325
+ isa: "PBXFileReference",
9326
+ ...located ?? { sourceTree: "SDKROOT", path: raw2 },
9327
+ name: name2
9328
+ },
9329
+ text(entry.id)
9330
+ );
9331
+ if (located?.sourceTree === "<absolute>" && located.path.endsWith(".xcodeproj"))
9332
+ projectFiles.push(node.id);
9333
+ }
9334
+ parent.children.push(node);
9335
+ for (const membership of items(entry["target-membership"])) {
9336
+ if (kind !== "folder") memberships.push({ refId: node.id, entry: membership });
9337
+ }
9338
+ return [node.id];
9339
+ });
9340
+ const mainGroupChildren = walk2(items(json.files), root);
9341
+ const mainGroup = add({
9342
+ isa: "PBXGroup",
9343
+ children: mainGroupChildren,
9344
+ sourceTree: "<absolute>",
9345
+ path: projectDir
9346
+ });
9347
+ root.id = mainGroup;
9348
+ const lookup = (reference, from = root) => {
9349
+ if (isObject(reference)) {
9350
+ const anchor = lookupNode(reference.anchor, root);
9351
+ return anchor ? lookup(reference["relative-path"], anchor) : void 0;
9352
+ }
9353
+ if (Array.isArray(reference)) {
9354
+ return lookupNode(
9355
+ reference.map(
9356
+ (component) => isObject(component) ? text(component.name) ?? "" : text(component) ?? ""
9357
+ ).join("/"),
9358
+ from
9359
+ )?.id;
9360
+ }
9361
+ return lookupNode(reference, from)?.id;
9362
+ };
9363
+ const lookupNode = (reference, from) => {
9364
+ const value = text(reference);
9365
+ if (value === void 0) return void 0;
9366
+ if (value.startsWith("id:")) {
9367
+ const id = value.slice(3);
9368
+ const find = (node2) => node2.id === id ? node2 : node2.children.map(find).find(Boolean);
9369
+ return find(root);
9370
+ }
9371
+ let node = from;
9372
+ for (const component of value.split("/")) {
9373
+ if (!node) return void 0;
9374
+ node = component === "." ? node : component === ".." ? node.parent ?? void 0 : node.children.find((child) => child.name === component);
9375
+ }
9376
+ return node;
9377
+ };
9378
+ const configurations = items(json.configurations).flatMap((entry) => {
9379
+ const name2 = isObject(entry) ? text(entry.name) : text(entry);
9380
+ return name2 ? [{ name: name2, file: isObject(entry) ? entry.file : void 0 }] : [];
9381
+ });
9382
+ const settingsOf = (value) => Object.fromEntries(
9383
+ Object.entries(isObject(value) ? value : {}).flatMap(
9384
+ ([key, setting]) => typeof setting === "string" ? [[key, setting]] : Array.isArray(setting) ? [
9385
+ [
9386
+ key,
9387
+ setting.filter((item) => typeof item === "string")
9388
+ ]
9389
+ ] : []
9390
+ )
9391
+ );
9392
+ const configurationList = (settings, specialized) => add({
9393
+ isa: "XCConfigurationList",
9394
+ defaultConfigurationName: text(json["default-configuration"]) ?? "Debug",
9395
+ buildConfigurations: configurations.map(({ name: name2, file }) => {
9396
+ const base = lookup(specialized.has(name2) ? specialized.get(name2) : file);
9397
+ return add({
9398
+ isa: "XCBuildConfiguration",
9399
+ name: name2,
9400
+ buildSettings: settings,
9401
+ ...base ? { baseConfigurationReference: base } : {}
9402
+ });
9403
+ })
9404
+ });
9405
+ const packageIds = /* @__PURE__ */ new Map();
9406
+ for (const entry of items(json.packages)) {
9407
+ if (!isObject(entry)) continue;
9408
+ const repository = text(entry.repository);
9409
+ const local = text(entry.path);
9410
+ const name2 = local !== void 0 ? import_node_path14.default.basename(import_node_path14.default.resolve(import_node_path14.default.dirname(xcodeproj), local)) : import_node_path14.default.basename(repository ?? "").replace(/\.git$/, "");
9411
+ const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
9412
+ packageIds.set(name2.toLowerCase(), id);
9413
+ }
9414
+ const productDependency = (entry) => add({
9415
+ isa: "XCSwiftPackageProductDependency",
9416
+ productName: text(entry["product-name"]) ?? "",
9417
+ // xcode finds a product by name across packages when none is named
9418
+ ...packageIds.has(text(entry.package)?.toLowerCase() ?? "") ? { package: packageIds.get(text(entry.package).toLowerCase()) } : {}
9419
+ });
9420
+ const proxy = (entry, remote, proxyType) => add({
9421
+ isa: "PBXContainerItemProxy",
9422
+ containerPortal: lookup(entry.project) ?? "",
9423
+ proxyType,
9424
+ remoteGlobalIDString: remote ?? "",
9425
+ remoteInfo: text(entry.target) ?? ""
9426
+ });
9427
+ const phases = /* @__PURE__ */ new Map();
9428
+ const targetIds = /* @__PURE__ */ new Map();
9429
+ const targets = [];
9430
+ for (const entry of items(json.targets)) {
9431
+ if (!isObject(entry)) continue;
9432
+ const name2 = text(entry.name) ?? "";
9433
+ const productType = text(entry["product-type"]);
9434
+ const target = {
9435
+ isa: text(entry.kind) === "aggregate" ? "PBXAggregateTarget" : "PBXNativeTarget",
9436
+ name: name2,
9437
+ productName: name2,
9438
+ productType: productType ? `com.apple.product-type.${productType}` : text(entry["full-product-type"]) ?? "",
9439
+ buildPhases: [],
9440
+ dependencies: [],
9441
+ packageProductDependencies: [],
9442
+ fileSystemSynchronizedGroups: []
9443
+ };
9444
+ const product = lookup(entry.product);
9445
+ if (product) target.productReference = product;
9446
+ const id = add(target, text(entry.id));
9447
+ targetIds.set(name2, id);
9448
+ targets.push({ id, target, entry });
9449
+ for (const phase of items(entry["build-phases"])) {
9450
+ const kind = isObject(phase) ? text(phase.kind) : text(phase);
9451
+ const isa = kind ? PHASE_ISA[kind] : void 0;
9452
+ if (!kind || !isa) continue;
9453
+ const phaseName = isObject(phase) ? text(phase.name) : void 0;
9454
+ const phaseId = add(
9455
+ { isa, files: [] },
9456
+ isObject(phase) ? text(phase.id) : void 0
9457
+ );
9458
+ target.buildPhases.push(phaseId);
9459
+ phases.set([name2, kind, phaseName].filter(Boolean).join("/"), phaseId);
9460
+ phases.set(`id:${phaseId}`, phaseId);
9461
+ }
9462
+ }
9463
+ const phaseFiles = (reference, targetName) => {
9464
+ const value = text(reference);
9465
+ if (value === void 0) return null;
9466
+ const key = value.startsWith("id:") || !targetName ? value : `${targetName}/${value}`;
9467
+ const phase = objects[phases.get(key) ?? ""];
9468
+ return phase && typeof phase === "object" && !Array.isArray(phase) && Array.isArray(phase.files) ? phase.files : null;
9469
+ };
9470
+ for (const { refId, entry } of memberships) {
9471
+ const files = phaseFiles(isObject(entry) ? entry["build-phase"] : entry);
9472
+ files?.push(add({ isa: "PBXBuildFile", fileRef: refId }));
9473
+ }
9474
+ for (const { target, entry } of targets) {
9475
+ const name2 = text(entry.name) ?? "";
9476
+ target.buildConfigurationList = configurationList(
9477
+ settingsOf(entry["build-settings"]),
9478
+ new Map(
9479
+ items(entry["specialized-configurations"]).flatMap(
9480
+ (configuration) => isObject(configuration) && text(configuration.name) ? [[text(configuration.name), configuration.file]] : []
9481
+ )
9482
+ )
9483
+ );
9484
+ for (const dependency of items(entry.dependencies)) {
9485
+ const kind = isObject(dependency) ? text(dependency.kind) ?? "localTarget" : "localTarget";
9486
+ if (kind === "package" && isObject(dependency)) {
9487
+ ;
9488
+ target.dependencies.push(
9489
+ add({ isa: "PBXTargetDependency", productRef: productDependency(dependency) })
9490
+ );
9491
+ } else if (kind === "remoteTarget" && isObject(dependency)) {
9492
+ ;
9493
+ target.dependencies.push(
9494
+ add({
9495
+ isa: "PBXTargetDependency",
9496
+ targetProxy: proxy(dependency, text(dependency["target-id"]), "1")
9497
+ })
9498
+ );
9499
+ } else {
9500
+ const local = isObject(dependency) ? text(dependency.target) : text(dependency);
9501
+ const id = local ? targetIds.get(local) : void 0;
9502
+ if (id)
9503
+ target.dependencies.push(
9504
+ add({ isa: "PBXTargetDependency", target: id })
9505
+ );
9506
+ }
9507
+ }
9508
+ for (const member of items(entry["package-product-members"])) {
9509
+ if (!isObject(member)) continue;
9510
+ const dependency = productDependency(member);
9511
+ target.packageProductDependencies.push(dependency);
9512
+ const buildFile = member["build-phase"];
9513
+ phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name2)?.push(
9514
+ add({ isa: "PBXBuildFile", productRef: dependency })
9515
+ );
9516
+ }
9517
+ }
9518
+ for (const imported of items(json["imported-products"])) {
9519
+ if (!isObject(imported)) continue;
9520
+ const reference = add({
9521
+ isa: "PBXReferenceProxy",
9522
+ path: text(imported.name) ?? text(imported.path) ?? "",
9523
+ sourceTree: "BUILT_PRODUCTS_DIR",
9524
+ remoteRef: proxy(imported, text(imported["product-id"]), "2")
9525
+ });
9526
+ for (const membership of items(imported["target-membership"])) {
9527
+ phaseFiles(isObject(membership) ? membership["build-phase"] : membership)?.push(
9528
+ add({ isa: "PBXBuildFile", fileRef: reference })
9529
+ );
9530
+ }
9531
+ }
9532
+ for (const { id, folder } of folders) {
9533
+ const exceptions = [];
9534
+ for (const exception of items(folder["membership-exceptions"])) {
9535
+ if (!isObject(exception)) continue;
9536
+ const target = targetIds.get(text(exception.target) ?? "");
9537
+ if (!target) continue;
9538
+ exceptions.push(
9539
+ add({
9540
+ isa: "PBXFileSystemSynchronizedBuildFileExceptionSet",
9541
+ target,
9542
+ membershipExceptions: [
9543
+ ...items(exception.exclusions),
9544
+ ...items(exception.inclusions)
9545
+ ].flatMap((member) => typeof member === "string" ? [member] : [])
9546
+ })
9547
+ );
9548
+ }
9549
+ const group = objects[id];
9550
+ if (group && typeof group === "object" && !Array.isArray(group))
9551
+ group.exceptions = exceptions;
9552
+ for (const owner of items(folder["target-membership"])) {
9553
+ const target = targets.find(
9554
+ (candidate) => candidate.id === targetIds.get(text(owner) ?? "")
9555
+ );
9556
+ target?.target.fileSystemSynchronizedGroups?.push(id);
9557
+ }
9558
+ }
9559
+ const localizations = isObject(json.localizations) ? json.localizations : {};
9560
+ const project = add({
9561
+ isa: "PBXProject",
9562
+ mainGroup,
9563
+ projectDirPath: "",
9564
+ developmentRegion: text(localizations.development) ?? "en",
9565
+ buildConfigurationList: configurationList(
9566
+ settingsOf(json["build-settings"]),
9567
+ /* @__PURE__ */ new Map()
9568
+ ),
9569
+ targets: targets.map((entry) => entry.id),
9570
+ packageReferences: [...packageIds.values()],
9571
+ projectReferences: projectFiles.map((ProjectRef) => ({ ProjectRef }))
9572
+ });
9573
+ return { objects, rootObject: project };
9574
+ }
9575
+ function isJsonObject(value) {
9576
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9577
+ }
9578
+
9579
+ // src/xcode-project.ts
9580
+ function parseOpenStepPlist(text2) {
9246
9581
  let i = 0;
9247
9582
  const fail = (message) => {
9248
- const line = text.slice(0, i).split("\n").length;
9583
+ const line = text2.slice(0, i).split("\n").length;
9249
9584
  throw new Error(`project.pbxproj line ${line}: ${message}`);
9250
9585
  };
9251
9586
  const skip = () => {
9252
9587
  for (; ; ) {
9253
- const ch = text[i];
9588
+ const ch = text2[i];
9254
9589
  if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
9255
- else if (ch === "/" && text[i + 1] === "*") {
9256
- const end = text.indexOf("*/", i + 2);
9590
+ else if (ch === "/" && text2[i + 1] === "*") {
9591
+ const end = text2.indexOf("*/", i + 2);
9257
9592
  if (end < 0) fail("unterminated comment");
9258
9593
  i = end + 2;
9259
- } else if (ch === "/" && text[i + 1] === "/") {
9260
- const end = text.indexOf("\n", i);
9261
- i = end < 0 ? text.length : end + 1;
9594
+ } else if (ch === "/" && text2[i + 1] === "/") {
9595
+ const end = text2.indexOf("\n", i);
9596
+ i = end < 0 ? text2.length : end + 1;
9262
9597
  } else return;
9263
9598
  }
9264
9599
  };
@@ -9266,42 +9601,42 @@ function parseOpenStepPlist(text) {
9266
9601
  i++;
9267
9602
  let out = "";
9268
9603
  for (; ; ) {
9269
- const ch = text[i++];
9604
+ const ch = text2[i++];
9270
9605
  if (ch === void 0) fail("unterminated string");
9271
9606
  if (ch === '"') return out;
9272
9607
  if (ch !== "\\") {
9273
9608
  out += ch;
9274
9609
  continue;
9275
9610
  }
9276
- const next = text[i++];
9611
+ const next = text2[i++];
9277
9612
  if (next === "n") out += "\n";
9278
9613
  else if (next === "t") out += " ";
9279
9614
  else if (next === "r") out += "\r";
9280
9615
  else if (next === "U") {
9281
- out += String.fromCharCode(parseInt(text.slice(i, i + 4), 16));
9616
+ out += String.fromCharCode(parseInt(text2.slice(i, i + 4), 16));
9282
9617
  i += 4;
9283
9618
  } else out += next;
9284
9619
  }
9285
9620
  };
9286
9621
  const value = () => {
9287
9622
  skip();
9288
- const ch = text[i];
9623
+ const ch = text2[i];
9289
9624
  if (ch === "{") {
9290
9625
  i++;
9291
9626
  const dict = {};
9292
9627
  for (; ; ) {
9293
9628
  skip();
9294
- if (text[i] === "}") {
9629
+ if (text2[i] === "}") {
9295
9630
  i++;
9296
9631
  return dict;
9297
9632
  }
9298
9633
  const key = value();
9299
9634
  if (typeof key !== "string") fail("dictionary key is not a string");
9300
9635
  skip();
9301
- if (text[i++] !== "=") fail("expected =");
9636
+ if (text2[i++] !== "=") fail("expected =");
9302
9637
  dict[key] = value();
9303
9638
  skip();
9304
- if (text[i++] !== ";") fail("expected ;");
9639
+ if (text2[i++] !== ";") fail("expected ;");
9305
9640
  }
9306
9641
  }
9307
9642
  if (ch === "(") {
@@ -9309,26 +9644,26 @@ function parseOpenStepPlist(text) {
9309
9644
  const list2 = [];
9310
9645
  for (; ; ) {
9311
9646
  skip();
9312
- if (text[i] === ")") {
9647
+ if (text2[i] === ")") {
9313
9648
  i++;
9314
9649
  return list2;
9315
9650
  }
9316
9651
  list2.push(value());
9317
9652
  skip();
9318
- if (text[i] === ",") i++;
9319
- else if (text[i] !== ")") fail("expected , or )");
9653
+ if (text2[i] === ",") i++;
9654
+ else if (text2[i] !== ")") fail("expected , or )");
9320
9655
  }
9321
9656
  }
9322
9657
  if (ch === '"') return quoted();
9323
9658
  const start = i;
9324
- while (i < text.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text[i])) i++;
9659
+ while (i < text2.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text2[i])) i++;
9325
9660
  if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
9326
- return text.slice(start, i);
9661
+ return text2.slice(start, i);
9327
9662
  };
9328
- if (text.startsWith("// !$*UTF8*$!")) i = text.indexOf("\n") + 1;
9663
+ if (text2.startsWith("// !$*UTF8*$!")) i = text2.indexOf("\n") + 1;
9329
9664
  const root = value();
9330
9665
  skip();
9331
- if (i !== text.length) fail("trailing content");
9666
+ if (i !== text2.length) fail("trailing content");
9332
9667
  return root;
9333
9668
  }
9334
9669
  var isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -9353,7 +9688,7 @@ function walkFiles(dir) {
9353
9688
  const out = [];
9354
9689
  for (const entry of import_node_fs14.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
9355
9690
  if (entry.name.startsWith(".")) continue;
9356
- const full = import_node_path14.default.join(dir, entry.name);
9691
+ const full = import_node_path15.default.join(dir, entry.name);
9357
9692
  if (entry.isDirectory()) out.push(...walkFiles(full));
9358
9693
  else if (entry.isFile()) out.push(full);
9359
9694
  }
@@ -9370,7 +9705,7 @@ function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
9370
9705
  if (include) {
9371
9706
  Object.assign(
9372
9707
  settings,
9373
- readXcconfig(import_node_path14.default.resolve(import_node_path14.default.dirname(file), include[1]), seen)
9708
+ readXcconfig(import_node_path15.default.resolve(import_node_path15.default.dirname(file), include[1]), seen)
9374
9709
  );
9375
9710
  continue;
9376
9711
  }
@@ -9416,22 +9751,22 @@ function applyOperator(value, operator) {
9416
9751
  }
9417
9752
  throw new Error(`unsupported build setting operator :${operator}`);
9418
9753
  }
9419
- function decodeXml(text) {
9420
- return text.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
9754
+ function decodeXml(text2) {
9755
+ return text2.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
9421
9756
  }
9422
9757
  function workspaceReferences(workspace) {
9423
- const data = import_node_path14.default.join(workspace, "contents.xcworkspacedata");
9758
+ const data = import_node_path15.default.join(workspace, "contents.xcworkspacedata");
9424
9759
  if (!import_node_fs14.default.existsSync(data))
9425
9760
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
9426
- const container = import_node_path14.default.dirname(workspace);
9761
+ const container = import_node_path15.default.dirname(workspace);
9427
9762
  const locate = (location2, base) => {
9428
9763
  const colon = location2.indexOf(":");
9429
9764
  const kind = location2.slice(0, colon);
9430
9765
  const rest = location2.slice(colon + 1);
9431
- if (kind === "group") return import_node_path14.default.resolve(base, rest);
9432
- if (kind === "container" || kind === "self") return import_node_path14.default.resolve(container, rest);
9433
- if (kind === "absolute") return import_node_path14.default.resolve(rest);
9434
- throw new Error(`${import_node_path14.default.basename(workspace)} has an unsupported location ${location2}`);
9766
+ if (kind === "group") return import_node_path15.default.resolve(base, rest);
9767
+ if (kind === "container" || kind === "self") return import_node_path15.default.resolve(container, rest);
9768
+ if (kind === "absolute") return import_node_path15.default.resolve(rest);
9769
+ throw new Error(`${import_node_path15.default.basename(workspace)} has an unsupported location ${location2}`);
9435
9770
  };
9436
9771
  const groups = [container];
9437
9772
  const references = [];
@@ -9449,15 +9784,24 @@ function workspaceReferences(workspace) {
9449
9784
  return references;
9450
9785
  }
9451
9786
  var loaded = /* @__PURE__ */ new Map();
9787
+ function xcodeProjectFile(xcodeproj) {
9788
+ for (const name2 of ["project.pbxproj", "project.xcproj"]) {
9789
+ const file = import_node_path15.default.join(xcodeproj, name2);
9790
+ if (import_node_fs14.default.existsSync(file)) return file;
9791
+ }
9792
+ return null;
9793
+ }
9452
9794
  function loadProject(xcodeproj) {
9453
- const pbxproj = import_node_path14.default.join(xcodeproj, "project.pbxproj");
9454
- if (!import_node_fs14.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
9455
- const mtimeMs = import_node_fs14.default.statSync(pbxproj).mtimeMs;
9456
- const cached3 = loaded.get(pbxproj);
9795
+ const projectFile = xcodeProjectFile(xcodeproj);
9796
+ if (!projectFile)
9797
+ throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
9798
+ const mtimeMs = import_node_fs14.default.statSync(projectFile).mtimeMs;
9799
+ const cached3 = loaded.get(projectFile);
9457
9800
  if (cached3?.mtimeMs === mtimeMs) return cached3.project;
9458
- const root = parseOpenStepPlist(import_node_fs14.default.readFileSync(pbxproj, "utf8"));
9801
+ const source = import_node_fs14.default.readFileSync(projectFile, "utf8");
9802
+ const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
9459
9803
  if (!isDict(root) || !isDict(root.objects)) {
9460
- throw new Error(`${pbxproj} has no objects table`);
9804
+ throw new Error(`${projectFile} has no objects table`);
9461
9805
  }
9462
9806
  const objects = root.objects;
9463
9807
  const object = (id) => {
@@ -9466,10 +9810,10 @@ function loadProject(xcodeproj) {
9466
9810
  };
9467
9811
  const project = object(str(root.rootObject));
9468
9812
  if (!project || project.isa !== "PBXProject") {
9469
- throw new Error(`${pbxproj} has no PBXProject root`);
9813
+ throw new Error(`${projectFile} has no PBXProject root`);
9470
9814
  }
9471
9815
  const projectDir = import_node_fs14.default.realpathSync(
9472
- import_node_path14.default.resolve(import_node_path14.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
9816
+ import_node_path15.default.resolve(import_node_path15.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
9473
9817
  );
9474
9818
  const parent = /* @__PURE__ */ new Map();
9475
9819
  for (const [id, entry] of Object.entries(objects)) {
@@ -9487,18 +9831,26 @@ function loadProject(xcodeproj) {
9487
9831
  const own = str(entry.path) ?? "";
9488
9832
  const tree = str(entry.sourceTree) ?? "<group>";
9489
9833
  if (tree === "<absolute>") result2 = own;
9490
- else if (tree === "SOURCE_ROOT") result2 = import_node_path14.default.join(projectDir, own);
9834
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path15.default.join(projectDir, own);
9491
9835
  else if (tree === "<group>") {
9492
9836
  const up = parent.get(id);
9493
9837
  const base = up ? resolvePath(up) : projectDir;
9494
- result2 = base === null ? null : import_node_path14.default.join(base, own);
9838
+ result2 = base === null ? null : import_node_path15.default.join(base, own);
9495
9839
  }
9496
9840
  }
9497
9841
  resolvedPaths.set(id, result2);
9498
9842
  return result2;
9499
9843
  };
9500
- const result = { xcodeproj, pbxproj, objects, project, projectDir, object, resolvePath };
9501
- loaded.set(pbxproj, { mtimeMs, project: result });
9844
+ const result = {
9845
+ xcodeproj,
9846
+ projectFile,
9847
+ objects,
9848
+ project,
9849
+ projectDir,
9850
+ object,
9851
+ resolvePath
9852
+ };
9853
+ loaded.set(projectFile, { mtimeMs, project: result });
9502
9854
  return result;
9503
9855
  }
9504
9856
  function targetSettings(ref, builtins) {
@@ -9612,7 +9964,7 @@ function targetMembers(ref) {
9612
9964
  }
9613
9965
  }
9614
9966
  const addSynchronized = (folder, relative2) => {
9615
- const file = import_node_path14.default.join(folder, relative2);
9967
+ const file = import_node_path15.default.join(folder, relative2);
9616
9968
  if (NEVER_MEMBER.test(relative2)) return;
9617
9969
  if (file.endsWith(".swift")) {
9618
9970
  if (!relative2.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
@@ -9637,7 +9989,7 @@ function targetMembers(ref) {
9637
9989
  }
9638
9990
  if (owned.has(groupId)) {
9639
9991
  for (const file of walkFiles(folder)) {
9640
- const relative2 = import_node_path14.default.relative(folder, file).split(import_node_path14.default.sep).join("/");
9992
+ const relative2 = import_node_path15.default.relative(folder, file).split(import_node_path15.default.sep).join("/");
9641
9993
  if ([...exceptions].some(
9642
9994
  (exception) => relative2 === exception || relative2.startsWith(`${exception}/`)
9643
9995
  ))
@@ -9646,12 +9998,12 @@ function targetMembers(ref) {
9646
9998
  }
9647
9999
  } else {
9648
10000
  for (const relative2 of exceptions) {
9649
- const file = import_node_path14.default.join(folder, relative2);
10001
+ const file = import_node_path15.default.join(folder, relative2);
9650
10002
  if (isDirectory(file)) {
9651
10003
  for (const inner of walkFiles(file))
9652
10004
  addSynchronized(
9653
10005
  folder,
9654
- import_node_path14.default.relative(folder, inner).split(import_node_path14.default.sep).join("/")
10006
+ import_node_path15.default.relative(folder, inner).split(import_node_path15.default.sep).join("/")
9655
10007
  );
9656
10008
  } else if (import_node_fs14.default.existsSync(file)) addSynchronized(folder, relative2);
9657
10009
  }
@@ -9666,8 +10018,8 @@ function targetMembers(ref) {
9666
10018
  function commonAncestor(dirs) {
9667
10019
  let common = dirs[0];
9668
10020
  for (const dir of dirs) {
9669
- while (common !== import_node_path14.default.dirname(common) && import_node_path14.default.relative(common, dir).startsWith(".."))
9670
- common = import_node_path14.default.dirname(common);
10021
+ while (common !== import_node_path15.default.dirname(common) && import_node_path15.default.relative(common, dir).startsWith(".."))
10022
+ common = import_node_path15.default.dirname(common);
9671
10023
  }
9672
10024
  return common;
9673
10025
  }
@@ -9676,9 +10028,9 @@ function workspaceProjects(xcodeprojOrWorkspace) {
9676
10028
  const projects2 = [];
9677
10029
  const projectAt = /* @__PURE__ */ new Map();
9678
10030
  const addProject = (xcodeproj) => {
9679
- const key = import_node_path14.default.resolve(xcodeproj);
9680
- if (projectAt.has(key) || key.split(import_node_path14.default.sep).includes("Pods")) return;
9681
- if (!import_node_fs14.default.existsSync(import_node_path14.default.join(key, "project.pbxproj"))) return;
10031
+ const key = import_node_path15.default.resolve(xcodeproj);
10032
+ if (projectAt.has(key) || key.split(import_node_path15.default.sep).includes("Pods")) return;
10033
+ if (!xcodeProjectFile(key)) return;
9682
10034
  const project = loadProject(key);
9683
10035
  projectAt.set(key, project);
9684
10036
  projects2.push(project);
@@ -9694,21 +10046,29 @@ function workspaceProjects(xcodeprojOrWorkspace) {
9694
10046
  for (const reference of listed)
9695
10047
  if (reference.endsWith(".xcodeproj")) addProject(reference);
9696
10048
  if (projects2.length === 0) {
9697
- throw new Error(`${import_node_path14.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
10049
+ throw new Error(`${import_node_path15.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
9698
10050
  }
9699
10051
  return { listed, projects: projects2, projectAt };
9700
10052
  }
9701
- var nativeTargets = (project) => list(project.project.targets).flatMap((id) => {
9702
- const target = project.object(id);
9703
- return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
9704
- });
10053
+ var targetRefs = /* @__PURE__ */ new WeakMap();
10054
+ function nativeTargets(project) {
10055
+ let refs = targetRefs.get(project);
10056
+ if (!refs) {
10057
+ refs = list(project.project.targets).flatMap((id) => {
10058
+ const target = project.object(id);
10059
+ return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
10060
+ });
10061
+ targetRefs.set(project, refs);
10062
+ }
10063
+ return refs;
10064
+ }
9705
10065
  function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9706
10066
  const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
9707
10067
  const { listed, projects: projects2, projectAt } = workspaceProjects(xcodeprojOrWorkspace);
9708
10068
  const allTargets = projects2.flatMap(nativeTargets);
9709
10069
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
9710
10070
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
9711
- const container = import_node_path14.default.basename(xcodeprojOrWorkspace);
10071
+ const container = import_node_path15.default.basename(xcodeprojOrWorkspace);
9712
10072
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
9713
10073
  if (named.length !== 1) {
9714
10074
  throw new Error(
@@ -9720,14 +10080,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9720
10080
  for (const ref of allTargets) {
9721
10081
  const product = ref.project.object(str(ref.target.productReference));
9722
10082
  const file = str(product?.path);
9723
- if (file && !byProduct.has(import_node_path14.default.basename(file)))
9724
- byProduct.set(import_node_path14.default.basename(file), ref);
10083
+ if (file && !byProduct.has(import_node_path15.default.basename(file)))
10084
+ byProduct.set(import_node_path15.default.basename(file), ref);
9725
10085
  }
9726
10086
  const proxied = (project, proxyId) => {
9727
10087
  const proxy = project.object(proxyId);
9728
10088
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
9729
10089
  const portal = str(proxy.containerPortal);
9730
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path14.default.resolve(project.resolvePath(portal ?? "") ?? ""));
10090
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path15.default.resolve(project.resolvePath(portal ?? "") ?? ""));
9731
10091
  const remote = str(proxy.remoteGlobalIDString);
9732
10092
  if (!owner || !remote) return void 0;
9733
10093
  return nativeTargets(owner).find(
@@ -9748,7 +10108,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9748
10108
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
9749
10109
  for (const buildFileId of list(phase.files)) {
9750
10110
  const file = project.object(str(project.object(buildFileId)?.fileRef));
9751
- 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;
10111
+ const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path15.default.basename(str(file.path) ?? "")) : void 0;
9752
10112
  if (resolved) found.push(resolved);
9753
10113
  }
9754
10114
  }
@@ -9769,7 +10129,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9769
10129
  const name2 = str(ref.target.name) ?? ref.id;
9770
10130
  const { get: settings2, keys } = targetSettings(ref, {
9771
10131
  TARGET_NAME: name2,
9772
- PROJECT_NAME: import_node_path14.default.basename(ref.project.xcodeproj, ".xcodeproj"),
10132
+ PROJECT_NAME: import_node_path15.default.basename(ref.project.xcodeproj, ".xcodeproj"),
9773
10133
  SRCROOT: ref.project.projectDir,
9774
10134
  SOURCE_ROOT: ref.project.projectDir,
9775
10135
  PROJECT_DIR: ref.project.projectDir,
@@ -9800,7 +10160,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9800
10160
  }
9801
10161
  return value;
9802
10162
  };
9803
- const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path14.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
10163
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path15.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
9804
10164
  const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs14.default.readFileSync(infoPlistFile, "utf8")) : {};
9805
10165
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
9806
10166
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
@@ -9819,12 +10179,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9819
10179
  };
9820
10180
  }
9821
10181
  const localPackageDirs = [
9822
- ...listed.filter((reference) => import_node_fs14.default.existsSync(import_node_path14.default.join(reference, "Package.swift"))),
10182
+ ...listed.filter((reference) => import_node_fs14.default.existsSync(import_node_path15.default.join(reference, "Package.swift"))),
9823
10183
  ...projects2.flatMap(
9824
10184
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
9825
10185
  if (!isDict(entry)) return [];
9826
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path14.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
9827
- return candidate && import_node_fs14.default.existsSync(import_node_path14.default.join(candidate, "Package.swift")) ? [candidate] : [];
10186
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path15.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
10187
+ return candidate && import_node_fs14.default.existsSync(import_node_path15.default.join(candidate, "Package.swift")) ? [candidate] : [];
9828
10188
  })
9829
10189
  )
9830
10190
  ];
@@ -9833,7 +10193,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9833
10193
  const cached3 = graphs.get(dir);
9834
10194
  if (cached3) return cached3;
9835
10195
  const graph = swiftManifestGraph(
9836
- import_node_fs14.default.readFileSync(import_node_path14.default.join(dir, "Package.swift"), "utf8")
10196
+ import_node_fs14.default.readFileSync(import_node_path15.default.join(dir, "Package.swift"), "utf8")
9837
10197
  );
9838
10198
  graphs.set(dir, graph);
9839
10199
  return graph;
@@ -9868,7 +10228,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9868
10228
  });
9869
10229
  } else if (reference?.isa === "XCLocalSwiftPackageReference") {
9870
10230
  localPackages.add(
9871
- import_node_path14.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
10231
+ import_node_path15.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
9872
10232
  );
9873
10233
  } else if (localProducts.has(product)) {
9874
10234
  localPackages.add(localProducts.get(product));
@@ -9880,8 +10240,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9880
10240
  const dir = pending.pop();
9881
10241
  const graph = graphOf(dir);
9882
10242
  for (const relative2 of graph.packagePaths) {
9883
- const next = import_node_path14.default.resolve(dir, relative2);
9884
- if (localPackages.has(next) || !import_node_fs14.default.existsSync(import_node_path14.default.join(next, "Package.swift")))
10243
+ const next = import_node_path15.default.resolve(dir, relative2);
10244
+ if (localPackages.has(next) || !import_node_fs14.default.existsSync(import_node_path15.default.join(next, "Package.swift")))
9885
10245
  continue;
9886
10246
  localPackages.add(next);
9887
10247
  pending.push(next);
@@ -9895,8 +10255,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9895
10255
  }
9896
10256
  }
9897
10257
  }
9898
- const resolvedFile = import_node_path14.default.join(
9899
- workspace ?? import_node_path14.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
10258
+ const resolvedFile = import_node_path15.default.join(
10259
+ workspace ?? import_node_path15.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
9900
10260
  "xcshareddata",
9901
10261
  "swiftpm",
9902
10262
  "Package.resolved"
@@ -9906,12 +10266,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
9906
10266
  ...module2,
9907
10267
  rootDir: commonAncestor(
9908
10268
  [
9909
- workspace ? import_node_path14.default.dirname(workspace) : app.project.projectDir,
10269
+ workspace ? import_node_path15.default.dirname(workspace) : app.project.projectDir,
9910
10270
  ...used.map((project) => project.projectDir),
9911
10271
  ...localPackages
9912
10272
  ].map((dir) => import_node_fs14.default.realpathSync(dir))
9913
10273
  ),
9914
- pbxprojs: [...new Set(used.map((project) => project.pbxproj))].sort(),
10274
+ projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
9915
10275
  infoPlist: import_plist3.default.build(info),
9916
10276
  infoPlistFile,
9917
10277
  frameworks,
@@ -9938,17 +10298,17 @@ var SKIP_SOURCE_DIRS = /* @__PURE__ */ new Set([
9938
10298
  var NATIVE_DESCRIPTOR = ".one-native-source.json";
9939
10299
  var NATIVE_GLUE = ".one-native-source.swift.txt";
9940
10300
  function swiftPackageId(packagePath) {
9941
- return import_node_path15.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
10301
+ return import_node_path16.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
9942
10302
  }
9943
10303
  function nativeSourceDescriptor(packagePath) {
9944
10304
  packagePath = import_node_fs15.default.realpathSync(packagePath);
9945
- const file = import_node_path15.default.join(packagePath, NATIVE_DESCRIPTOR);
10305
+ const file = import_node_path16.default.join(packagePath, NATIVE_DESCRIPTOR);
9946
10306
  if (!import_node_fs15.default.existsSync(file)) return null;
9947
10307
  const value = JSON.parse(
9948
10308
  readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
9949
10309
  );
9950
10310
  const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
9951
- if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs15.default.existsSync(import_node_path15.default.join(packagePath, NATIVE_GLUE))) {
10311
+ if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs15.default.existsSync(import_node_path16.default.join(packagePath, NATIVE_GLUE))) {
9952
10312
  throw invalid();
9953
10313
  }
9954
10314
  if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
@@ -10002,22 +10362,22 @@ function remotePackages(entry, app) {
10002
10362
  var XCODE_APP_DIR = "__app__";
10003
10363
  var XCODE_FRAMEWORKS_DIR = "__frameworks__";
10004
10364
  var XCODE_PACKAGES_DIR = "__packages__";
10005
- var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)}/`;
10365
+ var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)}/`;
10006
10366
  function xcodeInputKey(layout, file, relative2) {
10007
10367
  const owner = layout.targetDirs.get(file);
10008
- if (owner) return import_node_path15.default.posix.join(owner, relative2);
10009
- return relative2.startsWith(CHECKOUTS_PREFIX) ? import_node_path15.default.posix.join(XCODE_PACKAGES_DIR, relative2.slice(CHECKOUTS_PREFIX.length)) : relative2;
10368
+ if (owner) return import_node_path16.default.posix.join(owner, relative2);
10369
+ return relative2.startsWith(CHECKOUTS_PREFIX) ? import_node_path16.default.posix.join(XCODE_PACKAGES_DIR, relative2.slice(CHECKOUTS_PREFIX.length)) : relative2;
10010
10370
  }
10011
10371
  function xcodeLayout(root) {
10012
10372
  const registered = xcodeProjects.get(root);
10013
10373
  if (!registered) return null;
10014
10374
  const app = readXcodeAppTarget(registered.xcodeproj, registered.target);
10015
- const files = /* @__PURE__ */ new Set([...app.pbxprojs, ...app.sources, ...app.resources]);
10375
+ const files = /* @__PURE__ */ new Set([...app.projectFiles, ...app.sources, ...app.resources]);
10016
10376
  if (app.infoPlistFile) files.add(app.infoPlistFile);
10017
10377
  const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
10018
10378
  const targets = [];
10019
10379
  for (const framework of app.frameworks) {
10020
- const dir = import_node_path15.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
10380
+ const dir = import_node_path16.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
10021
10381
  for (const file of framework.sources) {
10022
10382
  if (targetDirs.has(file)) continue;
10023
10383
  targetDirs.set(file, dir);
@@ -10033,21 +10393,21 @@ function xcodeLayout(root) {
10033
10393
  });
10034
10394
  }
10035
10395
  for (const dir of app.localPackages) {
10036
- const manifestFile = import_node_path15.default.join(dir, "Package.swift");
10396
+ const manifestFile = import_node_path16.default.join(dir, "Package.swift");
10037
10397
  files.add(manifestFile);
10038
10398
  const manifest = import_node_fs15.default.readFileSync(manifestFile, "utf8");
10039
- const prefix = import_node_path15.default.relative(root, dir).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
10399
+ const prefix = import_node_path16.default.relative(root, dir).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep);
10040
10400
  const declared = swiftManifestTargets(manifest).filter((target) => !target.executable);
10041
10401
  const all = declared.flatMap(
10042
- (target) => sourceTreeFiles(import_node_path15.default.join(dir, target.path), root).map(
10043
- (file) => import_node_path15.default.relative(dir, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
10402
+ (target) => sourceTreeFiles(import_node_path16.default.join(dir, target.path), root).map(
10403
+ (file) => import_node_path16.default.relative(dir, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
10044
10404
  )
10045
10405
  );
10046
10406
  for (const target of swiftManifestTargets(manifest, all)) {
10047
10407
  if (target.executable) continue;
10048
- targets.push({ ...target, path: import_node_path15.default.posix.join(prefix, target.path) });
10408
+ targets.push({ ...target, path: import_node_path16.default.posix.join(prefix, target.path) });
10049
10409
  for (const relative2 of all) {
10050
- if (relative2.startsWith(`${target.path}/`)) files.add(import_node_path15.default.join(dir, relative2));
10410
+ if (relative2.startsWith(`${target.path}/`)) files.add(import_node_path16.default.join(dir, relative2));
10051
10411
  }
10052
10412
  }
10053
10413
  }
@@ -10055,9 +10415,9 @@ function xcodeLayout(root) {
10055
10415
  for (const target of remote.targets) {
10056
10416
  targets.push({
10057
10417
  ...target,
10058
- path: import_node_path15.default.posix.join(
10418
+ path: import_node_path16.default.posix.join(
10059
10419
  XCODE_PACKAGES_DIR,
10060
- import_node_path15.default.relative(import_node_path15.default.join(root, REMOTE_CHECKOUTS), target.dir).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
10420
+ import_node_path16.default.relative(import_node_path16.default.join(root, REMOTE_CHECKOUTS), target.dir).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
10061
10421
  )
10062
10422
  });
10063
10423
  for (const file of target.files) files.add(file);
@@ -10095,15 +10455,15 @@ function sourceTreeFiles(dir, canonicalRoot) {
10095
10455
  for (const entry of import_node_fs15.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
10096
10456
  if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
10097
10457
  continue;
10098
- const full = import_node_path15.default.join(dir2, entry.name);
10458
+ const full = import_node_path16.default.join(dir2, entry.name);
10099
10459
  if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
10100
10460
  const real = import_node_fs15.default.realpathSync(full);
10101
- const relative2 = import_node_path15.default.relative(canonicalRoot, real);
10102
- if (relative2.startsWith(`..${import_node_path15.default.sep}`) || relative2 === ".." || import_node_path15.default.isAbsolute(relative2)) {
10461
+ const relative2 = import_node_path16.default.relative(canonicalRoot, real);
10462
+ if (relative2.startsWith(`..${import_node_path16.default.sep}`) || relative2 === ".." || import_node_path16.default.isAbsolute(relative2)) {
10103
10463
  throw new Error(`swift input escapes the selected package: ${full}`);
10104
10464
  }
10105
10465
  if (entry.isDirectory()) {
10106
- if (import_node_fs15.default.existsSync(import_node_path15.default.join(full, "Package.swift"))) continue;
10466
+ if (import_node_fs15.default.existsSync(import_node_path16.default.join(full, "Package.swift"))) continue;
10107
10467
  walk2(full);
10108
10468
  } else if (entry.isFile()) {
10109
10469
  found.push(full);
@@ -10116,16 +10476,16 @@ function sourceTreeFiles(dir, canonicalRoot) {
10116
10476
  }
10117
10477
  function readPackageFile(root, file, maxBytes) {
10118
10478
  const canonicalRoot = import_node_fs15.default.realpathSync(root);
10119
- const relative2 = import_node_path15.default.relative(canonicalRoot, import_node_fs15.default.realpathSync(file));
10120
- if (relative2 === ".." || relative2.startsWith(`..${import_node_path15.default.sep}`) || import_node_path15.default.isAbsolute(relative2)) {
10479
+ const relative2 = import_node_path16.default.relative(canonicalRoot, import_node_fs15.default.realpathSync(file));
10480
+ if (relative2 === ".." || relative2.startsWith(`..${import_node_path16.default.sep}`) || import_node_path16.default.isAbsolute(relative2)) {
10121
10481
  throw new Error(`swift input escapes the selected package: ${file}`);
10122
10482
  }
10123
- let ancestor = import_node_path15.default.resolve(file);
10483
+ let ancestor = import_node_path16.default.resolve(file);
10124
10484
  while (ancestor !== canonicalRoot) {
10125
10485
  if (import_node_fs15.default.lstatSync(ancestor).isSymbolicLink()) {
10126
10486
  throw new Error(`swift input is a symlink: ${ancestor}`);
10127
10487
  }
10128
- const parent = import_node_path15.default.dirname(ancestor);
10488
+ const parent = import_node_path16.default.dirname(ancestor);
10129
10489
  if (parent === ancestor)
10130
10490
  throw new Error(`swift input escapes the selected package: ${file}`);
10131
10491
  ancestor = parent;
@@ -10160,7 +10520,7 @@ function sourceFiles(root) {
10160
10520
  }
10161
10521
  function resourceCandidateFiles(root) {
10162
10522
  return packageFiles(root).filter(
10163
- (file) => !file.endsWith(".swift") && import_node_path15.default.basename(file) !== "project.pbxproj"
10523
+ (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path16.default.basename(file))
10164
10524
  );
10165
10525
  }
10166
10526
  var HOSTED_LIMITS = {
@@ -10194,7 +10554,7 @@ function buildSwiftResourceTable(project, baseUrl) {
10194
10554
  const limits = inputLimits(Boolean(project.hosted));
10195
10555
  const absolute = resourceCandidateFiles(project.packagePath);
10196
10556
  const relative2 = absolute.map(
10197
- (file) => import_node_path15.default.relative(project.packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
10557
+ (file) => import_node_path16.default.relative(project.packagePath, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
10198
10558
  );
10199
10559
  const byRelative = new Map(absolute.map((file, index) => [relative2[index], file]));
10200
10560
  const readContents = (candidate) => {
@@ -10222,10 +10582,10 @@ function buildSwiftResourceTable(project, baseUrl) {
10222
10582
  const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
10223
10583
  imageBytes += bytes.length;
10224
10584
  const hash = (0, import_node_crypto5.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
10225
- const ext = import_node_path15.default.posix.extname(file).toLowerCase();
10585
+ const ext = import_node_path16.default.posix.extname(file).toLowerCase();
10226
10586
  table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
10227
10587
  images[name2] = {
10228
- file: import_node_path15.default.posix.basename(file),
10588
+ file: import_node_path16.default.posix.basename(file),
10229
10589
  data: bytes.toString("base64")
10230
10590
  };
10231
10591
  watched.push(file);
@@ -10252,7 +10612,7 @@ function buildSwiftBundleFiles(packagePath, hosted) {
10252
10612
  packagePath = import_node_fs15.default.realpathSync(packagePath);
10253
10613
  const limits = inputLimits(hosted);
10254
10614
  const relative2 = resourceCandidateFiles(packagePath).map(
10255
- (file) => import_node_path15.default.relative(packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
10615
+ (file) => import_node_path16.default.relative(packagePath, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
10256
10616
  );
10257
10617
  const files = {};
10258
10618
  const watched = [];
@@ -10266,12 +10626,12 @@ function buildSwiftBundleFiles(packagePath, hosted) {
10266
10626
  total += bytes.length;
10267
10627
  if (xcode.app.infoPlistFile)
10268
10628
  watched.push(
10269
- import_node_path15.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path15.default.sep).join("/")
10629
+ import_node_path16.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path16.default.sep).join("/")
10270
10630
  );
10271
10631
  }
10272
10632
  for (const { base, file } of enumerateBundleJson(relative2)) {
10273
10633
  watched.push(file);
10274
- const disk = import_node_path15.default.join(packagePath, ...file.split("/"));
10634
+ const disk = import_node_path16.default.join(packagePath, ...file.split("/"));
10275
10635
  if (Object.keys(files).length >= limits.resources || total + import_node_fs15.default.statSync(disk).size > limits.resourceTotalBytes) {
10276
10636
  throw new Error(
10277
10637
  `swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
@@ -10292,7 +10652,7 @@ function linkedModuleRoots(packagePath) {
10292
10652
  try {
10293
10653
  manifest = readPackageFile(
10294
10654
  packagePath,
10295
- import_node_path15.default.join(packagePath, "Package.swift"),
10655
+ import_node_path16.default.join(packagePath, "Package.swift"),
10296
10656
  MAX_SWIFT_COMPILE_SOURCE_BYTES
10297
10657
  ).toString("utf8");
10298
10658
  } catch {
@@ -10301,8 +10661,8 @@ function linkedModuleRoots(packagePath) {
10301
10661
  const roots = /* @__PURE__ */ new Set();
10302
10662
  const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
10303
10663
  for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
10304
- const root = import_node_path15.default.resolve(packagePath, match[1]);
10305
- if (import_node_fs15.default.existsSync(import_node_path15.default.join(root, "Package.swift"))) roots.add(root);
10664
+ const root = import_node_path16.default.resolve(packagePath, match[1]);
10665
+ if (import_node_fs15.default.existsSync(import_node_path16.default.join(root, "Package.swift"))) roots.add(root);
10306
10666
  }
10307
10667
  return [...roots].sort();
10308
10668
  }
@@ -10311,18 +10671,18 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
10311
10671
  hash.update(packagePath);
10312
10672
  const projectInputs = new Set(packageFiles(packagePath));
10313
10673
  for (const file of [...projectInputs].sort()) {
10314
- hash.update(import_node_path15.default.relative(packagePath, file));
10674
+ hash.update(import_node_path16.default.relative(packagePath, file));
10315
10675
  const stat2 = import_node_fs15.default.statSync(file);
10316
10676
  hash.update(`${stat2.mtimeMs}/${stat2.ctimeMs}/${stat2.size}`);
10317
10677
  }
10318
10678
  const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
10319
- (root) => import_node_fs15.default.existsSync(import_node_path15.default.join(root, "toolchain.json"))
10679
+ (root) => import_node_fs15.default.existsSync(import_node_path16.default.join(root, "toolchain.json"))
10320
10680
  );
10321
10681
  if (moduleRoot) {
10322
10682
  hash.update(moduleRoot);
10323
10683
  for (const relative2 of swiftModuleInputFiles(moduleRoot)) {
10324
10684
  hash.update(relative2);
10325
- hash.update(String(import_node_fs15.default.statSync(import_node_path15.default.join(moduleRoot, relative2)).mtimeMs));
10685
+ hash.update(String(import_node_fs15.default.statSync(import_node_path16.default.join(moduleRoot, relative2)).mtimeMs));
10326
10686
  }
10327
10687
  }
10328
10688
  return hash.digest("hex").slice(0, 16);
@@ -10334,8 +10694,8 @@ function packageSources(packagePath) {
10334
10694
  const xcode = xcodeLayout(packagePath);
10335
10695
  const files = {};
10336
10696
  for (const file of sourceFiles(packagePath)) {
10337
- const relative2 = import_node_path15.default.relative(packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
10338
- if (xcode && import_node_path15.default.basename(file) === "Package.swift") continue;
10697
+ const relative2 = import_node_path16.default.relative(packagePath, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep);
10698
+ if (xcode && import_node_path16.default.basename(file) === "Package.swift") continue;
10339
10699
  files[xcode ? xcodeInputKey(xcode, file, relative2) : relative2] = readPackageFile(
10340
10700
  packagePath,
10341
10701
  file,
@@ -10352,7 +10712,7 @@ function packageSnapshot(project) {
10352
10712
  files,
10353
10713
  resourcePaths: swiftImplicitResourcePaths(
10354
10714
  resourceCandidateFiles(project.packagePath).map(
10355
- (file) => import_node_path15.default.relative(project.packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
10715
+ (file) => import_node_path16.default.relative(project.packagePath, file).split(import_node_path16.default.sep).join(import_node_path16.default.posix.sep)
10356
10716
  )
10357
10717
  ),
10358
10718
  resources: buildSwiftResourceTable(project, ""),
@@ -10361,7 +10721,7 @@ function packageSnapshot(project) {
10361
10721
  ...native ? {
10362
10722
  glue: readPackageFile(
10363
10723
  project.packagePath,
10364
- import_node_path15.default.join(project.packagePath, NATIVE_GLUE),
10724
+ import_node_path16.default.join(project.packagePath, NATIVE_GLUE),
10365
10725
  MAX_SWIFT_COMPILE_SOURCE_BYTES
10366
10726
  ).toString("utf8")
10367
10727
  } : {}
@@ -10397,7 +10757,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
10397
10757
  package: content
10398
10758
  };
10399
10759
  const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
10400
- (root) => import_node_fs15.default.existsSync(import_node_path15.default.join(root, "toolchain.json"))
10760
+ (root) => import_node_fs15.default.existsSync(import_node_path16.default.join(root, "toolchain.json"))
10401
10761
  ) ?? await swiftDistributionRoot();
10402
10762
  if (!moduleRoot)
10403
10763
  return {
@@ -10423,10 +10783,10 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
10423
10783
  // server and a capture, or two checkouts) build each other's sources. so
10424
10784
  // each app and module checkout gets its own root, which keeps the same
10425
10785
  // app's incremental build across restarts.
10426
- buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path15.default.join(
10786
+ buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path16.default.join(
10427
10787
  import_node_os5.default.tmpdir(),
10428
10788
  "contrast-swift-build",
10429
- (0, import_node_crypto5.createHash)("sha256").update(`${moduleRoot}\0${import_node_path15.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
10789
+ (0, import_node_crypto5.createHash)("sha256").update(`${moduleRoot}\0${import_node_path16.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
10430
10790
  ),
10431
10791
  moduleRoot,
10432
10792
  ...toolchain
@@ -10511,7 +10871,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
10511
10871
  const auth = hosted ? null : resolveCliAuth();
10512
10872
  if (!hosted && (!auth || auth.kind === "github")) {
10513
10873
  throw new Error(
10514
- `compiling ${import_node_path15.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
10874
+ `compiling ${import_node_path16.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
10515
10875
  );
10516
10876
  }
10517
10877
  const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
@@ -10527,10 +10887,10 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
10527
10887
  });
10528
10888
  if (!submit) throw new Error("swift compile: no credential to submit with");
10529
10889
  const sources = Object.values(snapshot.files);
10530
- const bytes = sources.reduce((total2, text) => total2 + Buffer.byteLength(text), 0);
10890
+ const bytes = sources.reduce((total2, text2) => total2 + Buffer.byteLength(text2), 0);
10531
10891
  if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
10532
10892
  throw new Error(
10533
- `${import_node_path15.default.basename(packagePath)} has ${sources.length} Swift files (${bytes} bytes), over Contrast's compile limits of ${MAX_SWIFT_COMPILE_FILES} files and ${MAX_SWIFT_COMPILE_SOURCE_BYTES} bytes; compile it on this machine with the Swift distribution instead`
10893
+ `${import_node_path16.default.basename(packagePath)} has ${sources.length} Swift files (${bytes} bytes), over Contrast's compile limits of ${MAX_SWIFT_COMPILE_FILES} files and ${MAX_SWIFT_COMPILE_SOURCE_BYTES} bytes; compile it on this machine with the Swift distribution instead`
10534
10894
  );
10535
10895
  }
10536
10896
  const descriptor = snapshot.native;
@@ -10549,7 +10909,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
10549
10909
  );
10550
10910
  if (descriptor && address.native?.hash !== descriptor.hash) {
10551
10911
  throw new Error(
10552
- `${import_node_path15.default.basename(packagePath)}: Contrast compiled native contract ${address.native?.hash ?? "none"} but one typegen wrote ${descriptor.hash}; the app's One and the compile host's differ, or the compile host is older than this peachsim`
10912
+ `${import_node_path16.default.basename(packagePath)}: Contrast compiled native contract ${address.native?.hash ?? "none"} but one typegen wrote ${descriptor.hash}; the app's One and the compile host's differ, or the compile host is older than this peachsim`
10553
10913
  );
10554
10914
  }
10555
10915
  const response = await fetch(address.url, { signal });
@@ -10674,7 +11034,7 @@ var EXPO_SWIFT_ROUTE = "/__peach/expo-swift";
10674
11034
  var EXPO_SWIFT_ENTRY = "Sources/PeachExpoApp/PeachExpoEntry.swift";
10675
11035
  async function collectExpoSwiftSources(appRoot) {
10676
11036
  appRoot = import_node_fs16.default.realpathSync(appRoot);
10677
- const appRequire = (0, import_node_module.createRequire)(import_node_path16.default.join(appRoot, "package.json"));
11037
+ const appRequire = (0, import_node_module.createRequire)(import_node_path17.default.join(appRoot, "package.json"));
10678
11038
  let autolinker;
10679
11039
  try {
10680
11040
  autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
@@ -10688,7 +11048,7 @@ async function collectExpoSwiftSources(appRoot) {
10688
11048
  (command) => run3(
10689
11049
  process.execPath,
10690
11050
  [
10691
- import_node_path16.default.join(import_node_path16.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
11051
+ import_node_path17.default.join(import_node_path17.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
10692
11052
  command,
10693
11053
  "--platform",
10694
11054
  "apple",
@@ -10720,7 +11080,7 @@ async function collectExpoSwiftSources(appRoot) {
10720
11080
  if (typeof sourceRoot !== "string")
10721
11081
  throw new Error("Expo autolinking entry has no path");
10722
11082
  const canonical = import_node_fs16.default.realpathSync(sourceRoot);
10723
- if (canonical.split(import_node_path16.default.sep).includes("node_modules")) continue;
11083
+ if (canonical.split(import_node_path17.default.sep).includes("node_modules")) continue;
10724
11084
  const resolution = resolutions.find(
10725
11085
  (candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
10726
11086
  );
@@ -10746,12 +11106,12 @@ async function collectExpoSwiftSources(appRoot) {
10746
11106
  `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
10747
11107
  );
10748
11108
  }
10749
- const ios = import_node_path16.default.join(canonical, "ios");
11109
+ const ios = import_node_path17.default.join(canonical, "ios");
10750
11110
  if (import_node_fs16.default.lstatSync(ios).isSymbolicLink())
10751
11111
  throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
10752
11112
  const walk2 = (dir) => {
10753
11113
  for (const child of import_node_fs16.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
10754
- const file = import_node_path16.default.join(dir, child.name);
11114
+ const file = import_node_path17.default.join(dir, child.name);
10755
11115
  if (child.isSymbolicLink())
10756
11116
  throw new Error(`Expo Swift source is a symlink: ${file}`);
10757
11117
  if (child.isDirectory()) {
@@ -10764,7 +11124,7 @@ async function collectExpoSwiftSources(appRoot) {
10764
11124
  fileCount++;
10765
11125
  if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
10766
11126
  throw new Error("Expo Swift sources exceed compile service caps");
10767
- files[`Sources/${namespace}/${import_node_path16.default.relative(ios, file).split(import_node_path16.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
11127
+ files[`Sources/${namespace}/${import_node_path17.default.relative(ios, file).split(import_node_path17.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
10768
11128
  ${import_node_fs16.default.readFileSync(file, "utf8")}`;
10769
11129
  }
10770
11130
  };
@@ -10850,7 +11210,7 @@ async function handleExpoSwiftRequest(req, res) {
10850
11210
  return true;
10851
11211
  }
10852
11212
  const root = url.searchParams.get("root");
10853
- if (!root || !import_node_path16.default.isAbsolute(root)) {
11213
+ if (!root || !import_node_path17.default.isAbsolute(root)) {
10854
11214
  res.writeHead(400);
10855
11215
  res.end("missing absolute app root");
10856
11216
  return true;
@@ -10881,7 +11241,7 @@ async function handleExpoSwiftRequest(req, res) {
10881
11241
  continue;
10882
11242
  }
10883
11243
  try {
10884
- const packagePath = import_node_path16.default.join(
11244
+ const packagePath = import_node_path17.default.join(
10885
11245
  import_node_os6.default.tmpdir(),
10886
11246
  "peach-expo-swift",
10887
11247
  key,
@@ -10891,7 +11251,7 @@ async function handleExpoSwiftRequest(req, res) {
10891
11251
  packagePath,
10892
11252
  new Map(
10893
11253
  Object.entries(unit.files).map(([name2, source]) => [
10894
- import_node_path16.default.join(packagePath, name2),
11254
+ import_node_path17.default.join(packagePath, name2),
10895
11255
  source
10896
11256
  ])
10897
11257
  )
@@ -10942,7 +11302,7 @@ async function handleExpoSwiftRequest(req, res) {
10942
11302
  import PackageDescription
10943
11303
  let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.target(name: ${JSON.stringify(name2)}, path: ${JSON.stringify(`Sources/${name2}`)})`).join(", ")}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])
10944
11304
  `;
10945
- const packagePath = import_node_path16.default.join(
11305
+ const packagePath = import_node_path17.default.join(
10946
11306
  import_node_os6.default.tmpdir(),
10947
11307
  "peach-expo-swift",
10948
11308
  key,
@@ -10952,7 +11312,7 @@ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.ta
10952
11312
  packagePath,
10953
11313
  new Map(
10954
11314
  Object.entries(files).map(([name2, source]) => [
10955
- import_node_path16.default.join(packagePath, name2),
11315
+ import_node_path17.default.join(packagePath, name2),
10956
11316
  source
10957
11317
  ])
10958
11318
  )
@@ -11127,18 +11487,18 @@ var rnxRuntime = createRuntimeDelivery(RNX_RUNTIME_PRODUCT);
11127
11487
  // src/host/agent-host.ts
11128
11488
  var import_node_crypto9 = require("node:crypto");
11129
11489
  var import_node_fs20 = __toESM(require("node:fs"), 1);
11130
- var import_node_path20 = __toESM(require("node:path"), 1);
11490
+ var import_node_path21 = __toESM(require("node:path"), 1);
11131
11491
 
11132
11492
  // src/agent-sessions.ts
11133
11493
  var import_node_child_process8 = require("node:child_process");
11134
11494
  var import_node_crypto8 = require("node:crypto");
11135
11495
  var import_node_fs19 = __toESM(require("node:fs"), 1);
11136
- var import_node_path19 = __toESM(require("node:path"), 1);
11496
+ var import_node_path20 = __toESM(require("node:path"), 1);
11137
11497
  var import_node_readline = __toESM(require("node:readline"), 1);
11138
11498
 
11139
11499
  // cli/self-invocation.ts
11140
11500
  var import_node_fs17 = require("node:fs");
11141
- var import_node_path17 = require("node:path");
11501
+ var import_node_path18 = require("node:path");
11142
11502
  var import_node_url3 = require("node:url");
11143
11503
  init_public_brand();
11144
11504
 
@@ -11148,14 +11508,14 @@ var IS_STANDALONE = typeof __SOOTSIM_STANDALONE__ !== "undefined" && __SOOTSIM_S
11148
11508
  // cli/self-invocation.ts
11149
11509
  function sourceEntryPath() {
11150
11510
  try {
11151
- const candidate = (0, import_node_path17.join)((0, import_node_path17.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
11511
+ const candidate = (0, import_node_path18.join)((0, import_node_path18.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
11152
11512
  return (0, import_node_fs17.existsSync)(candidate) ? candidate : null;
11153
11513
  } catch {
11154
11514
  return null;
11155
11515
  }
11156
11516
  }
11157
- function isCliEntry(path20) {
11158
- const name2 = (0, import_node_path17.basename)(path20);
11517
+ function isCliEntry(path21) {
11518
+ const name2 = (0, import_node_path18.basename)(path21);
11159
11519
  return name2 === "bin.ts" || name2 === "bin.js";
11160
11520
  }
11161
11521
  function rnxSelfInvocation() {
@@ -11197,16 +11557,16 @@ function cleanPromptText(value) {
11197
11557
  return typeof value === "string" ? value.trim() : "";
11198
11558
  }
11199
11559
  function encodeAgentPromptEnvelope(input) {
11200
- const text = cleanPromptText(input.text);
11201
- if (!text) return "";
11560
+ const text2 = cleanPromptText(input.text);
11561
+ if (!text2) return "";
11202
11562
  const displayText = cleanPromptText(input.displayText);
11203
11563
  const inspectSummary = cleanPromptText(input.inspectSummary);
11204
11564
  const inspectTrace = cleanPromptText(input.inspectTrace);
11205
- const needsEnvelope = !!inspectSummary || !!inspectTrace || /[\r\n]/.test(text) || !!displayText && displayText !== text;
11206
- if (!needsEnvelope) return text;
11565
+ const needsEnvelope = !!inspectSummary || !!inspectTrace || /[\r\n]/.test(text2) || !!displayText && displayText !== text2;
11566
+ if (!needsEnvelope) return text2;
11207
11567
  return JSON.stringify({
11208
11568
  __sootsimAgentPrompt: ENVELOPE_MARKER,
11209
- text,
11569
+ text: text2,
11210
11570
  displayText,
11211
11571
  inspectSummary,
11212
11572
  inspectTrace
@@ -11216,7 +11576,7 @@ function encodeAgentPromptEnvelope(input) {
11216
11576
  // src/attached-projects.ts
11217
11577
  var import_node_crypto7 = require("node:crypto");
11218
11578
  var import_node_fs18 = __toESM(require("node:fs"), 1);
11219
- var import_node_path18 = __toESM(require("node:path"), 1);
11579
+ var import_node_path19 = __toESM(require("node:path"), 1);
11220
11580
  init_home_paths();
11221
11581
  var overrideDir = null;
11222
11582
  function userDataDir() {
@@ -11229,7 +11589,7 @@ function getUserDataDir() {
11229
11589
  return userDataDir();
11230
11590
  }
11231
11591
  function storeFile() {
11232
- return import_node_path18.default.join(userDataDir(), "attached-projects.json");
11592
+ return import_node_path19.default.join(userDataDir(), "attached-projects.json");
11233
11593
  }
11234
11594
  function cloneEmpty() {
11235
11595
  return {
@@ -11271,7 +11631,7 @@ function loadStore() {
11271
11631
  }
11272
11632
  function writeStore(store) {
11273
11633
  const file = storeFile();
11274
- import_node_fs18.default.mkdirSync(import_node_path18.default.dirname(file), { recursive: true });
11634
+ import_node_fs18.default.mkdirSync(import_node_path19.default.dirname(file), { recursive: true });
11275
11635
  const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
11276
11636
  const fd = import_node_fs18.default.openSync(tmp, "w", 384);
11277
11637
  try {
@@ -11289,13 +11649,13 @@ function mutateStore(fn) {
11289
11649
  return store;
11290
11650
  }
11291
11651
  function projectIdForCwd(cwd) {
11292
- return (0, import_node_crypto7.createHash)("sha256").update(import_node_path18.default.resolve(cwd)).digest("hex").slice(0, 16);
11652
+ return (0, import_node_crypto7.createHash)("sha256").update(import_node_path19.default.resolve(cwd)).digest("hex").slice(0, 16);
11293
11653
  }
11294
11654
  function newSessionId() {
11295
11655
  return `s_${(0, import_node_crypto7.randomBytes)(10).toString("hex")}`;
11296
11656
  }
11297
11657
  function upsertProject(input) {
11298
- const cwd = import_node_path18.default.resolve(input.cwd);
11658
+ const cwd = import_node_path19.default.resolve(input.cwd);
11299
11659
  const id = projectIdForCwd(cwd);
11300
11660
  let result;
11301
11661
  mutateStore((store) => {
@@ -11321,7 +11681,7 @@ function upsertProject(input) {
11321
11681
  const now = Date.now();
11322
11682
  const created = {
11323
11683
  id,
11324
- name: input.name ?? import_node_path18.default.basename(cwd),
11684
+ name: input.name ?? import_node_path19.default.basename(cwd),
11325
11685
  cwd,
11326
11686
  repoRoot: input.repoRoot,
11327
11687
  sourceRoots: input.sourceRoots ?? [cwd],
@@ -11468,7 +11828,7 @@ async function seedFromDemoAppRegistry() {
11468
11828
  mutateStore((store) => {
11469
11829
  for (const app of apps) {
11470
11830
  if (!import_node_fs18.default.existsSync(app.dir)) continue;
11471
- const cwd = import_node_path18.default.resolve(app.dir);
11831
+ const cwd = import_node_path19.default.resolve(app.dir);
11472
11832
  const id = projectIdForCwd(cwd);
11473
11833
  if (store.attachedProjects.some((p) => p.id === id)) continue;
11474
11834
  const now = Date.now();
@@ -11493,16 +11853,16 @@ async function seedFromDemoAppRegistry() {
11493
11853
  // src/agent-sessions.ts
11494
11854
  init_public_brand();
11495
11855
  function sessionDir(sessionId) {
11496
- return import_node_path19.default.join(getUserDataDir(), "sessions", sessionId);
11856
+ return import_node_path20.default.join(getUserDataDir(), "sessions", sessionId);
11497
11857
  }
11498
11858
  function promptFifoPath(sessionId) {
11499
- return import_node_path19.default.join(sessionDir(sessionId), "prompt.in");
11859
+ return import_node_path20.default.join(sessionDir(sessionId), "prompt.in");
11500
11860
  }
11501
11861
  function eventsFifoPath(sessionId) {
11502
- return import_node_path19.default.join(sessionDir(sessionId), "events.out");
11862
+ return import_node_path20.default.join(sessionDir(sessionId), "events.out");
11503
11863
  }
11504
11864
  function transcriptPath(sessionId) {
11505
- return import_node_path19.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
11865
+ return import_node_path20.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
11506
11866
  }
11507
11867
  function pidIsAlive(pid, sessionId) {
11508
11868
  if (!pid) return false;
@@ -11525,8 +11885,8 @@ function resolveSootsimInvocation() {
11525
11885
  const resourcesPath = process.resourcesPath;
11526
11886
  if (resourcesPath) {
11527
11887
  const candidates = [
11528
- import_node_path19.default.join(resourcesPath, "bin", "sootsim"),
11529
- import_node_path19.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
11888
+ import_node_path20.default.join(resourcesPath, "bin", "sootsim"),
11889
+ import_node_path20.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
11530
11890
  ];
11531
11891
  for (const c of candidates) {
11532
11892
  if (import_node_fs19.default.existsSync(c)) return { executable: c, prefixArgs: [] };
@@ -11548,12 +11908,12 @@ function tryWorkspaceSootsim() {
11548
11908
  const sootsimDir = resolveSootsimPackageDir();
11549
11909
  if (!sootsimDir) return null;
11550
11910
  const binaryName = `peach-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`;
11551
- const distBinary = import_node_path19.default.join(sootsimDir, "dist-bin", binaryName);
11911
+ const distBinary = import_node_path20.default.join(sootsimDir, "dist-bin", binaryName);
11552
11912
  if (import_node_fs19.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
11553
- const distBin = import_node_path19.default.join(sootsimDir, "dist-cli", "bin.js");
11913
+ const distBin = import_node_path20.default.join(sootsimDir, "dist-cli", "bin.js");
11554
11914
  if (import_node_fs19.default.existsSync(distBin)) {
11555
11915
  try {
11556
- const src = import_node_path19.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
11916
+ const src = import_node_path20.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
11557
11917
  if (import_node_fs19.default.existsSync(src)) {
11558
11918
  const srcMtime = import_node_fs19.default.statSync(src).mtimeMs;
11559
11919
  const buildMtime = import_node_fs19.default.statSync(distBin).mtimeMs;
@@ -11575,14 +11935,14 @@ function tryWorkspaceSootsim() {
11575
11935
  function resolveSootsimPackageDir() {
11576
11936
  try {
11577
11937
  const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
11578
- return import_node_path19.default.dirname(resolved);
11938
+ return import_node_path20.default.dirname(resolved);
11579
11939
  } catch {
11580
11940
  }
11581
11941
  const here = fileFromImportMeta();
11582
11942
  if (!here) return null;
11583
- let cur = import_node_path19.default.dirname(here);
11943
+ let cur = import_node_path20.default.dirname(here);
11584
11944
  for (let i = 0; i < 8; i++) {
11585
- const pkg = import_node_path19.default.join(cur, "package.json");
11945
+ const pkg = import_node_path20.default.join(cur, "package.json");
11586
11946
  try {
11587
11947
  if (import_node_fs19.default.existsSync(pkg)) {
11588
11948
  const parsed = JSON.parse(import_node_fs19.default.readFileSync(pkg, "utf8"));
@@ -11590,7 +11950,7 @@ function resolveSootsimPackageDir() {
11590
11950
  }
11591
11951
  } catch {
11592
11952
  }
11593
- const parent = import_node_path19.default.dirname(cur);
11953
+ const parent = import_node_path20.default.dirname(cur);
11594
11954
  if (parent === cur) break;
11595
11955
  cur = parent;
11596
11956
  }
@@ -11606,13 +11966,13 @@ function fileFromImportMeta() {
11606
11966
  }
11607
11967
  }
11608
11968
  async function withStartLock(projectId, provider, fn) {
11609
- const lockDir = import_node_path19.default.join(getUserDataDir(), "locks");
11969
+ const lockDir = import_node_path20.default.join(getUserDataDir(), "locks");
11610
11970
  import_node_fs19.default.mkdirSync(lockDir, { recursive: true });
11611
11971
  try {
11612
11972
  import_node_fs19.default.chmodSync(lockDir, 448);
11613
11973
  } catch {
11614
11974
  }
11615
- const lockPath = import_node_path19.default.join(lockDir, `start-${projectId}-${provider}.lock`);
11975
+ const lockPath = import_node_path20.default.join(lockDir, `start-${projectId}-${provider}.lock`);
11616
11976
  const deadline = Date.now() + 4e3;
11617
11977
  let fd = null;
11618
11978
  while (fd === null) {
@@ -11663,7 +12023,7 @@ function isProcessAlive(pid) {
11663
12023
  }
11664
12024
  }
11665
12025
  function mkfifoSync(p) {
11666
- const parent = import_node_path19.default.dirname(p);
12026
+ const parent = import_node_path20.default.dirname(p);
11667
12027
  import_node_fs19.default.mkdirSync(parent, { recursive: true });
11668
12028
  try {
11669
12029
  import_node_fs19.default.chmodSync(parent, 448);
@@ -11728,7 +12088,7 @@ async function startSession(opts) {
11728
12088
  const transcript = transcriptPath(session.id);
11729
12089
  mkfifoSync(promptIn);
11730
12090
  mkfifoSync(eventsOut);
11731
- const transcriptDir = import_node_path19.default.dirname(transcript);
12091
+ const transcriptDir = import_node_path20.default.dirname(transcript);
11732
12092
  import_node_fs19.default.mkdirSync(transcriptDir, { recursive: true });
11733
12093
  try {
11734
12094
  import_node_fs19.default.chmodSync(transcriptDir, 448);
@@ -12162,7 +12522,7 @@ var AgentHost = class {
12162
12522
  );
12163
12523
  const project = upsertProject({
12164
12524
  cwd: match.cwd,
12165
- name: match.projectName ?? import_node_path20.default.basename(match.cwd),
12525
+ name: match.projectName ?? import_node_path21.default.basename(match.cwd),
12166
12526
  preferredProvider: input.provider ?? existing?.preferredProvider,
12167
12527
  sourceRoots: existing?.sourceRoots ?? [match.cwd],
12168
12528
  knownBundleUrls,
@@ -12182,9 +12542,9 @@ var AgentHost = class {
12182
12542
  const dir = getUserDataDir();
12183
12543
  return {
12184
12544
  userDataDir: dir,
12185
- storeFile: import_node_path20.default.join(dir, "attached-projects.json"),
12186
- sessionsDir: import_node_path20.default.join(dir, "sessions"),
12187
- transcriptsDir: import_node_path20.default.join(dir, "transcripts")
12545
+ storeFile: import_node_path21.default.join(dir, "attached-projects.json"),
12546
+ sessionsDir: import_node_path21.default.join(dir, "sessions"),
12547
+ transcriptsDir: import_node_path21.default.join(dir, "transcripts")
12188
12548
  };
12189
12549
  }
12190
12550
  // --- subscription management ---
@@ -13029,7 +13389,7 @@ async function openUrl(url, options = {}) {
13029
13389
 
13030
13390
  // src/host/plane-host.ts
13031
13391
  var import_node_fs22 = __toESM(require("node:fs"), 1);
13032
- var import_node_path22 = __toESM(require("node:path"), 1);
13392
+ var import_node_path23 = __toESM(require("node:path"), 1);
13033
13393
 
13034
13394
  // ../peach-box/src/planeProtocol.ts
13035
13395
  var PLANE_FLAG_READ_ONLY = 1;
@@ -13110,7 +13470,7 @@ async function dispatchPlaneCommand(plane, type, msg, mutationOptions) {
13110
13470
  // cli/commands/box/checkout-plane.ts
13111
13471
  var import_node_child_process9 = require("node:child_process");
13112
13472
  var import_node_fs21 = __toESM(require("node:fs"), 1);
13113
- var import_node_path21 = __toESM(require("node:path"), 1);
13473
+ var import_node_path22 = __toESM(require("node:path"), 1);
13114
13474
  var CheckoutRequiresGitError = class extends Error {
13115
13475
  };
13116
13476
  var BINARY_SNIFF_BYTES = 8192;
@@ -13141,7 +13501,7 @@ var CheckoutFilePlane = class {
13141
13501
  listTimeoutMs;
13142
13502
  trackedOnly;
13143
13503
  constructor(root, options = {}) {
13144
- this.root = import_node_path21.default.resolve(root);
13504
+ this.root = import_node_path22.default.resolve(root);
13145
13505
  this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
13146
13506
  this.trackedOnly = options.trackedOnly ?? false;
13147
13507
  }
@@ -13203,13 +13563,13 @@ var CheckoutFilePlane = class {
13203
13563
  if (!relative2) continue;
13204
13564
  let stat2;
13205
13565
  try {
13206
- stat2 = import_node_fs21.default.statSync(import_node_path21.default.join(this.root, relative2));
13566
+ stat2 = import_node_fs21.default.statSync(import_node_path22.default.join(this.root, relative2));
13207
13567
  } catch {
13208
13568
  continue;
13209
13569
  }
13210
13570
  if (!stat2.isFile()) continue;
13211
13571
  const seen = this.sniffed.get(relative2);
13212
- const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path21.default.join(this.root, relative2), stat2.size);
13572
+ const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path22.default.join(this.root, relative2), stat2.size);
13213
13573
  nextSniffed.set(relative2, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary });
13214
13574
  next.set(relative2, {
13215
13575
  size: stat2.size,
@@ -13223,8 +13583,8 @@ var CheckoutFilePlane = class {
13223
13583
  this.sniffed = nextSniffed;
13224
13584
  }
13225
13585
  absolute(planePath) {
13226
- const resolved = import_node_path21.default.resolve(this.root, planePath);
13227
- if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path21.default.sep}`)) {
13586
+ const resolved = import_node_path22.default.resolve(this.root, planePath);
13587
+ if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path22.default.sep}`)) {
13228
13588
  throw new Error(`path escapes the project: ${planePath}`);
13229
13589
  }
13230
13590
  return resolved;
@@ -13237,7 +13597,7 @@ var CheckoutFilePlane = class {
13237
13597
  }
13238
13598
  async write(planePath, content) {
13239
13599
  const absolute = this.absolute(planePath);
13240
- await import_node_fs21.default.promises.mkdir(import_node_path21.default.dirname(absolute), { recursive: true });
13600
+ await import_node_fs21.default.promises.mkdir(import_node_path22.default.dirname(absolute), { recursive: true });
13241
13601
  await import_node_fs21.default.promises.writeFile(absolute, content);
13242
13602
  this.entries.set(planePath, {
13243
13603
  size: content.byteLength,
@@ -13373,7 +13733,7 @@ var PlaneHost = class {
13373
13733
  // root and an opened one cannot disagree about the same directory.
13374
13734
  realRoot(root) {
13375
13735
  if (!root) throw new Error("root is required");
13376
- const resolved = import_node_path22.default.resolve(root);
13736
+ const resolved = import_node_path23.default.resolve(root);
13377
13737
  let real;
13378
13738
  try {
13379
13739
  real = import_node_fs22.default.realpathSync(resolved);
@@ -13402,7 +13762,7 @@ var PlaneHost = class {
13402
13762
  // src/host/replacement-module-handler.ts
13403
13763
  var import_node_fs23 = require("node:fs");
13404
13764
  var import_promises5 = __toESM(require("node:fs/promises"), 1);
13405
- var import_node_path23 = __toESM(require("node:path"), 1);
13765
+ var import_node_path24 = __toESM(require("node:path"), 1);
13406
13766
 
13407
13767
  // ../contrast-bundler/src/replacementModule.ts
13408
13768
  var import_dist = require("sucrase/dist/index.js");
@@ -13730,13 +14090,13 @@ function sendJavaScript(req, res, source) {
13730
14090
  res.end(req.method === "HEAD" ? void 0 : source);
13731
14091
  }
13732
14092
  function resolveReplacementModuleFile(fromFile, specifier) {
13733
- const base = import_node_path23.default.resolve(import_node_path23.default.dirname(fromFile), specifier);
14093
+ const base = import_node_path24.default.resolve(import_node_path24.default.dirname(fromFile), specifier);
13734
14094
  const candidates = [
13735
14095
  ...REPLACEMENT_MODULE_EXTENSIONS.some(
13736
- (ext) => ext === import_node_path23.default.extname(base).toLowerCase()
14096
+ (ext) => ext === import_node_path24.default.extname(base).toLowerCase()
13737
14097
  ) ? [base] : [],
13738
14098
  ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
13739
- ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path23.default.join(base, `index${ext}`))
14099
+ ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path24.default.join(base, `index${ext}`))
13740
14100
  ];
13741
14101
  const found = candidates.find(
13742
14102
  (candidate) => (0, import_node_fs23.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
@@ -13794,13 +14154,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
13794
14154
  res.end("missing path param");
13795
14155
  return true;
13796
14156
  }
13797
- const extension = import_node_path23.default.extname(targetPath).toLowerCase();
14157
+ const extension = import_node_path24.default.extname(targetPath).toLowerCase();
13798
14158
  if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
13799
14159
  res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
13800
14160
  res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
13801
14161
  return true;
13802
14162
  }
13803
- if (!import_node_path23.default.isAbsolute(targetPath)) {
14163
+ if (!import_node_path24.default.isAbsolute(targetPath)) {
13804
14164
  res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
13805
14165
  res.end("replacement file path must be absolute");
13806
14166
  return true;
@@ -13808,10 +14168,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
13808
14168
  const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
13809
14169
  let resolvedProjectRoot;
13810
14170
  if (options.projectRoot) {
13811
- const lexicalProjectRoot = import_node_path23.default.resolve(options.projectRoot);
14171
+ const lexicalProjectRoot = import_node_path24.default.resolve(options.projectRoot);
13812
14172
  resolvedProjectRoot = await import_promises5.default.realpath(options.projectRoot);
13813
- const lexicalTarget = import_node_path23.default.relative(lexicalProjectRoot, targetPath);
13814
- if (lexicalTarget.startsWith("..") || import_node_path23.default.isAbsolute(lexicalTarget)) {
14173
+ const lexicalTarget = import_node_path24.default.relative(lexicalProjectRoot, targetPath);
14174
+ if (lexicalTarget.startsWith("..") || import_node_path24.default.isAbsolute(lexicalTarget)) {
13815
14175
  res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
13816
14176
  res.end("replacement file must be inside the project root");
13817
14177
  return true;
@@ -13827,8 +14187,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
13827
14187
  return true;
13828
14188
  }
13829
14189
  if (resolvedProjectRoot) {
13830
- const relativeTarget = import_node_path23.default.relative(resolvedProjectRoot, resolvedTargetPath);
13831
- if (relativeTarget.startsWith("..") || import_node_path23.default.isAbsolute(relativeTarget)) {
14190
+ const relativeTarget = import_node_path24.default.relative(resolvedProjectRoot, resolvedTargetPath);
14191
+ if (relativeTarget.startsWith("..") || import_node_path24.default.isAbsolute(relativeTarget)) {
13832
14192
  res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
13833
14193
  res.end("replacement file must be inside the project root");
13834
14194
  return true;
@@ -13854,9 +14214,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
13854
14214
  sendJavaScript(
13855
14215
  req,
13856
14216
  res,
13857
- `${compiled.code}
13858
- //# sourceMappingURL=data:application/json;base64,${map}
13859
- `
14217
+ compiled.code + "\n//# sourceMappingURL=data:application/json;base64," + map + "\n"
13860
14218
  );
13861
14219
  } catch (error) {
13862
14220
  const message = error instanceof Error ? error.message : String(error);
@@ -15278,8 +15636,8 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
15278
15636
  for await (const chunk of req) {
15279
15637
  chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
15280
15638
  }
15281
- const text = Buffer.concat(chunks).toString("utf8").trim();
15282
- const parsed = text ? JSON.parse(text) : {};
15639
+ const text2 = Buffer.concat(chunks).toString("utf8").trim();
15640
+ const parsed = text2 ? JSON.parse(text2) : {};
15283
15641
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
15284
15642
  throw new Error("send to box needs a json object body");
15285
15643
  }