peachsim 0.1.796 → 0.1.798

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 (86) hide show
  1. package/cli/cloud-test-tunnel.ts +1 -1
  2. package/cli/outbound-endpoints.ts +6 -1
  3. package/dist-lib/agent-daemon-client.cjs +1 -1
  4. package/dist-lib/agent-events.cjs +1 -1
  5. package/dist-lib/agent-identity.cjs +1 -1
  6. package/dist-lib/agent-sessions.cjs +1 -1
  7. package/dist-lib/attached-projects.cjs +1 -1
  8. package/dist-lib/auth/shared-session.cjs +1 -1
  9. package/dist-lib/backend-origin.cjs +1 -1
  10. package/dist-lib/beta.cjs +1 -1
  11. package/dist-lib/beta.mjs +1 -1
  12. package/dist-lib/bridge-constants.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.cjs +1 -1
  14. package/dist-lib/bridge-contract-input.mjs +1 -1
  15. package/dist-lib/bridge-contract.cjs +1 -1
  16. package/dist-lib/bridge-contract.mjs +1 -1
  17. package/dist-lib/bundle-channel.cjs +383 -346
  18. package/dist-lib/capture-contract.cjs +1 -1
  19. package/dist-lib/capture-contract.mjs +1 -1
  20. package/dist-lib/cli-constants.cjs +1 -1
  21. package/dist-lib/cloud-contract.cjs +1 -1
  22. package/dist-lib/cloud-contract.mjs +1 -1
  23. package/dist-lib/cloud-test-args.cjs +1 -1
  24. package/dist-lib/cloud-test-args.mjs +1 -1
  25. package/dist-lib/cloud.cjs +1 -1
  26. package/dist-lib/cloud.mjs +1 -1
  27. package/dist-lib/config.cjs +1 -1
  28. package/dist-lib/detox/index.cjs +1 -1
  29. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  30. package/dist-lib/expo-swift-bundle.cjs +356 -326
  31. package/dist-lib/expo-swift-metadata.cjs +1 -1
  32. package/dist-lib/expo-swift-metadata.mjs +1 -1
  33. package/dist-lib/home-paths.cjs +1 -1
  34. package/dist-lib/host/bridge-host.cjs +679 -565
  35. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  37. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  38. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  39. package/dist-lib/host/websocket-proxy.cjs +1 -1
  40. package/dist-lib/index.cjs +401 -178
  41. package/dist-lib/jump-to-source-babel.cjs +1 -1
  42. package/dist-lib/jump-to-source-native.cjs +1 -1
  43. package/dist-lib/kotlin-host.cjs +1 -1
  44. package/dist-lib/menu.cjs +1 -1
  45. package/dist-lib/menu.mjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  47. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  48. package/dist-lib/metro-production-bundle.cjs +1 -1
  49. package/dist-lib/metro-production-bundle.mjs +1 -1
  50. package/dist-lib/metro.cjs +1 -1
  51. package/dist-lib/native-app-identity.cjs +1 -1
  52. package/dist-lib/native-app-identity.mjs +1 -1
  53. package/dist-lib/native-firebase-metadata.cjs +1 -1
  54. package/dist-lib/native-firebase-metadata.mjs +1 -1
  55. package/dist-lib/plist.cjs +1 -1
  56. package/dist-lib/plist.mjs +1 -1
  57. package/dist-lib/profiles.cjs +1 -1
  58. package/dist-lib/public-brand.cjs +1 -1
  59. package/dist-lib/react-native-host-modules.cjs +1 -1
  60. package/dist-lib/react-native-host-modules.mjs +1 -1
  61. package/dist-lib/render-mode.cjs +1 -1
  62. package/dist-lib/scripts/dev-server-scanner.cjs +85 -1
  63. package/dist-lib/sdk.cjs +1 -1
  64. package/dist-lib/sdk.mjs +1 -1
  65. package/dist-lib/skills.cjs +976 -842
  66. package/dist-lib/swift-compile.cjs +30 -5
  67. package/dist-lib/swift-compile.mjs +29 -5
  68. package/dist-lib/swift-package.cjs +1 -1
  69. package/dist-lib/swift-package.mjs +1 -1
  70. package/dist-lib/swift-submit.cjs +1 -1
  71. package/dist-lib/swift-submit.mjs +1 -1
  72. package/dist-lib/swift-toolchain.cjs +1 -1
  73. package/dist-lib/swift.cjs +1 -1
  74. package/dist-lib/vite-swift.cjs +415 -358
  75. package/dist-lib/vite.cjs +240 -15
  76. package/package.json +1 -1
  77. package/scripts/dev-server-scanner.ts +16 -5
  78. package/src/expo-swift-host.ts +8 -4
  79. package/src/one-widget-discovery.ts +17 -0
  80. package/src/one-widget-metadata.ts +208 -0
  81. package/src/one-widget-package.ts +11 -165
  82. package/src/oneWidgetContract.ts +122 -0
  83. package/src/swift-compile.ts +31 -5
  84. package/src/swift-host.ts +2 -48
  85. package/src/swift-source-file.ts +48 -0
  86. package/src/vite-plugin-one.ts +18 -1
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.796 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.798 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -19023,17 +19023,17 @@ function visit(node, visitor) {
19023
19023
  } else
19024
19024
  visit_(null, node, visitor_, Object.freeze([]));
19025
19025
  }
19026
- function visit_(key2, node, visitor, path37) {
19027
- const ctrl = callVisitor(key2, node, visitor, path37);
19026
+ function visit_(key2, node, visitor, path38) {
19027
+ const ctrl = callVisitor(key2, node, visitor, path38);
19028
19028
  if (isNode(ctrl) || isPair(ctrl)) {
19029
- replaceNode(key2, path37, ctrl);
19030
- return visit_(key2, ctrl, visitor, path37);
19029
+ replaceNode(key2, path38, ctrl);
19030
+ return visit_(key2, ctrl, visitor, path38);
19031
19031
  }
19032
19032
  if (typeof ctrl !== "symbol") {
19033
19033
  if (isCollection(node)) {
19034
- path37 = Object.freeze(path37.concat(node));
19034
+ path38 = Object.freeze(path38.concat(node));
19035
19035
  for (let i = 0; i < node.items.length; ++i) {
19036
- const ci = visit_(i, node.items[i], visitor, path37);
19036
+ const ci = visit_(i, node.items[i], visitor, path38);
19037
19037
  if (typeof ci === "number")
19038
19038
  i = ci - 1;
19039
19039
  else if (ci === BREAK)
@@ -19044,13 +19044,13 @@ function visit_(key2, node, visitor, path37) {
19044
19044
  }
19045
19045
  }
19046
19046
  } else if (isPair(node)) {
19047
- path37 = Object.freeze(path37.concat(node));
19048
- const ck = visit_("key", node.key, visitor, path37);
19047
+ path38 = Object.freeze(path38.concat(node));
19048
+ const ck = visit_("key", node.key, visitor, path38);
19049
19049
  if (ck === BREAK)
19050
19050
  return BREAK;
19051
19051
  else if (ck === REMOVE)
19052
19052
  node.key = null;
19053
- const cv = visit_("value", node.value, visitor, path37);
19053
+ const cv = visit_("value", node.value, visitor, path38);
19054
19054
  if (cv === BREAK)
19055
19055
  return BREAK;
19056
19056
  else if (cv === REMOVE)
@@ -19068,17 +19068,17 @@ async function visitAsync(node, visitor) {
19068
19068
  } else
19069
19069
  await visitAsync_(null, node, visitor_, Object.freeze([]));
19070
19070
  }
19071
- async function visitAsync_(key2, node, visitor, path37) {
19072
- const ctrl = await callVisitor(key2, node, visitor, path37);
19071
+ async function visitAsync_(key2, node, visitor, path38) {
19072
+ const ctrl = await callVisitor(key2, node, visitor, path38);
19073
19073
  if (isNode(ctrl) || isPair(ctrl)) {
19074
- replaceNode(key2, path37, ctrl);
19075
- return visitAsync_(key2, ctrl, visitor, path37);
19074
+ replaceNode(key2, path38, ctrl);
19075
+ return visitAsync_(key2, ctrl, visitor, path38);
19076
19076
  }
19077
19077
  if (typeof ctrl !== "symbol") {
19078
19078
  if (isCollection(node)) {
19079
- path37 = Object.freeze(path37.concat(node));
19079
+ path38 = Object.freeze(path38.concat(node));
19080
19080
  for (let i = 0; i < node.items.length; ++i) {
19081
- const ci = await visitAsync_(i, node.items[i], visitor, path37);
19081
+ const ci = await visitAsync_(i, node.items[i], visitor, path38);
19082
19082
  if (typeof ci === "number")
19083
19083
  i = ci - 1;
19084
19084
  else if (ci === BREAK)
@@ -19089,13 +19089,13 @@ async function visitAsync_(key2, node, visitor, path37) {
19089
19089
  }
19090
19090
  }
19091
19091
  } else if (isPair(node)) {
19092
- path37 = Object.freeze(path37.concat(node));
19093
- const ck = await visitAsync_("key", node.key, visitor, path37);
19092
+ path38 = Object.freeze(path38.concat(node));
19093
+ const ck = await visitAsync_("key", node.key, visitor, path38);
19094
19094
  if (ck === BREAK)
19095
19095
  return BREAK;
19096
19096
  else if (ck === REMOVE)
19097
19097
  node.key = null;
19098
- const cv = await visitAsync_("value", node.value, visitor, path37);
19098
+ const cv = await visitAsync_("value", node.value, visitor, path38);
19099
19099
  if (cv === BREAK)
19100
19100
  return BREAK;
19101
19101
  else if (cv === REMOVE)
@@ -19122,23 +19122,23 @@ function initVisitor(visitor) {
19122
19122
  }
19123
19123
  return visitor;
19124
19124
  }
19125
- function callVisitor(key2, node, visitor, path37) {
19125
+ function callVisitor(key2, node, visitor, path38) {
19126
19126
  if (typeof visitor === "function")
19127
- return visitor(key2, node, path37);
19127
+ return visitor(key2, node, path38);
19128
19128
  if (isMap(node))
19129
- return visitor.Map?.(key2, node, path37);
19129
+ return visitor.Map?.(key2, node, path38);
19130
19130
  if (isSeq(node))
19131
- return visitor.Seq?.(key2, node, path37);
19131
+ return visitor.Seq?.(key2, node, path38);
19132
19132
  if (isPair(node))
19133
- return visitor.Pair?.(key2, node, path37);
19133
+ return visitor.Pair?.(key2, node, path38);
19134
19134
  if (isScalar(node))
19135
- return visitor.Scalar?.(key2, node, path37);
19135
+ return visitor.Scalar?.(key2, node, path38);
19136
19136
  if (isAlias(node))
19137
- return visitor.Alias?.(key2, node, path37);
19137
+ return visitor.Alias?.(key2, node, path38);
19138
19138
  return void 0;
19139
19139
  }
19140
- function replaceNode(key2, path37, node) {
19141
- const parent = path37[path37.length - 1];
19140
+ function replaceNode(key2, path38, node) {
19141
+ const parent = path38[path38.length - 1];
19142
19142
  if (isCollection(parent)) {
19143
19143
  parent.items[key2] = node;
19144
19144
  } else if (isPair(parent)) {
@@ -19738,10 +19738,10 @@ var init_createNode = __esm({
19738
19738
  });
19739
19739
 
19740
19740
  // ../../node_modules/yaml/browser/dist/nodes/Collection.js
19741
- function collectionFromPath(schema4, path37, value) {
19741
+ function collectionFromPath(schema4, path38, value) {
19742
19742
  let v = value;
19743
- for (let i = path37.length - 1; i >= 0; --i) {
19744
- const k = path37[i];
19743
+ for (let i = path38.length - 1; i >= 0; --i) {
19744
+ const k = path38[i];
19745
19745
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
19746
19746
  const a = [];
19747
19747
  a[k] = v;
@@ -19766,7 +19766,7 @@ var init_Collection = __esm({
19766
19766
  init_createNode();
19767
19767
  init_identity();
19768
19768
  init_Node();
19769
- isEmptyPath = (path37) => path37 == null || typeof path37 === "object" && !!path37[Symbol.iterator]().next().done;
19769
+ isEmptyPath = (path38) => path38 == null || typeof path38 === "object" && !!path38[Symbol.iterator]().next().done;
19770
19770
  Collection = class extends NodeBase {
19771
19771
  constructor(type, schema4) {
19772
19772
  super(type);
@@ -19796,11 +19796,11 @@ var init_Collection = __esm({
19796
19796
  * be a Pair instance or a `{ key, value }` object, which may not have a key
19797
19797
  * that already exists in the map.
19798
19798
  */
19799
- addIn(path37, value) {
19800
- if (isEmptyPath(path37))
19799
+ addIn(path38, value) {
19800
+ if (isEmptyPath(path38))
19801
19801
  this.add(value);
19802
19802
  else {
19803
- const [key2, ...rest] = path37;
19803
+ const [key2, ...rest] = path38;
19804
19804
  const node = this.get(key2, true);
19805
19805
  if (isCollection(node))
19806
19806
  node.addIn(rest, value);
@@ -19814,8 +19814,8 @@ var init_Collection = __esm({
19814
19814
  * Removes a value from the collection.
19815
19815
  * @returns `true` if the item was found and removed.
19816
19816
  */
19817
- deleteIn(path37) {
19818
- const [key2, ...rest] = path37;
19817
+ deleteIn(path38) {
19818
+ const [key2, ...rest] = path38;
19819
19819
  if (rest.length === 0)
19820
19820
  return this.delete(key2);
19821
19821
  const node = this.get(key2, true);
@@ -19829,8 +19829,8 @@ var init_Collection = __esm({
19829
19829
  * scalar values from their surrounding node; to disable set `keepScalar` to
19830
19830
  * `true` (collections are always returned intact).
19831
19831
  */
19832
- getIn(path37, keepScalar) {
19833
- const [key2, ...rest] = path37;
19832
+ getIn(path38, keepScalar) {
19833
+ const [key2, ...rest] = path38;
19834
19834
  const node = this.get(key2, true);
19835
19835
  if (rest.length === 0)
19836
19836
  return !keepScalar && isScalar(node) ? node.value : node;
@@ -19848,8 +19848,8 @@ var init_Collection = __esm({
19848
19848
  /**
19849
19849
  * Checks if the collection includes a value with the key `key`.
19850
19850
  */
19851
- hasIn(path37) {
19852
- const [key2, ...rest] = path37;
19851
+ hasIn(path38) {
19852
+ const [key2, ...rest] = path38;
19853
19853
  if (rest.length === 0)
19854
19854
  return this.has(key2);
19855
19855
  const node = this.get(key2, true);
@@ -19859,8 +19859,8 @@ var init_Collection = __esm({
19859
19859
  * Sets a value in this collection. For `!!set`, `value` needs to be a
19860
19860
  * boolean to add/remove the item from the set.
19861
19861
  */
19862
- setIn(path37, value) {
19863
- const [key2, ...rest] = path37;
19862
+ setIn(path38, value) {
19863
+ const [key2, ...rest] = path38;
19864
19864
  if (rest.length === 0) {
19865
19865
  this.set(key2, value);
19866
19866
  } else {
@@ -22294,9 +22294,9 @@ var init_Document = __esm({
22294
22294
  this.contents.add(value);
22295
22295
  }
22296
22296
  /** Adds a value to the document. */
22297
- addIn(path37, value) {
22297
+ addIn(path38, value) {
22298
22298
  if (assertCollection(this.contents))
22299
- this.contents.addIn(path37, value);
22299
+ this.contents.addIn(path38, value);
22300
22300
  }
22301
22301
  /**
22302
22302
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -22371,14 +22371,14 @@ var init_Document = __esm({
22371
22371
  * Removes a value from the document.
22372
22372
  * @returns `true` if the item was found and removed.
22373
22373
  */
22374
- deleteIn(path37) {
22375
- if (isEmptyPath(path37)) {
22374
+ deleteIn(path38) {
22375
+ if (isEmptyPath(path38)) {
22376
22376
  if (this.contents == null)
22377
22377
  return false;
22378
22378
  this.contents = null;
22379
22379
  return true;
22380
22380
  }
22381
- return assertCollection(this.contents) ? this.contents.deleteIn(path37) : false;
22381
+ return assertCollection(this.contents) ? this.contents.deleteIn(path38) : false;
22382
22382
  }
22383
22383
  /**
22384
22384
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -22393,10 +22393,10 @@ var init_Document = __esm({
22393
22393
  * scalar values from their surrounding node; to disable set `keepScalar` to
22394
22394
  * `true` (collections are always returned intact).
22395
22395
  */
22396
- getIn(path37, keepScalar) {
22397
- if (isEmptyPath(path37))
22396
+ getIn(path38, keepScalar) {
22397
+ if (isEmptyPath(path38))
22398
22398
  return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
22399
- return isCollection(this.contents) ? this.contents.getIn(path37, keepScalar) : void 0;
22399
+ return isCollection(this.contents) ? this.contents.getIn(path38, keepScalar) : void 0;
22400
22400
  }
22401
22401
  /**
22402
22402
  * Checks if the document includes a value with the key `key`.
@@ -22407,10 +22407,10 @@ var init_Document = __esm({
22407
22407
  /**
22408
22408
  * Checks if the document includes a value at `path`.
22409
22409
  */
22410
- hasIn(path37) {
22411
- if (isEmptyPath(path37))
22410
+ hasIn(path38) {
22411
+ if (isEmptyPath(path38))
22412
22412
  return this.contents !== void 0;
22413
- return isCollection(this.contents) ? this.contents.hasIn(path37) : false;
22413
+ return isCollection(this.contents) ? this.contents.hasIn(path38) : false;
22414
22414
  }
22415
22415
  /**
22416
22416
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -22427,13 +22427,13 @@ var init_Document = __esm({
22427
22427
  * Sets a value in this document. For `!!set`, `value` needs to be a
22428
22428
  * boolean to add/remove the item from the set.
22429
22429
  */
22430
- setIn(path37, value) {
22431
- if (isEmptyPath(path37)) {
22430
+ setIn(path38, value) {
22431
+ if (isEmptyPath(path38)) {
22432
22432
  this.contents = value;
22433
22433
  } else if (this.contents == null) {
22434
- this.contents = collectionFromPath(this.schema, Array.from(path37), value);
22434
+ this.contents = collectionFromPath(this.schema, Array.from(path38), value);
22435
22435
  } else if (assertCollection(this.contents)) {
22436
- this.contents.setIn(path37, value);
22436
+ this.contents.setIn(path38, value);
22437
22437
  }
22438
22438
  }
22439
22439
  /**
@@ -24338,15 +24338,15 @@ function visit2(cst, visitor) {
24338
24338
  cst = { start: cst.start, value: cst.value };
24339
24339
  _visit(Object.freeze([]), cst, visitor);
24340
24340
  }
24341
- function _visit(path37, item, visitor) {
24342
- let ctrl = visitor(item, path37);
24341
+ function _visit(path38, item, visitor) {
24342
+ let ctrl = visitor(item, path38);
24343
24343
  if (typeof ctrl === "symbol")
24344
24344
  return ctrl;
24345
24345
  for (const field of ["key", "value"]) {
24346
24346
  const token = item[field];
24347
24347
  if (token && "items" in token) {
24348
24348
  for (let i = 0; i < token.items.length; ++i) {
24349
- const ci = _visit(Object.freeze(path37.concat([[field, i]])), token.items[i], visitor);
24349
+ const ci = _visit(Object.freeze(path38.concat([[field, i]])), token.items[i], visitor);
24350
24350
  if (typeof ci === "number")
24351
24351
  i = ci - 1;
24352
24352
  else if (ci === BREAK2)
@@ -24357,10 +24357,10 @@ function _visit(path37, item, visitor) {
24357
24357
  }
24358
24358
  }
24359
24359
  if (typeof ctrl === "function" && field === "key")
24360
- ctrl = ctrl(item, path37);
24360
+ ctrl = ctrl(item, path38);
24361
24361
  }
24362
24362
  }
24363
- return typeof ctrl === "function" ? ctrl(item, path37) : ctrl;
24363
+ return typeof ctrl === "function" ? ctrl(item, path38) : ctrl;
24364
24364
  }
24365
24365
  var BREAK2, SKIP2, REMOVE2;
24366
24366
  var init_cst_visit = __esm({
@@ -24371,9 +24371,9 @@ var init_cst_visit = __esm({
24371
24371
  visit2.BREAK = BREAK2;
24372
24372
  visit2.SKIP = SKIP2;
24373
24373
  visit2.REMOVE = REMOVE2;
24374
- visit2.itemAtPath = (cst, path37) => {
24374
+ visit2.itemAtPath = (cst, path38) => {
24375
24375
  let item = cst;
24376
- for (const [field, index] of path37) {
24376
+ for (const [field, index] of path38) {
24377
24377
  const tok = item?.[field];
24378
24378
  if (tok && "items" in tok) {
24379
24379
  item = tok.items[index];
@@ -24382,9 +24382,9 @@ var init_cst_visit = __esm({
24382
24382
  }
24383
24383
  return item;
24384
24384
  };
24385
- visit2.parentCollection = (cst, path37) => {
24386
- const parent = visit2.itemAtPath(cst, path37.slice(0, -1));
24387
- const field = path37[path37.length - 1][0];
24385
+ visit2.parentCollection = (cst, path38) => {
24386
+ const parent = visit2.itemAtPath(cst, path38.slice(0, -1));
24387
+ const field = path38[path38.length - 1][0];
24388
24388
  const coll = parent?.[field];
24389
24389
  if (coll && "items" in coll)
24390
24390
  return coll;
@@ -25687,14 +25687,14 @@ var init_parser = __esm({
25687
25687
  case "scalar":
25688
25688
  case "single-quoted-scalar":
25689
25689
  case "double-quoted-scalar": {
25690
- const fs34 = this.flowScalar(this.type);
25690
+ const fs35 = this.flowScalar(this.type);
25691
25691
  if (atNextItem || it.value) {
25692
- map2.items.push({ start, key: fs34, sep: [] });
25692
+ map2.items.push({ start, key: fs35, sep: [] });
25693
25693
  this.onKeyLine = true;
25694
25694
  } else if (it.sep) {
25695
- this.stack.push(fs34);
25695
+ this.stack.push(fs35);
25696
25696
  } else {
25697
- Object.assign(it, { key: fs34, sep: [] });
25697
+ Object.assign(it, { key: fs35, sep: [] });
25698
25698
  this.onKeyLine = true;
25699
25699
  }
25700
25700
  return;
@@ -25822,13 +25822,13 @@ var init_parser = __esm({
25822
25822
  case "scalar":
25823
25823
  case "single-quoted-scalar":
25824
25824
  case "double-quoted-scalar": {
25825
- const fs34 = this.flowScalar(this.type);
25825
+ const fs35 = this.flowScalar(this.type);
25826
25826
  if (!it || it.value)
25827
- fc.items.push({ start: [], key: fs34, sep: [] });
25827
+ fc.items.push({ start: [], key: fs35, sep: [] });
25828
25828
  else if (it.sep)
25829
- this.stack.push(fs34);
25829
+ this.stack.push(fs35);
25830
25830
  else
25831
- Object.assign(it, { key: fs34, sep: [] });
25831
+ Object.assign(it, { key: fs35, sep: [] });
25832
25832
  return;
25833
25833
  }
25834
25834
  case "flow-map-end":
@@ -26768,6 +26768,95 @@ var init_native_dev_bundle_url = __esm({
26768
26768
  }
26769
26769
  });
26770
26770
 
26771
+ // src/oneWidgetContract.ts
26772
+ function configuredWidgetFromScan(value, bundleUrl) {
26773
+ if (!Array.isArray(value)) return null;
26774
+ const requested = new URL(bundleUrl);
26775
+ for (const entry of value) {
26776
+ if (!entry || typeof entry !== "object") continue;
26777
+ const widget = Reflect.get(entry, "widget");
26778
+ if (!widget || typeof widget !== "object") continue;
26779
+ const metadata = Reflect.get(widget, "metadata");
26780
+ const advertisedUrl = Reflect.get(widget, "bundleUrl");
26781
+ const packageUrl = Reflect.get(widget, "packageUrl");
26782
+ const projectRoot = Reflect.get(widget, "projectRoot");
26783
+ const appIdentity = Reflect.get(widget, "appIdentity");
26784
+ const urlSchemes = Reflect.get(widget, "urlSchemes");
26785
+ if (typeof advertisedUrl !== "string" || typeof packageUrl !== "string" || typeof projectRoot !== "string" || !projectRoot || typeof appIdentity !== "string" || !/^[a-f0-9]{64}$/.test(appIdentity) || !Array.isArray(urlSchemes) || !urlSchemes.every(
26786
+ (scheme) => typeof scheme === "string" && /^[A-Za-z][A-Za-z0-9+.-]*$/.test(scheme)
26787
+ ) || !metadata || typeof metadata !== "object")
26788
+ continue;
26789
+ const advertised = new URL(alignLoopbackBundleUrlWithProbe(advertisedUrl, bundleUrl));
26790
+ if (advertised.protocol !== requested.protocol || advertised.port !== requested.port || advertised.hostname !== requested.hostname || advertised.pathname !== requested.pathname)
26791
+ continue;
26792
+ if (["rnxProjectId", "rnxReplacementToken"].some(
26793
+ (key2) => requested.searchParams.has(key2) && requested.searchParams.get(key2) !== advertised.searchParams.get(key2)
26794
+ ))
26795
+ continue;
26796
+ if (new URL(packageUrl).origin !== new URL(advertisedUrl).origin || new URL(packageUrl).pathname !== "/__peach/swift-package/OneWidgets")
26797
+ continue;
26798
+ const appName = Reflect.get(metadata, "appName");
26799
+ const bundleId = Reflect.get(metadata, "bundleId");
26800
+ const kind = Reflect.get(metadata, "kind");
26801
+ const suite = Reflect.get(metadata, "suite");
26802
+ const displayName = Reflect.get(metadata, "displayName");
26803
+ const description = Reflect.get(metadata, "description");
26804
+ const sources = Reflect.get(metadata, "sources");
26805
+ if (typeof appName !== "string" || !/^[A-Za-z][A-Za-z0-9_]*$/.test(appName) || typeof bundleId !== "string" || !bundleId || typeof kind !== "string" || !kind || typeof suite !== "string" || !suite || typeof displayName !== "string" || !displayName || typeof description !== "string" || !description || !sources || typeof sources !== "object" || Array.isArray(sources))
26806
+ continue;
26807
+ const sourceHashes = {};
26808
+ for (const [file, hash] of Object.entries(sources)) {
26809
+ if (typeof hash !== "string" || !/^[a-f0-9]{64}$/.test(hash)) return null;
26810
+ sourceHashes[file] = hash;
26811
+ }
26812
+ if (Object.keys(sourceHashes).length !== 2 || !sourceHashes["ios/OneWidgets/OneWidget.swift"] || !sourceHashes[`ios/${appName}/OneWidgetContract.swift`])
26813
+ continue;
26814
+ return {
26815
+ metadata: {
26816
+ appName,
26817
+ bundleId,
26818
+ kind,
26819
+ suite,
26820
+ displayName,
26821
+ description,
26822
+ sources: sourceHashes
26823
+ },
26824
+ bundleUrl,
26825
+ packageUrl: new URL("/__peach/swift-package/OneWidgets", requested).href,
26826
+ projectRoot,
26827
+ appIdentity,
26828
+ urlSchemes
26829
+ };
26830
+ }
26831
+ return null;
26832
+ }
26833
+ var init_oneWidgetContract = __esm({
26834
+ "src/oneWidgetContract.ts"() {
26835
+ "use strict";
26836
+ init_native_dev_bundle_url();
26837
+ }
26838
+ });
26839
+
26840
+ // src/one-widget-discovery.ts
26841
+ async function readConfiguredOneWidget(bundleUrl) {
26842
+ try {
26843
+ const response = await fetch(new URL("/__server-scan", bundleUrl).href, {
26844
+ signal: AbortSignal.timeout(3e4)
26845
+ });
26846
+ if (!response.ok || !response.headers.get("content-type")?.includes("json"))
26847
+ return null;
26848
+ return configuredWidgetFromScan(await response.json(), bundleUrl);
26849
+ } catch {
26850
+ return null;
26851
+ }
26852
+ }
26853
+ var init_one_widget_discovery = __esm({
26854
+ "src/one-widget-discovery.ts"() {
26855
+ "use strict";
26856
+ init_oneWidgetContract();
26857
+ }
26858
+ });
26859
+
26771
26860
  // ../../node_modules/plist/lib/parse.js
26772
26861
  var require_parse = __commonJS({
26773
26862
  "../../node_modules/plist/lib/parse.js"(exports2) {
@@ -27096,9 +27185,9 @@ function safeChildPlistName(value) {
27096
27185
  name: file.toLowerCase().endsWith(".plist") ? file : `${file}.plist`
27097
27186
  };
27098
27187
  }
27099
- async function readableSettingsBundle(path37) {
27188
+ async function readableSettingsBundle(path38) {
27100
27189
  try {
27101
- const root = await (0, import_promises.stat)((0, import_node_path.join)(path37, "Root.plist"));
27190
+ const root = await (0, import_promises.stat)((0, import_node_path.join)(path38, "Root.plist"));
27102
27191
  return root.isFile() && root.size <= MAX_PLIST_BYTES;
27103
27192
  } catch {
27104
27193
  return false;
@@ -27143,11 +27232,11 @@ async function settingsBundleFingerprint(bundlePath) {
27143
27232
  return null;
27144
27233
  }
27145
27234
  }
27146
- async function parsePlistRecord(path37) {
27235
+ async function parsePlistRecord(path38) {
27147
27236
  try {
27148
- const metadata = await (0, import_promises.stat)(path37);
27237
+ const metadata = await (0, import_promises.stat)(path38);
27149
27238
  if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
27150
- const source = await (0, import_promises.readFile)(path37, "utf8");
27239
+ const source = await (0, import_promises.readFile)(path38, "utf8");
27151
27240
  const parsed = parsePlistSource(source);
27152
27241
  return isRecord2(parsed) ? parsed : null;
27153
27242
  } catch {
@@ -27471,7 +27560,7 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
27471
27560
  return null;
27472
27561
  }
27473
27562
  }
27474
- function httpGet(hostname, port, path37, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
27563
+ function httpGet(hostname, port, path38, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
27475
27564
  return new Promise((resolve10) => {
27476
27565
  let settled = false;
27477
27566
  let killing = false;
@@ -27480,7 +27569,7 @@ function httpGet(hostname, port, path37, method = "GET", timeout = TIMEOUT_MS, h
27480
27569
  settled = true;
27481
27570
  resolve10(value);
27482
27571
  };
27483
- const req = import_http.default.request({ hostname, port, path: path37, method, headers }, (res) => {
27572
+ const req = import_http.default.request({ hostname, port, path: path38, method, headers }, (res) => {
27484
27573
  let body = "";
27485
27574
  res.on("data", (c) => body += c.toString());
27486
27575
  const contentType = (() => {
@@ -28051,6 +28140,13 @@ async function scanDevServers(opts = {}) {
28051
28140
  if (result) results.push(result);
28052
28141
  });
28053
28142
  }
28143
+ await Promise.all(
28144
+ results.map(async (result) => {
28145
+ result.widget = null;
28146
+ if (result.framework !== "one" && result.framework !== "vxrn") return;
28147
+ result.widget = await readConfiguredOneWidget(result.bundleUrl);
28148
+ })
28149
+ );
28054
28150
  const pidByPort = /* @__PURE__ */ new Map();
28055
28151
  for (const { port, pid } of processes) {
28056
28152
  if (pid > 0) pidByPort.set(port, pid);
@@ -28086,6 +28182,7 @@ var init_dev_server_scanner = __esm({
28086
28182
  init_backend_origin();
28087
28183
  init_config();
28088
28184
  init_native_dev_bundle_url();
28185
+ init_one_widget_discovery();
28089
28186
  init_settings_bundle();
28090
28187
  init_optional_demo_registry();
28091
28188
  TIMEOUT_MS = 250;
@@ -29388,8 +29485,12 @@ function emitSwiftPackageManifest(args) {
29388
29485
  (name2) => OPTIONAL_FRAMEWORKS.has(name2) && !targets.some((target) => target.name === name2)
29389
29486
  ).flatMap((name2) => [name2, ...OPTIONAL_FRAMEWORK_DEPENDENCIES[name2] ?? []])
29390
29487
  );
29488
+ if (spriteKit) {
29489
+ reachedFrameworks.add("SpriteKit");
29490
+ reachedFrameworks.add("PeachBox2D");
29491
+ }
29391
29492
  const distributionObjects = distribution?.objects.filter(
29392
- (object) => [...OPTIONAL_FRAMEWORKS].every(
29493
+ (object) => [...OPTIONAL_FRAMEWORKS, "SpriteKit", "PeachBox2D"].every(
29393
29494
  (name2) => !object.startsWith(`lib/${name2}-`) || reachedFrameworks.has(name2)
29394
29495
  )
29395
29496
  );
@@ -30522,7 +30623,17 @@ function compileSwiftProjectUnit(input, options) {
30522
30623
  ])
30523
30624
  ],
30524
30625
  {
30525
- env: BUILD_ENV,
30626
+ env: {
30627
+ ...BUILD_ENV,
30628
+ // shipped host plugins resolve against the selected compiler's runtime.
30629
+ ...process.platform === "linux" ? {
30630
+ LD_LIBRARY_PATH: [
30631
+ import_node_path7.default.resolve(options.toolchainBin, "../lib/swift/linux"),
30632
+ import_node_path7.default.resolve(options.toolchainBin, "../lib/swift/host"),
30633
+ process.env.LD_LIBRARY_PATH
30634
+ ].filter(Boolean).join(":")
30635
+ } : {}
30636
+ },
30526
30637
  maxBuffer: 64 * 1024 * 1024,
30527
30638
  timeout: options.timeoutMs
30528
30639
  }
@@ -30539,7 +30650,7 @@ function compileSwiftProjectUnit(input, options) {
30539
30650
  };
30540
30651
  });
30541
30652
  }
30542
- var import_node_child_process4, import_node_crypto3, import_node_fs7, import_node_os2, import_node_path7, import_node_util2, run2, WASM_TRIPLE, cores, BUILD_ENV, BUILD_JOBS, linkedModuleDigests, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, sdkPaths, availableModules, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, MULTI_MANIFEST_VERSION, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, TYPE_AFTER_ATTRIBUTE, DELEGATE_CLASS, REUSABLE_INIT, REUSABLE_VIEW_BASES, CLASS_BASE, FRAME_INIT, APPLE_CLASS, EXTENSION_DECL, CLASS_DECL, MODIFIERS, OVERRIDE_FUNC, OVERRIDE_VAR, compiledSource, ROOT_LOCKS, host, rootLocks;
30653
+ var import_node_child_process4, import_node_crypto3, import_node_fs7, import_node_os2, import_node_path7, import_node_util2, run2, WASM_TRIPLE, cores, BUILD_ENV, BUILD_JOBS, linkedModuleDigests, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, sdkPaths, availableModules, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, FOUNDATION_IMPLICIT_MODULES, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, MULTI_MANIFEST_VERSION, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, TYPE_AFTER_ATTRIBUTE, DELEGATE_CLASS, REUSABLE_INIT, REUSABLE_VIEW_BASES, CLASS_BASE, FRAME_INIT, APPLE_CLASS, EXTENSION_DECL, CLASS_DECL, MODIFIERS, OVERRIDE_FUNC, OVERRIDE_VAR, compiledSource, ROOT_LOCKS, host, rootLocks;
30543
30654
  var init_swift_compile = __esm({
30544
30655
  "src/swift-compile.ts"() {
30545
30656
  "use strict";
@@ -30606,9 +30717,18 @@ var init_swift_compile = __esm({
30606
30717
  importsSpriteKit = (files2) => Object.entries(files2).some(
30607
30718
  ([file, contents]) => file.endsWith(".swift") && swiftImportNames(contents).includes("SpriteKit")
30608
30719
  );
30609
- FOUNDATION_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "PeachObjC", "-Xfrontend", "-import-module", "-Xfrontend", "Dispatch", "-Xfrontend", "-import-module", "-Xfrontend", "FoundationNetworking", "-Xfrontend", "-import-module", "-Xfrontend", "WASILibc", "-Xfrontend", "-import-module", "-Xfrontend", "wasi_pthread"';
30720
+ FOUNDATION_IMPLICIT_MODULES = [
30721
+ "PeachObjC",
30722
+ "Dispatch",
30723
+ "FoundationNetworking",
30724
+ "WASILibc",
30725
+ "wasi_pthread"
30726
+ ];
30727
+ FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
30728
+ (module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
30729
+ ).join("");
30610
30730
  ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
30611
- MULTI_MANIFEST_VERSION = 11;
30731
+ MULTI_MANIFEST_VERSION = 12;
30612
30732
  DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
30613
30733
  OS_IOS = /\bos\(\s*iOS\s*\)/g;
30614
30734
  OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
@@ -31303,8 +31423,8 @@ function pickImagesetFile(images) {
31303
31423
  scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
31304
31424
  };
31305
31425
  }
31306
- function flatScale(path37) {
31307
- const match = /@([23])x\.[^./]+$/.exec(path37);
31426
+ function flatScale(path38) {
31427
+ const match = /@([23])x\.[^./]+$/.exec(path38);
31308
31428
  return match ? Number(match[1]) : 1;
31309
31429
  }
31310
31430
  function providesNamespace(text3) {
@@ -31331,13 +31451,13 @@ function catalogEntryName(contentsPath, kind, readText2) {
31331
31451
  }
31332
31452
  return segments.join("/");
31333
31453
  }
31334
- function isFlatResourceImage(path37) {
31335
- return path37.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path37));
31454
+ function isFlatResourceImage(path38) {
31455
+ return path38.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path38));
31336
31456
  }
31337
31457
  function enumerateBundleImages(paths, readText2) {
31338
31458
  const table = [];
31339
31459
  const seen = /* @__PURE__ */ new Set();
31340
- const catalogs = paths.filter((path37) => baseOf(path37) === "Contents.json");
31460
+ const catalogs = paths.filter((path38) => baseOf(path38) === "Contents.json");
31341
31461
  for (const contentsPath of catalogs) {
31342
31462
  const name2 = catalogEntryName(contentsPath, ".imageset", readText2);
31343
31463
  if (name2 === null || seen.has(name2)) continue;
@@ -31358,12 +31478,12 @@ function enumerateBundleImages(paths, readText2) {
31358
31478
  seen.add(name2);
31359
31479
  table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
31360
31480
  }
31361
- for (const path37 of paths) {
31362
- if (!isFlatResourceImage(path37)) continue;
31363
- const name2 = baseOf(path37).slice(0, -extOf(path37).length);
31481
+ for (const path38 of paths) {
31482
+ if (!isFlatResourceImage(path38)) continue;
31483
+ const name2 = baseOf(path38).slice(0, -extOf(path38).length);
31364
31484
  if (name2 === "" || seen.has(name2)) continue;
31365
31485
  seen.add(name2);
31366
- table.push({ name: name2, file: path37, scale: flatScale(path37) });
31486
+ table.push({ name: name2, file: path38, scale: flatScale(path38) });
31367
31487
  }
31368
31488
  return table;
31369
31489
  }
@@ -31392,7 +31512,7 @@ function colorsetValue(color) {
31392
31512
  }
31393
31513
  function enumerateBundleColors(paths, readText2) {
31394
31514
  const table = {};
31395
- for (const contentsPath of paths.filter((path37) => baseOf(path37) === "Contents.json")) {
31515
+ for (const contentsPath of paths.filter((path38) => baseOf(path38) === "Contents.json")) {
31396
31516
  const name2 = catalogEntryName(contentsPath, ".colorset", readText2);
31397
31517
  if (name2 === null || name2 in table) continue;
31398
31518
  let colors;
@@ -31456,8 +31576,8 @@ function axisExtremes(points) {
31456
31576
  function pathBounds(d) {
31457
31577
  const xs = [];
31458
31578
  const ys = [];
31459
- for (const path37 of d)
31460
- (0, import_svgpath.default)(path37).abs().unshort().unarc().iterate((segment, _index, x, y) => {
31579
+ for (const path38 of d)
31580
+ (0, import_svgpath.default)(path38).abs().unshort().unarc().iterate((segment, _index, x, y) => {
31461
31581
  const [command, ...args] = segment;
31462
31582
  if (command === "M" || command === "L") {
31463
31583
  xs.push(Number(args[0]));
@@ -31484,7 +31604,7 @@ function guide(svg, id, axis) {
31484
31604
  }
31485
31605
  function enumerateBundleSymbols(paths, readText2) {
31486
31606
  const table = {};
31487
- for (const contentsPath of paths.filter((path37) => baseOf(path37) === "Contents.json")) {
31607
+ for (const contentsPath of paths.filter((path38) => baseOf(path38) === "Contents.json")) {
31488
31608
  const name2 = catalogEntryName(contentsPath, ".symbolset", readText2);
31489
31609
  if (name2 === null || name2 in table) continue;
31490
31610
  let symbols;
@@ -31517,8 +31637,8 @@ function enumerateBundleSymbols(paths, readText2) {
31517
31637
  viewBox: "0 0 24 24",
31518
31638
  advance,
31519
31639
  box: [12 - advance / 2, 12 - tall / 2, advance, tall],
31520
- layers: d.map((path37) => ({
31521
- d: (0, import_svgpath.default)(path37).abs().scale(scale).translate(translateX, translateY).round(3).toString()
31640
+ layers: d.map((path38) => ({
31641
+ d: (0, import_svgpath.default)(path38).abs().scale(scale).translate(translateX, translateY).round(3).toString()
31522
31642
  }))
31523
31643
  };
31524
31644
  }
@@ -31528,7 +31648,7 @@ function enumerateBundleJson(paths) {
31528
31648
  const found = [];
31529
31649
  const seen = /* @__PURE__ */ new Set();
31530
31650
  const ordered = [...paths].filter(
31531
- (path37) => path37.split("/").includes("Resources") && path37.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path37) === ".json" || extOf(path37) === ".xcstrings")
31651
+ (path38) => path38.split("/").includes("Resources") && path38.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path38) === ".json" || extOf(path38) === ".xcstrings")
31532
31652
  ).sort((a, b) => {
31533
31653
  const aDepth = a.split("/").length;
31534
31654
  const bDepth = b.split("/").length;
@@ -32630,6 +32750,57 @@ var init_swift_packages = __esm({
32630
32750
  }
32631
32751
  });
32632
32752
 
32753
+ // src/swift-source-file.ts
32754
+ function readPackageFile(root, file, maxBytes) {
32755
+ const canonicalRoot = import_node_fs16.default.realpathSync(root);
32756
+ const relative3 = import_node_path16.default.relative(canonicalRoot, import_node_fs16.default.realpathSync(file));
32757
+ if (relative3 === ".." || relative3.startsWith(`..${import_node_path16.default.sep}`) || import_node_path16.default.isAbsolute(relative3)) {
32758
+ throw new Error(`swift input escapes the selected package: ${file}`);
32759
+ }
32760
+ let ancestor = import_node_path16.default.resolve(file);
32761
+ while (ancestor !== canonicalRoot) {
32762
+ if (import_node_fs16.default.lstatSync(ancestor).isSymbolicLink()) {
32763
+ throw new Error(`swift input is a symlink: ${ancestor}`);
32764
+ }
32765
+ const parent = import_node_path16.default.dirname(ancestor);
32766
+ if (parent === ancestor)
32767
+ throw new Error(`swift input escapes the selected package: ${file}`);
32768
+ ancestor = parent;
32769
+ }
32770
+ const expected = import_node_fs16.default.statSync(file);
32771
+ const fd = import_node_fs16.default.openSync(file, import_node_fs16.default.constants.O_RDONLY | import_node_fs16.default.constants.O_NOFOLLOW);
32772
+ try {
32773
+ const stat2 = import_node_fs16.default.fstatSync(fd);
32774
+ if (stat2.dev !== expected.dev || stat2.ino !== expected.ino) {
32775
+ throw new Error(`swift input changed while opening: ${file}`);
32776
+ }
32777
+ if (!stat2.isFile() || stat2.size > maxBytes) {
32778
+ throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
32779
+ }
32780
+ const bytes = Buffer.alloc(stat2.size + 1);
32781
+ let offset = 0;
32782
+ while (offset < bytes.length) {
32783
+ const count = import_node_fs16.default.readSync(fd, bytes, offset, bytes.length - offset, null);
32784
+ if (count === 0) break;
32785
+ offset += count;
32786
+ }
32787
+ if (offset !== stat2.size || import_node_fs16.default.fstatSync(fd).size !== stat2.size) {
32788
+ throw new Error(`swift input changed while reading: ${file}`);
32789
+ }
32790
+ return bytes.subarray(0, offset);
32791
+ } finally {
32792
+ import_node_fs16.default.closeSync(fd);
32793
+ }
32794
+ }
32795
+ var import_node_fs16, import_node_path16;
32796
+ var init_swift_source_file = __esm({
32797
+ "src/swift-source-file.ts"() {
32798
+ "use strict";
32799
+ import_node_fs16 = __toESM(require("node:fs"), 1);
32800
+ import_node_path16 = __toESM(require("node:path"), 1);
32801
+ }
32802
+ });
32803
+
32633
32804
  // src/swift-standin-emit.ts
32634
32805
  function splitAccessors(core) {
32635
32806
  const match = /\{\s*([^}]*)\}\s*$/.exec(core);
@@ -32778,10 +32949,10 @@ function emitSwiftStandin(graphs, options) {
32778
32949
  owners.push(...physical.map(() => current));
32779
32950
  };
32780
32951
  const scoped = (body) => (symbol, ...rest) => {
32781
- const path37 = pathOf(symbol);
32782
- if (omit.has(path37)) return void skipped.push({ path: path37, reason: omit.get(path37) });
32952
+ const path38 = pathOf(symbol);
32953
+ if (omit.has(path38)) return void skipped.push({ path: path38, reason: omit.get(path38) });
32783
32954
  const previous = current;
32784
- current = path37;
32955
+ current = path38;
32785
32956
  try {
32786
32957
  body(symbol, ...rest);
32787
32958
  } finally {
@@ -32801,14 +32972,14 @@ function emitSwiftStandin(graphs, options) {
32801
32972
  const access = (symbol, openOwner) => symbol.accessLevel === "open" && openOwner ? "open" : "public";
32802
32973
  const emitMember = scoped(
32803
32974
  (member, indent, context) => {
32804
- const path37 = pathOf(member);
32975
+ const path38 = pathOf(member);
32805
32976
  if (TYPE_KINDS.has(member.kind.identifier)) {
32806
32977
  emitType(member, indent);
32807
32978
  return;
32808
32979
  }
32809
32980
  if (member.kind.identifier === "swift.enum.case") return;
32810
32981
  if (!MEMBER_KINDS.has(member.kind.identifier)) {
32811
- skipped.push({ path: path37, reason: `unhandled ${member.kind.identifier}` });
32982
+ skipped.push({ path: path38, reason: `unhandled ${member.kind.identifier}` });
32812
32983
  return;
32813
32984
  }
32814
32985
  const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(member));
@@ -32822,12 +32993,12 @@ function emitSwiftStandin(graphs, options) {
32822
32993
  const final = context.inClass && flags.has("final") ? "final " : "";
32823
32994
  const mutating = flags.has("mutating") ? "mutating " : flags.has("nonmutating") ? "nonmutating " : "";
32824
32995
  let core = `${flags.has("convenience") ? "convenience " : ""}${modifiers[2]}`;
32825
- const override = context.inClass && !options.plain?.has(path37) && (flags.has("override") || overrides.has(member.identifier.precise) || options.forcedOverride?.has(path37) || isObjC(member) && path37.endsWith(".init()")) ? "override " : "";
32996
+ const override = context.inClass && !options.plain?.has(path38) && (flags.has("override") || overrides.has(member.identifier.precise) || options.forcedOverride?.has(path38) || isObjC(member) && path38.endsWith(".init()")) ? "override " : "";
32826
32997
  const head = `${indent}${attrs}${access(member, context.openOwner)} ${required ? "required " : ""}${final}${override}${mutating}`;
32827
- const measured = behavior.get(path37);
32828
- if (measured) used.add(path37);
32998
+ const measured = behavior.get(path38);
32999
+ if (measured) used.add(path38);
32829
33000
  const overloadBody = /\basync\b/.test(core) ? measured?.asyncBody : /\bResult</.test(core) ? measured?.resultBody : void 0;
32830
- const body = overloadBody ?? measured?.body ?? trap(path37);
33001
+ const body = overloadBody ?? measured?.body ?? trap(path38);
32831
33002
  switch (member.kind.identifier) {
32832
33003
  case "swift.property":
32833
33004
  case "swift.type.property":
@@ -32848,7 +33019,7 @@ function emitSwiftStandin(graphs, options) {
32848
33019
  return;
32849
33020
  }
32850
33021
  emit(
32851
- `${head}${computed} { get${effects} { ${body} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? trap(path37)} }` : ""} }`
33022
+ `${head}${computed} { get${effects} { ${body} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? trap(path38)} }` : ""} }`
32852
33023
  );
32853
33024
  return;
32854
33025
  }
@@ -32901,7 +33072,7 @@ function emitSwiftStandin(graphs, options) {
32901
33072
  };
32902
33073
  const emitType = scoped(
32903
33074
  (symbol, indent) => {
32904
- const path37 = pathOf(symbol);
33075
+ const path38 = pathOf(symbol);
32905
33076
  const id = symbol.identifier.precise;
32906
33077
  const inner = `${indent} `;
32907
33078
  switch (symbol.kind.identifier) {
@@ -32913,10 +33084,10 @@ function emitSwiftStandin(graphs, options) {
32913
33084
  case "swift.class": {
32914
33085
  const shape = header(symbol, "class", indent);
32915
33086
  if (!shape)
32916
- return void skipped.push({ path: path37, reason: `unparsed class ${text(symbol)}` });
32917
- const parent = options.superclasses?.get(path37) ?? superclass.get(id);
33087
+ return void skipped.push({ path: path38, reason: `unparsed class ${text(symbol)}` });
33088
+ const parent = options.superclasses?.get(path38) ?? superclass.get(id);
32918
33089
  const blocked = classBlocked(id);
32919
- if (blocked) return void skipped.push({ path: path37, reason: blocked });
33090
+ if (blocked) return void skipped.push({ path: path38, reason: blocked });
32920
33091
  const ancestors = /* @__PURE__ */ new Set();
32921
33092
  for (let at = superId.get(id); at; at = superId.get(at))
32922
33093
  for (const name2 of conforms.get(at) ?? []) ancestors.add(name2);
@@ -32932,9 +33103,9 @@ function emitSwiftStandin(graphs, options) {
32932
33103
  `${indent}${shape.attrs}${open ? "open" : "public"} class ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${selfConforming(shape.where)} {`
32933
33104
  );
32934
33105
  const members = membersOf(id);
32935
- const extra = options.behavior?.get(path37)?.members;
33106
+ const extra = options.behavior?.get(path38)?.members;
32936
33107
  if (extra) {
32937
- used.add(path37);
33108
+ used.add(path38);
32938
33109
  emit(`${inner}${extra}`);
32939
33110
  }
32940
33111
  for (const member of members)
@@ -32987,13 +33158,13 @@ function emitSwiftStandin(graphs, options) {
32987
33158
  continue;
32988
33159
  have.add(witnessKey(member));
32989
33160
  have.add(sideLeaf(member));
32990
- emitWitness(member, inner, path37);
33161
+ emitWitness(member, inner, path38);
32991
33162
  }
32992
33163
  }
32993
33164
  const coder = members.some((member) => leaf(member) === "init(coder:)");
32994
33165
  if (designated && !coder && externalRoot(id) !== "NSObject" && externalRoot(id) !== null)
32995
33166
  emit(
32996
- `${inner}public required init?(coder: NSCoder) { ${trap(`${path37}.init(coder:)`)} }`
33167
+ `${inner}public required init?(coder: NSCoder) { ${trap(`${path38}.init(coder:)`)} }`
32997
33168
  );
32998
33169
  emit(`${indent}}`);
32999
33170
  return;
@@ -33001,7 +33172,7 @@ function emitSwiftStandin(graphs, options) {
33001
33172
  case "swift.struct": {
33002
33173
  const shape = header(symbol, "struct", indent);
33003
33174
  if (!shape)
33004
- return void skipped.push({ path: path37, reason: `unparsed struct ${text(symbol)}` });
33175
+ return void skipped.push({ path: path38, reason: `unparsed struct ${text(symbol)}` });
33005
33176
  const members = membersOf(id);
33006
33177
  const raw2 = rawType(members);
33007
33178
  const list2 = inheritance(id);
@@ -33052,7 +33223,7 @@ function emitSwiftStandin(graphs, options) {
33052
33223
  case "swift.enum": {
33053
33224
  const shape = header(symbol, "enum", indent);
33054
33225
  if (!shape)
33055
- return void skipped.push({ path: path37, reason: `unparsed enum ${text(symbol)}` });
33226
+ return void skipped.push({ path: path38, reason: `unparsed enum ${text(symbol)}` });
33056
33227
  const members = membersOf(id);
33057
33228
  const raw2 = rawType(members);
33058
33229
  const cases = (children.get(id) ?? []).filter(
@@ -33061,7 +33232,7 @@ function emitSwiftStandin(graphs, options) {
33061
33232
  const missing = raw2 ? cases.filter((member) => !values.has(member.identifier.precise)) : [];
33062
33233
  if (raw2 && isObjC(symbol) && missing.length > 0)
33063
33234
  return void skipped.push({
33064
- path: path37,
33235
+ path: path38,
33065
33236
  reason: `no header value for ${missing.map(leaf).join(", ")}`
33066
33237
  });
33067
33238
  const list2 = inheritance(id, raw2 ?? void 0).filter(
@@ -33102,7 +33273,7 @@ function emitSwiftStandin(graphs, options) {
33102
33273
  const shape = header(symbol, "protocol", indent);
33103
33274
  if (!shape)
33104
33275
  return void skipped.push({
33105
- path: path37,
33276
+ path: path38,
33106
33277
  reason: `unparsed protocol ${text(symbol)}`
33107
33278
  });
33108
33279
  const list2 = [...isObjC(symbol) ? ["AnyObject"] : [], ...inheritance(id)];
@@ -33127,7 +33298,7 @@ function emitSwiftStandin(graphs, options) {
33127
33298
  }
33128
33299
  emit(`${indent}}`);
33129
33300
  if (defaults.length > 0) {
33130
- emit(`${indent}extension ${path37} {`);
33301
+ emit(`${indent}extension ${path38} {`);
33131
33302
  for (const member of defaults) {
33132
33303
  const decl = text(member);
33133
33304
  if (optional.has(member.identifier.precise) && member.kind.identifier === "swift.method" && !decl.replace(/\([^)]*\)/g, "").includes("->") && !/ async\b/.test(decl))
@@ -33174,7 +33345,7 @@ function emitSwiftStandin(graphs, options) {
33174
33345
  return init ? /rawValue:\s*([^)]+)\)/.exec(text(init))?.[1]?.trim() ?? null : null;
33175
33346
  };
33176
33347
  const emitGlobal = scoped((symbol) => {
33177
- const path37 = pathOf(symbol);
33348
+ const path38 = pathOf(symbol);
33178
33349
  const kind = symbol.kind.identifier;
33179
33350
  if (kind === "swift.func" || kind === "swift.func.op" || kind === "swift.method" || kind === "swift.type.method") {
33180
33351
  const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(symbol));
@@ -33185,17 +33356,17 @@ function emitSwiftStandin(graphs, options) {
33185
33356
  if (fix && !/^(?:prefix|infix|postfix)\b/.test(spelled))
33186
33357
  spelled = `${fix} ${spelled}`;
33187
33358
  }
33188
- emit(`${attrs}public ${spelled} { ${trap(path37)} }`);
33359
+ emit(`${attrs}public ${spelled} { ${trap(path38)} }`);
33189
33360
  } else if (kind === "swift.var") {
33190
33361
  const parsed = splitAccessors(text(symbol).replace(/^let /, "var "));
33191
- const measured = behavior.get(path37);
33192
- if (measured) used.add(path37);
33193
- emit(`public ${parsed.decl} { ${measured?.body ?? trap(path37)} }`);
33194
- } else skipped.push({ path: path37, reason: `unhandled top-level ${kind}` });
33362
+ const measured = behavior.get(path38);
33363
+ if (measured) used.add(path38);
33364
+ emit(`public ${parsed.decl} { ${measured?.body ?? trap(path38)} }`);
33365
+ } else skipped.push({ path: path38, reason: `unhandled top-level ${kind}` });
33195
33366
  });
33196
33367
  const roots = [...byId.values()].filter((symbol) => !owner.has(symbol.identifier.precise) && !unavailable(symbol)).sort((a, b) => pathOf(a).localeCompare(pathOf(b)));
33197
33368
  for (const symbol of roots) {
33198
- const path37 = pathOf(symbol);
33369
+ const path38 = pathOf(symbol);
33199
33370
  if (TYPE_KINDS.has(symbol.kind.identifier)) emitType(symbol, "");
33200
33371
  else emitGlobal(symbol);
33201
33372
  }
@@ -33237,9 +33408,9 @@ function emitSwiftStandin(graphs, options) {
33237
33408
  ...imports.map((name2) => `import ${name2}`),
33238
33409
  ""
33239
33410
  ];
33240
- for (const path37 of behavior.keys())
33241
- if (!used.has(path37))
33242
- skipped.push({ path: path37, reason: "behavior names no emitted declaration" });
33411
+ for (const path38 of behavior.keys())
33412
+ if (!used.has(path38))
33413
+ skipped.push({ path: path38, reason: "behavior names no emitted declaration" });
33243
33414
  return {
33244
33415
  source: `${[...banner, ...lines].join("\n")}
33245
33416
  `,
@@ -33325,7 +33496,7 @@ var init_swift_standin_emit = __esm({
33325
33496
  sideLeaf = (symbol) => `${symbol.kind.identifier.startsWith("swift.type.") ? "type" : "instance"}|leaf|${leaf(symbol)}`;
33326
33497
  isObjC = (symbol) => symbol.identifier.precise.startsWith("c:");
33327
33498
  synthesizedEquality = (symbol, conforms) => conforms.includes("Hashable") ? ["==(_:_:)", "hash(into:)", "hashValue"].includes(leaf(symbol)) : conforms.includes("Equatable") && leaf(symbol) === "==(_:_:)";
33328
- trap = (path37) => `fatalError("${path37} is a binary framework peach cannot run")`;
33499
+ trap = (path38) => `fatalError("${path38} is a binary framework peach cannot run")`;
33329
33500
  KEYWORDS = /* @__PURE__ */ new Set([
33330
33501
  "Type",
33331
33502
  "Protocol",
@@ -33383,15 +33554,15 @@ ${"stdout" in error ? String(error.stdout) : ""}` : String(error);
33383
33554
  function treeDigest(root) {
33384
33555
  const names = [];
33385
33556
  const walk2 = (dir) => {
33386
- for (const entry of import_node_fs16.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
33387
- const full = import_node_path16.default.join(dir, entry.name);
33557
+ for (const entry of import_node_fs17.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
33558
+ const full = import_node_path17.default.join(dir, entry.name);
33388
33559
  if (entry.isDirectory()) walk2(full);
33389
- else if (entry.isFile()) names.push(import_node_path16.default.relative(root, full));
33560
+ else if (entry.isFile()) names.push(import_node_path17.default.relative(root, full));
33390
33561
  }
33391
33562
  };
33392
33563
  walk2(root);
33393
33564
  const stamp = names.map((name2) => {
33394
- const stat2 = import_node_fs16.default.statSync(import_node_path16.default.join(root, name2));
33565
+ const stat2 = import_node_fs17.default.statSync(import_node_path17.default.join(root, name2));
33395
33566
  return `${name2}\0${stat2.size}:${stat2.mtimeMs}`;
33396
33567
  }).join("\n");
33397
33568
  const memo2 = digests.get(`tree\0${root}`);
@@ -33399,7 +33570,7 @@ function treeDigest(root) {
33399
33570
  const hash = (0, import_node_crypto7.createHash)("sha256");
33400
33571
  for (const name2 of names) {
33401
33572
  hash.update(`${name2}\0`);
33402
- hash.update(import_node_fs16.default.readFileSync(import_node_path16.default.join(root, name2)));
33573
+ hash.update(import_node_fs17.default.readFileSync(import_node_path17.default.join(root, name2)));
33403
33574
  hash.update("\0");
33404
33575
  }
33405
33576
  const digest = hash.digest("hex");
@@ -33408,9 +33579,9 @@ function treeDigest(root) {
33408
33579
  }
33409
33580
  function locateXcframework(tree) {
33410
33581
  const find = (root, depth) => {
33411
- for (const entry of import_node_fs16.default.readdirSync(root, { withFileTypes: true })) {
33582
+ for (const entry of import_node_fs17.default.readdirSync(root, { withFileTypes: true })) {
33412
33583
  if (!entry.isDirectory() || entry.name === "__MACOSX") continue;
33413
- const full = import_node_path16.default.join(root, entry.name);
33584
+ const full = import_node_path17.default.join(root, entry.name);
33414
33585
  if (entry.name.endsWith(".xcframework")) return full;
33415
33586
  const nested = depth > 0 ? find(full, depth - 1) : null;
33416
33587
  if (nested) return nested;
@@ -33425,66 +33596,66 @@ function xcframework(binary2) {
33425
33596
  if (binary2.url && (!binary2.checksum || !/^[a-f0-9]{64}$/i.test(binary2.checksum)))
33426
33597
  throw new Error("remote binary archive requires its Package.swift SHA-256 checksum");
33427
33598
  const expected = binary2.checksum?.toLowerCase();
33428
- const dir = import_node_path16.default.join(cacheDir4, "archives", key(binary2.url ? expected : binary2.dir));
33429
- const archive = import_node_path16.default.join(dir, "archive.zip");
33430
- const fingerprint = import_node_path16.default.join(dir, ".fingerprint");
33599
+ const dir = import_node_path17.default.join(cacheDir4, "archives", key(binary2.url ? expected : binary2.dir));
33600
+ const archive = import_node_path17.default.join(dir, "archive.zip");
33601
+ const fingerprint = import_node_path17.default.join(dir, ".fingerprint");
33431
33602
  const stored = (() => {
33432
33603
  try {
33433
- const parsed = JSON.parse(import_node_fs16.default.readFileSync(fingerprint, "utf8"));
33604
+ const parsed = JSON.parse(import_node_fs17.default.readFileSync(fingerprint, "utf8"));
33434
33605
  return parsed && typeof parsed === "object" && "sha" in parsed ? parsed : null;
33435
33606
  } catch {
33436
33607
  return null;
33437
33608
  }
33438
33609
  })();
33439
33610
  if (!binary2.url) {
33440
- const stat2 = import_node_fs16.default.statSync(binary2.dir);
33611
+ const stat2 = import_node_fs17.default.statSync(binary2.dir);
33441
33612
  const stamp = `${stat2.size}:${stat2.mtimeMs}`;
33442
33613
  if (stored?.stamp === stamp) {
33443
- const found3 = locateXcframework(import_node_path16.default.join(dir, "tree"));
33614
+ const found3 = locateXcframework(import_node_path17.default.join(dir, "tree"));
33444
33615
  if (found3) return { dir: found3, digest: stored.sha };
33445
33616
  }
33446
- const sha2 = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs16.default.readFileSync(binary2.dir)).digest("hex");
33447
- if (sha2 !== stored?.sha || !locateXcframework(import_node_path16.default.join(dir, "tree"))) {
33448
- import_node_fs16.default.rmSync(dir, { recursive: true, force: true });
33449
- import_node_fs16.default.mkdirSync(import_node_path16.default.join(dir, "tree"), { recursive: true });
33450
- exec("unzip", ["-q", binary2.dir, "-d", import_node_path16.default.join(dir, "tree")]);
33617
+ const sha2 = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs17.default.readFileSync(binary2.dir)).digest("hex");
33618
+ if (sha2 !== stored?.sha || !locateXcframework(import_node_path17.default.join(dir, "tree"))) {
33619
+ import_node_fs17.default.rmSync(dir, { recursive: true, force: true });
33620
+ import_node_fs17.default.mkdirSync(import_node_path17.default.join(dir, "tree"), { recursive: true });
33621
+ exec("unzip", ["-q", binary2.dir, "-d", import_node_path17.default.join(dir, "tree")]);
33451
33622
  }
33452
- import_node_fs16.default.writeFileSync(fingerprint, JSON.stringify({ stamp, sha: sha2 }));
33453
- const found2 = locateXcframework(import_node_path16.default.join(dir, "tree"));
33623
+ import_node_fs17.default.writeFileSync(fingerprint, JSON.stringify({ stamp, sha: sha2 }));
33624
+ const found2 = locateXcframework(import_node_path17.default.join(dir, "tree"));
33454
33625
  if (!found2) throw new Error("its archive holds no .xcframework");
33455
33626
  return { dir: found2, digest: sha2 };
33456
33627
  }
33457
- if (stored && import_node_fs16.default.existsSync(archive)) {
33458
- const sha2 = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs16.default.readFileSync(archive)).digest("hex");
33628
+ if (stored && import_node_fs17.default.existsSync(archive)) {
33629
+ const sha2 = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs17.default.readFileSync(archive)).digest("hex");
33459
33630
  if (sha2 !== expected)
33460
33631
  throw new Error(`archive checksum ${sha2} is not the declared checksum ${expected}`);
33461
- const found2 = locateXcframework(import_node_path16.default.join(dir, "tree"));
33632
+ const found2 = locateXcframework(import_node_path17.default.join(dir, "tree"));
33462
33633
  if (found2) return { dir: found2, digest: sha2 };
33463
33634
  }
33464
- import_node_fs16.default.rmSync(dir, { recursive: true, force: true });
33465
- import_node_fs16.default.mkdirSync(import_node_path16.default.join(dir, "tree"), { recursive: true });
33635
+ import_node_fs17.default.rmSync(dir, { recursive: true, force: true });
33636
+ import_node_fs17.default.mkdirSync(import_node_path17.default.join(dir, "tree"), { recursive: true });
33466
33637
  exec("curl", ["-fsSL", "--retry", "2", "-o", archive, binary2.url]);
33467
- const sha = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs16.default.readFileSync(archive)).digest("hex");
33638
+ const sha = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs17.default.readFileSync(archive)).digest("hex");
33468
33639
  if (sha !== expected) {
33469
- import_node_fs16.default.rmSync(dir, { recursive: true, force: true });
33640
+ import_node_fs17.default.rmSync(dir, { recursive: true, force: true });
33470
33641
  throw new Error(`archive checksum ${sha} is not the declared checksum ${expected}`);
33471
33642
  }
33472
- exec("unzip", ["-q", archive, "-d", import_node_path16.default.join(dir, "tree")]);
33473
- import_node_fs16.default.writeFileSync(fingerprint, JSON.stringify({ sha }));
33474
- const found = locateXcframework(import_node_path16.default.join(dir, "tree"));
33643
+ exec("unzip", ["-q", archive, "-d", import_node_path17.default.join(dir, "tree")]);
33644
+ import_node_fs17.default.writeFileSync(fingerprint, JSON.stringify({ sha }));
33645
+ const found = locateXcframework(import_node_path17.default.join(dir, "tree"));
33475
33646
  if (!found) throw new Error("its archive holds no .xcframework");
33476
33647
  return { dir: found, digest: sha };
33477
33648
  }
33478
33649
  function surfaces(xcframeworkDir) {
33479
- const slice = import_node_fs16.default.readdirSync(xcframeworkDir).filter((name2) => /^ios-.+-simulator$/.test(name2)).sort()[0];
33650
+ const slice = import_node_fs17.default.readdirSync(xcframeworkDir).filter((name2) => /^ios-.+-simulator$/.test(name2)).sort()[0];
33480
33651
  if (!slice) throw new Error("it has no iOS simulator slice");
33481
- const root = import_node_path16.default.join(xcframeworkDir, slice);
33652
+ const root = import_node_path17.default.join(xcframeworkDir, slice);
33482
33653
  const found = [];
33483
- for (const entry of import_node_fs16.default.readdirSync(root).sort()) {
33654
+ for (const entry of import_node_fs17.default.readdirSync(root).sort()) {
33484
33655
  if (!entry.endsWith(".framework")) continue;
33485
33656
  const module2 = entry.slice(0, -".framework".length);
33486
- const framework = import_node_path16.default.join(root, entry);
33487
- const swiftmodule = import_node_path16.default.join(framework, "Modules", `${module2}.swiftmodule`);
33657
+ const framework = import_node_path17.default.join(root, entry);
33658
+ const swiftmodule = import_node_path17.default.join(framework, "Modules", `${module2}.swiftmodule`);
33488
33659
  const interfaces = files(
33489
33660
  swiftmodule,
33490
33661
  (name2) => name2.endsWith(".swiftinterface") && !name2.endsWith(".private.swiftinterface") && !name2.endsWith(".package.swiftinterface")
@@ -33494,41 +33665,41 @@ function surfaces(xcframeworkDir) {
33494
33665
  found.push({
33495
33666
  kind: "swift",
33496
33667
  module: module2,
33497
- interface: import_node_path16.default.join(swiftmodule, chosen)
33668
+ interface: import_node_path17.default.join(swiftmodule, chosen)
33498
33669
  });
33499
33670
  continue;
33500
33671
  }
33501
- const modulemap = import_node_path16.default.join(framework, "Modules", "module.modulemap");
33502
- if (import_node_fs16.default.existsSync(modulemap))
33672
+ const modulemap = import_node_path17.default.join(framework, "Modules", "module.modulemap");
33673
+ if (import_node_fs17.default.existsSync(modulemap))
33503
33674
  found.push({
33504
33675
  kind: "c",
33505
33676
  module: module2,
33506
33677
  modulemap,
33507
- headers: import_node_path16.default.join(framework, "Headers")
33678
+ headers: import_node_path17.default.join(framework, "Headers")
33508
33679
  });
33509
33680
  }
33510
- const headers = import_node_path16.default.join(root, "Headers");
33681
+ const headers = import_node_path17.default.join(root, "Headers");
33511
33682
  for (const map2 of files(headers, (name2) => name2 === "module.modulemap")) {
33512
- const modulemap = import_node_path16.default.join(headers, map2);
33513
- const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs16.default.readFileSync(modulemap, "utf8"))?.[1];
33683
+ const modulemap = import_node_path17.default.join(headers, map2);
33684
+ const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs17.default.readFileSync(modulemap, "utf8"))?.[1];
33514
33685
  if (module2) found.push({ kind: "c", module: module2, modulemap, headers });
33515
33686
  }
33516
33687
  return found;
33517
33688
  }
33518
33689
  function peachModuleDirs(toolchain, imports) {
33519
33690
  const { moduleRoot, toolchainBin } = toolchain;
33520
- if (swiftDistributionAt(moduleRoot)) return [import_node_path16.default.join(moduleRoot, "modules")];
33691
+ if (swiftDistributionAt(moduleRoot)) return [import_node_path17.default.join(moduleRoot, "modules")];
33521
33692
  const peach = new Set(swiftPeachModules(moduleRoot));
33522
33693
  const plugins = swiftMacroPlugins(moduleRoot);
33523
33694
  if (plugins.stale)
33524
33695
  exec("sh", [
33525
- import_node_path16.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
33696
+ import_node_path17.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
33526
33697
  toolchainBin,
33527
33698
  plugins.libraries[0]
33528
33699
  ]);
33529
33700
  for (const target of imports.filter((name2) => peach.has(name2)))
33530
33701
  exec(
33531
- import_node_path16.default.join(toolchainBin, "swift"),
33702
+ import_node_path17.default.join(toolchainBin, "swift"),
33532
33703
  [
33533
33704
  "build",
33534
33705
  "--swift-sdk",
@@ -33548,7 +33719,7 @@ function peachModuleDirs(toolchain, imports) {
33548
33719
  ],
33549
33720
  moduleRoot
33550
33721
  );
33551
- return [import_node_path16.default.join(moduleRoot, ".build", TRIPLE, "release", "Modules")];
33722
+ return [import_node_path17.default.join(moduleRoot, ".build", TRIPLE, "release", "Modules")];
33552
33723
  }
33553
33724
  function swiftInterfaceForWasm(text3) {
33554
33725
  return text3.replace(
@@ -33560,11 +33731,11 @@ function swiftInterfaceForWasm(text3) {
33560
33731
  );
33561
33732
  }
33562
33733
  function swiftStandin(surface, binary2, toolchain, work) {
33563
- const text3 = swiftInterfaceForWasm(import_node_fs16.default.readFileSync(surface.interface, "utf8"));
33564
- const search = import_node_path16.default.join(work, "interfaces");
33565
- const moduleDir = import_node_path16.default.join(search, `${surface.module}.swiftmodule`);
33566
- import_node_fs16.default.mkdirSync(moduleDir, { recursive: true });
33567
- import_node_fs16.default.writeFileSync(import_node_path16.default.join(moduleDir, `${TRIPLE}.swiftinterface`), text3);
33734
+ const text3 = swiftInterfaceForWasm(import_node_fs17.default.readFileSync(surface.interface, "utf8"));
33735
+ const search = import_node_path17.default.join(work, "interfaces");
33736
+ const moduleDir = import_node_path17.default.join(search, `${surface.module}.swiftmodule`);
33737
+ import_node_fs17.default.mkdirSync(moduleDir, { recursive: true });
33738
+ import_node_fs17.default.writeFileSync(import_node_path17.default.join(moduleDir, `${TRIPLE}.swiftinterface`), text3);
33568
33739
  const imports = [
33569
33740
  ...text3.matchAll(
33570
33741
  /^(?:@_exported[ \t]+)?import[ \t]+(?:(?:struct|class|enum|protocol|typealias|func|var|let)[ \t]+)?(\w+)/gm
@@ -33576,9 +33747,9 @@ function swiftStandin(surface, binary2, toolchain, work) {
33576
33747
  );
33577
33748
  const target = ["-target", TRIPLE, "-sdk", sysroot, "-resource-dir", resources];
33578
33749
  const peach = peachModuleDirs(toolchain, imports).flatMap((dir) => ["-I", dir]);
33579
- const out = import_node_path16.default.join(work, "graphs");
33580
- import_node_fs16.default.mkdirSync(out, { recursive: true });
33581
- exec(import_node_path16.default.join(toolchain.toolchainBin, "swift-symbolgraph-extract"), [
33750
+ const out = import_node_path17.default.join(work, "graphs");
33751
+ import_node_fs17.default.mkdirSync(out, { recursive: true });
33752
+ exec(import_node_path17.default.join(toolchain.toolchainBin, "swift-symbolgraph-extract"), [
33582
33753
  "-module-name",
33583
33754
  surface.module,
33584
33755
  ...target,
@@ -33592,10 +33763,10 @@ function swiftStandin(surface, binary2, toolchain, work) {
33592
33763
  "-output-dir",
33593
33764
  out
33594
33765
  ]);
33595
- const graphs = import_node_fs16.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs16.default.readFileSync(import_node_path16.default.join(out, name2), "utf8")));
33766
+ const graphs = import_node_fs17.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs17.default.readFileSync(import_node_path17.default.join(out, name2), "utf8")));
33596
33767
  const omit = /* @__PURE__ */ new Map();
33597
33768
  const plain = /* @__PURE__ */ new Set();
33598
- const file = import_node_path16.default.join(work, `${surface.module}.swift`);
33769
+ const file = import_node_path17.default.join(work, `${surface.module}.swift`);
33599
33770
  for (; ; ) {
33600
33771
  const { source, owners } = emitSwiftStandin(graphs, {
33601
33772
  module: surface.module,
@@ -33603,9 +33774,9 @@ function swiftStandin(surface, binary2, toolchain, work) {
33603
33774
  omit,
33604
33775
  plain
33605
33776
  });
33606
- import_node_fs16.default.writeFileSync(file, source);
33777
+ import_node_fs17.default.writeFileSync(file, source);
33607
33778
  const check = (0, import_node_child_process9.spawnSync)(
33608
- import_node_path16.default.join(toolchain.toolchainBin, "swiftc"),
33779
+ import_node_path17.default.join(toolchain.toolchainBin, "swiftc"),
33609
33780
  [
33610
33781
  "-typecheck",
33611
33782
  "-parse-as-library",
@@ -33753,21 +33924,21 @@ function splitDeclarators(statement, names) {
33753
33924
  }
33754
33925
  function cStandin(surface, binary2, toolchain, work) {
33755
33926
  const named = [
33756
- ...import_node_fs16.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
33927
+ ...import_node_fs17.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
33757
33928
  ].map((match) => match[1]);
33758
33929
  const headers = files(surface.headers, (name2) => name2.endsWith(".h"));
33759
33930
  const texts = new Map(
33760
33931
  headers.map((file) => [
33761
33932
  file,
33762
- import_node_fs16.default.readFileSync(import_node_path16.default.join(surface.headers, file), "utf8")
33933
+ import_node_fs17.default.readFileSync(import_node_path17.default.join(surface.headers, file), "utf8")
33763
33934
  ])
33764
33935
  );
33765
33936
  const objc = headers.find((file) => OBJC.test(texts.get(file)));
33766
33937
  if (objc) throw new Error(`its header ${objc} is Objective-C`);
33767
- const include = import_node_path16.default.join(work, "include");
33938
+ const include = import_node_path17.default.join(work, "include");
33768
33939
  for (const [file, text3] of texts) {
33769
- import_node_fs16.default.mkdirSync(import_node_path16.default.dirname(import_node_path16.default.join(include, file)), { recursive: true });
33770
- import_node_fs16.default.writeFileSync(import_node_path16.default.join(include, file), text3);
33940
+ import_node_fs17.default.mkdirSync(import_node_path17.default.dirname(import_node_path17.default.join(include, file)), { recursive: true });
33941
+ import_node_fs17.default.writeFileSync(import_node_path17.default.join(include, file), text3);
33771
33942
  }
33772
33943
  const roots = named.length > 0 ? named : headers;
33773
33944
  const modulemap = `module ${surface.module} {
@@ -33775,12 +33946,12 @@ ${roots.map((file) => ` header "${file}"
33775
33946
  `).join("")} export *
33776
33947
  }
33777
33948
  `;
33778
- const probe2 = import_node_path16.default.join(work, "declarations.c");
33779
- import_node_fs16.default.writeFileSync(probe2, roots.map((file) => `#include "${file}"
33949
+ const probe2 = import_node_path17.default.join(work, "declarations.c");
33950
+ import_node_fs17.default.writeFileSync(probe2, roots.map((file) => `#include "${file}"
33780
33951
  `).join(""));
33781
33952
  const { sysroot } = swiftSdkPaths(toolchain.moduleRoot, toolchain.toolchainBin);
33782
33953
  const ast = JSON.parse(
33783
- exec(import_node_path16.default.join(toolchain.toolchainBin, "clang"), [
33954
+ exec(import_node_path17.default.join(toolchain.toolchainBin, "clang"), [
33784
33955
  "-target",
33785
33956
  TRIPLE,
33786
33957
  "--sysroot",
@@ -33793,7 +33964,7 @@ ${roots.map((file) => ` header "${file}"
33793
33964
  probe2
33794
33965
  ])
33795
33966
  );
33796
- const byPath = new Map(headers.map((file) => [import_node_path16.default.join(include, file), file]));
33967
+ const byPath = new Map(headers.map((file) => [import_node_path17.default.join(include, file), file]));
33797
33968
  const declarations = functionDeclarations(ast, new Set(byPath.keys()));
33798
33969
  const groups = /* @__PURE__ */ new Map();
33799
33970
  for (const declaration of declarations) {
@@ -33840,10 +34011,10 @@ ${roots.map((file) => ` header "${file}"
33840
34011
  "",
33841
34012
  ...definitions
33842
34013
  ].join("\n");
33843
- const out = import_node_path16.default.join(work, `${surface.module}.c`);
33844
- import_node_fs16.default.writeFileSync(out, source);
34014
+ const out = import_node_path17.default.join(work, `${surface.module}.c`);
34015
+ import_node_fs17.default.writeFileSync(out, source);
33845
34016
  try {
33846
- exec(import_node_path16.default.join(toolchain.toolchainBin, "clang"), [
34017
+ exec(import_node_path17.default.join(toolchain.toolchainBin, "clang"), [
33847
34018
  "-target",
33848
34019
  TRIPLE,
33849
34020
  "--sysroot",
@@ -33924,25 +34095,25 @@ function binaryStandins(binary2, toolchain, provided) {
33924
34095
  for (const file of surface.kind === "swift" ? [surface.interface] : [
33925
34096
  surface.modulemap,
33926
34097
  ...files(surface.headers, (name2) => name2.endsWith(".h")).map(
33927
- (file2) => import_node_path16.default.join(surface.headers, file2)
34098
+ (file2) => import_node_path17.default.join(surface.headers, file2)
33928
34099
  )
33929
34100
  ])
33930
- hash.update(import_node_fs16.default.readFileSync(file));
34101
+ hash.update(import_node_fs17.default.readFileSync(file));
33931
34102
  }
33932
34103
  const id = hash.digest("hex").slice(0, 32);
33933
34104
  const memo2 = built.get(id);
33934
34105
  if (memo2) return memo2;
33935
- const cached4 = import_node_path16.default.join(cacheDir4, "standins", `${id}.json`);
33936
- if (import_node_fs16.default.existsSync(cached4)) {
33937
- const value = JSON.parse(import_node_fs16.default.readFileSync(cached4, "utf8"));
34106
+ const cached4 = import_node_path17.default.join(cacheDir4, "standins", `${id}.json`);
34107
+ if (import_node_fs17.default.existsSync(cached4)) {
34108
+ const value = JSON.parse(import_node_fs17.default.readFileSync(cached4, "utf8"));
33938
34109
  built.set(id, value);
33939
34110
  return value;
33940
34111
  }
33941
- const work = import_node_fs16.default.mkdtempSync(import_node_path16.default.join(import_node_os7.default.tmpdir(), "peach-standin-"));
34112
+ const work = import_node_fs17.default.mkdtempSync(import_node_path17.default.join(import_node_os7.default.tmpdir(), "peach-standin-"));
33942
34113
  let result;
33943
34114
  try {
33944
34115
  result = found.map((surface) => {
33945
- const dir = import_node_path16.default.join(work, surface.module);
34116
+ const dir = import_node_path17.default.join(work, surface.module);
33946
34117
  try {
33947
34118
  return surface.kind === "swift" ? swiftStandin(surface, binary2, toolchain, dir) : cStandin(surface, binary2, toolchain, dir);
33948
34119
  } catch (error) {
@@ -33951,13 +34122,13 @@ function binaryStandins(binary2, toolchain, provided) {
33951
34122
  );
33952
34123
  }
33953
34124
  });
33954
- import_node_fs16.default.mkdirSync(import_node_path16.default.dirname(cached4), { recursive: true });
33955
- import_node_fs16.default.writeFileSync(cached4, JSON.stringify(result));
34125
+ import_node_fs17.default.mkdirSync(import_node_path17.default.dirname(cached4), { recursive: true });
34126
+ import_node_fs17.default.writeFileSync(cached4, JSON.stringify(result));
33956
34127
  built.set(id, result);
33957
34128
  } catch (error) {
33958
34129
  result = error instanceof Error ? error.message : String(error);
33959
34130
  } finally {
33960
- import_node_fs16.default.rmSync(work, { recursive: true, force: true });
34131
+ import_node_fs17.default.rmSync(work, { recursive: true, force: true });
33961
34132
  }
33962
34133
  return result;
33963
34134
  }
@@ -33971,23 +34142,23 @@ function swiftStandins(binaries, toolchain, provided = /* @__PURE__ */ new Set()
33971
34142
  }
33972
34143
  return { standins, gaps };
33973
34144
  }
33974
- var import_node_child_process9, import_node_crypto7, import_node_fs16, import_node_os7, import_node_path16, TRIPLE, cacheDir4, key, digests, files, OBJC, identChar, built;
34145
+ var import_node_child_process9, import_node_crypto7, import_node_fs17, import_node_os7, import_node_path17, TRIPLE, cacheDir4, key, digests, files, OBJC, identChar, built;
33975
34146
  var init_swift_standins = __esm({
33976
34147
  "src/swift-standins.ts"() {
33977
34148
  "use strict";
33978
34149
  import_node_child_process9 = require("node:child_process");
33979
34150
  import_node_crypto7 = require("node:crypto");
33980
- import_node_fs16 = __toESM(require("node:fs"), 1);
34151
+ import_node_fs17 = __toESM(require("node:fs"), 1);
33981
34152
  import_node_os7 = __toESM(require("node:os"), 1);
33982
- import_node_path16 = __toESM(require("node:path"), 1);
34153
+ import_node_path17 = __toESM(require("node:path"), 1);
33983
34154
  init_cli_version();
33984
34155
  init_swift_compile();
33985
34156
  init_swift_standin_emit();
33986
34157
  TRIPLE = "wasm32-unknown-wasip1";
33987
- cacheDir4 = import_node_path16.default.join(import_node_os7.default.tmpdir(), "peach-swift-standins");
34158
+ cacheDir4 = import_node_path17.default.join(import_node_os7.default.tmpdir(), "peach-swift-standins");
33988
34159
  key = (...parts) => (0, import_node_crypto7.createHash)("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
33989
34160
  digests = /* @__PURE__ */ new Map();
33990
- files = (dir, test) => import_node_fs16.default.existsSync(dir) ? import_node_fs16.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => test(import_node_path16.default.basename(file))).sort() : [];
34161
+ files = (dir, test) => import_node_fs17.default.existsSync(dir) ? import_node_fs17.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => test(import_node_path17.default.basename(file))).sort() : [];
33991
34162
  OBJC = /^\s*(?:@interface|@protocol|@class|@import|#import)\b/m;
33992
34163
  identChar = (char) => char !== void 0 && /[\w$]/.test(char);
33993
34164
  built = /* @__PURE__ */ new Map();
@@ -35242,7 +35413,7 @@ var require_lib = __commonJS({
35242
35413
  function readXcodeJsonProject(xcodeproj, source) {
35243
35414
  const json = import_json5.default.parse(source);
35244
35415
  if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
35245
- const projectDir = import_node_path17.default.dirname(xcodeproj);
35416
+ const projectDir = import_node_path18.default.dirname(xcodeproj);
35246
35417
  const objects = {};
35247
35418
  let next = 0;
35248
35419
  const add = (entry, id) => {
@@ -35255,7 +35426,7 @@ function readXcodeJsonProject(xcodeproj, source) {
35255
35426
  const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
35256
35427
  if (base) {
35257
35428
  if (base[1] === "PROJECT")
35258
- return { sourceTree: "<absolute>", path: import_node_path17.default.join(projectDir, base[2]) };
35429
+ return { sourceTree: "<absolute>", path: import_node_path18.default.join(projectDir, base[2]) };
35259
35430
  if (base[1] === "PRODUCTS")
35260
35431
  return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
35261
35432
  return null;
@@ -35263,7 +35434,7 @@ function readXcodeJsonProject(xcodeproj, source) {
35263
35434
  const unescaped = raw2.replaceAll("\\<", "<");
35264
35435
  if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
35265
35436
  if (unescaped.startsWith("~")) return null;
35266
- return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path17.default.join(groupDir, unescaped) };
35437
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path18.default.join(groupDir, unescaped) };
35267
35438
  };
35268
35439
  const memberships = [];
35269
35440
  const folders = [];
@@ -35274,7 +35445,7 @@ function readXcodeJsonProject(xcodeproj, source) {
35274
35445
  const kind = text2(entry.kind) ?? "file-reference";
35275
35446
  const raw2 = text2(entry.path) ?? "";
35276
35447
  const located = raw2 === "" ? null : locate(raw2, parent.dir);
35277
- const name2 = text2(entry.name) ?? import_node_path17.default.basename(raw2);
35448
+ const name2 = text2(entry.name) ?? import_node_path18.default.basename(raw2);
35278
35449
  const node = { id: "", name: name2, dir: null, parent, children: [] };
35279
35450
  if (kind === "group" || kind === "variant-group" || kind === "version-group") {
35280
35451
  node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
@@ -35389,7 +35560,7 @@ function readXcodeJsonProject(xcodeproj, source) {
35389
35560
  if (!isObject(entry)) continue;
35390
35561
  const repository = text2(entry.repository);
35391
35562
  const local = text2(entry.path);
35392
- const name2 = local !== void 0 ? import_node_path17.default.basename(import_node_path17.default.resolve(import_node_path17.default.dirname(xcodeproj), local)) : import_node_path17.default.basename(repository ?? "").replace(/\.git$/, "");
35563
+ const name2 = local !== void 0 ? import_node_path18.default.basename(import_node_path18.default.resolve(import_node_path18.default.dirname(xcodeproj), local)) : import_node_path18.default.basename(repository ?? "").replace(/\.git$/, "");
35393
35564
  const id = text2(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
35394
35565
  packageIds.set(name2.toLowerCase(), id);
35395
35566
  }
@@ -35557,11 +35728,11 @@ function readXcodeJsonProject(xcodeproj, source) {
35557
35728
  function isJsonObject(value) {
35558
35729
  return typeof value === "object" && value !== null && !Array.isArray(value);
35559
35730
  }
35560
- var import_node_path17, import_json5, isObject, text2, items, PHASE_ISA;
35731
+ var import_node_path18, import_json5, isObject, text2, items, PHASE_ISA;
35561
35732
  var init_xcode_json_project = __esm({
35562
35733
  "src/xcode-json-project.ts"() {
35563
35734
  "use strict";
35564
- import_node_path17 = __toESM(require("node:path"), 1);
35735
+ import_node_path18 = __toESM(require("node:path"), 1);
35565
35736
  import_json5 = __toESM(require_lib(), 1);
35566
35737
  isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
35567
35738
  text2 = (value) => typeof value === "string" ? value : void 0;
@@ -35668,27 +35839,27 @@ function parseOpenStepPlist(text3) {
35668
35839
  return root;
35669
35840
  }
35670
35841
  function walkFiles(dir) {
35671
- if (!import_node_fs17.default.existsSync(dir)) return [];
35842
+ if (!import_node_fs18.default.existsSync(dir)) return [];
35672
35843
  const out = [];
35673
- for (const entry of import_node_fs17.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
35844
+ for (const entry of import_node_fs18.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
35674
35845
  if (entry.name.startsWith(".")) continue;
35675
- const full = import_node_path18.default.join(dir, entry.name);
35846
+ const full = import_node_path19.default.join(dir, entry.name);
35676
35847
  if (entry.isDirectory()) out.push(...walkFiles(full));
35677
35848
  else if (entry.isFile()) out.push(full);
35678
35849
  }
35679
35850
  return out;
35680
35851
  }
35681
35852
  function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
35682
- if (seen.has(file) || !import_node_fs17.default.existsSync(file)) return {};
35853
+ if (seen.has(file) || !import_node_fs18.default.existsSync(file)) return {};
35683
35854
  seen.add(file);
35684
35855
  const settings = {};
35685
- for (const raw2 of import_node_fs17.default.readFileSync(file, "utf8").split("\n")) {
35856
+ for (const raw2 of import_node_fs18.default.readFileSync(file, "utf8").split("\n")) {
35686
35857
  const line = raw2.replace(/\/\/.*$/, "").trim();
35687
35858
  const include = /^#include\??\s+"([^"]+)"/.exec(line);
35688
35859
  if (include) {
35689
35860
  Object.assign(
35690
35861
  settings,
35691
- readXcconfig(import_node_path18.default.resolve(import_node_path18.default.dirname(file), include[1]), seen)
35862
+ readXcconfig(import_node_path19.default.resolve(import_node_path19.default.dirname(file), include[1]), seen)
35692
35863
  );
35693
35864
  continue;
35694
35865
  }
@@ -35738,22 +35909,22 @@ function decodeXml(text3) {
35738
35909
  return text3.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
35739
35910
  }
35740
35911
  function workspaceReferences(workspace) {
35741
- const data = import_node_path18.default.join(workspace, "contents.xcworkspacedata");
35742
- if (!import_node_fs17.default.existsSync(data))
35912
+ const data = import_node_path19.default.join(workspace, "contents.xcworkspacedata");
35913
+ if (!import_node_fs18.default.existsSync(data))
35743
35914
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
35744
- const container = import_node_path18.default.dirname(workspace);
35915
+ const container = import_node_path19.default.dirname(workspace);
35745
35916
  const locate = (location2, base) => {
35746
35917
  const colon = location2.indexOf(":");
35747
35918
  const kind = location2.slice(0, colon);
35748
35919
  const rest = location2.slice(colon + 1);
35749
- if (kind === "group") return import_node_path18.default.resolve(base, rest);
35750
- if (kind === "container" || kind === "self") return import_node_path18.default.resolve(container, rest);
35751
- if (kind === "absolute") return import_node_path18.default.resolve(rest);
35752
- throw new Error(`${import_node_path18.default.basename(workspace)} has an unsupported location ${location2}`);
35920
+ if (kind === "group") return import_node_path19.default.resolve(base, rest);
35921
+ if (kind === "container" || kind === "self") return import_node_path19.default.resolve(container, rest);
35922
+ if (kind === "absolute") return import_node_path19.default.resolve(rest);
35923
+ throw new Error(`${import_node_path19.default.basename(workspace)} has an unsupported location ${location2}`);
35753
35924
  };
35754
35925
  const groups = [container];
35755
35926
  const references = [];
35756
- for (const [, closing, tag, attributes, selfClosing] of import_node_fs17.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
35927
+ for (const [, closing, tag, attributes, selfClosing] of import_node_fs18.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
35757
35928
  if (closing) {
35758
35929
  if (tag === "Group") groups.pop();
35759
35930
  continue;
@@ -35768,8 +35939,8 @@ function workspaceReferences(workspace) {
35768
35939
  }
35769
35940
  function xcodeProjectFile(xcodeproj) {
35770
35941
  for (const name2 of ["project.pbxproj", "project.xcproj"]) {
35771
- const file = import_node_path18.default.join(xcodeproj, name2);
35772
- if (import_node_fs17.default.existsSync(file)) return file;
35942
+ const file = import_node_path19.default.join(xcodeproj, name2);
35943
+ if (import_node_fs18.default.existsSync(file)) return file;
35773
35944
  }
35774
35945
  return null;
35775
35946
  }
@@ -35777,10 +35948,10 @@ function loadProject(xcodeproj) {
35777
35948
  const projectFile = xcodeProjectFile(xcodeproj);
35778
35949
  if (!projectFile)
35779
35950
  throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
35780
- const mtimeMs = import_node_fs17.default.statSync(projectFile).mtimeMs;
35951
+ const mtimeMs = import_node_fs18.default.statSync(projectFile).mtimeMs;
35781
35952
  const cached4 = loaded.get(projectFile);
35782
35953
  if (cached4?.mtimeMs === mtimeMs) return cached4.project;
35783
- const source = import_node_fs17.default.readFileSync(projectFile, "utf8");
35954
+ const source = import_node_fs18.default.readFileSync(projectFile, "utf8");
35784
35955
  const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
35785
35956
  if (!isDict(root) || !isDict(root.objects)) {
35786
35957
  throw new Error(`${projectFile} has no objects table`);
@@ -35794,8 +35965,8 @@ function loadProject(xcodeproj) {
35794
35965
  if (!project || project.isa !== "PBXProject") {
35795
35966
  throw new Error(`${projectFile} has no PBXProject root`);
35796
35967
  }
35797
- const projectDir = import_node_fs17.default.realpathSync(
35798
- import_node_path18.default.resolve(import_node_path18.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
35968
+ const projectDir = import_node_fs18.default.realpathSync(
35969
+ import_node_path19.default.resolve(import_node_path19.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
35799
35970
  );
35800
35971
  const parent = /* @__PURE__ */ new Map();
35801
35972
  for (const [id, entry] of Object.entries(objects)) {
@@ -35813,11 +35984,11 @@ function loadProject(xcodeproj) {
35813
35984
  const own = str(entry.path) ?? "";
35814
35985
  const tree = str(entry.sourceTree) ?? "<group>";
35815
35986
  if (tree === "<absolute>") result2 = own;
35816
- else if (tree === "SOURCE_ROOT") result2 = import_node_path18.default.join(projectDir, own);
35987
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path19.default.join(projectDir, own);
35817
35988
  else if (tree === "<group>") {
35818
35989
  const up = parent.get(id);
35819
35990
  const base = up ? resolvePath(up) : projectDir;
35820
- result2 = base === null ? null : import_node_path18.default.join(base, own);
35991
+ result2 = base === null ? null : import_node_path19.default.join(base, own);
35821
35992
  }
35822
35993
  }
35823
35994
  resolvedPaths.set(id, result2);
@@ -35917,7 +36088,7 @@ function targetMembers(ref) {
35917
36088
  const addResource = (file) => {
35918
36089
  if (isDirectory(file)) {
35919
36090
  for (const inner of walkFiles(file)) resources.add(inner);
35920
- } else if (import_node_fs17.default.existsSync(file)) resources.add(file);
36091
+ } else if (import_node_fs18.default.existsSync(file)) resources.add(file);
35921
36092
  };
35922
36093
  const fileRefPaths = (refId) => {
35923
36094
  const entry = project.object(refId);
@@ -35938,7 +36109,7 @@ function targetMembers(ref) {
35938
36109
  for (const buildFileId of list(phase.files)) {
35939
36110
  for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
35940
36111
  if (phase.isa === "PBXSourcesBuildPhase") {
35941
- if (!import_node_fs17.default.existsSync(file)) continue;
36112
+ if (!import_node_fs18.default.existsSync(file)) continue;
35942
36113
  allSources.add(file);
35943
36114
  if (file.endsWith(".swift")) sources.add(file);
35944
36115
  } else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
@@ -35946,7 +36117,7 @@ function targetMembers(ref) {
35946
36117
  }
35947
36118
  }
35948
36119
  const addSynchronized = (folder, relative3) => {
35949
- const file = import_node_path18.default.join(folder, relative3);
36120
+ const file = import_node_path19.default.join(folder, relative3);
35950
36121
  if (NEVER_MEMBER.test(relative3)) return;
35951
36122
  if (file.endsWith(".swift")) {
35952
36123
  if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
@@ -35971,7 +36142,7 @@ function targetMembers(ref) {
35971
36142
  }
35972
36143
  if (owned.has(groupId)) {
35973
36144
  for (const file of walkFiles(folder)) {
35974
- const relative3 = import_node_path18.default.relative(folder, file).split(import_node_path18.default.sep).join("/");
36145
+ const relative3 = import_node_path19.default.relative(folder, file).split(import_node_path19.default.sep).join("/");
35975
36146
  if ([...exceptions].some(
35976
36147
  (exception) => relative3 === exception || relative3.startsWith(`${exception}/`)
35977
36148
  ))
@@ -35980,14 +36151,14 @@ function targetMembers(ref) {
35980
36151
  }
35981
36152
  } else {
35982
36153
  for (const relative3 of exceptions) {
35983
- const file = import_node_path18.default.join(folder, relative3);
36154
+ const file = import_node_path19.default.join(folder, relative3);
35984
36155
  if (isDirectory(file)) {
35985
36156
  for (const inner of walkFiles(file))
35986
36157
  addSynchronized(
35987
36158
  folder,
35988
- import_node_path18.default.relative(folder, inner).split(import_node_path18.default.sep).join("/")
36159
+ import_node_path19.default.relative(folder, inner).split(import_node_path19.default.sep).join("/")
35989
36160
  );
35990
- } else if (import_node_fs17.default.existsSync(file)) addSynchronized(folder, relative3);
36161
+ } else if (import_node_fs18.default.existsSync(file)) addSynchronized(folder, relative3);
35991
36162
  }
35992
36163
  }
35993
36164
  }
@@ -36000,8 +36171,8 @@ function targetMembers(ref) {
36000
36171
  function commonAncestor(dirs) {
36001
36172
  let common = dirs[0];
36002
36173
  for (const dir of dirs) {
36003
- while (common !== import_node_path18.default.dirname(common) && import_node_path18.default.relative(common, dir).startsWith(".."))
36004
- common = import_node_path18.default.dirname(common);
36174
+ while (common !== import_node_path19.default.dirname(common) && import_node_path19.default.relative(common, dir).startsWith(".."))
36175
+ common = import_node_path19.default.dirname(common);
36005
36176
  }
36006
36177
  return common;
36007
36178
  }
@@ -36010,8 +36181,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
36010
36181
  const projects2 = [];
36011
36182
  const projectAt = /* @__PURE__ */ new Map();
36012
36183
  const addProject = (xcodeproj) => {
36013
- const key2 = import_node_path18.default.resolve(xcodeproj);
36014
- if (projectAt.has(key2) || key2.split(import_node_path18.default.sep).includes("Pods")) return;
36184
+ const key2 = import_node_path19.default.resolve(xcodeproj);
36185
+ if (projectAt.has(key2) || key2.split(import_node_path19.default.sep).includes("Pods")) return;
36015
36186
  if (!xcodeProjectFile(key2)) return;
36016
36187
  const project = loadProject(key2);
36017
36188
  projectAt.set(key2, project);
@@ -36028,7 +36199,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
36028
36199
  for (const reference of listed)
36029
36200
  if (reference.endsWith(".xcodeproj")) addProject(reference);
36030
36201
  if (projects2.length === 0) {
36031
- throw new Error(`${import_node_path18.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
36202
+ throw new Error(`${import_node_path19.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
36032
36203
  }
36033
36204
  return { listed, projects: projects2, projectAt };
36034
36205
  }
@@ -36052,7 +36223,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36052
36223
  const allTargets = projects2.flatMap(nativeTargets);
36053
36224
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
36054
36225
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
36055
- const container = import_node_path18.default.basename(xcodeprojOrWorkspace);
36226
+ const container = import_node_path19.default.basename(xcodeprojOrWorkspace);
36056
36227
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
36057
36228
  if (named.length !== 1) {
36058
36229
  throw new Error(
@@ -36064,14 +36235,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36064
36235
  for (const ref of allTargets) {
36065
36236
  const product = ref.project.object(str(ref.target.productReference));
36066
36237
  const file = str(product?.path);
36067
- if (file && !byProduct.has(import_node_path18.default.basename(file)))
36068
- byProduct.set(import_node_path18.default.basename(file), ref);
36238
+ if (file && !byProduct.has(import_node_path19.default.basename(file)))
36239
+ byProduct.set(import_node_path19.default.basename(file), ref);
36069
36240
  }
36070
36241
  const proxied = (project, proxyId) => {
36071
36242
  const proxy = project.object(proxyId);
36072
36243
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
36073
36244
  const portal = str(proxy.containerPortal);
36074
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path18.default.resolve(project.resolvePath(portal ?? "") ?? ""));
36245
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path19.default.resolve(project.resolvePath(portal ?? "") ?? ""));
36075
36246
  const remote = str(proxy.remoteGlobalIDString);
36076
36247
  if (!owner || !remote) return void 0;
36077
36248
  return nativeTargets(owner).find(
@@ -36092,7 +36263,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36092
36263
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
36093
36264
  for (const buildFileId of list(phase.files)) {
36094
36265
  const file = project.object(str(project.object(buildFileId)?.fileRef));
36095
- const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path18.default.basename(str(file.path) ?? "")) : void 0;
36266
+ const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path19.default.basename(str(file.path) ?? "")) : void 0;
36096
36267
  if (resolved) found.push(resolved);
36097
36268
  }
36098
36269
  }
@@ -36113,7 +36284,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36113
36284
  const name2 = str(ref.target.name) ?? ref.id;
36114
36285
  const { get: settings2, keys } = targetSettings(ref, {
36115
36286
  TARGET_NAME: name2,
36116
- PROJECT_NAME: import_node_path18.default.basename(ref.project.xcodeproj, ".xcodeproj"),
36287
+ PROJECT_NAME: import_node_path19.default.basename(ref.project.xcodeproj, ".xcodeproj"),
36117
36288
  SRCROOT: ref.project.projectDir,
36118
36289
  SOURCE_ROOT: ref.project.projectDir,
36119
36290
  PROJECT_DIR: ref.project.projectDir,
@@ -36144,8 +36315,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36144
36315
  }
36145
36316
  return value;
36146
36317
  };
36147
- const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path18.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
36148
- const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs17.default.readFileSync(infoPlistFile, "utf8")) : {};
36318
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path19.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
36319
+ const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs18.default.readFileSync(infoPlistFile, "utf8")) : {};
36149
36320
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
36150
36321
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
36151
36322
  }
@@ -36163,12 +36334,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36163
36334
  };
36164
36335
  }
36165
36336
  const localPackageDirs = [
36166
- ...listed.filter((reference) => import_node_fs17.default.existsSync(import_node_path18.default.join(reference, "Package.swift"))),
36337
+ ...listed.filter((reference) => import_node_fs18.default.existsSync(import_node_path19.default.join(reference, "Package.swift"))),
36167
36338
  ...projects2.flatMap(
36168
36339
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
36169
36340
  if (!isDict(entry)) return [];
36170
- const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path18.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
36171
- return candidate && import_node_fs17.default.existsSync(import_node_path18.default.join(candidate, "Package.swift")) ? [candidate] : [];
36341
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path19.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
36342
+ return candidate && import_node_fs18.default.existsSync(import_node_path19.default.join(candidate, "Package.swift")) ? [candidate] : [];
36172
36343
  })
36173
36344
  )
36174
36345
  ];
@@ -36192,7 +36363,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36192
36363
  product,
36193
36364
  source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
36194
36365
  kind: "local",
36195
- dir: import_node_path18.default.resolve(
36366
+ dir: import_node_path19.default.resolve(
36196
36367
  project.projectDir,
36197
36368
  str(reference.relativePath) ?? ""
36198
36369
  )
@@ -36214,8 +36385,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36214
36385
  }
36215
36386
  }
36216
36387
  }
36217
- const resolvedFile = import_node_path18.default.join(
36218
- workspace ?? import_node_path18.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
36388
+ const resolvedFile = import_node_path19.default.join(
36389
+ workspace ?? import_node_path19.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
36219
36390
  "xcshareddata",
36220
36391
  "swiftpm",
36221
36392
  "Package.resolved"
@@ -36225,13 +36396,13 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36225
36396
  ...module2,
36226
36397
  rootDir: commonAncestor(
36227
36398
  [
36228
- workspace ? import_node_path18.default.dirname(workspace) : app.project.projectDir,
36399
+ workspace ? import_node_path19.default.dirname(workspace) : app.project.projectDir,
36229
36400
  ...used.map((project) => project.projectDir),
36230
36401
  ...localPackageDirs,
36231
36402
  ...linkedProducts.flatMap(
36232
- ({ source }) => source.kind === "local" && import_node_fs17.default.existsSync(source.dir) ? [source.dir] : []
36403
+ ({ source }) => source.kind === "local" && import_node_fs18.default.existsSync(source.dir) ? [source.dir] : []
36233
36404
  )
36234
- ].map((dir) => import_node_fs17.default.realpathSync(dir))
36405
+ ].map((dir) => import_node_fs18.default.realpathSync(dir))
36235
36406
  ),
36236
36407
  projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
36237
36408
  infoPlist: import_plist3.default.build(info),
@@ -36239,19 +36410,19 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36239
36410
  frameworks,
36240
36411
  linkedProducts,
36241
36412
  localPackageDirs: [
36242
- ...new Set(localPackageDirs.map((dir) => import_node_fs17.default.realpathSync(dir)))
36413
+ ...new Set(localPackageDirs.map((dir) => import_node_fs18.default.realpathSync(dir)))
36243
36414
  ].sort(),
36244
36415
  binaryFrameworks: [...binaryFrameworks].sort(),
36245
- packageResolved: import_node_fs17.default.existsSync(resolvedFile) ? resolvedFile : null,
36416
+ packageResolved: import_node_fs18.default.existsSync(resolvedFile) ? resolvedFile : null,
36246
36417
  appTargets: appTargetNames
36247
36418
  };
36248
36419
  }
36249
- var import_node_fs17, import_node_path18, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
36420
+ var import_node_fs18, import_node_path19, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
36250
36421
  var init_xcode_project = __esm({
36251
36422
  "src/xcode-project.ts"() {
36252
36423
  "use strict";
36253
- import_node_fs17 = __toESM(require("node:fs"), 1);
36254
- import_node_path18 = __toESM(require("node:path"), 1);
36424
+ import_node_fs18 = __toESM(require("node:fs"), 1);
36425
+ import_node_path19 = __toESM(require("node:path"), 1);
36255
36426
  import_plist3 = __toESM(require_plist(), 1);
36256
36427
  init_xcode_json_project();
36257
36428
  isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -36271,7 +36442,7 @@ var init_xcode_project = __esm({
36271
36442
  arch: "arm64",
36272
36443
  variant: "normal"
36273
36444
  };
36274
- isDirectory = (dir) => import_node_fs17.default.existsSync(dir) && import_node_fs17.default.statSync(dir).isDirectory();
36445
+ isDirectory = (dir) => import_node_fs18.default.existsSync(dir) && import_node_fs18.default.statSync(dir).isDirectory();
36275
36446
  loaded = /* @__PURE__ */ new Map();
36276
36447
  targetRefs = /* @__PURE__ */ new WeakMap();
36277
36448
  }
@@ -36279,17 +36450,17 @@ var init_xcode_project = __esm({
36279
36450
 
36280
36451
  // src/swift-host.ts
36281
36452
  function swiftPackageId(packagePath) {
36282
- return import_node_path19.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
36453
+ return import_node_path20.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
36283
36454
  }
36284
36455
  function nativeSourceDescriptor(packagePath) {
36285
- packagePath = import_node_fs18.default.realpathSync(packagePath);
36286
- const file = import_node_path19.default.join(packagePath, NATIVE_DESCRIPTOR);
36287
- if (!import_node_fs18.default.existsSync(file)) return null;
36456
+ packagePath = import_node_fs19.default.realpathSync(packagePath);
36457
+ const file = import_node_path20.default.join(packagePath, NATIVE_DESCRIPTOR);
36458
+ if (!import_node_fs19.default.existsSync(file)) return null;
36288
36459
  const value = JSON.parse(
36289
36460
  readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
36290
36461
  );
36291
36462
  const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
36292
- if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs18.default.existsSync(import_node_path19.default.join(packagePath, NATIVE_GLUE))) {
36463
+ if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs19.default.existsSync(import_node_path20.default.join(packagePath, NATIVE_GLUE))) {
36293
36464
  throw invalid();
36294
36465
  }
36295
36466
  if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
@@ -36298,7 +36469,7 @@ function nativeSourceDescriptor(packagePath) {
36298
36469
  return value;
36299
36470
  }
36300
36471
  function projectFor(packagePath, hosted) {
36301
- packagePath = import_node_fs18.default.realpathSync(packagePath);
36472
+ packagePath = import_node_fs19.default.realpathSync(packagePath);
36302
36473
  const existing = projects.get(packagePath);
36303
36474
  if (existing) {
36304
36475
  if (hosted && !existing.hosted) {
@@ -36319,14 +36490,14 @@ function projectFor(packagePath, hosted) {
36319
36490
  return created;
36320
36491
  }
36321
36492
  function swiftPackages(entry, app) {
36322
- const stamp = (file) => file && import_node_fs18.default.existsSync(file) ? import_node_fs18.default.statSync(file).mtimeMs : 0;
36493
+ const stamp = (file) => file && import_node_fs19.default.existsSync(file) ? import_node_fs19.default.statSync(file).mtimeMs : 0;
36323
36494
  const key2 = JSON.stringify([
36324
36495
  app.linkedProducts,
36325
36496
  app.packageResolved,
36326
36497
  stamp(app.packageResolved),
36327
- app.localPackageDirs.map((dir) => stamp(import_node_path19.default.join(dir, "Package.swift"))),
36498
+ app.localPackageDirs.map((dir) => stamp(import_node_path20.default.join(dir, "Package.swift"))),
36328
36499
  app.linkedProducts.map(
36329
- ({ source }) => source.kind === "local" ? stamp(import_node_path19.default.join(source.dir, "Package.swift")) : 0
36500
+ ({ source }) => source.kind === "local" ? stamp(import_node_path20.default.join(source.dir, "Package.swift")) : 0
36330
36501
  )
36331
36502
  ]);
36332
36503
  let cached4 = entry.packages;
@@ -36375,8 +36546,8 @@ function swiftPackages(entry, app) {
36375
36546
  }
36376
36547
  function xcodeInputKey(layout, file, relative3) {
36377
36548
  const owner = layout.targetDirs.get(file);
36378
- if (owner) return import_node_path19.default.posix.join(owner, relative3);
36379
- return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path19.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
36549
+ if (owner) return import_node_path20.default.posix.join(owner, relative3);
36550
+ return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path20.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
36380
36551
  }
36381
36552
  function xcodeLayout(root) {
36382
36553
  const registered = xcodeProjects.get(root);
@@ -36387,7 +36558,7 @@ function xcodeLayout(root) {
36387
36558
  const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
36388
36559
  const targets = [];
36389
36560
  for (const framework of app.frameworks) {
36390
- const dir = import_node_path19.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
36561
+ const dir = import_node_path20.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
36391
36562
  for (const file of framework.sources) {
36392
36563
  if (targetDirs.has(file)) continue;
36393
36564
  targetDirs.set(file, dir);
@@ -36407,7 +36578,7 @@ function xcodeLayout(root) {
36407
36578
  for (const standin of standins)
36408
36579
  targets.push({
36409
36580
  name: standin.module,
36410
- path: import_node_path19.default.posix.join(XCODE_STANDINS_DIR, standin.module),
36581
+ path: import_node_path20.default.posix.join(XCODE_STANDINS_DIR, standin.module),
36411
36582
  executable: false,
36412
36583
  resources: false,
36413
36584
  exclude: [],
@@ -36415,19 +36586,19 @@ function xcodeLayout(root) {
36415
36586
  mainActorIsolation: false
36416
36587
  });
36417
36588
  for (const target of packages.targets) {
36418
- const relative3 = import_node_path19.default.relative(
36419
- target.remote ? import_node_path19.default.join(root, REMOTE_CHECKOUTS) : root,
36589
+ const relative3 = import_node_path20.default.relative(
36590
+ target.remote ? import_node_path20.default.join(root, REMOTE_CHECKOUTS) : root,
36420
36591
  target.dir
36421
36592
  );
36422
- if (relative3 === ".." || relative3.startsWith(`..${import_node_path19.default.sep}`) || import_node_path19.default.isAbsolute(relative3))
36593
+ if (relative3 === ".." || relative3.startsWith(`..${import_node_path20.default.sep}`) || import_node_path20.default.isAbsolute(relative3))
36423
36594
  throw new Error(`swift input escapes the selected package: ${target.dir}`);
36424
- const posix2 = relative3.split(import_node_path19.default.sep).join(import_node_path19.default.posix.sep);
36595
+ const posix2 = relative3.split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep);
36425
36596
  targets.push({
36426
36597
  ...target,
36427
- path: target.remote ? import_node_path19.default.posix.join(XCODE_PACKAGES_DIR, posix2) : posix2,
36598
+ path: target.remote ? import_node_path20.default.posix.join(XCODE_PACKAGES_DIR, posix2) : posix2,
36428
36599
  exclude: []
36429
36600
  });
36430
- if (!target.remote) files2.add(import_node_path19.default.join(target.packageDir, "Package.swift"));
36601
+ if (!target.remote) files2.add(import_node_path20.default.join(target.packageDir, "Package.swift"));
36431
36602
  for (const file of target.files) files2.add(file);
36432
36603
  }
36433
36604
  for (const target of targets) {
@@ -36457,25 +36628,25 @@ function xcodeManifest(layout) {
36457
36628
  ].join("\n");
36458
36629
  }
36459
36630
  function packageFiles(root) {
36460
- const canonicalRoot = import_node_fs18.default.realpathSync(root);
36631
+ const canonicalRoot = import_node_fs19.default.realpathSync(root);
36461
36632
  const xcode = xcodeLayout(canonicalRoot);
36462
36633
  return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
36463
36634
  }
36464
36635
  function sourceTreeFiles(dir, canonicalRoot) {
36465
36636
  const found = [];
36466
36637
  const walk2 = (dir2) => {
36467
- for (const entry of import_node_fs18.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
36638
+ for (const entry of import_node_fs19.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
36468
36639
  if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
36469
36640
  continue;
36470
- const full = import_node_path19.default.join(dir2, entry.name);
36641
+ const full = import_node_path20.default.join(dir2, entry.name);
36471
36642
  if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
36472
- const real = import_node_fs18.default.realpathSync(full);
36473
- const relative3 = import_node_path19.default.relative(canonicalRoot, real);
36474
- if (relative3.startsWith(`..${import_node_path19.default.sep}`) || relative3 === ".." || import_node_path19.default.isAbsolute(relative3)) {
36643
+ const real = import_node_fs19.default.realpathSync(full);
36644
+ const relative3 = import_node_path20.default.relative(canonicalRoot, real);
36645
+ if (relative3.startsWith(`..${import_node_path20.default.sep}`) || relative3 === ".." || import_node_path20.default.isAbsolute(relative3)) {
36475
36646
  throw new Error(`swift input escapes the selected package: ${full}`);
36476
36647
  }
36477
36648
  if (entry.isDirectory()) {
36478
- if (import_node_fs18.default.existsSync(import_node_path19.default.join(full, "Package.swift"))) continue;
36649
+ if (import_node_fs19.default.existsSync(import_node_path20.default.join(full, "Package.swift"))) continue;
36479
36650
  walk2(full);
36480
36651
  } else if (entry.isFile()) {
36481
36652
  found.push(full);
@@ -36483,63 +36654,22 @@ function sourceTreeFiles(dir, canonicalRoot) {
36483
36654
  }
36484
36655
  }
36485
36656
  };
36486
- if (import_node_fs18.default.existsSync(dir)) walk2(import_node_fs18.default.realpathSync(dir));
36657
+ if (import_node_fs19.default.existsSync(dir)) walk2(import_node_fs19.default.realpathSync(dir));
36487
36658
  return found;
36488
36659
  }
36489
- function readPackageFile(root, file, maxBytes) {
36490
- const canonicalRoot = import_node_fs18.default.realpathSync(root);
36491
- const relative3 = import_node_path19.default.relative(canonicalRoot, import_node_fs18.default.realpathSync(file));
36492
- if (relative3 === ".." || relative3.startsWith(`..${import_node_path19.default.sep}`) || import_node_path19.default.isAbsolute(relative3)) {
36493
- throw new Error(`swift input escapes the selected package: ${file}`);
36494
- }
36495
- let ancestor = import_node_path19.default.resolve(file);
36496
- while (ancestor !== canonicalRoot) {
36497
- if (import_node_fs18.default.lstatSync(ancestor).isSymbolicLink()) {
36498
- throw new Error(`swift input is a symlink: ${ancestor}`);
36499
- }
36500
- const parent = import_node_path19.default.dirname(ancestor);
36501
- if (parent === ancestor)
36502
- throw new Error(`swift input escapes the selected package: ${file}`);
36503
- ancestor = parent;
36504
- }
36505
- const expected = import_node_fs18.default.statSync(file);
36506
- const fd = import_node_fs18.default.openSync(file, import_node_fs18.default.constants.O_RDONLY | import_node_fs18.default.constants.O_NOFOLLOW);
36507
- try {
36508
- const stat2 = import_node_fs18.default.fstatSync(fd);
36509
- if (stat2.dev !== expected.dev || stat2.ino !== expected.ino) {
36510
- throw new Error(`swift input changed while opening: ${file}`);
36511
- }
36512
- if (!stat2.isFile() || stat2.size > maxBytes) {
36513
- throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
36514
- }
36515
- const bytes = Buffer.alloc(stat2.size + 1);
36516
- let offset = 0;
36517
- while (offset < bytes.length) {
36518
- const count = import_node_fs18.default.readSync(fd, bytes, offset, bytes.length - offset, null);
36519
- if (count === 0) break;
36520
- offset += count;
36521
- }
36522
- if (offset !== stat2.size || import_node_fs18.default.fstatSync(fd).size !== stat2.size) {
36523
- throw new Error(`swift input changed while reading: ${file}`);
36524
- }
36525
- return bytes.subarray(0, offset);
36526
- } finally {
36527
- import_node_fs18.default.closeSync(fd);
36528
- }
36529
- }
36530
36660
  function sourceFiles(root) {
36531
36661
  return packageFiles(root).filter((file) => file.endsWith(".swift"));
36532
36662
  }
36533
36663
  function resourceCandidateFiles(root) {
36534
36664
  return packageFiles(root).filter(
36535
- (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path19.default.basename(file))
36665
+ (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path20.default.basename(file))
36536
36666
  );
36537
36667
  }
36538
36668
  function buildSwiftResourceTable(project, baseUrl) {
36539
36669
  const limits = inputLimits(Boolean(project.hosted));
36540
36670
  const absolute = resourceCandidateFiles(project.packagePath);
36541
36671
  const relative3 = absolute.map(
36542
- (file) => import_node_path19.default.relative(project.packagePath, file).split(import_node_path19.default.sep).join(import_node_path19.default.posix.sep)
36672
+ (file) => import_node_path20.default.relative(project.packagePath, file).split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep)
36543
36673
  );
36544
36674
  const byRelative = new Map(absolute.map((file, index) => [relative3[index], file]));
36545
36675
  const readContents = (candidate) => {
@@ -36561,16 +36691,16 @@ function buildSwiftResourceTable(project, baseUrl) {
36561
36691
  for (const { name: name2, file, scale } of found) {
36562
36692
  const disk = byRelative.get(file);
36563
36693
  if (!disk) continue;
36564
- if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs18.default.statSync(disk).size > limits.imageTotalBytes) {
36694
+ if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs19.default.statSync(disk).size > limits.imageTotalBytes) {
36565
36695
  throw new Error("swift image pack exceeds the compile service caps");
36566
36696
  }
36567
36697
  const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
36568
36698
  imageBytes += bytes.length;
36569
36699
  const hash = (0, import_node_crypto8.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
36570
- const ext = import_node_path19.default.posix.extname(file).toLowerCase();
36700
+ const ext = import_node_path20.default.posix.extname(file).toLowerCase();
36571
36701
  table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
36572
36702
  images[name2] = {
36573
- file: import_node_path19.default.posix.basename(file),
36703
+ file: import_node_path20.default.posix.basename(file),
36574
36704
  data: bytes.toString("base64")
36575
36705
  };
36576
36706
  watched.push(file);
@@ -36594,10 +36724,10 @@ function buildSwiftResourceTable(project, baseUrl) {
36594
36724
  return { table, images, colors, symbols, watched };
36595
36725
  }
36596
36726
  function buildSwiftBundleFiles(packagePath, hosted) {
36597
- packagePath = import_node_fs18.default.realpathSync(packagePath);
36727
+ packagePath = import_node_fs19.default.realpathSync(packagePath);
36598
36728
  const limits = inputLimits(hosted);
36599
36729
  const relative3 = resourceCandidateFiles(packagePath).map(
36600
- (file) => import_node_path19.default.relative(packagePath, file).split(import_node_path19.default.sep).join(import_node_path19.default.posix.sep)
36730
+ (file) => import_node_path20.default.relative(packagePath, file).split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep)
36601
36731
  );
36602
36732
  const files2 = {};
36603
36733
  const watched = [];
@@ -36611,13 +36741,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
36611
36741
  total += bytes.length;
36612
36742
  if (xcode.app.infoPlistFile)
36613
36743
  watched.push(
36614
- import_node_path19.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path19.default.sep).join("/")
36744
+ import_node_path20.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path20.default.sep).join("/")
36615
36745
  );
36616
36746
  }
36617
36747
  for (const { base, file } of enumerateBundleJson(relative3)) {
36618
36748
  watched.push(file);
36619
- const disk = import_node_path19.default.join(packagePath, ...file.split("/"));
36620
- if (Object.keys(files2).length >= limits.resources || total + import_node_fs18.default.statSync(disk).size > limits.resourceTotalBytes) {
36749
+ const disk = import_node_path20.default.join(packagePath, ...file.split("/"));
36750
+ if (Object.keys(files2).length >= limits.resources || total + import_node_fs19.default.statSync(disk).size > limits.resourceTotalBytes) {
36621
36751
  throw new Error(
36622
36752
  `swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
36623
36753
  );
@@ -36632,12 +36762,12 @@ function serveSwiftResource(project, key2) {
36632
36762
  return project.resourceFiles.get(key2) ?? project.resourcesPrevious.get(key2) ?? null;
36633
36763
  }
36634
36764
  function linkedModuleRoots(packagePath) {
36635
- packagePath = import_node_fs18.default.realpathSync(packagePath);
36765
+ packagePath = import_node_fs19.default.realpathSync(packagePath);
36636
36766
  let manifest;
36637
36767
  try {
36638
36768
  manifest = readPackageFile(
36639
36769
  packagePath,
36640
- import_node_path19.default.join(packagePath, "Package.swift"),
36770
+ import_node_path20.default.join(packagePath, "Package.swift"),
36641
36771
  MAX_SWIFT_COMPILE_SOURCE_BYTES
36642
36772
  ).toString("utf8");
36643
36773
  } catch {
@@ -36646,8 +36776,8 @@ function linkedModuleRoots(packagePath) {
36646
36776
  const roots = /* @__PURE__ */ new Set();
36647
36777
  const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
36648
36778
  for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
36649
- const root = import_node_path19.default.resolve(packagePath, match[1]);
36650
- if (import_node_fs18.default.existsSync(import_node_path19.default.join(root, "Package.swift"))) roots.add(root);
36779
+ const root = import_node_path20.default.resolve(packagePath, match[1]);
36780
+ if (import_node_fs19.default.existsSync(import_node_path20.default.join(root, "Package.swift"))) roots.add(root);
36651
36781
  }
36652
36782
  return [...roots].sort();
36653
36783
  }
@@ -36656,18 +36786,18 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
36656
36786
  hash.update(packagePath);
36657
36787
  const projectInputs = new Set(packageFiles(packagePath));
36658
36788
  for (const file of [...projectInputs].sort()) {
36659
- hash.update(import_node_path19.default.relative(packagePath, file));
36660
- const stat2 = import_node_fs18.default.statSync(file);
36789
+ hash.update(import_node_path20.default.relative(packagePath, file));
36790
+ const stat2 = import_node_fs19.default.statSync(file);
36661
36791
  hash.update(`${stat2.mtimeMs}/${stat2.ctimeMs}/${stat2.size}`);
36662
36792
  }
36663
36793
  const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
36664
- (root) => import_node_fs18.default.existsSync(import_node_path19.default.join(root, "toolchain.json"))
36794
+ (root) => import_node_fs19.default.existsSync(import_node_path20.default.join(root, "toolchain.json"))
36665
36795
  );
36666
36796
  if (moduleRoot) {
36667
36797
  hash.update(moduleRoot);
36668
36798
  for (const relative3 of swiftModuleInputFiles(moduleRoot)) {
36669
36799
  hash.update(relative3);
36670
- hash.update(String(import_node_fs18.default.statSync(import_node_path19.default.join(moduleRoot, relative3)).mtimeMs));
36800
+ hash.update(String(import_node_fs19.default.statSync(import_node_path20.default.join(moduleRoot, relative3)).mtimeMs));
36671
36801
  }
36672
36802
  }
36673
36803
  return hash.digest("hex").slice(0, 16);
@@ -36679,8 +36809,8 @@ function packageSources(packagePath) {
36679
36809
  const xcode = xcodeLayout(packagePath);
36680
36810
  const files2 = {};
36681
36811
  for (const file of sourceFiles(packagePath)) {
36682
- const relative3 = import_node_path19.default.relative(packagePath, file).split(import_node_path19.default.sep).join(import_node_path19.default.posix.sep);
36683
- if (xcode && import_node_path19.default.basename(file) === "Package.swift") continue;
36812
+ const relative3 = import_node_path20.default.relative(packagePath, file).split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep);
36813
+ if (xcode && import_node_path20.default.basename(file) === "Package.swift") continue;
36684
36814
  files2[xcode ? xcodeInputKey(xcode, file, relative3) : relative3] = readPackageFile(
36685
36815
  packagePath,
36686
36816
  file,
@@ -36691,7 +36821,7 @@ function packageSources(packagePath) {
36691
36821
  files2["Package.swift"] = xcodeManifest(xcode);
36692
36822
  for (const standin of xcode.standins)
36693
36823
  for (const [file, text3] of Object.entries(standin.files))
36694
- files2[import_node_path19.default.posix.join(XCODE_STANDINS_DIR, standin.module, file)] = text3;
36824
+ files2[import_node_path20.default.posix.join(XCODE_STANDINS_DIR, standin.module, file)] = text3;
36695
36825
  }
36696
36826
  return files2;
36697
36827
  }
@@ -36702,7 +36832,7 @@ function packageSnapshot(project) {
36702
36832
  files: files2,
36703
36833
  resourcePaths: swiftImplicitResourcePaths(
36704
36834
  resourceCandidateFiles(project.packagePath).map(
36705
- (file) => import_node_path19.default.relative(project.packagePath, file).split(import_node_path19.default.sep).join(import_node_path19.default.posix.sep)
36835
+ (file) => import_node_path20.default.relative(project.packagePath, file).split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep)
36706
36836
  )
36707
36837
  ),
36708
36838
  resources: buildSwiftResourceTable(project, ""),
@@ -36711,7 +36841,7 @@ function packageSnapshot(project) {
36711
36841
  ...native ? {
36712
36842
  glue: readPackageFile(
36713
36843
  project.packagePath,
36714
- import_node_path19.default.join(project.packagePath, NATIVE_GLUE),
36844
+ import_node_path20.default.join(project.packagePath, NATIVE_GLUE),
36715
36845
  MAX_SWIFT_COMPILE_SOURCE_BYTES
36716
36846
  ).toString("utf8")
36717
36847
  } : {}
@@ -36747,7 +36877,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
36747
36877
  package: content
36748
36878
  };
36749
36879
  const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
36750
- (root) => import_node_fs18.default.existsSync(import_node_path19.default.join(root, "toolchain.json"))
36880
+ (root) => import_node_fs19.default.existsSync(import_node_path20.default.join(root, "toolchain.json"))
36751
36881
  ) ?? await swiftDistributionRoot();
36752
36882
  if (!moduleRoot)
36753
36883
  return {
@@ -36774,10 +36904,10 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
36774
36904
  // server and a capture, or two checkouts) build each other's sources. so
36775
36905
  // each app and module checkout gets its own root, which keeps the same
36776
36906
  // app's incremental build across restarts.
36777
- buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path19.default.join(
36907
+ buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path20.default.join(
36778
36908
  import_node_os8.default.tmpdir(),
36779
36909
  "contrast-swift-build",
36780
- (0, import_node_crypto8.createHash)("sha256").update(`${moduleRoot}\0${import_node_path19.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
36910
+ (0, import_node_crypto8.createHash)("sha256").update(`${moduleRoot}\0${import_node_path20.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
36781
36911
  ),
36782
36912
  moduleRoot,
36783
36913
  ...toolchain
@@ -36870,7 +37000,7 @@ async function missingModulesMessage(packagePath, missing) {
36870
37000
  `Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
36871
37001
  ...[...missing].map(([name2, files2]) => {
36872
37002
  const gap = gaps.get(name2);
36873
- return ` ${name2.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path19.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
37003
+ return ` ${name2.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path20.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
36874
37004
  })
36875
37005
  ].join("\n");
36876
37006
  }
@@ -36878,7 +37008,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
36878
37008
  const auth = hosted ? null : resolveCliAuth();
36879
37009
  if (!hosted && (!auth || auth.kind === "github")) {
36880
37010
  throw new Error(
36881
- `compiling ${import_node_path19.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
37011
+ `compiling ${import_node_path20.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
36882
37012
  );
36883
37013
  }
36884
37014
  const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
@@ -36897,7 +37027,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
36897
37027
  const bytes = sources.reduce((total2, text3) => total2 + Buffer.byteLength(text3), 0);
36898
37028
  if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
36899
37029
  throw new Error(
36900
- `${import_node_path19.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`
37030
+ `${import_node_path20.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`
36901
37031
  );
36902
37032
  }
36903
37033
  const descriptor = snapshot.native;
@@ -36916,7 +37046,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
36916
37046
  );
36917
37047
  if (descriptor && address.native?.hash !== descriptor.hash) {
36918
37048
  throw new Error(
36919
- `${import_node_path19.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`
37049
+ `${import_node_path20.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`
36920
37050
  );
36921
37051
  }
36922
37052
  const response = await fetch(address.url, { signal });
@@ -37033,14 +37163,14 @@ function serveSwiftPackageAsset(pathname, res) {
37033
37163
  res.end("swift artifact is stale");
37034
37164
  return true;
37035
37165
  }
37036
- var import_node_crypto8, import_node_fs18, import_node_os8, import_node_path19, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, SwiftMissingModulesError, projects, xcodeProjects, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, XCODE_STANDINS_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, UNPROVIDED_PLATFORM_MODULES, IOS_SDK_FRAMEWORKS;
37166
+ var import_node_crypto8, import_node_fs19, import_node_os8, import_node_path20, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, SwiftMissingModulesError, projects, xcodeProjects, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, XCODE_STANDINS_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, UNPROVIDED_PLATFORM_MODULES, IOS_SDK_FRAMEWORKS;
37037
37167
  var init_swift_host = __esm({
37038
37168
  "src/swift-host.ts"() {
37039
37169
  "use strict";
37040
37170
  import_node_crypto8 = require("node:crypto");
37041
- import_node_fs18 = __toESM(require("node:fs"), 1);
37171
+ import_node_fs19 = __toESM(require("node:fs"), 1);
37042
37172
  import_node_os8 = __toESM(require("node:os"), 1);
37043
- import_node_path19 = __toESM(require("node:path"), 1);
37173
+ import_node_path20 = __toESM(require("node:path"), 1);
37044
37174
  init_bundleAssets();
37045
37175
  init_auth();
37046
37176
  init_backend_origin();
@@ -37050,6 +37180,7 @@ var init_swift_host = __esm({
37050
37180
  init_swift_distribution();
37051
37181
  init_swift_package();
37052
37182
  init_swift_packages();
37183
+ init_swift_source_file();
37053
37184
  init_swift_standins();
37054
37185
  init_swift_submit();
37055
37186
  init_xcode_project();
@@ -37074,7 +37205,7 @@ var init_swift_host = __esm({
37074
37205
  XCODE_FRAMEWORKS_DIR = "__frameworks__";
37075
37206
  XCODE_PACKAGES_DIR = "__packages__";
37076
37207
  XCODE_STANDINS_DIR = "__standins__";
37077
- CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path19.default.sep).join(import_node_path19.default.posix.sep)}/`;
37208
+ CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep)}/`;
37078
37209
  HOSTED_LIMITS = {
37079
37210
  resources: MAX_SWIFT_COMPILE_RESOURCES,
37080
37211
  resourceBytes: MAX_SWIFT_COMPILE_RESOURCE_BYTES,
@@ -37126,8 +37257,8 @@ var init_swift_host = __esm({
37126
37257
 
37127
37258
  // src/expo-swift-host.ts
37128
37259
  async function collectExpoSwiftSources(appRoot) {
37129
- appRoot = import_node_fs19.default.realpathSync(appRoot);
37130
- const appRequire = (0, import_node_module.createRequire)(import_node_path20.default.join(appRoot, "package.json"));
37260
+ appRoot = import_node_fs20.default.realpathSync(appRoot);
37261
+ const appRequire = (0, import_node_module.createRequire)(import_node_path21.default.join(appRoot, "package.json"));
37131
37262
  let autolinker;
37132
37263
  try {
37133
37264
  autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
@@ -37141,7 +37272,7 @@ async function collectExpoSwiftSources(appRoot) {
37141
37272
  (command) => run3(
37142
37273
  process.execPath,
37143
37274
  [
37144
- import_node_path20.default.join(import_node_path20.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
37275
+ import_node_path21.default.join(import_node_path21.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
37145
37276
  command,
37146
37277
  "--platform",
37147
37278
  "apple",
@@ -37172,8 +37303,8 @@ async function collectExpoSwiftSources(appRoot) {
37172
37303
  const sourceRoot = Reflect.get(entry, "path");
37173
37304
  if (typeof sourceRoot !== "string")
37174
37305
  throw new Error("Expo autolinking entry has no path");
37175
- const canonical = import_node_fs19.default.realpathSync(sourceRoot);
37176
- if (canonical.split(import_node_path20.default.sep).includes("node_modules")) continue;
37306
+ const canonical = import_node_fs20.default.realpathSync(sourceRoot);
37307
+ if (canonical.split(import_node_path21.default.sep).includes("node_modules")) continue;
37177
37308
  const resolution = resolutions.find(
37178
37309
  (candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
37179
37310
  );
@@ -37200,12 +37331,12 @@ async function collectExpoSwiftSources(appRoot) {
37200
37331
  registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
37201
37332
  });
37202
37333
  }
37203
- const ios = import_node_path20.default.join(canonical, "ios");
37204
- if (import_node_fs19.default.lstatSync(ios).isSymbolicLink())
37334
+ const ios = import_node_path21.default.join(canonical, "ios");
37335
+ if (import_node_fs20.default.lstatSync(ios).isSymbolicLink())
37205
37336
  throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
37206
37337
  const walk2 = (dir) => {
37207
- for (const child of import_node_fs19.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
37208
- const file = import_node_path20.default.join(dir, child.name);
37338
+ for (const child of import_node_fs20.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
37339
+ const file = import_node_path21.default.join(dir, child.name);
37209
37340
  if (child.isSymbolicLink())
37210
37341
  throw new Error(`Expo Swift source is a symlink: ${file}`);
37211
37342
  if (child.isDirectory()) {
@@ -37213,13 +37344,13 @@ async function collectExpoSwiftSources(appRoot) {
37213
37344
  continue;
37214
37345
  }
37215
37346
  if (!child.name.endsWith(".swift")) continue;
37216
- const size = import_node_fs19.default.statSync(file).size;
37347
+ const size = import_node_fs20.default.statSync(file).size;
37217
37348
  bytes += size;
37218
37349
  fileCount++;
37219
37350
  if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
37220
37351
  throw new Error("Expo Swift sources exceed compile service caps");
37221
- files2[`Sources/${namespace}/${import_node_path20.default.relative(ios, file).split(import_node_path20.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
37222
- ${import_node_fs19.default.readFileSync(file, "utf8")}`;
37352
+ files2[`Sources/${namespace}/${import_node_path21.default.relative(ios, file).split(import_node_path21.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
37353
+ ${import_node_fs20.default.readFileSync(file, "utf8")}`;
37223
37354
  }
37224
37355
  };
37225
37356
  walk2(ios);
@@ -37303,7 +37434,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
37303
37434
  modules: [],
37304
37435
  failures: []
37305
37436
  };
37306
- const key2 = (0, import_node_crypto9.createHash)("sha256").update(import_node_fs19.default.realpathSync(root)).digest("hex");
37437
+ const key2 = (0, import_node_crypto9.createHash)("sha256").update(import_node_fs20.default.realpathSync(root)).digest("hex");
37307
37438
  const linked = [];
37308
37439
  for (const unit of units) {
37309
37440
  if (!module2) {
@@ -37313,14 +37444,14 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
37313
37444
  });
37314
37445
  continue;
37315
37446
  }
37316
- const packagePath = import_node_path20.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, unit.moduleId);
37447
+ const packagePath = import_node_path21.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, unit.moduleId);
37317
37448
  let stamp;
37318
37449
  try {
37319
37450
  syncSwiftTree(
37320
37451
  packagePath,
37321
37452
  new Map(
37322
37453
  Object.entries(unit.files).map(([name2, source]) => [
37323
- import_node_path20.default.join(packagePath, name2),
37454
+ import_node_path21.default.join(packagePath, name2),
37324
37455
  source
37325
37456
  ])
37326
37457
  )
@@ -37345,10 +37476,13 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
37345
37476
  const file = JSON.parse(match[1]);
37346
37477
  return typeof file === "string" ? [file] : [];
37347
37478
  });
37348
- const sourceErrors = (diagnostic.match(/^.+:\d+(?::\d+)?: error:.*$/gm) ?? []).filter((line) => appPaths.some((file) => line.startsWith(`${file}:`)));
37349
- if (publishArtifact && sourceErrors.length === 0 && !(error instanceof SwiftMissingModulesError))
37479
+ const errors = diagnostic.match(/^.+:\d+(?::\d+)?: error:.*$/gm) ?? [];
37480
+ const sourceErrors = errors.filter(
37481
+ (line) => appPaths.some((file) => line.startsWith(`${file}:`)) && !/external macro implementation type|failed to load library plugin/.test(line)
37482
+ );
37483
+ if (publishArtifact && (sourceErrors.length === 0 || sourceErrors.length !== errors.length) && !(error instanceof SwiftMissingModulesError))
37350
37484
  throw error;
37351
- if (sourceErrors.length && module2 && stamp && sourceStamp(packagePath, module2.root) === stamp) {
37485
+ if (sourceErrors.length && sourceErrors.length === errors.length && module2 && stamp && sourceStamp(packagePath, module2.root) === stamp) {
37352
37486
  failedCompilations.set(packagePath, {
37353
37487
  stamp,
37354
37488
  diagnostic: sourceErrors.join("\n")
@@ -37378,12 +37512,12 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
37378
37512
  import PackageDescription
37379
37513
  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")])
37380
37514
  `;
37381
- const packagePath = import_node_path20.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, "linked-app");
37515
+ const packagePath = import_node_path21.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, "linked-app");
37382
37516
  syncSwiftTree(
37383
37517
  packagePath,
37384
37518
  new Map(
37385
37519
  Object.entries(files2).map(([name2, source]) => [
37386
- import_node_path20.default.join(packagePath, name2),
37520
+ import_node_path21.default.join(packagePath, name2),
37387
37521
  source
37388
37522
  ])
37389
37523
  )
@@ -37426,7 +37560,7 @@ async function handleExpoSwiftRequest(req, res) {
37426
37560
  return true;
37427
37561
  }
37428
37562
  const root = url.searchParams.get("root");
37429
- if (!root || !import_node_path20.default.isAbsolute(root)) {
37563
+ if (!root || !import_node_path21.default.isAbsolute(root)) {
37430
37564
  res.writeHead(400);
37431
37565
  res.end("missing absolute app root");
37432
37566
  return true;
@@ -37455,16 +37589,16 @@ async function handleExpoSwiftRequest(req, res) {
37455
37589
  }
37456
37590
  return true;
37457
37591
  }
37458
- var import_node_child_process10, import_node_crypto9, import_node_fs19, import_node_module, import_node_os9, import_node_path20, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, compiling, failedCompilations;
37592
+ var import_node_child_process10, import_node_crypto9, import_node_fs20, import_node_module, import_node_os9, import_node_path21, import_node_util3, run3, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, compiling, failedCompilations;
37459
37593
  var init_expo_swift_host = __esm({
37460
37594
  "src/expo-swift-host.ts"() {
37461
37595
  "use strict";
37462
37596
  import_node_child_process10 = require("node:child_process");
37463
37597
  import_node_crypto9 = require("node:crypto");
37464
- import_node_fs19 = __toESM(require("node:fs"), 1);
37598
+ import_node_fs20 = __toESM(require("node:fs"), 1);
37465
37599
  import_node_module = require("node:module");
37466
37600
  import_node_os9 = __toESM(require("node:os"), 1);
37467
- import_node_path20 = __toESM(require("node:path"), 1);
37601
+ import_node_path21 = __toESM(require("node:path"), 1);
37468
37602
  import_node_util3 = require("node:util");
37469
37603
  init_internal_child();
37470
37604
  init_backend_origin();
@@ -37648,14 +37782,14 @@ var init_standalone = __esm({
37648
37782
  // cli/self-invocation.ts
37649
37783
  function sourceEntryPath() {
37650
37784
  try {
37651
- const candidate = (0, import_node_path21.join)((0, import_node_path21.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
37652
- return (0, import_node_fs20.existsSync)(candidate) ? candidate : null;
37785
+ const candidate = (0, import_node_path22.join)((0, import_node_path22.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
37786
+ return (0, import_node_fs21.existsSync)(candidate) ? candidate : null;
37653
37787
  } catch {
37654
37788
  return null;
37655
37789
  }
37656
37790
  }
37657
- function isCliEntry(path37) {
37658
- const name2 = (0, import_node_path21.basename)(path37);
37791
+ function isCliEntry(path38) {
37792
+ const name2 = (0, import_node_path22.basename)(path38);
37659
37793
  return name2 === "bin.ts" || name2 === "bin.js";
37660
37794
  }
37661
37795
  function rnxSelfInvocation() {
@@ -37673,12 +37807,12 @@ function rnxSelfInvocation() {
37673
37807
  }
37674
37808
  return { executable: process.execPath, prefixArgs: [entry] };
37675
37809
  }
37676
- var import_node_fs20, import_node_path21, import_node_url3;
37810
+ var import_node_fs21, import_node_path22, import_node_url3;
37677
37811
  var init_self_invocation = __esm({
37678
37812
  "cli/self-invocation.ts"() {
37679
37813
  "use strict";
37680
- import_node_fs20 = require("node:fs");
37681
- import_node_path21 = require("node:path");
37814
+ import_node_fs21 = require("node:fs");
37815
+ import_node_path22 = require("node:path");
37682
37816
  import_node_url3 = require("node:url");
37683
37817
  init_public_brand();
37684
37818
  init_standalone();
@@ -37746,7 +37880,7 @@ function getUserDataDir() {
37746
37880
  return userDataDir();
37747
37881
  }
37748
37882
  function storeFile() {
37749
- return import_node_path22.default.join(userDataDir(), "attached-projects.json");
37883
+ return import_node_path23.default.join(userDataDir(), "attached-projects.json");
37750
37884
  }
37751
37885
  function cloneEmpty() {
37752
37886
  return {
@@ -37760,7 +37894,7 @@ function loadStore() {
37760
37894
  const file = storeFile();
37761
37895
  let raw2;
37762
37896
  try {
37763
- raw2 = import_node_fs21.default.readFileSync(file, "utf8");
37897
+ raw2 = import_node_fs22.default.readFileSync(file, "utf8");
37764
37898
  } catch (err) {
37765
37899
  if (err.code === "ENOENT") return cloneEmpty();
37766
37900
  throw err;
@@ -37777,7 +37911,7 @@ function loadStore() {
37777
37911
  } catch (err) {
37778
37912
  const quarantine = `${file}.corrupt-${Date.now()}`;
37779
37913
  try {
37780
- import_node_fs21.default.renameSync(file, quarantine);
37914
+ import_node_fs22.default.renameSync(file, quarantine);
37781
37915
  console.warn(
37782
37916
  `[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
37783
37917
  );
@@ -37788,16 +37922,16 @@ function loadStore() {
37788
37922
  }
37789
37923
  function writeStore(store) {
37790
37924
  const file = storeFile();
37791
- import_node_fs21.default.mkdirSync(import_node_path22.default.dirname(file), { recursive: true });
37925
+ import_node_fs22.default.mkdirSync(import_node_path23.default.dirname(file), { recursive: true });
37792
37926
  const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
37793
- const fd = import_node_fs21.default.openSync(tmp, "w", 384);
37927
+ const fd = import_node_fs22.default.openSync(tmp, "w", 384);
37794
37928
  try {
37795
- import_node_fs21.default.writeFileSync(fd, JSON.stringify(store, null, 2));
37796
- import_node_fs21.default.fsyncSync(fd);
37929
+ import_node_fs22.default.writeFileSync(fd, JSON.stringify(store, null, 2));
37930
+ import_node_fs22.default.fsyncSync(fd);
37797
37931
  } finally {
37798
- import_node_fs21.default.closeSync(fd);
37932
+ import_node_fs22.default.closeSync(fd);
37799
37933
  }
37800
- import_node_fs21.default.renameSync(tmp, file);
37934
+ import_node_fs22.default.renameSync(tmp, file);
37801
37935
  }
37802
37936
  function mutateStore(fn) {
37803
37937
  const store = loadStore();
@@ -37806,13 +37940,13 @@ function mutateStore(fn) {
37806
37940
  return store;
37807
37941
  }
37808
37942
  function projectIdForCwd(cwd) {
37809
- return (0, import_node_crypto10.createHash)("sha256").update(import_node_path22.default.resolve(cwd)).digest("hex").slice(0, 16);
37943
+ return (0, import_node_crypto10.createHash)("sha256").update(import_node_path23.default.resolve(cwd)).digest("hex").slice(0, 16);
37810
37944
  }
37811
37945
  function newSessionId() {
37812
37946
  return `s_${(0, import_node_crypto10.randomBytes)(10).toString("hex")}`;
37813
37947
  }
37814
37948
  function upsertProject(input) {
37815
- const cwd = import_node_path22.default.resolve(input.cwd);
37949
+ const cwd = import_node_path23.default.resolve(input.cwd);
37816
37950
  const id = projectIdForCwd(cwd);
37817
37951
  let result;
37818
37952
  mutateStore((store) => {
@@ -37838,7 +37972,7 @@ function upsertProject(input) {
37838
37972
  const now = Date.now();
37839
37973
  const created = {
37840
37974
  id,
37841
- name: input.name ?? import_node_path22.default.basename(cwd),
37975
+ name: input.name ?? import_node_path23.default.basename(cwd),
37842
37976
  cwd,
37843
37977
  repoRoot: input.repoRoot,
37844
37978
  sourceRoots: input.sourceRoots ?? [cwd],
@@ -37983,8 +38117,8 @@ async function seedFromDemoAppRegistry() {
37983
38117
  if (apps.length === 0) return;
37984
38118
  mutateStore((store) => {
37985
38119
  for (const app of apps) {
37986
- if (!import_node_fs21.default.existsSync(app.dir)) continue;
37987
- const cwd = import_node_path22.default.resolve(app.dir);
38120
+ if (!import_node_fs22.default.existsSync(app.dir)) continue;
38121
+ const cwd = import_node_path23.default.resolve(app.dir);
37988
38122
  const id = projectIdForCwd(cwd);
37989
38123
  if (store.attachedProjects.some((p) => p.id === id)) continue;
37990
38124
  const now = Date.now();
@@ -38005,13 +38139,13 @@ async function seedFromDemoAppRegistry() {
38005
38139
  }
38006
38140
  });
38007
38141
  }
38008
- var import_node_crypto10, import_node_fs21, import_node_path22, overrideDir, COST_HISTORY_MAX_AGE_MS;
38142
+ var import_node_crypto10, import_node_fs22, import_node_path23, overrideDir, COST_HISTORY_MAX_AGE_MS;
38009
38143
  var init_attached_projects = __esm({
38010
38144
  "src/attached-projects.ts"() {
38011
38145
  "use strict";
38012
38146
  import_node_crypto10 = require("node:crypto");
38013
- import_node_fs21 = __toESM(require("node:fs"), 1);
38014
- import_node_path22 = __toESM(require("node:path"), 1);
38147
+ import_node_fs22 = __toESM(require("node:fs"), 1);
38148
+ import_node_path23 = __toESM(require("node:path"), 1);
38015
38149
  init_home_paths();
38016
38150
  overrideDir = null;
38017
38151
  COST_HISTORY_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
@@ -38020,16 +38154,16 @@ var init_attached_projects = __esm({
38020
38154
 
38021
38155
  // src/agent-sessions.ts
38022
38156
  function sessionDir(sessionId) {
38023
- return import_node_path23.default.join(getUserDataDir(), "sessions", sessionId);
38157
+ return import_node_path24.default.join(getUserDataDir(), "sessions", sessionId);
38024
38158
  }
38025
38159
  function promptFifoPath(sessionId) {
38026
- return import_node_path23.default.join(sessionDir(sessionId), "prompt.in");
38160
+ return import_node_path24.default.join(sessionDir(sessionId), "prompt.in");
38027
38161
  }
38028
38162
  function eventsFifoPath(sessionId) {
38029
- return import_node_path23.default.join(sessionDir(sessionId), "events.out");
38163
+ return import_node_path24.default.join(sessionDir(sessionId), "events.out");
38030
38164
  }
38031
38165
  function transcriptPath(sessionId) {
38032
- return import_node_path23.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
38166
+ return import_node_path24.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
38033
38167
  }
38034
38168
  function pidIsAlive(pid, sessionId) {
38035
38169
  if (!pid) return false;
@@ -38039,7 +38173,7 @@ function pidIsAlive(pid, sessionId) {
38039
38173
  return false;
38040
38174
  }
38041
38175
  if (sessionId) {
38042
- if (!import_node_fs22.default.existsSync(sessionDir(sessionId))) return false;
38176
+ if (!import_node_fs23.default.existsSync(sessionDir(sessionId))) return false;
38043
38177
  }
38044
38178
  return true;
38045
38179
  }
@@ -38052,11 +38186,11 @@ function resolveSootsimInvocation() {
38052
38186
  const resourcesPath = process.resourcesPath;
38053
38187
  if (resourcesPath) {
38054
38188
  const candidates = [
38055
- import_node_path23.default.join(resourcesPath, "bin", "sootsim"),
38056
- import_node_path23.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
38189
+ import_node_path24.default.join(resourcesPath, "bin", "sootsim"),
38190
+ import_node_path24.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
38057
38191
  ];
38058
38192
  for (const c of candidates) {
38059
- if (import_node_fs22.default.existsSync(c)) return { executable: c, prefixArgs: [] };
38193
+ if (import_node_fs23.default.existsSync(c)) return { executable: c, prefixArgs: [] };
38060
38194
  }
38061
38195
  }
38062
38196
  }
@@ -38075,15 +38209,15 @@ function tryWorkspaceSootsim() {
38075
38209
  const sootsimDir = resolveSootsimPackageDir();
38076
38210
  if (!sootsimDir) return null;
38077
38211
  const binaryName = `peach-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`;
38078
- const distBinary = import_node_path23.default.join(sootsimDir, "dist-bin", binaryName);
38079
- if (import_node_fs22.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
38080
- const distBin = import_node_path23.default.join(sootsimDir, "dist-cli", "bin.js");
38081
- if (import_node_fs22.default.existsSync(distBin)) {
38212
+ const distBinary = import_node_path24.default.join(sootsimDir, "dist-bin", binaryName);
38213
+ if (import_node_fs23.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
38214
+ const distBin = import_node_path24.default.join(sootsimDir, "dist-cli", "bin.js");
38215
+ if (import_node_fs23.default.existsSync(distBin)) {
38082
38216
  try {
38083
- const src = import_node_path23.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
38084
- if (import_node_fs22.default.existsSync(src)) {
38085
- const srcMtime = import_node_fs22.default.statSync(src).mtimeMs;
38086
- const buildMtime = import_node_fs22.default.statSync(distBin).mtimeMs;
38217
+ const src = import_node_path24.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
38218
+ if (import_node_fs23.default.existsSync(src)) {
38219
+ const srcMtime = import_node_fs23.default.statSync(src).mtimeMs;
38220
+ const buildMtime = import_node_fs23.default.statSync(distBin).mtimeMs;
38087
38221
  if (buildMtime < srcMtime) {
38088
38222
  console.warn(
38089
38223
  `[peach] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with \`bun run --cwd packages/peachsim build:cli\`.`
@@ -38102,22 +38236,22 @@ function tryWorkspaceSootsim() {
38102
38236
  function resolveSootsimPackageDir() {
38103
38237
  try {
38104
38238
  const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
38105
- return import_node_path23.default.dirname(resolved);
38239
+ return import_node_path24.default.dirname(resolved);
38106
38240
  } catch {
38107
38241
  }
38108
38242
  const here = fileFromImportMeta();
38109
38243
  if (!here) return null;
38110
- let cur = import_node_path23.default.dirname(here);
38244
+ let cur = import_node_path24.default.dirname(here);
38111
38245
  for (let i = 0; i < 8; i++) {
38112
- const pkg = import_node_path23.default.join(cur, "package.json");
38246
+ const pkg = import_node_path24.default.join(cur, "package.json");
38113
38247
  try {
38114
- if (import_node_fs22.default.existsSync(pkg)) {
38115
- const parsed = JSON.parse(import_node_fs22.default.readFileSync(pkg, "utf8"));
38248
+ if (import_node_fs23.default.existsSync(pkg)) {
38249
+ const parsed = JSON.parse(import_node_fs23.default.readFileSync(pkg, "utf8"));
38116
38250
  if (parsed.name === rnxPublicBrand.packageName) return cur;
38117
38251
  }
38118
38252
  } catch {
38119
38253
  }
38120
- const parent = import_node_path23.default.dirname(cur);
38254
+ const parent = import_node_path24.default.dirname(cur);
38121
38255
  if (parent === cur) break;
38122
38256
  cur = parent;
38123
38257
  }
@@ -38133,28 +38267,28 @@ function fileFromImportMeta() {
38133
38267
  }
38134
38268
  }
38135
38269
  async function withStartLock(projectId, provider, fn) {
38136
- const lockDir = import_node_path23.default.join(getUserDataDir(), "locks");
38137
- import_node_fs22.default.mkdirSync(lockDir, { recursive: true });
38270
+ const lockDir = import_node_path24.default.join(getUserDataDir(), "locks");
38271
+ import_node_fs23.default.mkdirSync(lockDir, { recursive: true });
38138
38272
  try {
38139
- import_node_fs22.default.chmodSync(lockDir, 448);
38273
+ import_node_fs23.default.chmodSync(lockDir, 448);
38140
38274
  } catch {
38141
38275
  }
38142
- const lockPath = import_node_path23.default.join(lockDir, `start-${projectId}-${provider}.lock`);
38276
+ const lockPath = import_node_path24.default.join(lockDir, `start-${projectId}-${provider}.lock`);
38143
38277
  const deadline = Date.now() + 4e3;
38144
38278
  let fd = null;
38145
38279
  while (fd === null) {
38146
38280
  try {
38147
- fd = import_node_fs22.default.openSync(
38281
+ fd = import_node_fs23.default.openSync(
38148
38282
  lockPath,
38149
- import_node_fs22.constants.O_WRONLY | import_node_fs22.constants.O_CREAT | import_node_fs22.constants.O_EXCL,
38283
+ import_node_fs23.constants.O_WRONLY | import_node_fs23.constants.O_CREAT | import_node_fs23.constants.O_EXCL,
38150
38284
  384
38151
38285
  );
38152
38286
  } catch (err) {
38153
38287
  if (err.code !== "EEXIST") throw err;
38154
38288
  try {
38155
- const stale = Number(import_node_fs22.default.readFileSync(lockPath, "utf8").trim());
38289
+ const stale = Number(import_node_fs23.default.readFileSync(lockPath, "utf8").trim());
38156
38290
  if (stale && !isProcessAlive(stale)) {
38157
- import_node_fs22.default.unlinkSync(lockPath);
38291
+ import_node_fs23.default.unlinkSync(lockPath);
38158
38292
  continue;
38159
38293
  }
38160
38294
  } catch {
@@ -38168,15 +38302,15 @@ async function withStartLock(projectId, provider, fn) {
38168
38302
  }
38169
38303
  }
38170
38304
  try {
38171
- import_node_fs22.default.writeFileSync(fd, String(process.pid));
38305
+ import_node_fs23.default.writeFileSync(fd, String(process.pid));
38172
38306
  return await fn();
38173
38307
  } finally {
38174
38308
  try {
38175
- import_node_fs22.default.closeSync(fd);
38309
+ import_node_fs23.default.closeSync(fd);
38176
38310
  } catch {
38177
38311
  }
38178
38312
  try {
38179
- import_node_fs22.default.unlinkSync(lockPath);
38313
+ import_node_fs23.default.unlinkSync(lockPath);
38180
38314
  } catch {
38181
38315
  }
38182
38316
  }
@@ -38190,25 +38324,25 @@ function isProcessAlive(pid) {
38190
38324
  }
38191
38325
  }
38192
38326
  function mkfifoSync(p) {
38193
- const parent = import_node_path23.default.dirname(p);
38194
- import_node_fs22.default.mkdirSync(parent, { recursive: true });
38327
+ const parent = import_node_path24.default.dirname(p);
38328
+ import_node_fs23.default.mkdirSync(parent, { recursive: true });
38195
38329
  try {
38196
- import_node_fs22.default.chmodSync(parent, 448);
38330
+ import_node_fs23.default.chmodSync(parent, 448);
38197
38331
  } catch {
38198
38332
  }
38199
- if (import_node_fs22.default.existsSync(p)) {
38333
+ if (import_node_fs23.default.existsSync(p)) {
38200
38334
  try {
38201
- const stat2 = import_node_fs22.default.statSync(p);
38335
+ const stat2 = import_node_fs23.default.statSync(p);
38202
38336
  if (stat2.isFIFO()) {
38203
38337
  try {
38204
- import_node_fs22.default.chmodSync(p, 384);
38338
+ import_node_fs23.default.chmodSync(p, 384);
38205
38339
  } catch {
38206
38340
  }
38207
38341
  return;
38208
38342
  }
38209
- import_node_fs22.default.unlinkSync(p);
38343
+ import_node_fs23.default.unlinkSync(p);
38210
38344
  } catch {
38211
- import_node_fs22.default.unlinkSync(p);
38345
+ import_node_fs23.default.unlinkSync(p);
38212
38346
  }
38213
38347
  }
38214
38348
  const result = (0, import_node_child_process11.spawnSync)("mkfifo", ["-m", "600", p]);
@@ -38248,10 +38382,10 @@ async function startSession(opts) {
38248
38382
  const transcript = transcriptPath(session.id);
38249
38383
  mkfifoSync(promptIn);
38250
38384
  mkfifoSync(eventsOut);
38251
- const transcriptDir = import_node_path23.default.dirname(transcript);
38252
- import_node_fs22.default.mkdirSync(transcriptDir, { recursive: true });
38385
+ const transcriptDir = import_node_path24.default.dirname(transcript);
38386
+ import_node_fs23.default.mkdirSync(transcriptDir, { recursive: true });
38253
38387
  try {
38254
- import_node_fs22.default.chmodSync(transcriptDir, 448);
38388
+ import_node_fs23.default.chmodSync(transcriptDir, 448);
38255
38389
  } catch {
38256
38390
  }
38257
38391
  const { executable, prefixArgs } = resolveSootsimInvocation();
@@ -38302,7 +38436,7 @@ async function startSession(opts) {
38302
38436
  }
38303
38437
  }
38304
38438
  try {
38305
- import_node_fs22.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
38439
+ import_node_fs23.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
38306
38440
  } catch {
38307
38441
  }
38308
38442
  updateSessionStatus(session.id, { status: "ended" });
@@ -38330,18 +38464,18 @@ async function sendPrompt(sessionId, prompt) {
38330
38464
  );
38331
38465
  }
38332
38466
  const fifo = promptFifoPath(sessionId);
38333
- if (!import_node_fs22.default.existsSync(fifo)) {
38467
+ if (!import_node_fs23.default.existsSync(fifo)) {
38334
38468
  throw new AgentSessionError("NO_FIFO", `prompt FIFO missing: ${fifo}`);
38335
38469
  }
38336
- const fd = import_node_fs22.default.openSync(fifo, import_node_fs22.constants.O_WRONLY);
38470
+ const fd = import_node_fs23.default.openSync(fifo, import_node_fs23.constants.O_WRONLY);
38337
38471
  try {
38338
38472
  const wireText = encodeAgentPromptEnvelope(prompt);
38339
38473
  if (!wireText) {
38340
38474
  throw new AgentSessionError("EMPTY_PROMPT", "prompt text is empty");
38341
38475
  }
38342
- import_node_fs22.default.writeSync(fd, wireText + "\n");
38476
+ import_node_fs23.default.writeSync(fd, wireText + "\n");
38343
38477
  } finally {
38344
- import_node_fs22.default.closeSync(fd);
38478
+ import_node_fs23.default.closeSync(fd);
38345
38479
  }
38346
38480
  updateSessionStatus(sessionId, {
38347
38481
  lastPrompt: prompt.displayText ?? prompt.text,
@@ -38363,7 +38497,7 @@ async function endSession(sessionId) {
38363
38497
  const base = getUserDataDir();
38364
38498
  if (dir.startsWith(base)) {
38365
38499
  try {
38366
- import_node_fs22.default.rmSync(dir, { recursive: true, force: true });
38500
+ import_node_fs23.default.rmSync(dir, { recursive: true, force: true });
38367
38501
  } catch {
38368
38502
  }
38369
38503
  }
@@ -38371,11 +38505,11 @@ async function endSession(sessionId) {
38371
38505
  }
38372
38506
  function subscribeEvents(sessionId, onEvent) {
38373
38507
  const fifo = eventsFifoPath(sessionId);
38374
- if (!import_node_fs22.default.existsSync(fifo)) {
38508
+ if (!import_node_fs23.default.existsSync(fifo)) {
38375
38509
  throw new AgentSessionError("NO_FIFO", `events FIFO missing: ${fifo}`);
38376
38510
  }
38377
- const fd = import_node_fs22.default.openSync(fifo, import_node_fs22.constants.O_RDWR);
38378
- const stream = import_node_fs22.default.createReadStream("", { fd, autoClose: true });
38511
+ const fd = import_node_fs23.default.openSync(fifo, import_node_fs23.constants.O_RDWR);
38512
+ const stream = import_node_fs23.default.createReadStream("", { fd, autoClose: true });
38379
38513
  const rl = import_node_readline.default.createInterface({ input: stream, crlfDelay: Infinity });
38380
38514
  rl.on("line", (line) => {
38381
38515
  const event = parseAgentEventLine(line);
@@ -38386,7 +38520,7 @@ function subscribeEvents(sessionId, onEvent) {
38386
38520
  if (closed) return;
38387
38521
  closed = true;
38388
38522
  try {
38389
- import_node_fs22.default.writeSync(fd, "\n");
38523
+ import_node_fs23.default.writeSync(fd, "\n");
38390
38524
  } catch {
38391
38525
  }
38392
38526
  try {
@@ -38400,7 +38534,7 @@ function subscribeEvents(sessionId, onEvent) {
38400
38534
  };
38401
38535
  }
38402
38536
  async function waitForFirstEvent(fifo, predicate, timeoutMs) {
38403
- const fd = import_node_fs22.default.openSync(fifo, import_node_fs22.constants.O_RDWR | import_node_fs22.constants.O_NONBLOCK);
38537
+ const fd = import_node_fs23.default.openSync(fifo, import_node_fs23.constants.O_RDWR | import_node_fs23.constants.O_NONBLOCK);
38404
38538
  const buf = Buffer.alloc(8192);
38405
38539
  let leftover = "";
38406
38540
  const deadline = Date.now() + timeoutMs;
@@ -38408,7 +38542,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
38408
38542
  while (Date.now() < deadline) {
38409
38543
  let n = 0;
38410
38544
  try {
38411
- n = import_node_fs22.default.readSync(fd, buf, 0, buf.length, null);
38545
+ n = import_node_fs23.default.readSync(fd, buf, 0, buf.length, null);
38412
38546
  } catch (err) {
38413
38547
  if (err.code !== "EAGAIN") throw err;
38414
38548
  n = 0;
@@ -38428,17 +38562,17 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
38428
38562
  }
38429
38563
  return null;
38430
38564
  } finally {
38431
- import_node_fs22.default.closeSync(fd);
38565
+ import_node_fs23.default.closeSync(fd);
38432
38566
  }
38433
38567
  }
38434
- var import_node_child_process11, import_node_crypto11, import_node_fs22, import_node_path23, import_node_readline, AgentSessionError;
38568
+ var import_node_child_process11, import_node_crypto11, import_node_fs23, import_node_path24, import_node_readline, AgentSessionError;
38435
38569
  var init_agent_sessions = __esm({
38436
38570
  "src/agent-sessions.ts"() {
38437
38571
  "use strict";
38438
38572
  import_node_child_process11 = require("node:child_process");
38439
38573
  import_node_crypto11 = require("node:crypto");
38440
- import_node_fs22 = __toESM(require("node:fs"), 1);
38441
- import_node_path23 = __toESM(require("node:path"), 1);
38574
+ import_node_fs23 = __toESM(require("node:fs"), 1);
38575
+ import_node_path24 = __toESM(require("node:path"), 1);
38442
38576
  import_node_readline = __toESM(require("node:readline"), 1);
38443
38577
  init_self_invocation();
38444
38578
  init_standalone();
@@ -38469,13 +38603,13 @@ function mapFrameworkToProjectFramework(fw) {
38469
38603
  if (fw === "one" || fw === "vxrn") return "one";
38470
38604
  return "unknown";
38471
38605
  }
38472
- var import_node_crypto12, import_node_fs23, import_node_path24, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
38606
+ var import_node_crypto12, import_node_fs24, import_node_path25, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
38473
38607
  var init_agent_host = __esm({
38474
38608
  "src/host/agent-host.ts"() {
38475
38609
  "use strict";
38476
38610
  import_node_crypto12 = require("node:crypto");
38477
- import_node_fs23 = __toESM(require("node:fs"), 1);
38478
- import_node_path24 = __toESM(require("node:path"), 1);
38611
+ import_node_fs24 = __toESM(require("node:fs"), 1);
38612
+ import_node_path25 = __toESM(require("node:path"), 1);
38479
38613
  init_dev_server_scanner();
38480
38614
  init_agent_sessions();
38481
38615
  init_attached_projects();
@@ -38721,7 +38855,7 @@ var init_agent_host = __esm({
38721
38855
  );
38722
38856
  const project = upsertProject({
38723
38857
  cwd: match.cwd,
38724
- name: match.projectName ?? import_node_path24.default.basename(match.cwd),
38858
+ name: match.projectName ?? import_node_path25.default.basename(match.cwd),
38725
38859
  preferredProvider: input.provider ?? existing?.preferredProvider,
38726
38860
  sourceRoots: existing?.sourceRoots ?? [match.cwd],
38727
38861
  knownBundleUrls,
@@ -38732,18 +38866,18 @@ var init_agent_host = __esm({
38732
38866
  }
38733
38867
  getTranscript(sessionId) {
38734
38868
  const p = transcriptPath(sessionId);
38735
- if (!import_node_fs23.default.existsSync(p)) {
38869
+ if (!import_node_fs24.default.existsSync(p)) {
38736
38870
  return { error: "transcript not found", code: "NO_TRANSCRIPT" };
38737
38871
  }
38738
- return import_node_fs23.default.readFileSync(p, "utf8");
38872
+ return import_node_fs24.default.readFileSync(p, "utf8");
38739
38873
  }
38740
38874
  getPaths() {
38741
38875
  const dir = getUserDataDir();
38742
38876
  return {
38743
38877
  userDataDir: dir,
38744
- storeFile: import_node_path24.default.join(dir, "attached-projects.json"),
38745
- sessionsDir: import_node_path24.default.join(dir, "sessions"),
38746
- transcriptsDir: import_node_path24.default.join(dir, "transcripts")
38878
+ storeFile: import_node_path25.default.join(dir, "attached-projects.json"),
38879
+ sessionsDir: import_node_path25.default.join(dir, "sessions"),
38880
+ transcriptsDir: import_node_path25.default.join(dir, "transcripts")
38747
38881
  };
38748
38882
  }
38749
38883
  // --- subscription management ---
@@ -39770,23 +39904,23 @@ function looksBinary(filePath, size) {
39770
39904
  if (size === 0) return false;
39771
39905
  let fd;
39772
39906
  try {
39773
- fd = import_node_fs24.default.openSync(filePath, "r");
39907
+ fd = import_node_fs25.default.openSync(filePath, "r");
39774
39908
  const buffer = Buffer.alloc(Math.min(BINARY_SNIFF_BYTES, size));
39775
- const read = import_node_fs24.default.readSync(fd, buffer, 0, buffer.length, 0);
39909
+ const read = import_node_fs25.default.readSync(fd, buffer, 0, buffer.length, 0);
39776
39910
  return buffer.subarray(0, read).includes(0);
39777
39911
  } catch {
39778
39912
  return false;
39779
39913
  } finally {
39780
- if (fd !== void 0) import_node_fs24.default.closeSync(fd);
39914
+ if (fd !== void 0) import_node_fs25.default.closeSync(fd);
39781
39915
  }
39782
39916
  }
39783
- var import_node_child_process12, import_node_fs24, import_node_path25, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, LIST_FILES_ATTEMPTS, LIST_FILES_RETRY_MS, CheckoutFilePlane;
39917
+ var import_node_child_process12, import_node_fs25, import_node_path26, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, LIST_FILES_ATTEMPTS, LIST_FILES_RETRY_MS, CheckoutFilePlane;
39784
39918
  var init_checkout_plane = __esm({
39785
39919
  "cli/commands/box/checkout-plane.ts"() {
39786
39920
  "use strict";
39787
39921
  import_node_child_process12 = require("node:child_process");
39788
- import_node_fs24 = __toESM(require("node:fs"), 1);
39789
- import_node_path25 = __toESM(require("node:path"), 1);
39922
+ import_node_fs25 = __toESM(require("node:fs"), 1);
39923
+ import_node_path26 = __toESM(require("node:path"), 1);
39790
39924
  CheckoutRequiresGitError = class extends Error {
39791
39925
  };
39792
39926
  BINARY_SNIFF_BYTES = 8192;
@@ -39803,7 +39937,7 @@ var init_checkout_plane = __esm({
39803
39937
  listTimeoutMs;
39804
39938
  trackedOnly;
39805
39939
  constructor(root, options = {}) {
39806
- this.root = import_node_path25.default.resolve(root);
39940
+ this.root = import_node_path26.default.resolve(root);
39807
39941
  this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
39808
39942
  this.trackedOnly = options.trackedOnly ?? false;
39809
39943
  }
@@ -39865,13 +39999,13 @@ var init_checkout_plane = __esm({
39865
39999
  if (!relative3) continue;
39866
40000
  let stat2;
39867
40001
  try {
39868
- stat2 = import_node_fs24.default.statSync(import_node_path25.default.join(this.root, relative3));
40002
+ stat2 = import_node_fs25.default.statSync(import_node_path26.default.join(this.root, relative3));
39869
40003
  } catch {
39870
40004
  continue;
39871
40005
  }
39872
40006
  if (!stat2.isFile()) continue;
39873
40007
  const seen = this.sniffed.get(relative3);
39874
- const binary2 = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path25.default.join(this.root, relative3), stat2.size);
40008
+ const binary2 = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path26.default.join(this.root, relative3), stat2.size);
39875
40009
  nextSniffed.set(relative3, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary: binary2 });
39876
40010
  next.set(relative3, {
39877
40011
  size: stat2.size,
@@ -39885,22 +40019,22 @@ var init_checkout_plane = __esm({
39885
40019
  this.sniffed = nextSniffed;
39886
40020
  }
39887
40021
  absolute(planePath) {
39888
- const resolved = import_node_path25.default.resolve(this.root, planePath);
39889
- if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path25.default.sep}`)) {
40022
+ const resolved = import_node_path26.default.resolve(this.root, planePath);
40023
+ if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path26.default.sep}`)) {
39890
40024
  throw new Error(`path escapes the project: ${planePath}`);
39891
40025
  }
39892
40026
  return resolved;
39893
40027
  }
39894
40028
  async read(planePath) {
39895
- return import_node_fs24.default.promises.readFile(this.absolute(planePath), "utf8");
40029
+ return import_node_fs25.default.promises.readFile(this.absolute(planePath), "utf8");
39896
40030
  }
39897
40031
  async readBytes(planePath) {
39898
- return import_node_fs24.default.promises.readFile(this.absolute(planePath));
40032
+ return import_node_fs25.default.promises.readFile(this.absolute(planePath));
39899
40033
  }
39900
40034
  async write(planePath, content) {
39901
40035
  const absolute = this.absolute(planePath);
39902
- await import_node_fs24.default.promises.mkdir(import_node_path25.default.dirname(absolute), { recursive: true });
39903
- await import_node_fs24.default.promises.writeFile(absolute, content);
40036
+ await import_node_fs25.default.promises.mkdir(import_node_path26.default.dirname(absolute), { recursive: true });
40037
+ await import_node_fs25.default.promises.writeFile(absolute, content);
39904
40038
  this.entries.set(planePath, {
39905
40039
  size: content.byteLength,
39906
40040
  readOnly: false,
@@ -39909,7 +40043,7 @@ var init_checkout_plane = __esm({
39909
40043
  });
39910
40044
  }
39911
40045
  async delete(planePath) {
39912
- await import_node_fs24.default.promises.rm(this.absolute(planePath), { force: true });
40046
+ await import_node_fs25.default.promises.rm(this.absolute(planePath), { force: true });
39913
40047
  this.entries.delete(planePath);
39914
40048
  }
39915
40049
  };
@@ -39917,12 +40051,12 @@ var init_checkout_plane = __esm({
39917
40051
  });
39918
40052
 
39919
40053
  // src/host/plane-host.ts
39920
- var import_node_fs25, import_node_path26, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
40054
+ var import_node_fs26, import_node_path27, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
39921
40055
  var init_plane_host = __esm({
39922
40056
  "src/host/plane-host.ts"() {
39923
40057
  "use strict";
39924
- import_node_fs25 = __toESM(require("node:fs"), 1);
39925
- import_node_path26 = __toESM(require("node:path"), 1);
40058
+ import_node_fs26 = __toESM(require("node:fs"), 1);
40059
+ import_node_path27 = __toESM(require("node:path"), 1);
39926
40060
  init_plane();
39927
40061
  init_checkout_plane();
39928
40062
  WS_OPEN2 = 1;
@@ -40045,14 +40179,14 @@ var init_plane_host = __esm({
40045
40179
  // root and an opened one cannot disagree about the same directory.
40046
40180
  realRoot(root) {
40047
40181
  if (!root) throw new Error("root is required");
40048
- const resolved = import_node_path26.default.resolve(root);
40182
+ const resolved = import_node_path27.default.resolve(root);
40049
40183
  let real;
40050
40184
  try {
40051
- real = import_node_fs25.default.realpathSync(resolved);
40185
+ real = import_node_fs26.default.realpathSync(resolved);
40052
40186
  } catch {
40053
40187
  throw new Error(`no such directory: ${resolved}`);
40054
40188
  }
40055
- if (!import_node_fs25.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
40189
+ if (!import_node_fs26.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
40056
40190
  return real;
40057
40191
  }
40058
40192
  respond(ws, id, result) {
@@ -40408,16 +40542,16 @@ function sendJavaScript(req, res, source) {
40408
40542
  res.end(req.method === "HEAD" ? void 0 : source);
40409
40543
  }
40410
40544
  function resolveReplacementModuleFile(fromFile, specifier) {
40411
- const base = import_node_path27.default.resolve(import_node_path27.default.dirname(fromFile), specifier);
40545
+ const base = import_node_path28.default.resolve(import_node_path28.default.dirname(fromFile), specifier);
40412
40546
  const candidates = [
40413
40547
  ...REPLACEMENT_MODULE_EXTENSIONS.some(
40414
- (ext) => ext === import_node_path27.default.extname(base).toLowerCase()
40548
+ (ext) => ext === import_node_path28.default.extname(base).toLowerCase()
40415
40549
  ) ? [base] : [],
40416
40550
  ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
40417
- ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path27.default.join(base, `index${ext}`))
40551
+ ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path28.default.join(base, `index${ext}`))
40418
40552
  ];
40419
40553
  const found = candidates.find(
40420
- (candidate) => (0, import_node_fs26.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
40554
+ (candidate) => (0, import_node_fs27.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
40421
40555
  );
40422
40556
  if (!found) {
40423
40557
  throw new Error(
@@ -40472,13 +40606,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
40472
40606
  res.end("missing path param");
40473
40607
  return true;
40474
40608
  }
40475
- const extension = import_node_path27.default.extname(targetPath).toLowerCase();
40609
+ const extension = import_node_path28.default.extname(targetPath).toLowerCase();
40476
40610
  if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
40477
40611
  res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
40478
40612
  res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
40479
40613
  return true;
40480
40614
  }
40481
- if (!import_node_path27.default.isAbsolute(targetPath)) {
40615
+ if (!import_node_path28.default.isAbsolute(targetPath)) {
40482
40616
  res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
40483
40617
  res.end("replacement file path must be absolute");
40484
40618
  return true;
@@ -40486,10 +40620,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
40486
40620
  const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
40487
40621
  let resolvedProjectRoot;
40488
40622
  if (options.projectRoot) {
40489
- const lexicalProjectRoot = import_node_path27.default.resolve(options.projectRoot);
40623
+ const lexicalProjectRoot = import_node_path28.default.resolve(options.projectRoot);
40490
40624
  resolvedProjectRoot = await import_promises5.default.realpath(options.projectRoot);
40491
- const lexicalTarget = import_node_path27.default.relative(lexicalProjectRoot, targetPath);
40492
- if (lexicalTarget.startsWith("..") || import_node_path27.default.isAbsolute(lexicalTarget)) {
40625
+ const lexicalTarget = import_node_path28.default.relative(lexicalProjectRoot, targetPath);
40626
+ if (lexicalTarget.startsWith("..") || import_node_path28.default.isAbsolute(lexicalTarget)) {
40493
40627
  res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
40494
40628
  res.end("replacement file must be inside the project root");
40495
40629
  return true;
@@ -40505,8 +40639,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
40505
40639
  return true;
40506
40640
  }
40507
40641
  if (resolvedProjectRoot) {
40508
- const relativeTarget = import_node_path27.default.relative(resolvedProjectRoot, resolvedTargetPath);
40509
- if (relativeTarget.startsWith("..") || import_node_path27.default.isAbsolute(relativeTarget)) {
40642
+ const relativeTarget = import_node_path28.default.relative(resolvedProjectRoot, resolvedTargetPath);
40643
+ if (relativeTarget.startsWith("..") || import_node_path28.default.isAbsolute(relativeTarget)) {
40510
40644
  res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
40511
40645
  res.end("replacement file must be inside the project root");
40512
40646
  return true;
@@ -40541,13 +40675,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
40541
40675
  }
40542
40676
  return true;
40543
40677
  }
40544
- var import_node_fs26, import_promises5, import_node_path27, REPLACEMENT_MODULE_ROUTE;
40678
+ var import_node_fs27, import_promises5, import_node_path28, REPLACEMENT_MODULE_ROUTE;
40545
40679
  var init_replacement_module_handler = __esm({
40546
40680
  "src/host/replacement-module-handler.ts"() {
40547
40681
  "use strict";
40548
- import_node_fs26 = require("node:fs");
40682
+ import_node_fs27 = require("node:fs");
40549
40683
  import_promises5 = __toESM(require("node:fs/promises"), 1);
40550
- import_node_path27 = __toESM(require("node:path"), 1);
40684
+ import_node_path28 = __toESM(require("node:path"), 1);
40551
40685
  init_replacementModule();
40552
40686
  init_backend_origin();
40553
40687
  REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
@@ -42531,8 +42665,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
42531
42665
  }
42532
42666
  const out = [];
42533
42667
  for (const dir of dirs) {
42534
- const path37 = `${dir}/${filename}`;
42535
- if (!out.includes(path37)) out.push(path37);
42668
+ const path38 = `${dir}/${filename}`;
42669
+ if (!out.includes(path38)) out.push(path38);
42536
42670
  }
42537
42671
  if (!out.includes(filename)) out.push(filename);
42538
42672
  return out;
@@ -43486,13 +43620,13 @@ function readFactoryStringLiterals(factory) {
43486
43620
  return literals;
43487
43621
  }
43488
43622
  function normalizeFingerprintLiteral(literal) {
43489
- const path37 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
43623
+ const path38 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
43490
43624
  const nodeModulesMarker = "/node_modules/";
43491
- const nodeModulesIndex = path37.lastIndexOf(nodeModulesMarker);
43625
+ const nodeModulesIndex = path38.lastIndexOf(nodeModulesMarker);
43492
43626
  if (nodeModulesIndex >= 0) {
43493
- return `node_modules/${path37.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
43627
+ return `node_modules/${path38.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
43494
43628
  }
43495
- if ((path37.startsWith("/") || /^[A-Za-z]:\//.test(path37) || path37.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path37)) {
43629
+ if ((path38.startsWith("/") || /^[A-Za-z]:\//.test(path38) || path38.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path38)) {
43496
43630
  return null;
43497
43631
  }
43498
43632
  return literal;
@@ -43730,10 +43864,10 @@ function templateAssignment(template, embeddings) {
43730
43864
  if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
43731
43865
  nodesByModuleId.set(moduleId, nodeIndex);
43732
43866
  const node = template.nodes[nodeIndex];
43733
- const path37 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
43867
+ const path38 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
43734
43868
  const existingPath = pathsByModuleId.get(moduleId);
43735
- if (existingPath !== void 0 && existingPath !== path37) return null;
43736
- pathsByModuleId.set(moduleId, path37);
43869
+ if (existingPath !== void 0 && existingPath !== path38) return null;
43870
+ pathsByModuleId.set(moduleId, path38);
43737
43871
  }
43738
43872
  }
43739
43873
  return {
@@ -43895,14 +44029,14 @@ async function inferMetroModuleIdentity(args) {
43895
44029
  const packageClaims = claimsByPackage.values().next().value;
43896
44030
  if (!packageClaims) continue;
43897
44031
  const exactClaims = packageClaims.filter((assignment2) => {
43898
- const path37 = assignment2.pathsByModuleId.get(moduleId);
43899
- return path37 !== void 0 && !path37.includes("/__rnx_inferred__/");
44032
+ const path38 = assignment2.pathsByModuleId.get(moduleId);
44033
+ return path38 !== void 0 && !path38.includes("/__rnx_inferred__/");
43900
44034
  });
43901
44035
  const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
43902
44036
  const routes = new Set(
43903
44037
  preferredClaims.flatMap((assignment2) => {
43904
- const path37 = assignment2.pathsByModuleId.get(moduleId);
43905
- return path37 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path37)] : [];
44038
+ const path38 = assignment2.pathsByModuleId.get(moduleId);
44039
+ return path38 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path38)] : [];
43906
44040
  })
43907
44041
  );
43908
44042
  if (routes.size !== 1) continue;
@@ -44197,8 +44331,8 @@ function detectFramework2(deps) {
44197
44331
  return "unknown";
44198
44332
  }
44199
44333
  function detectProject(dir) {
44200
- const pkgPath = (0, import_node_path28.join)(dir, "package.json");
44201
- if (!(0, import_node_fs27.existsSync)(pkgPath)) return null;
44334
+ const pkgPath = (0, import_node_path29.join)(dir, "package.json");
44335
+ if (!(0, import_node_fs28.existsSync)(pkgPath)) return null;
44202
44336
  const pkg = readProjectManifest(dir);
44203
44337
  if (!pkg) return null;
44204
44338
  const deps = { ...pkg.dependencies, ...pkg.devDependencies };
@@ -44210,25 +44344,25 @@ function detectProject(dir) {
44210
44344
  if (framework === "unknown") return null;
44211
44345
  return {
44212
44346
  dir,
44213
- name: pkg.name || (0, import_node_path28.basename)(dir),
44347
+ name: pkg.name || (0, import_node_path29.basename)(dir),
44214
44348
  framework,
44215
44349
  // a config file is a config file whatever module system it declares. real
44216
44350
  // apps write .cjs as often as .js, and missing one reads as "this project
44217
44351
  // has no bundler config" and sends the user to create a second one.
44218
44352
  hasViteConfig: CONFIG_EXTENSIONS.some(
44219
- (ext) => (0, import_node_fs27.existsSync)((0, import_node_path28.join)(dir, `vite.config.${ext}`))
44353
+ (ext) => (0, import_node_fs28.existsSync)((0, import_node_path29.join)(dir, `vite.config.${ext}`))
44220
44354
  ),
44221
44355
  hasMetroConfig: CONFIG_EXTENSIONS.some(
44222
- (ext) => (0, import_node_fs27.existsSync)((0, import_node_path28.join)(dir, `metro.config.${ext}`))
44356
+ (ext) => (0, import_node_fs28.existsSync)((0, import_node_path29.join)(dir, `metro.config.${ext}`))
44223
44357
  ),
44224
44358
  devCommand: typeof devCommand === "string" ? devCommand : null
44225
44359
  };
44226
44360
  }
44227
- function readProjectMetadata(path37) {
44361
+ function readProjectMetadata(path38) {
44228
44362
  try {
44229
- const info = (0, import_node_fs27.lstatSync)(path37);
44363
+ const info = (0, import_node_fs28.lstatSync)(path38);
44230
44364
  if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
44231
- return (0, import_node_fs27.readFileSync)(path37, "utf8");
44365
+ return (0, import_node_fs28.readFileSync)(path38, "utf8");
44232
44366
  } catch {
44233
44367
  return null;
44234
44368
  }
@@ -44237,8 +44371,8 @@ function metadataValue(value, key2) {
44237
44371
  if (!value || typeof value !== "object") return void 0;
44238
44372
  return Object.getOwnPropertyDescriptor(value, key2)?.value;
44239
44373
  }
44240
- function readProjectJson(path37) {
44241
- const text3 = readProjectMetadata(path37);
44374
+ function readProjectJson(path38) {
44375
+ const text3 = readProjectMetadata(path38);
44242
44376
  if (text3 === null) return null;
44243
44377
  try {
44244
44378
  const value = JSON.parse(text3);
@@ -44248,7 +44382,7 @@ function readProjectJson(path37) {
44248
44382
  }
44249
44383
  }
44250
44384
  function readProjectManifest(dir) {
44251
- const parsed = readProjectJson((0, import_node_path28.join)(dir, "package.json"));
44385
+ const parsed = readProjectJson((0, import_node_path29.join)(dir, "package.json"));
44252
44386
  if (!parsed || typeof parsed !== "object") return null;
44253
44387
  const record2 = (value) => {
44254
44388
  if (!value || typeof value !== "object") return {};
@@ -44265,12 +44399,12 @@ function readProjectManifest(dir) {
44265
44399
  devDependencies: record2(metadataValue(parsed, "devDependencies"))
44266
44400
  };
44267
44401
  }
44268
- var import_node_fs27, import_node_path28, import_json52, CONFIG_EXTENSIONS;
44402
+ var import_node_fs28, import_node_path29, import_json52, CONFIG_EXTENSIONS;
44269
44403
  var init_detect = __esm({
44270
44404
  "cli/commands/detect.ts"() {
44271
44405
  "use strict";
44272
- import_node_fs27 = require("node:fs");
44273
- import_node_path28 = require("node:path");
44406
+ import_node_fs28 = require("node:fs");
44407
+ import_node_path29 = require("node:path");
44274
44408
  import_json52 = __toESM(require_lib(), 1);
44275
44409
  init_browser();
44276
44410
  CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
@@ -44307,21 +44441,21 @@ function resolveCloudOrigin(value) {
44307
44441
  return normalizeCloudOrigin(source);
44308
44442
  }
44309
44443
  function readImmutableBundleSource(bundlePath) {
44310
- const filepath = (0, import_node_path29.resolve)(bundlePath);
44311
- if ((0, import_node_path29.extname)(filepath) !== ".js") {
44444
+ const filepath = (0, import_node_path30.resolve)(bundlePath);
44445
+ if ((0, import_node_path30.extname)(filepath) !== ".js") {
44312
44446
  throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
44313
44447
  }
44314
- const descriptor = (0, import_node_fs28.openSync)(filepath, "r");
44448
+ const descriptor = (0, import_node_fs29.openSync)(filepath, "r");
44315
44449
  try {
44316
- const before = (0, import_node_fs28.fstatSync)(descriptor, { bigint: true });
44450
+ const before = (0, import_node_fs29.fstatSync)(descriptor, { bigint: true });
44317
44451
  if (!before.isFile()) {
44318
44452
  throw new Error(`${REMOTE_COMMAND} bundle must be a regular local file`);
44319
44453
  }
44320
44454
  if (before.size <= 0n) {
44321
44455
  throw new Error(`${REMOTE_COMMAND} bundle is empty`);
44322
44456
  }
44323
- const bytes = (0, import_node_fs28.readFileSync)(descriptor);
44324
- const after = (0, import_node_fs28.fstatSync)(descriptor, { bigint: true });
44457
+ const bytes = (0, import_node_fs29.readFileSync)(descriptor);
44458
+ const after = (0, import_node_fs29.fstatSync)(descriptor, { bigint: true });
44325
44459
  if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
44326
44460
  throw new Error(`${REMOTE_COMMAND} bundle changed while it was being read`);
44327
44461
  }
@@ -44336,7 +44470,7 @@ function readImmutableBundleSource(bundlePath) {
44336
44470
  }
44337
44471
  return source;
44338
44472
  } finally {
44339
- (0, import_node_fs28.closeSync)(descriptor);
44473
+ (0, import_node_fs29.closeSync)(descriptor);
44340
44474
  }
44341
44475
  }
44342
44476
  async function fetchBundleSource(bundleUrl) {
@@ -44383,15 +44517,15 @@ async function loadBundleSource(bundleInput) {
44383
44517
  return readImmutableBundleSource(bundleInput);
44384
44518
  }
44385
44519
  function listMetroAssetDest(assetsPath) {
44386
- const directory = (0, import_node_path29.resolve)(assetsPath);
44387
- if (!(0, import_node_fs28.existsSync)(directory)) return { directory, files: [], truncated: false };
44388
- const skipNested = (0, import_node_fs28.existsSync)((0, import_node_path29.join)(directory, "package.json"));
44520
+ const directory = (0, import_node_path30.resolve)(assetsPath);
44521
+ if (!(0, import_node_fs29.existsSync)(directory)) return { directory, files: [], truncated: false };
44522
+ const skipNested = (0, import_node_fs29.existsSync)((0, import_node_path30.join)(directory, "package.json"));
44389
44523
  const files2 = [];
44390
44524
  let truncated = false;
44391
44525
  const walk2 = (dir, prefix) => {
44392
44526
  let entries;
44393
44527
  try {
44394
- entries = (0, import_node_fs28.readdirSync)(dir, { withFileTypes: true });
44528
+ entries = (0, import_node_fs29.readdirSync)(dir, { withFileTypes: true });
44395
44529
  } catch {
44396
44530
  return;
44397
44531
  }
@@ -44403,7 +44537,7 @@ function listMetroAssetDest(assetsPath) {
44403
44537
  if (entry.isDirectory()) {
44404
44538
  if (entry.name === ".git") continue;
44405
44539
  if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
44406
- walk2((0, import_node_path29.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
44540
+ walk2((0, import_node_path30.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
44407
44541
  } else if (entry.isFile()) {
44408
44542
  files2.push(prefix ? `${prefix}/${entry.name}` : entry.name);
44409
44543
  }
@@ -44438,7 +44572,7 @@ function distinctByContent(directory, options) {
44438
44572
  for (const relative3 of options) {
44439
44573
  let bytes;
44440
44574
  try {
44441
- bytes = (0, import_node_fs28.readFileSync)((0, import_node_path29.join)(directory, relative3));
44575
+ bytes = (0, import_node_fs29.readFileSync)((0, import_node_path30.join)(directory, relative3));
44442
44576
  } catch {
44443
44577
  continue;
44444
44578
  }
@@ -44470,7 +44604,7 @@ function placeMetroDescriptor(listing, descriptor) {
44470
44604
  let bytes;
44471
44605
  try {
44472
44606
  bytes = combination.map(
44473
- (relative3) => (0, import_node_fs28.readFileSync)((0, import_node_path29.join)(listing.directory, relative3))
44607
+ (relative3) => (0, import_node_fs29.readFileSync)((0, import_node_path30.join)(listing.directory, relative3))
44474
44608
  );
44475
44609
  } catch {
44476
44610
  continue;
@@ -44498,10 +44632,10 @@ function unverifiedContentKey(dest, fileDigests) {
44498
44632
  return JSON.stringify(
44499
44633
  dest.placements.map(
44500
44634
  (placement) => placement.verified ? null : [...placement.files].map(([scale, relative3]) => {
44501
- const file = (0, import_node_path29.join)(dest.directory, relative3);
44635
+ const file = (0, import_node_path30.join)(dest.directory, relative3);
44502
44636
  let digest = fileDigests.get(file);
44503
44637
  if (digest === void 0) {
44504
- digest = (0, import_node_crypto14.createHash)("sha256").update((0, import_node_fs28.readFileSync)(file)).digest("hex");
44638
+ digest = (0, import_node_crypto14.createHash)("sha256").update((0, import_node_fs29.readFileSync)(file)).digest("hex");
44505
44639
  fileDigests.set(file, digest);
44506
44640
  }
44507
44641
  return [scale, digest];
@@ -44510,22 +44644,22 @@ function unverifiedContentKey(dest, fileDigests) {
44510
44644
  );
44511
44645
  }
44512
44646
  function searchMetroAssetDest(bundlePath, descriptors) {
44513
- const bundleDirectory = (0, import_node_path29.dirname)((0, import_node_path29.resolve)(bundlePath));
44647
+ const bundleDirectory = (0, import_node_path30.dirname)((0, import_node_path30.resolve)(bundlePath));
44514
44648
  const candidates = [
44515
- (0, import_node_path29.join)(bundleDirectory, "assets"),
44649
+ (0, import_node_path30.join)(bundleDirectory, "assets"),
44516
44650
  bundleDirectory,
44517
- (0, import_node_path29.resolve)(bundleDirectory, "..", "assets")
44651
+ (0, import_node_path30.resolve)(bundleDirectory, "..", "assets")
44518
44652
  ];
44519
44653
  const cwd = process.cwd();
44520
44654
  let projectDirectory = null;
44521
44655
  for (const start of [bundleDirectory, cwd]) {
44522
- let directory = (0, import_node_path29.resolve)(start);
44656
+ let directory = (0, import_node_path30.resolve)(start);
44523
44657
  while (true) {
44524
44658
  if (detectProject(directory)?.hasMetroConfig) {
44525
44659
  projectDirectory = directory;
44526
44660
  break;
44527
44661
  }
44528
- const parent = (0, import_node_path29.dirname)(directory);
44662
+ const parent = (0, import_node_path30.dirname)(directory);
44529
44663
  if (parent === directory) break;
44530
44664
  directory = parent;
44531
44665
  }
@@ -44533,11 +44667,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
44533
44667
  }
44534
44668
  if (projectDirectory) {
44535
44669
  candidates.push(
44536
- (0, import_node_path29.join)(projectDirectory, "assets"),
44537
- (0, import_node_path29.join)(projectDirectory, "dist"),
44538
- (0, import_node_path29.join)(projectDirectory, "dist", "assets"),
44539
- (0, import_node_path29.join)(projectDirectory, "build"),
44540
- (0, import_node_path29.join)(projectDirectory, "build", "assets")
44670
+ (0, import_node_path30.join)(projectDirectory, "assets"),
44671
+ (0, import_node_path30.join)(projectDirectory, "dist"),
44672
+ (0, import_node_path30.join)(projectDirectory, "dist", "assets"),
44673
+ (0, import_node_path30.join)(projectDirectory, "build"),
44674
+ (0, import_node_path30.join)(projectDirectory, "build", "assets")
44541
44675
  );
44542
44676
  }
44543
44677
  const searched = [];
@@ -44545,7 +44679,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
44545
44679
  const stale = [];
44546
44680
  let truncated = false;
44547
44681
  for (const candidate of candidates) {
44548
- const directory = (0, import_node_path29.resolve)(candidate);
44682
+ const directory = (0, import_node_path30.resolve)(candidate);
44549
44683
  if (searched.includes(directory)) continue;
44550
44684
  searched.push(directory);
44551
44685
  const listing = listMetroAssetDest(directory);
@@ -44654,7 +44788,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
44654
44788
  );
44655
44789
  }
44656
44790
  const relative3 = placement?.files.get(variant.scale);
44657
- if (relative3 && dest) return (0, import_node_fs28.readFileSync)((0, import_node_path29.join)(dest.directory, relative3));
44791
+ if (relative3 && dest) return (0, import_node_fs29.readFileSync)((0, import_node_path30.join)(dest.directory, relative3));
44658
44792
  if (placement && placement.files.size > 0) return null;
44659
44793
  if (placement && placement.ambiguous.length > 0 && dest) {
44660
44794
  throw new Error(
@@ -44683,7 +44817,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
44683
44817
  );
44684
44818
  const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
44685
44819
  throw new Error(
44686
- `${command} could not read ${(0, import_node_path29.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\`.`
44820
+ `${command} could not read ${(0, import_node_path30.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\`.`
44687
44821
  );
44688
44822
  });
44689
44823
  return {
@@ -44869,13 +45003,13 @@ function createCloudBridgeForParsed(parsed) {
44869
45003
  if (!session) return null;
44870
45004
  return session.service === "box" ? new CloudBoxBridge(session) : new CloudBridge(session);
44871
45005
  }
44872
- var import_node_crypto14, import_node_fs28, import_node_path29, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS, CloudBridge, CloudBoxBridge;
45006
+ var import_node_crypto14, import_node_fs29, import_node_path30, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS, CloudBridge, CloudBoxBridge;
44873
45007
  var init_cloud_client = __esm({
44874
45008
  "cli/cloud-client.ts"() {
44875
45009
  "use strict";
44876
45010
  import_node_crypto14 = require("node:crypto");
44877
- import_node_fs28 = require("node:fs");
44878
- import_node_path29 = require("node:path");
45011
+ import_node_fs29 = require("node:fs");
45012
+ import_node_path30 = require("node:path");
44879
45013
  init_metroAssetArtifact();
44880
45014
  init_metroCloudArtifact();
44881
45015
  init_metro_fingerprint_registry_client();
@@ -47378,31 +47512,31 @@ var init_parent_pid = __esm({
47378
47512
 
47379
47513
  // cli/secure-file.ts
47380
47514
  function writeSecureJsonAtomic(filepath, value) {
47381
- (0, import_node_fs29.mkdirSync)((0, import_node_path30.dirname)(filepath), { recursive: true });
47515
+ (0, import_node_fs30.mkdirSync)((0, import_node_path31.dirname)(filepath), { recursive: true });
47382
47516
  const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto15.randomUUID)()}`;
47383
47517
  let descriptor = null;
47384
47518
  try {
47385
- descriptor = (0, import_node_fs29.openSync)(temporary, "wx", 384);
47386
- (0, import_node_fs29.fchmodSync)(descriptor, 384);
47387
- (0, import_node_fs29.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
47519
+ descriptor = (0, import_node_fs30.openSync)(temporary, "wx", 384);
47520
+ (0, import_node_fs30.fchmodSync)(descriptor, 384);
47521
+ (0, import_node_fs30.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
47388
47522
  `);
47389
- (0, import_node_fs29.fsyncSync)(descriptor);
47390
- (0, import_node_fs29.closeSync)(descriptor);
47523
+ (0, import_node_fs30.fsyncSync)(descriptor);
47524
+ (0, import_node_fs30.closeSync)(descriptor);
47391
47525
  descriptor = null;
47392
- (0, import_node_fs29.renameSync)(temporary, filepath);
47526
+ (0, import_node_fs30.renameSync)(temporary, filepath);
47393
47527
  } catch (error) {
47394
- if (descriptor !== null) (0, import_node_fs29.closeSync)(descriptor);
47395
- (0, import_node_fs29.rmSync)(temporary, { force: true });
47528
+ if (descriptor !== null) (0, import_node_fs30.closeSync)(descriptor);
47529
+ (0, import_node_fs30.rmSync)(temporary, { force: true });
47396
47530
  throw error;
47397
47531
  }
47398
47532
  }
47399
- var import_node_crypto15, import_node_fs29, import_node_path30;
47533
+ var import_node_crypto15, import_node_fs30, import_node_path31;
47400
47534
  var init_secure_file = __esm({
47401
47535
  "cli/secure-file.ts"() {
47402
47536
  "use strict";
47403
47537
  import_node_crypto15 = require("node:crypto");
47404
- import_node_fs29 = require("node:fs");
47405
- import_node_path30 = require("node:path");
47538
+ import_node_fs30 = require("node:fs");
47539
+ import_node_path31 = require("node:path");
47406
47540
  }
47407
47541
  });
47408
47542
 
@@ -47587,17 +47721,17 @@ function liveDevBridgeLockfiles() {
47587
47721
  return readDevBridgeLockfiles().filter((lockfile) => isDevBridgeLockfileFresh(lockfile));
47588
47722
  }
47589
47723
  function checkoutRoot(cwd) {
47590
- let current = import_node_path31.default.resolve(cwd);
47724
+ let current = import_node_path32.default.resolve(cwd);
47591
47725
  while (true) {
47592
- if (import_node_fs30.default.existsSync(import_node_path31.default.join(current, ".git"))) return current;
47593
- const parent = import_node_path31.default.dirname(current);
47726
+ if (import_node_fs31.default.existsSync(import_node_path32.default.join(current, ".git"))) return current;
47727
+ const parent = import_node_path32.default.dirname(current);
47594
47728
  if (parent === current) return null;
47595
47729
  current = parent;
47596
47730
  }
47597
47731
  }
47598
47732
  function pathContains(parent, child) {
47599
- const relative3 = import_node_path31.default.relative(parent, child);
47600
- return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path31.default.sep}`) && !import_node_path31.default.isAbsolute(relative3);
47733
+ const relative3 = import_node_path32.default.relative(parent, child);
47734
+ return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path32.default.sep}`) && !import_node_path32.default.isAbsolute(relative3);
47601
47735
  }
47602
47736
  function resolveDefaultDevBridgeLockfile() {
47603
47737
  const lockfiles = liveDevBridgeLockfiles();
@@ -48192,18 +48326,18 @@ async function evalInBridge(bridge, code, opts = {}) {
48192
48326
  if (opts.acquireLock) payload.acquireLock = true;
48193
48327
  return bridge.send(payload);
48194
48328
  }
48195
- async function callInBridge(bridge, path37, ...args) {
48196
- return bridge.send({ type: "call", path: path37, args });
48329
+ async function callInBridge(bridge, path38, ...args) {
48330
+ return bridge.send({ type: "call", path: path38, args });
48197
48331
  }
48198
- async function callInBridgeWrite(bridge, path37, ...args) {
48199
- return bridge.send({ type: "call", path: path37, args, acquireLock: true });
48332
+ async function callInBridgeWrite(bridge, path38, ...args) {
48333
+ return bridge.send({ type: "call", path: path38, args, acquireLock: true });
48200
48334
  }
48201
- var import_node_fs30, import_node_path31, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
48335
+ var import_node_fs31, import_node_path32, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
48202
48336
  var init_ws_bridge = __esm({
48203
48337
  "cli/ws-bridge.ts"() {
48204
48338
  "use strict";
48205
- import_node_fs30 = __toESM(require("node:fs"), 1);
48206
- import_node_path31 = __toESM(require("node:path"), 1);
48339
+ import_node_fs31 = __toESM(require("node:fs"), 1);
48340
+ import_node_path32 = __toESM(require("node:path"), 1);
48207
48341
  import_ws2 = require("ws");
48208
48342
  init_bridge_constants();
48209
48343
  init_cli_constants();
@@ -48331,8 +48465,8 @@ function getDefaultPortForProtocol(protocol) {
48331
48465
  return protocol === "https:" ? 443 : 80;
48332
48466
  }
48333
48467
  function isBaseServerUrl(url) {
48334
- const path37 = url.pathname || "/";
48335
- return (path37 === "/" || path37 === "") && !url.search && !url.hash;
48468
+ const path38 = url.pathname || "/";
48469
+ return (path38 === "/" || path38 === "") && !url.search && !url.hash;
48336
48470
  }
48337
48471
  async function resolvePortViaServerScan(port) {
48338
48472
  try {
@@ -48496,8 +48630,8 @@ var init_dev_bundle_resolution = __esm({
48496
48630
 
48497
48631
  // src/dot-env.ts
48498
48632
  function selectEnvFile(env, notices) {
48499
- if (import_node_fs31.default.existsSync("/tmp/envfile")) {
48500
- return { name: import_node_fs31.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
48633
+ if (import_node_fs32.default.existsSync("/tmp/envfile")) {
48634
+ return { name: import_node_fs32.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
48501
48635
  }
48502
48636
  const requested = env.ENVFILE;
48503
48637
  if (!requested) return { name: DEFAULT_ENV_FILE, fromEnvfile: false };
@@ -48560,16 +48694,16 @@ function readProjectDotEnv(envsRoot, env = process.env) {
48560
48694
  const notices = [];
48561
48695
  const selection = selectEnvFile(env, notices);
48562
48696
  const requestedPaths = [
48563
- import_node_path32.default.resolve(import_node_path32.default.join(envsRoot, selection.name)),
48564
- import_node_path32.default.resolve(selection.name)
48697
+ import_node_path33.default.resolve(import_node_path33.default.join(envsRoot, selection.name)),
48698
+ import_node_path33.default.resolve(selection.name)
48565
48699
  ];
48566
48700
  const candidates = [
48567
48701
  ...requestedPaths,
48568
- import_node_path32.default.resolve(import_node_path32.default.join(envsRoot, DEFAULT_ENV_FILE))
48702
+ import_node_path33.default.resolve(import_node_path33.default.join(envsRoot, DEFAULT_ENV_FILE))
48569
48703
  ];
48570
- if (!import_node_fs31.default.existsSync(candidates[2])) candidates.push(import_node_path32.default.resolve(DEFAULT_ENV_FILE));
48704
+ if (!import_node_fs32.default.existsSync(candidates[2])) candidates.push(import_node_path33.default.resolve(DEFAULT_ENV_FILE));
48571
48705
  const tried = [...new Set(candidates)];
48572
- const resolved = tried.find((candidate) => import_node_fs31.default.existsSync(candidate));
48706
+ const resolved = tried.find((candidate) => import_node_fs32.default.existsSync(candidate));
48573
48707
  if (!resolved) {
48574
48708
  notices.push(
48575
48709
  "*** Missing .env file ****",
@@ -48589,7 +48723,7 @@ function readProjectDotEnv(envsRoot, env = process.env) {
48589
48723
  );
48590
48724
  }
48591
48725
  const config = {};
48592
- for (const line of import_node_fs31.default.readFileSync(resolved, "utf8").split("\n")) {
48726
+ for (const line of import_node_fs32.default.readFileSync(resolved, "utf8").split("\n")) {
48593
48727
  if (!line.trim()) continue;
48594
48728
  if (/^[ \t\n\v\f\r]*#/.test(line)) continue;
48595
48729
  const match = DOTENV_PATTERN.exec(line);
@@ -48599,12 +48733,12 @@ function readProjectDotEnv(envsRoot, env = process.env) {
48599
48733
  }
48600
48734
  return { config, notices };
48601
48735
  }
48602
- var import_node_fs31, import_node_path32, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
48736
+ var import_node_fs32, import_node_path33, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
48603
48737
  var init_dot_env = __esm({
48604
48738
  "src/dot-env.ts"() {
48605
48739
  "use strict";
48606
- import_node_fs31 = __toESM(require("node:fs"), 1);
48607
- import_node_path32 = __toESM(require("node:path"), 1);
48740
+ import_node_fs32 = __toESM(require("node:fs"), 1);
48741
+ import_node_path33 = __toESM(require("node:path"), 1);
48608
48742
  DEFAULT_ENV_FILE = ".env";
48609
48743
  DOTENV_PATTERN = /^(?:export[ \t\n\v\f\r]+|)(?<key>[\p{Alphabetic}\p{Nd}_]+)[ \t\n\v\f\r]*=[ \t\n\v\f\r]*((?<quote>["'])?(?<val>[^\n]*?[^\\\n])\k<quote>?|)$/u;
48610
48744
  BUILD_SETTING_PATTERN = /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]|\$([A-Za-z_][A-Za-z0-9_]*)/g;
@@ -48628,8 +48762,8 @@ var init_flow_timeout_scale = __esm({
48628
48762
  function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48629
48763
  const result = {};
48630
48764
  let config = {};
48631
- const appJsonPath = import_node_path33.default.join(projectRoot, "app.json");
48632
- const appJson = import_node_fs32.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs32.default.readFileSync(appJsonPath, "utf8")) : null;
48765
+ const appJsonPath = import_node_path34.default.join(projectRoot, "app.json");
48766
+ const appJson = import_node_fs33.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs33.default.readFileSync(appJsonPath, "utf8")) : null;
48633
48767
  const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
48634
48768
  (value) => isRecord(value) && typeof value.googleServicesFile === "string"
48635
48769
  ));
@@ -48638,9 +48772,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48638
48772
  "app.config.ts",
48639
48773
  "app.config.cjs",
48640
48774
  "app.config.mjs"
48641
- ].some((name2) => import_node_fs32.default.existsSync(import_node_path33.default.join(projectRoot, name2)));
48775
+ ].some((name2) => import_node_fs33.default.existsSync(import_node_path34.default.join(projectRoot, name2)));
48642
48776
  if (staticExpo || dynamicExpo) {
48643
- const require4 = (0, import_node_module2.createRequire)(import_node_path33.default.join(projectRoot, "package.json"));
48777
+ const require4 = (0, import_node_module2.createRequire)(import_node_path34.default.join(projectRoot, "package.json"));
48644
48778
  const configModule = require4("@expo/config");
48645
48779
  if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
48646
48780
  throw new Error("Expo native configuration is unavailable.");
@@ -48652,23 +48786,23 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48652
48786
  }
48653
48787
  const ios = config.ios;
48654
48788
  if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
48655
- const iosRoot = import_node_path33.default.join(projectRoot, "ios");
48656
- if (import_node_fs32.default.existsSync(iosRoot)) {
48657
- const projects2 = import_node_fs32.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
48789
+ const iosRoot = import_node_path34.default.join(projectRoot, "ios");
48790
+ if (import_node_fs33.default.existsSync(iosRoot)) {
48791
+ const projects2 = import_node_fs33.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
48658
48792
  if (projects2.length > 1)
48659
48793
  throw new Error("native Firebase configuration requires a selected Xcode project");
48660
48794
  if (projects2.length === 1) {
48661
- const xcodeproj = import_node_path33.default.join(iosRoot, projects2[0].name);
48795
+ const xcodeproj = import_node_path34.default.join(iosRoot, projects2[0].name);
48662
48796
  const appTargets = listXcodeAppTargets(xcodeproj);
48663
48797
  if (appTargets.length > 1)
48664
48798
  throw new Error("native Firebase configuration requires a selected app target");
48665
48799
  if (appTargets.length === 1) {
48666
48800
  const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
48667
48801
  const delegates = app.allSources.filter(
48668
- (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path33.default.basename(file))
48802
+ (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path34.default.basename(file))
48669
48803
  );
48670
48804
  const defaultConfigured = delegates.some((file) => {
48671
- const source = import_node_fs32.default.readFileSync(file, "utf8").replace(
48805
+ const source = import_node_fs33.default.readFileSync(file, "utf8").replace(
48672
48806
  /\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
48673
48807
  (token) => token.startsWith('"') ? '""' : token.replace(/[^\n]/g, " ")
48674
48808
  );
@@ -48696,15 +48830,15 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48696
48830
  });
48697
48831
  if (defaultConfigured) {
48698
48832
  const resources = app.resources.filter(
48699
- (file) => /^GoogleService-Info\.plist$/.test(import_node_path33.default.basename(file))
48833
+ (file) => /^GoogleService-Info\.plist$/.test(import_node_path34.default.basename(file))
48700
48834
  );
48701
48835
  if (resources.length !== 1)
48702
48836
  throw new Error(
48703
48837
  "native Firebase default initialization requires one GoogleService-Info.plist build resource"
48704
48838
  );
48705
48839
  config.ios = {
48706
- googleServicesFile: import_node_path33.default.relative(
48707
- import_node_fs32.default.realpathSync(projectRoot),
48840
+ googleServicesFile: import_node_path34.default.relative(
48841
+ import_node_fs33.default.realpathSync(projectRoot),
48708
48842
  resources[0]
48709
48843
  )
48710
48844
  };
@@ -48717,8 +48851,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48717
48851
  const native = config[platform];
48718
48852
  if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
48719
48853
  try {
48720
- const source = import_node_fs32.default.readFileSync(
48721
- import_node_path33.default.resolve(projectRoot, native.googleServicesFile),
48854
+ const source = import_node_fs33.default.readFileSync(
48855
+ import_node_path34.default.resolve(projectRoot, native.googleServicesFile),
48722
48856
  "utf8"
48723
48857
  );
48724
48858
  const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
@@ -48770,13 +48904,13 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48770
48904
  }
48771
48905
  return result;
48772
48906
  }
48773
- var import_node_fs32, import_node_module2, import_node_path33;
48907
+ var import_node_fs33, import_node_module2, import_node_path34;
48774
48908
  var init_native_firebase_config = __esm({
48775
48909
  "src/native-firebase-config.ts"() {
48776
48910
  "use strict";
48777
- import_node_fs32 = __toESM(require("node:fs"), 1);
48911
+ import_node_fs33 = __toESM(require("node:fs"), 1);
48778
48912
  import_node_module2 = require("node:module");
48779
- import_node_path33 = __toESM(require("node:path"), 1);
48913
+ import_node_path34 = __toESM(require("node:path"), 1);
48780
48914
  init_is_record();
48781
48915
  init_plist();
48782
48916
  init_xcode_project();
@@ -48890,59 +49024,59 @@ var init_profiles = __esm({
48890
49024
  // cli/app-catalog.ts
48891
49025
  function listDir(dir) {
48892
49026
  try {
48893
- return import_node_fs33.default.readdirSync(dir, { withFileTypes: true });
49027
+ return import_node_fs34.default.readdirSync(dir, { withFileTypes: true });
48894
49028
  } catch {
48895
49029
  return [];
48896
49030
  }
48897
49031
  }
48898
49032
  function readText(file) {
48899
49033
  try {
48900
- return import_node_fs33.default.readFileSync(file, "utf8");
49034
+ return import_node_fs34.default.readFileSync(file, "utf8");
48901
49035
  } catch {
48902
49036
  return null;
48903
49037
  }
48904
49038
  }
48905
49039
  function catalogFiles(dir, found) {
48906
49040
  for (const entry of listDir(dir)) {
48907
- const full = import_node_path34.default.join(dir, entry.name);
49041
+ const full = import_node_path35.default.join(dir, entry.name);
48908
49042
  if (entry.isDirectory()) catalogFiles(full, found);
48909
49043
  else if (entry.name === "Contents.json") found.push(full);
48910
49044
  }
48911
49045
  }
48912
49046
  function discoverAppCatalog(appDir) {
48913
- const iosDir = import_node_path34.default.join(appDir, "ios");
49047
+ const iosDir = import_node_path35.default.join(appDir, "ios");
48914
49048
  const target = listDir(iosDir).find(
48915
- (entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path34.default.join(iosDir, entry.name)).some(
49049
+ (entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path35.default.join(iosDir, entry.name)).some(
48916
49050
  (file) => /^AppDelegate\.(swift|mm|m)$/.test(file.name)
48917
49051
  )
48918
49052
  );
48919
49053
  if (!target) return null;
48920
- const targetDir = import_node_path34.default.join(iosDir, target.name);
49054
+ const targetDir = import_node_path35.default.join(iosDir, target.name);
48921
49055
  const files2 = [];
48922
49056
  for (const entry of listDir(targetDir)) {
48923
49057
  if (entry.isDirectory() && entry.name.endsWith(".xcassets"))
48924
- catalogFiles(import_node_path34.default.join(targetDir, entry.name), files2);
49058
+ catalogFiles(import_node_path35.default.join(targetDir, entry.name), files2);
48925
49059
  }
48926
49060
  const relative3 = files2.map(
48927
- (file) => import_node_path34.default.relative(targetDir, file).split(import_node_path34.default.sep).join(import_node_path34.default.posix.sep)
49061
+ (file) => import_node_path35.default.relative(targetDir, file).split(import_node_path35.default.sep).join(import_node_path35.default.posix.sep)
48928
49062
  );
48929
49063
  const colors = enumerateBundleColors(
48930
49064
  relative3,
48931
- (candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path34.default.join(targetDir, candidate)) : null
49065
+ (candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path35.default.join(targetDir, candidate)) : null
48932
49066
  );
48933
49067
  const pbxproj = listDir(iosDir).find((entry) => entry.name.endsWith(".xcodeproj"));
48934
- const accentName = readText(import_node_path34.default.join(targetDir, "Info.plist"))?.match(PLIST_ACCENT)?.[1] ?? (pbxproj ? readText(import_node_path34.default.join(iosDir, pbxproj.name, "project.pbxproj"))?.match(
49068
+ const accentName = readText(import_node_path35.default.join(targetDir, "Info.plist"))?.match(PLIST_ACCENT)?.[1] ?? (pbxproj ? readText(import_node_path35.default.join(iosDir, pbxproj.name, "project.pbxproj"))?.match(
48935
49069
  ACCENT_BUILD_SETTING
48936
49070
  )?.[1] : void 0) ?? null;
48937
49071
  if (accentName === null && Object.keys(colors).length === 0) return null;
48938
49072
  return { colors, accentName };
48939
49073
  }
48940
- var import_node_fs33, import_node_path34, ACCENT_BUILD_SETTING, PLIST_ACCENT;
49074
+ var import_node_fs34, import_node_path35, ACCENT_BUILD_SETTING, PLIST_ACCENT;
48941
49075
  var init_app_catalog = __esm({
48942
49076
  "cli/app-catalog.ts"() {
48943
49077
  "use strict";
48944
- import_node_fs33 = __toESM(require("node:fs"), 1);
48945
- import_node_path34 = __toESM(require("node:path"), 1);
49078
+ import_node_fs34 = __toESM(require("node:fs"), 1);
49079
+ import_node_path35 = __toESM(require("node:path"), 1);
48946
49080
  init_bundleAssets();
48947
49081
  ACCENT_BUILD_SETTING = /ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "?([^";]+)"?;/;
48948
49082
  PLIST_ACCENT = /<key>NSAccentColorName<\/key>\s*<string>([^<]+)<\/string>/;
@@ -48952,9 +49086,9 @@ var init_app_catalog = __esm({
48952
49086
  // cli/app-project.ts
48953
49087
  function firstNamedFile(dir, names) {
48954
49088
  for (const name2 of names) {
48955
- const candidate = import_node_path35.default.join(dir, name2);
49089
+ const candidate = import_node_path36.default.join(dir, name2);
48956
49090
  try {
48957
- if (import_node_fs34.default.statSync(candidate).isFile()) return candidate;
49091
+ if (import_node_fs35.default.statSync(candidate).isFile()) return candidate;
48958
49092
  } catch {
48959
49093
  }
48960
49094
  }
@@ -48967,24 +49101,24 @@ function findRNXAppConfig(dir) {
48967
49101
  return firstNamedFile(dir, PEACH_APP_CONFIG_NAMES);
48968
49102
  }
48969
49103
  function resolveAppProject(projectRoot) {
48970
- const appDir = import_node_path35.default.resolve(projectRoot);
49104
+ const appDir = import_node_path36.default.resolve(projectRoot);
48971
49105
  try {
48972
- if (!import_node_fs34.default.statSync(appDir).isDirectory()) return null;
49106
+ if (!import_node_fs35.default.statSync(appDir).isDirectory()) return null;
48973
49107
  } catch {
48974
49108
  return null;
48975
49109
  }
48976
49110
  const configPath = findRNXAppConfig(appDir);
48977
- if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs34.default.existsSync(import_node_path35.default.join(appDir, "package.json"))) {
49111
+ if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs35.default.existsSync(import_node_path36.default.join(appDir, "package.json"))) {
48978
49112
  return null;
48979
49113
  }
48980
49114
  return { appDir, configPath };
48981
49115
  }
48982
- var import_node_fs34, import_node_path35, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
49116
+ var import_node_fs35, import_node_path36, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
48983
49117
  var init_app_project = __esm({
48984
49118
  "cli/app-project.ts"() {
48985
49119
  "use strict";
48986
- import_node_fs34 = __toESM(require("node:fs"), 1);
48987
- import_node_path35 = __toESM(require("node:path"), 1);
49120
+ import_node_fs35 = __toESM(require("node:fs"), 1);
49121
+ import_node_path36 = __toESM(require("node:path"), 1);
48988
49122
  EXPO_APP_CONFIG_NAMES = [
48989
49123
  "app.config.js",
48990
49124
  "app.config.ts",
@@ -49007,12 +49141,12 @@ function resolveFileEntries(entries, configDir) {
49007
49141
  return Object.fromEntries(
49008
49142
  Object.entries(entries).map(([name2, resolution]) => [
49009
49143
  name2,
49010
- resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path36.default.resolve(configDir, resolution.file) } : resolution
49144
+ resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path37.default.resolve(configDir, resolution.file) } : resolution
49011
49145
  ])
49012
49146
  );
49013
49147
  }
49014
49148
  function resolveConfigReplacementFiles(config, configPath) {
49015
- const configDir = import_node_path36.default.dirname(configPath);
49149
+ const configDir = import_node_path37.default.dirname(configPath);
49016
49150
  return {
49017
49151
  ...config,
49018
49152
  modules: resolveFileEntries(config.modules, configDir),
@@ -49047,11 +49181,11 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
49047
49181
  const project = resolveAppProject(startDir);
49048
49182
  return { project, config: await loadRNXAppConfig(project) };
49049
49183
  }
49050
- var import_node_path36, import_jiti;
49184
+ var import_node_path37, import_jiti;
49051
49185
  var init_app_config = __esm({
49052
49186
  "cli/app-config.ts"() {
49053
49187
  "use strict";
49054
- import_node_path36 = __toESM(require("node:path"), 1);
49188
+ import_node_path37 = __toESM(require("node:path"), 1);
49055
49189
  import_jiti = require("jiti");
49056
49190
  init_config();
49057
49191
  init_config();
@@ -49108,13 +49242,13 @@ function discoverNativeLinkedAppFonts(opts) {
49108
49242
  scannedFontDirectories++;
49109
49243
  let entries;
49110
49244
  try {
49111
- entries = import_node_fs35.default.readdirSync(current.dir, { withFileTypes: true });
49245
+ entries = import_node_fs36.default.readdirSync(current.dir, { withFileTypes: true });
49112
49246
  } catch {
49113
49247
  continue;
49114
49248
  }
49115
49249
  for (const entry of entries) {
49116
49250
  if (entry.isSymbolicLink()) continue;
49117
- const fullPath = import_node_path37.default.join(current.dir, entry.name);
49251
+ const fullPath = import_node_path38.default.join(current.dir, entry.name);
49118
49252
  if (entry.isDirectory()) {
49119
49253
  if (current.depth < 4 && pending.length < 64 && !entry.name.startsWith(".")) {
49120
49254
  pending.push({ dir: fullPath, depth: current.depth + 1 });
@@ -49122,15 +49256,15 @@ function discoverNativeLinkedAppFonts(opts) {
49122
49256
  continue;
49123
49257
  }
49124
49258
  if (!entry.isFile() || !/\.(ttf|otf|woff|woff2)$/i.test(entry.name)) continue;
49125
- const relative3 = import_node_path37.default.relative(root, fullPath).split(import_node_path37.default.sep).join("/");
49126
- fontPaths.push(import_node_path37.default.posix.join(metroPathPrefix, relative3));
49259
+ const relative3 = import_node_path38.default.relative(root, fullPath).split(import_node_path38.default.sep).join("/");
49260
+ fontPaths.push(import_node_path38.default.posix.join(metroPathPrefix, relative3));
49127
49261
  if (fontPaths.length >= 256) break;
49128
49262
  }
49129
49263
  }
49130
49264
  };
49131
49265
  try {
49132
49266
  const packageJson = JSON.parse(
49133
- import_node_fs35.default.readFileSync(import_node_path37.default.join(selectedAppDir, "package.json"), "utf8")
49267
+ import_node_fs36.default.readFileSync(import_node_path38.default.join(selectedAppDir, "package.json"), "utf8")
49134
49268
  );
49135
49269
  const dependencyNames = /* @__PURE__ */ new Set();
49136
49270
  for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
@@ -49145,32 +49279,32 @@ function discoverNativeLinkedAppFonts(opts) {
49145
49279
  const config = Reflect.get(packageJson, "reactNativeVectorIcons");
49146
49280
  const configuredFontDir = config && typeof config === "object" ? Reflect.get(config, "fontDir") : null;
49147
49281
  const configuredDir = typeof configuredFontDir === "string" ? configuredFontDir : "rnvi-fonts";
49148
- const root = import_node_path37.default.resolve(selectedAppDir, configuredDir);
49149
- const relativeRoot = import_node_path37.default.relative(selectedAppDir, root);
49150
- if (!relativeRoot.startsWith("..") && !import_node_path37.default.isAbsolute(relativeRoot)) {
49151
- collectFontFiles(root, relativeRoot.split(import_node_path37.default.sep).join("/"));
49282
+ const root = import_node_path38.default.resolve(selectedAppDir, configuredDir);
49283
+ const relativeRoot = import_node_path38.default.relative(selectedAppDir, root);
49284
+ if (!relativeRoot.startsWith("..") && !import_node_path38.default.isAbsolute(relativeRoot)) {
49285
+ collectFontFiles(root, relativeRoot.split(import_node_path38.default.sep).join("/"));
49152
49286
  }
49153
- const bundleDir = import_node_path37.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
49154
- const appRelativeDir = bundleDir.split("/").join(import_node_path37.default.sep);
49287
+ const bundleDir = import_node_path38.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
49288
+ const appRelativeDir = bundleDir.split("/").join(import_node_path38.default.sep);
49155
49289
  const metroRootCandidates = [selectedAppDir];
49156
- if (bundleDir && selectedAppDir.endsWith(import_node_path37.default.sep + appRelativeDir)) {
49290
+ if (bundleDir && selectedAppDir.endsWith(import_node_path38.default.sep + appRelativeDir)) {
49157
49291
  metroRootCandidates.push(selectedAppDir.slice(0, -appRelativeDir.length - 1));
49158
49292
  }
49159
- const vectorIconRequire = (0, import_node_module3.createRequire)(import_node_path37.default.join(selectedAppDir, "package.json"));
49293
+ const vectorIconRequire = (0, import_node_module3.createRequire)(import_node_path38.default.join(selectedAppDir, "package.json"));
49160
49294
  for (const dependencyName of vectorIconDependencies) {
49161
49295
  try {
49162
49296
  const entryPath = vectorIconRequire.resolve(dependencyName);
49163
- const dependencyPath = dependencyName.split("/").join(import_node_path37.default.sep);
49164
- const marker = `${import_node_path37.default.sep}node_modules${import_node_path37.default.sep}${dependencyPath}${import_node_path37.default.sep}`;
49297
+ const dependencyPath = dependencyName.split("/").join(import_node_path38.default.sep);
49298
+ const marker = `${import_node_path38.default.sep}node_modules${import_node_path38.default.sep}${dependencyPath}${import_node_path38.default.sep}`;
49165
49299
  const markerIndex = entryPath.lastIndexOf(marker);
49166
49300
  if (markerIndex === -1) continue;
49167
49301
  const packageRoot = entryPath.slice(0, markerIndex + marker.length - 1);
49168
49302
  const fontsDir = dependencyName === "react-native-vector-icons" ? "Fonts" : "fonts";
49169
- const fontsRoot = import_node_path37.default.join(packageRoot, fontsDir);
49303
+ const fontsRoot = import_node_path38.default.join(packageRoot, fontsDir);
49170
49304
  for (const metroRoot of metroRootCandidates) {
49171
49305
  collectFontFiles(
49172
49306
  fontsRoot,
49173
- import_node_path37.default.relative(metroRoot, fontsRoot).split(import_node_path37.default.sep).join("/")
49307
+ import_node_path38.default.relative(metroRoot, fontsRoot).split(import_node_path38.default.sep).join("/")
49174
49308
  );
49175
49309
  }
49176
49310
  } catch {
@@ -49180,37 +49314,37 @@ function discoverNativeLinkedAppFonts(opts) {
49180
49314
  } catch {
49181
49315
  }
49182
49316
  try {
49183
- const configPath = import_node_path37.default.join(selectedAppDir, "react-native.config.js");
49184
- if (import_node_fs35.default.statSync(configPath).isFile()) {
49185
- const appConfigRequire = (0, import_node_module3.createRequire)(import_node_path37.default.join(selectedAppDir, "package.json"));
49317
+ const configPath = import_node_path38.default.join(selectedAppDir, "react-native.config.js");
49318
+ if (import_node_fs36.default.statSync(configPath).isFile()) {
49319
+ const appConfigRequire = (0, import_node_module3.createRequire)(import_node_path38.default.join(selectedAppDir, "package.json"));
49186
49320
  const rnConfig = appConfigRequire(configPath);
49187
49321
  const assets2 = rnConfig && typeof rnConfig === "object" ? Reflect.get(rnConfig, "assets") : null;
49188
49322
  if (Array.isArray(assets2)) {
49189
49323
  for (const assetDir of assets2) {
49190
49324
  if (typeof assetDir !== "string") continue;
49191
- const root = import_node_path37.default.resolve(selectedAppDir, assetDir);
49192
- const relativeRoot = import_node_path37.default.relative(selectedAppDir, root);
49193
- if (relativeRoot.startsWith("..") || import_node_path37.default.isAbsolute(relativeRoot)) continue;
49194
- collectFontFiles(root, relativeRoot.split(import_node_path37.default.sep).join("/"));
49325
+ const root = import_node_path38.default.resolve(selectedAppDir, assetDir);
49326
+ const relativeRoot = import_node_path38.default.relative(selectedAppDir, root);
49327
+ if (relativeRoot.startsWith("..") || import_node_path38.default.isAbsolute(relativeRoot)) continue;
49328
+ collectFontFiles(root, relativeRoot.split(import_node_path38.default.sep).join("/"));
49195
49329
  }
49196
49330
  }
49197
49331
  }
49198
49332
  } catch {
49199
49333
  }
49200
49334
  if (platform === "ios") {
49201
- const iosDir = import_node_path37.default.join(selectedAppDir, "ios");
49335
+ const iosDir = import_node_path38.default.join(selectedAppDir, "ios");
49202
49336
  try {
49203
- const targetDirs = import_node_fs35.default.readdirSync(iosDir, { withFileTypes: true }).filter(
49337
+ const targetDirs = import_node_fs36.default.readdirSync(iosDir, { withFileTypes: true }).filter(
49204
49338
  (entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
49205
49339
  ).slice(0, 64);
49206
- const plistPaths = [import_node_path37.default.join(iosDir, "Info.plist")];
49340
+ const plistPaths = [import_node_path38.default.join(iosDir, "Info.plist")];
49207
49341
  for (const entry of targetDirs) {
49208
- plistPaths.push(import_node_path37.default.join(iosDir, entry.name, "Info.plist"));
49342
+ plistPaths.push(import_node_path38.default.join(iosDir, entry.name, "Info.plist"));
49209
49343
  }
49210
49344
  for (const plistPath of plistPaths) {
49211
49345
  let parsed;
49212
49346
  try {
49213
- parsed = parsePlistSource(import_node_fs35.default.readFileSync(plistPath, "utf8"));
49347
+ parsed = parsePlistSource(import_node_fs36.default.readFileSync(plistPath, "utf8"));
49214
49348
  } catch {
49215
49349
  continue;
49216
49350
  }
@@ -49220,21 +49354,21 @@ function discoverNativeLinkedAppFonts(opts) {
49220
49354
  for (const declaredFont of declaredFonts) {
49221
49355
  if (typeof declaredFont !== "string") continue;
49222
49356
  const candidates = [
49223
- import_node_path37.default.resolve(import_node_path37.default.dirname(plistPath), declaredFont),
49224
- import_node_path37.default.resolve(iosDir, declaredFont)
49357
+ import_node_path38.default.resolve(import_node_path38.default.dirname(plistPath), declaredFont),
49358
+ import_node_path38.default.resolve(iosDir, declaredFont)
49225
49359
  ];
49226
49360
  const fontPath = candidates.find((candidate) => {
49227
- const relative3 = import_node_path37.default.relative(selectedAppDir, candidate);
49228
- if (relative3.startsWith("..") || import_node_path37.default.isAbsolute(relative3)) return false;
49361
+ const relative3 = import_node_path38.default.relative(selectedAppDir, candidate);
49362
+ if (relative3.startsWith("..") || import_node_path38.default.isAbsolute(relative3)) return false;
49229
49363
  try {
49230
- return import_node_fs35.default.statSync(candidate).isFile();
49364
+ return import_node_fs36.default.statSync(candidate).isFile();
49231
49365
  } catch {
49232
49366
  return false;
49233
49367
  }
49234
49368
  });
49235
49369
  if (!fontPath) continue;
49236
49370
  fontPaths.push(
49237
- import_node_path37.default.relative(selectedAppDir, fontPath).split(import_node_path37.default.sep).join("/")
49371
+ import_node_path38.default.relative(selectedAppDir, fontPath).split(import_node_path38.default.sep).join("/")
49238
49372
  );
49239
49373
  }
49240
49374
  }
@@ -49276,13 +49410,13 @@ async function resolveMetroProjectRoot(bundleUrl, opts) {
49276
49410
  function encodeAppFontsWire(specs) {
49277
49411
  return specs.map((spec) => `${encodeURIComponent(spec.url)}::${encodeURIComponent(spec.family)}`).join(",");
49278
49412
  }
49279
- var import_node_fs35, import_node_module3, import_node_path37, import_config_plugin_fonts, require2;
49413
+ var import_node_fs36, import_node_module3, import_node_path38, import_config_plugin_fonts, require2;
49280
49414
  var init_app_fonts = __esm({
49281
49415
  "cli/app-fonts.ts"() {
49282
49416
  "use strict";
49283
- import_node_fs35 = __toESM(require("node:fs"), 1);
49417
+ import_node_fs36 = __toESM(require("node:fs"), 1);
49284
49418
  import_node_module3 = require("node:module");
49285
- import_node_path37 = __toESM(require("node:path"), 1);
49419
+ import_node_path38 = __toESM(require("node:path"), 1);
49286
49420
  import_config_plugin_fonts = require("peach-engine/engine/config-plugin-fonts");
49287
49421
  init_dev_server_scanner();
49288
49422
  init_backend_origin();
@@ -50222,7 +50356,7 @@ function desktopHostExecutable() {
50222
50356
  function bundleValue(app, key2) {
50223
50357
  const read = (0, import_node_child_process13.spawnSync)(
50224
50358
  "plutil",
50225
- ["-extract", key2, "raw", "-o", "-", import_node_path38.default.join(app, "Contents/Info.plist")],
50359
+ ["-extract", key2, "raw", "-o", "-", import_node_path39.default.join(app, "Contents/Info.plist")],
50226
50360
  { encoding: "utf8" }
50227
50361
  );
50228
50362
  return read.status === 0 ? read.stdout.trim() : null;
@@ -50233,8 +50367,8 @@ function isNativeHostBundle(app) {
50233
50367
  function placedHostVersion() {
50234
50368
  if (desktopHostPlatform() === "linux-x64") {
50235
50369
  try {
50236
- const version = import_node_fs36.default.readFileSync(import_node_path38.default.join(desktopHostsDir(), "active"), "utf8").trim();
50237
- return /^\d+\.\d+$/.test(version) && import_node_fs36.default.existsSync(import_node_path38.default.join(desktopHostDir(version), desktopHostExecutable())) ? version : null;
50370
+ const version = import_node_fs37.default.readFileSync(import_node_path39.default.join(desktopHostsDir(), "active"), "utf8").trim();
50371
+ return /^\d+\.\d+$/.test(version) && import_node_fs37.default.existsSync(import_node_path39.default.join(desktopHostDir(version), desktopHostExecutable())) ? version : null;
50238
50372
  } catch {
50239
50373
  return null;
50240
50374
  }
@@ -50250,18 +50384,18 @@ function headlessHostCommand() {
50250
50384
  if (!version) return null;
50251
50385
  const dir = desktopHostDir(version);
50252
50386
  return [
50253
- import_node_path38.default.join(dir, "bin/node"),
50387
+ import_node_path39.default.join(dir, "bin/node"),
50254
50388
  "--experimental-vm-modules",
50255
- import_node_path38.default.join(dir, "node/host.mjs")
50389
+ import_node_path39.default.join(dir, "node/host.mjs")
50256
50390
  ];
50257
50391
  }
50258
- var import_node_child_process13, import_node_fs36, import_node_path38, MAC_HOST_APP, HOST_BUNDLE_ID;
50392
+ var import_node_child_process13, import_node_fs37, import_node_path39, MAC_HOST_APP, HOST_BUNDLE_ID;
50259
50393
  var init_desktop_host_delivery = __esm({
50260
50394
  "src/desktop-host-delivery.ts"() {
50261
50395
  "use strict";
50262
50396
  import_node_child_process13 = require("node:child_process");
50263
- import_node_fs36 = __toESM(require("node:fs"), 1);
50264
- import_node_path38 = __toESM(require("node:path"), 1);
50397
+ import_node_fs37 = __toESM(require("node:fs"), 1);
50398
+ import_node_path39 = __toESM(require("node:path"), 1);
50265
50399
  init_src();
50266
50400
  init_home_paths();
50267
50401
  MAC_HOST_APP = "/Applications/Peach.app";
@@ -51809,8 +51943,8 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
51809
51943
  };
51810
51944
  }
51811
51945
  const lock = parseLinuxBrowserLibsLock(linux_browser_libs_lock_default);
51812
- const dir = (0, import_node_path39.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
51813
- if (!(0, import_node_fs37.existsSync)((0, import_node_path39.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
51946
+ const dir = (0, import_node_path40.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
51947
+ if (!(0, import_node_fs38.existsSync)((0, import_node_path40.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
51814
51948
  const url = `${DEFAULT_CLI_RELEASE_ORIGIN}/${linuxBrowserLibsKey(lock.id, arch)}`;
51815
51949
  process.stderr.write(
51816
51950
  `peach: this system lacks ${missing.length} shared libraries ${browser} links; downloading them\u2026
@@ -51838,7 +51972,7 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
51838
51972
  };
51839
51973
  }
51840
51974
  }
51841
- const libraryPath = [(0, import_node_path39.join)(dir, "lib"), (0, import_node_path39.join)(dir, "lib", "nss")].join(":");
51975
+ const libraryPath = [(0, import_node_path40.join)(dir, "lib"), (0, import_node_path40.join)(dir, "lib", "nss")].join(":");
51842
51976
  const stillMissing = missingLibraries(executablePath, libraryPath);
51843
51977
  if (stillMissing.length) {
51844
51978
  return {
@@ -51848,13 +51982,13 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
51848
51982
  }
51849
51983
  return { ok: true, libraryPath };
51850
51984
  }
51851
- var import_node_child_process14, import_node_fs37, import_node_path39, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
51985
+ var import_node_child_process14, import_node_fs38, import_node_path40, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
51852
51986
  var init_linux_browser_libs = __esm({
51853
51987
  "cli/drivers/linux-browser-libs.ts"() {
51854
51988
  "use strict";
51855
51989
  import_node_child_process14 = require("node:child_process");
51856
- import_node_fs37 = require("node:fs");
51857
- import_node_path39 = require("node:path");
51990
+ import_node_fs38 = require("node:fs");
51991
+ import_node_path40 = require("node:path");
51858
51992
  init_src();
51859
51993
  init_home_paths();
51860
51994
  init_is_record();
@@ -51878,13 +52012,13 @@ function resolvePlaywright() {
51878
52012
  try {
51879
52013
  const modulePath = requireFromRoot.resolve(spec);
51880
52014
  const packageJsonPath = requireFromRoot.resolve(`${spec}/package.json`);
51881
- const parsed = JSON.parse((0, import_node_fs38.readFileSync)(packageJsonPath, "utf8"));
52015
+ const parsed = JSON.parse((0, import_node_fs39.readFileSync)(packageJsonPath, "utf8"));
51882
52016
  if (!isRecord(parsed) || typeof parsed.version !== "string") continue;
51883
52017
  const corePackagePath = (0, import_node_module5.createRequire)(modulePath).resolve(
51884
52018
  "playwright-core/package.json"
51885
52019
  );
51886
- const cliPath = (0, import_node_path40.join)((0, import_node_path40.dirname)(corePackagePath), "cli.js");
51887
- if (!(0, import_node_fs38.existsSync)(cliPath)) continue;
52020
+ const cliPath = (0, import_node_path41.join)((0, import_node_path41.dirname)(corePackagePath), "cli.js");
52021
+ if (!(0, import_node_fs39.existsSync)(cliPath)) continue;
51888
52022
  return {
51889
52023
  spec,
51890
52024
  modulePath,
@@ -51912,7 +52046,7 @@ async function provisionPlaywright() {
51912
52046
  await installVerifiedTarball({
51913
52047
  url: `https://registry.npmjs.org/playwright-core/-/playwright-core-${version}.tgz`,
51914
52048
  digest: { algorithm, encoding: "base64", value: digest },
51915
- destDir: (0, import_node_path40.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
52049
+ destDir: (0, import_node_path41.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
51916
52050
  installedMarker: "package.json",
51917
52051
  // npm tarballs hold the package under a leading `package/`
51918
52052
  stripComponents: 1,
@@ -51955,7 +52089,7 @@ function probeBrowser(resolved, env) {
51955
52089
  return {
51956
52090
  ok: true,
51957
52091
  executablePath: parsed.executablePath,
51958
- exists: parsed.exists && (0, import_node_fs38.existsSync)(parsed.executablePath)
52092
+ exists: parsed.exists && (0, import_node_fs39.existsSync)(parsed.executablePath)
51959
52093
  };
51960
52094
  } catch (error) {
51961
52095
  return {
@@ -52023,14 +52157,14 @@ ${detail}` : ""}`
52023
52157
  libraryPath: libraries.libraryPath
52024
52158
  };
52025
52159
  }
52026
- var import_node_child_process15, import_node_fs38, import_node_module5, import_node_path40;
52160
+ var import_node_child_process15, import_node_fs39, import_node_module5, import_node_path41;
52027
52161
  var init_playwright_provisioning = __esm({
52028
52162
  "cli/drivers/playwright-provisioning.ts"() {
52029
52163
  "use strict";
52030
52164
  import_node_child_process15 = require("node:child_process");
52031
- import_node_fs38 = require("node:fs");
52165
+ import_node_fs39 = require("node:fs");
52032
52166
  import_node_module5 = require("node:module");
52033
- import_node_path40 = require("node:path");
52167
+ import_node_path41 = require("node:path");
52034
52168
  init_src();
52035
52169
  init_home_paths();
52036
52170
  init_is_record();
@@ -52528,12 +52662,12 @@ var init_runtime_diagnostics = __esm({
52528
52662
  // cli/commands/skills.ts
52529
52663
  function getSkillsDir() {
52530
52664
  if (typeof __PEACH_BUNDLED_SKILLS__ !== "undefined") {
52531
- const dir = path33.join(rnxHomeDir(), "skills", getCliVersion());
52665
+ const dir = path34.join(rnxHomeDir(), "skills", getCliVersion());
52532
52666
  for (const [file, body] of Object.entries(__PEACH_BUNDLED_SKILLS__)) {
52533
- const target = path33.join(dir, file);
52534
- if (fs29.existsSync(target)) continue;
52535
- fs29.mkdirSync(path33.dirname(target), { recursive: true });
52536
- fs29.writeFileSync(target, body);
52667
+ const target = path34.join(dir, file);
52668
+ if (fs30.existsSync(target)) continue;
52669
+ fs30.mkdirSync(path34.dirname(target), { recursive: true });
52670
+ fs30.writeFileSync(target, body);
52537
52671
  }
52538
52672
  return dir;
52539
52673
  }
@@ -52541,10 +52675,10 @@ function getSkillsDir() {
52541
52675
  const pkgPath = (0, import_url3.fileURLToPath)(
52542
52676
  import_meta3.resolve(`${rnxPublicBrand.packageName}/package.json`)
52543
52677
  );
52544
- return primaryCheckoutPath(path33.join(path33.dirname(pkgPath), "skills"));
52678
+ return primaryCheckoutPath(path34.join(path34.dirname(pkgPath), "skills"));
52545
52679
  } catch {
52546
- const __dirname = path33.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
52547
- return primaryCheckoutPath(path33.resolve(__dirname, "../../skills"));
52680
+ const __dirname = path34.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
52681
+ return primaryCheckoutPath(path34.resolve(__dirname, "../../skills"));
52548
52682
  }
52549
52683
  }
52550
52684
  function primaryCheckoutPath(dir) {
@@ -52567,17 +52701,17 @@ function primaryCheckoutPath(dir) {
52567
52701
  } catch {
52568
52702
  return dir;
52569
52703
  }
52570
- if (path33.basename(common) !== ".git") return dir;
52571
- const primary = path33.join(path33.dirname(common), path33.relative(top, dir));
52572
- return fs29.existsSync(primary) ? primary : dir;
52704
+ if (path34.basename(common) !== ".git") return dir;
52705
+ const primary = path34.join(path34.dirname(common), path34.relative(top, dir));
52706
+ return fs30.existsSync(primary) ? primary : dir;
52573
52707
  }
52574
52708
  function skillsDir() {
52575
52709
  skillsDirPath ??= getSkillsDir();
52576
52710
  return skillsDirPath;
52577
52711
  }
52578
52712
  function targetFromHome(envName, fallbackDir) {
52579
- const home = process.env[envName] || path33.join(os9.homedir(), fallbackDir);
52580
- return path33.join(home, "skills");
52713
+ const home = process.env[envName] || path34.join(os9.homedir(), fallbackDir);
52714
+ return path34.join(home, "skills");
52581
52715
  }
52582
52716
  function defaultAgentTargets() {
52583
52717
  return [
@@ -52590,7 +52724,7 @@ function hasInstalledPeachSkills() {
52590
52724
  (file) => /^([^/]+)\/SKILL\.md$/.exec(file)?.[1] ?? []
52591
52725
  ) : listSkills().map((skill7) => skill7.name);
52592
52726
  return defaultAgentTargets().some(
52593
- ({ dir }) => names.some((name2) => fs29.existsSync(path33.join(dir, name2, "SKILL.md")))
52727
+ ({ dir }) => names.some((name2) => fs30.existsSync(path34.join(dir, name2, "SKILL.md")))
52594
52728
  );
52595
52729
  }
52596
52730
  function parseSkillFrontmatter(content) {
@@ -52633,26 +52767,26 @@ function readFrontmatterField(frontmatter, field) {
52633
52767
  return null;
52634
52768
  }
52635
52769
  function listSkills() {
52636
- if (!fs29.existsSync(skillsDir())) return [];
52770
+ if (!fs30.existsSync(skillsDir())) return [];
52637
52771
  const skills = [];
52638
- for (const entry of fs29.readdirSync(skillsDir())) {
52639
- const skillMd = path33.join(skillsDir(), entry, "SKILL.md");
52640
- if (!fs29.existsSync(skillMd)) continue;
52641
- const meta = parseSkillFrontmatter(fs29.readFileSync(skillMd, "utf8"));
52772
+ for (const entry of fs30.readdirSync(skillsDir())) {
52773
+ const skillMd = path34.join(skillsDir(), entry, "SKILL.md");
52774
+ if (!fs30.existsSync(skillMd)) continue;
52775
+ const meta = parseSkillFrontmatter(fs30.readFileSync(skillMd, "utf8"));
52642
52776
  if (meta) {
52643
52777
  skills.push({ name: entry, description: meta.description });
52644
52778
  }
52645
52779
  }
52646
52780
  return skills.sort((a, b) => a.name.localeCompare(b.name));
52647
52781
  }
52648
- var import_child_process7, fs29, os9, path33, import_url3, import_meta3, skillsDirPath;
52782
+ var import_child_process7, fs30, os9, path34, import_url3, import_meta3, skillsDirPath;
52649
52783
  var init_skills = __esm({
52650
52784
  "cli/commands/skills.ts"() {
52651
52785
  "use strict";
52652
52786
  import_child_process7 = require("child_process");
52653
- fs29 = __toESM(require("fs"), 1);
52787
+ fs30 = __toESM(require("fs"), 1);
52654
52788
  os9 = __toESM(require("os"), 1);
52655
- path33 = __toESM(require("path"), 1);
52789
+ path34 = __toESM(require("path"), 1);
52656
52790
  import_url3 = require("url");
52657
52791
  init_cli_version();
52658
52792
  init_home_paths();
@@ -53139,7 +53273,7 @@ function assertExplicitBridgeLock(preferredPort, explicitPort, lock) {
53139
53273
  async function ensureRuntimeForOpen() {
53140
53274
  if (resolveDevCheckoutRuntimeRoot()) return;
53141
53275
  const active = readActiveRuntime();
53142
- if (active && import_node_fs39.default.existsSync(runtimeDir(active))) return;
53276
+ if (active && import_node_fs40.default.existsSync(runtimeDir(active))) return;
53143
53277
  console.error(" installing peach engine runtime...");
53144
53278
  const { runRuntime: runRuntime2 } = await Promise.resolve().then(() => (init_runtime(), runtime_exports));
53145
53279
  await runRuntime2(["install"], {});
@@ -53293,10 +53427,10 @@ async function buildResolvedBundleOpenUrl(target, baseUrl, opts = {}) {
53293
53427
  }
53294
53428
  function normalizeReplacementPath(filePath) {
53295
53429
  if (filePath.startsWith("~/")) {
53296
- return import_node_path41.default.join(import_node_os11.default.homedir(), filePath.slice(2));
53430
+ return import_node_path42.default.join(import_node_os11.default.homedir(), filePath.slice(2));
53297
53431
  }
53298
- if (import_node_path41.default.isAbsolute(filePath)) return filePath;
53299
- return import_node_path41.default.resolve(process.cwd(), filePath);
53432
+ if (import_node_path42.default.isAbsolute(filePath)) return filePath;
53433
+ return import_node_path42.default.resolve(process.cwd(), filePath);
53300
53434
  }
53301
53435
  function parseOpenRuntimeConfig(args) {
53302
53436
  const modules = {};
@@ -53315,7 +53449,7 @@ function parseOpenRuntimeConfig(args) {
53315
53449
  }
53316
53450
  const moduleName = raw2.slice(0, eqIndex).trim();
53317
53451
  const filePath = normalizeReplacementPath(raw2.slice(eqIndex + 1).trim());
53318
- if (!import_node_fs39.default.existsSync(filePath)) {
53452
+ if (!import_node_fs40.default.existsSync(filePath)) {
53319
53453
  console.error(` peach open: replacement file not found: ${filePath}`);
53320
53454
  rnxExit(1);
53321
53455
  }
@@ -53346,7 +53480,7 @@ async function resolveAppProjectForBundleUrl(bundleUrl) {
53346
53480
  return advertisedRoot ? resolveAppProject(advertisedRoot) : null;
53347
53481
  }
53348
53482
  async function ensureConfiguredRuntime(version) {
53349
- if (import_node_fs39.default.existsSync(import_node_path41.default.join(runtimeDir(version), "index.html"))) return;
53483
+ if (import_node_fs40.default.existsSync(import_node_path42.default.join(runtimeDir(version), "index.html"))) return;
53350
53484
  console.error(` installing configured engine runtime ${version}...`);
53351
53485
  const result = await rnxRuntime.install({
53352
53486
  version,
@@ -53682,7 +53816,7 @@ function playwrightHostPidForSim(sim) {
53682
53816
  function signalDriverLaunchConnected(result) {
53683
53817
  if (!result.connectAckFile) return false;
53684
53818
  try {
53685
- import_node_fs39.default.writeFileSync(
53819
+ import_node_fs40.default.writeFileSync(
53686
53820
  result.connectAckFile,
53687
53821
  `${JSON.stringify({ connectedAt: Date.now(), pid: result.pid ?? null })}
53688
53822
  `,
@@ -53696,7 +53830,7 @@ function signalDriverLaunchConnected(result) {
53696
53830
  function readUnservedUrl(result) {
53697
53831
  if (!result.diagnosticLogPath) return null;
53698
53832
  try {
53699
- const detail = import_node_fs39.default.readFileSync(result.diagnosticLogPath, "utf8");
53833
+ const detail = import_node_fs40.default.readFileSync(result.diagnosticLogPath, "utf8");
53700
53834
  const match = detail.match(/\[unserved\] nothing serves (\S+)/);
53701
53835
  return match ? match[1] : null;
53702
53836
  } catch {
@@ -53706,19 +53840,19 @@ function readUnservedUrl(result) {
53706
53840
  function printDriverDiagnosticLogTail(result) {
53707
53841
  if (!result.diagnosticLogPath) return;
53708
53842
  try {
53709
- const detail = import_node_fs39.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
53843
+ const detail = import_node_fs40.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
53710
53844
  if (!detail) {
53711
- console.error(` ${import_node_path41.default.basename(result.diagnosticLogPath)} was empty`);
53845
+ console.error(` ${import_node_path42.default.basename(result.diagnosticLogPath)} was empty`);
53712
53846
  return;
53713
53847
  }
53714
53848
  const shown = detail.length > 4e3 ? `\u2026
53715
53849
  ${detail.slice(-4e3)}` : detail;
53716
- console.error(` ${import_node_path41.default.basename(result.diagnosticLogPath)}:`);
53850
+ console.error(` ${import_node_path42.default.basename(result.diagnosticLogPath)}:`);
53717
53851
  console.error(shown);
53718
53852
  } catch (err) {
53719
53853
  const message = err instanceof Error ? err.message : String(err);
53720
53854
  console.error(
53721
- ` failed to read ${import_node_path41.default.basename(result.diagnosticLogPath)}: ${message}`
53855
+ ` failed to read ${import_node_path42.default.basename(result.diagnosticLogPath)}: ${message}`
53722
53856
  );
53723
53857
  }
53724
53858
  }
@@ -54717,14 +54851,14 @@ async function runCloseCommand(args, opts = {}) {
54717
54851
  bridge.close();
54718
54852
  }
54719
54853
  }
54720
- var import_node_child_process16, import_node_fs39, import_node_os11, import_node_path41, import_app_catalog_wire, import_devices2, import_ws4, DEFAULT_DRIVER_CONNECT_TIMEOUT_MS, DRIVER_CONNECT_INTERVAL_MS, DRIVER_CONNECT_HOST_GRACE_MS, OPEN_BRIDGE_SPAWN_TIMEOUT_MS, SHELL_APPS, DEV_BUNDLE_RESOLVE_ATTEMPTS, DEV_BUNDLE_RESOLVE_INTERVAL_MS;
54854
+ var import_node_child_process16, import_node_fs40, import_node_os11, import_node_path42, import_app_catalog_wire, import_devices2, import_ws4, DEFAULT_DRIVER_CONNECT_TIMEOUT_MS, DRIVER_CONNECT_INTERVAL_MS, DRIVER_CONNECT_HOST_GRACE_MS, OPEN_BRIDGE_SPAWN_TIMEOUT_MS, SHELL_APPS, DEV_BUNDLE_RESOLVE_ATTEMPTS, DEV_BUNDLE_RESOLVE_INTERVAL_MS;
54721
54855
  var init_control = __esm({
54722
54856
  "cli/commands/control.ts"() {
54723
54857
  "use strict";
54724
54858
  import_node_child_process16 = require("node:child_process");
54725
- import_node_fs39 = __toESM(require("node:fs"), 1);
54859
+ import_node_fs40 = __toESM(require("node:fs"), 1);
54726
54860
  import_node_os11 = __toESM(require("node:os"), 1);
54727
- import_node_path41 = __toESM(require("node:path"), 1);
54861
+ import_node_path42 = __toESM(require("node:path"), 1);
54728
54862
  import_app_catalog_wire = require("peach-engine/engine/app-catalog-wire");
54729
54863
  import_devices2 = require("peach-engine/settings/devices");
54730
54864
  import_ws4 = require("ws");
@@ -56179,16 +56313,16 @@ function readRecentShellAppId(state) {
56179
56313
  }
56180
56314
  function resolveProjectRelativeFlowBase(flowDir) {
56181
56315
  if (!flowDir) return process.cwd();
56182
- return path35.basename(flowDir) === ".maestro" ? path35.dirname(flowDir) : flowDir;
56316
+ return path36.basename(flowDir) === ".maestro" ? path36.dirname(flowDir) : flowDir;
56183
56317
  }
56184
56318
  function resolveFlowScreenshotPathWithMode(screenshotDir, name2, opts) {
56185
56319
  const normalizedName = name2.endsWith(".png") ? name2 : `${name2}.png`;
56186
- if (path35.isAbsolute(normalizedName)) return normalizedName;
56320
+ if (path36.isAbsolute(normalizedName)) return normalizedName;
56187
56321
  if (opts.mode === "flow" && /[\\/]/.test(normalizedName)) {
56188
56322
  const baseDir = normalizedName.startsWith("./") || normalizedName.startsWith("../") ? opts.flowDir ?? process.cwd() : resolveProjectRelativeFlowBase(opts.flowDir);
56189
- return path35.resolve(baseDir, normalizedName);
56323
+ return path36.resolve(baseDir, normalizedName);
56190
56324
  }
56191
- return path35.join(screenshotDir, normalizedName);
56325
+ return path36.join(screenshotDir, normalizedName);
56192
56326
  }
56193
56327
  function normalizeFlowScreenshotSpec(step) {
56194
56328
  if (typeof step === "string") {
@@ -56242,12 +56376,12 @@ function normalizeBareStringStep(verb) {
56242
56376
  function parseFlowSteps(content) {
56243
56377
  return parseFlowFile(content).steps;
56244
56378
  }
56245
- var fs32, path35, import_devices4, import_proof_frame, DEFAULT_TIMEOUT, ASSERTION_LOOKUP_MS, FLOW_TIMEOUT_SCALE, scaledTimeout, MAESTRO_SELECTOR_KEYS, SELECTOR_FILTER_KEYS, UNSUPPORTED_SELECTOR_KEYS, ACCESSIBILITY_SELECTOR_KEYS, ACCESSIBILITY_TRAIT_FILTERS, MAESTRO_PERMISSION_KINDS, MAESTRO_PERMISSION_STATUS, SootSimBridgeFlowRunner;
56379
+ var fs33, path36, import_devices4, import_proof_frame, DEFAULT_TIMEOUT, ASSERTION_LOOKUP_MS, FLOW_TIMEOUT_SCALE, scaledTimeout, MAESTRO_SELECTOR_KEYS, SELECTOR_FILTER_KEYS, UNSUPPORTED_SELECTOR_KEYS, ACCESSIBILITY_SELECTOR_KEYS, ACCESSIBILITY_TRAIT_FILTERS, MAESTRO_PERMISSION_KINDS, MAESTRO_PERMISSION_STATUS, SootSimBridgeFlowRunner;
56246
56380
  var init_bridge_flow_runner = __esm({
56247
56381
  "cli/bridge-flow-runner.ts"() {
56248
56382
  "use strict";
56249
- fs32 = __toESM(require("fs"), 1);
56250
- path35 = __toESM(require("path"), 1);
56383
+ fs33 = __toESM(require("fs"), 1);
56384
+ path36 = __toESM(require("path"), 1);
56251
56385
  import_devices4 = require("peach-engine/settings/devices");
56252
56386
  import_proof_frame = __toESM(require_proof_frame(), 1);
56253
56387
  init_flow_timeout_scale();
@@ -56572,14 +56706,14 @@ var init_bridge_flow_runner = __esm({
56572
56706
  if (chunks.length === 0) {
56573
56707
  throw new Error("recording requested but no video buffer was produced");
56574
56708
  }
56575
- fs32.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
56709
+ fs33.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
56576
56710
  const videoMime = stopped.mime || this.opts.recordingFormat || "video/webm";
56577
56711
  const extension = videoMime.includes("mp4") ? "mp4" : "webm";
56578
- const outputPath = path35.join(
56712
+ const outputPath = path36.join(
56579
56713
  this.opts.recordingOutputDir,
56580
56714
  `peach-${Date.now()}.${extension}`
56581
56715
  );
56582
- fs32.writeFileSync(outputPath, Buffer.concat(chunks));
56716
+ fs33.writeFileSync(outputPath, Buffer.concat(chunks));
56583
56717
  return outputPath;
56584
56718
  }
56585
56719
  async waitForRecordingTail(opts) {
@@ -57255,7 +57389,7 @@ var init_bridge_flow_runner = __esm({
57255
57389
  flowDir: this.opts.flowDir
57256
57390
  }
57257
57391
  );
57258
- fs32.mkdirSync(path35.dirname(outputPath), { recursive: true });
57392
+ fs33.mkdirSync(path36.dirname(outputPath), { recursive: true });
57259
57393
  const layers = spec.layers ?? this.opts.screenshotLayers;
57260
57394
  const screenshotRequest = {
57261
57395
  type: "screenshot",
@@ -57290,11 +57424,11 @@ var init_bridge_flow_runner = __esm({
57290
57424
  throw new Error("could not read current device model for framed screenshot");
57291
57425
  }
57292
57426
  const framed = await composeFramedScreenshot(rawBuffer, model);
57293
- fs32.writeFileSync(outputPath, framed);
57427
+ fs33.writeFileSync(outputPath, framed);
57294
57428
  console.log(`[flow] screenshot: ${outputPath} (frame: ${model})`);
57295
57429
  return outputPath;
57296
57430
  }
57297
- fs32.writeFileSync(outputPath, rawBuffer);
57431
+ fs33.writeFileSync(outputPath, rawBuffer);
57298
57432
  console.log(`[flow] screenshot: ${outputPath}`);
57299
57433
  return outputPath;
57300
57434
  }
@@ -57316,10 +57450,10 @@ var init_bridge_flow_runner = __esm({
57316
57450
  // + a11y tree + console errors/warnings + failed network requests +
57317
57451
  // shell state, all under one directory so post-mortem is one grep away.
57318
57452
  async captureFailureBundle(outputDir, context) {
57319
- fs32.mkdirSync(outputDir, { recursive: true });
57453
+ fs33.mkdirSync(outputDir, { recursive: true });
57320
57454
  const write = (name2, content) => {
57321
57455
  try {
57322
- fs32.writeFileSync(path35.join(outputDir, name2), content);
57456
+ fs33.writeFileSync(path36.join(outputDir, name2), content);
57323
57457
  } catch {
57324
57458
  }
57325
57459
  };
@@ -57912,8 +58046,8 @@ var init_bridge_flow_runner = __esm({
57912
58046
  runScript(target) {
57913
58047
  const spec = typeof target === "string" ? { file: target } : target;
57914
58048
  if (!spec.file) throw new Error("runScript requires a file");
57915
- const scriptPath = path35.resolve(this.opts.flowDir, spec.file);
57916
- const source = fs32.readFileSync(scriptPath, "utf8");
58049
+ const scriptPath = path36.resolve(this.opts.flowDir, spec.file);
58050
+ const source = fs33.readFileSync(scriptPath, "utf8");
57917
58051
  this.js.evaluate(source, { env: spec.env });
57918
58052
  console.log(`[flow] runScript: ${spec.file} done`);
57919
58053
  }
@@ -58273,14 +58407,14 @@ var init_bridge_flow_runner = __esm({
58273
58407
  for (const [k, v] of Object.entries(env)) this.js.putEnv(k, v);
58274
58408
  }
58275
58409
  if (file) {
58276
- const flowPath = path35.resolve(this.opts.flowDir, file);
58277
- const flowContent = fs32.readFileSync(flowPath, "utf8");
58410
+ const flowPath = path36.resolve(this.opts.flowDir, file);
58411
+ const flowContent = fs33.readFileSync(flowPath, "utf8");
58278
58412
  const { frontmatter } = parseFlowFile(flowContent);
58279
58413
  if (frontmatter.env && typeof frontmatter.env === "object") {
58280
58414
  this.js.defineVariables(frontmatter.env);
58281
58415
  }
58282
58416
  const previousDir = this.opts.flowDir;
58283
- this.opts.flowDir = path35.dirname(flowPath);
58417
+ this.opts.flowDir = path36.dirname(flowPath);
58284
58418
  try {
58285
58419
  await this.runFlow(parseFlowSteps(flowContent));
58286
58420
  } finally {
@@ -58451,8 +58585,8 @@ __export(registry_exports, {
58451
58585
  skillRegistry: () => skillRegistry
58452
58586
  });
58453
58587
  module.exports = __toCommonJS(registry_exports);
58454
- var fs33 = __toESM(require("fs"), 1);
58455
- var path36 = __toESM(require("path"), 1);
58588
+ var fs34 = __toESM(require("fs"), 1);
58589
+ var path37 = __toESM(require("path"), 1);
58456
58590
 
58457
58591
  // src/skills/builtin/a11y-review.ts
58458
58592
  init_reap_browser();
@@ -58471,8 +58605,8 @@ var skill = {
58471
58605
  },
58472
58606
  async execute(params, context) {
58473
58607
  const { chromium } = await import("playwright");
58474
- const path37 = await import("path");
58475
- const fs34 = await import("fs");
58608
+ const path38 = await import("path");
58609
+ const fs35 = await import("fs");
58476
58610
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
58477
58611
  headless: true
58478
58612
  });
@@ -58529,9 +58663,9 @@ var skill = {
58529
58663
  warnings: issues.filter((i) => i.severity === "warning").length,
58530
58664
  tree: typeof tree === "string" ? tree : JSON.stringify(tree)
58531
58665
  };
58532
- const reportPath = path37.join(context.outputDir, "a11y-report.json");
58533
- fs34.mkdirSync(path37.dirname(reportPath), { recursive: true });
58534
- fs34.writeFileSync(reportPath, JSON.stringify(report, null, 2));
58666
+ const reportPath = path38.join(context.outputDir, "a11y-report.json");
58667
+ fs35.mkdirSync(path38.dirname(reportPath), { recursive: true });
58668
+ fs35.writeFileSync(reportPath, JSON.stringify(report, null, 2));
58535
58669
  return {
58536
58670
  success: issues.filter((i) => i.severity === "error").length === 0,
58537
58671
  message: `${report.errors} errors, ${report.warnings} warnings across ${report.nodeCount} nodes`,
@@ -58564,14 +58698,14 @@ var skill2 = {
58564
58698
  }
58565
58699
  },
58566
58700
  async execute(params, context) {
58567
- const fs34 = await import("node:fs");
58568
- const path37 = await import("node:path");
58701
+ const fs35 = await import("node:fs");
58702
+ const path38 = await import("node:path");
58569
58703
  const { COMPAT_RESULT_CAVEAT: COMPAT_RESULT_CAVEAT2, formatPackageStatus: formatPackageStatus2, formatScanCounts: formatScanCounts2, scanDeps: scanDeps2 } = await Promise.resolve().then(() => (init_web(), web_exports));
58570
- const packagePath = path37.join(context.projectDir, "package.json");
58571
- if (!fs34.existsSync(packagePath)) {
58704
+ const packagePath = path38.join(context.projectDir, "package.json");
58705
+ if (!fs35.existsSync(packagePath)) {
58572
58706
  return { success: false, message: "No package.json found" };
58573
58707
  }
58574
- const parsed = JSON.parse(fs34.readFileSync(packagePath, "utf8"));
58708
+ const parsed = JSON.parse(fs35.readFileSync(packagePath, "utf8"));
58575
58709
  if (!parsed || typeof parsed !== "object") {
58576
58710
  return { success: false, message: "package.json is not an object" };
58577
58711
  }
@@ -58583,9 +58717,9 @@ var skill2 = {
58583
58717
  }) : scanDeps2(parsed);
58584
58718
  const packageResult = params.packageName ? scan.packages[0] : void 0;
58585
58719
  const message = packageResult ? `${params.packageName}: ${formatPackageStatus2(packageResult)}. ${COMPAT_RESULT_CAVEAT2}` : `${formatScanCounts2(scan)}. ${COMPAT_RESULT_CAVEAT2}`;
58586
- const reportPath = path37.join(context.outputDir, "compat-report.json");
58587
- fs34.mkdirSync(path37.dirname(reportPath), { recursive: true });
58588
- fs34.writeFileSync(reportPath, `${JSON.stringify(scan, null, 2)}
58720
+ const reportPath = path38.join(context.outputDir, "compat-report.json");
58721
+ fs35.mkdirSync(path38.dirname(reportPath), { recursive: true });
58722
+ fs35.writeFileSync(reportPath, `${JSON.stringify(scan, null, 2)}
58589
58723
  `);
58590
58724
  return {
58591
58725
  success: true,
@@ -58627,8 +58761,8 @@ var skill3 = {
58627
58761
  record: { type: "boolean", description: "Record video of the flow" }
58628
58762
  },
58629
58763
  async execute(params, context) {
58630
- const fs34 = await import("fs");
58631
- const path37 = await import("path");
58764
+ const fs35 = await import("fs");
58765
+ const path38 = await import("path");
58632
58766
  const yaml = await Promise.resolve().then(() => (init_browser(), browser_exports));
58633
58767
  const { DEFAULT_SOOTSIM_BRIDGE_PORT: DEFAULT_SOOTSIM_BRIDGE_PORT3 } = await Promise.resolve().then(() => (init_bridge_constants(), bridge_constants_exports));
58634
58768
  const { SootSimBridgeHost: SootSimBridgeHost2 } = await Promise.resolve().then(() => (init_bridge_host(), bridge_host_exports));
@@ -58638,7 +58772,7 @@ var skill3 = {
58638
58772
  const host2 = new SootSimBridgeHost2({ port: DEFAULT_SOOTSIM_BRIDGE_PORT3 });
58639
58773
  host2.start({ silent: true });
58640
58774
  try {
58641
- const flowContent = fs34.readFileSync(params.flowPath, "utf8");
58775
+ const flowContent = fs35.readFileSync(params.flowPath, "utf8");
58642
58776
  const fmMatch = flowContent.match(/^---\n([\s\S]*?)\n---\n?/);
58643
58777
  const stepsBody = fmMatch ? flowContent.slice(fmMatch[0].length) : flowContent;
58644
58778
  const steps = yaml.parse(stepsBody);
@@ -58665,7 +58799,7 @@ var skill3 = {
58665
58799
  });
58666
58800
  const driver = new SootSimBridgeFlowRunner2(bridge, {
58667
58801
  screenshotDir: context.outputDir,
58668
- flowDir: path37.dirname(path37.resolve(params.flowPath)),
58802
+ flowDir: path38.dirname(path38.resolve(params.flowPath)),
58669
58803
  simId,
58670
58804
  recordingOutputDir: params.record ? context.outputDir : void 0
58671
58805
  });
@@ -58687,7 +58821,7 @@ var skill3 = {
58687
58821
  simId,
58688
58822
  videoPath: videoPath || void 0
58689
58823
  },
58690
- artifacts: videoPath ? [{ type: "video", name: path37.basename(videoPath), path: videoPath }] : void 0
58824
+ artifacts: videoPath ? [{ type: "video", name: path38.basename(videoPath), path: videoPath }] : void 0
58691
58825
  };
58692
58826
  } finally {
58693
58827
  try {
@@ -58734,8 +58868,8 @@ var skill4 = {
58734
58868
  },
58735
58869
  async execute(params, context) {
58736
58870
  const { chromium } = await import("playwright");
58737
- const path37 = await import("path");
58738
- const fs34 = await import("fs");
58871
+ const path38 = await import("path");
58872
+ const fs35 = await import("fs");
58739
58873
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
58740
58874
  headless: true
58741
58875
  });
@@ -58763,9 +58897,9 @@ var skill4 = {
58763
58897
  ...profile,
58764
58898
  fps: syncCount > 0 ? (syncCount / (duration / 1e3)).toFixed(1) : "0"
58765
58899
  };
58766
- const reportPath = path37.join(context.outputDir, "perf-report.json");
58767
- fs34.mkdirSync(path37.dirname(reportPath), { recursive: true });
58768
- fs34.writeFileSync(reportPath, JSON.stringify(report, null, 2));
58900
+ const reportPath = path38.join(context.outputDir, "perf-report.json");
58901
+ fs35.mkdirSync(path38.dirname(reportPath), { recursive: true });
58902
+ fs35.writeFileSync(reportPath, JSON.stringify(report, null, 2));
58769
58903
  return {
58770
58904
  success: true,
58771
58905
  message: `${report.fps} fps, ${profile.avgSyncMs?.toFixed(1)}ms avg sync, ${nodeCount} nodes`,
@@ -58798,8 +58932,8 @@ var skill5 = {
58798
58932
  },
58799
58933
  async execute(params, context) {
58800
58934
  const { chromium } = await import("playwright");
58801
- const path37 = await import("path");
58802
- const fs34 = await import("fs");
58935
+ const path38 = await import("path");
58936
+ const fs35 = await import("fs");
58803
58937
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
58804
58938
  headless: true
58805
58939
  });
@@ -58807,8 +58941,8 @@ var skill5 = {
58807
58941
  try {
58808
58942
  await page.goto(context.url, { waitUntil: "networkidle" });
58809
58943
  await page.waitForTimeout(2e3);
58810
- const outputPath = path37.join(context.outputDir, `${params.name}.png`);
58811
- fs34.mkdirSync(path37.dirname(outputPath), { recursive: true });
58944
+ const outputPath = path38.join(context.outputDir, `${params.name}.png`);
58945
+ fs35.mkdirSync(path38.dirname(outputPath), { recursive: true });
58812
58946
  await page.screenshot({ path: outputPath });
58813
58947
  return {
58814
58948
  success: true,
@@ -58849,8 +58983,8 @@ var skill6 = {
58849
58983
  },
58850
58984
  async execute(params, context) {
58851
58985
  const { chromium } = await import("playwright");
58852
- const path37 = await import("path");
58853
- const fs34 = await import("fs");
58986
+ const path38 = await import("path");
58987
+ const fs35 = await import("fs");
58854
58988
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
58855
58989
  headless: true
58856
58990
  });
@@ -58858,14 +58992,14 @@ var skill6 = {
58858
58992
  try {
58859
58993
  await page.goto(context.url, { waitUntil: "networkidle" });
58860
58994
  await page.waitForTimeout(2e3);
58861
- const currentPath = path37.join(context.outputDir, `${params.name}-current.png`);
58862
- fs34.mkdirSync(path37.dirname(currentPath), { recursive: true });
58995
+ const currentPath = path38.join(context.outputDir, `${params.name}-current.png`);
58996
+ fs35.mkdirSync(path38.dirname(currentPath), { recursive: true });
58863
58997
  await page.screenshot({ path: currentPath });
58864
58998
  try {
58865
58999
  const { PNG } = await import("pngjs");
58866
59000
  const pixelmatch = (await import("pixelmatch")).default;
58867
- const baseline = PNG.sync.read(fs34.readFileSync(params.baseline));
58868
- const current = PNG.sync.read(fs34.readFileSync(currentPath));
59001
+ const baseline = PNG.sync.read(fs35.readFileSync(params.baseline));
59002
+ const current = PNG.sync.read(fs35.readFileSync(currentPath));
58869
59003
  const { width, height } = baseline;
58870
59004
  const diff = new PNG({ width, height });
58871
59005
  const numDiffPixels = pixelmatch(
@@ -58876,8 +59010,8 @@ var skill6 = {
58876
59010
  height,
58877
59011
  { threshold: params.threshold || 0.1 }
58878
59012
  );
58879
- const diffPath = path37.join(context.outputDir, `${params.name}-diff.png`);
58880
- fs34.writeFileSync(diffPath, PNG.sync.write(diff));
59013
+ const diffPath = path38.join(context.outputDir, `${params.name}-diff.png`);
59014
+ fs35.writeFileSync(diffPath, PNG.sync.write(diff));
58881
59015
  const totalPixels = width * height;
58882
59016
  const diffPercent = (numDiffPixels / totalPixels * 100).toFixed(2);
58883
59017
  return {
@@ -58941,10 +59075,10 @@ var skillRegistry = {
58941
59075
  },
58942
59076
  // load skills from a project manifest (rnx-skills.json)
58943
59077
  async loadFromManifest(projectDir) {
58944
- const manifestPath = path36.join(projectDir, "rnx-skills.json");
58945
- if (!fs33.existsSync(manifestPath)) return;
59078
+ const manifestPath = path37.join(projectDir, "rnx-skills.json");
59079
+ if (!fs34.existsSync(manifestPath)) return;
58946
59080
  try {
58947
- const manifest = JSON.parse(fs33.readFileSync(manifestPath, "utf8"));
59081
+ const manifest = JSON.parse(fs34.readFileSync(manifestPath, "utf8"));
58948
59082
  if (Array.isArray(manifest.skills)) {
58949
59083
  for (const entry of manifest.skills) {
58950
59084
  if (typeof entry === "string") {
@@ -58955,7 +59089,7 @@ var skillRegistry = {
58955
59089
  }
58956
59090
  } else if (entry.file) {
58957
59091
  try {
58958
- const mod = await import(path36.resolve(projectDir, entry.file));
59092
+ const mod = await import(path37.resolve(projectDir, entry.file));
58959
59093
  if (mod.skill) this.register(mod.skill);
58960
59094
  } catch {
58961
59095
  }
@@ -58968,10 +59102,10 @@ var skillRegistry = {
58968
59102
  // auto-discover skills based on project dependencies
58969
59103
  suggestSkills(projectDir) {
58970
59104
  const suggestions = [];
58971
- const pkgPath = path36.join(projectDir, "package.json");
58972
- if (!fs33.existsSync(pkgPath)) return suggestions;
59105
+ const pkgPath = path37.join(projectDir, "package.json");
59106
+ if (!fs34.existsSync(pkgPath)) return suggestions;
58973
59107
  try {
58974
- const pkg = JSON.parse(fs33.readFileSync(pkgPath, "utf8"));
59108
+ const pkg = JSON.parse(fs34.readFileSync(pkgPath, "utf8"));
58975
59109
  const deps = { ...pkg.dependencies, ...pkg.devDependencies };
58976
59110
  if (deps["detox"] || deps["maestro"]) {
58977
59111
  suggestions.push("maestro-test");