peachsim 0.1.1673 → 0.1.1684

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 (213) hide show
  1. package/cli/commands/control.ts +13 -1
  2. package/cli/commands/coverage-swift.ts +83 -27
  3. package/cli/commands/coverage.ts +219 -20
  4. package/cli/commands/detect.ts +10 -6
  5. package/cli/commands/inspect/core.ts +2 -0
  6. package/cli/commands/inspect/settling.ts +37 -4
  7. package/cli/commands/inspect/wait-ready.ts +7 -0
  8. package/cli/outbound-endpoints.ts +12 -0
  9. package/detox/index.ts +11 -1
  10. package/detox/jest-environment.cjs +14 -0
  11. package/dist-lib/agent-daemon-client.cjs +1 -1
  12. package/dist-lib/agent-events.cjs +1 -1
  13. package/dist-lib/attached-projects.cjs +1 -1
  14. package/dist-lib/auth/shared-session.cjs +1 -1
  15. package/dist-lib/backend-origin.cjs +1 -1
  16. package/dist-lib/beta.cjs +1 -1
  17. package/dist-lib/beta.mjs +1 -1
  18. package/dist-lib/bridge-constants.cjs +1 -1
  19. package/dist-lib/bridge-contract-input.cjs +1 -1
  20. package/dist-lib/bridge-contract-input.mjs +1 -1
  21. package/dist-lib/bridge-contract.cjs +1 -1
  22. package/dist-lib/bridge-contract.mjs +1 -1
  23. package/dist-lib/bundle-channel.cjs +3299 -1665
  24. package/dist-lib/capture-contract.cjs +1 -1
  25. package/dist-lib/capture-contract.mjs +1 -1
  26. package/dist-lib/cloud-contract.cjs +1 -1
  27. package/dist-lib/cloud-contract.mjs +1 -1
  28. package/dist-lib/cloud-test-args.cjs +1 -1
  29. package/dist-lib/cloud-test-args.mjs +1 -1
  30. package/dist-lib/cloud.cjs +1 -1
  31. package/dist-lib/cloud.mjs +1 -1
  32. package/dist-lib/config.cjs +1 -1
  33. package/dist-lib/config.mjs +1 -1
  34. package/dist-lib/detox/index.cjs +43 -8
  35. package/dist-lib/detox/jest-environment.cjs +14 -0
  36. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  37. package/dist-lib/expo-swift-bundle.cjs +2432 -1128
  38. package/dist-lib/expo-swift-metadata.cjs +1 -1
  39. package/dist-lib/expo-swift-metadata.mjs +1 -1
  40. package/dist-lib/home-paths.cjs +1 -1
  41. package/dist-lib/host/bridge-host.cjs +2908 -1601
  42. package/dist-lib/host/fetch-proxy-handler.cjs +22 -6
  43. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  44. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  45. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  46. package/dist-lib/host/websocket-proxy.cjs +1 -1
  47. package/dist-lib/index.cjs +1941 -742
  48. package/dist-lib/jump-to-source-babel.cjs +1 -1
  49. package/dist-lib/jump-to-source-native.cjs +1 -1
  50. package/dist-lib/kotlin-host.cjs +1 -1
  51. package/dist-lib/menu.cjs +1 -1
  52. package/dist-lib/menu.mjs +1 -1
  53. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  54. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  55. package/dist-lib/metro-production-bundle.cjs +1 -1
  56. package/dist-lib/metro-production-bundle.mjs +1 -1
  57. package/dist-lib/metro.cjs +6215 -4283
  58. package/dist-lib/native-app-identity-project.cjs +31 -6
  59. package/dist-lib/native-app-identity-project.mjs +31 -6
  60. package/dist-lib/native-app-identity.cjs +1 -1
  61. package/dist-lib/native-app-identity.mjs +1 -1
  62. package/dist-lib/native-firebase-metadata.cjs +1 -1
  63. package/dist-lib/native-firebase-metadata.mjs +1 -1
  64. package/dist-lib/plist.cjs +1 -1
  65. package/dist-lib/plist.mjs +1 -1
  66. package/dist-lib/profiles.cjs +1 -1
  67. package/dist-lib/public-brand.cjs +1 -1
  68. package/dist-lib/public-origins-lib-esm.json +24 -23
  69. package/dist-lib/public-origins-lib-static.json +1 -1
  70. package/dist-lib/public-origins-lib.json +134 -78
  71. package/dist-lib/react-native-host-modules.cjs +1 -1
  72. package/dist-lib/react-native-host-modules.mjs +1 -1
  73. package/dist-lib/reap-browser.cjs +2 -2
  74. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  75. package/dist-lib/sdk.cjs +39 -5
  76. package/dist-lib/sdk.mjs +39 -5
  77. package/dist-lib/skills.cjs +3637 -2168
  78. package/dist-lib/swift-compile.cjs +496 -352
  79. package/dist-lib/swift-compile.mjs +494 -350
  80. package/dist-lib/swift-package.cjs +58 -9
  81. package/dist-lib/swift-package.mjs +57 -9
  82. package/dist-lib/swift-submit.cjs +1 -1
  83. package/dist-lib/swift-submit.mjs +1 -1
  84. package/dist-lib/swift-toolchain.cjs +26 -11
  85. package/dist-lib/swift.cjs +1 -1
  86. package/dist-lib/vite-swift.cjs +2443 -1134
  87. package/dist-lib/vite.cjs +1907 -763
  88. package/dist-lib/worklet-executable.cjs +1 -1
  89. package/dist-lib/worklet-executable.mjs +1 -1
  90. package/dist-types/packages/peach-engine/src/engine/canvaskit-api.d.ts +1 -1
  91. package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +9 -1
  92. package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +1 -0
  93. package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +11 -3
  94. package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +1 -1
  95. package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +6 -0
  96. package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +2 -0
  97. package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +10 -1
  98. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  99. package/package.json +1 -1
  100. package/runtime-companion.json +1 -1
  101. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +69 -2
  102. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +44 -4
  103. package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFComposeAssistantViewController.h +29 -0
  104. package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeControllerDeferredAction.h +14 -0
  105. package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeViewController.h +162 -0
  106. package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailDraft.h +24 -0
  107. package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController+UPI.h +31 -0
  108. package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController.h +169 -0
  109. package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MessageUI.h +13 -0
  110. package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Modules/module.modulemap +11 -0
  111. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +10 -0
  112. package/sdk/ios/usr/include/_ctype.h +388 -0
  113. package/sdk/ios/usr/include/_inttypes.h +296 -0
  114. package/sdk/ios/usr/include/_locale.h +83 -0
  115. package/sdk/ios/usr/include/_locale_posix2008.h +65 -0
  116. package/sdk/ios/usr/include/_time.h +207 -0
  117. package/sdk/ios/usr/include/arm/param.h +151 -0
  118. package/sdk/ios/usr/include/ctype.h +70 -0
  119. package/sdk/ios/usr/include/dispatch/dispatch.h +72 -6
  120. package/sdk/ios/usr/include/dlfcn.h +1 -2
  121. package/sdk/ios/usr/include/inttypes.h +35 -0
  122. package/sdk/ios/usr/include/locale.h +59 -0
  123. package/sdk/ios/usr/include/machine/param.h +42 -0
  124. package/sdk/ios/usr/include/net/if.h +1 -2
  125. package/sdk/ios/usr/include/peach/pthread.h +4 -4
  126. package/sdk/ios/usr/include/pthread/qos.h +304 -0
  127. package/sdk/ios/usr/include/runetype.h +118 -0
  128. package/sdk/ios/usr/include/setjmp.h +99 -0
  129. package/sdk/ios/usr/include/sys/_types/_clock_t.h +32 -0
  130. package/sdk/ios/usr/include/sys/_types/_ct_rune_t.h +33 -0
  131. package/sdk/ios/usr/include/sys/_types/_fd_clr.h +31 -0
  132. package/sdk/ios/usr/include/sys/_types/_fd_copy.h +31 -0
  133. package/sdk/ios/usr/include/sys/_types/_fd_def.h +121 -0
  134. package/sdk/ios/usr/include/sys/_types/_fd_isset.h +31 -0
  135. package/sdk/ios/usr/include/sys/_types/_fd_set.h +31 -0
  136. package/sdk/ios/usr/include/sys/_types/_fd_setsize.h +31 -0
  137. package/sdk/ios/usr/include/sys/_types/_fd_zero.h +31 -0
  138. package/sdk/ios/usr/include/sys/_types/_rune_t.h +32 -0
  139. package/sdk/ios/usr/include/sys/_types/_time_t.h +32 -0
  140. package/sdk/ios/usr/include/sys/_types/_wint_t.h +33 -0
  141. package/sdk/ios/usr/include/sys/cdefs.h +5 -0
  142. package/sdk/ios/usr/include/sys/param.h +235 -0
  143. package/sdk/ios/usr/include/sys/proc.h +1 -0
  144. package/sdk/ios/usr/include/sys/qos.h +151 -12
  145. package/sdk/ios/usr/include/time.h +67 -2
  146. package/sdk/ios/wasm/include/__typedef_sigset_t.h +7 -0
  147. package/sdk/ios/wasm/include/fcntl.h +11 -0
  148. package/sdk/ios/wasm/include/mach/machine/boolean.h +2 -0
  149. package/sdk/ios/wasm/include/mach/machine/exception.h +5 -0
  150. package/sdk/ios/wasm/include/mach/machine/kern_return.h +2 -0
  151. package/sdk/ios/wasm/include/mach/machine/processor_info.h +2 -0
  152. package/sdk/ios/wasm/include/mach/machine/rpc.h +2 -0
  153. package/sdk/ios/wasm/include/mach/machine/thread_state.h +3 -0
  154. package/sdk/ios/wasm/include/mach/machine/thread_status.h +3 -0
  155. package/sdk/ios/wasm/include/mach/machine/vm_param.h +3 -0
  156. package/sdk/ios/wasm/include/mach/machine/vm_types.h +18 -0
  157. package/sdk/ios/wasm/include/machine/_types.h +153 -0
  158. package/sdk/ios/wasm/include/machine/endian.h +2 -0
  159. package/sdk/ios/wasm/include/machine/limits.h +2 -0
  160. package/sdk/ios/wasm/include/machine/types.h +30 -0
  161. package/sdk/ios/wasm/include/poll.h +8 -0
  162. package/sdk/ios/wasm/include/pthread.h +50 -0
  163. package/sdk/ios/wasm/include/signal.h +72 -0
  164. package/sdk/ios/wasm/include/stdlib.h +3 -0
  165. package/sdk/ios/wasm/include/string.h +10 -0
  166. package/sdk/ios/wasm/include/sys/_pthread/_pthread_attr_t.h +7 -0
  167. package/sdk/ios/wasm/include/sys/_pthread/_pthread_t.h +7 -0
  168. package/sdk/ios/wasm/include/sys/mman.h +122 -0
  169. package/sdk/ios/wasm/include/sys/select.h +37 -0
  170. package/sdk/ios/wasm/include/sys/signal.h +259 -0
  171. package/sdk/ios/wasm/include/sys/socket.h +8 -0
  172. package/sdk/ios/wasm/include/sys/types.h +14 -0
  173. package/sdk/ios/wasm/include/sys/ucontext.h +1 -0
  174. package/sdk/ios/wasm/include/sys/uio.h +11 -0
  175. package/sdk/ios/wasm/include/sys/wait.h +89 -0
  176. package/sdk/ios/wasm/include/time.h +8 -0
  177. package/sdk/ios/wasm/include/unistd.h +17 -0
  178. package/src/bridge-contract.ts +2 -0
  179. package/src/chromium-admission.ts +10 -5
  180. package/src/device-catalog.ts +4 -4
  181. package/src/host/fetch-proxy-handler.ts +20 -0
  182. package/src/host/rolldown-bundle-forward.ts +4 -1
  183. package/src/metro-plugin.ts +5 -2
  184. package/src/nitro-adapter.lock.json +6 -6
  185. package/src/nitro-compile.ts +63 -2
  186. package/src/numbered-lock.ts +72 -0
  187. package/src/react-native-coverage/capability-reference-resolution.ts +62 -5
  188. package/src/react-native-coverage/capability-source-references.ts +50 -13
  189. package/src/react-native-coverage/native-source-credit.ts +126 -0
  190. package/src/react-native-coverage/native-source-ranges-file.ts +38 -0
  191. package/src/react-native-coverage/native-surface.ts +49 -0
  192. package/src/react-native-coverage/verified-reach.ts +22 -2
  193. package/src/runtime-assets.ts +17 -0
  194. package/src/swift-compile.ts +84 -47
  195. package/src/swift-coverage/indexing.ts +17 -1
  196. package/src/swift-coverage/sdk.ts +71 -0
  197. package/src/swift-coverage/source.ts +74 -2
  198. package/src/swift-coverage/types.ts +6 -0
  199. package/src/swift-distribution.lock.json +12 -12
  200. package/src/swift-host.ts +133 -14
  201. package/src/swift-objc-compile.ts +11 -22
  202. package/src/swift-objc-metadata.ts +2 -8
  203. package/src/swift-objc-platform.ts +53 -0
  204. package/src/swift-objc-standin.ts +49 -0
  205. package/src/swift-package-manifest.ts +48 -3
  206. package/src/swift-package.ts +85 -12
  207. package/src/swift-packages.ts +157 -44
  208. package/src/swift-source-pods.ts +288 -0
  209. package/src/swift-standins.ts +4 -1
  210. package/src/swift-toolchain.ts +32 -10
  211. package/src/vite-plugin-one.ts +5 -4
  212. package/src/worker-system-chunks.ts +7 -1
  213. package/src/xcode-project.ts +40 -11
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1673 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1684 | (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;
@@ -70,11 +70,11 @@ __export(swift_compile_exports, {
70
70
  writeSwiftProject: () => writeSwiftProject
71
71
  });
72
72
  module.exports = __toCommonJS(swift_compile_exports);
73
- var import_node_child_process7 = require("node:child_process");
73
+ var import_node_child_process8 = require("node:child_process");
74
74
  var import_node_crypto7 = require("node:crypto");
75
75
  var import_node_fs8 = require("node:fs");
76
76
  var import_node_os4 = __toESM(require("node:os"), 1);
77
- var import_node_path10 = __toESM(require("node:path"), 1);
77
+ var import_node_path11 = __toESM(require("node:path"), 1);
78
78
 
79
79
  // ../../node_modules/yaml/browser/dist/index.js
80
80
  var dist_exports = {};
@@ -162,17 +162,17 @@ function visit(node, visitor) {
162
162
  visit.BREAK = BREAK;
163
163
  visit.SKIP = SKIP;
164
164
  visit.REMOVE = REMOVE;
165
- function visit_(key, node, visitor, path10) {
166
- const ctrl = callVisitor(key, node, visitor, path10);
165
+ function visit_(key, node, visitor, path11) {
166
+ const ctrl = callVisitor(key, node, visitor, path11);
167
167
  if (isNode(ctrl) || isPair(ctrl)) {
168
- replaceNode(key, path10, ctrl);
169
- return visit_(key, ctrl, visitor, path10);
168
+ replaceNode(key, path11, ctrl);
169
+ return visit_(key, ctrl, visitor, path11);
170
170
  }
171
171
  if (typeof ctrl !== "symbol") {
172
172
  if (isCollection(node)) {
173
- path10 = Object.freeze(path10.concat(node));
173
+ path11 = Object.freeze(path11.concat(node));
174
174
  for (let i = 0; i < node.items.length; ++i) {
175
- const ci = visit_(i, node.items[i], visitor, path10);
175
+ const ci = visit_(i, node.items[i], visitor, path11);
176
176
  if (typeof ci === "number")
177
177
  i = ci - 1;
178
178
  else if (ci === BREAK)
@@ -183,13 +183,13 @@ function visit_(key, node, visitor, path10) {
183
183
  }
184
184
  }
185
185
  } else if (isPair(node)) {
186
- path10 = Object.freeze(path10.concat(node));
187
- const ck = visit_("key", node.key, visitor, path10);
186
+ path11 = Object.freeze(path11.concat(node));
187
+ const ck = visit_("key", node.key, visitor, path11);
188
188
  if (ck === BREAK)
189
189
  return BREAK;
190
190
  else if (ck === REMOVE)
191
191
  node.key = null;
192
- const cv = visit_("value", node.value, visitor, path10);
192
+ const cv = visit_("value", node.value, visitor, path11);
193
193
  if (cv === BREAK)
194
194
  return BREAK;
195
195
  else if (cv === REMOVE)
@@ -210,17 +210,17 @@ async function visitAsync(node, visitor) {
210
210
  visitAsync.BREAK = BREAK;
211
211
  visitAsync.SKIP = SKIP;
212
212
  visitAsync.REMOVE = REMOVE;
213
- async function visitAsync_(key, node, visitor, path10) {
214
- const ctrl = await callVisitor(key, node, visitor, path10);
213
+ async function visitAsync_(key, node, visitor, path11) {
214
+ const ctrl = await callVisitor(key, node, visitor, path11);
215
215
  if (isNode(ctrl) || isPair(ctrl)) {
216
- replaceNode(key, path10, ctrl);
217
- return visitAsync_(key, ctrl, visitor, path10);
216
+ replaceNode(key, path11, ctrl);
217
+ return visitAsync_(key, ctrl, visitor, path11);
218
218
  }
219
219
  if (typeof ctrl !== "symbol") {
220
220
  if (isCollection(node)) {
221
- path10 = Object.freeze(path10.concat(node));
221
+ path11 = Object.freeze(path11.concat(node));
222
222
  for (let i = 0; i < node.items.length; ++i) {
223
- const ci = await visitAsync_(i, node.items[i], visitor, path10);
223
+ const ci = await visitAsync_(i, node.items[i], visitor, path11);
224
224
  if (typeof ci === "number")
225
225
  i = ci - 1;
226
226
  else if (ci === BREAK)
@@ -231,13 +231,13 @@ async function visitAsync_(key, node, visitor, path10) {
231
231
  }
232
232
  }
233
233
  } else if (isPair(node)) {
234
- path10 = Object.freeze(path10.concat(node));
235
- const ck = await visitAsync_("key", node.key, visitor, path10);
234
+ path11 = Object.freeze(path11.concat(node));
235
+ const ck = await visitAsync_("key", node.key, visitor, path11);
236
236
  if (ck === BREAK)
237
237
  return BREAK;
238
238
  else if (ck === REMOVE)
239
239
  node.key = null;
240
- const cv = await visitAsync_("value", node.value, visitor, path10);
240
+ const cv = await visitAsync_("value", node.value, visitor, path11);
241
241
  if (cv === BREAK)
242
242
  return BREAK;
243
243
  else if (cv === REMOVE)
@@ -264,23 +264,23 @@ function initVisitor(visitor) {
264
264
  }
265
265
  return visitor;
266
266
  }
267
- function callVisitor(key, node, visitor, path10) {
267
+ function callVisitor(key, node, visitor, path11) {
268
268
  if (typeof visitor === "function")
269
- return visitor(key, node, path10);
269
+ return visitor(key, node, path11);
270
270
  if (isMap(node))
271
- return visitor.Map?.(key, node, path10);
271
+ return visitor.Map?.(key, node, path11);
272
272
  if (isSeq(node))
273
- return visitor.Seq?.(key, node, path10);
273
+ return visitor.Seq?.(key, node, path11);
274
274
  if (isPair(node))
275
- return visitor.Pair?.(key, node, path10);
275
+ return visitor.Pair?.(key, node, path11);
276
276
  if (isScalar(node))
277
- return visitor.Scalar?.(key, node, path10);
277
+ return visitor.Scalar?.(key, node, path11);
278
278
  if (isAlias(node))
279
- return visitor.Alias?.(key, node, path10);
279
+ return visitor.Alias?.(key, node, path11);
280
280
  return void 0;
281
281
  }
282
- function replaceNode(key, path10, node) {
283
- const parent = path10[path10.length - 1];
282
+ function replaceNode(key, path11, node) {
283
+ const parent = path11[path11.length - 1];
284
284
  if (isCollection(parent)) {
285
285
  parent.items[key] = node;
286
286
  } else if (isPair(parent)) {
@@ -809,10 +809,10 @@ function createNode(value, tagName, ctx) {
809
809
  }
810
810
 
811
811
  // ../../node_modules/yaml/browser/dist/nodes/Collection.js
812
- function collectionFromPath(schema4, path10, value) {
812
+ function collectionFromPath(schema4, path11, value) {
813
813
  let v = value;
814
- for (let i = path10.length - 1; i >= 0; --i) {
815
- const k = path10[i];
814
+ for (let i = path11.length - 1; i >= 0; --i) {
815
+ const k = path11[i];
816
816
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
817
817
  const a = [];
818
818
  a[k] = v;
@@ -831,7 +831,7 @@ function collectionFromPath(schema4, path10, value) {
831
831
  sourceObjects: /* @__PURE__ */ new Map()
832
832
  });
833
833
  }
834
- var isEmptyPath = (path10) => path10 == null || typeof path10 === "object" && !!path10[Symbol.iterator]().next().done;
834
+ var isEmptyPath = (path11) => path11 == null || typeof path11 === "object" && !!path11[Symbol.iterator]().next().done;
835
835
  var Collection = class extends NodeBase {
836
836
  constructor(type, schema4) {
837
837
  super(type);
@@ -861,11 +861,11 @@ var Collection = class extends NodeBase {
861
861
  * be a Pair instance or a `{ key, value }` object, which may not have a key
862
862
  * that already exists in the map.
863
863
  */
864
- addIn(path10, value) {
865
- if (isEmptyPath(path10))
864
+ addIn(path11, value) {
865
+ if (isEmptyPath(path11))
866
866
  this.add(value);
867
867
  else {
868
- const [key, ...rest] = path10;
868
+ const [key, ...rest] = path11;
869
869
  const node = this.get(key, true);
870
870
  if (isCollection(node))
871
871
  node.addIn(rest, value);
@@ -879,8 +879,8 @@ var Collection = class extends NodeBase {
879
879
  * Removes a value from the collection.
880
880
  * @returns `true` if the item was found and removed.
881
881
  */
882
- deleteIn(path10) {
883
- const [key, ...rest] = path10;
882
+ deleteIn(path11) {
883
+ const [key, ...rest] = path11;
884
884
  if (rest.length === 0)
885
885
  return this.delete(key);
886
886
  const node = this.get(key, true);
@@ -894,8 +894,8 @@ var Collection = class extends NodeBase {
894
894
  * scalar values from their surrounding node; to disable set `keepScalar` to
895
895
  * `true` (collections are always returned intact).
896
896
  */
897
- getIn(path10, keepScalar) {
898
- const [key, ...rest] = path10;
897
+ getIn(path11, keepScalar) {
898
+ const [key, ...rest] = path11;
899
899
  const node = this.get(key, true);
900
900
  if (rest.length === 0)
901
901
  return !keepScalar && isScalar(node) ? node.value : node;
@@ -913,8 +913,8 @@ var Collection = class extends NodeBase {
913
913
  /**
914
914
  * Checks if the collection includes a value with the key `key`.
915
915
  */
916
- hasIn(path10) {
917
- const [key, ...rest] = path10;
916
+ hasIn(path11) {
917
+ const [key, ...rest] = path11;
918
918
  if (rest.length === 0)
919
919
  return this.has(key);
920
920
  const node = this.get(key, true);
@@ -924,8 +924,8 @@ var Collection = class extends NodeBase {
924
924
  * Sets a value in this collection. For `!!set`, `value` needs to be a
925
925
  * boolean to add/remove the item from the set.
926
926
  */
927
- setIn(path10, value) {
928
- const [key, ...rest] = path10;
927
+ setIn(path11, value) {
928
+ const [key, ...rest] = path11;
929
929
  if (rest.length === 0) {
930
930
  this.set(key, value);
931
931
  } else {
@@ -3064,9 +3064,9 @@ var Document = class _Document {
3064
3064
  this.contents.add(value);
3065
3065
  }
3066
3066
  /** Adds a value to the document. */
3067
- addIn(path10, value) {
3067
+ addIn(path11, value) {
3068
3068
  if (assertCollection(this.contents))
3069
- this.contents.addIn(path10, value);
3069
+ this.contents.addIn(path11, value);
3070
3070
  }
3071
3071
  /**
3072
3072
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3141,14 +3141,14 @@ var Document = class _Document {
3141
3141
  * Removes a value from the document.
3142
3142
  * @returns `true` if the item was found and removed.
3143
3143
  */
3144
- deleteIn(path10) {
3145
- if (isEmptyPath(path10)) {
3144
+ deleteIn(path11) {
3145
+ if (isEmptyPath(path11)) {
3146
3146
  if (this.contents == null)
3147
3147
  return false;
3148
3148
  this.contents = null;
3149
3149
  return true;
3150
3150
  }
3151
- return assertCollection(this.contents) ? this.contents.deleteIn(path10) : false;
3151
+ return assertCollection(this.contents) ? this.contents.deleteIn(path11) : false;
3152
3152
  }
3153
3153
  /**
3154
3154
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3163,10 +3163,10 @@ var Document = class _Document {
3163
3163
  * scalar values from their surrounding node; to disable set `keepScalar` to
3164
3164
  * `true` (collections are always returned intact).
3165
3165
  */
3166
- getIn(path10, keepScalar) {
3167
- if (isEmptyPath(path10))
3166
+ getIn(path11, keepScalar) {
3167
+ if (isEmptyPath(path11))
3168
3168
  return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
3169
- return isCollection(this.contents) ? this.contents.getIn(path10, keepScalar) : void 0;
3169
+ return isCollection(this.contents) ? this.contents.getIn(path11, keepScalar) : void 0;
3170
3170
  }
3171
3171
  /**
3172
3172
  * Checks if the document includes a value with the key `key`.
@@ -3177,10 +3177,10 @@ var Document = class _Document {
3177
3177
  /**
3178
3178
  * Checks if the document includes a value at `path`.
3179
3179
  */
3180
- hasIn(path10) {
3181
- if (isEmptyPath(path10))
3180
+ hasIn(path11) {
3181
+ if (isEmptyPath(path11))
3182
3182
  return this.contents !== void 0;
3183
- return isCollection(this.contents) ? this.contents.hasIn(path10) : false;
3183
+ return isCollection(this.contents) ? this.contents.hasIn(path11) : false;
3184
3184
  }
3185
3185
  /**
3186
3186
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3197,13 +3197,13 @@ var Document = class _Document {
3197
3197
  * Sets a value in this document. For `!!set`, `value` needs to be a
3198
3198
  * boolean to add/remove the item from the set.
3199
3199
  */
3200
- setIn(path10, value) {
3201
- if (isEmptyPath(path10)) {
3200
+ setIn(path11, value) {
3201
+ if (isEmptyPath(path11)) {
3202
3202
  this.contents = value;
3203
3203
  } else if (this.contents == null) {
3204
- this.contents = collectionFromPath(this.schema, Array.from(path10), value);
3204
+ this.contents = collectionFromPath(this.schema, Array.from(path11), value);
3205
3205
  } else if (assertCollection(this.contents)) {
3206
- this.contents.setIn(path10, value);
3206
+ this.contents.setIn(path11, value);
3207
3207
  }
3208
3208
  }
3209
3209
  /**
@@ -4999,9 +4999,9 @@ function visit2(cst, visitor) {
4999
4999
  visit2.BREAK = BREAK2;
5000
5000
  visit2.SKIP = SKIP2;
5001
5001
  visit2.REMOVE = REMOVE2;
5002
- visit2.itemAtPath = (cst, path10) => {
5002
+ visit2.itemAtPath = (cst, path11) => {
5003
5003
  let item = cst;
5004
- for (const [field, index] of path10) {
5004
+ for (const [field, index] of path11) {
5005
5005
  const tok = item?.[field];
5006
5006
  if (tok && "items" in tok) {
5007
5007
  item = tok.items[index];
@@ -5010,23 +5010,23 @@ visit2.itemAtPath = (cst, path10) => {
5010
5010
  }
5011
5011
  return item;
5012
5012
  };
5013
- visit2.parentCollection = (cst, path10) => {
5014
- const parent = visit2.itemAtPath(cst, path10.slice(0, -1));
5015
- const field = path10[path10.length - 1][0];
5013
+ visit2.parentCollection = (cst, path11) => {
5014
+ const parent = visit2.itemAtPath(cst, path11.slice(0, -1));
5015
+ const field = path11[path11.length - 1][0];
5016
5016
  const coll = parent?.[field];
5017
5017
  if (coll && "items" in coll)
5018
5018
  return coll;
5019
5019
  throw new Error("Parent collection not found");
5020
5020
  };
5021
- function _visit(path10, item, visitor) {
5022
- let ctrl = visitor(item, path10);
5021
+ function _visit(path11, item, visitor) {
5022
+ let ctrl = visitor(item, path11);
5023
5023
  if (typeof ctrl === "symbol")
5024
5024
  return ctrl;
5025
5025
  for (const field of ["key", "value"]) {
5026
5026
  const token = item[field];
5027
5027
  if (token && "items" in token) {
5028
5028
  for (let i = 0; i < token.items.length; ++i) {
5029
- const ci = _visit(Object.freeze(path10.concat([[field, i]])), token.items[i], visitor);
5029
+ const ci = _visit(Object.freeze(path11.concat([[field, i]])), token.items[i], visitor);
5030
5030
  if (typeof ci === "number")
5031
5031
  i = ci - 1;
5032
5032
  else if (ci === BREAK2)
@@ -5037,10 +5037,10 @@ function _visit(path10, item, visitor) {
5037
5037
  }
5038
5038
  }
5039
5039
  if (typeof ctrl === "function" && field === "key")
5040
- ctrl = ctrl(item, path10);
5040
+ ctrl = ctrl(item, path11);
5041
5041
  }
5042
5042
  }
5043
- return typeof ctrl === "function" ? ctrl(item, path10) : ctrl;
5043
+ return typeof ctrl === "function" ? ctrl(item, path11) : ctrl;
5044
5044
  }
5045
5045
 
5046
5046
  // ../../node_modules/yaml/browser/dist/parse/cst.js
@@ -7410,9 +7410,9 @@ var EXCERPT = /^(\s*)(\d+)( \| )(.*)$/;
7410
7410
  var MARKER = /^(\s*)( \| )(.*)$/;
7411
7411
  function designTimeDiagnostic(output, files) {
7412
7412
  const rewritten = /* @__PURE__ */ new Map();
7413
- const linesOf = (path10) => {
7413
+ const linesOf = (path11) => {
7414
7414
  const file = Object.keys(files).find(
7415
- (name2) => name2.endsWith(".swift") && (path10 === name2 || path10.endsWith(`/${name2}`))
7415
+ (name2) => name2.endsWith(".swift") && (path11 === name2 || path11.endsWith(`/${name2}`))
7416
7416
  );
7417
7417
  if (file === void 0) return null;
7418
7418
  let lines = rewritten.get(file);
@@ -7523,20 +7523,20 @@ function swiftSdkOptions() {
7523
7523
  }
7524
7524
  return [];
7525
7525
  }
7526
- var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-0d775d32d7c74eae";
7527
- var SWIFT_HOST_COMPILER_ID = "0d775d32d7c74eae";
7526
+ var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-8be2e4a7a393b003";
7527
+ var SWIFT_HOST_COMPILER_ID = "8be2e4a7a393b003";
7528
7528
  var compilerArchives = {
7529
7529
  "darwin-arm64": {
7530
- checksum: "957e85486f92327ee5cf8d3c5bb9336d17ab80145c87645c637c49130a50477a",
7531
- manifest: "c63e2f81694e8d8ad046d10c71d0638dbae4e5a36601294ed670988d1cb5b6f1"
7530
+ checksum: "88d69b7ac912962adaadce9fdb2c57fe07cd19e4d8158088e0acbd247496ca6d",
7531
+ manifest: "70d5e2be8c959eb5dd1d9b576e6c209e1f58bfb9089f90c38c2d7e087759f0b3"
7532
7532
  },
7533
7533
  "linux-x64": {
7534
- checksum: "6302230fb126b79c9af5fc2bc0208a936bb573c343da7ae949c5c1687e761cd2",
7535
- manifest: "31b507a6a8648a2266a187b9fed092e29a63cae99d57c5defdf2e82a7cbbc113"
7534
+ checksum: "7c42ded03742d16816e64f8ae8fca478aaaff450d22ab3d698daf78c010854b2",
7535
+ manifest: "90cfb09c5a0ba8c119066787cf47244a45bf3cda68dce94c6b1a16337b9b91bd"
7536
7536
  },
7537
7537
  "linux-arm64": {
7538
- checksum: "9b40d39ea5ba82fd9a417868f0a449f5e98e37cf83acaac9cedd3a8b8d91a218",
7539
- manifest: "fe07a29d4f4374cad47b29de70e90aa2e3b7664e08c8b53d304585e65637da24"
7538
+ checksum: "f9f1d96fb1a6325d3bb30ab12a75fc06e4e8535aab58a91581e03f3d91f68fa6",
7539
+ manifest: "f988181dce795f6c8a6d4a8d86f7b61768f23a743b4e7bea76e64862ef328ad6"
7540
7540
  }
7541
7541
  };
7542
7542
  function swiftHostCompilerArchive(release, host2 = `${process.platform}-${process.arch}`) {
@@ -9116,11 +9116,66 @@ for (const [file, text3] of tree) {
9116
9116
  }
9117
9117
 
9118
9118
  // src/swift-objc-standin.ts
9119
- var import_node_child_process5 = require("node:child_process");
9119
+ var import_node_child_process6 = require("node:child_process");
9120
9120
  var import_node_crypto5 = require("node:crypto");
9121
9121
  var import_node_fs5 = __toESM(require("node:fs"), 1);
9122
+ var import_node_path8 = __toESM(require("node:path"), 1);
9123
+
9124
+ // src/swift-objc-platform.ts
9125
+ var import_node_child_process5 = require("node:child_process");
9122
9126
  var import_node_path7 = __toESM(require("node:path"), 1);
9127
+ var platforms = /* @__PURE__ */ new Map();
9128
+ function swiftObjCPlatformFlags(toolchainBin, minimum) {
9129
+ const key = `${toolchainBin}:${minimum}`;
9130
+ const cached = platforms.get(key);
9131
+ if (cached) return cached;
9132
+ const version = [
9133
+ Math.floor(minimum / 1e4),
9134
+ Math.floor(minimum % 1e4 / 100),
9135
+ minimum % 100
9136
+ ].join(".");
9137
+ const result = (0, import_node_child_process5.spawnSync)(
9138
+ import_node_path7.default.join(toolchainBin, "clang"),
9139
+ [
9140
+ "-target",
9141
+ `arm64-apple-ios${version}-simulator`,
9142
+ "-dM",
9143
+ "-E",
9144
+ "-x",
9145
+ "objective-c",
9146
+ "-"
9147
+ ],
9148
+ {
9149
+ input: "",
9150
+ encoding: "utf8",
9151
+ env: swiftEnvironment(),
9152
+ timeout: 3e4,
9153
+ maxBuffer: 1024 * 1024
9154
+ }
9155
+ );
9156
+ if (result.error || result.status !== 0)
9157
+ throw new Error(
9158
+ `could not read iOS compiler platform predefines: ${result.error?.message ?? result.stderr}`
9159
+ );
9160
+ const flags = [
9161
+ ...result.stdout.matchAll(
9162
+ /^#define (TARGET_OS_\w+|TARGET_IPHONE_SIMULATOR|__APPLE\w*__|__MACH__|__ENVIRONMENT_\w+) (.*)$/gm
9163
+ )
9164
+ ].map(([, name2, value]) => `-D${name2}=${value}`);
9165
+ if (!flags.includes("-D__APPLE__=1") || !flags.includes("-D__MACH__=1"))
9166
+ throw new Error("iOS compiler platform predefines lack Apple and Mach identity");
9167
+ platforms.set(key, flags);
9168
+ return flags;
9169
+ }
9170
+
9171
+ // src/swift-objc-standin.ts
9123
9172
  var NATIVE_GRAPH_SDK_VERSION = "27.1";
9173
+ var WASI_EMULATION = [
9174
+ "_WASI_EMULATED_SIGNAL",
9175
+ "_WASI_EMULATED_MMAN",
9176
+ "_WASI_EMULATED_PROCESS_CLOCKS"
9177
+ ];
9178
+ var WASI_EMULATION_FLAGS = WASI_EMULATION.map((name2) => `-D${name2}`);
9124
9179
  var NATIVE_GRAPH_INPUTS = {
9125
9180
  sdk: NATIVE_GRAPH_SDK_VERSION,
9126
9181
  settings: "e68503e5e534e9194af5efe8c636ca8b824e2d8237c5f38ec84aa4d155bc8418",
@@ -9145,13 +9200,13 @@ ${text3}`
9145
9200
  }
9146
9201
  var IOS_SDK_ID = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify(iosSdkEntries())).digest("hex").slice(0, 16);
9147
9202
  function materializeObjcSdk(cacheDir2) {
9148
- const sdk = import_node_path7.default.join(cacheDir2, "ios-sdk", IOS_SDK_ID);
9203
+ const sdk = import_node_path8.default.join(cacheDir2, "ios-sdk", IOS_SDK_ID);
9149
9204
  if (import_node_fs5.default.existsSync(sdk)) return sdk;
9150
- import_node_fs5.default.mkdirSync(import_node_path7.default.dirname(sdk), { recursive: true });
9205
+ import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(sdk), { recursive: true });
9151
9206
  const staging = import_node_fs5.default.mkdtempSync(`${sdk}-`);
9152
9207
  for (const [file, text3] of iosSdkEntries()) {
9153
- import_node_fs5.default.mkdirSync(import_node_path7.default.dirname(import_node_path7.default.join(staging, file)), { recursive: true });
9154
- import_node_fs5.default.writeFileSync(import_node_path7.default.join(staging, file), text3);
9208
+ import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(import_node_path8.default.join(staging, file)), { recursive: true });
9209
+ import_node_fs5.default.writeFileSync(import_node_path8.default.join(staging, file), text3);
9155
9210
  }
9156
9211
  try {
9157
9212
  import_node_fs5.default.renameSync(staging, sdk);
@@ -9161,6 +9216,33 @@ function materializeObjcSdk(cacheDir2) {
9161
9216
  }
9162
9217
  return sdk;
9163
9218
  }
9219
+ function objcSdkIntakeFlags(headers, toolchainBin, minimum) {
9220
+ return [
9221
+ ...swiftObjCPlatformFlags(toolchainBin, minimum),
9222
+ // AvailabilityInternal.h derives this through __is_target_os(ios), which
9223
+ // is false for wasm32.
9224
+ `-D__IPHONE_OS_VERSION_MIN_REQUIRED=${minimum}`,
9225
+ // apple's build setting for a 32-bit target to keep NSInteger and
9226
+ // NSUInteger long, the nominal types they have on arm64.
9227
+ "-DNS_BUILD_32_LIKE_64=1",
9228
+ // the installed libc's default feature set otherwise defines
9229
+ // _XOPEN_SOURCE, which darwin's sys/cdefs.h turns into a strict posix
9230
+ // level; iOS compiles at darwin's full level with neither defined.
9231
+ "-D_BSD_SOURCE",
9232
+ ...WASI_EMULATION_FLAGS,
9233
+ "-iframework",
9234
+ import_node_path8.default.join(headers, "System/Library/Frameworks"),
9235
+ "-isystem",
9236
+ import_node_path8.default.join(headers, "wasm/include"),
9237
+ "-idirafter",
9238
+ import_node_path8.default.join(headers, "usr/include")
9239
+ ];
9240
+ }
9241
+ function iosDeploymentMinimum(version) {
9242
+ const parts = /^(\d{1,2})(?:\.(\d{1,2}))?(?:\.(\d{1,2}))?$/.exec(version ?? "");
9243
+ if (!parts) return void 0;
9244
+ return Number(parts[1]) * 1e4 + Number(parts[2] ?? 0) * 100 + Number(parts[3] ?? 0);
9245
+ }
9164
9246
  var headerFiles = (dir) => import_node_fs5.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => file.endsWith(".h")).sort();
9165
9247
  function missingHeader(missing) {
9166
9248
  const lines = ["#import <Foundation/Foundation.h>", "#import <UIKit/UIKit.h>"];
@@ -9183,52 +9265,52 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
9183
9265
  `this peach's Swift has no iOS simulator standard library at ${stdlib}`
9184
9266
  );
9185
9267
  const sdk = materializeObjcSdk(cacheDir2);
9186
- const framework = import_node_path7.default.basename(import_node_path7.default.dirname(surface.modulemap)) === "Modules";
9187
- const frameworks = import_node_path7.default.join(work, "frameworks");
9188
- const include = import_node_path7.default.join(work, "include");
9189
- const headersDir = framework ? import_node_path7.default.join(frameworks, `${surface.module}.framework`, "Headers") : import_node_path7.default.join(include, surface.module);
9268
+ const framework = import_node_path8.default.basename(import_node_path8.default.dirname(surface.modulemap)) === "Modules";
9269
+ const frameworks = import_node_path8.default.join(work, "frameworks");
9270
+ const include = import_node_path8.default.join(work, "include");
9271
+ const headersDir = framework ? import_node_path8.default.join(frameworks, `${surface.module}.framework`, "Headers") : import_node_path8.default.join(include, surface.module);
9190
9272
  import_node_fs5.default.mkdirSync(headersDir, { recursive: true });
9191
9273
  const originals = new Map(
9192
9274
  headerFiles(surface.headers).map((file) => [
9193
- import_node_path7.default.join(headersDir, file),
9194
- import_node_fs5.default.readFileSync(import_node_path7.default.join(surface.headers, file), "utf8")
9275
+ import_node_path8.default.join(headersDir, file),
9276
+ import_node_fs5.default.readFileSync(import_node_path8.default.join(surface.headers, file), "utf8")
9195
9277
  ])
9196
9278
  );
9197
9279
  for (const [file, text3] of originals) {
9198
- import_node_fs5.default.mkdirSync(import_node_path7.default.dirname(file), { recursive: true });
9280
+ import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(file), { recursive: true });
9199
9281
  import_node_fs5.default.writeFileSync(file, text3);
9200
9282
  }
9201
9283
  if (framework) {
9202
- import_node_fs5.default.mkdirSync(import_node_path7.default.join(frameworks, `${surface.module}.framework`, "Modules"), {
9284
+ import_node_fs5.default.mkdirSync(import_node_path8.default.join(frameworks, `${surface.module}.framework`, "Modules"), {
9203
9285
  recursive: true
9204
9286
  });
9205
9287
  import_node_fs5.default.copyFileSync(
9206
9288
  surface.modulemap,
9207
- import_node_path7.default.join(frameworks, `${surface.module}.framework`, "Modules", "module.modulemap")
9289
+ import_node_path8.default.join(frameworks, `${surface.module}.framework`, "Modules", "module.modulemap")
9208
9290
  );
9209
9291
  } else {
9210
- import_node_fs5.default.copyFileSync(surface.modulemap, import_node_path7.default.join(headersDir, "module.modulemap"));
9292
+ import_node_fs5.default.copyFileSync(surface.modulemap, import_node_path8.default.join(headersDir, "module.modulemap"));
9211
9293
  }
9212
9294
  const dependencyOriginals = /* @__PURE__ */ new Map();
9213
9295
  for (const dependency of surface.dependencies ?? []) {
9214
- const dir = import_node_path7.default.join(include, dependency.module);
9296
+ const dir = import_node_path8.default.join(include, dependency.module);
9215
9297
  import_node_fs5.default.mkdirSync(dir, { recursive: true });
9216
9298
  for (const file of headerFiles(dependency.headers)) {
9217
- const destination = import_node_path7.default.join(dir, file);
9218
- const text3 = import_node_fs5.default.readFileSync(import_node_path7.default.join(dependency.headers, file), "utf8");
9299
+ const destination = import_node_path8.default.join(dir, file);
9300
+ const text3 = import_node_fs5.default.readFileSync(import_node_path8.default.join(dependency.headers, file), "utf8");
9219
9301
  dependencyOriginals.set(destination, text3);
9220
- import_node_fs5.default.mkdirSync(import_node_path7.default.dirname(destination), { recursive: true });
9302
+ import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(destination), { recursive: true });
9221
9303
  import_node_fs5.default.writeFileSync(destination, text3);
9222
9304
  }
9223
- const supplied = import_node_path7.default.join(dependency.headers, "module.modulemap");
9305
+ const supplied = import_node_path8.default.join(dependency.headers, "module.modulemap");
9224
9306
  import_node_fs5.default.writeFileSync(
9225
- import_node_path7.default.join(dir, "module.modulemap"),
9307
+ import_node_path8.default.join(dir, "module.modulemap"),
9226
9308
  import_node_fs5.default.existsSync(supplied) ? import_node_fs5.default.readFileSync(supplied, "utf8") : `module ${dependency.module} { umbrella "." export * }
9227
9309
  `
9228
9310
  );
9229
9311
  }
9230
- const stubs = import_node_path7.default.join(work, "stubs");
9231
- const stubIncludes = import_node_path7.default.join(work, "stub-include");
9312
+ const stubs = import_node_path8.default.join(work, "stubs");
9313
+ const stubIncludes = import_node_path8.default.join(work, "stub-include");
9232
9314
  import_node_fs5.default.mkdirSync(stubs, { recursive: true });
9233
9315
  import_node_fs5.default.mkdirSync(stubIncludes, { recursive: true });
9234
9316
  const search = [
@@ -9236,11 +9318,11 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
9236
9318
  sdk,
9237
9319
  // keep compiler support headers without importing host platform modules.
9238
9320
  "-resource-dir",
9239
- import_node_path7.default.join(sdk, "usr/lib/swift"),
9321
+ import_node_path8.default.join(sdk, "usr/lib/swift"),
9240
9322
  "-I",
9241
- import_node_path7.default.resolve(toolchainBin, "../lib/swift/clang/include"),
9323
+ import_node_path8.default.resolve(toolchainBin, "../lib/swift/clang/include"),
9242
9324
  "-I",
9243
- import_node_path7.default.resolve(toolchainBin, "../lib/swift/shims"),
9325
+ import_node_path8.default.resolve(toolchainBin, "../lib/swift/shims"),
9244
9326
  "-I",
9245
9327
  stdlib,
9246
9328
  "-F",
@@ -9251,7 +9333,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
9251
9333
  headersDir,
9252
9334
  ...(surface.dependencies ?? []).flatMap((dependency) => [
9253
9335
  "-I",
9254
- import_node_path7.default.join(include, dependency.module)
9336
+ import_node_path8.default.join(include, dependency.module)
9255
9337
  ]),
9256
9338
  "-F",
9257
9339
  stubs,
@@ -9260,7 +9342,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
9260
9342
  ];
9261
9343
  const missing = /* @__PURE__ */ new Map();
9262
9344
  const stubbed = /* @__PURE__ */ new Set();
9263
- const out = import_node_path7.default.join(work, "graphs");
9345
+ const out = import_node_path8.default.join(work, "graphs");
9264
9346
  const stub = (include2) => {
9265
9347
  if (stubbed.has(include2)) return false;
9266
9348
  stubbed.add(include2);
@@ -9272,22 +9354,22 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
9272
9354
  IOS_SDK_HEADERS,
9273
9355
  `System/Library/Frameworks/${name2}.framework/Headers/${name2}.h`
9274
9356
  )) {
9275
- const header2 = import_node_path7.default.join(stubIncludes, include2);
9276
- import_node_fs5.default.mkdirSync(import_node_path7.default.dirname(header2), { recursive: true });
9357
+ const header2 = import_node_path8.default.join(stubIncludes, include2);
9358
+ import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(header2), { recursive: true });
9277
9359
  import_node_fs5.default.writeFileSync(header2, `#import <${umbrella}>
9278
9360
  `);
9279
9361
  return true;
9280
9362
  }
9281
- const root = import_node_path7.default.join(stubs, `${name2}.framework`);
9282
- const header = import_node_path7.default.join(root, "Headers", include2.slice(slash + 1));
9283
- import_node_fs5.default.mkdirSync(import_node_path7.default.dirname(header), { recursive: true });
9363
+ const root = import_node_path8.default.join(stubs, `${name2}.framework`);
9364
+ const header = import_node_path8.default.join(root, "Headers", include2.slice(slash + 1));
9365
+ import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(header), { recursive: true });
9284
9366
  import_node_fs5.default.writeFileSync(
9285
9367
  header,
9286
9368
  "#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n"
9287
9369
  );
9288
- import_node_fs5.default.mkdirSync(import_node_path7.default.join(root, "Modules"), { recursive: true });
9370
+ import_node_fs5.default.mkdirSync(import_node_path8.default.join(root, "Modules"), { recursive: true });
9289
9371
  import_node_fs5.default.writeFileSync(
9290
- import_node_path7.default.join(root, "Modules", "module.modulemap"),
9372
+ import_node_path8.default.join(root, "Modules", "module.modulemap"),
9291
9373
  `framework module ${name2} {
9292
9374
  umbrella "Headers"
9293
9375
  export *
@@ -9296,19 +9378,19 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
9296
9378
  `
9297
9379
  );
9298
9380
  } else {
9299
- const header = import_node_path7.default.join(stubIncludes, include2);
9300
- import_node_fs5.default.mkdirSync(import_node_path7.default.dirname(header), { recursive: true });
9381
+ const header = import_node_path8.default.join(stubIncludes, include2);
9382
+ import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(header), { recursive: true });
9301
9383
  import_node_fs5.default.writeFileSync(header, "");
9302
9384
  }
9303
9385
  return true;
9304
9386
  };
9305
9387
  const declareMissing = () => {
9306
- const root = import_node_path7.default.join(stubs, "PeachMissing.framework");
9307
- import_node_fs5.default.mkdirSync(import_node_path7.default.join(root, "Headers"), { recursive: true });
9308
- import_node_fs5.default.mkdirSync(import_node_path7.default.join(root, "Modules"), { recursive: true });
9309
- import_node_fs5.default.writeFileSync(import_node_path7.default.join(root, "Headers", "PeachMissing.h"), missingHeader(missing));
9388
+ const root = import_node_path8.default.join(stubs, "PeachMissing.framework");
9389
+ import_node_fs5.default.mkdirSync(import_node_path8.default.join(root, "Headers"), { recursive: true });
9390
+ import_node_fs5.default.mkdirSync(import_node_path8.default.join(root, "Modules"), { recursive: true });
9391
+ import_node_fs5.default.writeFileSync(import_node_path8.default.join(root, "Headers", "PeachMissing.h"), missingHeader(missing));
9310
9392
  import_node_fs5.default.writeFileSync(
9311
- import_node_path7.default.join(root, "Modules", "module.modulemap"),
9393
+ import_node_path8.default.join(root, "Modules", "module.modulemap"),
9312
9394
  'framework module PeachMissing {\n umbrella header "PeachMissing.h"\n export *\n}\n'
9313
9395
  );
9314
9396
  for (const [file, text3] of [...originals, ...dependencyOriginals])
@@ -9325,8 +9407,8 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
9325
9407
  for (let round = 0; ; round++) {
9326
9408
  import_node_fs5.default.rmSync(out, { recursive: true, force: true });
9327
9409
  import_node_fs5.default.mkdirSync(out, { recursive: true });
9328
- const run2 = (0, import_node_child_process5.spawnSync)(
9329
- import_node_path7.default.join(toolchainBin, "swift-symbolgraph-extract"),
9410
+ const run2 = (0, import_node_child_process6.spawnSync)(
9411
+ import_node_path8.default.join(toolchainBin, "swift-symbolgraph-extract"),
9330
9412
  [
9331
9413
  "-module-name",
9332
9414
  surface.module,
@@ -9335,7 +9417,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
9335
9417
  ...search,
9336
9418
  ...original?.flags.flatMap((flag) => ["-Xcc", flag]) ?? [],
9337
9419
  "-module-cache-path",
9338
- import_node_path7.default.join(cacheDir2, "ios-module-cache"),
9420
+ import_node_path8.default.join(cacheDir2, "ios-module-cache"),
9339
9421
  "-minimum-access-level",
9340
9422
  // symbol graphs hide public underscored names at the public threshold.
9341
9423
  // original clang headers remain the declaration boundary.
@@ -9398,7 +9480,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
9398
9480
  );
9399
9481
  if (missing.size > 0) declareMissing();
9400
9482
  }
9401
- const graphs = import_node_fs5.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs5.default.readFileSync(import_node_path7.default.join(out, name2), "utf8")));
9483
+ const graphs = import_node_fs5.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs5.default.readFileSync(import_node_path8.default.join(out, name2), "utf8")));
9402
9484
  const imports = /* @__PURE__ */ new Set(["Foundation", "UIKit"]);
9403
9485
  for (const text3 of originals.values())
9404
9486
  for (const match of text3.matchAll(
@@ -9427,7 +9509,7 @@ function objcDeclarationAST(surface, framework, toolchainBin, search, work, orig
9427
9509
  const roots = [
9428
9510
  ...import_node_fs5.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
9429
9511
  ].map((match) => match[1]);
9430
- const probe = import_node_path7.default.join(work, "declarations.m");
9512
+ const probe = import_node_path8.default.join(work, "declarations.m");
9431
9513
  import_node_fs5.default.writeFileSync(
9432
9514
  probe,
9433
9515
  roots.map(
@@ -9457,8 +9539,8 @@ function objcDeclarationAST(surface, framework, toolchainBin, search, work, orig
9457
9539
  "-ast-dump-all=json"
9458
9540
  ];
9459
9541
  const dump = (filter) => {
9460
- const run2 = (0, import_node_child_process5.spawnSync)(
9461
- import_node_path7.default.join(toolchainBin, "clang"),
9542
+ const run2 = (0, import_node_child_process6.spawnSync)(
9543
+ import_node_path8.default.join(toolchainBin, "clang"),
9462
9544
  [
9463
9545
  ...args,
9464
9546
  ...filter ? ["-Xclang", "-ast-dump-filter", "-Xclang", filter] : [],
@@ -9522,7 +9604,7 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
9522
9604
  const roots = [
9523
9605
  ...import_node_fs5.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
9524
9606
  ].map((match) => match[1]);
9525
- const probe = import_node_path7.default.join(work, "values.m");
9607
+ const probe = import_node_path8.default.join(work, "values.m");
9526
9608
  import_node_fs5.default.writeFileSync(
9527
9609
  probe,
9528
9610
  roots.map(
@@ -9537,8 +9619,8 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
9537
9619
  if (flag === "-sdk") flags.push("-isysroot", dir);
9538
9620
  else flags.push(flag, dir);
9539
9621
  }
9540
- const run2 = (0, import_node_child_process5.spawnSync)(
9541
- import_node_path7.default.join(toolchainBin, "clang"),
9622
+ const run2 = (0, import_node_child_process6.spawnSync)(
9623
+ import_node_path8.default.join(toolchainBin, "clang"),
9542
9624
  [
9543
9625
  "-x",
9544
9626
  "objective-c",
@@ -9551,7 +9633,7 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
9551
9633
  original?.target ?? IOS_SDK_TARGET,
9552
9634
  ...flags,
9553
9635
  ...original?.flags ?? [],
9554
- `-fmodules-cache-path=${import_node_path7.default.join(work, "clang-modules")}`,
9636
+ `-fmodules-cache-path=${import_node_path8.default.join(work, "clang-modules")}`,
9555
9637
  "-Xclang",
9556
9638
  "-ast-dump=json",
9557
9639
  probe
@@ -9829,8 +9911,16 @@ function clangMacroSetting(macro) {
9829
9911
  const [name2, ...value] = macro.split("=");
9830
9912
  return value.length === 0 ? `.define(${JSON.stringify(name2)})` : `.define(${JSON.stringify(name2)}, to: ${JSON.stringify(value.join("="))})`;
9831
9913
  }
9832
- function settingDefines(call, tool) {
9833
- const defines = [];
9914
+ var swiftEscapes = {
9915
+ "\\": "\\",
9916
+ '"': '"',
9917
+ "'": "'",
9918
+ n: "\n",
9919
+ r: "\r",
9920
+ t: " "
9921
+ };
9922
+ function settingsBlocks(call, tool) {
9923
+ const bodies = [];
9834
9924
  for (const open of call.matchAll(new RegExp(`\\b${tool}Settings\\s*:\\s*\\[`, "g"))) {
9835
9925
  let depth = 1;
9836
9926
  let index = open.index + open[0].length;
@@ -9843,11 +9933,43 @@ function settingDefines(call, tool) {
9843
9933
  } else if (char === "[") depth++;
9844
9934
  else if (char === "]") depth--;
9845
9935
  }
9846
- const body = call.slice(start, index - 1);
9936
+ bodies.push(call.slice(start, index - 1));
9937
+ }
9938
+ return bodies;
9939
+ }
9940
+ function settingFeatures(call, setting) {
9941
+ const found = [];
9942
+ for (const body of settingsBlocks(call, "swift")) {
9943
+ if (setting === ".unsafeFlags") {
9944
+ for (const list of body.matchAll(/\.unsafeFlags\(\s*\[([^\]]*)\]/g))
9945
+ for (const match of list[1].matchAll(/"((?:[^"\\]|\\.)*)"/g))
9946
+ found.push(JSON.parse(`"${match[1]}"`));
9947
+ } else {
9948
+ const name2 = "([A-Za-z_][A-Za-z0-9_]*(?:=[A-Za-z_][A-Za-z0-9_.-]*)?)";
9949
+ const pattern = setting === ".enableExperimentalFeature" ? new RegExp(`\\.enableExperimentalFeature\\(\\s*"${name2}"\\s*\\)`, "g") : new RegExp(`\\.enableUpcomingFeature\\(\\s*"${name2}"\\s*\\)`, "g");
9950
+ for (const match of body.matchAll(pattern)) found.push(match[1]);
9951
+ }
9952
+ }
9953
+ return found;
9954
+ }
9955
+ function settingDefines(call, tool) {
9956
+ const defines = [];
9957
+ for (const body of settingsBlocks(call, tool)) {
9847
9958
  for (const match of body.matchAll(
9848
- /\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*(?:,\s*to:\s*"([^"]*)"\s*)?\)/g
9849
- ))
9850
- defines.push(match[2] === void 0 ? match[1] : `${match[1]}=${match[2]}`);
9959
+ /\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*(?:,\s*to:\s*"((?:[^"\\]|\\.)*)"\s*)?\)/g
9960
+ )) {
9961
+ const name2 = match[1];
9962
+ defines.push(
9963
+ match[2] === void 0 ? name2 : `${name2}=${match[2].replace(/\\(.)/g, (_, escape) => {
9964
+ const value = swiftEscapes[escape];
9965
+ if (value === void 0)
9966
+ throw new Error(
9967
+ `Unsupported escape \\${escape} in the value of macro ${name2}`
9968
+ );
9969
+ return value;
9970
+ })}`
9971
+ );
9972
+ }
9851
9973
  }
9852
9974
  return defines;
9853
9975
  }
@@ -9879,6 +10001,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
9879
10001
  call.replace(/"(?:\\.|[^"\\])*"/g, "")
9880
10002
  );
9881
10003
  const defines = settingDefines(call, "swift").map((define) => define.split("=")[0]);
10004
+ const experimentalFeatures = settingFeatures(call, ".enableExperimentalFeature");
10005
+ const upcomingFeatures = settingFeatures(call, ".enableUpcomingFeature");
10006
+ const swiftFlags = settingFeatures(call, ".unsafeFlags");
9882
10007
  const cDefines = settingDefines(call, "c");
9883
10008
  const cxxDefines = settingDefines(call, "cxx");
9884
10009
  const linkedLibraries = [...call.matchAll(/\.linkedLibrary\(\s*"([^"]+)"\s*\)/g)].map(
@@ -9923,6 +10048,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
9923
10048
  mainActorIsolation,
9924
10049
  ...cxxInterop ? { cxxInterop: true } : {},
9925
10050
  ...defines.length === 0 ? {} : { defines },
10051
+ ...experimentalFeatures.length === 0 ? {} : { experimentalFeatures },
10052
+ ...upcomingFeatures.length === 0 ? {} : { upcomingFeatures },
10053
+ ...swiftFlags.length === 0 ? {} : { swiftFlags },
9926
10054
  ...cDefines.length === 0 ? {} : { cDefines },
9927
10055
  ...cxxDefines.length === 0 ? {} : { cxxDefines },
9928
10056
  ...linkedLibraries.length === 0 ? {} : { linkedLibraries },
@@ -10010,14 +10138,14 @@ function swiftObjCResourceAccessor(bundleName) {
10010
10138
  }
10011
10139
  function swiftPackagePartition(manifest, resourcePaths = []) {
10012
10140
  const targets = swiftManifestTargets(manifest, resourcePaths);
10013
- return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].linkedLibraries?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
10141
+ return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].experimentalFeatures?.length && !targets[0].upcomingFeatures?.length && !targets[0].swiftFlags?.length && !targets[0].linkedLibraries?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
10014
10142
  }
10015
10143
 
10016
10144
  // src/swift-root-lock.ts
10017
- var import_node_child_process6 = require("node:child_process");
10145
+ var import_node_child_process7 = require("node:child_process");
10018
10146
  var import_node_crypto6 = require("node:crypto");
10019
10147
  var import_node_fs6 = require("node:fs");
10020
- var import_node_path8 = __toESM(require("node:path"), 1);
10148
+ var import_node_path9 = __toESM(require("node:path"), 1);
10021
10149
  var POLL_MS = 250;
10022
10150
  var START_TOLERANCE_MS = 2e3;
10023
10151
  function errorCode(error) {
@@ -10029,7 +10157,7 @@ function parseStart(text3) {
10029
10157
  return start;
10030
10158
  }
10031
10159
  function processTable() {
10032
- const result = (0, import_node_child_process6.spawnSync)("ps", ["-A", "-o", "pid=,pgid=,stat=,lstart="], {
10160
+ const result = (0, import_node_child_process7.spawnSync)("ps", ["-A", "-o", "pid=,pgid=,stat=,lstart="], {
10033
10161
  encoding: "utf8",
10034
10162
  env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
10035
10163
  stdio: ["ignore", "pipe", "pipe"],
@@ -10092,7 +10220,7 @@ function generationNumbers(directory) {
10092
10220
  function readGeneration(directory, number) {
10093
10221
  let owner;
10094
10222
  try {
10095
- owner = (0, import_node_fs6.readFileSync)(import_node_path8.default.join(directory, name(number, "owner")), "utf8");
10223
+ owner = (0, import_node_fs6.readFileSync)(import_node_path9.default.join(directory, name(number, "owner")), "utf8");
10096
10224
  } catch (error) {
10097
10225
  if (errorCode(error) === "ENOENT") return null;
10098
10226
  throw error;
@@ -10105,7 +10233,7 @@ function readGeneration(directory, number) {
10105
10233
  }
10106
10234
  function readChildren(directory, number) {
10107
10235
  const prefix = name(number, "child.");
10108
- return (0, import_node_fs6.readdirSync)(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity((0, import_node_fs6.readFileSync)(import_node_path8.default.join(directory, entry), "utf8")));
10236
+ return (0, import_node_fs6.readdirSync)(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity((0, import_node_fs6.readFileSync)(import_node_path9.default.join(directory, entry), "utf8")));
10109
10237
  }
10110
10238
  function groupAlive(table, leader) {
10111
10239
  const row = table.find((candidate) => candidate.pid === leader.pid);
@@ -10113,7 +10241,7 @@ function groupAlive(table, leader) {
10113
10241
  return table.some((candidate) => candidate.pgid === leader.pid && !candidate.zombie);
10114
10242
  }
10115
10243
  async function withSwiftRootLock(root, work, signal) {
10116
- const directory = import_node_path8.default.join(
10244
+ const directory = import_node_path9.default.join(
10117
10245
  rnxHomeDir(),
10118
10246
  "cache",
10119
10247
  "swift-root-locks",
@@ -10122,7 +10250,7 @@ async function withSwiftRootLock(root, work, signal) {
10122
10250
  (0, import_node_fs6.mkdirSync)(directory, { recursive: true });
10123
10251
  const token = (0, import_node_crypto6.randomUUID)();
10124
10252
  const owner = JSON.stringify(ownIdentity(process.pid));
10125
- const pending = import_node_path8.default.join(directory, `pending.${token}`);
10253
+ const pending = import_node_path9.default.join(directory, `pending.${token}`);
10126
10254
  let held = 0;
10127
10255
  for (; ; ) {
10128
10256
  signal?.throwIfAborted();
@@ -10143,7 +10271,7 @@ async function withSwiftRootLock(root, work, signal) {
10143
10271
  }
10144
10272
  (0, import_node_fs6.writeFileSync)(pending, owner);
10145
10273
  try {
10146
- (0, import_node_fs6.linkSync)(pending, import_node_path8.default.join(directory, name(newest + 1, "owner")));
10274
+ (0, import_node_fs6.linkSync)(pending, import_node_path9.default.join(directory, name(newest + 1, "owner")));
10147
10275
  } catch (error) {
10148
10276
  if (errorCode(error) === "EEXIST") continue;
10149
10277
  throw error;
@@ -10152,7 +10280,7 @@ async function withSwiftRootLock(root, work, signal) {
10152
10280
  }
10153
10281
  const numbers = generationNumbers(directory);
10154
10282
  if (numbers.at(-1) !== newest + 1) {
10155
- (0, import_node_fs6.rmSync)(import_node_path8.default.join(directory, name(newest + 1, "owner")), { force: true });
10283
+ (0, import_node_fs6.rmSync)(import_node_path9.default.join(directory, name(newest + 1, "owner")), { force: true });
10156
10284
  continue;
10157
10285
  }
10158
10286
  held = newest + 1;
@@ -10160,14 +10288,14 @@ async function withSwiftRootLock(root, work, signal) {
10160
10288
  if (number < held) {
10161
10289
  for (const entry of (0, import_node_fs6.readdirSync)(directory))
10162
10290
  if (entry.startsWith(name(number, "")))
10163
- (0, import_node_fs6.rmSync)(import_node_path8.default.join(directory, entry), { force: true });
10291
+ (0, import_node_fs6.rmSync)(import_node_path9.default.join(directory, entry), { force: true });
10164
10292
  }
10165
10293
  break;
10166
10294
  }
10167
10295
  const children = [];
10168
10296
  const lease = {
10169
10297
  spawn(command, args, options) {
10170
- const child = (0, import_node_child_process6.spawn)(
10298
+ const child = (0, import_node_child_process7.spawn)(
10171
10299
  "/bin/sh",
10172
10300
  ["-c", 'IFS= read -r go || exit 1; exec "$@" </dev/null', "sh", command, ...args],
10173
10301
  { ...options, detached: true, stdio: ["pipe", "pipe", "pipe"] }
@@ -10184,7 +10312,7 @@ async function withSwiftRootLock(root, work, signal) {
10184
10312
  const childPending = `${pending}.child.${child.pid}`;
10185
10313
  try {
10186
10314
  (0, import_node_fs6.writeFileSync)(childPending, JSON.stringify(ownIdentity(child.pid)));
10187
- (0, import_node_fs6.linkSync)(childPending, import_node_path8.default.join(directory, name(held, `child.${child.pid}`)));
10315
+ (0, import_node_fs6.linkSync)(childPending, import_node_path9.default.join(directory, name(held, `child.${child.pid}`)));
10188
10316
  } finally {
10189
10317
  (0, import_node_fs6.rmSync)(childPending, { force: true });
10190
10318
  }
@@ -10200,7 +10328,7 @@ async function withSwiftRootLock(root, work, signal) {
10200
10328
  return await work(lease);
10201
10329
  } finally {
10202
10330
  await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
10203
- (0, import_node_fs6.writeFileSync)(import_node_path8.default.join(directory, name(held, "released")), "");
10331
+ (0, import_node_fs6.writeFileSync)(import_node_path9.default.join(directory, name(held, "released")), "");
10204
10332
  }
10205
10333
  }
10206
10334
 
@@ -10256,7 +10384,7 @@ function isSwiftResourceBundles(value) {
10256
10384
 
10257
10385
  // src/xcode-header-search.ts
10258
10386
  var import_node_fs7 = __toESM(require("node:fs"), 1);
10259
- var import_node_path9 = __toESM(require("node:path"), 1);
10387
+ var import_node_path10 = __toESM(require("node:path"), 1);
10260
10388
  function headerMap(entries) {
10261
10389
  const unique = /* @__PURE__ */ new Map();
10262
10390
  for (const entry of entries)
@@ -10303,11 +10431,11 @@ function writeXcodeHeaderSearch(directory, targets) {
10303
10431
  const productDirectories = /* @__PURE__ */ new Map();
10304
10432
  for (const target of targets)
10305
10433
  for (const [product, file] of Object.entries(target.productHeaders)) {
10306
- const listed = productDirectories.get(import_node_path9.default.dirname(product)) ?? [];
10307
- productDirectories.set(import_node_path9.default.dirname(product), listed);
10308
- listed.push({ name: import_node_path9.default.basename(product), file });
10434
+ const listed = productDirectories.get(import_node_path10.default.dirname(product)) ?? [];
10435
+ productDirectories.set(import_node_path10.default.dirname(product), listed);
10436
+ listed.push({ name: import_node_path10.default.basename(product), file });
10309
10437
  }
10310
- const overlay = import_node_path9.default.join(directory, "all-product-headers.yaml");
10438
+ const overlay = import_node_path10.default.join(directory, "all-product-headers.yaml");
10311
10439
  import_node_fs7.default.writeFileSync(
10312
10440
  overlay,
10313
10441
  JSON.stringify({
@@ -10327,7 +10455,7 @@ function writeXcodeHeaderSearch(directory, targets) {
10327
10455
  const files = [overlay];
10328
10456
  const flags = targets.map((target, index) => {
10329
10457
  const maps = target.headerMaps.map((map2, order) => {
10330
- const file = import_node_path9.default.join(directory, `${index}-${order}.hmap`);
10458
+ const file = import_node_path10.default.join(directory, `${index}-${order}.hmap`);
10331
10459
  import_node_fs7.default.writeFileSync(file, headerMap(map2.entries));
10332
10460
  files.push(file);
10333
10461
  return { flag: map2.flag, file };
@@ -10353,7 +10481,7 @@ async function runCompiler(command, args, options, stream = false, quiet) {
10353
10481
  detached: true,
10354
10482
  stdio: ["ignore", "pipe", "pipe"]
10355
10483
  };
10356
- const child = options.lease ? options.lease.spawn(command, args, launch) : (0, import_node_child_process7.spawn)(command, args, launch);
10484
+ const child = options.lease ? options.lease.spawn(command, args, launch) : (0, import_node_child_process8.spawn)(command, args, launch);
10357
10485
  let stopping;
10358
10486
  try {
10359
10487
  return await new Promise((resolve, reject) => {
@@ -10444,7 +10572,7 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
10444
10572
  return (compileTimeoutMs ?? SWIFT_BUILDER_DEFAULT_COMPILE_MS) + SWIFT_BUILDER_TRANSPORT_MARGIN_MS;
10445
10573
  }
10446
10574
  function swiftDistributionAt(root) {
10447
- const file = import_node_path10.default.join(root, SWIFT_DISTRIBUTION_MANIFEST);
10575
+ const file = import_node_path11.default.join(root, SWIFT_DISTRIBUTION_MANIFEST);
10448
10576
  if (!(0, import_node_fs8.existsSync)(file)) return null;
10449
10577
  return parseSwiftDistributionManifest(JSON.parse((0, import_node_fs8.readFileSync)(file, "utf8")));
10450
10578
  }
@@ -10473,7 +10601,7 @@ function swiftModuleInputFiles(root) {
10473
10601
  "toolchain.json"
10474
10602
  ];
10475
10603
  const walk = (dir) => {
10476
- for (const entry of (0, import_node_fs8.readdirSync)(import_node_path10.default.join(root, dir), {
10604
+ for (const entry of (0, import_node_fs8.readdirSync)(import_node_path11.default.join(root, dir), {
10477
10605
  withFileTypes: true
10478
10606
  })) {
10479
10607
  const relative = `${dir}/${entry.name}`;
@@ -10491,32 +10619,32 @@ function swiftMacroPlugins(moduleRoot) {
10491
10619
  const distribution = swiftDistributionAt(moduleRoot);
10492
10620
  if (distribution)
10493
10621
  return {
10494
- libraries: distribution.plugins.map((plugin) => import_node_path10.default.join(moduleRoot, plugin)),
10622
+ libraries: distribution.plugins.map((plugin) => import_node_path11.default.join(moduleRoot, plugin)),
10495
10623
  stale: false
10496
10624
  };
10497
- const dir = import_node_path10.default.join(moduleRoot, ".build/host/RnxPreviewMacros");
10625
+ const dir = import_node_path11.default.join(moduleRoot, ".build/host/RnxPreviewMacros");
10498
10626
  const release = JSON.parse(
10499
- (0, import_node_fs8.readFileSync)(import_node_path10.default.join(moduleRoot, "toolchain.json"), "utf8")
10627
+ (0, import_node_fs8.readFileSync)(import_node_path11.default.join(moduleRoot, "toolchain.json"), "utf8")
10500
10628
  ).release;
10501
- const compilerStamp = import_node_path10.default.join(dir, "compiler-release");
10629
+ const compilerStamp = import_node_path11.default.join(dir, "compiler-release");
10502
10630
  const ext = process.platform === "darwin" ? "dylib" : "so";
10503
10631
  const plugins = [
10504
10632
  {
10505
- library: import_node_path10.default.join(dir, `libRnxPreviewMacros.${ext}`),
10506
- sources: [import_node_path10.default.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")]
10633
+ library: import_node_path11.default.join(dir, `libRnxPreviewMacros.${ext}`),
10634
+ sources: [import_node_path11.default.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")]
10507
10635
  },
10508
10636
  {
10509
- library: import_node_path10.default.join(dir, `libFoundationMacros.${ext}`),
10637
+ library: import_node_path11.default.join(dir, `libFoundationMacros.${ext}`),
10510
10638
  sources: [
10511
- import_node_path10.default.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift"),
10512
- import_node_path10.default.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
10639
+ import_node_path11.default.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift"),
10640
+ import_node_path11.default.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
10513
10641
  ]
10514
10642
  },
10515
10643
  {
10516
- library: import_node_path10.default.join(dir, `libTipKitMacros.${ext}`),
10644
+ library: import_node_path11.default.join(dir, `libTipKitMacros.${ext}`),
10517
10645
  sources: [
10518
- import_node_path10.default.join(moduleRoot, "Sources/TipKitMacros/TipKitMacros.swift"),
10519
- import_node_path10.default.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
10646
+ import_node_path11.default.join(moduleRoot, "Sources/TipKitMacros/TipKitMacros.swift"),
10647
+ import_node_path11.default.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
10520
10648
  ]
10521
10649
  }
10522
10650
  ];
@@ -10533,14 +10661,14 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal) {
10533
10661
  await runCompiler(
10534
10662
  "sh",
10535
10663
  [
10536
- import_node_path10.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
10664
+ import_node_path11.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
10537
10665
  toolchainBin,
10538
10666
  libraries[0]
10539
10667
  ],
10540
10668
  { signal }
10541
10669
  );
10542
10670
  (0, import_node_fs8.writeFileSync)(
10543
- import_node_path10.default.join(import_node_path10.default.dirname(libraries[0]), "compiler-release"),
10671
+ import_node_path11.default.join(import_node_path11.default.dirname(libraries[0]), "compiler-release"),
10544
10672
  `${release}
10545
10673
  `
10546
10674
  );
@@ -10556,7 +10684,7 @@ function swiftModuleDigest(root) {
10556
10684
  const files = swiftModuleInputFiles(root);
10557
10685
  const stampHash = (0, import_node_crypto7.createHash)("sha256");
10558
10686
  for (const file of files) {
10559
- const stat = (0, import_node_fs8.statSync)(import_node_path10.default.join(root, file), { bigint: true });
10687
+ const stat = (0, import_node_fs8.statSync)(import_node_path11.default.join(root, file), { bigint: true });
10560
10688
  stampHash.update(file);
10561
10689
  stampHash.update(
10562
10690
  `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}
@@ -10570,7 +10698,7 @@ function swiftModuleDigest(root) {
10570
10698
  for (const file of files) {
10571
10699
  hash2.update((0, import_node_crypto7.createHash)("sha256").update(file).digest());
10572
10700
  hash2.update(
10573
- (0, import_node_crypto7.createHash)("sha256").update((0, import_node_fs8.readFileSync)(import_node_path10.default.join(root, file))).digest()
10701
+ (0, import_node_crypto7.createHash)("sha256").update((0, import_node_fs8.readFileSync)(import_node_path11.default.join(root, file))).digest()
10574
10702
  );
10575
10703
  }
10576
10704
  const digest = hash2.digest();
@@ -10594,7 +10722,7 @@ function withNativeSourceGlue(input, glue) {
10594
10722
  ...input,
10595
10723
  files: {
10596
10724
  ...input.files,
10597
- [import_node_path10.default.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
10725
+ [import_node_path11.default.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
10598
10726
  },
10599
10727
  oneModule: true
10600
10728
  };
@@ -10719,7 +10847,7 @@ function swiftImportNames(contents, available) {
10719
10847
  function swiftPeachModules(moduleRoot) {
10720
10848
  const distribution = swiftDistributionAt(moduleRoot);
10721
10849
  return distribution ? distribution.modules : [
10722
- ...(0, import_node_fs8.readFileSync)(import_node_path10.default.join(moduleRoot, "Package.swift"), "utf8").matchAll(
10850
+ ...(0, import_node_fs8.readFileSync)(import_node_path11.default.join(moduleRoot, "Package.swift"), "utf8").matchAll(
10723
10851
  /\.(?:target|systemLibrary)\(\s*name:\s*"([^"]+)"/g
10724
10852
  )
10725
10853
  ].map((match) => match[1]);
@@ -10730,8 +10858,8 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
10730
10858
  const key = JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]);
10731
10859
  const cached = sdkPaths.get(key);
10732
10860
  if (cached) return cached;
10733
- const configuration = (0, import_node_child_process7.execFileSync)(
10734
- import_node_path10.default.join(toolchainBin, "swift"),
10861
+ const configuration = (0, import_node_child_process8.execFileSync)(
10862
+ import_node_path11.default.join(toolchainBin, "swift"),
10735
10863
  [
10736
10864
  "sdk",
10737
10865
  "configure",
@@ -10762,12 +10890,12 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
10762
10890
  if (cached) return cached;
10763
10891
  const modules = new Set(swiftPeachModules(moduleRoot));
10764
10892
  const { resources } = swiftSdkPaths(moduleRoot, toolchainBin);
10765
- for (const entry of (0, import_node_fs8.readdirSync)(import_node_path10.default.join(resources, "wasi"))) {
10893
+ for (const entry of (0, import_node_fs8.readdirSync)(import_node_path11.default.join(resources, "wasi"))) {
10766
10894
  if (entry.endsWith(".swiftmodule"))
10767
10895
  modules.add(entry.slice(0, -".swiftmodule".length));
10768
10896
  }
10769
10897
  for (const entry of (0, import_node_fs8.readdirSync)(resources)) {
10770
- const map2 = import_node_path10.default.join(resources, entry, "module.modulemap");
10898
+ const map2 = import_node_path11.default.join(resources, entry, "module.modulemap");
10771
10899
  if (!(0, import_node_fs8.existsSync)(map2)) continue;
10772
10900
  for (const match of (0, import_node_fs8.readFileSync)(map2, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
10773
10901
  modules.add(match[1]);
@@ -10775,12 +10903,14 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
10775
10903
  availableModules.set(key, modules);
10776
10904
  return modules;
10777
10905
  }
10778
- function missingSwiftModules(files, available) {
10906
+ function missingSwiftModules(files, available, providedByFile = () => []) {
10779
10907
  const missing = /* @__PURE__ */ new Map();
10780
10908
  for (const [file, contents] of Object.entries(files)) {
10781
10909
  if (!file.endsWith(".swift") || file === "Package.swift") continue;
10782
- for (const name2 of new Set(swiftImportNames(contents, available))) {
10783
- if (available.has(name2)) continue;
10910
+ const extra = providedByFile(file);
10911
+ const scoped = extra.length === 0 ? available : /* @__PURE__ */ new Set([...available, ...extra]);
10912
+ for (const name2 of new Set(swiftImportNames(contents, scoped))) {
10913
+ if (scoped.has(name2)) continue;
10784
10914
  missing.set(name2, [...missing.get(name2) ?? [], file]);
10785
10915
  }
10786
10916
  }
@@ -10833,7 +10963,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
10833
10963
  `;
10834
10964
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
10835
10965
  var MULTI_MANIFEST_VERSION = 40;
10836
- var compilerSourceDigest = true ? "6ea8d8a06ae707693b5fbb43a21e9d705ee8a19779051d47b05c4bbaeb39fb6c" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
10966
+ var compilerSourceDigest = true ? "25e399c85c279ad057ea8e9dac685fe538c7bda43eb7708cf1a32edcb229391d" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
10837
10967
  function swiftArtifactHash(input, release, moduleRoot) {
10838
10968
  const hash2 = (0, import_node_crypto7.createHash)("sha256");
10839
10969
  hash2.update(`swift-compile
@@ -10929,11 +11059,11 @@ function emitSwiftPackageManifest(args) {
10929
11059
  distributionLink.files.set(
10930
11060
  distributionLink.path,
10931
11061
  objects.map(
10932
- (object) => `"${import_node_path10.default.join(moduleRoot, object).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`
11062
+ (object) => `"${import_node_path11.default.join(moduleRoot, object).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`
10933
11063
  ).join("\n") + "\n"
10934
11064
  );
10935
11065
  }
10936
- const overlayRoot = import_node_path10.default.join(
11066
+ const overlayRoot = import_node_path11.default.join(
10937
11067
  moduleRoot,
10938
11068
  distribution ? "modules" : "cross-import-overlays"
10939
11069
  );
@@ -10941,9 +11071,9 @@ function emitSwiftPackageManifest(args) {
10941
11071
  "-Xfrontend",
10942
11072
  "-swift-module-cross-import",
10943
11073
  "-Xfrontend",
10944
- import_node_path10.default.basename(import_node_path10.default.dirname(file), ".swiftcrossimport"),
11074
+ import_node_path11.default.basename(import_node_path11.default.dirname(file), ".swiftcrossimport"),
10945
11075
  "-Xfrontend",
10946
- import_node_path10.default.join(overlayRoot, file)
11076
+ import_node_path11.default.join(overlayRoot, file)
10947
11077
  ]).map((flag) => `, ${JSON.stringify(flag)}`).join("");
10948
11078
  const executable = targets.find((target) => target.executable);
10949
11079
  if (!executable) throw new Error("swift-compile: no executable target to emit");
@@ -10958,7 +11088,10 @@ function emitSwiftPackageManifest(args) {
10958
11088
  const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
10959
11089
  const exports2 = args.objcExports?.modules.has(target.name) || args.objcExports?.rootModule === target.name ? ' .enableExperimentalFeature("Extern"),' : "";
10960
11090
  const defines = (target.defines ?? []).map((name2) => ` .define(${JSON.stringify(name2)}),`).join("");
10961
- const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path10.default.join(moduleRoot, "modules"))}` : "";
11091
+ const features = (target.experimentalFeatures ?? []).map((name2) => ` .enableExperimentalFeature(${JSON.stringify(name2)}),`).join("");
11092
+ const upcoming = (target.upcomingFeatures ?? []).map((name2) => ` .enableUpcomingFeature(${JSON.stringify(name2)}),`).join("");
11093
+ const upstream = (target.swiftFlags ?? []).map((flag) => `, ${JSON.stringify(flag)}`).join("");
11094
+ const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path11.default.join(moduleRoot, "modules"))}` : "";
10962
11095
  const native = args.native?.get(target.name);
10963
11096
  const clang = native && !native.mixed;
10964
11097
  const nativeImports = (siblings.get(target.name) ?? []).filter((name2) => args.native?.has(name2) && !args.native.get(name2)?.mixed).map(
@@ -10978,8 +11111,8 @@ function emitSwiftPackageManifest(args) {
10978
11111
  const nativeImportFlags = [...importContext].flatMap((name2) => args.native?.get(name2)?.clang?.importFlags ?? []).map((flag) => `, "-Xcc", ${JSON.stringify(flag)}`).join("");
10979
11112
  const header = args.headerDirectory && [...args.native?.values() ?? []].some(
10980
11113
  (value) => value.late?.producers.includes(target.name)
10981
- ) ? `, "-emit-objc-header-path", ${JSON.stringify(import_node_path10.default.join(args.headerDirectory, `${target.name}-${args.objcExports?.modules.has(target.name) ? "Cxx" : "Swift"}.h`))}` : "";
10982
- const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${exports2} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${nativeImportFlags}${header}])]`;
11114
+ ) ? `, "-emit-objc-header-path", ${JSON.stringify(import_node_path11.default.join(args.headerDirectory, `${target.name}-${args.objcExports?.modules.has(target.name) ? "Cxx" : "Swift"}.h`))}` : "";
11115
+ const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming}${exports2} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${nativeImportFlags}${header}${upstream}])]`;
10983
11116
  const deps = [
10984
11117
  .../* @__PURE__ */ new Set([
10985
11118
  ...target.executable ? [
@@ -11030,11 +11163,11 @@ function emitSwiftPackageManifest(args) {
11030
11163
  const cDefines = macroSettings(target.cDefines);
11031
11164
  const cxxDefines = macroSettings(target.cxxDefines);
11032
11165
  const nativeSettings = native?.clang ? [
11033
- `cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.objcExports?.flags ?? args.nativeFlags ?? [], ...native.clang.flags])})]`,
11034
- `cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.objcExports?.flags ?? args.nativeFlags ?? [], ...native.clang.cxxFlags])})]`
11166
+ `cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(target.name) ?? [], ...native.clang.flags])})]`,
11167
+ `cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(target.name) ?? [], ...native.clang.cxxFlags])})]`
11035
11168
  ].join(", ") : [
11036
- `cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.objcExports?.flags ?? args.nativeFlags ?? [], ...native?.flags ?? []])})]`,
11037
- `cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.objcExports?.flags ?? args.nativeFlags ?? [], ...native?.cxxFlags ?? []])})]`
11169
+ `cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(target.name) ?? [], ...native?.flags ?? []])})]`,
11170
+ `cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(target.name) ?? [], ...native?.cxxFlags ?? []])})]`
11038
11171
  ].join(", ");
11039
11172
  return [
11040
11173
  ` ${kind}(`,
@@ -11043,8 +11176,8 @@ function emitSwiftPackageManifest(args) {
11043
11176
  ` path: ${JSON.stringify(native?.clang ? "." : target.path)},`,
11044
11177
  ...native ? [` exclude: ${JSON.stringify(native.exclude ?? native.lateSources)},`] : [],
11045
11178
  ...native?.clang ? [
11046
- ` sources: ${JSON.stringify(native.clang.sources.map((source) => import_node_path10.default.posix.join(native.path, source)))},`,
11047
- ` publicHeadersPath: ${JSON.stringify(import_node_path10.default.posix.dirname(native.clang.modulemap))},`
11179
+ ` sources: ${JSON.stringify(native.clang.sources.map((source) => import_node_path11.default.posix.join(native.path, source)))},`,
11180
+ ` publicHeadersPath: ${JSON.stringify(import_node_path11.default.posix.dirname(native.clang.modulemap))},`
11048
11181
  ] : native?.flags ? [` sources: ${JSON.stringify(native.sources)},`] : [],
11049
11182
  // the native backend supplies dependency module maps without their
11050
11183
  // compiled modules. textual c++ includes keep those dependencies usable.
@@ -11069,7 +11202,7 @@ function emitSwiftPackageManifest(args) {
11069
11202
  ' path: "PeachObjCExports",',
11070
11203
  ` sources: ${JSON.stringify(["root.m", ...[...args.objcExports.modules].map((name2) => `${name2}.m`)])},`,
11071
11204
  ' publicHeadersPath: "include",',
11072
- ` cSettings: [.unsafeFlags(${JSON.stringify([...args.objcExports.flags.filter((flag) => flag !== "-fobjc-arc"), "-fno-objc-arc", "-Xclang", "-disable-objc-default-synthesize-properties"])})]),`
11205
+ ` cSettings: [.unsafeFlags(${JSON.stringify([...args.nativeFlags.get(args.objcExports.rootModule).filter((flag) => flag !== "-fobjc-arc"), "-fno-objc-arc", "-Xclang", "-disable-objc-default-synthesize-properties"])})]),`
11073
11206
  ] : [],
11074
11207
  ...[...args.native?.entries() ?? []].flatMap(([name2, native]) => {
11075
11208
  const late = native.late;
@@ -11085,10 +11218,10 @@ function emitSwiftPackageManifest(args) {
11085
11218
  ` .target(name: ${JSON.stringify(group.name)},`,
11086
11219
  ` dependencies: ${JSON.stringify(native.mixed ? [] : [name2, ...late.producers])},`,
11087
11220
  ` path: ${JSON.stringify(native.clang ? "." : native.path)},`,
11088
- ` sources: ${JSON.stringify(native.clang ? group.sources.map((source) => import_node_path10.default.posix.join(native.path, source)) : group.sources)},`,
11089
- ` publicHeadersPath: ${JSON.stringify(native.clang ? import_node_path10.default.posix.dirname(native.clang.modulemap) : "include")},`,
11090
- ` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...args.objcExports?.flags ?? args.nativeFlags ?? [], ...group.flags])})],`,
11091
- ` cxxSettings: [${macroSettings(owner?.cxxDefines)} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.objcExports?.flags ?? args.nativeFlags ?? [], "-I", native.includeDirectory, "-I", args.headerDirectory, ...group.cxxFlags])})]),`
11221
+ ` sources: ${JSON.stringify(native.clang ? group.sources.map((source) => import_node_path11.default.posix.join(native.path, source)) : group.sources)},`,
11222
+ ` publicHeadersPath: ${JSON.stringify(native.clang ? import_node_path11.default.posix.dirname(native.clang.modulemap) : "include")},`,
11223
+ ` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(name2) ?? [], ...group.flags])})],`,
11224
+ ` cxxSettings: [${macroSettings(owner?.cxxDefines)} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(name2) ?? [], "-I", native.includeDirectory, "-I", args.headerDirectory, ...group.cxxFlags])})]),`
11092
11225
  ]) : [];
11093
11226
  }),
11094
11227
  args.cxxLanguageStandard ? ` ],
@@ -11101,7 +11234,7 @@ function syncSwiftTree(base, files) {
11101
11234
  (0, import_node_fs8.mkdirSync)(base, { recursive: true });
11102
11235
  const walk = (dir) => {
11103
11236
  for (const entry of (0, import_node_fs8.readdirSync)(dir, { withFileTypes: true })) {
11104
- const full = import_node_path10.default.join(dir, entry.name);
11237
+ const full = import_node_path11.default.join(dir, entry.name);
11105
11238
  if (dir === base && entry.name === ".build") continue;
11106
11239
  if (entry.isDirectory()) walk(full);
11107
11240
  else if (!files.has(full)) (0, import_node_fs8.rmSync)(full, { force: true });
@@ -11111,7 +11244,7 @@ function syncSwiftTree(base, files) {
11111
11244
  for (const [full, contents] of files) {
11112
11245
  if ((0, import_node_fs8.existsSync)(full) && (typeof contents === "string" ? (0, import_node_fs8.readFileSync)(full, "utf8") === contents : (0, import_node_fs8.readFileSync)(full).equals(contents)))
11113
11246
  continue;
11114
- (0, import_node_fs8.mkdirSync)(import_node_path10.default.dirname(full), { recursive: true });
11247
+ (0, import_node_fs8.mkdirSync)(import_node_path11.default.dirname(full), { recursive: true });
11115
11248
  (0, import_node_fs8.writeFileSync)(full, contents);
11116
11249
  }
11117
11250
  }
@@ -14887,7 +15020,7 @@ function swiftApplicationEntry(file, source) {
14887
15020
  else if (source[at] === "}") depth--;
14888
15021
  else if (depth === 0 && /^@(?:main|UIApplicationMain)\b/.test(source.slice(at)))
14889
15022
  return true;
14890
- else if (depth === 0 && import_node_path10.default.basename(file) === "main.swift" && /^UIApplicationMain\s*\(/.test(source.slice(at)))
15023
+ else if (depth === 0 && import_node_path11.default.basename(file) === "main.swift" && /^UIApplicationMain\s*\(/.test(source.slice(at)))
14891
15024
  return true;
14892
15025
  }
14893
15026
  return false;
@@ -14920,7 +15053,7 @@ function installObjcPeerStartup(input, targets, compiled) {
14920
15053
  );
14921
15054
  if (entries.length === 0) {
14922
15055
  const source2 = compiled.get(input.entry);
14923
- if (import_node_path10.default.basename(input.entry) !== "main.swift" || source2 === void 0)
15056
+ if (import_node_path11.default.basename(input.entry) !== "main.swift" || source2 === void 0)
14924
15057
  fail("requires main.swift or a supported @main App/UIApplicationDelegate entry");
14925
15058
  compiled.set(input.entry, `_peachRegisterObjcPeers()
14926
15059
  ${source2}`);
@@ -15056,14 +15189,14 @@ function prepareSwiftDependency(source, destination) {
15056
15189
  for (const entry of (0, import_node_fs8.readdirSync)(from, { withFileTypes: true })) {
15057
15190
  if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
15058
15191
  continue;
15059
- const file = import_node_path10.default.join(from, entry.name);
15192
+ const file = import_node_path11.default.join(from, entry.name);
15060
15193
  if (entry.isDirectory()) gather(file);
15061
15194
  else if (entry.isFile() && entry.name.endsWith(".swift"))
15062
- origins[import_node_path10.default.relative(source, file)] = (0, import_node_fs8.readFileSync)(file, "utf8");
15195
+ origins[import_node_path11.default.relative(source, file)] = (0, import_node_fs8.readFileSync)(file, "utf8");
15063
15196
  }
15064
15197
  };
15065
15198
  gather(source);
15066
- const manifest = import_node_path10.default.join(source, "Package.swift");
15199
+ const manifest = import_node_path11.default.join(source, "Package.swift");
15067
15200
  const targets = (0, import_node_fs8.existsSync)(manifest) ? swiftManifestTargets((0, import_node_fs8.readFileSync)(manifest, "utf8")) : [];
15068
15201
  const compiled = compiledSwiftSources(origins, targets);
15069
15202
  const copy = (from, to) => {
@@ -15071,11 +15204,11 @@ function prepareSwiftDependency(source, destination) {
15071
15204
  for (const entry of (0, import_node_fs8.readdirSync)(from, { withFileTypes: true })) {
15072
15205
  if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
15073
15206
  continue;
15074
- const file = import_node_path10.default.join(from, entry.name);
15075
- const target = import_node_path10.default.join(to, entry.name);
15207
+ const file = import_node_path11.default.join(from, entry.name);
15208
+ const target = import_node_path11.default.join(to, entry.name);
15076
15209
  if (entry.isDirectory()) copy(file, target);
15077
15210
  else if (entry.isFile() && entry.name.endsWith(".swift"))
15078
- (0, import_node_fs8.writeFileSync)(target, compiled.get(import_node_path10.default.relative(source, file)));
15211
+ (0, import_node_fs8.writeFileSync)(target, compiled.get(import_node_path11.default.relative(source, file)));
15079
15212
  else (0, import_node_fs8.cpSync)(file, target, { verbatimSymlinks: true });
15080
15213
  }
15081
15214
  };
@@ -15097,7 +15230,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
15097
15230
  const targets = distribution && compileTargets(input).length === 0 ? [
15098
15231
  {
15099
15232
  name: "App",
15100
- path: import_node_path10.default.relative(layout.root, layout.sources),
15233
+ path: import_node_path11.default.relative(layout.root, layout.sources),
15101
15234
  executable: true,
15102
15235
  languageMode: 5,
15103
15236
  mainActorIsolation: false,
@@ -15118,17 +15251,25 @@ function writeSwiftProject(layout, input, moduleRoot) {
15118
15251
  );
15119
15252
  if (target) swiftTargets.add(target.name);
15120
15253
  }
15121
- const headerDirectory = import_node_path10.default.join(layout.root, ".build", "peach-cxx-headers");
15122
- const headerModuleDirectory = import_node_path10.default.join(
15254
+ const headerDirectory = import_node_path11.default.join(layout.root, ".build", "peach-cxx-headers");
15255
+ const headerModuleDirectory = import_node_path11.default.join(
15123
15256
  layout.root,
15124
15257
  ".build",
15125
15258
  "peach-objc-export-modules"
15126
15259
  );
15127
15260
  const imports = /* @__PURE__ */ new Map();
15128
15261
  const objcProducers = /* @__PURE__ */ new Set();
15262
+ let checkedToolchain;
15263
+ const nativeToolchain = () => {
15264
+ if (checkedToolchain) return checkedToolchain;
15265
+ const pin = distribution ?? JSON.parse((0, import_node_fs8.readFileSync)(import_node_path11.default.join(moduleRoot, "toolchain.json"), "utf8"));
15266
+ checkedToolchain = swiftToolchain(pin.release, swiftModuleSdk(moduleRoot));
15267
+ return checkedToolchain;
15268
+ };
15269
+ const deploymentTarget = (name2) => input.nativeTargets?.find((value) => value.name === name2)?.deploymentTarget ?? "16.0";
15129
15270
  const targetStagedFiles = /* @__PURE__ */ new Map();
15130
15271
  const stageTargetFile = (target, file, contents, options) => {
15131
- const relative = import_node_path10.default.relative(layout.root, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep);
15272
+ const relative = import_node_path11.default.relative(layout.root, file).split(import_node_path11.default.sep).join(import_node_path11.default.posix.sep);
15132
15273
  const prior = files.has(file) ? files.get(file) : Object.hasOwn(input.files, relative) ? input.files[relative] : void 0;
15133
15274
  if (!options?.allowExisting && prior !== void 0)
15134
15275
  throw new Error(`target ${target} already contains generated output ${relative}`);
@@ -15159,7 +15300,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
15159
15300
  targetStagedFiles.delete(target.name);
15160
15301
  if (entries.some(([file]) => /\.(?:c|cc|cpp|cxx|m|mm)$/.test(file)) && (swift || input.nativeTargets?.some((value) => value.name === target.name))) {
15161
15302
  if (!swift) {
15162
- const unprepared = import_node_path10.default.join(
15303
+ const unprepared = import_node_path11.default.join(
15163
15304
  layout.root,
15164
15305
  target.path,
15165
15306
  "PeachUnprepared.generated.swift"
@@ -15174,7 +15315,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
15174
15315
  native.set(target.name, {
15175
15316
  mixed: true,
15176
15317
  path: target.path,
15177
- includeDirectory: import_node_path10.default.join(layout.root, target.path, "include"),
15318
+ includeDirectory: import_node_path11.default.join(layout.root, target.path, "include"),
15178
15319
  sources: [],
15179
15320
  lateSources: [],
15180
15321
  exclude: entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length))
@@ -15186,26 +15327,26 @@ function writeSwiftProject(layout, input, moduleRoot) {
15186
15327
  const contents = input.files[file];
15187
15328
  if (contents === void 0)
15188
15329
  throw new Error(`missing original Objective-C header ${file}`);
15189
- const destination = import_node_path10.default.join(layout.root, file);
15190
- (0, import_node_fs8.mkdirSync)(import_node_path10.default.dirname(destination), { recursive: true });
15330
+ const destination = import_node_path11.default.join(layout.root, file);
15331
+ (0, import_node_fs8.mkdirSync)(import_node_path11.default.dirname(destination), { recursive: true });
15191
15332
  (0, import_node_fs8.writeFileSync)(destination, contents);
15192
15333
  files.set(destination, contents);
15193
15334
  }
15194
15335
  for (const header of settings.publicHeaders) {
15195
- const destination = import_node_path10.default.join(headerDirectory, settings.name, import_node_path10.default.basename(header));
15336
+ const destination = import_node_path11.default.join(headerDirectory, settings.name, import_node_path11.default.basename(header));
15196
15337
  if (files.has(destination))
15197
15338
  throw new Error(`duplicate product header ${destination}`);
15198
- const contents = `#import ${JSON.stringify(import_node_path10.default.join(layout.root, header))}
15339
+ const contents = `#import ${JSON.stringify(import_node_path11.default.join(layout.root, header))}
15199
15340
  `;
15200
15341
  files.set(destination, contents);
15201
- (0, import_node_fs8.mkdirSync)(import_node_path10.default.dirname(destination), { recursive: true });
15342
+ (0, import_node_fs8.mkdirSync)(import_node_path11.default.dirname(destination), { recursive: true });
15202
15343
  (0, import_node_fs8.writeFileSync)(destination, contents);
15203
15344
  }
15204
15345
  }
15205
15346
  const nativeTargets = input.nativeTargets ?? [];
15206
- const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ? import_node_path10.default.join(layout.root, file.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1)) : file;
15347
+ const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ? import_node_path11.default.join(layout.root, file.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1)) : file;
15207
15348
  const headerSearch = writeXcodeHeaderSearch(
15208
- import_node_path10.default.join(layout.root, ".build", "peach-xcode-headers"),
15349
+ import_node_path11.default.join(layout.root, ".build", "peach-xcode-headers"),
15209
15350
  nativeTargets.map((settings) => ({
15210
15351
  headerMaps: settings.headerMaps.map((map2) => ({
15211
15352
  flag: map2.flag,
@@ -15216,12 +15357,12 @@ function writeSwiftProject(layout, input, moduleRoot) {
15216
15357
  })),
15217
15358
  productHeaders: Object.fromEntries(
15218
15359
  Object.entries(settings.productHeaders).map(([product, file]) => [
15219
- import_node_path10.default.join(layout.root, product),
15220
- import_node_path10.default.join(layout.root, file)
15360
+ import_node_path11.default.join(layout.root, product),
15361
+ import_node_path11.default.join(layout.root, file)
15221
15362
  ])
15222
15363
  ),
15223
15364
  userHeaderSearchPaths: settings.userHeaderSearchPaths.map(
15224
- (directory) => import_node_path10.default.join(layout.root, directory)
15365
+ (directory) => import_node_path11.default.join(layout.root, directory)
15225
15366
  )
15226
15367
  }))
15227
15368
  );
@@ -15244,7 +15385,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
15244
15385
  if (producer && targets.some((value) => value.name === producer))
15245
15386
  producers2.add(producer);
15246
15387
  const local = [
15247
- import_node_path10.default.posix.join(import_node_path10.default.posix.dirname(file), include2),
15388
+ import_node_path11.default.posix.join(import_node_path11.default.posix.dirname(file), include2),
15248
15389
  `${includes}${include2}`
15249
15390
  ].find((candidate) => input.files[candidate] !== void 0);
15250
15391
  if (local) {
@@ -15274,21 +15415,19 @@ function writeSwiftProject(layout, input, moduleRoot) {
15274
15415
  const headers = settings.headers;
15275
15416
  const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
15276
15417
  for (const file of headers) {
15277
- const destination = import_node_path10.default.join(layout.root, file);
15278
- (0, import_node_fs8.mkdirSync)(import_node_path10.default.dirname(destination), { recursive: true });
15418
+ const destination = import_node_path11.default.join(layout.root, file);
15419
+ (0, import_node_fs8.mkdirSync)(import_node_path11.default.dirname(destination), { recursive: true });
15279
15420
  (0, import_node_fs8.writeFileSync)(destination, input.files[file]);
15280
15421
  }
15281
15422
  const search = [
15282
15423
  .../* @__PURE__ */ new Set([
15283
15424
  ...settings?.headerSearchPaths ?? [],
15284
- ...headers.map((file) => import_node_path10.default.posix.dirname(file))
15425
+ ...headers.map((file) => import_node_path11.default.posix.dirname(file))
15285
15426
  ])
15286
- ].flatMap((dir) => ["-I", import_node_path10.default.join(layout.root, dir)]);
15287
- const pin = distribution ?? JSON.parse((0, import_node_fs8.readFileSync)(import_node_path10.default.join(moduleRoot, "toolchain.json"), "utf8"));
15288
- const release = pin.release;
15289
- const toolchainBin = swiftToolchain(release, swiftModuleSdk(moduleRoot));
15427
+ ].flatMap((dir) => ["-I", import_node_path11.default.join(layout.root, dir)]);
15428
+ const toolchainBin = nativeToolchain();
15290
15429
  const sdkHeaders = materializeObjcSdk(
15291
- import_node_path10.default.join(layout.root, ".build", "peach-objc-sdk")
15430
+ import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk")
15292
15431
  );
15293
15432
  const stageFlags = (flags2, sdkInclude) => flags2.map(
15294
15433
  (flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
@@ -15299,16 +15438,16 @@ function writeSwiftProject(layout, input, moduleRoot) {
15299
15438
  ...search,
15300
15439
  ...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
15301
15440
  "-F",
15302
- import_node_path10.default.join(layout.root, dir)
15441
+ import_node_path11.default.join(layout.root, dir)
15303
15442
  ]),
15304
15443
  "-I",
15305
15444
  headerDirectory
15306
15445
  ];
15307
15446
  const flags = stageFlags(
15308
15447
  originalFlags,
15309
- import_node_path10.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
15448
+ import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
15310
15449
  );
15311
- const prefixHeader = settings?.prefixHeader ? ["-include", import_node_path10.default.join(layout.root, settings.prefixHeader)] : [];
15450
+ const prefixHeader = settings?.prefixHeader ? ["-include", import_node_path11.default.join(layout.root, settings.prefixHeader)] : [];
15312
15451
  const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
15313
15452
  target: target.name,
15314
15453
  path: target.path,
@@ -15319,7 +15458,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
15319
15458
  bundles: input.resourceBundles
15320
15459
  });
15321
15460
  const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
15322
- const accessorHeader = import_node_path10.default.join(
15461
+ const accessorHeader = import_node_path11.default.join(
15323
15462
  layout.root,
15324
15463
  target.path,
15325
15464
  OBJC_RESOURCE_ACCESSOR_HEADER
@@ -15330,23 +15469,23 @@ function writeSwiftProject(layout, input, moduleRoot) {
15330
15469
  const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
15331
15470
  const unitSource = (file) => {
15332
15471
  const relative = file.slice(prefix.length);
15333
- return relative.split("/").some((part) => part.startsWith(".")) ? import_node_path10.default.posix.join(HIDDEN_UNITS, relative.replaceAll(/(^|\/)\./g, "$1%2E")) : relative;
15472
+ return relative.split("/").some((part) => part.startsWith(".")) ? import_node_path11.default.posix.join(HIDDEN_UNITS, relative.replaceAll(/(^|\/)\./g, "$1%2E")) : relative;
15334
15473
  };
15335
15474
  const accessorFlags = accessor ? ["-include", accessorHeader] : [];
15336
15475
  let nativeC = !roots2.length && !entries.some(([file]) => file.endsWith(".swift")) && !units.some(([file]) => /\.mm?$/.test(file));
15337
15476
  if (roots2.length) {
15338
- const sourceHeaders = import_node_path10.default.join(
15477
+ const sourceHeaders = import_node_path11.default.join(
15339
15478
  layout.root,
15340
15479
  ".build",
15341
15480
  "peach-objc-originals",
15342
15481
  target.name
15343
15482
  );
15344
15483
  (0, import_node_fs8.mkdirSync)(sourceHeaders, { recursive: true });
15345
- const modulemap = import_node_path10.default.join(sourceHeaders, "module.modulemap");
15484
+ const modulemap = import_node_path11.default.join(sourceHeaders, "module.modulemap");
15346
15485
  (0, import_node_fs8.writeFileSync)(
15347
15486
  modulemap,
15348
15487
  `module ${swiftTargetModuleName(target.name)} {
15349
- ${roots2.map((file) => `header ${JSON.stringify(import_node_path10.default.join(layout.root, file))}`).join("\n")}
15488
+ ${roots2.map((file) => `header ${JSON.stringify(import_node_path11.default.join(layout.root, file))}`).join("\n")}
15350
15489
  export *
15351
15490
  }
15352
15491
  `
@@ -15358,12 +15497,12 @@ export *
15358
15497
  modulemap
15359
15498
  },
15360
15499
  toolchainBin,
15361
- import_node_path10.default.join(moduleRoot, "ios-simulator-stdlib"),
15362
- import_node_path10.default.join(layout.root, ".build", "peach-objc-sdk"),
15363
- import_node_path10.default.join(layout.root, ".build", "peach-objc-imports", target.name),
15500
+ import_node_path11.default.join(moduleRoot, "ios-simulator-stdlib"),
15501
+ import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk"),
15502
+ import_node_path11.default.join(layout.root, ".build", "peach-objc-imports", target.name),
15364
15503
  {
15365
- flags: stageFlags(originalFlags, import_node_path10.default.join(sdkHeaders, "usr/include")),
15366
- target: `arm64-apple-ios${settings?.deploymentTarget ?? "16.0"}-simulator`
15504
+ flags: stageFlags(originalFlags, import_node_path11.default.join(sdkHeaders, "usr/include")),
15505
+ target: `arm64-apple-ios${deploymentTarget(target.name)}-simulator`
15367
15506
  }
15368
15507
  );
15369
15508
  const defined = /* @__PURE__ */ new Set();
@@ -15401,7 +15540,7 @@ export *
15401
15540
  imports.set(target.name, {
15402
15541
  view,
15403
15542
  classes: [...foreignTypes.values()],
15404
- headers: roots2.map((file) => import_node_path10.default.join(layout.root, file)),
15543
+ headers: roots2.map((file) => import_node_path11.default.join(layout.root, file)),
15405
15544
  foreignTypes
15406
15545
  });
15407
15546
  }
@@ -15410,25 +15549,25 @@ export *
15410
15549
  for (const [file, contents] of nativeUnits) {
15411
15550
  const origin = settings?.sourceDirectories[file];
15412
15551
  if (origin) {
15413
- const original = import_node_path10.default.join(layout.root, origin, import_node_path10.default.posix.basename(file));
15414
- (0, import_node_fs8.mkdirSync)(import_node_path10.default.dirname(original), { recursive: true });
15552
+ const original = import_node_path11.default.join(layout.root, origin, import_node_path11.default.posix.basename(file));
15553
+ (0, import_node_fs8.mkdirSync)(import_node_path11.default.dirname(original), { recursive: true });
15415
15554
  stageTargetFile(target.name, original, contents, { allowExisting: true });
15416
15555
  }
15417
15556
  const source = unitSource(file);
15418
15557
  if (source !== file.slice(prefix.length))
15419
15558
  stageTargetFile(
15420
15559
  target.name,
15421
- import_node_path10.default.join(layout.root, target.path, source),
15560
+ import_node_path11.default.join(layout.root, target.path, source),
15422
15561
  contents,
15423
15562
  {
15424
15563
  allowExisting: true
15425
15564
  }
15426
15565
  );
15427
15566
  const perFile = [
15428
- ...origin ? ["-iquote", import_node_path10.default.join(layout.root, origin)] : [],
15567
+ ...origin ? ["-iquote", import_node_path11.default.join(layout.root, origin)] : [],
15429
15568
  ...stageFlags(
15430
15569
  settings?.fileFlags[file] ?? [],
15431
- import_node_path10.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
15570
+ import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
15432
15571
  )
15433
15572
  ];
15434
15573
  const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
@@ -15449,7 +15588,7 @@ export *
15449
15588
  ...accessorFlags,
15450
15589
  ...stageFlags(
15451
15590
  cxx ? settings.cxxFlags : [],
15452
- import_node_path10.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
15591
+ import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
15453
15592
  ),
15454
15593
  ...perFile
15455
15594
  ]
@@ -15464,12 +15603,12 @@ export *
15464
15603
  flags: [...flags, "-fobjc-arc"],
15465
15604
  cxxFlags: [...flags, "-fobjc-arc"]
15466
15605
  });
15467
- const include2 = import_node_path10.default.join(layout.root, target.path, "include");
15606
+ const include2 = import_node_path11.default.join(layout.root, target.path, "include");
15468
15607
  if (accessor) {
15469
15608
  stageTargetFile(target.name, accessorHeader, accessor.header);
15470
15609
  stageTargetFile(
15471
15610
  target.name,
15472
- import_node_path10.default.join(layout.root, accessorUnit),
15611
+ import_node_path11.default.join(layout.root, accessorUnit),
15473
15612
  accessor.body
15474
15613
  );
15475
15614
  }
@@ -15508,12 +15647,12 @@ export *
15508
15647
  const contents = input.files[original];
15509
15648
  if (contents === void 0)
15510
15649
  throw new Error(`missing original module map ${original}`);
15511
- stageTargetFile(target.name, import_node_path10.default.join(layout.root, product), contents);
15650
+ stageTargetFile(target.name, import_node_path11.default.join(layout.root, product), contents);
15512
15651
  const [owner, ...implementations] = groups.values();
15513
15652
  if (!owner) throw new Error(`target ${target.name} has no original units`);
15514
15653
  native.set(target.name, {
15515
15654
  path: target.path,
15516
- includeDirectory: import_node_path10.default.join(layout.root, import_node_path10.default.dirname(product)),
15655
+ includeDirectory: import_node_path11.default.join(layout.root, import_node_path11.default.dirname(product)),
15517
15656
  sources: nativeUnits.map(([file]) => unitSource(file)),
15518
15657
  lateSources: implementations.flatMap((group) => group.sources),
15519
15658
  exclude: [],
@@ -15534,7 +15673,7 @@ export *
15534
15673
  }
15535
15674
  stageTargetFile(
15536
15675
  target.name,
15537
- import_node_path10.default.join(include2, "module.modulemap"),
15676
+ import_node_path11.default.join(include2, "module.modulemap"),
15538
15677
  `module ${target.name}ImplementationDeclarations { export * }
15539
15678
  `
15540
15679
  );
@@ -15570,7 +15709,7 @@ export *
15570
15709
  }
15571
15710
  native.set(target.name, {
15572
15711
  path: target.path,
15573
- includeDirectory: import_node_path10.default.join(layout.root, includes),
15712
+ includeDirectory: import_node_path11.default.join(layout.root, includes),
15574
15713
  sources: units.map(([file]) => file.slice(prefix.length)),
15575
15714
  lateSources: late.map(([file]) => file.slice(prefix.length)),
15576
15715
  ...late.length > 0 ? {
@@ -15588,7 +15727,7 @@ export *
15588
15727
  ([file]) => file.startsWith(includes) && /\.(?:h|hpp|hh|hxx)$/.test(file) && consumers.get(file).size === 0
15589
15728
  );
15590
15729
  files.set(
15591
- import_node_path10.default.join(layout.root, includes, "module.modulemap"),
15730
+ import_node_path11.default.join(layout.root, includes, "module.modulemap"),
15592
15731
  [
15593
15732
  `module ${target.name} {`,
15594
15733
  ...roots.map(
@@ -15605,7 +15744,7 @@ export *
15605
15744
  swiftModuleInputFiles(moduleRoot).join("\n")
15606
15745
  );
15607
15746
  if (!distribution) {
15608
- modulePlan.update((0, import_node_fs8.readFileSync)(import_node_path10.default.join(moduleRoot, "Package.swift")));
15747
+ modulePlan.update((0, import_node_fs8.readFileSync)(import_node_path11.default.join(moduleRoot, "Package.swift")));
15609
15748
  }
15610
15749
  const resourcePlan = (0, import_node_crypto7.createHash)("sha256").update(
15611
15750
  JSON.stringify(
@@ -15686,27 +15825,27 @@ export *
15686
15825
  objcModules.add(name2);
15687
15826
  rootOwner ??= exported ? [...exported.swift.keys()][0] : `${prefix}PeachObjCImports.generated.swift`;
15688
15827
  files.set(
15689
- import_node_path10.default.join(headerDirectory, `${name2}-Swift.h`),
15828
+ import_node_path11.default.join(headerDirectory, `${name2}-Swift.h`),
15690
15829
  exported?.header ?? "#pragma once\n"
15691
15830
  );
15692
15831
  files.set(
15693
- import_node_path10.default.join(headerDirectory, name2, `${name2}-Swift.h`),
15832
+ import_node_path11.default.join(headerDirectory, name2, `${name2}-Swift.h`),
15694
15833
  `#include "../${name2}-Swift.h"
15695
15834
  `
15696
15835
  );
15697
15836
  files.set(
15698
- import_node_path10.default.join(headerModuleDirectory, name2, "module.modulemap"),
15837
+ import_node_path11.default.join(headerModuleDirectory, name2, "module.modulemap"),
15699
15838
  `module ${swiftTargetModuleName(name2)} {
15700
15839
  ${[
15701
- import_node_path10.default.join(headerDirectory, `${name2}-Swift.h`),
15702
- ...(input.nativeTargets?.find((target2) => target2.name === name2)?.publicHeaders ?? []).map((header) => import_node_path10.default.join(layout.root, header))
15840
+ import_node_path11.default.join(headerDirectory, `${name2}-Swift.h`),
15841
+ ...(input.nativeTargets?.find((target2) => target2.name === name2)?.publicHeaders ?? []).map((header) => import_node_path11.default.join(layout.root, header))
15703
15842
  ].map((header) => ` header ${JSON.stringify(header)}`).join("\n")}
15704
15843
  export *
15705
15844
  }
15706
15845
  `
15707
15846
  );
15708
15847
  files.set(
15709
- import_node_path10.default.join(layout.root, "PeachObjCExports", `${name2}.m`),
15848
+ import_node_path11.default.join(layout.root, "PeachObjCExports", `${name2}.m`),
15710
15849
  exported?.implementation ?? `#include "${name2}-Cxx.h"
15711
15850
  `
15712
15851
  );
@@ -15718,13 +15857,13 @@ ${[
15718
15857
  if (generated) {
15719
15858
  const register = `_peach_objc_imports_${swiftTargetModuleName(name2)}`;
15720
15859
  files.set(
15721
- import_node_path10.default.join(layout.root, target.path, "PeachObjCImports.generated.swift"),
15860
+ import_node_path11.default.join(layout.root, target.path, "PeachObjCImports.generated.swift"),
15722
15861
  generated.swift + generated.registration + `
15723
15862
  @_cdecl("${register}") public func __peachRegisterOriginalObjC() { ${generated.registerFunction}() }
15724
15863
  `
15725
15864
  );
15726
15865
  files.set(
15727
- import_node_path10.default.join(layout.root, target.path, "PeachObjCImports.generated.m"),
15866
+ import_node_path11.default.join(layout.root, target.path, "PeachObjCImports.generated.m"),
15728
15867
  generated.objc
15729
15868
  );
15730
15869
  registrations.push(`${register}();`);
@@ -15782,7 +15921,7 @@ ${[
15782
15921
  exclude: []
15783
15922
  });
15784
15923
  files.set(
15785
- import_node_path10.default.join(layout.root, `PeachApplication/${name2}/Entry.swift`),
15924
+ import_node_path11.default.join(layout.root, `PeachApplication/${name2}/Entry.swift`),
15786
15925
  `import ${swiftTargetModuleName(target.name)}
15787
15926
  @main struct __PeachApplicationEntry { @MainActor static func main() { __peachRunApplication() } }
15788
15927
  `
@@ -15790,21 +15929,35 @@ ${[
15790
15929
  }
15791
15930
  const nativeFlags = (() => {
15792
15931
  if (native.size === 0) return void 0;
15793
- const headers = materializeObjcSdk(import_node_path10.default.join(layout.root, ".build", "peach-objc-sdk"));
15794
- return [
15795
- "-fobjc-runtime=gnustep-2.2",
15796
- "-fobjc-exceptions",
15797
- "-fexceptions",
15798
- "-fwasm-exceptions",
15799
- "-fobjc-arc",
15800
- "-fblocks",
15801
- "-F",
15802
- import_node_path10.default.join(headers, "System/Library/Frameworks"),
15803
- "-idirafter",
15804
- import_node_path10.default.join(headers, "usr/include"),
15805
- "-I",
15806
- headerDirectory
15807
- ];
15932
+ const headers = materializeObjcSdk(import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk"));
15933
+ const moduleMaps = rootOwner ? [...objcModules].map(
15934
+ (name2) => `-fmodule-map-file=${import_node_path11.default.join(headerModuleDirectory, name2, "module.modulemap")}`
15935
+ ) : [];
15936
+ return new Map(
15937
+ targets.map((target) => {
15938
+ const version = deploymentTarget(target.name);
15939
+ const minimum = iosDeploymentMinimum(version);
15940
+ if (minimum === void 0)
15941
+ throw new Error(
15942
+ `${target.name}: unsupported IPHONEOS_DEPLOYMENT_TARGET ${JSON.stringify(version)}`
15943
+ );
15944
+ return [
15945
+ target.name,
15946
+ [
15947
+ "-fobjc-runtime=gnustep-2.2",
15948
+ "-fobjc-exceptions",
15949
+ "-fexceptions",
15950
+ "-fwasm-exceptions",
15951
+ "-fobjc-arc",
15952
+ "-fblocks",
15953
+ ...objcSdkIntakeFlags(headers, nativeToolchain(), minimum),
15954
+ "-I",
15955
+ headerDirectory,
15956
+ ...moduleMaps
15957
+ ]
15958
+ ];
15959
+ })
15960
+ );
15808
15961
  })();
15809
15962
  let objcExports;
15810
15963
  if (rootOwner && input.objcPeerStartup)
@@ -15821,7 +15974,7 @@ ${[
15821
15974
  throw new Error(
15822
15975
  "Swift Objective-C export target conflicts with application sources"
15823
15976
  );
15824
- const ownerFile = import_node_path10.default.join(layout.root, rootOwner);
15977
+ const ownerFile = import_node_path11.default.join(layout.root, rootOwner);
15825
15978
  const ownerSource = compiled.get(rootOwner) ?? files.get(ownerFile);
15826
15979
  if (typeof ownerSource !== "string")
15827
15980
  throw new Error("Objective-C root registration has no owning Swift source");
@@ -15838,11 +15991,11 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
15838
15991
  );
15839
15992
  if (compiled.has(rootOwner)) compiled.set(rootOwner, files.get(ownerFile).toString());
15840
15993
  files.set(
15841
- import_node_path10.default.join(layout.root, "PeachObjCExports", "include", "module.modulemap"),
15994
+ import_node_path11.default.join(layout.root, "PeachObjCExports", "include", "module.modulemap"),
15842
15995
  "module PeachSwiftObjCExports { export * }\n"
15843
15996
  );
15844
15997
  files.set(
15845
- import_node_path10.default.join(layout.root, "PeachObjCExports", "root.m"),
15998
+ import_node_path11.default.join(layout.root, "PeachObjCExports", "root.m"),
15846
15999
  [
15847
16000
  "#import <Foundation/Foundation.h>",
15848
16001
  "extern void _peach_objc_ensure_exports(void);",
@@ -15864,24 +16017,15 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
15864
16017
  ""
15865
16018
  ].join("\n")
15866
16019
  );
15867
- objcExports = {
15868
- modules: objcModules,
15869
- rootModule,
15870
- flags: [
15871
- ...nativeFlags,
15872
- ...[...objcModules].map(
15873
- (name2) => `-fmodule-map-file=${import_node_path10.default.join(headerModuleDirectory, name2, "module.modulemap")}`
15874
- )
15875
- ]
15876
- };
16020
+ objcExports = { modules: objcModules, rootModule };
15877
16021
  }
15878
16022
  if (targets.length === 0) {
15879
16023
  for (const [file, contents] of Object.entries(input.files)) {
15880
16024
  if (file === "Package.swift") continue;
15881
- files.set(import_node_path10.default.join(layout.sources, file), compiled.get(file) ?? contents);
16025
+ files.set(import_node_path11.default.join(layout.sources, file), compiled.get(file) ?? contents);
15882
16026
  }
15883
16027
  let manifest = (0, import_node_fs8.readFileSync)(
15884
- import_node_path10.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
16028
+ import_node_path11.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
15885
16029
  "utf8"
15886
16030
  ).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
15887
16031
  const reactor = ` ${REACTOR_FLAG}`;
@@ -15925,21 +16069,21 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
15925
16069
  manifest = manifest.replace(anchor, `${anchor}
15926
16070
  ${SPRITEKIT_PRODUCT},`);
15927
16071
  }
15928
- files.set(import_node_path10.default.join(layout.root, "Package.swift"), manifest + moduleFiles);
16072
+ files.set(import_node_path11.default.join(layout.root, "Package.swift"), manifest + moduleFiles);
15929
16073
  } else {
15930
16074
  const base = layout.multi ? layout.root : layout.sources;
15931
16075
  const libraries = /* @__PURE__ */ new Map();
15932
16076
  for (const [target, data] of Object.entries(input.libraries ?? {})) {
15933
- const file = import_node_path10.default.join(layout.root, ".peach-libraries", `lib${target}.a`);
16077
+ const file = import_node_path11.default.join(layout.root, ".peach-libraries", `lib${target}.a`);
15934
16078
  files.set(file, Buffer.from(data, "base64"));
15935
16079
  libraries.set(target, file);
15936
16080
  }
15937
16081
  for (const [file, contents] of Object.entries(input.files)) {
15938
16082
  if (file === "Package.swift") continue;
15939
- files.set(import_node_path10.default.join(base, file), compiled.get(file) ?? contents);
16083
+ files.set(import_node_path11.default.join(base, file), compiled.get(file) ?? contents);
15940
16084
  }
15941
16085
  files.set(
15942
- import_node_path10.default.join(layout.root, "Package.swift"),
16086
+ import_node_path11.default.join(layout.root, "Package.swift"),
15943
16087
  emitSwiftPackageManifest({
15944
16088
  targets,
15945
16089
  native,
@@ -15958,7 +16102,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
15958
16102
  spriteKit: importsSpriteKit(input.files),
15959
16103
  distribution: distribution ?? void 0,
15960
16104
  distributionLink: {
15961
- path: import_node_path10.default.join(layout.root, ".peach-distribution-objects.rsp"),
16105
+ path: import_node_path11.default.join(layout.root, ".peach-distribution-objects.rsp"),
15962
16106
  files
15963
16107
  },
15964
16108
  libraries
@@ -15974,9 +16118,9 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
15974
16118
  throw new Error(
15975
16119
  `swift resource target ${target.name} has no matching bundle assignment`
15976
16120
  );
15977
- const directory = layout.multi ? import_node_path10.default.join(layout.root, target.path) : layout.sources;
16121
+ const directory = layout.multi ? import_node_path11.default.join(layout.root, target.path) : layout.sources;
15978
16122
  files.set(
15979
- import_node_path10.default.join(directory, "ResourceBundleAccessor.generated.swift"),
16123
+ import_node_path11.default.join(directory, "ResourceBundleAccessor.generated.swift"),
15980
16124
  [
15981
16125
  "import Foundation",
15982
16126
  "",
@@ -15993,7 +16137,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
15993
16137
  }
15994
16138
  for (const [file, source] of compiled)
15995
16139
  if (!Object.hasOwn(input.files, file))
15996
- files.set(import_node_path10.default.join(layout.multi ? layout.root : layout.sources, file), source);
16140
+ files.set(import_node_path11.default.join(layout.multi ? layout.root : layout.sources, file), source);
15997
16141
  syncSwiftTree(layout.root, files);
15998
16142
  const producers = [
15999
16143
  .../* @__PURE__ */ new Set([
@@ -16015,10 +16159,10 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
16015
16159
  targetFailures,
16016
16160
  ...rootOwner && objcExports ? {
16017
16161
  objcImplementations: {
16018
- owner: import_node_path10.default.join(layout.root, rootOwner),
16162
+ owner: import_node_path11.default.join(layout.root, rootOwner),
16019
16163
  registeredClasses: [...registeredClasses],
16020
16164
  units: [...native.values()].flatMap(
16021
- (value) => value.sources.filter((file) => /\.mm?$/.test(file)).map((file) => import_node_path10.default.join(layout.root, value.path, file))
16165
+ (value) => value.sources.filter((file) => /\.mm?$/.test(file)).map((file) => import_node_path11.default.join(layout.root, value.path, file))
16022
16166
  )
16023
16167
  }
16024
16168
  } : {}
@@ -16040,13 +16184,13 @@ function outputOf(error) {
16040
16184
  return error instanceof Error ? error.message : String(error);
16041
16185
  }
16042
16186
  function builtArtifact(layout) {
16043
- const binDir = import_node_path10.default.join(layout.root, ".build", WASM_TRIPLE, "release");
16044
- const manifest = (0, import_node_fs8.readFileSync)(import_node_path10.default.join(layout.root, "Package.swift"), "utf8");
16187
+ const binDir = import_node_path11.default.join(layout.root, ".build", WASM_TRIPLE, "release");
16188
+ const manifest = (0, import_node_fs8.readFileSync)(import_node_path11.default.join(layout.root, "Package.swift"), "utf8");
16045
16189
  const executable = swiftManifestTargets(manifest).find((target) => target.executable);
16046
16190
  if (executable === void 0) {
16047
16191
  throw new Error("swift-compile: the written manifest names no executable target");
16048
16192
  }
16049
- const file = import_node_path10.default.join(binDir, `${executable.name}.wasm`);
16193
+ const file = import_node_path11.default.join(binDir, `${executable.name}.wasm`);
16050
16194
  if (!(0, import_node_fs8.existsSync)(file)) {
16051
16195
  const found = (0, import_node_fs8.existsSync)(binDir) ? (0, import_node_fs8.readdirSync)(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
16052
16196
  throw new Error(
@@ -16057,7 +16201,7 @@ function builtArtifact(layout) {
16057
16201
  }
16058
16202
  function projectDiagnostic(output, layout, files) {
16059
16203
  const base = layout.multi ? layout.root : layout.sources;
16060
- const prefix = `${base}${import_node_path10.default.sep}`;
16204
+ const prefix = `${base}${import_node_path11.default.sep}`;
16061
16205
  return designTimeDiagnostic(output, files).split("\n").filter((line) => !SWIFTPM_NOISE.test(line)).map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
16062
16206
  }
16063
16207
  var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
@@ -16093,12 +16237,12 @@ function serialize(root, work, signal) {
16093
16237
  function readCompiledArtifact(directory, hash2) {
16094
16238
  try {
16095
16239
  const receipt = JSON.parse(
16096
- (0, import_node_fs8.readFileSync)(import_node_path10.default.join(directory, "artifact.json"), "utf8")
16240
+ (0, import_node_fs8.readFileSync)(import_node_path11.default.join(directory, "artifact.json"), "utf8")
16097
16241
  );
16098
16242
  if (!receipt || typeof receipt !== "object" || !("hash" in receipt) || receipt.hash !== hash2 || !("icu" in receipt) || typeof receipt.icu !== "string" || !("wasm" in receipt) || typeof receipt.wasm !== "string")
16099
16243
  return null;
16100
- const bytes = (0, import_node_fs8.readFileSync)(import_node_path10.default.join(directory, "app.wasm"));
16101
- const gzip2 = (0, import_node_fs8.readFileSync)(import_node_path10.default.join(directory, "icu.gz"));
16244
+ const bytes = (0, import_node_fs8.readFileSync)(import_node_path11.default.join(directory, "app.wasm"));
16245
+ const gzip2 = (0, import_node_fs8.readFileSync)(import_node_path11.default.join(directory, "icu.gz"));
16102
16246
  if ((0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex") !== receipt.wasm || (0, import_node_crypto7.createHash)("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
16103
16247
  return null;
16104
16248
  return { hash: hash2, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
@@ -16109,14 +16253,14 @@ function readCompiledArtifact(directory, hash2) {
16109
16253
  }
16110
16254
  }
16111
16255
  function saveCompiledArtifact(root, artifact) {
16112
- const directory = import_node_path10.default.join(root, "artifact");
16256
+ const directory = import_node_path11.default.join(root, "artifact");
16113
16257
  (0, import_node_fs8.mkdirSync)(directory, { recursive: true });
16114
- const pending = (0, import_node_fs8.mkdtempSync)(import_node_path10.default.join(root, ".artifact-"));
16258
+ const pending = (0, import_node_fs8.mkdtempSync)(import_node_path11.default.join(root, ".artifact-"));
16115
16259
  try {
16116
- (0, import_node_fs8.writeFileSync)(import_node_path10.default.join(pending, "app.wasm"), artifact.bytes);
16117
- (0, import_node_fs8.writeFileSync)(import_node_path10.default.join(pending, "icu.gz"), artifact.icu.gzip);
16260
+ (0, import_node_fs8.writeFileSync)(import_node_path11.default.join(pending, "app.wasm"), artifact.bytes);
16261
+ (0, import_node_fs8.writeFileSync)(import_node_path11.default.join(pending, "icu.gz"), artifact.icu.gzip);
16118
16262
  (0, import_node_fs8.writeFileSync)(
16119
- import_node_path10.default.join(pending, "artifact.json"),
16263
+ import_node_path11.default.join(pending, "artifact.json"),
16120
16264
  JSON.stringify({
16121
16265
  hash: artifact.hash,
16122
16266
  wasm: (0, import_node_crypto7.createHash)("sha256").update(artifact.bytes).digest("hex"),
@@ -16124,7 +16268,7 @@ function saveCompiledArtifact(root, artifact) {
16124
16268
  })
16125
16269
  );
16126
16270
  for (const file of ["app.wasm", "icu.gz", "artifact.json"]) {
16127
- (0, import_node_fs8.renameSync)(import_node_path10.default.join(pending, file), import_node_path10.default.join(directory, file));
16271
+ (0, import_node_fs8.renameSync)(import_node_path11.default.join(pending, file), import_node_path11.default.join(directory, file));
16128
16272
  }
16129
16273
  } finally {
16130
16274
  (0, import_node_fs8.rmSync)(pending, { recursive: true, force: true });
@@ -16146,16 +16290,16 @@ function renewSharedArtifact(sharedRoot) {
16146
16290
  function pruneSharedArtifacts(parent, keep) {
16147
16291
  const entries = [];
16148
16292
  for (const name2 of (0, import_node_fs8.readdirSync)(parent)) {
16149
- const directory = import_node_path10.default.join(parent, name2);
16293
+ const directory = import_node_path11.default.join(parent, name2);
16150
16294
  if (name2.startsWith(RETIRED_PREFIX)) {
16151
16295
  (0, import_node_fs8.rmSync)(directory, { recursive: true, force: true });
16152
16296
  continue;
16153
16297
  }
16154
16298
  try {
16155
16299
  let bytes = 0;
16156
- for (const file of (0, import_node_fs8.readdirSync)(import_node_path10.default.join(directory, "artifact"))) {
16300
+ for (const file of (0, import_node_fs8.readdirSync)(import_node_path11.default.join(directory, "artifact"))) {
16157
16301
  try {
16158
- bytes += (0, import_node_fs8.statSync)(import_node_path10.default.join(directory, "artifact", file)).size;
16302
+ bytes += (0, import_node_fs8.statSync)(import_node_path11.default.join(directory, "artifact", file)).size;
16159
16303
  } catch (error) {
16160
16304
  if (!vanished(error)) throw error;
16161
16305
  }
@@ -16170,9 +16314,9 @@ function pruneSharedArtifacts(parent, keep) {
16170
16314
  if (total <= SHARED_ARTIFACT_BUDGET_BYTES) break;
16171
16315
  if (entry.directory === keep || Date.now() - entry.used < SHARED_ARTIFACT_GRACE_MS)
16172
16316
  continue;
16173
- const retired = import_node_path10.default.join(
16317
+ const retired = import_node_path11.default.join(
16174
16318
  parent,
16175
- `${RETIRED_PREFIX}${process.pid}-${import_node_path10.default.basename(entry.directory)}`
16319
+ `${RETIRED_PREFIX}${process.pid}-${import_node_path11.default.basename(entry.directory)}`
16176
16320
  );
16177
16321
  try {
16178
16322
  if ((0, import_node_fs8.statSync)(entry.directory).mtimeMs !== entry.used) continue;
@@ -16188,7 +16332,7 @@ function pruneSharedArtifacts(parent, keep) {
16188
16332
  function saveSharedArtifact(sharedRoot, artifact) {
16189
16333
  saveCompiledArtifact(sharedRoot, artifact);
16190
16334
  renewSharedArtifact(sharedRoot);
16191
- pruneSharedArtifacts(import_node_path10.default.dirname(sharedRoot), sharedRoot);
16335
+ pruneSharedArtifacts(import_node_path11.default.dirname(sharedRoot), sharedRoot);
16192
16336
  }
16193
16337
  var retainedArtifacts = /* @__PURE__ */ new Map();
16194
16338
  function retain(root, artifact) {
@@ -16205,14 +16349,14 @@ function compileSwiftProjectUnit(input, options) {
16205
16349
  options.signal?.throwIfAborted();
16206
16350
  (0, import_node_fs8.mkdirSync)(options.buildRoot, { recursive: true });
16207
16351
  const root = (0, import_node_fs8.realpathSync)(options.buildRoot);
16208
- const moduleRoot = import_node_path10.default.resolve(options.moduleRoot);
16352
+ const moduleRoot = import_node_path11.default.resolve(options.moduleRoot);
16209
16353
  const layout = {
16210
16354
  root,
16211
- sources: import_node_path10.default.join(root, "Sources", "App"),
16355
+ sources: import_node_path11.default.join(root, "Sources", "App"),
16212
16356
  multi: compileTargets(input).length > 0
16213
16357
  };
16214
16358
  const hash2 = swiftArtifactHash(input, options.release, moduleRoot);
16215
- const sharedRoot = import_node_path10.default.join(rnxHomeDir(), "cache", "swift-projects", hash2);
16359
+ const sharedRoot = import_node_path11.default.join(rnxHomeDir(), "cache", "swift-projects", hash2);
16216
16360
  const report = (message) => {
16217
16361
  console.error(`[swift-project ${hash2.slice(0, 16)}] ${message}`);
16218
16362
  options.onStage?.(message);
@@ -16226,8 +16370,8 @@ function compileSwiftProjectUnit(input, options) {
16226
16370
  report("reusing memory artifact");
16227
16371
  return retain(root, retained);
16228
16372
  }
16229
- const cached = readCompiledArtifact(import_node_path10.default.join(sharedRoot, "artifact"), hash2);
16230
- const previous = cached ?? readCompiledArtifact(import_node_path10.default.join(root, "artifact"), hash2);
16373
+ const cached = readCompiledArtifact(import_node_path11.default.join(sharedRoot, "artifact"), hash2);
16374
+ const previous = cached ?? readCompiledArtifact(import_node_path11.default.join(root, "artifact"), hash2);
16231
16375
  if (previous) {
16232
16376
  if (cached) renewSharedArtifact(sharedRoot);
16233
16377
  else saveSharedArtifact(sharedRoot, previous);
@@ -16236,8 +16380,8 @@ function compileSwiftProjectUnit(input, options) {
16236
16380
  }
16237
16381
  if (process.platform === "darwin" && process.env.TM_SESSION && !admittedMacBuilderSlot() && process.env.CI !== "true" && moduleRoot === sourceSwiftCheckout() && !swiftDistributionAt(moduleRoot)) {
16238
16382
  const requestRoot = (0, import_node_fs8.mkdtempSync)(`${root}.builder-request-`);
16239
- const output = import_node_path10.default.join(requestRoot, "output");
16240
- const request = import_node_path10.default.join(requestRoot, "request.json");
16383
+ const output = import_node_path11.default.join(requestRoot, "output");
16384
+ const request = import_node_path11.default.join(requestRoot, "request.json");
16241
16385
  (0, import_node_fs8.writeFileSync)(
16242
16386
  request,
16243
16387
  JSON.stringify({
@@ -16251,12 +16395,12 @@ function compileSwiftProjectUnit(input, options) {
16251
16395
  })
16252
16396
  );
16253
16397
  try {
16254
- const repo = import_node_path10.default.resolve(moduleRoot, "../..");
16398
+ const repo = import_node_path11.default.resolve(moduleRoot, "../..");
16255
16399
  report("requesting builder admission or cached result");
16256
16400
  await runCompiler(
16257
16401
  "bun",
16258
16402
  [
16259
- import_node_path10.default.join(repo, "scripts/build/swift-project.ts"),
16403
+ import_node_path11.default.join(repo, "scripts/build/swift-project.ts"),
16260
16404
  "--request",
16261
16405
  request,
16262
16406
  "--output",
@@ -16290,7 +16434,7 @@ function compileSwiftProjectUnit(input, options) {
16290
16434
  return withSwiftRootLock(
16291
16435
  root,
16292
16436
  async (lease) => {
16293
- const built = readCompiledArtifact(import_node_path10.default.join(sharedRoot, "artifact"), hash2);
16437
+ const built = readCompiledArtifact(import_node_path11.default.join(sharedRoot, "artifact"), hash2);
16294
16438
  if (built) {
16295
16439
  report("reusing verified disk artifact");
16296
16440
  return retain(root, built);
@@ -16299,7 +16443,7 @@ function compileSwiftProjectUnit(input, options) {
16299
16443
  const unprepared = preparation.targetFailures.map(
16300
16444
  (failure) => `error: target ${failure}`
16301
16445
  );
16302
- const swift = import_node_path10.default.join(options.toolchainBin, "swift");
16446
+ const swift = import_node_path11.default.join(options.toolchainBin, "swift");
16303
16447
  if (!(0, import_node_fs8.existsSync)(swift)) {
16304
16448
  throw new Error(
16305
16449
  `swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
@@ -16347,8 +16491,8 @@ function compileSwiftProjectUnit(input, options) {
16347
16491
  // shipped host plugins resolve against the selected compiler's runtime.
16348
16492
  ...process.platform === "linux" ? {
16349
16493
  LD_LIBRARY_PATH: [
16350
- import_node_path10.default.resolve(options.toolchainBin, "../lib/swift/linux"),
16351
- import_node_path10.default.resolve(options.toolchainBin, "../lib/swift/host"),
16494
+ import_node_path11.default.resolve(options.toolchainBin, "../lib/swift/linux"),
16495
+ import_node_path11.default.resolve(options.toolchainBin, "../lib/swift/host"),
16352
16496
  process.env.LD_LIBRARY_PATH
16353
16497
  ].filter(Boolean).join(":")
16354
16498
  } : {}
@@ -16372,7 +16516,7 @@ function compileSwiftProjectUnit(input, options) {
16372
16516
  if (preparation.objcImplementations) {
16373
16517
  const plan = preparation.objcImplementations;
16374
16518
  const manifest = browser_default.parse(
16375
- (0, import_node_fs8.readFileSync)(import_node_path10.default.join(root, ".build", "release.yaml"), "utf8")
16519
+ (0, import_node_fs8.readFileSync)(import_node_path11.default.join(root, ".build", "release.yaml"), "utf8")
16376
16520
  );
16377
16521
  if (!isRecord(manifest) || !isRecord(manifest.commands))
16378
16522
  throw new Error("missing SwiftPM native compiler commands");
@@ -16429,7 +16573,7 @@ function compileSwiftProjectUnit(input, options) {
16429
16573
  );
16430
16574
  } catch (error) {
16431
16575
  const output = outputOf(error);
16432
- const moduleCache = import_node_path10.default.join(
16576
+ const moduleCache = import_node_path11.default.join(
16433
16577
  root,
16434
16578
  ".build",
16435
16579
  WASM_TRIPLE,