peachsim 0.1.795 → 0.1.797

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 (87) 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 -355
  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 +357 -336
  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 +680 -575
  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 -851
  66. package/dist-lib/swift-compile.cjs +18 -4
  67. package/dist-lib/swift-compile.mjs +18 -4
  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 +416 -368
  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 +21 -3
  84. package/src/swift-distribution.lock.json +11 -11
  85. package/src/swift-host.ts +2 -48
  86. package/src/swift-source-file.ts +48 -0
  87. package/src/vite-plugin-one.ts +18 -1
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.795 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.797 | (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
  }
@@ -30608,7 +30719,7 @@ var init_swift_compile = __esm({
30608
30719
  );
30609
30720
  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"';
30610
30721
  ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
30611
- MULTI_MANIFEST_VERSION = 11;
30722
+ MULTI_MANIFEST_VERSION = 12;
30612
30723
  DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
30613
30724
  OS_IOS = /\bos\(\s*iOS\s*\)/g;
30614
30725
  OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
@@ -31100,24 +31211,24 @@ var swift_distribution_lock_default;
31100
31211
  var init_swift_distribution_lock = __esm({
31101
31212
  "src/swift-distribution.lock.json"() {
31102
31213
  swift_distribution_lock_default = {
31103
- id: "487239d0e061dfaa",
31214
+ id: "1a431e89764e8cfa",
31104
31215
  release: "swift-6.3-RELEASE",
31105
- wasmSdkId: "swift-6.3-RELEASE_wasm-peach-41921598-peach-209157d6",
31106
- wasmSdkUrl: "https://r2.sootsim.com/swift-wasm-sdk/swift-6.3-RELEASE_wasm-peach-41921598-peach-209157d6.artifactbundle.tar.gz",
31107
- wasmSdkChecksum: "2b291ff21683ba1063c7362fd5a244fe22af704315f20563abd68c8b4a19b089",
31108
- source: "a3d70fe1a5bcc462e1362c11285327d180e54e28",
31216
+ wasmSdkId: "swift-6.3-RELEASE_wasm-peach-41921598-peach-f2d7f5d4",
31217
+ wasmSdkUrl: "https://r2.sootsim.com/swift-wasm-sdk/swift-6.3-RELEASE_wasm-peach-41921598-peach-f2d7f5d4.artifactbundle.tar.gz",
31218
+ wasmSdkChecksum: "7471b1c145aba62bb9f696aa4d0cd1657cbd9bc7637811b2e6bda1f650553f8d",
31219
+ source: "90d77cf86a77ba84839e5885e1c354a4976f825f",
31109
31220
  hosts: {
31110
31221
  "darwin-arm64": {
31111
- sha256: "361390f1d2f9fee9577fc2253ce67ad40b09bb7946e8e6f3e034f3dc6670fd5b",
31112
- size: 31682452
31222
+ sha256: "ae344e0c60631747c512785d3232be4bc3066d3edbc2916616d43f2a8ee9d759",
31223
+ size: 36453618
31113
31224
  },
31114
31225
  "linux-x64": {
31115
- sha256: "d36ab74f444591458f72dc1d0c3c4032ee1620585a12ce3635fbd6adb8c9a0c8",
31116
- size: 31688001
31226
+ sha256: "16d8f064eaec39e35ee969719481d1f709e9dd08b7112dd83c7c0b8c0b447922",
31227
+ size: 36458677
31117
31228
  },
31118
31229
  "linux-arm64": {
31119
- sha256: "b3f167eb3cbfcf06f1ccf43e3b2cdd94c1a949a0d5ffea03a065a724d306caea",
31120
- size: 31686984
31230
+ sha256: "942892104d80b351b2dc9b414ba72695542ed3b066e0fe9e98d8e42ac760c8df",
31231
+ size: 36457909
31121
31232
  }
31122
31233
  }
31123
31234
  };
@@ -31303,8 +31414,8 @@ function pickImagesetFile(images) {
31303
31414
  scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
31304
31415
  };
31305
31416
  }
31306
- function flatScale(path37) {
31307
- const match = /@([23])x\.[^./]+$/.exec(path37);
31417
+ function flatScale(path38) {
31418
+ const match = /@([23])x\.[^./]+$/.exec(path38);
31308
31419
  return match ? Number(match[1]) : 1;
31309
31420
  }
31310
31421
  function providesNamespace(text3) {
@@ -31331,13 +31442,13 @@ function catalogEntryName(contentsPath, kind, readText2) {
31331
31442
  }
31332
31443
  return segments.join("/");
31333
31444
  }
31334
- function isFlatResourceImage(path37) {
31335
- return path37.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path37));
31445
+ function isFlatResourceImage(path38) {
31446
+ return path38.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path38));
31336
31447
  }
31337
31448
  function enumerateBundleImages(paths, readText2) {
31338
31449
  const table = [];
31339
31450
  const seen = /* @__PURE__ */ new Set();
31340
- const catalogs = paths.filter((path37) => baseOf(path37) === "Contents.json");
31451
+ const catalogs = paths.filter((path38) => baseOf(path38) === "Contents.json");
31341
31452
  for (const contentsPath of catalogs) {
31342
31453
  const name2 = catalogEntryName(contentsPath, ".imageset", readText2);
31343
31454
  if (name2 === null || seen.has(name2)) continue;
@@ -31358,12 +31469,12 @@ function enumerateBundleImages(paths, readText2) {
31358
31469
  seen.add(name2);
31359
31470
  table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
31360
31471
  }
31361
- for (const path37 of paths) {
31362
- if (!isFlatResourceImage(path37)) continue;
31363
- const name2 = baseOf(path37).slice(0, -extOf(path37).length);
31472
+ for (const path38 of paths) {
31473
+ if (!isFlatResourceImage(path38)) continue;
31474
+ const name2 = baseOf(path38).slice(0, -extOf(path38).length);
31364
31475
  if (name2 === "" || seen.has(name2)) continue;
31365
31476
  seen.add(name2);
31366
- table.push({ name: name2, file: path37, scale: flatScale(path37) });
31477
+ table.push({ name: name2, file: path38, scale: flatScale(path38) });
31367
31478
  }
31368
31479
  return table;
31369
31480
  }
@@ -31392,7 +31503,7 @@ function colorsetValue(color) {
31392
31503
  }
31393
31504
  function enumerateBundleColors(paths, readText2) {
31394
31505
  const table = {};
31395
- for (const contentsPath of paths.filter((path37) => baseOf(path37) === "Contents.json")) {
31506
+ for (const contentsPath of paths.filter((path38) => baseOf(path38) === "Contents.json")) {
31396
31507
  const name2 = catalogEntryName(contentsPath, ".colorset", readText2);
31397
31508
  if (name2 === null || name2 in table) continue;
31398
31509
  let colors;
@@ -31456,8 +31567,8 @@ function axisExtremes(points) {
31456
31567
  function pathBounds(d) {
31457
31568
  const xs = [];
31458
31569
  const ys = [];
31459
- for (const path37 of d)
31460
- (0, import_svgpath.default)(path37).abs().unshort().unarc().iterate((segment, _index, x, y) => {
31570
+ for (const path38 of d)
31571
+ (0, import_svgpath.default)(path38).abs().unshort().unarc().iterate((segment, _index, x, y) => {
31461
31572
  const [command, ...args] = segment;
31462
31573
  if (command === "M" || command === "L") {
31463
31574
  xs.push(Number(args[0]));
@@ -31484,7 +31595,7 @@ function guide(svg, id, axis) {
31484
31595
  }
31485
31596
  function enumerateBundleSymbols(paths, readText2) {
31486
31597
  const table = {};
31487
- for (const contentsPath of paths.filter((path37) => baseOf(path37) === "Contents.json")) {
31598
+ for (const contentsPath of paths.filter((path38) => baseOf(path38) === "Contents.json")) {
31488
31599
  const name2 = catalogEntryName(contentsPath, ".symbolset", readText2);
31489
31600
  if (name2 === null || name2 in table) continue;
31490
31601
  let symbols;
@@ -31517,8 +31628,8 @@ function enumerateBundleSymbols(paths, readText2) {
31517
31628
  viewBox: "0 0 24 24",
31518
31629
  advance,
31519
31630
  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()
31631
+ layers: d.map((path38) => ({
31632
+ d: (0, import_svgpath.default)(path38).abs().scale(scale).translate(translateX, translateY).round(3).toString()
31522
31633
  }))
31523
31634
  };
31524
31635
  }
@@ -31528,7 +31639,7 @@ function enumerateBundleJson(paths) {
31528
31639
  const found = [];
31529
31640
  const seen = /* @__PURE__ */ new Set();
31530
31641
  const ordered = [...paths].filter(
31531
- (path37) => path37.split("/").includes("Resources") && path37.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path37) === ".json" || extOf(path37) === ".xcstrings")
31642
+ (path38) => path38.split("/").includes("Resources") && path38.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path38) === ".json" || extOf(path38) === ".xcstrings")
31532
31643
  ).sort((a, b) => {
31533
31644
  const aDepth = a.split("/").length;
31534
31645
  const bDepth = b.split("/").length;
@@ -32630,6 +32741,57 @@ var init_swift_packages = __esm({
32630
32741
  }
32631
32742
  });
32632
32743
 
32744
+ // src/swift-source-file.ts
32745
+ function readPackageFile(root, file, maxBytes) {
32746
+ const canonicalRoot = import_node_fs16.default.realpathSync(root);
32747
+ const relative3 = import_node_path16.default.relative(canonicalRoot, import_node_fs16.default.realpathSync(file));
32748
+ if (relative3 === ".." || relative3.startsWith(`..${import_node_path16.default.sep}`) || import_node_path16.default.isAbsolute(relative3)) {
32749
+ throw new Error(`swift input escapes the selected package: ${file}`);
32750
+ }
32751
+ let ancestor = import_node_path16.default.resolve(file);
32752
+ while (ancestor !== canonicalRoot) {
32753
+ if (import_node_fs16.default.lstatSync(ancestor).isSymbolicLink()) {
32754
+ throw new Error(`swift input is a symlink: ${ancestor}`);
32755
+ }
32756
+ const parent = import_node_path16.default.dirname(ancestor);
32757
+ if (parent === ancestor)
32758
+ throw new Error(`swift input escapes the selected package: ${file}`);
32759
+ ancestor = parent;
32760
+ }
32761
+ const expected = import_node_fs16.default.statSync(file);
32762
+ const fd = import_node_fs16.default.openSync(file, import_node_fs16.default.constants.O_RDONLY | import_node_fs16.default.constants.O_NOFOLLOW);
32763
+ try {
32764
+ const stat2 = import_node_fs16.default.fstatSync(fd);
32765
+ if (stat2.dev !== expected.dev || stat2.ino !== expected.ino) {
32766
+ throw new Error(`swift input changed while opening: ${file}`);
32767
+ }
32768
+ if (!stat2.isFile() || stat2.size > maxBytes) {
32769
+ throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
32770
+ }
32771
+ const bytes = Buffer.alloc(stat2.size + 1);
32772
+ let offset = 0;
32773
+ while (offset < bytes.length) {
32774
+ const count = import_node_fs16.default.readSync(fd, bytes, offset, bytes.length - offset, null);
32775
+ if (count === 0) break;
32776
+ offset += count;
32777
+ }
32778
+ if (offset !== stat2.size || import_node_fs16.default.fstatSync(fd).size !== stat2.size) {
32779
+ throw new Error(`swift input changed while reading: ${file}`);
32780
+ }
32781
+ return bytes.subarray(0, offset);
32782
+ } finally {
32783
+ import_node_fs16.default.closeSync(fd);
32784
+ }
32785
+ }
32786
+ var import_node_fs16, import_node_path16;
32787
+ var init_swift_source_file = __esm({
32788
+ "src/swift-source-file.ts"() {
32789
+ "use strict";
32790
+ import_node_fs16 = __toESM(require("node:fs"), 1);
32791
+ import_node_path16 = __toESM(require("node:path"), 1);
32792
+ }
32793
+ });
32794
+
32633
32795
  // src/swift-standin-emit.ts
32634
32796
  function splitAccessors(core) {
32635
32797
  const match = /\{\s*([^}]*)\}\s*$/.exec(core);
@@ -32778,10 +32940,10 @@ function emitSwiftStandin(graphs, options) {
32778
32940
  owners.push(...physical.map(() => current));
32779
32941
  };
32780
32942
  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) });
32943
+ const path38 = pathOf(symbol);
32944
+ if (omit.has(path38)) return void skipped.push({ path: path38, reason: omit.get(path38) });
32783
32945
  const previous = current;
32784
- current = path37;
32946
+ current = path38;
32785
32947
  try {
32786
32948
  body(symbol, ...rest);
32787
32949
  } finally {
@@ -32801,14 +32963,14 @@ function emitSwiftStandin(graphs, options) {
32801
32963
  const access = (symbol, openOwner) => symbol.accessLevel === "open" && openOwner ? "open" : "public";
32802
32964
  const emitMember = scoped(
32803
32965
  (member, indent, context) => {
32804
- const path37 = pathOf(member);
32966
+ const path38 = pathOf(member);
32805
32967
  if (TYPE_KINDS.has(member.kind.identifier)) {
32806
32968
  emitType(member, indent);
32807
32969
  return;
32808
32970
  }
32809
32971
  if (member.kind.identifier === "swift.enum.case") return;
32810
32972
  if (!MEMBER_KINDS.has(member.kind.identifier)) {
32811
- skipped.push({ path: path37, reason: `unhandled ${member.kind.identifier}` });
32973
+ skipped.push({ path: path38, reason: `unhandled ${member.kind.identifier}` });
32812
32974
  return;
32813
32975
  }
32814
32976
  const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(member));
@@ -32822,12 +32984,12 @@ function emitSwiftStandin(graphs, options) {
32822
32984
  const final = context.inClass && flags.has("final") ? "final " : "";
32823
32985
  const mutating = flags.has("mutating") ? "mutating " : flags.has("nonmutating") ? "nonmutating " : "";
32824
32986
  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 " : "";
32987
+ 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
32988
  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);
32989
+ const measured = behavior.get(path38);
32990
+ if (measured) used.add(path38);
32829
32991
  const overloadBody = /\basync\b/.test(core) ? measured?.asyncBody : /\bResult</.test(core) ? measured?.resultBody : void 0;
32830
- const body = overloadBody ?? measured?.body ?? trap(path37);
32992
+ const body = overloadBody ?? measured?.body ?? trap(path38);
32831
32993
  switch (member.kind.identifier) {
32832
32994
  case "swift.property":
32833
32995
  case "swift.type.property":
@@ -32848,7 +33010,7 @@ function emitSwiftStandin(graphs, options) {
32848
33010
  return;
32849
33011
  }
32850
33012
  emit(
32851
- `${head}${computed} { get${effects} { ${body} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? trap(path37)} }` : ""} }`
33013
+ `${head}${computed} { get${effects} { ${body} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? trap(path38)} }` : ""} }`
32852
33014
  );
32853
33015
  return;
32854
33016
  }
@@ -32901,7 +33063,7 @@ function emitSwiftStandin(graphs, options) {
32901
33063
  };
32902
33064
  const emitType = scoped(
32903
33065
  (symbol, indent) => {
32904
- const path37 = pathOf(symbol);
33066
+ const path38 = pathOf(symbol);
32905
33067
  const id = symbol.identifier.precise;
32906
33068
  const inner = `${indent} `;
32907
33069
  switch (symbol.kind.identifier) {
@@ -32913,10 +33075,10 @@ function emitSwiftStandin(graphs, options) {
32913
33075
  case "swift.class": {
32914
33076
  const shape = header(symbol, "class", indent);
32915
33077
  if (!shape)
32916
- return void skipped.push({ path: path37, reason: `unparsed class ${text(symbol)}` });
32917
- const parent = options.superclasses?.get(path37) ?? superclass.get(id);
33078
+ return void skipped.push({ path: path38, reason: `unparsed class ${text(symbol)}` });
33079
+ const parent = options.superclasses?.get(path38) ?? superclass.get(id);
32918
33080
  const blocked = classBlocked(id);
32919
- if (blocked) return void skipped.push({ path: path37, reason: blocked });
33081
+ if (blocked) return void skipped.push({ path: path38, reason: blocked });
32920
33082
  const ancestors = /* @__PURE__ */ new Set();
32921
33083
  for (let at = superId.get(id); at; at = superId.get(at))
32922
33084
  for (const name2 of conforms.get(at) ?? []) ancestors.add(name2);
@@ -32932,9 +33094,9 @@ function emitSwiftStandin(graphs, options) {
32932
33094
  `${indent}${shape.attrs}${open ? "open" : "public"} class ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${selfConforming(shape.where)} {`
32933
33095
  );
32934
33096
  const members = membersOf(id);
32935
- const extra = options.behavior?.get(path37)?.members;
33097
+ const extra = options.behavior?.get(path38)?.members;
32936
33098
  if (extra) {
32937
- used.add(path37);
33099
+ used.add(path38);
32938
33100
  emit(`${inner}${extra}`);
32939
33101
  }
32940
33102
  for (const member of members)
@@ -32987,13 +33149,13 @@ function emitSwiftStandin(graphs, options) {
32987
33149
  continue;
32988
33150
  have.add(witnessKey(member));
32989
33151
  have.add(sideLeaf(member));
32990
- emitWitness(member, inner, path37);
33152
+ emitWitness(member, inner, path38);
32991
33153
  }
32992
33154
  }
32993
33155
  const coder = members.some((member) => leaf(member) === "init(coder:)");
32994
33156
  if (designated && !coder && externalRoot(id) !== "NSObject" && externalRoot(id) !== null)
32995
33157
  emit(
32996
- `${inner}public required init?(coder: NSCoder) { ${trap(`${path37}.init(coder:)`)} }`
33158
+ `${inner}public required init?(coder: NSCoder) { ${trap(`${path38}.init(coder:)`)} }`
32997
33159
  );
32998
33160
  emit(`${indent}}`);
32999
33161
  return;
@@ -33001,7 +33163,7 @@ function emitSwiftStandin(graphs, options) {
33001
33163
  case "swift.struct": {
33002
33164
  const shape = header(symbol, "struct", indent);
33003
33165
  if (!shape)
33004
- return void skipped.push({ path: path37, reason: `unparsed struct ${text(symbol)}` });
33166
+ return void skipped.push({ path: path38, reason: `unparsed struct ${text(symbol)}` });
33005
33167
  const members = membersOf(id);
33006
33168
  const raw2 = rawType(members);
33007
33169
  const list2 = inheritance(id);
@@ -33052,7 +33214,7 @@ function emitSwiftStandin(graphs, options) {
33052
33214
  case "swift.enum": {
33053
33215
  const shape = header(symbol, "enum", indent);
33054
33216
  if (!shape)
33055
- return void skipped.push({ path: path37, reason: `unparsed enum ${text(symbol)}` });
33217
+ return void skipped.push({ path: path38, reason: `unparsed enum ${text(symbol)}` });
33056
33218
  const members = membersOf(id);
33057
33219
  const raw2 = rawType(members);
33058
33220
  const cases = (children.get(id) ?? []).filter(
@@ -33061,7 +33223,7 @@ function emitSwiftStandin(graphs, options) {
33061
33223
  const missing = raw2 ? cases.filter((member) => !values.has(member.identifier.precise)) : [];
33062
33224
  if (raw2 && isObjC(symbol) && missing.length > 0)
33063
33225
  return void skipped.push({
33064
- path: path37,
33226
+ path: path38,
33065
33227
  reason: `no header value for ${missing.map(leaf).join(", ")}`
33066
33228
  });
33067
33229
  const list2 = inheritance(id, raw2 ?? void 0).filter(
@@ -33102,7 +33264,7 @@ function emitSwiftStandin(graphs, options) {
33102
33264
  const shape = header(symbol, "protocol", indent);
33103
33265
  if (!shape)
33104
33266
  return void skipped.push({
33105
- path: path37,
33267
+ path: path38,
33106
33268
  reason: `unparsed protocol ${text(symbol)}`
33107
33269
  });
33108
33270
  const list2 = [...isObjC(symbol) ? ["AnyObject"] : [], ...inheritance(id)];
@@ -33127,7 +33289,7 @@ function emitSwiftStandin(graphs, options) {
33127
33289
  }
33128
33290
  emit(`${indent}}`);
33129
33291
  if (defaults.length > 0) {
33130
- emit(`${indent}extension ${path37} {`);
33292
+ emit(`${indent}extension ${path38} {`);
33131
33293
  for (const member of defaults) {
33132
33294
  const decl = text(member);
33133
33295
  if (optional.has(member.identifier.precise) && member.kind.identifier === "swift.method" && !decl.replace(/\([^)]*\)/g, "").includes("->") && !/ async\b/.test(decl))
@@ -33174,7 +33336,7 @@ function emitSwiftStandin(graphs, options) {
33174
33336
  return init ? /rawValue:\s*([^)]+)\)/.exec(text(init))?.[1]?.trim() ?? null : null;
33175
33337
  };
33176
33338
  const emitGlobal = scoped((symbol) => {
33177
- const path37 = pathOf(symbol);
33339
+ const path38 = pathOf(symbol);
33178
33340
  const kind = symbol.kind.identifier;
33179
33341
  if (kind === "swift.func" || kind === "swift.func.op" || kind === "swift.method" || kind === "swift.type.method") {
33180
33342
  const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(symbol));
@@ -33185,17 +33347,17 @@ function emitSwiftStandin(graphs, options) {
33185
33347
  if (fix && !/^(?:prefix|infix|postfix)\b/.test(spelled))
33186
33348
  spelled = `${fix} ${spelled}`;
33187
33349
  }
33188
- emit(`${attrs}public ${spelled} { ${trap(path37)} }`);
33350
+ emit(`${attrs}public ${spelled} { ${trap(path38)} }`);
33189
33351
  } else if (kind === "swift.var") {
33190
33352
  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}` });
33353
+ const measured = behavior.get(path38);
33354
+ if (measured) used.add(path38);
33355
+ emit(`public ${parsed.decl} { ${measured?.body ?? trap(path38)} }`);
33356
+ } else skipped.push({ path: path38, reason: `unhandled top-level ${kind}` });
33195
33357
  });
33196
33358
  const roots = [...byId.values()].filter((symbol) => !owner.has(symbol.identifier.precise) && !unavailable(symbol)).sort((a, b) => pathOf(a).localeCompare(pathOf(b)));
33197
33359
  for (const symbol of roots) {
33198
- const path37 = pathOf(symbol);
33360
+ const path38 = pathOf(symbol);
33199
33361
  if (TYPE_KINDS.has(symbol.kind.identifier)) emitType(symbol, "");
33200
33362
  else emitGlobal(symbol);
33201
33363
  }
@@ -33237,9 +33399,9 @@ function emitSwiftStandin(graphs, options) {
33237
33399
  ...imports.map((name2) => `import ${name2}`),
33238
33400
  ""
33239
33401
  ];
33240
- for (const path37 of behavior.keys())
33241
- if (!used.has(path37))
33242
- skipped.push({ path: path37, reason: "behavior names no emitted declaration" });
33402
+ for (const path38 of behavior.keys())
33403
+ if (!used.has(path38))
33404
+ skipped.push({ path: path38, reason: "behavior names no emitted declaration" });
33243
33405
  return {
33244
33406
  source: `${[...banner, ...lines].join("\n")}
33245
33407
  `,
@@ -33325,7 +33487,7 @@ var init_swift_standin_emit = __esm({
33325
33487
  sideLeaf = (symbol) => `${symbol.kind.identifier.startsWith("swift.type.") ? "type" : "instance"}|leaf|${leaf(symbol)}`;
33326
33488
  isObjC = (symbol) => symbol.identifier.precise.startsWith("c:");
33327
33489
  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")`;
33490
+ trap = (path38) => `fatalError("${path38} is a binary framework peach cannot run")`;
33329
33491
  KEYWORDS = /* @__PURE__ */ new Set([
33330
33492
  "Type",
33331
33493
  "Protocol",
@@ -33383,15 +33545,15 @@ ${"stdout" in error ? String(error.stdout) : ""}` : String(error);
33383
33545
  function treeDigest(root) {
33384
33546
  const names = [];
33385
33547
  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);
33548
+ for (const entry of import_node_fs17.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
33549
+ const full = import_node_path17.default.join(dir, entry.name);
33388
33550
  if (entry.isDirectory()) walk2(full);
33389
- else if (entry.isFile()) names.push(import_node_path16.default.relative(root, full));
33551
+ else if (entry.isFile()) names.push(import_node_path17.default.relative(root, full));
33390
33552
  }
33391
33553
  };
33392
33554
  walk2(root);
33393
33555
  const stamp = names.map((name2) => {
33394
- const stat2 = import_node_fs16.default.statSync(import_node_path16.default.join(root, name2));
33556
+ const stat2 = import_node_fs17.default.statSync(import_node_path17.default.join(root, name2));
33395
33557
  return `${name2}\0${stat2.size}:${stat2.mtimeMs}`;
33396
33558
  }).join("\n");
33397
33559
  const memo2 = digests.get(`tree\0${root}`);
@@ -33399,7 +33561,7 @@ function treeDigest(root) {
33399
33561
  const hash = (0, import_node_crypto7.createHash)("sha256");
33400
33562
  for (const name2 of names) {
33401
33563
  hash.update(`${name2}\0`);
33402
- hash.update(import_node_fs16.default.readFileSync(import_node_path16.default.join(root, name2)));
33564
+ hash.update(import_node_fs17.default.readFileSync(import_node_path17.default.join(root, name2)));
33403
33565
  hash.update("\0");
33404
33566
  }
33405
33567
  const digest = hash.digest("hex");
@@ -33408,9 +33570,9 @@ function treeDigest(root) {
33408
33570
  }
33409
33571
  function locateXcframework(tree) {
33410
33572
  const find = (root, depth) => {
33411
- for (const entry of import_node_fs16.default.readdirSync(root, { withFileTypes: true })) {
33573
+ for (const entry of import_node_fs17.default.readdirSync(root, { withFileTypes: true })) {
33412
33574
  if (!entry.isDirectory() || entry.name === "__MACOSX") continue;
33413
- const full = import_node_path16.default.join(root, entry.name);
33575
+ const full = import_node_path17.default.join(root, entry.name);
33414
33576
  if (entry.name.endsWith(".xcframework")) return full;
33415
33577
  const nested = depth > 0 ? find(full, depth - 1) : null;
33416
33578
  if (nested) return nested;
@@ -33425,66 +33587,66 @@ function xcframework(binary2) {
33425
33587
  if (binary2.url && (!binary2.checksum || !/^[a-f0-9]{64}$/i.test(binary2.checksum)))
33426
33588
  throw new Error("remote binary archive requires its Package.swift SHA-256 checksum");
33427
33589
  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");
33590
+ const dir = import_node_path17.default.join(cacheDir4, "archives", key(binary2.url ? expected : binary2.dir));
33591
+ const archive = import_node_path17.default.join(dir, "archive.zip");
33592
+ const fingerprint = import_node_path17.default.join(dir, ".fingerprint");
33431
33593
  const stored = (() => {
33432
33594
  try {
33433
- const parsed = JSON.parse(import_node_fs16.default.readFileSync(fingerprint, "utf8"));
33595
+ const parsed = JSON.parse(import_node_fs17.default.readFileSync(fingerprint, "utf8"));
33434
33596
  return parsed && typeof parsed === "object" && "sha" in parsed ? parsed : null;
33435
33597
  } catch {
33436
33598
  return null;
33437
33599
  }
33438
33600
  })();
33439
33601
  if (!binary2.url) {
33440
- const stat2 = import_node_fs16.default.statSync(binary2.dir);
33602
+ const stat2 = import_node_fs17.default.statSync(binary2.dir);
33441
33603
  const stamp = `${stat2.size}:${stat2.mtimeMs}`;
33442
33604
  if (stored?.stamp === stamp) {
33443
- const found3 = locateXcframework(import_node_path16.default.join(dir, "tree"));
33605
+ const found3 = locateXcframework(import_node_path17.default.join(dir, "tree"));
33444
33606
  if (found3) return { dir: found3, digest: stored.sha };
33445
33607
  }
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")]);
33608
+ const sha2 = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs17.default.readFileSync(binary2.dir)).digest("hex");
33609
+ if (sha2 !== stored?.sha || !locateXcframework(import_node_path17.default.join(dir, "tree"))) {
33610
+ import_node_fs17.default.rmSync(dir, { recursive: true, force: true });
33611
+ import_node_fs17.default.mkdirSync(import_node_path17.default.join(dir, "tree"), { recursive: true });
33612
+ exec("unzip", ["-q", binary2.dir, "-d", import_node_path17.default.join(dir, "tree")]);
33451
33613
  }
33452
- import_node_fs16.default.writeFileSync(fingerprint, JSON.stringify({ stamp, sha: sha2 }));
33453
- const found2 = locateXcframework(import_node_path16.default.join(dir, "tree"));
33614
+ import_node_fs17.default.writeFileSync(fingerprint, JSON.stringify({ stamp, sha: sha2 }));
33615
+ const found2 = locateXcframework(import_node_path17.default.join(dir, "tree"));
33454
33616
  if (!found2) throw new Error("its archive holds no .xcframework");
33455
33617
  return { dir: found2, digest: sha2 };
33456
33618
  }
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");
33619
+ if (stored && import_node_fs17.default.existsSync(archive)) {
33620
+ const sha2 = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs17.default.readFileSync(archive)).digest("hex");
33459
33621
  if (sha2 !== expected)
33460
33622
  throw new Error(`archive checksum ${sha2} is not the declared checksum ${expected}`);
33461
- const found2 = locateXcframework(import_node_path16.default.join(dir, "tree"));
33623
+ const found2 = locateXcframework(import_node_path17.default.join(dir, "tree"));
33462
33624
  if (found2) return { dir: found2, digest: sha2 };
33463
33625
  }
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 });
33626
+ import_node_fs17.default.rmSync(dir, { recursive: true, force: true });
33627
+ import_node_fs17.default.mkdirSync(import_node_path17.default.join(dir, "tree"), { recursive: true });
33466
33628
  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");
33629
+ const sha = (0, import_node_crypto7.createHash)("sha256").update(import_node_fs17.default.readFileSync(archive)).digest("hex");
33468
33630
  if (sha !== expected) {
33469
- import_node_fs16.default.rmSync(dir, { recursive: true, force: true });
33631
+ import_node_fs17.default.rmSync(dir, { recursive: true, force: true });
33470
33632
  throw new Error(`archive checksum ${sha} is not the declared checksum ${expected}`);
33471
33633
  }
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"));
33634
+ exec("unzip", ["-q", archive, "-d", import_node_path17.default.join(dir, "tree")]);
33635
+ import_node_fs17.default.writeFileSync(fingerprint, JSON.stringify({ sha }));
33636
+ const found = locateXcframework(import_node_path17.default.join(dir, "tree"));
33475
33637
  if (!found) throw new Error("its archive holds no .xcframework");
33476
33638
  return { dir: found, digest: sha };
33477
33639
  }
33478
33640
  function surfaces(xcframeworkDir) {
33479
- const slice = import_node_fs16.default.readdirSync(xcframeworkDir).filter((name2) => /^ios-.+-simulator$/.test(name2)).sort()[0];
33641
+ const slice = import_node_fs17.default.readdirSync(xcframeworkDir).filter((name2) => /^ios-.+-simulator$/.test(name2)).sort()[0];
33480
33642
  if (!slice) throw new Error("it has no iOS simulator slice");
33481
- const root = import_node_path16.default.join(xcframeworkDir, slice);
33643
+ const root = import_node_path17.default.join(xcframeworkDir, slice);
33482
33644
  const found = [];
33483
- for (const entry of import_node_fs16.default.readdirSync(root).sort()) {
33645
+ for (const entry of import_node_fs17.default.readdirSync(root).sort()) {
33484
33646
  if (!entry.endsWith(".framework")) continue;
33485
33647
  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`);
33648
+ const framework = import_node_path17.default.join(root, entry);
33649
+ const swiftmodule = import_node_path17.default.join(framework, "Modules", `${module2}.swiftmodule`);
33488
33650
  const interfaces = files(
33489
33651
  swiftmodule,
33490
33652
  (name2) => name2.endsWith(".swiftinterface") && !name2.endsWith(".private.swiftinterface") && !name2.endsWith(".package.swiftinterface")
@@ -33494,41 +33656,41 @@ function surfaces(xcframeworkDir) {
33494
33656
  found.push({
33495
33657
  kind: "swift",
33496
33658
  module: module2,
33497
- interface: import_node_path16.default.join(swiftmodule, chosen)
33659
+ interface: import_node_path17.default.join(swiftmodule, chosen)
33498
33660
  });
33499
33661
  continue;
33500
33662
  }
33501
- const modulemap = import_node_path16.default.join(framework, "Modules", "module.modulemap");
33502
- if (import_node_fs16.default.existsSync(modulemap))
33663
+ const modulemap = import_node_path17.default.join(framework, "Modules", "module.modulemap");
33664
+ if (import_node_fs17.default.existsSync(modulemap))
33503
33665
  found.push({
33504
33666
  kind: "c",
33505
33667
  module: module2,
33506
33668
  modulemap,
33507
- headers: import_node_path16.default.join(framework, "Headers")
33669
+ headers: import_node_path17.default.join(framework, "Headers")
33508
33670
  });
33509
33671
  }
33510
- const headers = import_node_path16.default.join(root, "Headers");
33672
+ const headers = import_node_path17.default.join(root, "Headers");
33511
33673
  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];
33674
+ const modulemap = import_node_path17.default.join(headers, map2);
33675
+ const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs17.default.readFileSync(modulemap, "utf8"))?.[1];
33514
33676
  if (module2) found.push({ kind: "c", module: module2, modulemap, headers });
33515
33677
  }
33516
33678
  return found;
33517
33679
  }
33518
33680
  function peachModuleDirs(toolchain, imports) {
33519
33681
  const { moduleRoot, toolchainBin } = toolchain;
33520
- if (swiftDistributionAt(moduleRoot)) return [import_node_path16.default.join(moduleRoot, "modules")];
33682
+ if (swiftDistributionAt(moduleRoot)) return [import_node_path17.default.join(moduleRoot, "modules")];
33521
33683
  const peach = new Set(swiftPeachModules(moduleRoot));
33522
33684
  const plugins = swiftMacroPlugins(moduleRoot);
33523
33685
  if (plugins.stale)
33524
33686
  exec("sh", [
33525
- import_node_path16.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
33687
+ import_node_path17.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
33526
33688
  toolchainBin,
33527
33689
  plugins.libraries[0]
33528
33690
  ]);
33529
33691
  for (const target of imports.filter((name2) => peach.has(name2)))
33530
33692
  exec(
33531
- import_node_path16.default.join(toolchainBin, "swift"),
33693
+ import_node_path17.default.join(toolchainBin, "swift"),
33532
33694
  [
33533
33695
  "build",
33534
33696
  "--swift-sdk",
@@ -33548,7 +33710,7 @@ function peachModuleDirs(toolchain, imports) {
33548
33710
  ],
33549
33711
  moduleRoot
33550
33712
  );
33551
- return [import_node_path16.default.join(moduleRoot, ".build", TRIPLE, "release", "Modules")];
33713
+ return [import_node_path17.default.join(moduleRoot, ".build", TRIPLE, "release", "Modules")];
33552
33714
  }
33553
33715
  function swiftInterfaceForWasm(text3) {
33554
33716
  return text3.replace(
@@ -33560,11 +33722,11 @@ function swiftInterfaceForWasm(text3) {
33560
33722
  );
33561
33723
  }
33562
33724
  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);
33725
+ const text3 = swiftInterfaceForWasm(import_node_fs17.default.readFileSync(surface.interface, "utf8"));
33726
+ const search = import_node_path17.default.join(work, "interfaces");
33727
+ const moduleDir = import_node_path17.default.join(search, `${surface.module}.swiftmodule`);
33728
+ import_node_fs17.default.mkdirSync(moduleDir, { recursive: true });
33729
+ import_node_fs17.default.writeFileSync(import_node_path17.default.join(moduleDir, `${TRIPLE}.swiftinterface`), text3);
33568
33730
  const imports = [
33569
33731
  ...text3.matchAll(
33570
33732
  /^(?:@_exported[ \t]+)?import[ \t]+(?:(?:struct|class|enum|protocol|typealias|func|var|let)[ \t]+)?(\w+)/gm
@@ -33576,9 +33738,9 @@ function swiftStandin(surface, binary2, toolchain, work) {
33576
33738
  );
33577
33739
  const target = ["-target", TRIPLE, "-sdk", sysroot, "-resource-dir", resources];
33578
33740
  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"), [
33741
+ const out = import_node_path17.default.join(work, "graphs");
33742
+ import_node_fs17.default.mkdirSync(out, { recursive: true });
33743
+ exec(import_node_path17.default.join(toolchain.toolchainBin, "swift-symbolgraph-extract"), [
33582
33744
  "-module-name",
33583
33745
  surface.module,
33584
33746
  ...target,
@@ -33592,10 +33754,10 @@ function swiftStandin(surface, binary2, toolchain, work) {
33592
33754
  "-output-dir",
33593
33755
  out
33594
33756
  ]);
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")));
33757
+ 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
33758
  const omit = /* @__PURE__ */ new Map();
33597
33759
  const plain = /* @__PURE__ */ new Set();
33598
- const file = import_node_path16.default.join(work, `${surface.module}.swift`);
33760
+ const file = import_node_path17.default.join(work, `${surface.module}.swift`);
33599
33761
  for (; ; ) {
33600
33762
  const { source, owners } = emitSwiftStandin(graphs, {
33601
33763
  module: surface.module,
@@ -33603,9 +33765,9 @@ function swiftStandin(surface, binary2, toolchain, work) {
33603
33765
  omit,
33604
33766
  plain
33605
33767
  });
33606
- import_node_fs16.default.writeFileSync(file, source);
33768
+ import_node_fs17.default.writeFileSync(file, source);
33607
33769
  const check = (0, import_node_child_process9.spawnSync)(
33608
- import_node_path16.default.join(toolchain.toolchainBin, "swiftc"),
33770
+ import_node_path17.default.join(toolchain.toolchainBin, "swiftc"),
33609
33771
  [
33610
33772
  "-typecheck",
33611
33773
  "-parse-as-library",
@@ -33753,21 +33915,21 @@ function splitDeclarators(statement, names) {
33753
33915
  }
33754
33916
  function cStandin(surface, binary2, toolchain, work) {
33755
33917
  const named = [
33756
- ...import_node_fs16.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
33918
+ ...import_node_fs17.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
33757
33919
  ].map((match) => match[1]);
33758
33920
  const headers = files(surface.headers, (name2) => name2.endsWith(".h"));
33759
33921
  const texts = new Map(
33760
33922
  headers.map((file) => [
33761
33923
  file,
33762
- import_node_fs16.default.readFileSync(import_node_path16.default.join(surface.headers, file), "utf8")
33924
+ import_node_fs17.default.readFileSync(import_node_path17.default.join(surface.headers, file), "utf8")
33763
33925
  ])
33764
33926
  );
33765
33927
  const objc = headers.find((file) => OBJC.test(texts.get(file)));
33766
33928
  if (objc) throw new Error(`its header ${objc} is Objective-C`);
33767
- const include = import_node_path16.default.join(work, "include");
33929
+ const include = import_node_path17.default.join(work, "include");
33768
33930
  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);
33931
+ import_node_fs17.default.mkdirSync(import_node_path17.default.dirname(import_node_path17.default.join(include, file)), { recursive: true });
33932
+ import_node_fs17.default.writeFileSync(import_node_path17.default.join(include, file), text3);
33771
33933
  }
33772
33934
  const roots = named.length > 0 ? named : headers;
33773
33935
  const modulemap = `module ${surface.module} {
@@ -33775,12 +33937,12 @@ ${roots.map((file) => ` header "${file}"
33775
33937
  `).join("")} export *
33776
33938
  }
33777
33939
  `;
33778
- const probe2 = import_node_path16.default.join(work, "declarations.c");
33779
- import_node_fs16.default.writeFileSync(probe2, roots.map((file) => `#include "${file}"
33940
+ const probe2 = import_node_path17.default.join(work, "declarations.c");
33941
+ import_node_fs17.default.writeFileSync(probe2, roots.map((file) => `#include "${file}"
33780
33942
  `).join(""));
33781
33943
  const { sysroot } = swiftSdkPaths(toolchain.moduleRoot, toolchain.toolchainBin);
33782
33944
  const ast = JSON.parse(
33783
- exec(import_node_path16.default.join(toolchain.toolchainBin, "clang"), [
33945
+ exec(import_node_path17.default.join(toolchain.toolchainBin, "clang"), [
33784
33946
  "-target",
33785
33947
  TRIPLE,
33786
33948
  "--sysroot",
@@ -33793,7 +33955,7 @@ ${roots.map((file) => ` header "${file}"
33793
33955
  probe2
33794
33956
  ])
33795
33957
  );
33796
- const byPath = new Map(headers.map((file) => [import_node_path16.default.join(include, file), file]));
33958
+ const byPath = new Map(headers.map((file) => [import_node_path17.default.join(include, file), file]));
33797
33959
  const declarations = functionDeclarations(ast, new Set(byPath.keys()));
33798
33960
  const groups = /* @__PURE__ */ new Map();
33799
33961
  for (const declaration of declarations) {
@@ -33840,10 +34002,10 @@ ${roots.map((file) => ` header "${file}"
33840
34002
  "",
33841
34003
  ...definitions
33842
34004
  ].join("\n");
33843
- const out = import_node_path16.default.join(work, `${surface.module}.c`);
33844
- import_node_fs16.default.writeFileSync(out, source);
34005
+ const out = import_node_path17.default.join(work, `${surface.module}.c`);
34006
+ import_node_fs17.default.writeFileSync(out, source);
33845
34007
  try {
33846
- exec(import_node_path16.default.join(toolchain.toolchainBin, "clang"), [
34008
+ exec(import_node_path17.default.join(toolchain.toolchainBin, "clang"), [
33847
34009
  "-target",
33848
34010
  TRIPLE,
33849
34011
  "--sysroot",
@@ -33924,25 +34086,25 @@ function binaryStandins(binary2, toolchain, provided) {
33924
34086
  for (const file of surface.kind === "swift" ? [surface.interface] : [
33925
34087
  surface.modulemap,
33926
34088
  ...files(surface.headers, (name2) => name2.endsWith(".h")).map(
33927
- (file2) => import_node_path16.default.join(surface.headers, file2)
34089
+ (file2) => import_node_path17.default.join(surface.headers, file2)
33928
34090
  )
33929
34091
  ])
33930
- hash.update(import_node_fs16.default.readFileSync(file));
34092
+ hash.update(import_node_fs17.default.readFileSync(file));
33931
34093
  }
33932
34094
  const id = hash.digest("hex").slice(0, 32);
33933
34095
  const memo2 = built.get(id);
33934
34096
  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"));
34097
+ const cached4 = import_node_path17.default.join(cacheDir4, "standins", `${id}.json`);
34098
+ if (import_node_fs17.default.existsSync(cached4)) {
34099
+ const value = JSON.parse(import_node_fs17.default.readFileSync(cached4, "utf8"));
33938
34100
  built.set(id, value);
33939
34101
  return value;
33940
34102
  }
33941
- const work = import_node_fs16.default.mkdtempSync(import_node_path16.default.join(import_node_os7.default.tmpdir(), "peach-standin-"));
34103
+ const work = import_node_fs17.default.mkdtempSync(import_node_path17.default.join(import_node_os7.default.tmpdir(), "peach-standin-"));
33942
34104
  let result;
33943
34105
  try {
33944
34106
  result = found.map((surface) => {
33945
- const dir = import_node_path16.default.join(work, surface.module);
34107
+ const dir = import_node_path17.default.join(work, surface.module);
33946
34108
  try {
33947
34109
  return surface.kind === "swift" ? swiftStandin(surface, binary2, toolchain, dir) : cStandin(surface, binary2, toolchain, dir);
33948
34110
  } catch (error) {
@@ -33951,13 +34113,13 @@ function binaryStandins(binary2, toolchain, provided) {
33951
34113
  );
33952
34114
  }
33953
34115
  });
33954
- import_node_fs16.default.mkdirSync(import_node_path16.default.dirname(cached4), { recursive: true });
33955
- import_node_fs16.default.writeFileSync(cached4, JSON.stringify(result));
34116
+ import_node_fs17.default.mkdirSync(import_node_path17.default.dirname(cached4), { recursive: true });
34117
+ import_node_fs17.default.writeFileSync(cached4, JSON.stringify(result));
33956
34118
  built.set(id, result);
33957
34119
  } catch (error) {
33958
34120
  result = error instanceof Error ? error.message : String(error);
33959
34121
  } finally {
33960
- import_node_fs16.default.rmSync(work, { recursive: true, force: true });
34122
+ import_node_fs17.default.rmSync(work, { recursive: true, force: true });
33961
34123
  }
33962
34124
  return result;
33963
34125
  }
@@ -33971,23 +34133,23 @@ function swiftStandins(binaries, toolchain, provided = /* @__PURE__ */ new Set()
33971
34133
  }
33972
34134
  return { standins, gaps };
33973
34135
  }
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;
34136
+ 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
34137
  var init_swift_standins = __esm({
33976
34138
  "src/swift-standins.ts"() {
33977
34139
  "use strict";
33978
34140
  import_node_child_process9 = require("node:child_process");
33979
34141
  import_node_crypto7 = require("node:crypto");
33980
- import_node_fs16 = __toESM(require("node:fs"), 1);
34142
+ import_node_fs17 = __toESM(require("node:fs"), 1);
33981
34143
  import_node_os7 = __toESM(require("node:os"), 1);
33982
- import_node_path16 = __toESM(require("node:path"), 1);
34144
+ import_node_path17 = __toESM(require("node:path"), 1);
33983
34145
  init_cli_version();
33984
34146
  init_swift_compile();
33985
34147
  init_swift_standin_emit();
33986
34148
  TRIPLE = "wasm32-unknown-wasip1";
33987
- cacheDir4 = import_node_path16.default.join(import_node_os7.default.tmpdir(), "peach-swift-standins");
34149
+ cacheDir4 = import_node_path17.default.join(import_node_os7.default.tmpdir(), "peach-swift-standins");
33988
34150
  key = (...parts) => (0, import_node_crypto7.createHash)("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
33989
34151
  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() : [];
34152
+ 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
34153
  OBJC = /^\s*(?:@interface|@protocol|@class|@import|#import)\b/m;
33992
34154
  identChar = (char) => char !== void 0 && /[\w$]/.test(char);
33993
34155
  built = /* @__PURE__ */ new Map();
@@ -35242,7 +35404,7 @@ var require_lib = __commonJS({
35242
35404
  function readXcodeJsonProject(xcodeproj, source) {
35243
35405
  const json = import_json5.default.parse(source);
35244
35406
  if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
35245
- const projectDir = import_node_path17.default.dirname(xcodeproj);
35407
+ const projectDir = import_node_path18.default.dirname(xcodeproj);
35246
35408
  const objects = {};
35247
35409
  let next = 0;
35248
35410
  const add = (entry, id) => {
@@ -35255,7 +35417,7 @@ function readXcodeJsonProject(xcodeproj, source) {
35255
35417
  const base = /^<([A-Z]+)>\/(.*)$/.exec(raw2);
35256
35418
  if (base) {
35257
35419
  if (base[1] === "PROJECT")
35258
- return { sourceTree: "<absolute>", path: import_node_path17.default.join(projectDir, base[2]) };
35420
+ return { sourceTree: "<absolute>", path: import_node_path18.default.join(projectDir, base[2]) };
35259
35421
  if (base[1] === "PRODUCTS")
35260
35422
  return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
35261
35423
  return null;
@@ -35263,7 +35425,7 @@ function readXcodeJsonProject(xcodeproj, source) {
35263
35425
  const unescaped = raw2.replaceAll("\\<", "<");
35264
35426
  if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
35265
35427
  if (unescaped.startsWith("~")) return null;
35266
- return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path17.default.join(groupDir, unescaped) };
35428
+ return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path18.default.join(groupDir, unescaped) };
35267
35429
  };
35268
35430
  const memberships = [];
35269
35431
  const folders = [];
@@ -35274,7 +35436,7 @@ function readXcodeJsonProject(xcodeproj, source) {
35274
35436
  const kind = text2(entry.kind) ?? "file-reference";
35275
35437
  const raw2 = text2(entry.path) ?? "";
35276
35438
  const located = raw2 === "" ? null : locate(raw2, parent.dir);
35277
- const name2 = text2(entry.name) ?? import_node_path17.default.basename(raw2);
35439
+ const name2 = text2(entry.name) ?? import_node_path18.default.basename(raw2);
35278
35440
  const node = { id: "", name: name2, dir: null, parent, children: [] };
35279
35441
  if (kind === "group" || kind === "variant-group" || kind === "version-group") {
35280
35442
  node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
@@ -35389,7 +35551,7 @@ function readXcodeJsonProject(xcodeproj, source) {
35389
35551
  if (!isObject(entry)) continue;
35390
35552
  const repository = text2(entry.repository);
35391
35553
  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$/, "");
35554
+ 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
35555
  const id = text2(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
35394
35556
  packageIds.set(name2.toLowerCase(), id);
35395
35557
  }
@@ -35557,11 +35719,11 @@ function readXcodeJsonProject(xcodeproj, source) {
35557
35719
  function isJsonObject(value) {
35558
35720
  return typeof value === "object" && value !== null && !Array.isArray(value);
35559
35721
  }
35560
- var import_node_path17, import_json5, isObject, text2, items, PHASE_ISA;
35722
+ var import_node_path18, import_json5, isObject, text2, items, PHASE_ISA;
35561
35723
  var init_xcode_json_project = __esm({
35562
35724
  "src/xcode-json-project.ts"() {
35563
35725
  "use strict";
35564
- import_node_path17 = __toESM(require("node:path"), 1);
35726
+ import_node_path18 = __toESM(require("node:path"), 1);
35565
35727
  import_json5 = __toESM(require_lib(), 1);
35566
35728
  isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
35567
35729
  text2 = (value) => typeof value === "string" ? value : void 0;
@@ -35668,27 +35830,27 @@ function parseOpenStepPlist(text3) {
35668
35830
  return root;
35669
35831
  }
35670
35832
  function walkFiles(dir) {
35671
- if (!import_node_fs17.default.existsSync(dir)) return [];
35833
+ if (!import_node_fs18.default.existsSync(dir)) return [];
35672
35834
  const out = [];
35673
- for (const entry of import_node_fs17.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
35835
+ for (const entry of import_node_fs18.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
35674
35836
  if (entry.name.startsWith(".")) continue;
35675
- const full = import_node_path18.default.join(dir, entry.name);
35837
+ const full = import_node_path19.default.join(dir, entry.name);
35676
35838
  if (entry.isDirectory()) out.push(...walkFiles(full));
35677
35839
  else if (entry.isFile()) out.push(full);
35678
35840
  }
35679
35841
  return out;
35680
35842
  }
35681
35843
  function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
35682
- if (seen.has(file) || !import_node_fs17.default.existsSync(file)) return {};
35844
+ if (seen.has(file) || !import_node_fs18.default.existsSync(file)) return {};
35683
35845
  seen.add(file);
35684
35846
  const settings = {};
35685
- for (const raw2 of import_node_fs17.default.readFileSync(file, "utf8").split("\n")) {
35847
+ for (const raw2 of import_node_fs18.default.readFileSync(file, "utf8").split("\n")) {
35686
35848
  const line = raw2.replace(/\/\/.*$/, "").trim();
35687
35849
  const include = /^#include\??\s+"([^"]+)"/.exec(line);
35688
35850
  if (include) {
35689
35851
  Object.assign(
35690
35852
  settings,
35691
- readXcconfig(import_node_path18.default.resolve(import_node_path18.default.dirname(file), include[1]), seen)
35853
+ readXcconfig(import_node_path19.default.resolve(import_node_path19.default.dirname(file), include[1]), seen)
35692
35854
  );
35693
35855
  continue;
35694
35856
  }
@@ -35738,22 +35900,22 @@ function decodeXml(text3) {
35738
35900
  return text3.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
35739
35901
  }
35740
35902
  function workspaceReferences(workspace) {
35741
- const data = import_node_path18.default.join(workspace, "contents.xcworkspacedata");
35742
- if (!import_node_fs17.default.existsSync(data))
35903
+ const data = import_node_path19.default.join(workspace, "contents.xcworkspacedata");
35904
+ if (!import_node_fs18.default.existsSync(data))
35743
35905
  throw new Error(`${workspace} has no contents.xcworkspacedata`);
35744
- const container = import_node_path18.default.dirname(workspace);
35906
+ const container = import_node_path19.default.dirname(workspace);
35745
35907
  const locate = (location2, base) => {
35746
35908
  const colon = location2.indexOf(":");
35747
35909
  const kind = location2.slice(0, colon);
35748
35910
  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}`);
35911
+ if (kind === "group") return import_node_path19.default.resolve(base, rest);
35912
+ if (kind === "container" || kind === "self") return import_node_path19.default.resolve(container, rest);
35913
+ if (kind === "absolute") return import_node_path19.default.resolve(rest);
35914
+ throw new Error(`${import_node_path19.default.basename(workspace)} has an unsupported location ${location2}`);
35753
35915
  };
35754
35916
  const groups = [container];
35755
35917
  const references = [];
35756
- for (const [, closing, tag, attributes, selfClosing] of import_node_fs17.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
35918
+ for (const [, closing, tag, attributes, selfClosing] of import_node_fs18.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
35757
35919
  if (closing) {
35758
35920
  if (tag === "Group") groups.pop();
35759
35921
  continue;
@@ -35768,8 +35930,8 @@ function workspaceReferences(workspace) {
35768
35930
  }
35769
35931
  function xcodeProjectFile(xcodeproj) {
35770
35932
  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;
35933
+ const file = import_node_path19.default.join(xcodeproj, name2);
35934
+ if (import_node_fs18.default.existsSync(file)) return file;
35773
35935
  }
35774
35936
  return null;
35775
35937
  }
@@ -35777,10 +35939,10 @@ function loadProject(xcodeproj) {
35777
35939
  const projectFile = xcodeProjectFile(xcodeproj);
35778
35940
  if (!projectFile)
35779
35941
  throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
35780
- const mtimeMs = import_node_fs17.default.statSync(projectFile).mtimeMs;
35942
+ const mtimeMs = import_node_fs18.default.statSync(projectFile).mtimeMs;
35781
35943
  const cached4 = loaded.get(projectFile);
35782
35944
  if (cached4?.mtimeMs === mtimeMs) return cached4.project;
35783
- const source = import_node_fs17.default.readFileSync(projectFile, "utf8");
35945
+ const source = import_node_fs18.default.readFileSync(projectFile, "utf8");
35784
35946
  const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
35785
35947
  if (!isDict(root) || !isDict(root.objects)) {
35786
35948
  throw new Error(`${projectFile} has no objects table`);
@@ -35794,8 +35956,8 @@ function loadProject(xcodeproj) {
35794
35956
  if (!project || project.isa !== "PBXProject") {
35795
35957
  throw new Error(`${projectFile} has no PBXProject root`);
35796
35958
  }
35797
- const projectDir = import_node_fs17.default.realpathSync(
35798
- import_node_path18.default.resolve(import_node_path18.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
35959
+ const projectDir = import_node_fs18.default.realpathSync(
35960
+ import_node_path19.default.resolve(import_node_path19.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
35799
35961
  );
35800
35962
  const parent = /* @__PURE__ */ new Map();
35801
35963
  for (const [id, entry] of Object.entries(objects)) {
@@ -35813,11 +35975,11 @@ function loadProject(xcodeproj) {
35813
35975
  const own = str(entry.path) ?? "";
35814
35976
  const tree = str(entry.sourceTree) ?? "<group>";
35815
35977
  if (tree === "<absolute>") result2 = own;
35816
- else if (tree === "SOURCE_ROOT") result2 = import_node_path18.default.join(projectDir, own);
35978
+ else if (tree === "SOURCE_ROOT") result2 = import_node_path19.default.join(projectDir, own);
35817
35979
  else if (tree === "<group>") {
35818
35980
  const up = parent.get(id);
35819
35981
  const base = up ? resolvePath(up) : projectDir;
35820
- result2 = base === null ? null : import_node_path18.default.join(base, own);
35982
+ result2 = base === null ? null : import_node_path19.default.join(base, own);
35821
35983
  }
35822
35984
  }
35823
35985
  resolvedPaths.set(id, result2);
@@ -35917,7 +36079,7 @@ function targetMembers(ref) {
35917
36079
  const addResource = (file) => {
35918
36080
  if (isDirectory(file)) {
35919
36081
  for (const inner of walkFiles(file)) resources.add(inner);
35920
- } else if (import_node_fs17.default.existsSync(file)) resources.add(file);
36082
+ } else if (import_node_fs18.default.existsSync(file)) resources.add(file);
35921
36083
  };
35922
36084
  const fileRefPaths = (refId) => {
35923
36085
  const entry = project.object(refId);
@@ -35938,7 +36100,7 @@ function targetMembers(ref) {
35938
36100
  for (const buildFileId of list(phase.files)) {
35939
36101
  for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
35940
36102
  if (phase.isa === "PBXSourcesBuildPhase") {
35941
- if (!import_node_fs17.default.existsSync(file)) continue;
36103
+ if (!import_node_fs18.default.existsSync(file)) continue;
35942
36104
  allSources.add(file);
35943
36105
  if (file.endsWith(".swift")) sources.add(file);
35944
36106
  } else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
@@ -35946,7 +36108,7 @@ function targetMembers(ref) {
35946
36108
  }
35947
36109
  }
35948
36110
  const addSynchronized = (folder, relative3) => {
35949
- const file = import_node_path18.default.join(folder, relative3);
36111
+ const file = import_node_path19.default.join(folder, relative3);
35950
36112
  if (NEVER_MEMBER.test(relative3)) return;
35951
36113
  if (file.endsWith(".swift")) {
35952
36114
  if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
@@ -35971,7 +36133,7 @@ function targetMembers(ref) {
35971
36133
  }
35972
36134
  if (owned.has(groupId)) {
35973
36135
  for (const file of walkFiles(folder)) {
35974
- const relative3 = import_node_path18.default.relative(folder, file).split(import_node_path18.default.sep).join("/");
36136
+ const relative3 = import_node_path19.default.relative(folder, file).split(import_node_path19.default.sep).join("/");
35975
36137
  if ([...exceptions].some(
35976
36138
  (exception) => relative3 === exception || relative3.startsWith(`${exception}/`)
35977
36139
  ))
@@ -35980,14 +36142,14 @@ function targetMembers(ref) {
35980
36142
  }
35981
36143
  } else {
35982
36144
  for (const relative3 of exceptions) {
35983
- const file = import_node_path18.default.join(folder, relative3);
36145
+ const file = import_node_path19.default.join(folder, relative3);
35984
36146
  if (isDirectory(file)) {
35985
36147
  for (const inner of walkFiles(file))
35986
36148
  addSynchronized(
35987
36149
  folder,
35988
- import_node_path18.default.relative(folder, inner).split(import_node_path18.default.sep).join("/")
36150
+ import_node_path19.default.relative(folder, inner).split(import_node_path19.default.sep).join("/")
35989
36151
  );
35990
- } else if (import_node_fs17.default.existsSync(file)) addSynchronized(folder, relative3);
36152
+ } else if (import_node_fs18.default.existsSync(file)) addSynchronized(folder, relative3);
35991
36153
  }
35992
36154
  }
35993
36155
  }
@@ -36000,8 +36162,8 @@ function targetMembers(ref) {
36000
36162
  function commonAncestor(dirs) {
36001
36163
  let common = dirs[0];
36002
36164
  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);
36165
+ while (common !== import_node_path19.default.dirname(common) && import_node_path19.default.relative(common, dir).startsWith(".."))
36166
+ common = import_node_path19.default.dirname(common);
36005
36167
  }
36006
36168
  return common;
36007
36169
  }
@@ -36010,8 +36172,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
36010
36172
  const projects2 = [];
36011
36173
  const projectAt = /* @__PURE__ */ new Map();
36012
36174
  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;
36175
+ const key2 = import_node_path19.default.resolve(xcodeproj);
36176
+ if (projectAt.has(key2) || key2.split(import_node_path19.default.sep).includes("Pods")) return;
36015
36177
  if (!xcodeProjectFile(key2)) return;
36016
36178
  const project = loadProject(key2);
36017
36179
  projectAt.set(key2, project);
@@ -36028,7 +36190,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
36028
36190
  for (const reference of listed)
36029
36191
  if (reference.endsWith(".xcodeproj")) addProject(reference);
36030
36192
  if (projects2.length === 0) {
36031
- throw new Error(`${import_node_path18.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
36193
+ throw new Error(`${import_node_path19.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
36032
36194
  }
36033
36195
  return { listed, projects: projects2, projectAt };
36034
36196
  }
@@ -36052,7 +36214,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36052
36214
  const allTargets = projects2.flatMap(nativeTargets);
36053
36215
  const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
36054
36216
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
36055
- const container = import_node_path18.default.basename(xcodeprojOrWorkspace);
36217
+ const container = import_node_path19.default.basename(xcodeprojOrWorkspace);
36056
36218
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
36057
36219
  if (named.length !== 1) {
36058
36220
  throw new Error(
@@ -36064,14 +36226,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36064
36226
  for (const ref of allTargets) {
36065
36227
  const product = ref.project.object(str(ref.target.productReference));
36066
36228
  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);
36229
+ if (file && !byProduct.has(import_node_path19.default.basename(file)))
36230
+ byProduct.set(import_node_path19.default.basename(file), ref);
36069
36231
  }
36070
36232
  const proxied = (project, proxyId) => {
36071
36233
  const proxy = project.object(proxyId);
36072
36234
  if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
36073
36235
  const portal = str(proxy.containerPortal);
36074
- const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path18.default.resolve(project.resolvePath(portal ?? "") ?? ""));
36236
+ const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path19.default.resolve(project.resolvePath(portal ?? "") ?? ""));
36075
36237
  const remote = str(proxy.remoteGlobalIDString);
36076
36238
  if (!owner || !remote) return void 0;
36077
36239
  return nativeTargets(owner).find(
@@ -36092,7 +36254,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36092
36254
  if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
36093
36255
  for (const buildFileId of list(phase.files)) {
36094
36256
  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;
36257
+ 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
36258
  if (resolved) found.push(resolved);
36097
36259
  }
36098
36260
  }
@@ -36113,7 +36275,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36113
36275
  const name2 = str(ref.target.name) ?? ref.id;
36114
36276
  const { get: settings2, keys } = targetSettings(ref, {
36115
36277
  TARGET_NAME: name2,
36116
- PROJECT_NAME: import_node_path18.default.basename(ref.project.xcodeproj, ".xcodeproj"),
36278
+ PROJECT_NAME: import_node_path19.default.basename(ref.project.xcodeproj, ".xcodeproj"),
36117
36279
  SRCROOT: ref.project.projectDir,
36118
36280
  SOURCE_ROOT: ref.project.projectDir,
36119
36281
  PROJECT_DIR: ref.project.projectDir,
@@ -36144,8 +36306,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36144
36306
  }
36145
36307
  return value;
36146
36308
  };
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")) : {};
36309
+ const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path19.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
36310
+ const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs18.default.readFileSync(infoPlistFile, "utf8")) : {};
36149
36311
  if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
36150
36312
  throw new Error(`${module2.name} Info.plist must contain a dictionary`);
36151
36313
  }
@@ -36163,12 +36325,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36163
36325
  };
36164
36326
  }
36165
36327
  const localPackageDirs = [
36166
- ...listed.filter((reference) => import_node_fs17.default.existsSync(import_node_path18.default.join(reference, "Package.swift"))),
36328
+ ...listed.filter((reference) => import_node_fs18.default.existsSync(import_node_path19.default.join(reference, "Package.swift"))),
36167
36329
  ...projects2.flatMap(
36168
36330
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
36169
36331
  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] : [];
36332
+ const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path19.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
36333
+ return candidate && import_node_fs18.default.existsSync(import_node_path19.default.join(candidate, "Package.swift")) ? [candidate] : [];
36172
36334
  })
36173
36335
  )
36174
36336
  ];
@@ -36192,7 +36354,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36192
36354
  product,
36193
36355
  source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
36194
36356
  kind: "local",
36195
- dir: import_node_path18.default.resolve(
36357
+ dir: import_node_path19.default.resolve(
36196
36358
  project.projectDir,
36197
36359
  str(reference.relativePath) ?? ""
36198
36360
  )
@@ -36214,8 +36376,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36214
36376
  }
36215
36377
  }
36216
36378
  }
36217
- const resolvedFile = import_node_path18.default.join(
36218
- workspace ?? import_node_path18.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
36379
+ const resolvedFile = import_node_path19.default.join(
36380
+ workspace ?? import_node_path19.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
36219
36381
  "xcshareddata",
36220
36382
  "swiftpm",
36221
36383
  "Package.resolved"
@@ -36225,13 +36387,13 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36225
36387
  ...module2,
36226
36388
  rootDir: commonAncestor(
36227
36389
  [
36228
- workspace ? import_node_path18.default.dirname(workspace) : app.project.projectDir,
36390
+ workspace ? import_node_path19.default.dirname(workspace) : app.project.projectDir,
36229
36391
  ...used.map((project) => project.projectDir),
36230
36392
  ...localPackageDirs,
36231
36393
  ...linkedProducts.flatMap(
36232
- ({ source }) => source.kind === "local" && import_node_fs17.default.existsSync(source.dir) ? [source.dir] : []
36394
+ ({ source }) => source.kind === "local" && import_node_fs18.default.existsSync(source.dir) ? [source.dir] : []
36233
36395
  )
36234
- ].map((dir) => import_node_fs17.default.realpathSync(dir))
36396
+ ].map((dir) => import_node_fs18.default.realpathSync(dir))
36235
36397
  ),
36236
36398
  projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
36237
36399
  infoPlist: import_plist3.default.build(info),
@@ -36239,19 +36401,19 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
36239
36401
  frameworks,
36240
36402
  linkedProducts,
36241
36403
  localPackageDirs: [
36242
- ...new Set(localPackageDirs.map((dir) => import_node_fs17.default.realpathSync(dir)))
36404
+ ...new Set(localPackageDirs.map((dir) => import_node_fs18.default.realpathSync(dir)))
36243
36405
  ].sort(),
36244
36406
  binaryFrameworks: [...binaryFrameworks].sort(),
36245
- packageResolved: import_node_fs17.default.existsSync(resolvedFile) ? resolvedFile : null,
36407
+ packageResolved: import_node_fs18.default.existsSync(resolvedFile) ? resolvedFile : null,
36246
36408
  appTargets: appTargetNames
36247
36409
  };
36248
36410
  }
36249
- var import_node_fs17, import_node_path18, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
36411
+ var import_node_fs18, import_node_path19, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, targetRefs;
36250
36412
  var init_xcode_project = __esm({
36251
36413
  "src/xcode-project.ts"() {
36252
36414
  "use strict";
36253
- import_node_fs17 = __toESM(require("node:fs"), 1);
36254
- import_node_path18 = __toESM(require("node:path"), 1);
36415
+ import_node_fs18 = __toESM(require("node:fs"), 1);
36416
+ import_node_path19 = __toESM(require("node:path"), 1);
36255
36417
  import_plist3 = __toESM(require_plist(), 1);
36256
36418
  init_xcode_json_project();
36257
36419
  isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -36271,7 +36433,7 @@ var init_xcode_project = __esm({
36271
36433
  arch: "arm64",
36272
36434
  variant: "normal"
36273
36435
  };
36274
- isDirectory = (dir) => import_node_fs17.default.existsSync(dir) && import_node_fs17.default.statSync(dir).isDirectory();
36436
+ isDirectory = (dir) => import_node_fs18.default.existsSync(dir) && import_node_fs18.default.statSync(dir).isDirectory();
36275
36437
  loaded = /* @__PURE__ */ new Map();
36276
36438
  targetRefs = /* @__PURE__ */ new WeakMap();
36277
36439
  }
@@ -36279,17 +36441,17 @@ var init_xcode_project = __esm({
36279
36441
 
36280
36442
  // src/swift-host.ts
36281
36443
  function swiftPackageId(packagePath) {
36282
- return import_node_path19.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
36444
+ return import_node_path20.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
36283
36445
  }
36284
36446
  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;
36447
+ packagePath = import_node_fs19.default.realpathSync(packagePath);
36448
+ const file = import_node_path20.default.join(packagePath, NATIVE_DESCRIPTOR);
36449
+ if (!import_node_fs19.default.existsSync(file)) return null;
36288
36450
  const value = JSON.parse(
36289
36451
  readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
36290
36452
  );
36291
36453
  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))) {
36454
+ 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
36455
  throw invalid();
36294
36456
  }
36295
36457
  if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
@@ -36298,7 +36460,7 @@ function nativeSourceDescriptor(packagePath) {
36298
36460
  return value;
36299
36461
  }
36300
36462
  function projectFor(packagePath, hosted) {
36301
- packagePath = import_node_fs18.default.realpathSync(packagePath);
36463
+ packagePath = import_node_fs19.default.realpathSync(packagePath);
36302
36464
  const existing = projects.get(packagePath);
36303
36465
  if (existing) {
36304
36466
  if (hosted && !existing.hosted) {
@@ -36319,14 +36481,14 @@ function projectFor(packagePath, hosted) {
36319
36481
  return created;
36320
36482
  }
36321
36483
  function swiftPackages(entry, app) {
36322
- const stamp = (file) => file && import_node_fs18.default.existsSync(file) ? import_node_fs18.default.statSync(file).mtimeMs : 0;
36484
+ const stamp = (file) => file && import_node_fs19.default.existsSync(file) ? import_node_fs19.default.statSync(file).mtimeMs : 0;
36323
36485
  const key2 = JSON.stringify([
36324
36486
  app.linkedProducts,
36325
36487
  app.packageResolved,
36326
36488
  stamp(app.packageResolved),
36327
- app.localPackageDirs.map((dir) => stamp(import_node_path19.default.join(dir, "Package.swift"))),
36489
+ app.localPackageDirs.map((dir) => stamp(import_node_path20.default.join(dir, "Package.swift"))),
36328
36490
  app.linkedProducts.map(
36329
- ({ source }) => source.kind === "local" ? stamp(import_node_path19.default.join(source.dir, "Package.swift")) : 0
36491
+ ({ source }) => source.kind === "local" ? stamp(import_node_path20.default.join(source.dir, "Package.swift")) : 0
36330
36492
  )
36331
36493
  ]);
36332
36494
  let cached4 = entry.packages;
@@ -36375,8 +36537,8 @@ function swiftPackages(entry, app) {
36375
36537
  }
36376
36538
  function xcodeInputKey(layout, file, relative3) {
36377
36539
  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;
36540
+ if (owner) return import_node_path20.default.posix.join(owner, relative3);
36541
+ return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path20.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
36380
36542
  }
36381
36543
  function xcodeLayout(root) {
36382
36544
  const registered = xcodeProjects.get(root);
@@ -36387,7 +36549,7 @@ function xcodeLayout(root) {
36387
36549
  const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
36388
36550
  const targets = [];
36389
36551
  for (const framework of app.frameworks) {
36390
- const dir = import_node_path19.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
36552
+ const dir = import_node_path20.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
36391
36553
  for (const file of framework.sources) {
36392
36554
  if (targetDirs.has(file)) continue;
36393
36555
  targetDirs.set(file, dir);
@@ -36407,7 +36569,7 @@ function xcodeLayout(root) {
36407
36569
  for (const standin of standins)
36408
36570
  targets.push({
36409
36571
  name: standin.module,
36410
- path: import_node_path19.default.posix.join(XCODE_STANDINS_DIR, standin.module),
36572
+ path: import_node_path20.default.posix.join(XCODE_STANDINS_DIR, standin.module),
36411
36573
  executable: false,
36412
36574
  resources: false,
36413
36575
  exclude: [],
@@ -36415,19 +36577,19 @@ function xcodeLayout(root) {
36415
36577
  mainActorIsolation: false
36416
36578
  });
36417
36579
  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,
36580
+ const relative3 = import_node_path20.default.relative(
36581
+ target.remote ? import_node_path20.default.join(root, REMOTE_CHECKOUTS) : root,
36420
36582
  target.dir
36421
36583
  );
36422
- if (relative3 === ".." || relative3.startsWith(`..${import_node_path19.default.sep}`) || import_node_path19.default.isAbsolute(relative3))
36584
+ if (relative3 === ".." || relative3.startsWith(`..${import_node_path20.default.sep}`) || import_node_path20.default.isAbsolute(relative3))
36423
36585
  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);
36586
+ const posix2 = relative3.split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep);
36425
36587
  targets.push({
36426
36588
  ...target,
36427
- path: target.remote ? import_node_path19.default.posix.join(XCODE_PACKAGES_DIR, posix2) : posix2,
36589
+ path: target.remote ? import_node_path20.default.posix.join(XCODE_PACKAGES_DIR, posix2) : posix2,
36428
36590
  exclude: []
36429
36591
  });
36430
- if (!target.remote) files2.add(import_node_path19.default.join(target.packageDir, "Package.swift"));
36592
+ if (!target.remote) files2.add(import_node_path20.default.join(target.packageDir, "Package.swift"));
36431
36593
  for (const file of target.files) files2.add(file);
36432
36594
  }
36433
36595
  for (const target of targets) {
@@ -36457,25 +36619,25 @@ function xcodeManifest(layout) {
36457
36619
  ].join("\n");
36458
36620
  }
36459
36621
  function packageFiles(root) {
36460
- const canonicalRoot = import_node_fs18.default.realpathSync(root);
36622
+ const canonicalRoot = import_node_fs19.default.realpathSync(root);
36461
36623
  const xcode = xcodeLayout(canonicalRoot);
36462
36624
  return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
36463
36625
  }
36464
36626
  function sourceTreeFiles(dir, canonicalRoot) {
36465
36627
  const found = [];
36466
36628
  const walk2 = (dir2) => {
36467
- for (const entry of import_node_fs18.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
36629
+ for (const entry of import_node_fs19.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
36468
36630
  if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
36469
36631
  continue;
36470
- const full = import_node_path19.default.join(dir2, entry.name);
36632
+ const full = import_node_path20.default.join(dir2, entry.name);
36471
36633
  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)) {
36634
+ const real = import_node_fs19.default.realpathSync(full);
36635
+ const relative3 = import_node_path20.default.relative(canonicalRoot, real);
36636
+ if (relative3.startsWith(`..${import_node_path20.default.sep}`) || relative3 === ".." || import_node_path20.default.isAbsolute(relative3)) {
36475
36637
  throw new Error(`swift input escapes the selected package: ${full}`);
36476
36638
  }
36477
36639
  if (entry.isDirectory()) {
36478
- if (import_node_fs18.default.existsSync(import_node_path19.default.join(full, "Package.swift"))) continue;
36640
+ if (import_node_fs19.default.existsSync(import_node_path20.default.join(full, "Package.swift"))) continue;
36479
36641
  walk2(full);
36480
36642
  } else if (entry.isFile()) {
36481
36643
  found.push(full);
@@ -36483,63 +36645,22 @@ function sourceTreeFiles(dir, canonicalRoot) {
36483
36645
  }
36484
36646
  }
36485
36647
  };
36486
- if (import_node_fs18.default.existsSync(dir)) walk2(import_node_fs18.default.realpathSync(dir));
36648
+ if (import_node_fs19.default.existsSync(dir)) walk2(import_node_fs19.default.realpathSync(dir));
36487
36649
  return found;
36488
36650
  }
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
36651
  function sourceFiles(root) {
36531
36652
  return packageFiles(root).filter((file) => file.endsWith(".swift"));
36532
36653
  }
36533
36654
  function resourceCandidateFiles(root) {
36534
36655
  return packageFiles(root).filter(
36535
- (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path19.default.basename(file))
36656
+ (file) => !file.endsWith(".swift") && !["project.pbxproj", "project.xcproj"].includes(import_node_path20.default.basename(file))
36536
36657
  );
36537
36658
  }
36538
36659
  function buildSwiftResourceTable(project, baseUrl) {
36539
36660
  const limits = inputLimits(Boolean(project.hosted));
36540
36661
  const absolute = resourceCandidateFiles(project.packagePath);
36541
36662
  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)
36663
+ (file) => import_node_path20.default.relative(project.packagePath, file).split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep)
36543
36664
  );
36544
36665
  const byRelative = new Map(absolute.map((file, index) => [relative3[index], file]));
36545
36666
  const readContents = (candidate) => {
@@ -36561,16 +36682,16 @@ function buildSwiftResourceTable(project, baseUrl) {
36561
36682
  for (const { name: name2, file, scale } of found) {
36562
36683
  const disk = byRelative.get(file);
36563
36684
  if (!disk) continue;
36564
- if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs18.default.statSync(disk).size > limits.imageTotalBytes) {
36685
+ if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs19.default.statSync(disk).size > limits.imageTotalBytes) {
36565
36686
  throw new Error("swift image pack exceeds the compile service caps");
36566
36687
  }
36567
36688
  const bytes = readPackageFile(project.packagePath, disk, limits.imageBytes);
36568
36689
  imageBytes += bytes.length;
36569
36690
  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();
36691
+ const ext = import_node_path20.default.posix.extname(file).toLowerCase();
36571
36692
  table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
36572
36693
  images[name2] = {
36573
- file: import_node_path19.default.posix.basename(file),
36694
+ file: import_node_path20.default.posix.basename(file),
36574
36695
  data: bytes.toString("base64")
36575
36696
  };
36576
36697
  watched.push(file);
@@ -36594,10 +36715,10 @@ function buildSwiftResourceTable(project, baseUrl) {
36594
36715
  return { table, images, colors, symbols, watched };
36595
36716
  }
36596
36717
  function buildSwiftBundleFiles(packagePath, hosted) {
36597
- packagePath = import_node_fs18.default.realpathSync(packagePath);
36718
+ packagePath = import_node_fs19.default.realpathSync(packagePath);
36598
36719
  const limits = inputLimits(hosted);
36599
36720
  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)
36721
+ (file) => import_node_path20.default.relative(packagePath, file).split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep)
36601
36722
  );
36602
36723
  const files2 = {};
36603
36724
  const watched = [];
@@ -36611,13 +36732,13 @@ function buildSwiftBundleFiles(packagePath, hosted) {
36611
36732
  total += bytes.length;
36612
36733
  if (xcode.app.infoPlistFile)
36613
36734
  watched.push(
36614
- import_node_path19.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path19.default.sep).join("/")
36735
+ import_node_path20.default.relative(packagePath, xcode.app.infoPlistFile).split(import_node_path20.default.sep).join("/")
36615
36736
  );
36616
36737
  }
36617
36738
  for (const { base, file } of enumerateBundleJson(relative3)) {
36618
36739
  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) {
36740
+ const disk = import_node_path20.default.join(packagePath, ...file.split("/"));
36741
+ if (Object.keys(files2).length >= limits.resources || total + import_node_fs19.default.statSync(disk).size > limits.resourceTotalBytes) {
36621
36742
  throw new Error(
36622
36743
  `swift bundle pack exceeds ${limits.resources} files / ${limits.resourceTotalBytes} bytes`
36623
36744
  );
@@ -36632,12 +36753,12 @@ function serveSwiftResource(project, key2) {
36632
36753
  return project.resourceFiles.get(key2) ?? project.resourcesPrevious.get(key2) ?? null;
36633
36754
  }
36634
36755
  function linkedModuleRoots(packagePath) {
36635
- packagePath = import_node_fs18.default.realpathSync(packagePath);
36756
+ packagePath = import_node_fs19.default.realpathSync(packagePath);
36636
36757
  let manifest;
36637
36758
  try {
36638
36759
  manifest = readPackageFile(
36639
36760
  packagePath,
36640
- import_node_path19.default.join(packagePath, "Package.swift"),
36761
+ import_node_path20.default.join(packagePath, "Package.swift"),
36641
36762
  MAX_SWIFT_COMPILE_SOURCE_BYTES
36642
36763
  ).toString("utf8");
36643
36764
  } catch {
@@ -36646,8 +36767,8 @@ function linkedModuleRoots(packagePath) {
36646
36767
  const roots = /* @__PURE__ */ new Set();
36647
36768
  const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
36648
36769
  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);
36770
+ const root = import_node_path20.default.resolve(packagePath, match[1]);
36771
+ if (import_node_fs19.default.existsSync(import_node_path20.default.join(root, "Package.swift"))) roots.add(root);
36651
36772
  }
36652
36773
  return [...roots].sort();
36653
36774
  }
@@ -36656,18 +36777,18 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
36656
36777
  hash.update(packagePath);
36657
36778
  const projectInputs = new Set(packageFiles(packagePath));
36658
36779
  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);
36780
+ hash.update(import_node_path20.default.relative(packagePath, file));
36781
+ const stat2 = import_node_fs19.default.statSync(file);
36661
36782
  hash.update(`${stat2.mtimeMs}/${stat2.ctimeMs}/${stat2.size}`);
36662
36783
  }
36663
36784
  const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
36664
- (root) => import_node_fs18.default.existsSync(import_node_path19.default.join(root, "toolchain.json"))
36785
+ (root) => import_node_fs19.default.existsSync(import_node_path20.default.join(root, "toolchain.json"))
36665
36786
  );
36666
36787
  if (moduleRoot) {
36667
36788
  hash.update(moduleRoot);
36668
36789
  for (const relative3 of swiftModuleInputFiles(moduleRoot)) {
36669
36790
  hash.update(relative3);
36670
- hash.update(String(import_node_fs18.default.statSync(import_node_path19.default.join(moduleRoot, relative3)).mtimeMs));
36791
+ hash.update(String(import_node_fs19.default.statSync(import_node_path20.default.join(moduleRoot, relative3)).mtimeMs));
36671
36792
  }
36672
36793
  }
36673
36794
  return hash.digest("hex").slice(0, 16);
@@ -36679,8 +36800,8 @@ function packageSources(packagePath) {
36679
36800
  const xcode = xcodeLayout(packagePath);
36680
36801
  const files2 = {};
36681
36802
  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;
36803
+ const relative3 = import_node_path20.default.relative(packagePath, file).split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep);
36804
+ if (xcode && import_node_path20.default.basename(file) === "Package.swift") continue;
36684
36805
  files2[xcode ? xcodeInputKey(xcode, file, relative3) : relative3] = readPackageFile(
36685
36806
  packagePath,
36686
36807
  file,
@@ -36691,7 +36812,7 @@ function packageSources(packagePath) {
36691
36812
  files2["Package.swift"] = xcodeManifest(xcode);
36692
36813
  for (const standin of xcode.standins)
36693
36814
  for (const [file, text3] of Object.entries(standin.files))
36694
- files2[import_node_path19.default.posix.join(XCODE_STANDINS_DIR, standin.module, file)] = text3;
36815
+ files2[import_node_path20.default.posix.join(XCODE_STANDINS_DIR, standin.module, file)] = text3;
36695
36816
  }
36696
36817
  return files2;
36697
36818
  }
@@ -36702,7 +36823,7 @@ function packageSnapshot(project) {
36702
36823
  files: files2,
36703
36824
  resourcePaths: swiftImplicitResourcePaths(
36704
36825
  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)
36826
+ (file) => import_node_path20.default.relative(project.packagePath, file).split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep)
36706
36827
  )
36707
36828
  ),
36708
36829
  resources: buildSwiftResourceTable(project, ""),
@@ -36711,7 +36832,7 @@ function packageSnapshot(project) {
36711
36832
  ...native ? {
36712
36833
  glue: readPackageFile(
36713
36834
  project.packagePath,
36714
- import_node_path19.default.join(project.packagePath, NATIVE_GLUE),
36835
+ import_node_path20.default.join(project.packagePath, NATIVE_GLUE),
36715
36836
  MAX_SWIFT_COMPILE_SOURCE_BYTES
36716
36837
  ).toString("utf8")
36717
36838
  } : {}
@@ -36747,7 +36868,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
36747
36868
  package: content
36748
36869
  };
36749
36870
  const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
36750
- (root) => import_node_fs18.default.existsSync(import_node_path19.default.join(root, "toolchain.json"))
36871
+ (root) => import_node_fs19.default.existsSync(import_node_path20.default.join(root, "toolchain.json"))
36751
36872
  ) ?? await swiftDistributionRoot();
36752
36873
  if (!moduleRoot)
36753
36874
  return {
@@ -36774,10 +36895,10 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
36774
36895
  // server and a capture, or two checkouts) build each other's sources. so
36775
36896
  // each app and module checkout gets its own root, which keeps the same
36776
36897
  // app's incremental build across restarts.
36777
- buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path19.default.join(
36898
+ buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path20.default.join(
36778
36899
  import_node_os8.default.tmpdir(),
36779
36900
  "contrast-swift-build",
36780
- (0, import_node_crypto8.createHash)("sha256").update(`${moduleRoot}\0${import_node_path19.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
36901
+ (0, import_node_crypto8.createHash)("sha256").update(`${moduleRoot}\0${import_node_path20.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
36781
36902
  ),
36782
36903
  moduleRoot,
36783
36904
  ...toolchain
@@ -36870,7 +36991,7 @@ async function missingModulesMessage(packagePath, missing) {
36870
36991
  `Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
36871
36992
  ...[...missing].map(([name2, files2]) => {
36872
36993
  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})` : ""}`;
36994
+ 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
36995
  })
36875
36996
  ].join("\n");
36876
36997
  }
@@ -36878,7 +36999,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
36878
36999
  const auth = hosted ? null : resolveCliAuth();
36879
37000
  if (!hosted && (!auth || auth.kind === "github")) {
36880
37001
  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`
37002
+ `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
37003
  );
36883
37004
  }
36884
37005
  const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
@@ -36897,7 +37018,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
36897
37018
  const bytes = sources.reduce((total2, text3) => total2 + Buffer.byteLength(text3), 0);
36898
37019
  if (sources.length > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
36899
37020
  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`
37021
+ `${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
37022
  );
36902
37023
  }
36903
37024
  const descriptor = snapshot.native;
@@ -36916,7 +37037,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
36916
37037
  );
36917
37038
  if (descriptor && address.native?.hash !== descriptor.hash) {
36918
37039
  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`
37040
+ `${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
37041
  );
36921
37042
  }
36922
37043
  const response = await fetch(address.url, { signal });
@@ -37033,14 +37154,14 @@ function serveSwiftPackageAsset(pathname, res) {
37033
37154
  res.end("swift artifact is stale");
37034
37155
  return true;
37035
37156
  }
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;
37157
+ 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
37158
  var init_swift_host = __esm({
37038
37159
  "src/swift-host.ts"() {
37039
37160
  "use strict";
37040
37161
  import_node_crypto8 = require("node:crypto");
37041
- import_node_fs18 = __toESM(require("node:fs"), 1);
37162
+ import_node_fs19 = __toESM(require("node:fs"), 1);
37042
37163
  import_node_os8 = __toESM(require("node:os"), 1);
37043
- import_node_path19 = __toESM(require("node:path"), 1);
37164
+ import_node_path20 = __toESM(require("node:path"), 1);
37044
37165
  init_bundleAssets();
37045
37166
  init_auth();
37046
37167
  init_backend_origin();
@@ -37050,6 +37171,7 @@ var init_swift_host = __esm({
37050
37171
  init_swift_distribution();
37051
37172
  init_swift_package();
37052
37173
  init_swift_packages();
37174
+ init_swift_source_file();
37053
37175
  init_swift_standins();
37054
37176
  init_swift_submit();
37055
37177
  init_xcode_project();
@@ -37074,7 +37196,7 @@ var init_swift_host = __esm({
37074
37196
  XCODE_FRAMEWORKS_DIR = "__frameworks__";
37075
37197
  XCODE_PACKAGES_DIR = "__packages__";
37076
37198
  XCODE_STANDINS_DIR = "__standins__";
37077
- CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path19.default.sep).join(import_node_path19.default.posix.sep)}/`;
37199
+ CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path20.default.sep).join(import_node_path20.default.posix.sep)}/`;
37078
37200
  HOSTED_LIMITS = {
37079
37201
  resources: MAX_SWIFT_COMPILE_RESOURCES,
37080
37202
  resourceBytes: MAX_SWIFT_COMPILE_RESOURCE_BYTES,
@@ -37126,8 +37248,8 @@ var init_swift_host = __esm({
37126
37248
 
37127
37249
  // src/expo-swift-host.ts
37128
37250
  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"));
37251
+ appRoot = import_node_fs20.default.realpathSync(appRoot);
37252
+ const appRequire = (0, import_node_module.createRequire)(import_node_path21.default.join(appRoot, "package.json"));
37131
37253
  let autolinker;
37132
37254
  try {
37133
37255
  autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
@@ -37141,7 +37263,7 @@ async function collectExpoSwiftSources(appRoot) {
37141
37263
  (command) => run3(
37142
37264
  process.execPath,
37143
37265
  [
37144
- import_node_path20.default.join(import_node_path20.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
37266
+ import_node_path21.default.join(import_node_path21.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
37145
37267
  command,
37146
37268
  "--platform",
37147
37269
  "apple",
@@ -37172,8 +37294,8 @@ async function collectExpoSwiftSources(appRoot) {
37172
37294
  const sourceRoot = Reflect.get(entry, "path");
37173
37295
  if (typeof sourceRoot !== "string")
37174
37296
  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;
37297
+ const canonical = import_node_fs20.default.realpathSync(sourceRoot);
37298
+ if (canonical.split(import_node_path21.default.sep).includes("node_modules")) continue;
37177
37299
  const resolution = resolutions.find(
37178
37300
  (candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
37179
37301
  );
@@ -37200,12 +37322,12 @@ async function collectExpoSwiftSources(appRoot) {
37200
37322
  registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
37201
37323
  });
37202
37324
  }
37203
- const ios = import_node_path20.default.join(canonical, "ios");
37204
- if (import_node_fs19.default.lstatSync(ios).isSymbolicLink())
37325
+ const ios = import_node_path21.default.join(canonical, "ios");
37326
+ if (import_node_fs20.default.lstatSync(ios).isSymbolicLink())
37205
37327
  throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
37206
37328
  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);
37329
+ for (const child of import_node_fs20.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
37330
+ const file = import_node_path21.default.join(dir, child.name);
37209
37331
  if (child.isSymbolicLink())
37210
37332
  throw new Error(`Expo Swift source is a symlink: ${file}`);
37211
37333
  if (child.isDirectory()) {
@@ -37213,13 +37335,13 @@ async function collectExpoSwiftSources(appRoot) {
37213
37335
  continue;
37214
37336
  }
37215
37337
  if (!child.name.endsWith(".swift")) continue;
37216
- const size = import_node_fs19.default.statSync(file).size;
37338
+ const size = import_node_fs20.default.statSync(file).size;
37217
37339
  bytes += size;
37218
37340
  fileCount++;
37219
37341
  if (fileCount > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
37220
37342
  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")}`;
37343
+ files2[`Sources/${namespace}/${import_node_path21.default.relative(ios, file).split(import_node_path21.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
37344
+ ${import_node_fs20.default.readFileSync(file, "utf8")}`;
37223
37345
  }
37224
37346
  };
37225
37347
  walk2(ios);
@@ -37303,7 +37425,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
37303
37425
  modules: [],
37304
37426
  failures: []
37305
37427
  };
37306
- const key2 = (0, import_node_crypto9.createHash)("sha256").update(import_node_fs19.default.realpathSync(root)).digest("hex");
37428
+ const key2 = (0, import_node_crypto9.createHash)("sha256").update(import_node_fs20.default.realpathSync(root)).digest("hex");
37307
37429
  const linked = [];
37308
37430
  for (const unit of units) {
37309
37431
  if (!module2) {
@@ -37313,14 +37435,14 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
37313
37435
  });
37314
37436
  continue;
37315
37437
  }
37316
- const packagePath = import_node_path20.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, unit.moduleId);
37438
+ const packagePath = import_node_path21.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, unit.moduleId);
37317
37439
  let stamp;
37318
37440
  try {
37319
37441
  syncSwiftTree(
37320
37442
  packagePath,
37321
37443
  new Map(
37322
37444
  Object.entries(unit.files).map(([name2, source]) => [
37323
- import_node_path20.default.join(packagePath, name2),
37445
+ import_node_path21.default.join(packagePath, name2),
37324
37446
  source
37325
37447
  ])
37326
37448
  )
@@ -37345,10 +37467,13 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
37345
37467
  const file = JSON.parse(match[1]);
37346
37468
  return typeof file === "string" ? [file] : [];
37347
37469
  });
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))
37470
+ const errors = diagnostic.match(/^.+:\d+(?::\d+)?: error:.*$/gm) ?? [];
37471
+ const sourceErrors = errors.filter(
37472
+ (line) => appPaths.some((file) => line.startsWith(`${file}:`)) && !/external macro implementation type|failed to load library plugin/.test(line)
37473
+ );
37474
+ if (publishArtifact && (sourceErrors.length === 0 || sourceErrors.length !== errors.length) && !(error instanceof SwiftMissingModulesError))
37350
37475
  throw error;
37351
- if (sourceErrors.length && module2 && stamp && sourceStamp(packagePath, module2.root) === stamp) {
37476
+ if (sourceErrors.length && sourceErrors.length === errors.length && module2 && stamp && sourceStamp(packagePath, module2.root) === stamp) {
37352
37477
  failedCompilations.set(packagePath, {
37353
37478
  stamp,
37354
37479
  diagnostic: sourceErrors.join("\n")
@@ -37378,12 +37503,12 @@ async function compileExpoSwiftModules(root, base, publishArtifact) {
37378
37503
  import PackageDescription
37379
37504
  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
37505
  `;
37381
- const packagePath = import_node_path20.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, "linked-app");
37506
+ const packagePath = import_node_path21.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, "linked-app");
37382
37507
  syncSwiftTree(
37383
37508
  packagePath,
37384
37509
  new Map(
37385
37510
  Object.entries(files2).map(([name2, source]) => [
37386
- import_node_path20.default.join(packagePath, name2),
37511
+ import_node_path21.default.join(packagePath, name2),
37387
37512
  source
37388
37513
  ])
37389
37514
  )
@@ -37426,7 +37551,7 @@ async function handleExpoSwiftRequest(req, res) {
37426
37551
  return true;
37427
37552
  }
37428
37553
  const root = url.searchParams.get("root");
37429
- if (!root || !import_node_path20.default.isAbsolute(root)) {
37554
+ if (!root || !import_node_path21.default.isAbsolute(root)) {
37430
37555
  res.writeHead(400);
37431
37556
  res.end("missing absolute app root");
37432
37557
  return true;
@@ -37455,16 +37580,16 @@ async function handleExpoSwiftRequest(req, res) {
37455
37580
  }
37456
37581
  return true;
37457
37582
  }
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;
37583
+ 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
37584
  var init_expo_swift_host = __esm({
37460
37585
  "src/expo-swift-host.ts"() {
37461
37586
  "use strict";
37462
37587
  import_node_child_process10 = require("node:child_process");
37463
37588
  import_node_crypto9 = require("node:crypto");
37464
- import_node_fs19 = __toESM(require("node:fs"), 1);
37589
+ import_node_fs20 = __toESM(require("node:fs"), 1);
37465
37590
  import_node_module = require("node:module");
37466
37591
  import_node_os9 = __toESM(require("node:os"), 1);
37467
- import_node_path20 = __toESM(require("node:path"), 1);
37592
+ import_node_path21 = __toESM(require("node:path"), 1);
37468
37593
  import_node_util3 = require("node:util");
37469
37594
  init_internal_child();
37470
37595
  init_backend_origin();
@@ -37648,14 +37773,14 @@ var init_standalone = __esm({
37648
37773
  // cli/self-invocation.ts
37649
37774
  function sourceEntryPath() {
37650
37775
  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;
37776
+ const candidate = (0, import_node_path22.join)((0, import_node_path22.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
37777
+ return (0, import_node_fs21.existsSync)(candidate) ? candidate : null;
37653
37778
  } catch {
37654
37779
  return null;
37655
37780
  }
37656
37781
  }
37657
- function isCliEntry(path37) {
37658
- const name2 = (0, import_node_path21.basename)(path37);
37782
+ function isCliEntry(path38) {
37783
+ const name2 = (0, import_node_path22.basename)(path38);
37659
37784
  return name2 === "bin.ts" || name2 === "bin.js";
37660
37785
  }
37661
37786
  function rnxSelfInvocation() {
@@ -37673,12 +37798,12 @@ function rnxSelfInvocation() {
37673
37798
  }
37674
37799
  return { executable: process.execPath, prefixArgs: [entry] };
37675
37800
  }
37676
- var import_node_fs20, import_node_path21, import_node_url3;
37801
+ var import_node_fs21, import_node_path22, import_node_url3;
37677
37802
  var init_self_invocation = __esm({
37678
37803
  "cli/self-invocation.ts"() {
37679
37804
  "use strict";
37680
- import_node_fs20 = require("node:fs");
37681
- import_node_path21 = require("node:path");
37805
+ import_node_fs21 = require("node:fs");
37806
+ import_node_path22 = require("node:path");
37682
37807
  import_node_url3 = require("node:url");
37683
37808
  init_public_brand();
37684
37809
  init_standalone();
@@ -37746,7 +37871,7 @@ function getUserDataDir() {
37746
37871
  return userDataDir();
37747
37872
  }
37748
37873
  function storeFile() {
37749
- return import_node_path22.default.join(userDataDir(), "attached-projects.json");
37874
+ return import_node_path23.default.join(userDataDir(), "attached-projects.json");
37750
37875
  }
37751
37876
  function cloneEmpty() {
37752
37877
  return {
@@ -37760,7 +37885,7 @@ function loadStore() {
37760
37885
  const file = storeFile();
37761
37886
  let raw2;
37762
37887
  try {
37763
- raw2 = import_node_fs21.default.readFileSync(file, "utf8");
37888
+ raw2 = import_node_fs22.default.readFileSync(file, "utf8");
37764
37889
  } catch (err) {
37765
37890
  if (err.code === "ENOENT") return cloneEmpty();
37766
37891
  throw err;
@@ -37777,7 +37902,7 @@ function loadStore() {
37777
37902
  } catch (err) {
37778
37903
  const quarantine = `${file}.corrupt-${Date.now()}`;
37779
37904
  try {
37780
- import_node_fs21.default.renameSync(file, quarantine);
37905
+ import_node_fs22.default.renameSync(file, quarantine);
37781
37906
  console.warn(
37782
37907
  `[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
37783
37908
  );
@@ -37788,16 +37913,16 @@ function loadStore() {
37788
37913
  }
37789
37914
  function writeStore(store) {
37790
37915
  const file = storeFile();
37791
- import_node_fs21.default.mkdirSync(import_node_path22.default.dirname(file), { recursive: true });
37916
+ import_node_fs22.default.mkdirSync(import_node_path23.default.dirname(file), { recursive: true });
37792
37917
  const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
37793
- const fd = import_node_fs21.default.openSync(tmp, "w", 384);
37918
+ const fd = import_node_fs22.default.openSync(tmp, "w", 384);
37794
37919
  try {
37795
- import_node_fs21.default.writeFileSync(fd, JSON.stringify(store, null, 2));
37796
- import_node_fs21.default.fsyncSync(fd);
37920
+ import_node_fs22.default.writeFileSync(fd, JSON.stringify(store, null, 2));
37921
+ import_node_fs22.default.fsyncSync(fd);
37797
37922
  } finally {
37798
- import_node_fs21.default.closeSync(fd);
37923
+ import_node_fs22.default.closeSync(fd);
37799
37924
  }
37800
- import_node_fs21.default.renameSync(tmp, file);
37925
+ import_node_fs22.default.renameSync(tmp, file);
37801
37926
  }
37802
37927
  function mutateStore(fn) {
37803
37928
  const store = loadStore();
@@ -37806,13 +37931,13 @@ function mutateStore(fn) {
37806
37931
  return store;
37807
37932
  }
37808
37933
  function projectIdForCwd(cwd) {
37809
- return (0, import_node_crypto10.createHash)("sha256").update(import_node_path22.default.resolve(cwd)).digest("hex").slice(0, 16);
37934
+ return (0, import_node_crypto10.createHash)("sha256").update(import_node_path23.default.resolve(cwd)).digest("hex").slice(0, 16);
37810
37935
  }
37811
37936
  function newSessionId() {
37812
37937
  return `s_${(0, import_node_crypto10.randomBytes)(10).toString("hex")}`;
37813
37938
  }
37814
37939
  function upsertProject(input) {
37815
- const cwd = import_node_path22.default.resolve(input.cwd);
37940
+ const cwd = import_node_path23.default.resolve(input.cwd);
37816
37941
  const id = projectIdForCwd(cwd);
37817
37942
  let result;
37818
37943
  mutateStore((store) => {
@@ -37838,7 +37963,7 @@ function upsertProject(input) {
37838
37963
  const now = Date.now();
37839
37964
  const created = {
37840
37965
  id,
37841
- name: input.name ?? import_node_path22.default.basename(cwd),
37966
+ name: input.name ?? import_node_path23.default.basename(cwd),
37842
37967
  cwd,
37843
37968
  repoRoot: input.repoRoot,
37844
37969
  sourceRoots: input.sourceRoots ?? [cwd],
@@ -37983,8 +38108,8 @@ async function seedFromDemoAppRegistry() {
37983
38108
  if (apps.length === 0) return;
37984
38109
  mutateStore((store) => {
37985
38110
  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);
38111
+ if (!import_node_fs22.default.existsSync(app.dir)) continue;
38112
+ const cwd = import_node_path23.default.resolve(app.dir);
37988
38113
  const id = projectIdForCwd(cwd);
37989
38114
  if (store.attachedProjects.some((p) => p.id === id)) continue;
37990
38115
  const now = Date.now();
@@ -38005,13 +38130,13 @@ async function seedFromDemoAppRegistry() {
38005
38130
  }
38006
38131
  });
38007
38132
  }
38008
- var import_node_crypto10, import_node_fs21, import_node_path22, overrideDir, COST_HISTORY_MAX_AGE_MS;
38133
+ var import_node_crypto10, import_node_fs22, import_node_path23, overrideDir, COST_HISTORY_MAX_AGE_MS;
38009
38134
  var init_attached_projects = __esm({
38010
38135
  "src/attached-projects.ts"() {
38011
38136
  "use strict";
38012
38137
  import_node_crypto10 = require("node:crypto");
38013
- import_node_fs21 = __toESM(require("node:fs"), 1);
38014
- import_node_path22 = __toESM(require("node:path"), 1);
38138
+ import_node_fs22 = __toESM(require("node:fs"), 1);
38139
+ import_node_path23 = __toESM(require("node:path"), 1);
38015
38140
  init_home_paths();
38016
38141
  overrideDir = null;
38017
38142
  COST_HISTORY_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
@@ -38020,16 +38145,16 @@ var init_attached_projects = __esm({
38020
38145
 
38021
38146
  // src/agent-sessions.ts
38022
38147
  function sessionDir(sessionId) {
38023
- return import_node_path23.default.join(getUserDataDir(), "sessions", sessionId);
38148
+ return import_node_path24.default.join(getUserDataDir(), "sessions", sessionId);
38024
38149
  }
38025
38150
  function promptFifoPath(sessionId) {
38026
- return import_node_path23.default.join(sessionDir(sessionId), "prompt.in");
38151
+ return import_node_path24.default.join(sessionDir(sessionId), "prompt.in");
38027
38152
  }
38028
38153
  function eventsFifoPath(sessionId) {
38029
- return import_node_path23.default.join(sessionDir(sessionId), "events.out");
38154
+ return import_node_path24.default.join(sessionDir(sessionId), "events.out");
38030
38155
  }
38031
38156
  function transcriptPath(sessionId) {
38032
- return import_node_path23.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
38157
+ return import_node_path24.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
38033
38158
  }
38034
38159
  function pidIsAlive(pid, sessionId) {
38035
38160
  if (!pid) return false;
@@ -38039,7 +38164,7 @@ function pidIsAlive(pid, sessionId) {
38039
38164
  return false;
38040
38165
  }
38041
38166
  if (sessionId) {
38042
- if (!import_node_fs22.default.existsSync(sessionDir(sessionId))) return false;
38167
+ if (!import_node_fs23.default.existsSync(sessionDir(sessionId))) return false;
38043
38168
  }
38044
38169
  return true;
38045
38170
  }
@@ -38052,11 +38177,11 @@ function resolveSootsimInvocation() {
38052
38177
  const resourcesPath = process.resourcesPath;
38053
38178
  if (resourcesPath) {
38054
38179
  const candidates = [
38055
- import_node_path23.default.join(resourcesPath, "bin", "sootsim"),
38056
- import_node_path23.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
38180
+ import_node_path24.default.join(resourcesPath, "bin", "sootsim"),
38181
+ import_node_path24.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
38057
38182
  ];
38058
38183
  for (const c of candidates) {
38059
- if (import_node_fs22.default.existsSync(c)) return { executable: c, prefixArgs: [] };
38184
+ if (import_node_fs23.default.existsSync(c)) return { executable: c, prefixArgs: [] };
38060
38185
  }
38061
38186
  }
38062
38187
  }
@@ -38075,15 +38200,15 @@ function tryWorkspaceSootsim() {
38075
38200
  const sootsimDir = resolveSootsimPackageDir();
38076
38201
  if (!sootsimDir) return null;
38077
38202
  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)) {
38203
+ const distBinary = import_node_path24.default.join(sootsimDir, "dist-bin", binaryName);
38204
+ if (import_node_fs23.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
38205
+ const distBin = import_node_path24.default.join(sootsimDir, "dist-cli", "bin.js");
38206
+ if (import_node_fs23.default.existsSync(distBin)) {
38082
38207
  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;
38208
+ const src = import_node_path24.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
38209
+ if (import_node_fs23.default.existsSync(src)) {
38210
+ const srcMtime = import_node_fs23.default.statSync(src).mtimeMs;
38211
+ const buildMtime = import_node_fs23.default.statSync(distBin).mtimeMs;
38087
38212
  if (buildMtime < srcMtime) {
38088
38213
  console.warn(
38089
38214
  `[peach] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with \`bun run --cwd packages/peachsim build:cli\`.`
@@ -38102,22 +38227,22 @@ function tryWorkspaceSootsim() {
38102
38227
  function resolveSootsimPackageDir() {
38103
38228
  try {
38104
38229
  const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
38105
- return import_node_path23.default.dirname(resolved);
38230
+ return import_node_path24.default.dirname(resolved);
38106
38231
  } catch {
38107
38232
  }
38108
38233
  const here = fileFromImportMeta();
38109
38234
  if (!here) return null;
38110
- let cur = import_node_path23.default.dirname(here);
38235
+ let cur = import_node_path24.default.dirname(here);
38111
38236
  for (let i = 0; i < 8; i++) {
38112
- const pkg = import_node_path23.default.join(cur, "package.json");
38237
+ const pkg = import_node_path24.default.join(cur, "package.json");
38113
38238
  try {
38114
- if (import_node_fs22.default.existsSync(pkg)) {
38115
- const parsed = JSON.parse(import_node_fs22.default.readFileSync(pkg, "utf8"));
38239
+ if (import_node_fs23.default.existsSync(pkg)) {
38240
+ const parsed = JSON.parse(import_node_fs23.default.readFileSync(pkg, "utf8"));
38116
38241
  if (parsed.name === rnxPublicBrand.packageName) return cur;
38117
38242
  }
38118
38243
  } catch {
38119
38244
  }
38120
- const parent = import_node_path23.default.dirname(cur);
38245
+ const parent = import_node_path24.default.dirname(cur);
38121
38246
  if (parent === cur) break;
38122
38247
  cur = parent;
38123
38248
  }
@@ -38133,28 +38258,28 @@ function fileFromImportMeta() {
38133
38258
  }
38134
38259
  }
38135
38260
  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 });
38261
+ const lockDir = import_node_path24.default.join(getUserDataDir(), "locks");
38262
+ import_node_fs23.default.mkdirSync(lockDir, { recursive: true });
38138
38263
  try {
38139
- import_node_fs22.default.chmodSync(lockDir, 448);
38264
+ import_node_fs23.default.chmodSync(lockDir, 448);
38140
38265
  } catch {
38141
38266
  }
38142
- const lockPath = import_node_path23.default.join(lockDir, `start-${projectId}-${provider}.lock`);
38267
+ const lockPath = import_node_path24.default.join(lockDir, `start-${projectId}-${provider}.lock`);
38143
38268
  const deadline = Date.now() + 4e3;
38144
38269
  let fd = null;
38145
38270
  while (fd === null) {
38146
38271
  try {
38147
- fd = import_node_fs22.default.openSync(
38272
+ fd = import_node_fs23.default.openSync(
38148
38273
  lockPath,
38149
- import_node_fs22.constants.O_WRONLY | import_node_fs22.constants.O_CREAT | import_node_fs22.constants.O_EXCL,
38274
+ import_node_fs23.constants.O_WRONLY | import_node_fs23.constants.O_CREAT | import_node_fs23.constants.O_EXCL,
38150
38275
  384
38151
38276
  );
38152
38277
  } catch (err) {
38153
38278
  if (err.code !== "EEXIST") throw err;
38154
38279
  try {
38155
- const stale = Number(import_node_fs22.default.readFileSync(lockPath, "utf8").trim());
38280
+ const stale = Number(import_node_fs23.default.readFileSync(lockPath, "utf8").trim());
38156
38281
  if (stale && !isProcessAlive(stale)) {
38157
- import_node_fs22.default.unlinkSync(lockPath);
38282
+ import_node_fs23.default.unlinkSync(lockPath);
38158
38283
  continue;
38159
38284
  }
38160
38285
  } catch {
@@ -38168,15 +38293,15 @@ async function withStartLock(projectId, provider, fn) {
38168
38293
  }
38169
38294
  }
38170
38295
  try {
38171
- import_node_fs22.default.writeFileSync(fd, String(process.pid));
38296
+ import_node_fs23.default.writeFileSync(fd, String(process.pid));
38172
38297
  return await fn();
38173
38298
  } finally {
38174
38299
  try {
38175
- import_node_fs22.default.closeSync(fd);
38300
+ import_node_fs23.default.closeSync(fd);
38176
38301
  } catch {
38177
38302
  }
38178
38303
  try {
38179
- import_node_fs22.default.unlinkSync(lockPath);
38304
+ import_node_fs23.default.unlinkSync(lockPath);
38180
38305
  } catch {
38181
38306
  }
38182
38307
  }
@@ -38190,25 +38315,25 @@ function isProcessAlive(pid) {
38190
38315
  }
38191
38316
  }
38192
38317
  function mkfifoSync(p) {
38193
- const parent = import_node_path23.default.dirname(p);
38194
- import_node_fs22.default.mkdirSync(parent, { recursive: true });
38318
+ const parent = import_node_path24.default.dirname(p);
38319
+ import_node_fs23.default.mkdirSync(parent, { recursive: true });
38195
38320
  try {
38196
- import_node_fs22.default.chmodSync(parent, 448);
38321
+ import_node_fs23.default.chmodSync(parent, 448);
38197
38322
  } catch {
38198
38323
  }
38199
- if (import_node_fs22.default.existsSync(p)) {
38324
+ if (import_node_fs23.default.existsSync(p)) {
38200
38325
  try {
38201
- const stat2 = import_node_fs22.default.statSync(p);
38326
+ const stat2 = import_node_fs23.default.statSync(p);
38202
38327
  if (stat2.isFIFO()) {
38203
38328
  try {
38204
- import_node_fs22.default.chmodSync(p, 384);
38329
+ import_node_fs23.default.chmodSync(p, 384);
38205
38330
  } catch {
38206
38331
  }
38207
38332
  return;
38208
38333
  }
38209
- import_node_fs22.default.unlinkSync(p);
38334
+ import_node_fs23.default.unlinkSync(p);
38210
38335
  } catch {
38211
- import_node_fs22.default.unlinkSync(p);
38336
+ import_node_fs23.default.unlinkSync(p);
38212
38337
  }
38213
38338
  }
38214
38339
  const result = (0, import_node_child_process11.spawnSync)("mkfifo", ["-m", "600", p]);
@@ -38248,10 +38373,10 @@ async function startSession(opts) {
38248
38373
  const transcript = transcriptPath(session.id);
38249
38374
  mkfifoSync(promptIn);
38250
38375
  mkfifoSync(eventsOut);
38251
- const transcriptDir = import_node_path23.default.dirname(transcript);
38252
- import_node_fs22.default.mkdirSync(transcriptDir, { recursive: true });
38376
+ const transcriptDir = import_node_path24.default.dirname(transcript);
38377
+ import_node_fs23.default.mkdirSync(transcriptDir, { recursive: true });
38253
38378
  try {
38254
- import_node_fs22.default.chmodSync(transcriptDir, 448);
38379
+ import_node_fs23.default.chmodSync(transcriptDir, 448);
38255
38380
  } catch {
38256
38381
  }
38257
38382
  const { executable, prefixArgs } = resolveSootsimInvocation();
@@ -38302,7 +38427,7 @@ async function startSession(opts) {
38302
38427
  }
38303
38428
  }
38304
38429
  try {
38305
- import_node_fs22.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
38430
+ import_node_fs23.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
38306
38431
  } catch {
38307
38432
  }
38308
38433
  updateSessionStatus(session.id, { status: "ended" });
@@ -38330,18 +38455,18 @@ async function sendPrompt(sessionId, prompt) {
38330
38455
  );
38331
38456
  }
38332
38457
  const fifo = promptFifoPath(sessionId);
38333
- if (!import_node_fs22.default.existsSync(fifo)) {
38458
+ if (!import_node_fs23.default.existsSync(fifo)) {
38334
38459
  throw new AgentSessionError("NO_FIFO", `prompt FIFO missing: ${fifo}`);
38335
38460
  }
38336
- const fd = import_node_fs22.default.openSync(fifo, import_node_fs22.constants.O_WRONLY);
38461
+ const fd = import_node_fs23.default.openSync(fifo, import_node_fs23.constants.O_WRONLY);
38337
38462
  try {
38338
38463
  const wireText = encodeAgentPromptEnvelope(prompt);
38339
38464
  if (!wireText) {
38340
38465
  throw new AgentSessionError("EMPTY_PROMPT", "prompt text is empty");
38341
38466
  }
38342
- import_node_fs22.default.writeSync(fd, wireText + "\n");
38467
+ import_node_fs23.default.writeSync(fd, wireText + "\n");
38343
38468
  } finally {
38344
- import_node_fs22.default.closeSync(fd);
38469
+ import_node_fs23.default.closeSync(fd);
38345
38470
  }
38346
38471
  updateSessionStatus(sessionId, {
38347
38472
  lastPrompt: prompt.displayText ?? prompt.text,
@@ -38363,7 +38488,7 @@ async function endSession(sessionId) {
38363
38488
  const base = getUserDataDir();
38364
38489
  if (dir.startsWith(base)) {
38365
38490
  try {
38366
- import_node_fs22.default.rmSync(dir, { recursive: true, force: true });
38491
+ import_node_fs23.default.rmSync(dir, { recursive: true, force: true });
38367
38492
  } catch {
38368
38493
  }
38369
38494
  }
@@ -38371,11 +38496,11 @@ async function endSession(sessionId) {
38371
38496
  }
38372
38497
  function subscribeEvents(sessionId, onEvent) {
38373
38498
  const fifo = eventsFifoPath(sessionId);
38374
- if (!import_node_fs22.default.existsSync(fifo)) {
38499
+ if (!import_node_fs23.default.existsSync(fifo)) {
38375
38500
  throw new AgentSessionError("NO_FIFO", `events FIFO missing: ${fifo}`);
38376
38501
  }
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 });
38502
+ const fd = import_node_fs23.default.openSync(fifo, import_node_fs23.constants.O_RDWR);
38503
+ const stream = import_node_fs23.default.createReadStream("", { fd, autoClose: true });
38379
38504
  const rl = import_node_readline.default.createInterface({ input: stream, crlfDelay: Infinity });
38380
38505
  rl.on("line", (line) => {
38381
38506
  const event = parseAgentEventLine(line);
@@ -38386,7 +38511,7 @@ function subscribeEvents(sessionId, onEvent) {
38386
38511
  if (closed) return;
38387
38512
  closed = true;
38388
38513
  try {
38389
- import_node_fs22.default.writeSync(fd, "\n");
38514
+ import_node_fs23.default.writeSync(fd, "\n");
38390
38515
  } catch {
38391
38516
  }
38392
38517
  try {
@@ -38400,7 +38525,7 @@ function subscribeEvents(sessionId, onEvent) {
38400
38525
  };
38401
38526
  }
38402
38527
  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);
38528
+ const fd = import_node_fs23.default.openSync(fifo, import_node_fs23.constants.O_RDWR | import_node_fs23.constants.O_NONBLOCK);
38404
38529
  const buf = Buffer.alloc(8192);
38405
38530
  let leftover = "";
38406
38531
  const deadline = Date.now() + timeoutMs;
@@ -38408,7 +38533,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
38408
38533
  while (Date.now() < deadline) {
38409
38534
  let n = 0;
38410
38535
  try {
38411
- n = import_node_fs22.default.readSync(fd, buf, 0, buf.length, null);
38536
+ n = import_node_fs23.default.readSync(fd, buf, 0, buf.length, null);
38412
38537
  } catch (err) {
38413
38538
  if (err.code !== "EAGAIN") throw err;
38414
38539
  n = 0;
@@ -38428,17 +38553,17 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
38428
38553
  }
38429
38554
  return null;
38430
38555
  } finally {
38431
- import_node_fs22.default.closeSync(fd);
38556
+ import_node_fs23.default.closeSync(fd);
38432
38557
  }
38433
38558
  }
38434
- var import_node_child_process11, import_node_crypto11, import_node_fs22, import_node_path23, import_node_readline, AgentSessionError;
38559
+ var import_node_child_process11, import_node_crypto11, import_node_fs23, import_node_path24, import_node_readline, AgentSessionError;
38435
38560
  var init_agent_sessions = __esm({
38436
38561
  "src/agent-sessions.ts"() {
38437
38562
  "use strict";
38438
38563
  import_node_child_process11 = require("node:child_process");
38439
38564
  import_node_crypto11 = require("node:crypto");
38440
- import_node_fs22 = __toESM(require("node:fs"), 1);
38441
- import_node_path23 = __toESM(require("node:path"), 1);
38565
+ import_node_fs23 = __toESM(require("node:fs"), 1);
38566
+ import_node_path24 = __toESM(require("node:path"), 1);
38442
38567
  import_node_readline = __toESM(require("node:readline"), 1);
38443
38568
  init_self_invocation();
38444
38569
  init_standalone();
@@ -38469,13 +38594,13 @@ function mapFrameworkToProjectFramework(fw) {
38469
38594
  if (fw === "one" || fw === "vxrn") return "one";
38470
38595
  return "unknown";
38471
38596
  }
38472
- var import_node_crypto12, import_node_fs23, import_node_path24, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
38597
+ var import_node_crypto12, import_node_fs24, import_node_path25, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
38473
38598
  var init_agent_host = __esm({
38474
38599
  "src/host/agent-host.ts"() {
38475
38600
  "use strict";
38476
38601
  import_node_crypto12 = require("node:crypto");
38477
- import_node_fs23 = __toESM(require("node:fs"), 1);
38478
- import_node_path24 = __toESM(require("node:path"), 1);
38602
+ import_node_fs24 = __toESM(require("node:fs"), 1);
38603
+ import_node_path25 = __toESM(require("node:path"), 1);
38479
38604
  init_dev_server_scanner();
38480
38605
  init_agent_sessions();
38481
38606
  init_attached_projects();
@@ -38721,7 +38846,7 @@ var init_agent_host = __esm({
38721
38846
  );
38722
38847
  const project = upsertProject({
38723
38848
  cwd: match.cwd,
38724
- name: match.projectName ?? import_node_path24.default.basename(match.cwd),
38849
+ name: match.projectName ?? import_node_path25.default.basename(match.cwd),
38725
38850
  preferredProvider: input.provider ?? existing?.preferredProvider,
38726
38851
  sourceRoots: existing?.sourceRoots ?? [match.cwd],
38727
38852
  knownBundleUrls,
@@ -38732,18 +38857,18 @@ var init_agent_host = __esm({
38732
38857
  }
38733
38858
  getTranscript(sessionId) {
38734
38859
  const p = transcriptPath(sessionId);
38735
- if (!import_node_fs23.default.existsSync(p)) {
38860
+ if (!import_node_fs24.default.existsSync(p)) {
38736
38861
  return { error: "transcript not found", code: "NO_TRANSCRIPT" };
38737
38862
  }
38738
- return import_node_fs23.default.readFileSync(p, "utf8");
38863
+ return import_node_fs24.default.readFileSync(p, "utf8");
38739
38864
  }
38740
38865
  getPaths() {
38741
38866
  const dir = getUserDataDir();
38742
38867
  return {
38743
38868
  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")
38869
+ storeFile: import_node_path25.default.join(dir, "attached-projects.json"),
38870
+ sessionsDir: import_node_path25.default.join(dir, "sessions"),
38871
+ transcriptsDir: import_node_path25.default.join(dir, "transcripts")
38747
38872
  };
38748
38873
  }
38749
38874
  // --- subscription management ---
@@ -39770,23 +39895,23 @@ function looksBinary(filePath, size) {
39770
39895
  if (size === 0) return false;
39771
39896
  let fd;
39772
39897
  try {
39773
- fd = import_node_fs24.default.openSync(filePath, "r");
39898
+ fd = import_node_fs25.default.openSync(filePath, "r");
39774
39899
  const buffer = Buffer.alloc(Math.min(BINARY_SNIFF_BYTES, size));
39775
- const read = import_node_fs24.default.readSync(fd, buffer, 0, buffer.length, 0);
39900
+ const read = import_node_fs25.default.readSync(fd, buffer, 0, buffer.length, 0);
39776
39901
  return buffer.subarray(0, read).includes(0);
39777
39902
  } catch {
39778
39903
  return false;
39779
39904
  } finally {
39780
- if (fd !== void 0) import_node_fs24.default.closeSync(fd);
39905
+ if (fd !== void 0) import_node_fs25.default.closeSync(fd);
39781
39906
  }
39782
39907
  }
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;
39908
+ 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
39909
  var init_checkout_plane = __esm({
39785
39910
  "cli/commands/box/checkout-plane.ts"() {
39786
39911
  "use strict";
39787
39912
  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);
39913
+ import_node_fs25 = __toESM(require("node:fs"), 1);
39914
+ import_node_path26 = __toESM(require("node:path"), 1);
39790
39915
  CheckoutRequiresGitError = class extends Error {
39791
39916
  };
39792
39917
  BINARY_SNIFF_BYTES = 8192;
@@ -39803,7 +39928,7 @@ var init_checkout_plane = __esm({
39803
39928
  listTimeoutMs;
39804
39929
  trackedOnly;
39805
39930
  constructor(root, options = {}) {
39806
- this.root = import_node_path25.default.resolve(root);
39931
+ this.root = import_node_path26.default.resolve(root);
39807
39932
  this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
39808
39933
  this.trackedOnly = options.trackedOnly ?? false;
39809
39934
  }
@@ -39865,13 +39990,13 @@ var init_checkout_plane = __esm({
39865
39990
  if (!relative3) continue;
39866
39991
  let stat2;
39867
39992
  try {
39868
- stat2 = import_node_fs24.default.statSync(import_node_path25.default.join(this.root, relative3));
39993
+ stat2 = import_node_fs25.default.statSync(import_node_path26.default.join(this.root, relative3));
39869
39994
  } catch {
39870
39995
  continue;
39871
39996
  }
39872
39997
  if (!stat2.isFile()) continue;
39873
39998
  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);
39999
+ 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
40000
  nextSniffed.set(relative3, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary: binary2 });
39876
40001
  next.set(relative3, {
39877
40002
  size: stat2.size,
@@ -39885,22 +40010,22 @@ var init_checkout_plane = __esm({
39885
40010
  this.sniffed = nextSniffed;
39886
40011
  }
39887
40012
  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}`)) {
40013
+ const resolved = import_node_path26.default.resolve(this.root, planePath);
40014
+ if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path26.default.sep}`)) {
39890
40015
  throw new Error(`path escapes the project: ${planePath}`);
39891
40016
  }
39892
40017
  return resolved;
39893
40018
  }
39894
40019
  async read(planePath) {
39895
- return import_node_fs24.default.promises.readFile(this.absolute(planePath), "utf8");
40020
+ return import_node_fs25.default.promises.readFile(this.absolute(planePath), "utf8");
39896
40021
  }
39897
40022
  async readBytes(planePath) {
39898
- return import_node_fs24.default.promises.readFile(this.absolute(planePath));
40023
+ return import_node_fs25.default.promises.readFile(this.absolute(planePath));
39899
40024
  }
39900
40025
  async write(planePath, content) {
39901
40026
  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);
40027
+ await import_node_fs25.default.promises.mkdir(import_node_path26.default.dirname(absolute), { recursive: true });
40028
+ await import_node_fs25.default.promises.writeFile(absolute, content);
39904
40029
  this.entries.set(planePath, {
39905
40030
  size: content.byteLength,
39906
40031
  readOnly: false,
@@ -39909,7 +40034,7 @@ var init_checkout_plane = __esm({
39909
40034
  });
39910
40035
  }
39911
40036
  async delete(planePath) {
39912
- await import_node_fs24.default.promises.rm(this.absolute(planePath), { force: true });
40037
+ await import_node_fs25.default.promises.rm(this.absolute(planePath), { force: true });
39913
40038
  this.entries.delete(planePath);
39914
40039
  }
39915
40040
  };
@@ -39917,12 +40042,12 @@ var init_checkout_plane = __esm({
39917
40042
  });
39918
40043
 
39919
40044
  // src/host/plane-host.ts
39920
- var import_node_fs25, import_node_path26, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
40045
+ var import_node_fs26, import_node_path27, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
39921
40046
  var init_plane_host = __esm({
39922
40047
  "src/host/plane-host.ts"() {
39923
40048
  "use strict";
39924
- import_node_fs25 = __toESM(require("node:fs"), 1);
39925
- import_node_path26 = __toESM(require("node:path"), 1);
40049
+ import_node_fs26 = __toESM(require("node:fs"), 1);
40050
+ import_node_path27 = __toESM(require("node:path"), 1);
39926
40051
  init_plane();
39927
40052
  init_checkout_plane();
39928
40053
  WS_OPEN2 = 1;
@@ -40045,14 +40170,14 @@ var init_plane_host = __esm({
40045
40170
  // root and an opened one cannot disagree about the same directory.
40046
40171
  realRoot(root) {
40047
40172
  if (!root) throw new Error("root is required");
40048
- const resolved = import_node_path26.default.resolve(root);
40173
+ const resolved = import_node_path27.default.resolve(root);
40049
40174
  let real;
40050
40175
  try {
40051
- real = import_node_fs25.default.realpathSync(resolved);
40176
+ real = import_node_fs26.default.realpathSync(resolved);
40052
40177
  } catch {
40053
40178
  throw new Error(`no such directory: ${resolved}`);
40054
40179
  }
40055
- if (!import_node_fs25.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
40180
+ if (!import_node_fs26.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
40056
40181
  return real;
40057
40182
  }
40058
40183
  respond(ws, id, result) {
@@ -40408,16 +40533,16 @@ function sendJavaScript(req, res, source) {
40408
40533
  res.end(req.method === "HEAD" ? void 0 : source);
40409
40534
  }
40410
40535
  function resolveReplacementModuleFile(fromFile, specifier) {
40411
- const base = import_node_path27.default.resolve(import_node_path27.default.dirname(fromFile), specifier);
40536
+ const base = import_node_path28.default.resolve(import_node_path28.default.dirname(fromFile), specifier);
40412
40537
  const candidates = [
40413
40538
  ...REPLACEMENT_MODULE_EXTENSIONS.some(
40414
- (ext) => ext === import_node_path27.default.extname(base).toLowerCase()
40539
+ (ext) => ext === import_node_path28.default.extname(base).toLowerCase()
40415
40540
  ) ? [base] : [],
40416
40541
  ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
40417
- ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path27.default.join(base, `index${ext}`))
40542
+ ...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path28.default.join(base, `index${ext}`))
40418
40543
  ];
40419
40544
  const found = candidates.find(
40420
- (candidate) => (0, import_node_fs26.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
40545
+ (candidate) => (0, import_node_fs27.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
40421
40546
  );
40422
40547
  if (!found) {
40423
40548
  throw new Error(
@@ -40472,13 +40597,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
40472
40597
  res.end("missing path param");
40473
40598
  return true;
40474
40599
  }
40475
- const extension = import_node_path27.default.extname(targetPath).toLowerCase();
40600
+ const extension = import_node_path28.default.extname(targetPath).toLowerCase();
40476
40601
  if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
40477
40602
  res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
40478
40603
  res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
40479
40604
  return true;
40480
40605
  }
40481
- if (!import_node_path27.default.isAbsolute(targetPath)) {
40606
+ if (!import_node_path28.default.isAbsolute(targetPath)) {
40482
40607
  res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
40483
40608
  res.end("replacement file path must be absolute");
40484
40609
  return true;
@@ -40486,10 +40611,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
40486
40611
  const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
40487
40612
  let resolvedProjectRoot;
40488
40613
  if (options.projectRoot) {
40489
- const lexicalProjectRoot = import_node_path27.default.resolve(options.projectRoot);
40614
+ const lexicalProjectRoot = import_node_path28.default.resolve(options.projectRoot);
40490
40615
  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)) {
40616
+ const lexicalTarget = import_node_path28.default.relative(lexicalProjectRoot, targetPath);
40617
+ if (lexicalTarget.startsWith("..") || import_node_path28.default.isAbsolute(lexicalTarget)) {
40493
40618
  res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
40494
40619
  res.end("replacement file must be inside the project root");
40495
40620
  return true;
@@ -40505,8 +40630,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
40505
40630
  return true;
40506
40631
  }
40507
40632
  if (resolvedProjectRoot) {
40508
- const relativeTarget = import_node_path27.default.relative(resolvedProjectRoot, resolvedTargetPath);
40509
- if (relativeTarget.startsWith("..") || import_node_path27.default.isAbsolute(relativeTarget)) {
40633
+ const relativeTarget = import_node_path28.default.relative(resolvedProjectRoot, resolvedTargetPath);
40634
+ if (relativeTarget.startsWith("..") || import_node_path28.default.isAbsolute(relativeTarget)) {
40510
40635
  res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
40511
40636
  res.end("replacement file must be inside the project root");
40512
40637
  return true;
@@ -40541,13 +40666,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
40541
40666
  }
40542
40667
  return true;
40543
40668
  }
40544
- var import_node_fs26, import_promises5, import_node_path27, REPLACEMENT_MODULE_ROUTE;
40669
+ var import_node_fs27, import_promises5, import_node_path28, REPLACEMENT_MODULE_ROUTE;
40545
40670
  var init_replacement_module_handler = __esm({
40546
40671
  "src/host/replacement-module-handler.ts"() {
40547
40672
  "use strict";
40548
- import_node_fs26 = require("node:fs");
40673
+ import_node_fs27 = require("node:fs");
40549
40674
  import_promises5 = __toESM(require("node:fs/promises"), 1);
40550
- import_node_path27 = __toESM(require("node:path"), 1);
40675
+ import_node_path28 = __toESM(require("node:path"), 1);
40551
40676
  init_replacementModule();
40552
40677
  init_backend_origin();
40553
40678
  REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
@@ -42531,8 +42656,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
42531
42656
  }
42532
42657
  const out = [];
42533
42658
  for (const dir of dirs) {
42534
- const path37 = `${dir}/${filename}`;
42535
- if (!out.includes(path37)) out.push(path37);
42659
+ const path38 = `${dir}/${filename}`;
42660
+ if (!out.includes(path38)) out.push(path38);
42536
42661
  }
42537
42662
  if (!out.includes(filename)) out.push(filename);
42538
42663
  return out;
@@ -43486,13 +43611,13 @@ function readFactoryStringLiterals(factory) {
43486
43611
  return literals;
43487
43612
  }
43488
43613
  function normalizeFingerprintLiteral(literal) {
43489
- const path37 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
43614
+ const path38 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
43490
43615
  const nodeModulesMarker = "/node_modules/";
43491
- const nodeModulesIndex = path37.lastIndexOf(nodeModulesMarker);
43616
+ const nodeModulesIndex = path38.lastIndexOf(nodeModulesMarker);
43492
43617
  if (nodeModulesIndex >= 0) {
43493
- return `node_modules/${path37.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
43618
+ return `node_modules/${path38.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
43494
43619
  }
43495
- if ((path37.startsWith("/") || /^[A-Za-z]:\//.test(path37) || path37.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path37)) {
43620
+ if ((path38.startsWith("/") || /^[A-Za-z]:\//.test(path38) || path38.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path38)) {
43496
43621
  return null;
43497
43622
  }
43498
43623
  return literal;
@@ -43730,10 +43855,10 @@ function templateAssignment(template, embeddings) {
43730
43855
  if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
43731
43856
  nodesByModuleId.set(moduleId, nodeIndex);
43732
43857
  const node = template.nodes[nodeIndex];
43733
- const path37 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
43858
+ const path38 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
43734
43859
  const existingPath = pathsByModuleId.get(moduleId);
43735
- if (existingPath !== void 0 && existingPath !== path37) return null;
43736
- pathsByModuleId.set(moduleId, path37);
43860
+ if (existingPath !== void 0 && existingPath !== path38) return null;
43861
+ pathsByModuleId.set(moduleId, path38);
43737
43862
  }
43738
43863
  }
43739
43864
  return {
@@ -43895,14 +44020,14 @@ async function inferMetroModuleIdentity(args) {
43895
44020
  const packageClaims = claimsByPackage.values().next().value;
43896
44021
  if (!packageClaims) continue;
43897
44022
  const exactClaims = packageClaims.filter((assignment2) => {
43898
- const path37 = assignment2.pathsByModuleId.get(moduleId);
43899
- return path37 !== void 0 && !path37.includes("/__rnx_inferred__/");
44023
+ const path38 = assignment2.pathsByModuleId.get(moduleId);
44024
+ return path38 !== void 0 && !path38.includes("/__rnx_inferred__/");
43900
44025
  });
43901
44026
  const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
43902
44027
  const routes = new Set(
43903
44028
  preferredClaims.flatMap((assignment2) => {
43904
- const path37 = assignment2.pathsByModuleId.get(moduleId);
43905
- return path37 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path37)] : [];
44029
+ const path38 = assignment2.pathsByModuleId.get(moduleId);
44030
+ return path38 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path38)] : [];
43906
44031
  })
43907
44032
  );
43908
44033
  if (routes.size !== 1) continue;
@@ -44197,8 +44322,8 @@ function detectFramework2(deps) {
44197
44322
  return "unknown";
44198
44323
  }
44199
44324
  function detectProject(dir) {
44200
- const pkgPath = (0, import_node_path28.join)(dir, "package.json");
44201
- if (!(0, import_node_fs27.existsSync)(pkgPath)) return null;
44325
+ const pkgPath = (0, import_node_path29.join)(dir, "package.json");
44326
+ if (!(0, import_node_fs28.existsSync)(pkgPath)) return null;
44202
44327
  const pkg = readProjectManifest(dir);
44203
44328
  if (!pkg) return null;
44204
44329
  const deps = { ...pkg.dependencies, ...pkg.devDependencies };
@@ -44210,25 +44335,25 @@ function detectProject(dir) {
44210
44335
  if (framework === "unknown") return null;
44211
44336
  return {
44212
44337
  dir,
44213
- name: pkg.name || (0, import_node_path28.basename)(dir),
44338
+ name: pkg.name || (0, import_node_path29.basename)(dir),
44214
44339
  framework,
44215
44340
  // a config file is a config file whatever module system it declares. real
44216
44341
  // apps write .cjs as often as .js, and missing one reads as "this project
44217
44342
  // has no bundler config" and sends the user to create a second one.
44218
44343
  hasViteConfig: CONFIG_EXTENSIONS.some(
44219
- (ext) => (0, import_node_fs27.existsSync)((0, import_node_path28.join)(dir, `vite.config.${ext}`))
44344
+ (ext) => (0, import_node_fs28.existsSync)((0, import_node_path29.join)(dir, `vite.config.${ext}`))
44220
44345
  ),
44221
44346
  hasMetroConfig: CONFIG_EXTENSIONS.some(
44222
- (ext) => (0, import_node_fs27.existsSync)((0, import_node_path28.join)(dir, `metro.config.${ext}`))
44347
+ (ext) => (0, import_node_fs28.existsSync)((0, import_node_path29.join)(dir, `metro.config.${ext}`))
44223
44348
  ),
44224
44349
  devCommand: typeof devCommand === "string" ? devCommand : null
44225
44350
  };
44226
44351
  }
44227
- function readProjectMetadata(path37) {
44352
+ function readProjectMetadata(path38) {
44228
44353
  try {
44229
- const info = (0, import_node_fs27.lstatSync)(path37);
44354
+ const info = (0, import_node_fs28.lstatSync)(path38);
44230
44355
  if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
44231
- return (0, import_node_fs27.readFileSync)(path37, "utf8");
44356
+ return (0, import_node_fs28.readFileSync)(path38, "utf8");
44232
44357
  } catch {
44233
44358
  return null;
44234
44359
  }
@@ -44237,8 +44362,8 @@ function metadataValue(value, key2) {
44237
44362
  if (!value || typeof value !== "object") return void 0;
44238
44363
  return Object.getOwnPropertyDescriptor(value, key2)?.value;
44239
44364
  }
44240
- function readProjectJson(path37) {
44241
- const text3 = readProjectMetadata(path37);
44365
+ function readProjectJson(path38) {
44366
+ const text3 = readProjectMetadata(path38);
44242
44367
  if (text3 === null) return null;
44243
44368
  try {
44244
44369
  const value = JSON.parse(text3);
@@ -44248,7 +44373,7 @@ function readProjectJson(path37) {
44248
44373
  }
44249
44374
  }
44250
44375
  function readProjectManifest(dir) {
44251
- const parsed = readProjectJson((0, import_node_path28.join)(dir, "package.json"));
44376
+ const parsed = readProjectJson((0, import_node_path29.join)(dir, "package.json"));
44252
44377
  if (!parsed || typeof parsed !== "object") return null;
44253
44378
  const record2 = (value) => {
44254
44379
  if (!value || typeof value !== "object") return {};
@@ -44265,12 +44390,12 @@ function readProjectManifest(dir) {
44265
44390
  devDependencies: record2(metadataValue(parsed, "devDependencies"))
44266
44391
  };
44267
44392
  }
44268
- var import_node_fs27, import_node_path28, import_json52, CONFIG_EXTENSIONS;
44393
+ var import_node_fs28, import_node_path29, import_json52, CONFIG_EXTENSIONS;
44269
44394
  var init_detect = __esm({
44270
44395
  "cli/commands/detect.ts"() {
44271
44396
  "use strict";
44272
- import_node_fs27 = require("node:fs");
44273
- import_node_path28 = require("node:path");
44397
+ import_node_fs28 = require("node:fs");
44398
+ import_node_path29 = require("node:path");
44274
44399
  import_json52 = __toESM(require_lib(), 1);
44275
44400
  init_browser();
44276
44401
  CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
@@ -44307,21 +44432,21 @@ function resolveCloudOrigin(value) {
44307
44432
  return normalizeCloudOrigin(source);
44308
44433
  }
44309
44434
  function readImmutableBundleSource(bundlePath) {
44310
- const filepath = (0, import_node_path29.resolve)(bundlePath);
44311
- if ((0, import_node_path29.extname)(filepath) !== ".js") {
44435
+ const filepath = (0, import_node_path30.resolve)(bundlePath);
44436
+ if ((0, import_node_path30.extname)(filepath) !== ".js") {
44312
44437
  throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
44313
44438
  }
44314
- const descriptor = (0, import_node_fs28.openSync)(filepath, "r");
44439
+ const descriptor = (0, import_node_fs29.openSync)(filepath, "r");
44315
44440
  try {
44316
- const before = (0, import_node_fs28.fstatSync)(descriptor, { bigint: true });
44441
+ const before = (0, import_node_fs29.fstatSync)(descriptor, { bigint: true });
44317
44442
  if (!before.isFile()) {
44318
44443
  throw new Error(`${REMOTE_COMMAND} bundle must be a regular local file`);
44319
44444
  }
44320
44445
  if (before.size <= 0n) {
44321
44446
  throw new Error(`${REMOTE_COMMAND} bundle is empty`);
44322
44447
  }
44323
- const bytes = (0, import_node_fs28.readFileSync)(descriptor);
44324
- const after = (0, import_node_fs28.fstatSync)(descriptor, { bigint: true });
44448
+ const bytes = (0, import_node_fs29.readFileSync)(descriptor);
44449
+ const after = (0, import_node_fs29.fstatSync)(descriptor, { bigint: true });
44325
44450
  if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
44326
44451
  throw new Error(`${REMOTE_COMMAND} bundle changed while it was being read`);
44327
44452
  }
@@ -44336,7 +44461,7 @@ function readImmutableBundleSource(bundlePath) {
44336
44461
  }
44337
44462
  return source;
44338
44463
  } finally {
44339
- (0, import_node_fs28.closeSync)(descriptor);
44464
+ (0, import_node_fs29.closeSync)(descriptor);
44340
44465
  }
44341
44466
  }
44342
44467
  async function fetchBundleSource(bundleUrl) {
@@ -44383,15 +44508,15 @@ async function loadBundleSource(bundleInput) {
44383
44508
  return readImmutableBundleSource(bundleInput);
44384
44509
  }
44385
44510
  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"));
44511
+ const directory = (0, import_node_path30.resolve)(assetsPath);
44512
+ if (!(0, import_node_fs29.existsSync)(directory)) return { directory, files: [], truncated: false };
44513
+ const skipNested = (0, import_node_fs29.existsSync)((0, import_node_path30.join)(directory, "package.json"));
44389
44514
  const files2 = [];
44390
44515
  let truncated = false;
44391
44516
  const walk2 = (dir, prefix) => {
44392
44517
  let entries;
44393
44518
  try {
44394
- entries = (0, import_node_fs28.readdirSync)(dir, { withFileTypes: true });
44519
+ entries = (0, import_node_fs29.readdirSync)(dir, { withFileTypes: true });
44395
44520
  } catch {
44396
44521
  return;
44397
44522
  }
@@ -44403,7 +44528,7 @@ function listMetroAssetDest(assetsPath) {
44403
44528
  if (entry.isDirectory()) {
44404
44529
  if (entry.name === ".git") continue;
44405
44530
  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);
44531
+ walk2((0, import_node_path30.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
44407
44532
  } else if (entry.isFile()) {
44408
44533
  files2.push(prefix ? `${prefix}/${entry.name}` : entry.name);
44409
44534
  }
@@ -44438,7 +44563,7 @@ function distinctByContent(directory, options) {
44438
44563
  for (const relative3 of options) {
44439
44564
  let bytes;
44440
44565
  try {
44441
- bytes = (0, import_node_fs28.readFileSync)((0, import_node_path29.join)(directory, relative3));
44566
+ bytes = (0, import_node_fs29.readFileSync)((0, import_node_path30.join)(directory, relative3));
44442
44567
  } catch {
44443
44568
  continue;
44444
44569
  }
@@ -44470,7 +44595,7 @@ function placeMetroDescriptor(listing, descriptor) {
44470
44595
  let bytes;
44471
44596
  try {
44472
44597
  bytes = combination.map(
44473
- (relative3) => (0, import_node_fs28.readFileSync)((0, import_node_path29.join)(listing.directory, relative3))
44598
+ (relative3) => (0, import_node_fs29.readFileSync)((0, import_node_path30.join)(listing.directory, relative3))
44474
44599
  );
44475
44600
  } catch {
44476
44601
  continue;
@@ -44498,10 +44623,10 @@ function unverifiedContentKey(dest, fileDigests) {
44498
44623
  return JSON.stringify(
44499
44624
  dest.placements.map(
44500
44625
  (placement) => placement.verified ? null : [...placement.files].map(([scale, relative3]) => {
44501
- const file = (0, import_node_path29.join)(dest.directory, relative3);
44626
+ const file = (0, import_node_path30.join)(dest.directory, relative3);
44502
44627
  let digest = fileDigests.get(file);
44503
44628
  if (digest === void 0) {
44504
- digest = (0, import_node_crypto14.createHash)("sha256").update((0, import_node_fs28.readFileSync)(file)).digest("hex");
44629
+ digest = (0, import_node_crypto14.createHash)("sha256").update((0, import_node_fs29.readFileSync)(file)).digest("hex");
44505
44630
  fileDigests.set(file, digest);
44506
44631
  }
44507
44632
  return [scale, digest];
@@ -44510,22 +44635,22 @@ function unverifiedContentKey(dest, fileDigests) {
44510
44635
  );
44511
44636
  }
44512
44637
  function searchMetroAssetDest(bundlePath, descriptors) {
44513
- const bundleDirectory = (0, import_node_path29.dirname)((0, import_node_path29.resolve)(bundlePath));
44638
+ const bundleDirectory = (0, import_node_path30.dirname)((0, import_node_path30.resolve)(bundlePath));
44514
44639
  const candidates = [
44515
- (0, import_node_path29.join)(bundleDirectory, "assets"),
44640
+ (0, import_node_path30.join)(bundleDirectory, "assets"),
44516
44641
  bundleDirectory,
44517
- (0, import_node_path29.resolve)(bundleDirectory, "..", "assets")
44642
+ (0, import_node_path30.resolve)(bundleDirectory, "..", "assets")
44518
44643
  ];
44519
44644
  const cwd = process.cwd();
44520
44645
  let projectDirectory = null;
44521
44646
  for (const start of [bundleDirectory, cwd]) {
44522
- let directory = (0, import_node_path29.resolve)(start);
44647
+ let directory = (0, import_node_path30.resolve)(start);
44523
44648
  while (true) {
44524
44649
  if (detectProject(directory)?.hasMetroConfig) {
44525
44650
  projectDirectory = directory;
44526
44651
  break;
44527
44652
  }
44528
- const parent = (0, import_node_path29.dirname)(directory);
44653
+ const parent = (0, import_node_path30.dirname)(directory);
44529
44654
  if (parent === directory) break;
44530
44655
  directory = parent;
44531
44656
  }
@@ -44533,11 +44658,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
44533
44658
  }
44534
44659
  if (projectDirectory) {
44535
44660
  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")
44661
+ (0, import_node_path30.join)(projectDirectory, "assets"),
44662
+ (0, import_node_path30.join)(projectDirectory, "dist"),
44663
+ (0, import_node_path30.join)(projectDirectory, "dist", "assets"),
44664
+ (0, import_node_path30.join)(projectDirectory, "build"),
44665
+ (0, import_node_path30.join)(projectDirectory, "build", "assets")
44541
44666
  );
44542
44667
  }
44543
44668
  const searched = [];
@@ -44545,7 +44670,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
44545
44670
  const stale = [];
44546
44671
  let truncated = false;
44547
44672
  for (const candidate of candidates) {
44548
- const directory = (0, import_node_path29.resolve)(candidate);
44673
+ const directory = (0, import_node_path30.resolve)(candidate);
44549
44674
  if (searched.includes(directory)) continue;
44550
44675
  searched.push(directory);
44551
44676
  const listing = listMetroAssetDest(directory);
@@ -44654,7 +44779,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
44654
44779
  );
44655
44780
  }
44656
44781
  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));
44782
+ if (relative3 && dest) return (0, import_node_fs29.readFileSync)((0, import_node_path30.join)(dest.directory, relative3));
44658
44783
  if (placement && placement.files.size > 0) return null;
44659
44784
  if (placement && placement.ambiguous.length > 0 && dest) {
44660
44785
  throw new Error(
@@ -44683,7 +44808,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
44683
44808
  );
44684
44809
  const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
44685
44810
  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\`.`
44811
+ `${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
44812
  );
44688
44813
  });
44689
44814
  return {
@@ -44869,13 +44994,13 @@ function createCloudBridgeForParsed(parsed) {
44869
44994
  if (!session) return null;
44870
44995
  return session.service === "box" ? new CloudBoxBridge(session) : new CloudBridge(session);
44871
44996
  }
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;
44997
+ 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
44998
  var init_cloud_client = __esm({
44874
44999
  "cli/cloud-client.ts"() {
44875
45000
  "use strict";
44876
45001
  import_node_crypto14 = require("node:crypto");
44877
- import_node_fs28 = require("node:fs");
44878
- import_node_path29 = require("node:path");
45002
+ import_node_fs29 = require("node:fs");
45003
+ import_node_path30 = require("node:path");
44879
45004
  init_metroAssetArtifact();
44880
45005
  init_metroCloudArtifact();
44881
45006
  init_metro_fingerprint_registry_client();
@@ -47378,31 +47503,31 @@ var init_parent_pid = __esm({
47378
47503
 
47379
47504
  // cli/secure-file.ts
47380
47505
  function writeSecureJsonAtomic(filepath, value) {
47381
- (0, import_node_fs29.mkdirSync)((0, import_node_path30.dirname)(filepath), { recursive: true });
47506
+ (0, import_node_fs30.mkdirSync)((0, import_node_path31.dirname)(filepath), { recursive: true });
47382
47507
  const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto15.randomUUID)()}`;
47383
47508
  let descriptor = null;
47384
47509
  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)}
47510
+ descriptor = (0, import_node_fs30.openSync)(temporary, "wx", 384);
47511
+ (0, import_node_fs30.fchmodSync)(descriptor, 384);
47512
+ (0, import_node_fs30.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
47388
47513
  `);
47389
- (0, import_node_fs29.fsyncSync)(descriptor);
47390
- (0, import_node_fs29.closeSync)(descriptor);
47514
+ (0, import_node_fs30.fsyncSync)(descriptor);
47515
+ (0, import_node_fs30.closeSync)(descriptor);
47391
47516
  descriptor = null;
47392
- (0, import_node_fs29.renameSync)(temporary, filepath);
47517
+ (0, import_node_fs30.renameSync)(temporary, filepath);
47393
47518
  } catch (error) {
47394
- if (descriptor !== null) (0, import_node_fs29.closeSync)(descriptor);
47395
- (0, import_node_fs29.rmSync)(temporary, { force: true });
47519
+ if (descriptor !== null) (0, import_node_fs30.closeSync)(descriptor);
47520
+ (0, import_node_fs30.rmSync)(temporary, { force: true });
47396
47521
  throw error;
47397
47522
  }
47398
47523
  }
47399
- var import_node_crypto15, import_node_fs29, import_node_path30;
47524
+ var import_node_crypto15, import_node_fs30, import_node_path31;
47400
47525
  var init_secure_file = __esm({
47401
47526
  "cli/secure-file.ts"() {
47402
47527
  "use strict";
47403
47528
  import_node_crypto15 = require("node:crypto");
47404
- import_node_fs29 = require("node:fs");
47405
- import_node_path30 = require("node:path");
47529
+ import_node_fs30 = require("node:fs");
47530
+ import_node_path31 = require("node:path");
47406
47531
  }
47407
47532
  });
47408
47533
 
@@ -47587,17 +47712,17 @@ function liveDevBridgeLockfiles() {
47587
47712
  return readDevBridgeLockfiles().filter((lockfile) => isDevBridgeLockfileFresh(lockfile));
47588
47713
  }
47589
47714
  function checkoutRoot(cwd) {
47590
- let current = import_node_path31.default.resolve(cwd);
47715
+ let current = import_node_path32.default.resolve(cwd);
47591
47716
  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);
47717
+ if (import_node_fs31.default.existsSync(import_node_path32.default.join(current, ".git"))) return current;
47718
+ const parent = import_node_path32.default.dirname(current);
47594
47719
  if (parent === current) return null;
47595
47720
  current = parent;
47596
47721
  }
47597
47722
  }
47598
47723
  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);
47724
+ const relative3 = import_node_path32.default.relative(parent, child);
47725
+ return relative3 === "" || relative3 !== ".." && !relative3.startsWith(`..${import_node_path32.default.sep}`) && !import_node_path32.default.isAbsolute(relative3);
47601
47726
  }
47602
47727
  function resolveDefaultDevBridgeLockfile() {
47603
47728
  const lockfiles = liveDevBridgeLockfiles();
@@ -48192,18 +48317,18 @@ async function evalInBridge(bridge, code, opts = {}) {
48192
48317
  if (opts.acquireLock) payload.acquireLock = true;
48193
48318
  return bridge.send(payload);
48194
48319
  }
48195
- async function callInBridge(bridge, path37, ...args) {
48196
- return bridge.send({ type: "call", path: path37, args });
48320
+ async function callInBridge(bridge, path38, ...args) {
48321
+ return bridge.send({ type: "call", path: path38, args });
48197
48322
  }
48198
- async function callInBridgeWrite(bridge, path37, ...args) {
48199
- return bridge.send({ type: "call", path: path37, args, acquireLock: true });
48323
+ async function callInBridgeWrite(bridge, path38, ...args) {
48324
+ return bridge.send({ type: "call", path: path38, args, acquireLock: true });
48200
48325
  }
48201
- var import_node_fs30, import_node_path31, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
48326
+ var import_node_fs31, import_node_path32, import_ws2, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
48202
48327
  var init_ws_bridge = __esm({
48203
48328
  "cli/ws-bridge.ts"() {
48204
48329
  "use strict";
48205
- import_node_fs30 = __toESM(require("node:fs"), 1);
48206
- import_node_path31 = __toESM(require("node:path"), 1);
48330
+ import_node_fs31 = __toESM(require("node:fs"), 1);
48331
+ import_node_path32 = __toESM(require("node:path"), 1);
48207
48332
  import_ws2 = require("ws");
48208
48333
  init_bridge_constants();
48209
48334
  init_cli_constants();
@@ -48331,8 +48456,8 @@ function getDefaultPortForProtocol(protocol) {
48331
48456
  return protocol === "https:" ? 443 : 80;
48332
48457
  }
48333
48458
  function isBaseServerUrl(url) {
48334
- const path37 = url.pathname || "/";
48335
- return (path37 === "/" || path37 === "") && !url.search && !url.hash;
48459
+ const path38 = url.pathname || "/";
48460
+ return (path38 === "/" || path38 === "") && !url.search && !url.hash;
48336
48461
  }
48337
48462
  async function resolvePortViaServerScan(port) {
48338
48463
  try {
@@ -48496,8 +48621,8 @@ var init_dev_bundle_resolution = __esm({
48496
48621
 
48497
48622
  // src/dot-env.ts
48498
48623
  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 };
48624
+ if (import_node_fs32.default.existsSync("/tmp/envfile")) {
48625
+ return { name: import_node_fs32.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
48501
48626
  }
48502
48627
  const requested = env.ENVFILE;
48503
48628
  if (!requested) return { name: DEFAULT_ENV_FILE, fromEnvfile: false };
@@ -48560,16 +48685,16 @@ function readProjectDotEnv(envsRoot, env = process.env) {
48560
48685
  const notices = [];
48561
48686
  const selection = selectEnvFile(env, notices);
48562
48687
  const requestedPaths = [
48563
- import_node_path32.default.resolve(import_node_path32.default.join(envsRoot, selection.name)),
48564
- import_node_path32.default.resolve(selection.name)
48688
+ import_node_path33.default.resolve(import_node_path33.default.join(envsRoot, selection.name)),
48689
+ import_node_path33.default.resolve(selection.name)
48565
48690
  ];
48566
48691
  const candidates = [
48567
48692
  ...requestedPaths,
48568
- import_node_path32.default.resolve(import_node_path32.default.join(envsRoot, DEFAULT_ENV_FILE))
48693
+ import_node_path33.default.resolve(import_node_path33.default.join(envsRoot, DEFAULT_ENV_FILE))
48569
48694
  ];
48570
- if (!import_node_fs31.default.existsSync(candidates[2])) candidates.push(import_node_path32.default.resolve(DEFAULT_ENV_FILE));
48695
+ if (!import_node_fs32.default.existsSync(candidates[2])) candidates.push(import_node_path33.default.resolve(DEFAULT_ENV_FILE));
48571
48696
  const tried = [...new Set(candidates)];
48572
- const resolved = tried.find((candidate) => import_node_fs31.default.existsSync(candidate));
48697
+ const resolved = tried.find((candidate) => import_node_fs32.default.existsSync(candidate));
48573
48698
  if (!resolved) {
48574
48699
  notices.push(
48575
48700
  "*** Missing .env file ****",
@@ -48589,7 +48714,7 @@ function readProjectDotEnv(envsRoot, env = process.env) {
48589
48714
  );
48590
48715
  }
48591
48716
  const config = {};
48592
- for (const line of import_node_fs31.default.readFileSync(resolved, "utf8").split("\n")) {
48717
+ for (const line of import_node_fs32.default.readFileSync(resolved, "utf8").split("\n")) {
48593
48718
  if (!line.trim()) continue;
48594
48719
  if (/^[ \t\n\v\f\r]*#/.test(line)) continue;
48595
48720
  const match = DOTENV_PATTERN.exec(line);
@@ -48599,12 +48724,12 @@ function readProjectDotEnv(envsRoot, env = process.env) {
48599
48724
  }
48600
48725
  return { config, notices };
48601
48726
  }
48602
- var import_node_fs31, import_node_path32, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
48727
+ var import_node_fs32, import_node_path33, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
48603
48728
  var init_dot_env = __esm({
48604
48729
  "src/dot-env.ts"() {
48605
48730
  "use strict";
48606
- import_node_fs31 = __toESM(require("node:fs"), 1);
48607
- import_node_path32 = __toESM(require("node:path"), 1);
48731
+ import_node_fs32 = __toESM(require("node:fs"), 1);
48732
+ import_node_path33 = __toESM(require("node:path"), 1);
48608
48733
  DEFAULT_ENV_FILE = ".env";
48609
48734
  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
48735
  BUILD_SETTING_PATTERN = /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]|\$([A-Za-z_][A-Za-z0-9_]*)/g;
@@ -48628,8 +48753,8 @@ var init_flow_timeout_scale = __esm({
48628
48753
  function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48629
48754
  const result = {};
48630
48755
  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;
48756
+ const appJsonPath = import_node_path34.default.join(projectRoot, "app.json");
48757
+ const appJson = import_node_fs33.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs33.default.readFileSync(appJsonPath, "utf8")) : null;
48633
48758
  const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
48634
48759
  (value) => isRecord(value) && typeof value.googleServicesFile === "string"
48635
48760
  ));
@@ -48638,9 +48763,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48638
48763
  "app.config.ts",
48639
48764
  "app.config.cjs",
48640
48765
  "app.config.mjs"
48641
- ].some((name2) => import_node_fs32.default.existsSync(import_node_path33.default.join(projectRoot, name2)));
48766
+ ].some((name2) => import_node_fs33.default.existsSync(import_node_path34.default.join(projectRoot, name2)));
48642
48767
  if (staticExpo || dynamicExpo) {
48643
- const require4 = (0, import_node_module2.createRequire)(import_node_path33.default.join(projectRoot, "package.json"));
48768
+ const require4 = (0, import_node_module2.createRequire)(import_node_path34.default.join(projectRoot, "package.json"));
48644
48769
  const configModule = require4("@expo/config");
48645
48770
  if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
48646
48771
  throw new Error("Expo native configuration is unavailable.");
@@ -48652,23 +48777,23 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48652
48777
  }
48653
48778
  const ios = config.ios;
48654
48779
  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"));
48780
+ const iosRoot = import_node_path34.default.join(projectRoot, "ios");
48781
+ if (import_node_fs33.default.existsSync(iosRoot)) {
48782
+ const projects2 = import_node_fs33.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
48658
48783
  if (projects2.length > 1)
48659
48784
  throw new Error("native Firebase configuration requires a selected Xcode project");
48660
48785
  if (projects2.length === 1) {
48661
- const xcodeproj = import_node_path33.default.join(iosRoot, projects2[0].name);
48786
+ const xcodeproj = import_node_path34.default.join(iosRoot, projects2[0].name);
48662
48787
  const appTargets = listXcodeAppTargets(xcodeproj);
48663
48788
  if (appTargets.length > 1)
48664
48789
  throw new Error("native Firebase configuration requires a selected app target");
48665
48790
  if (appTargets.length === 1) {
48666
48791
  const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
48667
48792
  const delegates = app.allSources.filter(
48668
- (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path33.default.basename(file))
48793
+ (file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path34.default.basename(file))
48669
48794
  );
48670
48795
  const defaultConfigured = delegates.some((file) => {
48671
- const source = import_node_fs32.default.readFileSync(file, "utf8").replace(
48796
+ const source = import_node_fs33.default.readFileSync(file, "utf8").replace(
48672
48797
  /\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
48673
48798
  (token) => token.startsWith('"') ? '""' : token.replace(/[^\n]/g, " ")
48674
48799
  );
@@ -48696,15 +48821,15 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48696
48821
  });
48697
48822
  if (defaultConfigured) {
48698
48823
  const resources = app.resources.filter(
48699
- (file) => /^GoogleService-Info\.plist$/.test(import_node_path33.default.basename(file))
48824
+ (file) => /^GoogleService-Info\.plist$/.test(import_node_path34.default.basename(file))
48700
48825
  );
48701
48826
  if (resources.length !== 1)
48702
48827
  throw new Error(
48703
48828
  "native Firebase default initialization requires one GoogleService-Info.plist build resource"
48704
48829
  );
48705
48830
  config.ios = {
48706
- googleServicesFile: import_node_path33.default.relative(
48707
- import_node_fs32.default.realpathSync(projectRoot),
48831
+ googleServicesFile: import_node_path34.default.relative(
48832
+ import_node_fs33.default.realpathSync(projectRoot),
48708
48833
  resources[0]
48709
48834
  )
48710
48835
  };
@@ -48717,8 +48842,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48717
48842
  const native = config[platform];
48718
48843
  if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
48719
48844
  try {
48720
- const source = import_node_fs32.default.readFileSync(
48721
- import_node_path33.default.resolve(projectRoot, native.googleServicesFile),
48845
+ const source = import_node_fs33.default.readFileSync(
48846
+ import_node_path34.default.resolve(projectRoot, native.googleServicesFile),
48722
48847
  "utf8"
48723
48848
  );
48724
48849
  const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
@@ -48770,13 +48895,13 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
48770
48895
  }
48771
48896
  return result;
48772
48897
  }
48773
- var import_node_fs32, import_node_module2, import_node_path33;
48898
+ var import_node_fs33, import_node_module2, import_node_path34;
48774
48899
  var init_native_firebase_config = __esm({
48775
48900
  "src/native-firebase-config.ts"() {
48776
48901
  "use strict";
48777
- import_node_fs32 = __toESM(require("node:fs"), 1);
48902
+ import_node_fs33 = __toESM(require("node:fs"), 1);
48778
48903
  import_node_module2 = require("node:module");
48779
- import_node_path33 = __toESM(require("node:path"), 1);
48904
+ import_node_path34 = __toESM(require("node:path"), 1);
48780
48905
  init_is_record();
48781
48906
  init_plist();
48782
48907
  init_xcode_project();
@@ -48890,59 +49015,59 @@ var init_profiles = __esm({
48890
49015
  // cli/app-catalog.ts
48891
49016
  function listDir(dir) {
48892
49017
  try {
48893
- return import_node_fs33.default.readdirSync(dir, { withFileTypes: true });
49018
+ return import_node_fs34.default.readdirSync(dir, { withFileTypes: true });
48894
49019
  } catch {
48895
49020
  return [];
48896
49021
  }
48897
49022
  }
48898
49023
  function readText(file) {
48899
49024
  try {
48900
- return import_node_fs33.default.readFileSync(file, "utf8");
49025
+ return import_node_fs34.default.readFileSync(file, "utf8");
48901
49026
  } catch {
48902
49027
  return null;
48903
49028
  }
48904
49029
  }
48905
49030
  function catalogFiles(dir, found) {
48906
49031
  for (const entry of listDir(dir)) {
48907
- const full = import_node_path34.default.join(dir, entry.name);
49032
+ const full = import_node_path35.default.join(dir, entry.name);
48908
49033
  if (entry.isDirectory()) catalogFiles(full, found);
48909
49034
  else if (entry.name === "Contents.json") found.push(full);
48910
49035
  }
48911
49036
  }
48912
49037
  function discoverAppCatalog(appDir) {
48913
- const iosDir = import_node_path34.default.join(appDir, "ios");
49038
+ const iosDir = import_node_path35.default.join(appDir, "ios");
48914
49039
  const target = listDir(iosDir).find(
48915
- (entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path34.default.join(iosDir, entry.name)).some(
49040
+ (entry) => entry.isDirectory() && entry.name !== "Pods" && listDir(import_node_path35.default.join(iosDir, entry.name)).some(
48916
49041
  (file) => /^AppDelegate\.(swift|mm|m)$/.test(file.name)
48917
49042
  )
48918
49043
  );
48919
49044
  if (!target) return null;
48920
- const targetDir = import_node_path34.default.join(iosDir, target.name);
49045
+ const targetDir = import_node_path35.default.join(iosDir, target.name);
48921
49046
  const files2 = [];
48922
49047
  for (const entry of listDir(targetDir)) {
48923
49048
  if (entry.isDirectory() && entry.name.endsWith(".xcassets"))
48924
- catalogFiles(import_node_path34.default.join(targetDir, entry.name), files2);
49049
+ catalogFiles(import_node_path35.default.join(targetDir, entry.name), files2);
48925
49050
  }
48926
49051
  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)
49052
+ (file) => import_node_path35.default.relative(targetDir, file).split(import_node_path35.default.sep).join(import_node_path35.default.posix.sep)
48928
49053
  );
48929
49054
  const colors = enumerateBundleColors(
48930
49055
  relative3,
48931
- (candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path34.default.join(targetDir, candidate)) : null
49056
+ (candidate) => candidate.endsWith("Contents.json") ? readText(import_node_path35.default.join(targetDir, candidate)) : null
48932
49057
  );
48933
49058
  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(
49059
+ 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
49060
  ACCENT_BUILD_SETTING
48936
49061
  )?.[1] : void 0) ?? null;
48937
49062
  if (accentName === null && Object.keys(colors).length === 0) return null;
48938
49063
  return { colors, accentName };
48939
49064
  }
48940
- var import_node_fs33, import_node_path34, ACCENT_BUILD_SETTING, PLIST_ACCENT;
49065
+ var import_node_fs34, import_node_path35, ACCENT_BUILD_SETTING, PLIST_ACCENT;
48941
49066
  var init_app_catalog = __esm({
48942
49067
  "cli/app-catalog.ts"() {
48943
49068
  "use strict";
48944
- import_node_fs33 = __toESM(require("node:fs"), 1);
48945
- import_node_path34 = __toESM(require("node:path"), 1);
49069
+ import_node_fs34 = __toESM(require("node:fs"), 1);
49070
+ import_node_path35 = __toESM(require("node:path"), 1);
48946
49071
  init_bundleAssets();
48947
49072
  ACCENT_BUILD_SETTING = /ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "?([^";]+)"?;/;
48948
49073
  PLIST_ACCENT = /<key>NSAccentColorName<\/key>\s*<string>([^<]+)<\/string>/;
@@ -48952,9 +49077,9 @@ var init_app_catalog = __esm({
48952
49077
  // cli/app-project.ts
48953
49078
  function firstNamedFile(dir, names) {
48954
49079
  for (const name2 of names) {
48955
- const candidate = import_node_path35.default.join(dir, name2);
49080
+ const candidate = import_node_path36.default.join(dir, name2);
48956
49081
  try {
48957
- if (import_node_fs34.default.statSync(candidate).isFile()) return candidate;
49082
+ if (import_node_fs35.default.statSync(candidate).isFile()) return candidate;
48958
49083
  } catch {
48959
49084
  }
48960
49085
  }
@@ -48967,24 +49092,24 @@ function findRNXAppConfig(dir) {
48967
49092
  return firstNamedFile(dir, PEACH_APP_CONFIG_NAMES);
48968
49093
  }
48969
49094
  function resolveAppProject(projectRoot) {
48970
- const appDir = import_node_path35.default.resolve(projectRoot);
49095
+ const appDir = import_node_path36.default.resolve(projectRoot);
48971
49096
  try {
48972
- if (!import_node_fs34.default.statSync(appDir).isDirectory()) return null;
49097
+ if (!import_node_fs35.default.statSync(appDir).isDirectory()) return null;
48973
49098
  } catch {
48974
49099
  return null;
48975
49100
  }
48976
49101
  const configPath = findRNXAppConfig(appDir);
48977
- if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs34.default.existsSync(import_node_path35.default.join(appDir, "package.json"))) {
49102
+ if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs35.default.existsSync(import_node_path36.default.join(appDir, "package.json"))) {
48978
49103
  return null;
48979
49104
  }
48980
49105
  return { appDir, configPath };
48981
49106
  }
48982
- var import_node_fs34, import_node_path35, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
49107
+ var import_node_fs35, import_node_path36, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
48983
49108
  var init_app_project = __esm({
48984
49109
  "cli/app-project.ts"() {
48985
49110
  "use strict";
48986
- import_node_fs34 = __toESM(require("node:fs"), 1);
48987
- import_node_path35 = __toESM(require("node:path"), 1);
49111
+ import_node_fs35 = __toESM(require("node:fs"), 1);
49112
+ import_node_path36 = __toESM(require("node:path"), 1);
48988
49113
  EXPO_APP_CONFIG_NAMES = [
48989
49114
  "app.config.js",
48990
49115
  "app.config.ts",
@@ -49007,12 +49132,12 @@ function resolveFileEntries(entries, configDir) {
49007
49132
  return Object.fromEntries(
49008
49133
  Object.entries(entries).map(([name2, resolution]) => [
49009
49134
  name2,
49010
- resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path36.default.resolve(configDir, resolution.file) } : resolution
49135
+ resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path37.default.resolve(configDir, resolution.file) } : resolution
49011
49136
  ])
49012
49137
  );
49013
49138
  }
49014
49139
  function resolveConfigReplacementFiles(config, configPath) {
49015
- const configDir = import_node_path36.default.dirname(configPath);
49140
+ const configDir = import_node_path37.default.dirname(configPath);
49016
49141
  return {
49017
49142
  ...config,
49018
49143
  modules: resolveFileEntries(config.modules, configDir),
@@ -49047,11 +49172,11 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
49047
49172
  const project = resolveAppProject(startDir);
49048
49173
  return { project, config: await loadRNXAppConfig(project) };
49049
49174
  }
49050
- var import_node_path36, import_jiti;
49175
+ var import_node_path37, import_jiti;
49051
49176
  var init_app_config = __esm({
49052
49177
  "cli/app-config.ts"() {
49053
49178
  "use strict";
49054
- import_node_path36 = __toESM(require("node:path"), 1);
49179
+ import_node_path37 = __toESM(require("node:path"), 1);
49055
49180
  import_jiti = require("jiti");
49056
49181
  init_config();
49057
49182
  init_config();
@@ -49108,13 +49233,13 @@ function discoverNativeLinkedAppFonts(opts) {
49108
49233
  scannedFontDirectories++;
49109
49234
  let entries;
49110
49235
  try {
49111
- entries = import_node_fs35.default.readdirSync(current.dir, { withFileTypes: true });
49236
+ entries = import_node_fs36.default.readdirSync(current.dir, { withFileTypes: true });
49112
49237
  } catch {
49113
49238
  continue;
49114
49239
  }
49115
49240
  for (const entry of entries) {
49116
49241
  if (entry.isSymbolicLink()) continue;
49117
- const fullPath = import_node_path37.default.join(current.dir, entry.name);
49242
+ const fullPath = import_node_path38.default.join(current.dir, entry.name);
49118
49243
  if (entry.isDirectory()) {
49119
49244
  if (current.depth < 4 && pending.length < 64 && !entry.name.startsWith(".")) {
49120
49245
  pending.push({ dir: fullPath, depth: current.depth + 1 });
@@ -49122,15 +49247,15 @@ function discoverNativeLinkedAppFonts(opts) {
49122
49247
  continue;
49123
49248
  }
49124
49249
  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));
49250
+ const relative3 = import_node_path38.default.relative(root, fullPath).split(import_node_path38.default.sep).join("/");
49251
+ fontPaths.push(import_node_path38.default.posix.join(metroPathPrefix, relative3));
49127
49252
  if (fontPaths.length >= 256) break;
49128
49253
  }
49129
49254
  }
49130
49255
  };
49131
49256
  try {
49132
49257
  const packageJson = JSON.parse(
49133
- import_node_fs35.default.readFileSync(import_node_path37.default.join(selectedAppDir, "package.json"), "utf8")
49258
+ import_node_fs36.default.readFileSync(import_node_path38.default.join(selectedAppDir, "package.json"), "utf8")
49134
49259
  );
49135
49260
  const dependencyNames = /* @__PURE__ */ new Set();
49136
49261
  for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
@@ -49145,32 +49270,32 @@ function discoverNativeLinkedAppFonts(opts) {
49145
49270
  const config = Reflect.get(packageJson, "reactNativeVectorIcons");
49146
49271
  const configuredFontDir = config && typeof config === "object" ? Reflect.get(config, "fontDir") : null;
49147
49272
  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("/"));
49273
+ const root = import_node_path38.default.resolve(selectedAppDir, configuredDir);
49274
+ const relativeRoot = import_node_path38.default.relative(selectedAppDir, root);
49275
+ if (!relativeRoot.startsWith("..") && !import_node_path38.default.isAbsolute(relativeRoot)) {
49276
+ collectFontFiles(root, relativeRoot.split(import_node_path38.default.sep).join("/"));
49152
49277
  }
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);
49278
+ const bundleDir = import_node_path38.default.posix.dirname(new URL(opts.bundleUrl).pathname).replace(/^\/+/, "");
49279
+ const appRelativeDir = bundleDir.split("/").join(import_node_path38.default.sep);
49155
49280
  const metroRootCandidates = [selectedAppDir];
49156
- if (bundleDir && selectedAppDir.endsWith(import_node_path37.default.sep + appRelativeDir)) {
49281
+ if (bundleDir && selectedAppDir.endsWith(import_node_path38.default.sep + appRelativeDir)) {
49157
49282
  metroRootCandidates.push(selectedAppDir.slice(0, -appRelativeDir.length - 1));
49158
49283
  }
49159
- const vectorIconRequire = (0, import_node_module3.createRequire)(import_node_path37.default.join(selectedAppDir, "package.json"));
49284
+ const vectorIconRequire = (0, import_node_module3.createRequire)(import_node_path38.default.join(selectedAppDir, "package.json"));
49160
49285
  for (const dependencyName of vectorIconDependencies) {
49161
49286
  try {
49162
49287
  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}`;
49288
+ const dependencyPath = dependencyName.split("/").join(import_node_path38.default.sep);
49289
+ const marker = `${import_node_path38.default.sep}node_modules${import_node_path38.default.sep}${dependencyPath}${import_node_path38.default.sep}`;
49165
49290
  const markerIndex = entryPath.lastIndexOf(marker);
49166
49291
  if (markerIndex === -1) continue;
49167
49292
  const packageRoot = entryPath.slice(0, markerIndex + marker.length - 1);
49168
49293
  const fontsDir = dependencyName === "react-native-vector-icons" ? "Fonts" : "fonts";
49169
- const fontsRoot = import_node_path37.default.join(packageRoot, fontsDir);
49294
+ const fontsRoot = import_node_path38.default.join(packageRoot, fontsDir);
49170
49295
  for (const metroRoot of metroRootCandidates) {
49171
49296
  collectFontFiles(
49172
49297
  fontsRoot,
49173
- import_node_path37.default.relative(metroRoot, fontsRoot).split(import_node_path37.default.sep).join("/")
49298
+ import_node_path38.default.relative(metroRoot, fontsRoot).split(import_node_path38.default.sep).join("/")
49174
49299
  );
49175
49300
  }
49176
49301
  } catch {
@@ -49180,37 +49305,37 @@ function discoverNativeLinkedAppFonts(opts) {
49180
49305
  } catch {
49181
49306
  }
49182
49307
  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"));
49308
+ const configPath = import_node_path38.default.join(selectedAppDir, "react-native.config.js");
49309
+ if (import_node_fs36.default.statSync(configPath).isFile()) {
49310
+ const appConfigRequire = (0, import_node_module3.createRequire)(import_node_path38.default.join(selectedAppDir, "package.json"));
49186
49311
  const rnConfig = appConfigRequire(configPath);
49187
49312
  const assets2 = rnConfig && typeof rnConfig === "object" ? Reflect.get(rnConfig, "assets") : null;
49188
49313
  if (Array.isArray(assets2)) {
49189
49314
  for (const assetDir of assets2) {
49190
49315
  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("/"));
49316
+ const root = import_node_path38.default.resolve(selectedAppDir, assetDir);
49317
+ const relativeRoot = import_node_path38.default.relative(selectedAppDir, root);
49318
+ if (relativeRoot.startsWith("..") || import_node_path38.default.isAbsolute(relativeRoot)) continue;
49319
+ collectFontFiles(root, relativeRoot.split(import_node_path38.default.sep).join("/"));
49195
49320
  }
49196
49321
  }
49197
49322
  }
49198
49323
  } catch {
49199
49324
  }
49200
49325
  if (platform === "ios") {
49201
- const iosDir = import_node_path37.default.join(selectedAppDir, "ios");
49326
+ const iosDir = import_node_path38.default.join(selectedAppDir, "ios");
49202
49327
  try {
49203
- const targetDirs = import_node_fs35.default.readdirSync(iosDir, { withFileTypes: true }).filter(
49328
+ const targetDirs = import_node_fs36.default.readdirSync(iosDir, { withFileTypes: true }).filter(
49204
49329
  (entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
49205
49330
  ).slice(0, 64);
49206
- const plistPaths = [import_node_path37.default.join(iosDir, "Info.plist")];
49331
+ const plistPaths = [import_node_path38.default.join(iosDir, "Info.plist")];
49207
49332
  for (const entry of targetDirs) {
49208
- plistPaths.push(import_node_path37.default.join(iosDir, entry.name, "Info.plist"));
49333
+ plistPaths.push(import_node_path38.default.join(iosDir, entry.name, "Info.plist"));
49209
49334
  }
49210
49335
  for (const plistPath of plistPaths) {
49211
49336
  let parsed;
49212
49337
  try {
49213
- parsed = parsePlistSource(import_node_fs35.default.readFileSync(plistPath, "utf8"));
49338
+ parsed = parsePlistSource(import_node_fs36.default.readFileSync(plistPath, "utf8"));
49214
49339
  } catch {
49215
49340
  continue;
49216
49341
  }
@@ -49220,21 +49345,21 @@ function discoverNativeLinkedAppFonts(opts) {
49220
49345
  for (const declaredFont of declaredFonts) {
49221
49346
  if (typeof declaredFont !== "string") continue;
49222
49347
  const candidates = [
49223
- import_node_path37.default.resolve(import_node_path37.default.dirname(plistPath), declaredFont),
49224
- import_node_path37.default.resolve(iosDir, declaredFont)
49348
+ import_node_path38.default.resolve(import_node_path38.default.dirname(plistPath), declaredFont),
49349
+ import_node_path38.default.resolve(iosDir, declaredFont)
49225
49350
  ];
49226
49351
  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;
49352
+ const relative3 = import_node_path38.default.relative(selectedAppDir, candidate);
49353
+ if (relative3.startsWith("..") || import_node_path38.default.isAbsolute(relative3)) return false;
49229
49354
  try {
49230
- return import_node_fs35.default.statSync(candidate).isFile();
49355
+ return import_node_fs36.default.statSync(candidate).isFile();
49231
49356
  } catch {
49232
49357
  return false;
49233
49358
  }
49234
49359
  });
49235
49360
  if (!fontPath) continue;
49236
49361
  fontPaths.push(
49237
- import_node_path37.default.relative(selectedAppDir, fontPath).split(import_node_path37.default.sep).join("/")
49362
+ import_node_path38.default.relative(selectedAppDir, fontPath).split(import_node_path38.default.sep).join("/")
49238
49363
  );
49239
49364
  }
49240
49365
  }
@@ -49276,13 +49401,13 @@ async function resolveMetroProjectRoot(bundleUrl, opts) {
49276
49401
  function encodeAppFontsWire(specs) {
49277
49402
  return specs.map((spec) => `${encodeURIComponent(spec.url)}::${encodeURIComponent(spec.family)}`).join(",");
49278
49403
  }
49279
- var import_node_fs35, import_node_module3, import_node_path37, import_config_plugin_fonts, require2;
49404
+ var import_node_fs36, import_node_module3, import_node_path38, import_config_plugin_fonts, require2;
49280
49405
  var init_app_fonts = __esm({
49281
49406
  "cli/app-fonts.ts"() {
49282
49407
  "use strict";
49283
- import_node_fs35 = __toESM(require("node:fs"), 1);
49408
+ import_node_fs36 = __toESM(require("node:fs"), 1);
49284
49409
  import_node_module3 = require("node:module");
49285
- import_node_path37 = __toESM(require("node:path"), 1);
49410
+ import_node_path38 = __toESM(require("node:path"), 1);
49286
49411
  import_config_plugin_fonts = require("peach-engine/engine/config-plugin-fonts");
49287
49412
  init_dev_server_scanner();
49288
49413
  init_backend_origin();
@@ -50222,7 +50347,7 @@ function desktopHostExecutable() {
50222
50347
  function bundleValue(app, key2) {
50223
50348
  const read = (0, import_node_child_process13.spawnSync)(
50224
50349
  "plutil",
50225
- ["-extract", key2, "raw", "-o", "-", import_node_path38.default.join(app, "Contents/Info.plist")],
50350
+ ["-extract", key2, "raw", "-o", "-", import_node_path39.default.join(app, "Contents/Info.plist")],
50226
50351
  { encoding: "utf8" }
50227
50352
  );
50228
50353
  return read.status === 0 ? read.stdout.trim() : null;
@@ -50233,8 +50358,8 @@ function isNativeHostBundle(app) {
50233
50358
  function placedHostVersion() {
50234
50359
  if (desktopHostPlatform() === "linux-x64") {
50235
50360
  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;
50361
+ const version = import_node_fs37.default.readFileSync(import_node_path39.default.join(desktopHostsDir(), "active"), "utf8").trim();
50362
+ return /^\d+\.\d+$/.test(version) && import_node_fs37.default.existsSync(import_node_path39.default.join(desktopHostDir(version), desktopHostExecutable())) ? version : null;
50238
50363
  } catch {
50239
50364
  return null;
50240
50365
  }
@@ -50250,18 +50375,18 @@ function headlessHostCommand() {
50250
50375
  if (!version) return null;
50251
50376
  const dir = desktopHostDir(version);
50252
50377
  return [
50253
- import_node_path38.default.join(dir, "bin/node"),
50378
+ import_node_path39.default.join(dir, "bin/node"),
50254
50379
  "--experimental-vm-modules",
50255
- import_node_path38.default.join(dir, "node/host.mjs")
50380
+ import_node_path39.default.join(dir, "node/host.mjs")
50256
50381
  ];
50257
50382
  }
50258
- var import_node_child_process13, import_node_fs36, import_node_path38, MAC_HOST_APP, HOST_BUNDLE_ID;
50383
+ var import_node_child_process13, import_node_fs37, import_node_path39, MAC_HOST_APP, HOST_BUNDLE_ID;
50259
50384
  var init_desktop_host_delivery = __esm({
50260
50385
  "src/desktop-host-delivery.ts"() {
50261
50386
  "use strict";
50262
50387
  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);
50388
+ import_node_fs37 = __toESM(require("node:fs"), 1);
50389
+ import_node_path39 = __toESM(require("node:path"), 1);
50265
50390
  init_src();
50266
50391
  init_home_paths();
50267
50392
  MAC_HOST_APP = "/Applications/Peach.app";
@@ -51809,8 +51934,8 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
51809
51934
  };
51810
51935
  }
51811
51936
  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))) {
51937
+ const dir = (0, import_node_path40.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
51938
+ if (!(0, import_node_fs38.existsSync)((0, import_node_path40.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
51814
51939
  const url = `${DEFAULT_CLI_RELEASE_ORIGIN}/${linuxBrowserLibsKey(lock.id, arch)}`;
51815
51940
  process.stderr.write(
51816
51941
  `peach: this system lacks ${missing.length} shared libraries ${browser} links; downloading them\u2026
@@ -51838,7 +51963,7 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
51838
51963
  };
51839
51964
  }
51840
51965
  }
51841
- const libraryPath = [(0, import_node_path39.join)(dir, "lib"), (0, import_node_path39.join)(dir, "lib", "nss")].join(":");
51966
+ const libraryPath = [(0, import_node_path40.join)(dir, "lib"), (0, import_node_path40.join)(dir, "lib", "nss")].join(":");
51842
51967
  const stillMissing = missingLibraries(executablePath, libraryPath);
51843
51968
  if (stillMissing.length) {
51844
51969
  return {
@@ -51848,13 +51973,13 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
51848
51973
  }
51849
51974
  return { ok: true, libraryPath };
51850
51975
  }
51851
- var import_node_child_process14, import_node_fs37, import_node_path39, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
51976
+ var import_node_child_process14, import_node_fs38, import_node_path40, LINUX_BROWSER_LIBS_ARCHES, LINUX_BROWSER_LIBS_MARKER;
51852
51977
  var init_linux_browser_libs = __esm({
51853
51978
  "cli/drivers/linux-browser-libs.ts"() {
51854
51979
  "use strict";
51855
51980
  import_node_child_process14 = require("node:child_process");
51856
- import_node_fs37 = require("node:fs");
51857
- import_node_path39 = require("node:path");
51981
+ import_node_fs38 = require("node:fs");
51982
+ import_node_path40 = require("node:path");
51858
51983
  init_src();
51859
51984
  init_home_paths();
51860
51985
  init_is_record();
@@ -51878,13 +52003,13 @@ function resolvePlaywright() {
51878
52003
  try {
51879
52004
  const modulePath = requireFromRoot.resolve(spec);
51880
52005
  const packageJsonPath = requireFromRoot.resolve(`${spec}/package.json`);
51881
- const parsed = JSON.parse((0, import_node_fs38.readFileSync)(packageJsonPath, "utf8"));
52006
+ const parsed = JSON.parse((0, import_node_fs39.readFileSync)(packageJsonPath, "utf8"));
51882
52007
  if (!isRecord(parsed) || typeof parsed.version !== "string") continue;
51883
52008
  const corePackagePath = (0, import_node_module5.createRequire)(modulePath).resolve(
51884
52009
  "playwright-core/package.json"
51885
52010
  );
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;
52011
+ const cliPath = (0, import_node_path41.join)((0, import_node_path41.dirname)(corePackagePath), "cli.js");
52012
+ if (!(0, import_node_fs39.existsSync)(cliPath)) continue;
51888
52013
  return {
51889
52014
  spec,
51890
52015
  modulePath,
@@ -51912,7 +52037,7 @@ async function provisionPlaywright() {
51912
52037
  await installVerifiedTarball({
51913
52038
  url: `https://registry.npmjs.org/playwright-core/-/playwright-core-${version}.tgz`,
51914
52039
  digest: { algorithm, encoding: "base64", value: digest },
51915
- destDir: (0, import_node_path40.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
52040
+ destDir: (0, import_node_path41.join)(playwrightCoreDir(version), "node_modules", "playwright-core"),
51916
52041
  installedMarker: "package.json",
51917
52042
  // npm tarballs hold the package under a leading `package/`
51918
52043
  stripComponents: 1,
@@ -51955,7 +52080,7 @@ function probeBrowser(resolved, env) {
51955
52080
  return {
51956
52081
  ok: true,
51957
52082
  executablePath: parsed.executablePath,
51958
- exists: parsed.exists && (0, import_node_fs38.existsSync)(parsed.executablePath)
52083
+ exists: parsed.exists && (0, import_node_fs39.existsSync)(parsed.executablePath)
51959
52084
  };
51960
52085
  } catch (error) {
51961
52086
  return {
@@ -52023,14 +52148,14 @@ ${detail}` : ""}`
52023
52148
  libraryPath: libraries.libraryPath
52024
52149
  };
52025
52150
  }
52026
- var import_node_child_process15, import_node_fs38, import_node_module5, import_node_path40;
52151
+ var import_node_child_process15, import_node_fs39, import_node_module5, import_node_path41;
52027
52152
  var init_playwright_provisioning = __esm({
52028
52153
  "cli/drivers/playwright-provisioning.ts"() {
52029
52154
  "use strict";
52030
52155
  import_node_child_process15 = require("node:child_process");
52031
- import_node_fs38 = require("node:fs");
52156
+ import_node_fs39 = require("node:fs");
52032
52157
  import_node_module5 = require("node:module");
52033
- import_node_path40 = require("node:path");
52158
+ import_node_path41 = require("node:path");
52034
52159
  init_src();
52035
52160
  init_home_paths();
52036
52161
  init_is_record();
@@ -52528,12 +52653,12 @@ var init_runtime_diagnostics = __esm({
52528
52653
  // cli/commands/skills.ts
52529
52654
  function getSkillsDir() {
52530
52655
  if (typeof __PEACH_BUNDLED_SKILLS__ !== "undefined") {
52531
- const dir = path33.join(rnxHomeDir(), "skills", getCliVersion());
52656
+ const dir = path34.join(rnxHomeDir(), "skills", getCliVersion());
52532
52657
  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);
52658
+ const target = path34.join(dir, file);
52659
+ if (fs30.existsSync(target)) continue;
52660
+ fs30.mkdirSync(path34.dirname(target), { recursive: true });
52661
+ fs30.writeFileSync(target, body);
52537
52662
  }
52538
52663
  return dir;
52539
52664
  }
@@ -52541,10 +52666,10 @@ function getSkillsDir() {
52541
52666
  const pkgPath = (0, import_url3.fileURLToPath)(
52542
52667
  import_meta3.resolve(`${rnxPublicBrand.packageName}/package.json`)
52543
52668
  );
52544
- return primaryCheckoutPath(path33.join(path33.dirname(pkgPath), "skills"));
52669
+ return primaryCheckoutPath(path34.join(path34.dirname(pkgPath), "skills"));
52545
52670
  } catch {
52546
- const __dirname = path33.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
52547
- return primaryCheckoutPath(path33.resolve(__dirname, "../../skills"));
52671
+ const __dirname = path34.dirname((0, import_url3.fileURLToPath)(__sootsim_import_meta_url));
52672
+ return primaryCheckoutPath(path34.resolve(__dirname, "../../skills"));
52548
52673
  }
52549
52674
  }
52550
52675
  function primaryCheckoutPath(dir) {
@@ -52567,17 +52692,17 @@ function primaryCheckoutPath(dir) {
52567
52692
  } catch {
52568
52693
  return dir;
52569
52694
  }
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;
52695
+ if (path34.basename(common) !== ".git") return dir;
52696
+ const primary = path34.join(path34.dirname(common), path34.relative(top, dir));
52697
+ return fs30.existsSync(primary) ? primary : dir;
52573
52698
  }
52574
52699
  function skillsDir() {
52575
52700
  skillsDirPath ??= getSkillsDir();
52576
52701
  return skillsDirPath;
52577
52702
  }
52578
52703
  function targetFromHome(envName, fallbackDir) {
52579
- const home = process.env[envName] || path33.join(os9.homedir(), fallbackDir);
52580
- return path33.join(home, "skills");
52704
+ const home = process.env[envName] || path34.join(os9.homedir(), fallbackDir);
52705
+ return path34.join(home, "skills");
52581
52706
  }
52582
52707
  function defaultAgentTargets() {
52583
52708
  return [
@@ -52590,7 +52715,7 @@ function hasInstalledPeachSkills() {
52590
52715
  (file) => /^([^/]+)\/SKILL\.md$/.exec(file)?.[1] ?? []
52591
52716
  ) : listSkills().map((skill7) => skill7.name);
52592
52717
  return defaultAgentTargets().some(
52593
- ({ dir }) => names.some((name2) => fs29.existsSync(path33.join(dir, name2, "SKILL.md")))
52718
+ ({ dir }) => names.some((name2) => fs30.existsSync(path34.join(dir, name2, "SKILL.md")))
52594
52719
  );
52595
52720
  }
52596
52721
  function parseSkillFrontmatter(content) {
@@ -52633,26 +52758,26 @@ function readFrontmatterField(frontmatter, field) {
52633
52758
  return null;
52634
52759
  }
52635
52760
  function listSkills() {
52636
- if (!fs29.existsSync(skillsDir())) return [];
52761
+ if (!fs30.existsSync(skillsDir())) return [];
52637
52762
  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"));
52763
+ for (const entry of fs30.readdirSync(skillsDir())) {
52764
+ const skillMd = path34.join(skillsDir(), entry, "SKILL.md");
52765
+ if (!fs30.existsSync(skillMd)) continue;
52766
+ const meta = parseSkillFrontmatter(fs30.readFileSync(skillMd, "utf8"));
52642
52767
  if (meta) {
52643
52768
  skills.push({ name: entry, description: meta.description });
52644
52769
  }
52645
52770
  }
52646
52771
  return skills.sort((a, b) => a.name.localeCompare(b.name));
52647
52772
  }
52648
- var import_child_process7, fs29, os9, path33, import_url3, import_meta3, skillsDirPath;
52773
+ var import_child_process7, fs30, os9, path34, import_url3, import_meta3, skillsDirPath;
52649
52774
  var init_skills = __esm({
52650
52775
  "cli/commands/skills.ts"() {
52651
52776
  "use strict";
52652
52777
  import_child_process7 = require("child_process");
52653
- fs29 = __toESM(require("fs"), 1);
52778
+ fs30 = __toESM(require("fs"), 1);
52654
52779
  os9 = __toESM(require("os"), 1);
52655
- path33 = __toESM(require("path"), 1);
52780
+ path34 = __toESM(require("path"), 1);
52656
52781
  import_url3 = require("url");
52657
52782
  init_cli_version();
52658
52783
  init_home_paths();
@@ -53139,7 +53264,7 @@ function assertExplicitBridgeLock(preferredPort, explicitPort, lock) {
53139
53264
  async function ensureRuntimeForOpen() {
53140
53265
  if (resolveDevCheckoutRuntimeRoot()) return;
53141
53266
  const active = readActiveRuntime();
53142
- if (active && import_node_fs39.default.existsSync(runtimeDir(active))) return;
53267
+ if (active && import_node_fs40.default.existsSync(runtimeDir(active))) return;
53143
53268
  console.error(" installing peach engine runtime...");
53144
53269
  const { runRuntime: runRuntime2 } = await Promise.resolve().then(() => (init_runtime(), runtime_exports));
53145
53270
  await runRuntime2(["install"], {});
@@ -53293,10 +53418,10 @@ async function buildResolvedBundleOpenUrl(target, baseUrl, opts = {}) {
53293
53418
  }
53294
53419
  function normalizeReplacementPath(filePath) {
53295
53420
  if (filePath.startsWith("~/")) {
53296
- return import_node_path41.default.join(import_node_os11.default.homedir(), filePath.slice(2));
53421
+ return import_node_path42.default.join(import_node_os11.default.homedir(), filePath.slice(2));
53297
53422
  }
53298
- if (import_node_path41.default.isAbsolute(filePath)) return filePath;
53299
- return import_node_path41.default.resolve(process.cwd(), filePath);
53423
+ if (import_node_path42.default.isAbsolute(filePath)) return filePath;
53424
+ return import_node_path42.default.resolve(process.cwd(), filePath);
53300
53425
  }
53301
53426
  function parseOpenRuntimeConfig(args) {
53302
53427
  const modules = {};
@@ -53315,7 +53440,7 @@ function parseOpenRuntimeConfig(args) {
53315
53440
  }
53316
53441
  const moduleName = raw2.slice(0, eqIndex).trim();
53317
53442
  const filePath = normalizeReplacementPath(raw2.slice(eqIndex + 1).trim());
53318
- if (!import_node_fs39.default.existsSync(filePath)) {
53443
+ if (!import_node_fs40.default.existsSync(filePath)) {
53319
53444
  console.error(` peach open: replacement file not found: ${filePath}`);
53320
53445
  rnxExit(1);
53321
53446
  }
@@ -53346,7 +53471,7 @@ async function resolveAppProjectForBundleUrl(bundleUrl) {
53346
53471
  return advertisedRoot ? resolveAppProject(advertisedRoot) : null;
53347
53472
  }
53348
53473
  async function ensureConfiguredRuntime(version) {
53349
- if (import_node_fs39.default.existsSync(import_node_path41.default.join(runtimeDir(version), "index.html"))) return;
53474
+ if (import_node_fs40.default.existsSync(import_node_path42.default.join(runtimeDir(version), "index.html"))) return;
53350
53475
  console.error(` installing configured engine runtime ${version}...`);
53351
53476
  const result = await rnxRuntime.install({
53352
53477
  version,
@@ -53682,7 +53807,7 @@ function playwrightHostPidForSim(sim) {
53682
53807
  function signalDriverLaunchConnected(result) {
53683
53808
  if (!result.connectAckFile) return false;
53684
53809
  try {
53685
- import_node_fs39.default.writeFileSync(
53810
+ import_node_fs40.default.writeFileSync(
53686
53811
  result.connectAckFile,
53687
53812
  `${JSON.stringify({ connectedAt: Date.now(), pid: result.pid ?? null })}
53688
53813
  `,
@@ -53696,7 +53821,7 @@ function signalDriverLaunchConnected(result) {
53696
53821
  function readUnservedUrl(result) {
53697
53822
  if (!result.diagnosticLogPath) return null;
53698
53823
  try {
53699
- const detail = import_node_fs39.default.readFileSync(result.diagnosticLogPath, "utf8");
53824
+ const detail = import_node_fs40.default.readFileSync(result.diagnosticLogPath, "utf8");
53700
53825
  const match = detail.match(/\[unserved\] nothing serves (\S+)/);
53701
53826
  return match ? match[1] : null;
53702
53827
  } catch {
@@ -53706,19 +53831,19 @@ function readUnservedUrl(result) {
53706
53831
  function printDriverDiagnosticLogTail(result) {
53707
53832
  if (!result.diagnosticLogPath) return;
53708
53833
  try {
53709
- const detail = import_node_fs39.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
53834
+ const detail = import_node_fs40.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
53710
53835
  if (!detail) {
53711
- console.error(` ${import_node_path41.default.basename(result.diagnosticLogPath)} was empty`);
53836
+ console.error(` ${import_node_path42.default.basename(result.diagnosticLogPath)} was empty`);
53712
53837
  return;
53713
53838
  }
53714
53839
  const shown = detail.length > 4e3 ? `\u2026
53715
53840
  ${detail.slice(-4e3)}` : detail;
53716
- console.error(` ${import_node_path41.default.basename(result.diagnosticLogPath)}:`);
53841
+ console.error(` ${import_node_path42.default.basename(result.diagnosticLogPath)}:`);
53717
53842
  console.error(shown);
53718
53843
  } catch (err) {
53719
53844
  const message = err instanceof Error ? err.message : String(err);
53720
53845
  console.error(
53721
- ` failed to read ${import_node_path41.default.basename(result.diagnosticLogPath)}: ${message}`
53846
+ ` failed to read ${import_node_path42.default.basename(result.diagnosticLogPath)}: ${message}`
53722
53847
  );
53723
53848
  }
53724
53849
  }
@@ -54717,14 +54842,14 @@ async function runCloseCommand(args, opts = {}) {
54717
54842
  bridge.close();
54718
54843
  }
54719
54844
  }
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;
54845
+ 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
54846
  var init_control = __esm({
54722
54847
  "cli/commands/control.ts"() {
54723
54848
  "use strict";
54724
54849
  import_node_child_process16 = require("node:child_process");
54725
- import_node_fs39 = __toESM(require("node:fs"), 1);
54850
+ import_node_fs40 = __toESM(require("node:fs"), 1);
54726
54851
  import_node_os11 = __toESM(require("node:os"), 1);
54727
- import_node_path41 = __toESM(require("node:path"), 1);
54852
+ import_node_path42 = __toESM(require("node:path"), 1);
54728
54853
  import_app_catalog_wire = require("peach-engine/engine/app-catalog-wire");
54729
54854
  import_devices2 = require("peach-engine/settings/devices");
54730
54855
  import_ws4 = require("ws");
@@ -56179,16 +56304,16 @@ function readRecentShellAppId(state) {
56179
56304
  }
56180
56305
  function resolveProjectRelativeFlowBase(flowDir) {
56181
56306
  if (!flowDir) return process.cwd();
56182
- return path35.basename(flowDir) === ".maestro" ? path35.dirname(flowDir) : flowDir;
56307
+ return path36.basename(flowDir) === ".maestro" ? path36.dirname(flowDir) : flowDir;
56183
56308
  }
56184
56309
  function resolveFlowScreenshotPathWithMode(screenshotDir, name2, opts) {
56185
56310
  const normalizedName = name2.endsWith(".png") ? name2 : `${name2}.png`;
56186
- if (path35.isAbsolute(normalizedName)) return normalizedName;
56311
+ if (path36.isAbsolute(normalizedName)) return normalizedName;
56187
56312
  if (opts.mode === "flow" && /[\\/]/.test(normalizedName)) {
56188
56313
  const baseDir = normalizedName.startsWith("./") || normalizedName.startsWith("../") ? opts.flowDir ?? process.cwd() : resolveProjectRelativeFlowBase(opts.flowDir);
56189
- return path35.resolve(baseDir, normalizedName);
56314
+ return path36.resolve(baseDir, normalizedName);
56190
56315
  }
56191
- return path35.join(screenshotDir, normalizedName);
56316
+ return path36.join(screenshotDir, normalizedName);
56192
56317
  }
56193
56318
  function normalizeFlowScreenshotSpec(step) {
56194
56319
  if (typeof step === "string") {
@@ -56242,12 +56367,12 @@ function normalizeBareStringStep(verb) {
56242
56367
  function parseFlowSteps(content) {
56243
56368
  return parseFlowFile(content).steps;
56244
56369
  }
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;
56370
+ 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
56371
  var init_bridge_flow_runner = __esm({
56247
56372
  "cli/bridge-flow-runner.ts"() {
56248
56373
  "use strict";
56249
- fs32 = __toESM(require("fs"), 1);
56250
- path35 = __toESM(require("path"), 1);
56374
+ fs33 = __toESM(require("fs"), 1);
56375
+ path36 = __toESM(require("path"), 1);
56251
56376
  import_devices4 = require("peach-engine/settings/devices");
56252
56377
  import_proof_frame = __toESM(require_proof_frame(), 1);
56253
56378
  init_flow_timeout_scale();
@@ -56572,14 +56697,14 @@ var init_bridge_flow_runner = __esm({
56572
56697
  if (chunks.length === 0) {
56573
56698
  throw new Error("recording requested but no video buffer was produced");
56574
56699
  }
56575
- fs32.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
56700
+ fs33.mkdirSync(this.opts.recordingOutputDir, { recursive: true });
56576
56701
  const videoMime = stopped.mime || this.opts.recordingFormat || "video/webm";
56577
56702
  const extension = videoMime.includes("mp4") ? "mp4" : "webm";
56578
- const outputPath = path35.join(
56703
+ const outputPath = path36.join(
56579
56704
  this.opts.recordingOutputDir,
56580
56705
  `peach-${Date.now()}.${extension}`
56581
56706
  );
56582
- fs32.writeFileSync(outputPath, Buffer.concat(chunks));
56707
+ fs33.writeFileSync(outputPath, Buffer.concat(chunks));
56583
56708
  return outputPath;
56584
56709
  }
56585
56710
  async waitForRecordingTail(opts) {
@@ -57255,7 +57380,7 @@ var init_bridge_flow_runner = __esm({
57255
57380
  flowDir: this.opts.flowDir
57256
57381
  }
57257
57382
  );
57258
- fs32.mkdirSync(path35.dirname(outputPath), { recursive: true });
57383
+ fs33.mkdirSync(path36.dirname(outputPath), { recursive: true });
57259
57384
  const layers = spec.layers ?? this.opts.screenshotLayers;
57260
57385
  const screenshotRequest = {
57261
57386
  type: "screenshot",
@@ -57290,11 +57415,11 @@ var init_bridge_flow_runner = __esm({
57290
57415
  throw new Error("could not read current device model for framed screenshot");
57291
57416
  }
57292
57417
  const framed = await composeFramedScreenshot(rawBuffer, model);
57293
- fs32.writeFileSync(outputPath, framed);
57418
+ fs33.writeFileSync(outputPath, framed);
57294
57419
  console.log(`[flow] screenshot: ${outputPath} (frame: ${model})`);
57295
57420
  return outputPath;
57296
57421
  }
57297
- fs32.writeFileSync(outputPath, rawBuffer);
57422
+ fs33.writeFileSync(outputPath, rawBuffer);
57298
57423
  console.log(`[flow] screenshot: ${outputPath}`);
57299
57424
  return outputPath;
57300
57425
  }
@@ -57316,10 +57441,10 @@ var init_bridge_flow_runner = __esm({
57316
57441
  // + a11y tree + console errors/warnings + failed network requests +
57317
57442
  // shell state, all under one directory so post-mortem is one grep away.
57318
57443
  async captureFailureBundle(outputDir, context) {
57319
- fs32.mkdirSync(outputDir, { recursive: true });
57444
+ fs33.mkdirSync(outputDir, { recursive: true });
57320
57445
  const write = (name2, content) => {
57321
57446
  try {
57322
- fs32.writeFileSync(path35.join(outputDir, name2), content);
57447
+ fs33.writeFileSync(path36.join(outputDir, name2), content);
57323
57448
  } catch {
57324
57449
  }
57325
57450
  };
@@ -57912,8 +58037,8 @@ var init_bridge_flow_runner = __esm({
57912
58037
  runScript(target) {
57913
58038
  const spec = typeof target === "string" ? { file: target } : target;
57914
58039
  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");
58040
+ const scriptPath = path36.resolve(this.opts.flowDir, spec.file);
58041
+ const source = fs33.readFileSync(scriptPath, "utf8");
57917
58042
  this.js.evaluate(source, { env: spec.env });
57918
58043
  console.log(`[flow] runScript: ${spec.file} done`);
57919
58044
  }
@@ -58273,14 +58398,14 @@ var init_bridge_flow_runner = __esm({
58273
58398
  for (const [k, v] of Object.entries(env)) this.js.putEnv(k, v);
58274
58399
  }
58275
58400
  if (file) {
58276
- const flowPath = path35.resolve(this.opts.flowDir, file);
58277
- const flowContent = fs32.readFileSync(flowPath, "utf8");
58401
+ const flowPath = path36.resolve(this.opts.flowDir, file);
58402
+ const flowContent = fs33.readFileSync(flowPath, "utf8");
58278
58403
  const { frontmatter } = parseFlowFile(flowContent);
58279
58404
  if (frontmatter.env && typeof frontmatter.env === "object") {
58280
58405
  this.js.defineVariables(frontmatter.env);
58281
58406
  }
58282
58407
  const previousDir = this.opts.flowDir;
58283
- this.opts.flowDir = path35.dirname(flowPath);
58408
+ this.opts.flowDir = path36.dirname(flowPath);
58284
58409
  try {
58285
58410
  await this.runFlow(parseFlowSteps(flowContent));
58286
58411
  } finally {
@@ -58451,8 +58576,8 @@ __export(registry_exports, {
58451
58576
  skillRegistry: () => skillRegistry
58452
58577
  });
58453
58578
  module.exports = __toCommonJS(registry_exports);
58454
- var fs33 = __toESM(require("fs"), 1);
58455
- var path36 = __toESM(require("path"), 1);
58579
+ var fs34 = __toESM(require("fs"), 1);
58580
+ var path37 = __toESM(require("path"), 1);
58456
58581
 
58457
58582
  // src/skills/builtin/a11y-review.ts
58458
58583
  init_reap_browser();
@@ -58471,8 +58596,8 @@ var skill = {
58471
58596
  },
58472
58597
  async execute(params, context) {
58473
58598
  const { chromium } = await import("playwright");
58474
- const path37 = await import("path");
58475
- const fs34 = await import("fs");
58599
+ const path38 = await import("path");
58600
+ const fs35 = await import("fs");
58476
58601
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
58477
58602
  headless: true
58478
58603
  });
@@ -58529,9 +58654,9 @@ var skill = {
58529
58654
  warnings: issues.filter((i) => i.severity === "warning").length,
58530
58655
  tree: typeof tree === "string" ? tree : JSON.stringify(tree)
58531
58656
  };
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));
58657
+ const reportPath = path38.join(context.outputDir, "a11y-report.json");
58658
+ fs35.mkdirSync(path38.dirname(reportPath), { recursive: true });
58659
+ fs35.writeFileSync(reportPath, JSON.stringify(report, null, 2));
58535
58660
  return {
58536
58661
  success: issues.filter((i) => i.severity === "error").length === 0,
58537
58662
  message: `${report.errors} errors, ${report.warnings} warnings across ${report.nodeCount} nodes`,
@@ -58564,14 +58689,14 @@ var skill2 = {
58564
58689
  }
58565
58690
  },
58566
58691
  async execute(params, context) {
58567
- const fs34 = await import("node:fs");
58568
- const path37 = await import("node:path");
58692
+ const fs35 = await import("node:fs");
58693
+ const path38 = await import("node:path");
58569
58694
  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)) {
58695
+ const packagePath = path38.join(context.projectDir, "package.json");
58696
+ if (!fs35.existsSync(packagePath)) {
58572
58697
  return { success: false, message: "No package.json found" };
58573
58698
  }
58574
- const parsed = JSON.parse(fs34.readFileSync(packagePath, "utf8"));
58699
+ const parsed = JSON.parse(fs35.readFileSync(packagePath, "utf8"));
58575
58700
  if (!parsed || typeof parsed !== "object") {
58576
58701
  return { success: false, message: "package.json is not an object" };
58577
58702
  }
@@ -58583,9 +58708,9 @@ var skill2 = {
58583
58708
  }) : scanDeps2(parsed);
58584
58709
  const packageResult = params.packageName ? scan.packages[0] : void 0;
58585
58710
  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)}
58711
+ const reportPath = path38.join(context.outputDir, "compat-report.json");
58712
+ fs35.mkdirSync(path38.dirname(reportPath), { recursive: true });
58713
+ fs35.writeFileSync(reportPath, `${JSON.stringify(scan, null, 2)}
58589
58714
  `);
58590
58715
  return {
58591
58716
  success: true,
@@ -58627,8 +58752,8 @@ var skill3 = {
58627
58752
  record: { type: "boolean", description: "Record video of the flow" }
58628
58753
  },
58629
58754
  async execute(params, context) {
58630
- const fs34 = await import("fs");
58631
- const path37 = await import("path");
58755
+ const fs35 = await import("fs");
58756
+ const path38 = await import("path");
58632
58757
  const yaml = await Promise.resolve().then(() => (init_browser(), browser_exports));
58633
58758
  const { DEFAULT_SOOTSIM_BRIDGE_PORT: DEFAULT_SOOTSIM_BRIDGE_PORT3 } = await Promise.resolve().then(() => (init_bridge_constants(), bridge_constants_exports));
58634
58759
  const { SootSimBridgeHost: SootSimBridgeHost2 } = await Promise.resolve().then(() => (init_bridge_host(), bridge_host_exports));
@@ -58638,7 +58763,7 @@ var skill3 = {
58638
58763
  const host2 = new SootSimBridgeHost2({ port: DEFAULT_SOOTSIM_BRIDGE_PORT3 });
58639
58764
  host2.start({ silent: true });
58640
58765
  try {
58641
- const flowContent = fs34.readFileSync(params.flowPath, "utf8");
58766
+ const flowContent = fs35.readFileSync(params.flowPath, "utf8");
58642
58767
  const fmMatch = flowContent.match(/^---\n([\s\S]*?)\n---\n?/);
58643
58768
  const stepsBody = fmMatch ? flowContent.slice(fmMatch[0].length) : flowContent;
58644
58769
  const steps = yaml.parse(stepsBody);
@@ -58665,7 +58790,7 @@ var skill3 = {
58665
58790
  });
58666
58791
  const driver = new SootSimBridgeFlowRunner2(bridge, {
58667
58792
  screenshotDir: context.outputDir,
58668
- flowDir: path37.dirname(path37.resolve(params.flowPath)),
58793
+ flowDir: path38.dirname(path38.resolve(params.flowPath)),
58669
58794
  simId,
58670
58795
  recordingOutputDir: params.record ? context.outputDir : void 0
58671
58796
  });
@@ -58687,7 +58812,7 @@ var skill3 = {
58687
58812
  simId,
58688
58813
  videoPath: videoPath || void 0
58689
58814
  },
58690
- artifacts: videoPath ? [{ type: "video", name: path37.basename(videoPath), path: videoPath }] : void 0
58815
+ artifacts: videoPath ? [{ type: "video", name: path38.basename(videoPath), path: videoPath }] : void 0
58691
58816
  };
58692
58817
  } finally {
58693
58818
  try {
@@ -58734,8 +58859,8 @@ var skill4 = {
58734
58859
  },
58735
58860
  async execute(params, context) {
58736
58861
  const { chromium } = await import("playwright");
58737
- const path37 = await import("path");
58738
- const fs34 = await import("fs");
58862
+ const path38 = await import("path");
58863
+ const fs35 = await import("fs");
58739
58864
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
58740
58865
  headless: true
58741
58866
  });
@@ -58763,9 +58888,9 @@ var skill4 = {
58763
58888
  ...profile,
58764
58889
  fps: syncCount > 0 ? (syncCount / (duration / 1e3)).toFixed(1) : "0"
58765
58890
  };
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));
58891
+ const reportPath = path38.join(context.outputDir, "perf-report.json");
58892
+ fs35.mkdirSync(path38.dirname(reportPath), { recursive: true });
58893
+ fs35.writeFileSync(reportPath, JSON.stringify(report, null, 2));
58769
58894
  return {
58770
58895
  success: true,
58771
58896
  message: `${report.fps} fps, ${profile.avgSyncMs?.toFixed(1)}ms avg sync, ${nodeCount} nodes`,
@@ -58798,8 +58923,8 @@ var skill5 = {
58798
58923
  },
58799
58924
  async execute(params, context) {
58800
58925
  const { chromium } = await import("playwright");
58801
- const path37 = await import("path");
58802
- const fs34 = await import("fs");
58926
+ const path38 = await import("path");
58927
+ const fs35 = await import("fs");
58803
58928
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
58804
58929
  headless: true
58805
58930
  });
@@ -58807,8 +58932,8 @@ var skill5 = {
58807
58932
  try {
58808
58933
  await page.goto(context.url, { waitUntil: "networkidle" });
58809
58934
  await page.waitForTimeout(2e3);
58810
- const outputPath = path37.join(context.outputDir, `${params.name}.png`);
58811
- fs34.mkdirSync(path37.dirname(outputPath), { recursive: true });
58935
+ const outputPath = path38.join(context.outputDir, `${params.name}.png`);
58936
+ fs35.mkdirSync(path38.dirname(outputPath), { recursive: true });
58812
58937
  await page.screenshot({ path: outputPath });
58813
58938
  return {
58814
58939
  success: true,
@@ -58849,8 +58974,8 @@ var skill6 = {
58849
58974
  },
58850
58975
  async execute(params, context) {
58851
58976
  const { chromium } = await import("playwright");
58852
- const path37 = await import("path");
58853
- const fs34 = await import("fs");
58977
+ const path38 = await import("path");
58978
+ const fs35 = await import("fs");
58854
58979
  const browser = await launchReapedChrome((options) => chromium.launch(options), {
58855
58980
  headless: true
58856
58981
  });
@@ -58858,14 +58983,14 @@ var skill6 = {
58858
58983
  try {
58859
58984
  await page.goto(context.url, { waitUntil: "networkidle" });
58860
58985
  await page.waitForTimeout(2e3);
58861
- const currentPath = path37.join(context.outputDir, `${params.name}-current.png`);
58862
- fs34.mkdirSync(path37.dirname(currentPath), { recursive: true });
58986
+ const currentPath = path38.join(context.outputDir, `${params.name}-current.png`);
58987
+ fs35.mkdirSync(path38.dirname(currentPath), { recursive: true });
58863
58988
  await page.screenshot({ path: currentPath });
58864
58989
  try {
58865
58990
  const { PNG } = await import("pngjs");
58866
58991
  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));
58992
+ const baseline = PNG.sync.read(fs35.readFileSync(params.baseline));
58993
+ const current = PNG.sync.read(fs35.readFileSync(currentPath));
58869
58994
  const { width, height } = baseline;
58870
58995
  const diff = new PNG({ width, height });
58871
58996
  const numDiffPixels = pixelmatch(
@@ -58876,8 +59001,8 @@ var skill6 = {
58876
59001
  height,
58877
59002
  { threshold: params.threshold || 0.1 }
58878
59003
  );
58879
- const diffPath = path37.join(context.outputDir, `${params.name}-diff.png`);
58880
- fs34.writeFileSync(diffPath, PNG.sync.write(diff));
59004
+ const diffPath = path38.join(context.outputDir, `${params.name}-diff.png`);
59005
+ fs35.writeFileSync(diffPath, PNG.sync.write(diff));
58881
59006
  const totalPixels = width * height;
58882
59007
  const diffPercent = (numDiffPixels / totalPixels * 100).toFixed(2);
58883
59008
  return {
@@ -58941,10 +59066,10 @@ var skillRegistry = {
58941
59066
  },
58942
59067
  // load skills from a project manifest (rnx-skills.json)
58943
59068
  async loadFromManifest(projectDir) {
58944
- const manifestPath = path36.join(projectDir, "rnx-skills.json");
58945
- if (!fs33.existsSync(manifestPath)) return;
59069
+ const manifestPath = path37.join(projectDir, "rnx-skills.json");
59070
+ if (!fs34.existsSync(manifestPath)) return;
58946
59071
  try {
58947
- const manifest = JSON.parse(fs33.readFileSync(manifestPath, "utf8"));
59072
+ const manifest = JSON.parse(fs34.readFileSync(manifestPath, "utf8"));
58948
59073
  if (Array.isArray(manifest.skills)) {
58949
59074
  for (const entry of manifest.skills) {
58950
59075
  if (typeof entry === "string") {
@@ -58955,7 +59080,7 @@ var skillRegistry = {
58955
59080
  }
58956
59081
  } else if (entry.file) {
58957
59082
  try {
58958
- const mod = await import(path36.resolve(projectDir, entry.file));
59083
+ const mod = await import(path37.resolve(projectDir, entry.file));
58959
59084
  if (mod.skill) this.register(mod.skill);
58960
59085
  } catch {
58961
59086
  }
@@ -58968,10 +59093,10 @@ var skillRegistry = {
58968
59093
  // auto-discover skills based on project dependencies
58969
59094
  suggestSkills(projectDir) {
58970
59095
  const suggestions = [];
58971
- const pkgPath = path36.join(projectDir, "package.json");
58972
- if (!fs33.existsSync(pkgPath)) return suggestions;
59096
+ const pkgPath = path37.join(projectDir, "package.json");
59097
+ if (!fs34.existsSync(pkgPath)) return suggestions;
58973
59098
  try {
58974
- const pkg = JSON.parse(fs33.readFileSync(pkgPath, "utf8"));
59099
+ const pkg = JSON.parse(fs34.readFileSync(pkgPath, "utf8"));
58975
59100
  const deps = { ...pkg.dependencies, ...pkg.devDependencies };
58976
59101
  if (deps["detox"] || deps["maestro"]) {
58977
59102
  suggestions.push("maestro-test");