peachsim 0.1.1625 → 0.1.1640

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 (169) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +15 -2
  3. package/cli/app-config.ts +18 -6
  4. package/cli/app-fonts.ts +37 -17
  5. package/cli/app-stubs.ts +284 -20
  6. package/cli/bridge-flow-runner.ts +66 -45
  7. package/cli/cloud-client.ts +60 -40
  8. package/cli/command-registry.ts +1 -0
  9. package/cli/commands/control.ts +283 -49
  10. package/cli/commands/doctor.ts +30 -189
  11. package/cli/commands/flow.ts +79 -11
  12. package/cli/commands/inspect/core.ts +10 -5
  13. package/cli/commands/inspect/settling.ts +14 -2
  14. package/cli/commands/inspect/shared.ts +9 -4
  15. package/cli/commands/inspect/wait-ready.ts +12 -0
  16. package/cli/commands/inspect.ts +91 -50
  17. package/cli/commands/install-desktop.ts +1 -0
  18. package/cli/commands/maestro-compare.ts +97 -38
  19. package/cli/commands/maestro.ts +9 -1
  20. package/cli/commands/preview.ts +1 -1
  21. package/cli/commands/record.ts +118 -48
  22. package/cli/commands/screenshot.ts +23 -1
  23. package/cli/commands/serve.ts +7 -2
  24. package/cli/commands/setup.ts +19 -42
  25. package/cli/commands/swift.ts +14 -3
  26. package/cli/commands/upload.ts +93 -48
  27. package/cli/desktop-companion.ts +102 -17
  28. package/cli/drivers/desktop.ts +14 -1
  29. package/cli/drivers/playwright-sim-host.ts +103 -45
  30. package/cli/drivers/playwright.ts +9 -8
  31. package/cli/drivers/types.ts +5 -0
  32. package/cli/maestro-accessibility.ts +1 -1
  33. package/cli/maestro-compare.ts +84 -12
  34. package/cli/main.ts +3 -2
  35. package/cli/outbound-endpoints.ts +20 -6
  36. package/cli/pause-aware-timeout.ts +106 -0
  37. package/cli/scene-video.ts +89 -0
  38. package/cli/ws-bridge.ts +37 -19
  39. package/detox/attempt-events.cjs +66 -5
  40. package/detox/attempt-events.d.cts +7 -0
  41. package/detox/expectations.ts +7 -3
  42. package/detox/index.ts +269 -170
  43. package/detox/motion-change.cjs +206 -21
  44. package/detox/motion-change.d.cts +39 -2
  45. package/detox/navigation-lifecycle.ts +35 -3
  46. package/dist-lib/agent-daemon-client.cjs +1 -1
  47. package/dist-lib/agent-events.cjs +1 -1
  48. package/dist-lib/attached-projects.cjs +1 -1
  49. package/dist-lib/auth/shared-session.cjs +1 -1
  50. package/dist-lib/backend-origin.cjs +8 -7
  51. package/dist-lib/beta.cjs +1 -1
  52. package/dist-lib/beta.mjs +1 -1
  53. package/dist-lib/bridge-constants.cjs +13 -1
  54. package/dist-lib/bridge-contract-input.cjs +1 -1
  55. package/dist-lib/bridge-contract-input.mjs +1 -1
  56. package/dist-lib/bridge-contract.cjs +14 -8
  57. package/dist-lib/bridge-contract.mjs +13 -7
  58. package/dist-lib/bundle-channel.cjs +11887 -7900
  59. package/dist-lib/capture-contract.cjs +1 -1
  60. package/dist-lib/capture-contract.mjs +1 -1
  61. package/dist-lib/cloud-contract.cjs +1 -1
  62. package/dist-lib/cloud-contract.mjs +1 -1
  63. package/dist-lib/cloud-test-args.cjs +1 -1
  64. package/dist-lib/cloud-test-args.mjs +1 -1
  65. package/dist-lib/cloud.cjs +1 -1
  66. package/dist-lib/cloud.mjs +1 -1
  67. package/dist-lib/config.cjs +6 -3
  68. package/dist-lib/config.mjs +6 -3
  69. package/dist-lib/detox/index.cjs +1379 -725
  70. package/dist-lib/dev-bundle-resolution.cjs +14 -2
  71. package/dist-lib/expo-swift-bundle.cjs +9341 -5462
  72. package/dist-lib/expo-swift-metadata.cjs +11 -7
  73. package/dist-lib/expo-swift-metadata.mjs +11 -7
  74. package/dist-lib/home-paths.cjs +32 -3
  75. package/dist-lib/host/bridge-host.cjs +50204 -7258
  76. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  77. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  78. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  79. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  80. package/dist-lib/host/websocket-proxy.cjs +1 -1
  81. package/dist-lib/index.cjs +3541 -448
  82. package/dist-lib/jump-to-source-babel.cjs +1 -1
  83. package/dist-lib/jump-to-source-native.cjs +1 -1
  84. package/dist-lib/kotlin-host.cjs +1 -1
  85. package/dist-lib/menu.cjs +1 -1
  86. package/dist-lib/menu.mjs +1 -1
  87. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  88. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  89. package/dist-lib/metro-production-bundle.cjs +1 -1
  90. package/dist-lib/metro-production-bundle.mjs +1 -1
  91. package/dist-lib/metro.cjs +2931 -104
  92. package/dist-lib/native-app-identity-project.cjs +289 -49
  93. package/dist-lib/native-app-identity-project.mjs +289 -49
  94. package/dist-lib/native-app-identity.cjs +77 -26
  95. package/dist-lib/native-app-identity.mjs +76 -26
  96. package/dist-lib/native-firebase-metadata.cjs +1 -1
  97. package/dist-lib/native-firebase-metadata.mjs +1 -1
  98. package/dist-lib/plist.cjs +1 -1
  99. package/dist-lib/plist.mjs +1 -1
  100. package/dist-lib/profiles.cjs +1 -1
  101. package/dist-lib/public-brand.cjs +1 -1
  102. package/dist-lib/react-native-host-modules.cjs +6 -2
  103. package/dist-lib/react-native-host-modules.mjs +6 -2
  104. package/dist-lib/scripts/dev-server-scanner.cjs +22 -8
  105. package/dist-lib/sdk.cjs +27 -11
  106. package/dist-lib/sdk.mjs +27 -10
  107. package/dist-lib/skills.cjs +72201 -26208
  108. package/dist-lib/swift-compile.cjs +1007 -140
  109. package/dist-lib/swift-compile.mjs +1049 -174
  110. package/dist-lib/swift-package.cjs +12 -3
  111. package/dist-lib/swift-package.mjs +12 -3
  112. package/dist-lib/swift-submit.cjs +13 -5
  113. package/dist-lib/swift-submit.mjs +11 -5
  114. package/dist-lib/swift-toolchain.cjs +423 -33
  115. package/dist-lib/swift.cjs +1 -1
  116. package/dist-lib/vite-swift.cjs +8628 -5268
  117. package/dist-lib/vite.cjs +2859 -12
  118. package/dist-lib/worklet-executable.cjs +14 -2
  119. package/dist-lib/worklet-executable.mjs +14 -2
  120. package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +21 -14
  121. package/kotlin/Sources/androidx/annotation/DrawableRes.kt +14 -0
  122. package/package.json +1 -1
  123. package/scripts/dev-server-scanner.ts +2 -1
  124. package/skills/peach-perf/SKILL.md +11 -5
  125. package/skills/peach-setup/SKILL.md +16 -19
  126. package/src/backend-origin.ts +13 -6
  127. package/src/bridge-constants.ts +11 -0
  128. package/src/bridge-contract.ts +22 -34
  129. package/src/config.ts +15 -0
  130. package/src/desktop-host-delivery.ts +5 -1
  131. package/src/dev-bundle-resolution.ts +2 -1
  132. package/src/expo-manifest-body.ts +13 -0
  133. package/src/expo-swift-host.ts +196 -49
  134. package/src/expo-swift-ready.ts +78 -0
  135. package/src/expoKotlinContract.ts +4 -7
  136. package/src/expoSwiftContract.ts +17 -6
  137. package/src/home-paths.ts +48 -2
  138. package/src/host/bridge-host.ts +5 -2
  139. package/src/host/staged-host-files.ts +9 -0
  140. package/src/native-app-identity-project.ts +27 -6
  141. package/src/native-app-identity.ts +91 -4
  142. package/src/native-firebase-config.ts +209 -13
  143. package/src/nativeAppIconContract.ts +1 -4
  144. package/src/output-lock-stdio.ts +36 -0
  145. package/src/process-group.ts +25 -2
  146. package/src/react-native-bridge-modules.ts +431 -0
  147. package/src/react-native-host-modules.ts +8 -1
  148. package/src/settings-bundle.ts +1 -4
  149. package/src/swift-binary-modules.ts +2 -2
  150. package/src/swift-compile.ts +918 -109
  151. package/src/swift-compiler-digest.ts +14 -0
  152. package/src/swift-distribution.lock.json +24 -12
  153. package/src/swift-distribution.ts +103 -4
  154. package/src/swift-host.ts +180 -55
  155. package/src/swift-icu.ts +27 -13
  156. package/src/swift-objc-compile.ts +355 -0
  157. package/src/swift-objc-sdk.ts +821 -27
  158. package/src/swift-objc-standin.ts +148 -14
  159. package/src/swift-package-manifest.ts +60 -7
  160. package/src/swift-package.ts +15 -1
  161. package/src/swift-packages.ts +154 -81
  162. package/src/swift-standin-emit.ts +96 -15
  163. package/src/swift-standins.ts +530 -116
  164. package/src/swift-submit.ts +13 -5
  165. package/src/swift-toolchain.ts +500 -42
  166. package/src/vite-plugin.ts +12 -1
  167. package/src/worker-system-chunks.ts +11 -12
  168. package/src/worklet-executable.ts +19 -1
  169. package/src/xcode-project.ts +270 -30
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1625 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1640 | (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;
@@ -48,6 +48,7 @@ __export(swift_compile_exports, {
48
48
  swiftApplicationEntry: () => swiftApplicationEntry,
49
49
  swiftArtifactHash: () => swiftArtifactHash,
50
50
  swiftAvailableModules: () => swiftAvailableModules,
51
+ swiftCodeMask: () => swiftCodeMask,
51
52
  swiftDistributionAt: () => swiftDistributionAt,
52
53
  swiftIcuAsset: () => swiftIcuAsset,
53
54
  swiftImportNames: () => swiftImportNames,
@@ -56,6 +57,7 @@ __export(swift_compile_exports, {
56
57
  swiftModuleInputFiles: () => swiftModuleInputFiles,
57
58
  swiftModuleSdk: () => swiftModuleSdk,
58
59
  swiftPeachModules: () => swiftPeachModules,
60
+ swiftProjectBuildKey: () => swiftProjectBuildKey,
59
61
  swiftSdkPaths: () => swiftSdkPaths,
60
62
  swiftSourceAsIOS: () => swiftSourceAsIOS,
61
63
  swiftSourceClosure: () => swiftSourceClosure,
@@ -69,7 +71,7 @@ var import_node_child_process4 = require("node:child_process");
69
71
  var import_node_crypto2 = require("node:crypto");
70
72
  var import_node_fs3 = require("node:fs");
71
73
  var import_node_os3 = __toESM(require("node:os"), 1);
72
- var import_node_path4 = __toESM(require("node:path"), 1);
74
+ var import_node_path5 = __toESM(require("node:path"), 1);
73
75
 
74
76
  // src/admitted-mac-build.ts
75
77
  var import_node_child_process = require("node:child_process");
@@ -106,6 +108,16 @@ function rnxHomeDir() {
106
108
  if (override && override.length > 0) return import_node_path.default.resolve(override);
107
109
  return import_node_path.default.join((0, import_node_os.homedir)(), ".peach");
108
110
  }
111
+ function cacheDir() {
112
+ return import_node_path.default.join(rnxHomeDir(), "cache");
113
+ }
114
+ function swiftPackageCacheOptions() {
115
+ const root = import_node_path.default.join(cacheDir(), "swiftpm");
116
+ return ["cache", "config", "security"].flatMap((name) => [
117
+ `--${name}-path`,
118
+ import_node_path.default.join(root, name)
119
+ ]);
120
+ }
109
121
  var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
110
122
 
111
123
  // src/process-group.ts
@@ -116,6 +128,7 @@ var import_node_path2 = require("node:path");
116
128
  var import_promises = require("node:timers/promises");
117
129
  var GRACEFUL_TIMEOUT_MS = 3e3;
118
130
  var FORCED_EXIT_TIMEOUT_MS = 1e3;
131
+ var FREEZE_GUARD_NAME = "process-freeze-guard";
119
132
  function listProcessChildren(parents, timeoutMs = 3e3) {
120
133
  if (parents.some((pid) => !Number.isInteger(pid) || pid <= 1))
121
134
  throw new Error("process inspection requires valid parent pids");
@@ -202,7 +215,7 @@ pid ${rootPid}
202
215
  '
203
216
  if ! IFS= read -r command || [ "$command" != disarm ]; then cleanup; fi
204
217
  `,
205
- "process-freeze-guard",
218
+ FREEZE_GUARD_NAME,
206
219
  journal
207
220
  ],
208
221
  {
@@ -248,6 +261,21 @@ pid ${rootPid}
248
261
  }
249
262
  };
250
263
  }
264
+ function withoutFreezeGuards(pids) {
265
+ if (pids.length === 0) return pids;
266
+ const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,command=", "-p", pids.join(",")], {
267
+ encoding: "utf8",
268
+ stdio: ["ignore", "pipe", "pipe"],
269
+ timeout: FORCED_EXIT_TIMEOUT_MS,
270
+ killSignal: "SIGKILL"
271
+ });
272
+ if (result.error || result.status !== 0 && result.status !== 1)
273
+ throw new Error(result.error?.message || `ps exited ${result.status}`);
274
+ const guards = new Set(
275
+ result.stdout.split("\n").filter((line) => line.includes(FREEZE_GUARD_NAME)).map((line) => Number(line.trim().split(/\s+/)[0]))
276
+ );
277
+ return pids.filter((pid) => !guards.has(pid));
278
+ }
251
279
  function processesHaveExited(pids, pgid) {
252
280
  const mayExist = [-pgid, ...pids].some((target) => {
253
281
  try {
@@ -311,7 +339,7 @@ async function terminateProcessGroup(child, signal = "SIGTERM", gracefulTimeoutM
311
339
  }
312
340
  let children;
313
341
  try {
314
- children = listProcessChildren(parents, remaining);
342
+ children = withoutFreezeGuards(listProcessChildren(parents, remaining));
315
343
  } catch (error) {
316
344
  inspectionError = new Error(`could not inspect descendants: ${String(error)}`);
317
345
  break;
@@ -745,9 +773,9 @@ var EXCERPT = /^(\s*)(\d+)( \| )(.*)$/;
745
773
  var MARKER = /^(\s*)( \| )(.*)$/;
746
774
  function designTimeDiagnostic(output, files) {
747
775
  const rewritten = /* @__PURE__ */ new Map();
748
- const linesOf = (path4) => {
776
+ const linesOf = (path5) => {
749
777
  const file = Object.keys(files).find(
750
- (name) => name.endsWith(".swift") && (path4 === name || path4.endsWith(`/${name}`))
778
+ (name) => name.endsWith(".swift") && (path5 === name || path5.endsWith(`/${name}`))
751
779
  );
752
780
  if (file === void 0) return null;
753
781
  let lines = rewritten.get(file);
@@ -830,9 +858,24 @@ function parseSwiftDistributionManifest(value) {
830
858
  var import_node_child_process3 = require("node:child_process");
831
859
  var import_node_crypto = require("node:crypto");
832
860
  var import_node_fs2 = require("node:fs");
833
- var import_node_path3 = __toESM(require("node:path"), 1);
861
+ var import_node_path4 = __toESM(require("node:path"), 1);
834
862
  var import_node_util = require("node:util");
835
863
  var import_node_zlib = require("node:zlib");
864
+
865
+ // src/swift-toolchain.ts
866
+ var import_node_path3 = __toESM(require("node:path"), 1);
867
+ function swiftSdkOptions() {
868
+ const directory = process.env.PEACH_SWIFT_SDKS_PATH;
869
+ return directory ? ["--swift-sdks-path", import_node_path3.default.resolve(directory)] : [];
870
+ }
871
+ var scratch;
872
+ var swiftHome;
873
+ function swiftEnvironment(base = process.env) {
874
+ if (!scratch) return base;
875
+ return swiftHome ? { ...base, TMPDIR: scratch, HOME: swiftHome } : { ...base, TMPDIR: scratch };
876
+ }
877
+
878
+ // src/swift-icu.ts
836
879
  var run = (0, import_node_util.promisify)(import_node_child_process3.execFile);
837
880
  var deflate = (0, import_node_util.promisify)(import_node_zlib.gzip);
838
881
  var ARCHIVE = "wasi/lib_FoundationICU.a";
@@ -849,32 +892,47 @@ function memo(cache, key, load2) {
849
892
  return pending;
850
893
  }
851
894
  function swiftIcuData(toolchainBin, sdk) {
852
- return memo(raw, `${toolchainBin}\0${sdk}`, () => load(toolchainBin, sdk));
895
+ return memo(
896
+ raw,
897
+ JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]),
898
+ () => load(toolchainBin, sdk)
899
+ );
853
900
  }
854
901
  function swiftIcuAsset(toolchainBin, sdk) {
855
- return memo(assets, `${toolchainBin}\0${sdk}`, async () => {
856
- const zipped = await deflate(await swiftIcuData(toolchainBin, sdk));
857
- return { sha256: (0, import_node_crypto.createHash)("sha256").update(zipped).digest("hex"), gzip: zipped };
858
- });
902
+ return memo(
903
+ assets,
904
+ JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]),
905
+ async () => {
906
+ const zipped = await deflate(await swiftIcuData(toolchainBin, sdk));
907
+ return { sha256: (0, import_node_crypto.createHash)("sha256").update(zipped).digest("hex"), gzip: zipped };
908
+ }
909
+ );
859
910
  }
860
911
  async function load(toolchainBin, sdk) {
861
- const swift = import_node_path3.default.join(toolchainBin, "swift");
912
+ const swift = import_node_path4.default.join(toolchainBin, "swift");
862
913
  if (!(0, import_node_fs2.existsSync)(swift))
863
914
  throw new Error(`swift-icu: no swift at ${swift} for the ${sdk} SDK's icu data`);
864
- const { stdout: listed } = await run(swift, ["sdk", "list"]);
915
+ const { stdout: listed } = await run(swift, ["sdk", "list", ...swiftSdkOptions()], {
916
+ env: swiftEnvironment()
917
+ });
865
918
  if (!listed.split("\n").some((line) => line.trim() === sdk))
866
919
  throw new Error(`swift-icu: ${sdk} is not installed for ${swift}`);
867
- const { stdout } = await run(swift, [
868
- "sdk",
869
- "configure",
870
- "--show-configuration",
871
- sdk,
872
- "wasm32-unknown-wasip1"
873
- ]);
920
+ const { stdout } = await run(
921
+ swift,
922
+ [
923
+ "sdk",
924
+ "configure",
925
+ ...swiftSdkOptions(),
926
+ "--show-configuration",
927
+ sdk,
928
+ "wasm32-unknown-wasip1"
929
+ ],
930
+ { env: swiftEnvironment() }
931
+ );
874
932
  const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
875
933
  if (!resources) throw new Error(`swift-icu: ${sdk} names no static resources`);
876
934
  return Buffer.from(
877
- icuSegment(archiveMember((0, import_node_fs2.readFileSync)(import_node_path3.default.join(resources, ARCHIVE)), MEMBER))
935
+ icuSegment(archiveMember((0, import_node_fs2.readFileSync)(import_node_path4.default.join(resources, ARCHIVE)), MEMBER))
878
936
  );
879
937
  }
880
938
  function archiveMember(archive, name) {
@@ -1030,7 +1088,11 @@ function swiftTargetModuleName(name) {
1030
1088
  function swiftManifestTargets(manifest, resourcePaths = []) {
1031
1089
  const implicitResources = swiftImplicitResourcePaths(resourcePaths);
1032
1090
  const targets = [];
1033
- const declarations = manifestCalls(manifest, ["executableTarget", "target"]);
1091
+ const declarations = manifestCalls(manifest, [
1092
+ "executableTarget",
1093
+ "target",
1094
+ "systemLibrary"
1095
+ ]);
1034
1096
  const targetNames = new Set(
1035
1097
  declarations.flatMap(({ flat }) => {
1036
1098
  const name = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
@@ -1053,6 +1115,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
1053
1115
  const defines = [
1054
1116
  ...call.matchAll(/\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*\)/g)
1055
1117
  ].map((match) => match[1]);
1118
+ const linkedLibraries = [...call.matchAll(/\.linkedLibrary\(\s*"([^"]+)"\s*\)/g)].map(
1119
+ (match) => match[1]
1120
+ );
1056
1121
  const excluded = [
1057
1122
  ...(/\bexclude\s*:\s*\[([^\]]*)\]/.exec(flat)?.[1] ?? "").matchAll(/"([^"]+)"/g)
1058
1123
  ].map((match) => match[1].replace(/^\.\//, "").replace(/\/+$/, ""));
@@ -1087,10 +1152,12 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
1087
1152
  name,
1088
1153
  path: targetPath,
1089
1154
  executable,
1155
+ ...kind === "systemLibrary" ? { systemLibrary: true } : {},
1090
1156
  languageMode,
1091
1157
  mainActorIsolation,
1092
1158
  ...cxxInterop ? { cxxInterop: true } : {},
1093
1159
  ...defines.length === 0 ? {} : { defines },
1160
+ ...linkedLibraries.length === 0 ? {} : { linkedLibraries },
1094
1161
  resources,
1095
1162
  ...dependencies.length === 0 ? {} : { dependencies },
1096
1163
  ...excluded.length === 0 ? {} : { exclude: excluded }
@@ -1106,7 +1173,7 @@ function swiftManifestCxxLanguageStandard(manifest) {
1106
1173
  }
1107
1174
  function swiftPackagePartition(manifest, resourcePaths = []) {
1108
1175
  const targets = swiftManifestTargets(manifest, resourcePaths);
1109
- return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
1176
+ 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;
1110
1177
  }
1111
1178
 
1112
1179
  // src/swiftContract.ts
@@ -1123,12 +1190,12 @@ function isSwiftResourceBundles(value) {
1123
1190
  }
1124
1191
 
1125
1192
  // src/swift-compile.ts
1126
- async function runCompiler(command, args, options, stream = false) {
1193
+ async function runCompiler(command, args, options, stream = false, quiet) {
1127
1194
  const { signal } = options;
1128
1195
  signal?.throwIfAborted();
1129
1196
  const child = (0, import_node_child_process4.spawn)(command, args, {
1130
1197
  cwd: options.cwd,
1131
- env: options.env,
1198
+ env: swiftEnvironment(options.env),
1132
1199
  detached: true,
1133
1200
  stdio: ["ignore", "pipe", "pipe"]
1134
1201
  });
@@ -1139,6 +1206,7 @@ async function runCompiler(command, args, options, stream = false) {
1139
1206
  let timeout;
1140
1207
  const chunks = { stdout: [], stderr: [] };
1141
1208
  const sizes = { stdout: 0, stderr: 0 };
1209
+ const partial = { stdout: "", stderr: "" };
1142
1210
  const stop = () => {
1143
1211
  stopping ??= terminateProcessGroup(child);
1144
1212
  void stopping.catch(() => {
@@ -1146,7 +1214,14 @@ async function runCompiler(command, args, options, stream = false) {
1146
1214
  };
1147
1215
  for (const name of ["stdout", "stderr"]) {
1148
1216
  child[name].on("data", (bytes) => {
1149
- if (stream) process[name].write(bytes);
1217
+ if (stream === true) process[name].write(bytes);
1218
+ else if (stream) {
1219
+ const lines = (partial[name] + bytes.toString()).split("\n");
1220
+ partial[name] = lines.pop();
1221
+ for (const line of lines)
1222
+ if (stream.test(line)) process[name].write(`${line}
1223
+ `);
1224
+ }
1150
1225
  sizes[name] += bytes.length;
1151
1226
  if (sizes[name] <= (options.maxBuffer ?? 1024 * 1024)) chunks[name].push(bytes);
1152
1227
  else {
@@ -1176,7 +1251,15 @@ async function runCompiler(command, args, options, stream = false) {
1176
1251
  }
1177
1252
  )
1178
1253
  );
1179
- else resolve();
1254
+ else {
1255
+ if (quiet) {
1256
+ for (const name of ["stdout", "stderr"])
1257
+ for (const line of Buffer.concat(chunks[name]).toString().split("\n"))
1258
+ if (line && !quiet.test(line)) process[name].write(`${line}
1259
+ `);
1260
+ }
1261
+ resolve();
1262
+ }
1180
1263
  });
1181
1264
  if (options.timeout)
1182
1265
  timeout = setTimeout(() => {
@@ -1190,16 +1273,18 @@ async function runCompiler(command, args, options, stream = false) {
1190
1273
  }
1191
1274
  }
1192
1275
  var WASM_TRIPLE = "wasm32-unknown-wasip1";
1276
+ var SWIFTPM_PROGRESS = /^\[\d+\/\d+\] /;
1277
+ var SWIFTPM_NOISE = /^(?:\[\d+\/\d+\] |Building for production\.\.\.$|warning: '--build-system native' has been deprecated)/;
1193
1278
  var BUILD_JOBS = String(
1194
1279
  Math.min(4, Math.max(1, Math.floor(import_node_os3.default.availableParallelism() / 2)))
1195
1280
  );
1196
1281
  function swiftDistributionAt(root) {
1197
- const file = import_node_path4.default.join(root, SWIFT_DISTRIBUTION_MANIFEST);
1282
+ const file = import_node_path5.default.join(root, SWIFT_DISTRIBUTION_MANIFEST);
1198
1283
  if (!(0, import_node_fs3.existsSync)(file)) return null;
1199
1284
  return parseSwiftDistributionManifest(JSON.parse((0, import_node_fs3.readFileSync)(file, "utf8")));
1200
1285
  }
1201
1286
  function swiftModuleSdk(root) {
1202
- const pin = swiftDistributionAt(root) ?? JSON.parse((0, import_node_fs3.readFileSync)(import_node_path4.default.join(root, "toolchain.json"), "utf8"));
1287
+ const pin = swiftDistributionAt(root) ?? JSON.parse((0, import_node_fs3.readFileSync)(import_node_path5.default.join(root, "toolchain.json"), "utf8"));
1203
1288
  if (!pin || typeof pin !== "object" || typeof Reflect.get(pin, "wasmSdkId") !== "string" || typeof Reflect.get(pin, "wasmSdkUrl") !== "string" || typeof Reflect.get(pin, "wasmSdkChecksum") !== "string")
1204
1289
  throw new Error(`${root} pins no wasm SDK id, url and checksum`);
1205
1290
  return {
@@ -1215,13 +1300,17 @@ function swiftModuleInputFiles(root) {
1215
1300
  "scripts/contrast-app-Package.swift",
1216
1301
  "scripts/build-distribution.ts",
1217
1302
  "scripts/distribution-clang.ts",
1303
+ "scripts/distribution-libxml2.ts",
1304
+ "scripts/distribution-libxml2.json",
1305
+ "Sources/libxml2/include/module.modulemap",
1306
+ "Sources/libxml2/COPYING",
1218
1307
  "scripts/build-distribution-plugins.sh",
1219
1308
  "scripts/build-distribution-plugins-docker.sh",
1220
1309
  "scripts/build-preview-plugin.sh",
1221
1310
  "toolchain.json"
1222
1311
  ];
1223
1312
  const walk = (dir) => {
1224
- for (const entry of (0, import_node_fs3.readdirSync)(import_node_path4.default.join(root, dir), {
1313
+ for (const entry of (0, import_node_fs3.readdirSync)(import_node_path5.default.join(root, dir), {
1225
1314
  withFileTypes: true
1226
1315
  })) {
1227
1316
  const relative = `${dir}/${entry.name}`;
@@ -1239,29 +1328,39 @@ function swiftMacroPlugins(moduleRoot) {
1239
1328
  const distribution = swiftDistributionAt(moduleRoot);
1240
1329
  if (distribution)
1241
1330
  return {
1242
- libraries: distribution.plugins.map((plugin) => import_node_path4.default.join(moduleRoot, plugin)),
1331
+ libraries: distribution.plugins.map((plugin) => import_node_path5.default.join(moduleRoot, plugin)),
1243
1332
  stale: false
1244
1333
  };
1245
- const dir = import_node_path4.default.join(moduleRoot, ".build/host/RnxPreviewMacros");
1334
+ const dir = import_node_path5.default.join(moduleRoot, ".build/host/RnxPreviewMacros");
1246
1335
  const release = JSON.parse(
1247
- (0, import_node_fs3.readFileSync)(import_node_path4.default.join(moduleRoot, "toolchain.json"), "utf8")
1336
+ (0, import_node_fs3.readFileSync)(import_node_path5.default.join(moduleRoot, "toolchain.json"), "utf8")
1248
1337
  ).release;
1249
- const compilerStamp = import_node_path4.default.join(dir, "compiler-release");
1338
+ const compilerStamp = import_node_path5.default.join(dir, "compiler-release");
1250
1339
  const ext = process.platform === "darwin" ? "dylib" : "so";
1251
1340
  const plugins = [
1252
1341
  {
1253
- library: import_node_path4.default.join(dir, `libRnxPreviewMacros.${ext}`),
1254
- source: import_node_path4.default.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")
1342
+ library: import_node_path5.default.join(dir, `libRnxPreviewMacros.${ext}`),
1343
+ sources: [import_node_path5.default.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")]
1344
+ },
1345
+ {
1346
+ library: import_node_path5.default.join(dir, `libFoundationMacros.${ext}`),
1347
+ sources: [
1348
+ import_node_path5.default.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift"),
1349
+ import_node_path5.default.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
1350
+ ]
1255
1351
  },
1256
1352
  {
1257
- library: import_node_path4.default.join(dir, `libFoundationMacros.${ext}`),
1258
- source: import_node_path4.default.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift")
1353
+ library: import_node_path5.default.join(dir, `libTipKitMacros.${ext}`),
1354
+ sources: [
1355
+ import_node_path5.default.join(moduleRoot, "Sources/TipKitMacros/TipKitMacros.swift"),
1356
+ import_node_path5.default.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
1357
+ ]
1259
1358
  }
1260
1359
  ];
1261
1360
  return {
1262
1361
  libraries: plugins.map(({ library }) => library),
1263
1362
  stale: !(0, import_node_fs3.existsSync)(compilerStamp) || (0, import_node_fs3.readFileSync)(compilerStamp, "utf8").trim() !== release || plugins.some(
1264
- ({ library, source }) => !(0, import_node_fs3.existsSync)(library) || (0, import_node_fs3.statSync)(source).mtimeMs > (0, import_node_fs3.statSync)(library).mtimeMs
1363
+ ({ library, sources }) => !(0, import_node_fs3.existsSync)(library) || sources.some((source) => (0, import_node_fs3.statSync)(source).mtimeMs > (0, import_node_fs3.statSync)(library).mtimeMs)
1265
1364
  )
1266
1365
  };
1267
1366
  }
@@ -1271,14 +1370,14 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal) {
1271
1370
  await runCompiler(
1272
1371
  "sh",
1273
1372
  [
1274
- import_node_path4.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
1373
+ import_node_path5.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
1275
1374
  toolchainBin,
1276
1375
  libraries[0]
1277
1376
  ],
1278
1377
  { signal }
1279
1378
  );
1280
1379
  (0, import_node_fs3.writeFileSync)(
1281
- import_node_path4.default.join(import_node_path4.default.dirname(libraries[0]), "compiler-release"),
1380
+ import_node_path5.default.join(import_node_path5.default.dirname(libraries[0]), "compiler-release"),
1282
1381
  `${release}
1283
1382
  `
1284
1383
  );
@@ -1294,7 +1393,7 @@ function swiftModuleDigest(root) {
1294
1393
  const files = swiftModuleInputFiles(root);
1295
1394
  const stampHash = (0, import_node_crypto2.createHash)("sha256");
1296
1395
  for (const file of files) {
1297
- const stat = (0, import_node_fs3.statSync)(import_node_path4.default.join(root, file), { bigint: true });
1396
+ const stat = (0, import_node_fs3.statSync)(import_node_path5.default.join(root, file), { bigint: true });
1298
1397
  stampHash.update(file);
1299
1398
  stampHash.update(
1300
1399
  `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}
@@ -1308,13 +1407,16 @@ function swiftModuleDigest(root) {
1308
1407
  for (const file of files) {
1309
1408
  hash.update((0, import_node_crypto2.createHash)("sha256").update(file).digest());
1310
1409
  hash.update(
1311
- (0, import_node_crypto2.createHash)("sha256").update((0, import_node_fs3.readFileSync)(import_node_path4.default.join(root, file))).digest()
1410
+ (0, import_node_crypto2.createHash)("sha256").update((0, import_node_fs3.readFileSync)(import_node_path5.default.join(root, file))).digest()
1312
1411
  );
1313
1412
  }
1314
1413
  const digest = hash.digest();
1315
1414
  linkedModuleDigests.set(root, { stamp, digest });
1316
1415
  return digest;
1317
1416
  }
1417
+ function swiftProjectBuildKey(moduleRoot, release) {
1418
+ return (0, import_node_crypto2.createHash)("sha256").update(`${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).update(swiftModuleDigest(moduleRoot)).digest("hex").slice(0, 32);
1419
+ }
1318
1420
  function compileTargets(input) {
1319
1421
  const manifest = input.files["Package.swift"];
1320
1422
  return manifest === void 0 ? [] : swiftPackagePartition(manifest, input.resourcePaths);
@@ -1329,7 +1431,7 @@ function withNativeSourceGlue(input, glue) {
1329
1431
  ...input,
1330
1432
  files: {
1331
1433
  ...input.files,
1332
- [import_node_path4.default.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
1434
+ [import_node_path5.default.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
1333
1435
  },
1334
1436
  oneModule: true
1335
1437
  };
@@ -1337,21 +1439,24 @@ function withNativeSourceGlue(input, glue) {
1337
1439
  var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
1338
1440
  GameplayKit: [],
1339
1441
  simd: [],
1340
- GLKit: [],
1442
+ ModelIO: ["simd"],
1443
+ GLKit: ["ModelIO"],
1341
1444
  Accelerate: [],
1342
1445
  CryptoKit: [],
1343
1446
  CommonCrypto: [],
1447
+ ImagePlayground: [],
1448
+ QuickLookThumbnailing: [],
1449
+ libxml2: [],
1344
1450
  CoreText: [],
1345
1451
  Compression: ["PeachCodec"],
1346
1452
  zlib: ["PeachCodec"],
1347
1453
  PeachCodec: [],
1348
- Security: ["CryptoKit"],
1349
1454
  TikTokBusinessSDK: [],
1350
1455
  nSure: [],
1351
1456
  Statsig: [],
1352
1457
  TOCropViewController: [],
1353
1458
  RiveRuntime: ["MetalKit"],
1354
- MetalKit: [],
1459
+ MetalKit: ["ModelIO"],
1355
1460
  DatadogCore: [],
1356
1461
  DatadogLogs: ["DatadogCore"],
1357
1462
  DatadogRUM: ["DatadogCore"],
@@ -1451,7 +1556,7 @@ function swiftImportNames(contents, available) {
1451
1556
  function swiftPeachModules(moduleRoot) {
1452
1557
  const distribution = swiftDistributionAt(moduleRoot);
1453
1558
  return distribution ? distribution.modules : [
1454
- ...(0, import_node_fs3.readFileSync)(import_node_path4.default.join(moduleRoot, "Package.swift"), "utf8").matchAll(
1559
+ ...(0, import_node_fs3.readFileSync)(import_node_path5.default.join(moduleRoot, "Package.swift"), "utf8").matchAll(
1455
1560
  /\.(?:target|systemLibrary)\(\s*name:\s*"([^"]+)"/g
1456
1561
  )
1457
1562
  ].map((match) => match[1]);
@@ -1459,13 +1564,20 @@ function swiftPeachModules(moduleRoot) {
1459
1564
  var sdkPaths = /* @__PURE__ */ new Map();
1460
1565
  function swiftSdkPaths(moduleRoot, toolchainBin) {
1461
1566
  const sdk = swiftModuleSdk(moduleRoot).wasmSdkId;
1462
- const key = `${toolchainBin}\0${sdk}`;
1567
+ const key = JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]);
1463
1568
  const cached = sdkPaths.get(key);
1464
1569
  if (cached) return cached;
1465
1570
  const configuration = (0, import_node_child_process4.execFileSync)(
1466
- import_node_path4.default.join(toolchainBin, "swift"),
1467
- ["sdk", "configure", "--show-configuration", sdk, "wasm32-unknown-wasip1"],
1468
- { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
1571
+ import_node_path5.default.join(toolchainBin, "swift"),
1572
+ [
1573
+ "sdk",
1574
+ "configure",
1575
+ ...swiftSdkOptions(),
1576
+ "--show-configuration",
1577
+ sdk,
1578
+ "wasm32-unknown-wasip1"
1579
+ ],
1580
+ { encoding: "utf8", env: swiftEnvironment(), stdio: ["ignore", "pipe", "pipe"] }
1469
1581
  );
1470
1582
  const field = (name) => {
1471
1583
  const value = new RegExp(`^${name}:\\s*(.+)$`, "m").exec(configuration)?.[1]?.trim();
@@ -1482,17 +1594,17 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
1482
1594
  var availableModules = /* @__PURE__ */ new Map();
1483
1595
  function swiftAvailableModules(moduleRoot, toolchainBin) {
1484
1596
  const sdk = swiftModuleSdk(moduleRoot).wasmSdkId;
1485
- const key = `${moduleRoot}\0${sdk}`;
1597
+ const key = JSON.stringify([moduleRoot, sdk, swiftSdkOptions()]);
1486
1598
  const cached = availableModules.get(key);
1487
1599
  if (cached) return cached;
1488
1600
  const modules = new Set(swiftPeachModules(moduleRoot));
1489
1601
  const { resources } = swiftSdkPaths(moduleRoot, toolchainBin);
1490
- for (const entry of (0, import_node_fs3.readdirSync)(import_node_path4.default.join(resources, "wasi"))) {
1602
+ for (const entry of (0, import_node_fs3.readdirSync)(import_node_path5.default.join(resources, "wasi"))) {
1491
1603
  if (entry.endsWith(".swiftmodule"))
1492
1604
  modules.add(entry.slice(0, -".swiftmodule".length));
1493
1605
  }
1494
1606
  for (const entry of (0, import_node_fs3.readdirSync)(resources)) {
1495
- const map = import_node_path4.default.join(resources, entry, "module.modulemap");
1607
+ const map = import_node_path5.default.join(resources, entry, "module.modulemap");
1496
1608
  if (!(0, import_node_fs3.existsSync)(map)) continue;
1497
1609
  for (const match of (0, import_node_fs3.readFileSync)(map, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
1498
1610
  modules.add(match[1]);
@@ -1557,12 +1669,14 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
1557
1669
  "-Xlinker", "--global-base=8372224",
1558
1670
  `;
1559
1671
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
1560
- var MULTI_MANIFEST_VERSION = 38;
1672
+ var MULTI_MANIFEST_VERSION = 39;
1673
+ var compilerSourceDigest = true ? "0c614fef8e4e656ac3500002f7d1f2746f20f462321142e2f69a93e94f2321c4" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
1561
1674
  function swiftArtifactHash(input, release, moduleRoot) {
1562
1675
  const hash = (0, import_node_crypto2.createHash)("sha256");
1563
- hash.update(`swift-compile/v49
1676
+ hash.update(`swift-compile
1564
1677
  ${release}
1565
1678
  `);
1679
+ hash.update(compilerSourceDigest);
1566
1680
  if (input.oneModule) hash.update("one-module\n");
1567
1681
  hash.update(swiftModuleDigest(moduleRoot));
1568
1682
  for (const file of Object.keys(input.files).sort()) {
@@ -1623,14 +1737,18 @@ ${target}
1623
1737
  }
1624
1738
  function emitSwiftPackageManifest(args) {
1625
1739
  const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
1626
- const reachedFrameworks = new Set(
1627
- [...siblings.values()].flat().filter(
1628
- (name) => OPTIONAL_FRAMEWORKS.has(name) && !targets.some((target) => target.name === name)
1629
- ).flatMap((name) => [name, ...OPTIONAL_FRAMEWORK_DEPENDENCIES[name] ?? []])
1630
- );
1740
+ const reachedFrameworks = /* @__PURE__ */ new Set();
1741
+ const reach = (name) => {
1742
+ if (reachedFrameworks.has(name)) return;
1743
+ reachedFrameworks.add(name);
1744
+ for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[name] ?? [])
1745
+ reach(dependency);
1746
+ };
1747
+ for (const name of [...siblings.values()].flat())
1748
+ if (OPTIONAL_FRAMEWORKS.has(name) && !targets.some((target) => target.name === name))
1749
+ reach(name);
1631
1750
  if (spriteKit) {
1632
- reachedFrameworks.add("SpriteKit");
1633
- reachedFrameworks.add("PeachBox2D");
1751
+ for (const name of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name);
1634
1752
  }
1635
1753
  const distributionLink = args.distributionLink;
1636
1754
  if (distribution && !distributionLink)
@@ -1646,11 +1764,11 @@ function emitSwiftPackageManifest(args) {
1646
1764
  distributionLink.files.set(
1647
1765
  distributionLink.path,
1648
1766
  objects.map(
1649
- (object) => `"${import_node_path4.default.join(moduleRoot, object).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`
1767
+ (object) => `"${import_node_path5.default.join(moduleRoot, object).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`
1650
1768
  ).join("\n") + "\n"
1651
1769
  );
1652
1770
  }
1653
- const overlayRoot = import_node_path4.default.join(
1771
+ const overlayRoot = import_node_path5.default.join(
1654
1772
  moduleRoot,
1655
1773
  distribution ? "modules" : "cross-import-overlays"
1656
1774
  );
@@ -1658,24 +1776,26 @@ function emitSwiftPackageManifest(args) {
1658
1776
  "-Xfrontend",
1659
1777
  "-swift-module-cross-import",
1660
1778
  "-Xfrontend",
1661
- import_node_path4.default.basename(import_node_path4.default.dirname(file), ".swiftcrossimport"),
1779
+ import_node_path5.default.basename(import_node_path5.default.dirname(file), ".swiftcrossimport"),
1662
1780
  "-Xfrontend",
1663
- import_node_path4.default.join(overlayRoot, file)
1781
+ import_node_path5.default.join(overlayRoot, file)
1664
1782
  ]).map((flag) => `, ${JSON.stringify(flag)}`).join("");
1665
1783
  const executable = targets.find((target) => target.executable);
1666
1784
  if (!executable) throw new Error("swift-compile: no executable target to emit");
1667
1785
  const stanza = (target) => {
1786
+ if (target.systemLibrary)
1787
+ return ` .systemLibrary(name: ${JSON.stringify(target.name)}, path: ${JSON.stringify(target.path)}),`;
1668
1788
  const isolation = target.mainActorIsolation ? " .defaultIsolation(MainActor.self)," : "";
1669
1789
  const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
1670
1790
  const defines = (target.defines ?? []).map((name) => ` .define(${JSON.stringify(name)}),`).join("");
1671
- const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path4.default.join(moduleRoot, "modules"))}` : "";
1791
+ const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path5.default.join(moduleRoot, "modules"))}` : "";
1672
1792
  const native = args.native?.get(target.name);
1673
1793
  const nativeImports = (siblings.get(target.name) ?? []).filter((name) => args.native?.has(name)).map(
1674
1794
  (name) => `, "-Xfrontend", "-import-module", "-Xfrontend", ${JSON.stringify(swiftTargetModuleName(name))}`
1675
1795
  ).join("");
1676
1796
  const header = args.headerDirectory && [...args.native?.values() ?? []].some(
1677
1797
  (value) => value.late?.producers.includes(target.name)
1678
- ) ? `, "-emit-objc-header-path", ${JSON.stringify(import_node_path4.default.join(args.headerDirectory, `${target.name}-Swift.h`))}` : "";
1798
+ ) ? `, "-emit-objc-header-path", ${JSON.stringify(import_node_path5.default.join(args.headerDirectory, `${target.name}-Swift.h`))}` : "";
1679
1799
  const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${header}])]`;
1680
1800
  const deps = [
1681
1801
  ...target.executable ? [...args.native?.values() ?? []].flatMap(
@@ -1692,14 +1812,22 @@ function emitSwiftPackageManifest(args) {
1692
1812
  ].join(", ");
1693
1813
  const library = distribution && distributionLink ? ["-Xlinker", `@${distributionLink.path}`, ...distribution.link].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
1694
1814
  const kind = target.executable ? ".executableTarget" : ".target";
1815
+ const linkedLibraries = (target.linkedLibraries ?? []).map(
1816
+ (name) => `.linkedLibrary(${JSON.stringify(name)})`
1817
+ );
1818
+ const librarySettings = [
1819
+ ...linkedLibraries,
1820
+ ...args.libraries?.has(target.name) ? [`.unsafeFlags([${JSON.stringify(args.libraries.get(target.name))}])`] : []
1821
+ ];
1695
1822
  const link = target.executable ? `,
1696
1823
  linkerSettings: [
1824
+ ${linkedLibraries.map((setting) => `${setting},`).join("\n ")}
1697
1825
  .unsafeFlags([
1698
1826
  ${REACTOR_FLAG}${EXECUTABLE_LINK_FLAGS} "-Xlinker", "--export-if-defined=__main_argc_argv"${library},
1699
1827
  ]),
1700
1828
  .unsafeFlags(["-Xlinker", "--strip-all"], .when(configuration: .release)),
1701
- ]` : args.libraries?.has(target.name) ? `,
1702
- linkerSettings: [.unsafeFlags([${JSON.stringify(args.libraries.get(target.name))}])]` : "";
1829
+ ]` : librarySettings.length > 0 ? `,
1830
+ linkerSettings: [${librarySettings.join(", ")}]` : "";
1703
1831
  return [
1704
1832
  ` ${kind}(`,
1705
1833
  ` name: "${target.name}",`,
@@ -1743,7 +1871,7 @@ function syncSwiftTree(base, files) {
1743
1871
  (0, import_node_fs3.mkdirSync)(base, { recursive: true });
1744
1872
  const walk = (dir) => {
1745
1873
  for (const entry of (0, import_node_fs3.readdirSync)(dir, { withFileTypes: true })) {
1746
- const full = import_node_path4.default.join(dir, entry.name);
1874
+ const full = import_node_path5.default.join(dir, entry.name);
1747
1875
  if (dir === base && entry.name === ".build") continue;
1748
1876
  if (entry.isDirectory()) walk(full);
1749
1877
  else if (!files.has(full)) (0, import_node_fs3.rmSync)(full, { force: true });
@@ -1753,12 +1881,12 @@ function syncSwiftTree(base, files) {
1753
1881
  for (const [full, contents] of files) {
1754
1882
  if ((0, import_node_fs3.existsSync)(full) && (typeof contents === "string" ? (0, import_node_fs3.readFileSync)(full, "utf8") === contents : (0, import_node_fs3.readFileSync)(full).equals(contents)))
1755
1883
  continue;
1756
- (0, import_node_fs3.mkdirSync)(import_node_path4.default.dirname(full), { recursive: true });
1884
+ (0, import_node_fs3.mkdirSync)(import_node_path5.default.dirname(full), { recursive: true });
1757
1885
  (0, import_node_fs3.writeFileSync)(full, contents);
1758
1886
  }
1759
1887
  }
1760
1888
  var DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
1761
- var OS_IOS = /\bos\(\s*iOS\s*\)/g;
1889
+ var OS_IOS = /\b(?:os\(\s*iOS\s*\)|targetEnvironment\(\s*simulator\s*\))/g;
1762
1890
  var OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
1763
1891
  var SELECTOR = /^#selector\b/;
1764
1892
  var PROTOCOL_NAME = /^\s+[A-Za-z_]\w*(\s*:)?/;
@@ -2177,19 +2305,24 @@ function objcRootedClasses(sources) {
2177
2305
  function hideObjCClassesFromCxx(source, rooted) {
2178
2306
  if (rooted.size === 0) return source;
2179
2307
  const code = swiftCodeMask(source);
2180
- const starts = [];
2308
+ const insertions = [];
2181
2309
  let depth = 0;
2182
2310
  for (const match of code.matchAll(
2183
2311
  /[{}]|\bclass\s+(?!(?:func|var|let|subscript)\b)([A-Za-z_]\w*)/g
2184
2312
  )) {
2185
2313
  if (match[0] === "{") depth++;
2186
2314
  else if (match[0] === "}") depth--;
2187
- else if (depth === 0 && rooted.has(match[1]))
2188
- starts.push(declarationStart(code, match.index, 0));
2315
+ else if (depth === 0 && rooted.has(match[1])) {
2316
+ const start = declarationStart(code, match.index, 0);
2317
+ const main = /@main\b/.exec(code.slice(start, match.index));
2318
+ insertions.push(
2319
+ main ? { at: start + main.index + main[0].length, text: " @_expose(!Cxx)" } : { at: start, text: "@_expose(!Cxx) " }
2320
+ );
2321
+ }
2189
2322
  }
2190
2323
  let out = source;
2191
- for (const at of starts.reverse())
2192
- out = `${out.slice(0, at)}@_expose(!Cxx) ${out.slice(at)}`;
2324
+ for (const { at, text: text2 } of insertions.reverse())
2325
+ out = `${out.slice(0, at)}${text2}${out.slice(at)}`;
2193
2326
  return out;
2194
2327
  }
2195
2328
  function lowerAnyObjectDoubleValue(source) {
@@ -4554,6 +4687,694 @@ function swiftCodeMask(source) {
4554
4687
  scanCode(0, false);
4555
4688
  return chars.join("");
4556
4689
  }
4690
+ var FOUNDATION_NETWORKING_TYPES = /* @__PURE__ */ new Set([
4691
+ "CachedURLResponse",
4692
+ "HTTPCookieStorage",
4693
+ "HTTPURLResponse",
4694
+ "NSMutableURLRequest",
4695
+ "NSURLConnection",
4696
+ "NSURLConnectionDataDelegate",
4697
+ "NSURLConnectionDelegate",
4698
+ "NSURLConnectionDownloadDelegate",
4699
+ "URLAuthenticationChallenge",
4700
+ "URLAuthenticationChallengeSender",
4701
+ "URLCache",
4702
+ "URLCredential",
4703
+ "URLCredentialStorage",
4704
+ "URLProtectionSpace",
4705
+ "URLProtocol",
4706
+ "URLProtocolClient",
4707
+ "URLRequest",
4708
+ "URLResponse",
4709
+ "URLSession",
4710
+ "URLSessionConfiguration",
4711
+ "URLSessionDataDelegate",
4712
+ "URLSessionDataTask",
4713
+ "URLSessionDelegate",
4714
+ "URLSessionDownloadDelegate",
4715
+ "URLSessionDownloadTask",
4716
+ "URLSessionStreamDelegate",
4717
+ "URLSessionStreamTask",
4718
+ "URLSessionTask",
4719
+ "URLSessionTaskDelegate",
4720
+ "URLSessionTaskMetrics",
4721
+ "URLSessionTaskTransactionMetrics",
4722
+ "URLSessionUploadTask",
4723
+ "URLSessionWebSocketDelegate",
4724
+ "URLSessionWebSocketTask"
4725
+ ]);
4726
+ var FOUNDATION_OVERLAY_TYPES = /* @__PURE__ */ new Set([
4727
+ "AsyncCharacterSequence",
4728
+ "AsyncLineSequence",
4729
+ "AsyncUnicodeScalarSequence",
4730
+ "BlockOperation",
4731
+ "DateComponentsFormatter",
4732
+ "ErrorUserInfoKey",
4733
+ "FileWrapper",
4734
+ "HTTPCookie",
4735
+ "HTTPCookiePropertyKey",
4736
+ "HTTPCookieStringPolicy",
4737
+ "InlinePresentationIntent",
4738
+ "ListFormatter",
4739
+ "LocalizedStringResource",
4740
+ "MachError",
4741
+ "MeasurementFormatUnitUsage",
4742
+ "MeasurementFormatter",
4743
+ "MessagePort",
4744
+ "NSAssertionHandler",
4745
+ "NSAttributedStringFormattingContextKey",
4746
+ "NSBundleResourceRequest",
4747
+ "NSCollectionChangeType",
4748
+ "NSConditionLock",
4749
+ "NSDataDetector",
4750
+ "NSException",
4751
+ "NSExtensionContext",
4752
+ "NSExtensionItem",
4753
+ "NSExtensionRequestHandling",
4754
+ "NSFastEnumerationIterator",
4755
+ "NSFastEnumerationState",
4756
+ "NSFileAccessIntent",
4757
+ "NSFileCoordinator",
4758
+ "NSFileManagerResumeSyncBehavior",
4759
+ "NSFileManagerSupportedSyncControls",
4760
+ "NSFileManagerUploadLocalVersionConflictPolicy",
4761
+ "NSFileProviderService",
4762
+ "NSFileProviderServiceName",
4763
+ "NSFileSecurity",
4764
+ "NSFileVersion",
4765
+ "NSGrammaticalCase",
4766
+ "NSGrammaticalDefiniteness",
4767
+ "NSGrammaticalDetermination",
4768
+ "NSGrammaticalGender",
4769
+ "NSGrammaticalNumber",
4770
+ "NSGrammaticalPartOfSpeech",
4771
+ "NSGrammaticalPerson",
4772
+ "NSGrammaticalPronounType",
4773
+ "NSHashEnumerator",
4774
+ "NSHashTable",
4775
+ "NSHashTableCallBacks",
4776
+ "NSItemProvider",
4777
+ "NSItemProviderFileOptions",
4778
+ "NSItemProviderRepresentationVisibility",
4779
+ "NSKeyValueOperator",
4780
+ "NSKeyValueSetMutationKind",
4781
+ "NSKeyValueSharedObservers",
4782
+ "NSLinguisticTag",
4783
+ "NSLinguisticTagScheme",
4784
+ "NSLinguisticTagger",
4785
+ "NSLinguisticTaggerUnit",
4786
+ "NSMachPort",
4787
+ "NSMapEnumerator",
4788
+ "NSMapTable",
4789
+ "NSMapTableKeyCallBacks",
4790
+ "NSMapTableValueCallBacks",
4791
+ "NSMetadataItem",
4792
+ "NSMetadataQuery",
4793
+ "NSMetadataQueryAttributeValueTuple",
4794
+ "NSMetadataQueryDelegate",
4795
+ "NSMetadataQueryResultGroup",
4796
+ "NSOrderedCollectionChange",
4797
+ "NSOrderedCollectionDifference",
4798
+ "NSOrderedCollectionDifferenceCalculationOptions",
4799
+ "NSPointerArray",
4800
+ "NSPointerFunctions",
4801
+ "NSPredicateValidating",
4802
+ "NSProxy",
4803
+ "NSPurgeableData",
4804
+ "NSSecureUnarchiveFromDataTransformer",
4805
+ "NSSwappedDouble",
4806
+ "NSSwappedFloat",
4807
+ "NSURLRequest",
4808
+ "NSUbiquitousKeyValueStore",
4809
+ "NSUserActivity",
4810
+ "NSUserActivityDelegate",
4811
+ "NSValueTransformerName",
4812
+ "NSXPCCoder",
4813
+ "NSXPCConnection",
4814
+ "NSXPCInterface",
4815
+ "NSXPCListener",
4816
+ "NSXPCListenerDelegate",
4817
+ "NSXPCListenerEndpoint",
4818
+ "NetService",
4819
+ "NetServiceBrowser",
4820
+ "NetServiceBrowserDelegate",
4821
+ "NetServiceDelegate",
4822
+ "NotificationQueue",
4823
+ "Operation",
4824
+ "OperationQueue",
4825
+ "PredicateCodableConfiguration",
4826
+ "PresentationIntent",
4827
+ "Progress",
4828
+ "ProgressKind",
4829
+ "ProgressUserInfoKey",
4830
+ "RelativeDateTimeFormatter",
4831
+ "SocketPort",
4832
+ "StringEncodingDetectionOptionsKey",
4833
+ "TermOfAddress",
4834
+ "URLFileProtection",
4835
+ "URLResource",
4836
+ "URLThumbnailDictionaryItem",
4837
+ "URLUbiquitousItemDownloadingStatus",
4838
+ "URLUbiquitousSharedItemPermissions",
4839
+ "URLUbiquitousSharedItemRole",
4840
+ "UndoManager",
4841
+ "ValueTransformer",
4842
+ "XMLParser",
4843
+ "XMLParserDelegate"
4844
+ ]);
4845
+ var FOUNDATION_OVERLAY_GLOBALS = /* @__PURE__ */ new Set([
4846
+ "CFBridgingRetain",
4847
+ "NSASCIIStringEncoding",
4848
+ "NSAllHashTableObjects",
4849
+ "NSAllMapTableKeys",
4850
+ "NSAllMapTableValues",
4851
+ "NSAllocateMemoryPages",
4852
+ "NSAssertionHandlerKey",
4853
+ "NSBuddhistCalendar",
4854
+ "NSBundleErrorMaximum",
4855
+ "NSBundleErrorMinimum",
4856
+ "NSBundleExecutableArchitectureARM64",
4857
+ "NSBundleExecutableArchitectureI386",
4858
+ "NSBundleExecutableArchitecturePPC",
4859
+ "NSBundleExecutableArchitecturePPC64",
4860
+ "NSBundleExecutableArchitectureX86_64",
4861
+ "NSBundleOnDemandResourceExceededMaximumSizeError",
4862
+ "NSBundleOnDemandResourceInvalidTagError",
4863
+ "NSBundleOnDemandResourceOutOfSpaceError",
4864
+ "NSBundleResourceRequestLoadingPriorityUrgent",
4865
+ "NSChineseCalendar",
4866
+ "NSCloudSharingConflictError",
4867
+ "NSCloudSharingErrorMaximum",
4868
+ "NSCloudSharingErrorMinimum",
4869
+ "NSCloudSharingNetworkFailureError",
4870
+ "NSCloudSharingNoPermissionError",
4871
+ "NSCloudSharingOtherError",
4872
+ "NSCloudSharingQuotaExceededError",
4873
+ "NSCloudSharingTooManyParticipantsError",
4874
+ "NSCoderErrorMaximum",
4875
+ "NSCoderErrorMinimum",
4876
+ "NSCoderInvalidValueError",
4877
+ "NSCompareHashTables",
4878
+ "NSCompareMapTables",
4879
+ "NSCompressionErrorMaximum",
4880
+ "NSCompressionErrorMinimum",
4881
+ "NSCompressionFailedError",
4882
+ "NSConvertHostDoubleToSwapped",
4883
+ "NSConvertHostFloatToSwapped",
4884
+ "NSConvertSwappedDoubleToHost",
4885
+ "NSConvertSwappedFloatToHost",
4886
+ "NSCopyMemoryPages",
4887
+ "NSCountHashTable",
4888
+ "NSCountMapTable",
4889
+ "NSCreateHashTable",
4890
+ "NSCreateMapTable",
4891
+ "NSDeallocateMemoryPages",
4892
+ "NSDecompressionFailedError",
4893
+ "NSEndHashTableEnumeration",
4894
+ "NSEndMapTableEnumeration",
4895
+ "NSEnumerateHashTable",
4896
+ "NSEnumerateMapTable",
4897
+ "NSExecutableErrorMaximum",
4898
+ "NSExecutableErrorMinimum",
4899
+ "NSExtensionItemAttachmentsKey",
4900
+ "NSExtensionItemAttributedContentTextKey",
4901
+ "NSExtensionItemAttributedTitleKey",
4902
+ "NSExtensionItemsAndErrorsKey",
4903
+ "NSExtensionJavaScriptFinalizeArgumentKey",
4904
+ "NSExtensionJavaScriptPreprocessingResultsKey",
4905
+ "NSFileErrorMaximum",
4906
+ "NSFileErrorMinimum",
4907
+ "NSFormattingErrorMaximum",
4908
+ "NSFormattingErrorMinimum",
4909
+ "NSFoundationVersionNumber",
4910
+ "NSFoundationVersionNumber10_0",
4911
+ "NSFoundationVersionNumber10_1",
4912
+ "NSFoundationVersionNumber10_10",
4913
+ "NSFoundationVersionNumber10_10_1",
4914
+ "NSFoundationVersionNumber10_10_2",
4915
+ "NSFoundationVersionNumber10_10_3",
4916
+ "NSFoundationVersionNumber10_10_4",
4917
+ "NSFoundationVersionNumber10_10_5",
4918
+ "NSFoundationVersionNumber10_10_Max",
4919
+ "NSFoundationVersionNumber10_11",
4920
+ "NSFoundationVersionNumber10_11_1",
4921
+ "NSFoundationVersionNumber10_11_2",
4922
+ "NSFoundationVersionNumber10_11_3",
4923
+ "NSFoundationVersionNumber10_11_4",
4924
+ "NSFoundationVersionNumber10_11_Max",
4925
+ "NSFoundationVersionNumber10_1_1",
4926
+ "NSFoundationVersionNumber10_1_2",
4927
+ "NSFoundationVersionNumber10_1_3",
4928
+ "NSFoundationVersionNumber10_1_4",
4929
+ "NSFoundationVersionNumber10_2",
4930
+ "NSFoundationVersionNumber10_2_1",
4931
+ "NSFoundationVersionNumber10_2_2",
4932
+ "NSFoundationVersionNumber10_2_3",
4933
+ "NSFoundationVersionNumber10_2_4",
4934
+ "NSFoundationVersionNumber10_2_5",
4935
+ "NSFoundationVersionNumber10_2_6",
4936
+ "NSFoundationVersionNumber10_2_7",
4937
+ "NSFoundationVersionNumber10_2_8",
4938
+ "NSFoundationVersionNumber10_3",
4939
+ "NSFoundationVersionNumber10_3_1",
4940
+ "NSFoundationVersionNumber10_3_2",
4941
+ "NSFoundationVersionNumber10_3_3",
4942
+ "NSFoundationVersionNumber10_3_4",
4943
+ "NSFoundationVersionNumber10_3_5",
4944
+ "NSFoundationVersionNumber10_3_6",
4945
+ "NSFoundationVersionNumber10_3_7",
4946
+ "NSFoundationVersionNumber10_3_8",
4947
+ "NSFoundationVersionNumber10_3_9",
4948
+ "NSFoundationVersionNumber10_4",
4949
+ "NSFoundationVersionNumber10_4_1",
4950
+ "NSFoundationVersionNumber10_4_10",
4951
+ "NSFoundationVersionNumber10_4_11",
4952
+ "NSFoundationVersionNumber10_4_2",
4953
+ "NSFoundationVersionNumber10_4_3",
4954
+ "NSFoundationVersionNumber10_4_4_Intel",
4955
+ "NSFoundationVersionNumber10_4_4_PowerPC",
4956
+ "NSFoundationVersionNumber10_4_5",
4957
+ "NSFoundationVersionNumber10_4_6",
4958
+ "NSFoundationVersionNumber10_4_7",
4959
+ "NSFoundationVersionNumber10_4_8",
4960
+ "NSFoundationVersionNumber10_4_9",
4961
+ "NSFoundationVersionNumber10_5",
4962
+ "NSFoundationVersionNumber10_5_1",
4963
+ "NSFoundationVersionNumber10_5_2",
4964
+ "NSFoundationVersionNumber10_5_3",
4965
+ "NSFoundationVersionNumber10_5_4",
4966
+ "NSFoundationVersionNumber10_5_5",
4967
+ "NSFoundationVersionNumber10_5_6",
4968
+ "NSFoundationVersionNumber10_5_7",
4969
+ "NSFoundationVersionNumber10_5_8",
4970
+ "NSFoundationVersionNumber10_6",
4971
+ "NSFoundationVersionNumber10_6_1",
4972
+ "NSFoundationVersionNumber10_6_2",
4973
+ "NSFoundationVersionNumber10_6_3",
4974
+ "NSFoundationVersionNumber10_6_4",
4975
+ "NSFoundationVersionNumber10_6_5",
4976
+ "NSFoundationVersionNumber10_6_6",
4977
+ "NSFoundationVersionNumber10_6_7",
4978
+ "NSFoundationVersionNumber10_6_8",
4979
+ "NSFoundationVersionNumber10_7",
4980
+ "NSFoundationVersionNumber10_7_1",
4981
+ "NSFoundationVersionNumber10_7_2",
4982
+ "NSFoundationVersionNumber10_7_3",
4983
+ "NSFoundationVersionNumber10_7_4",
4984
+ "NSFoundationVersionNumber10_8",
4985
+ "NSFoundationVersionNumber10_8_1",
4986
+ "NSFoundationVersionNumber10_8_2",
4987
+ "NSFoundationVersionNumber10_8_3",
4988
+ "NSFoundationVersionNumber10_8_4",
4989
+ "NSFoundationVersionNumber10_9",
4990
+ "NSFoundationVersionNumber10_9_1",
4991
+ "NSFoundationVersionNumber10_9_2",
4992
+ "NSFoundationVersionNumber_iOS_4_0",
4993
+ "NSFoundationVersionNumber_iOS_4_1",
4994
+ "NSFoundationVersionNumber_iOS_4_2",
4995
+ "NSFoundationVersionNumber_iOS_4_3",
4996
+ "NSFoundationVersionNumber_iOS_5_0",
4997
+ "NSFoundationVersionNumber_iOS_5_1",
4998
+ "NSFoundationVersionNumber_iOS_6_0",
4999
+ "NSFoundationVersionNumber_iOS_6_1",
5000
+ "NSFoundationVersionNumber_iOS_7_0",
5001
+ "NSFoundationVersionNumber_iOS_7_1",
5002
+ "NSFoundationVersionNumber_iOS_8_0",
5003
+ "NSFoundationVersionNumber_iOS_8_1",
5004
+ "NSFoundationVersionNumber_iOS_8_2",
5005
+ "NSFoundationVersionNumber_iOS_8_3",
5006
+ "NSFoundationVersionNumber_iOS_8_4",
5007
+ "NSFoundationVersionNumber_iOS_8_x_Max",
5008
+ "NSFoundationVersionNumber_iOS_9_0",
5009
+ "NSFoundationVersionNumber_iOS_9_1",
5010
+ "NSFoundationVersionNumber_iOS_9_2",
5011
+ "NSFoundationVersionNumber_iOS_9_3",
5012
+ "NSFoundationVersionNumber_iOS_9_4",
5013
+ "NSFoundationVersionNumber_iOS_9_x_Max",
5014
+ "NSFoundationVersionNumber_iPhoneOS_2_0",
5015
+ "NSFoundationVersionNumber_iPhoneOS_2_1",
5016
+ "NSFoundationVersionNumber_iPhoneOS_2_2",
5017
+ "NSFoundationVersionNumber_iPhoneOS_3_0",
5018
+ "NSFoundationVersionNumber_iPhoneOS_3_1",
5019
+ "NSFoundationVersionNumber_iPhoneOS_3_2",
5020
+ "NSFoundationVersionWithFileManagerResourceForkSupport",
5021
+ "NSFreeHashTable",
5022
+ "NSFreeMapTable",
5023
+ "NSGetUncaughtExceptionHandler",
5024
+ "NSGregorianCalendar",
5025
+ "NSHPUXOperatingSystem",
5026
+ "NSHashGet",
5027
+ "NSHashInsert",
5028
+ "NSHashInsertIfAbsent",
5029
+ "NSHashInsertKnownAbsent",
5030
+ "NSHashRemove",
5031
+ "NSHashTableCopyIn",
5032
+ "NSHashTableObjectPointerPersonality",
5033
+ "NSHashTableStrongMemory",
5034
+ "NSHashTableWeakMemory",
5035
+ "NSHebrewCalendar",
5036
+ "NSHostByteOrder",
5037
+ "NSISO2022JPStringEncoding",
5038
+ "NSISO8601Calendar",
5039
+ "NSISOLatin1StringEncoding",
5040
+ "NSISOLatin2StringEncoding",
5041
+ "NSIndianCalendar",
5042
+ "NSIslamicCalendar",
5043
+ "NSIslamicCivilCalendar",
5044
+ "NSItemProviderPreferredImageSizeKey",
5045
+ "NSJapaneseCalendar",
5046
+ "NSJapaneseEUCStringEncoding",
5047
+ "NSLoadedClasses",
5048
+ "NSLocalizedFailureErrorKey",
5049
+ "NSLogPageSize",
5050
+ "NSMACHOperatingSystem",
5051
+ "NSMacOSRomanStringEncoding",
5052
+ "NSMapGet",
5053
+ "NSMapInsert",
5054
+ "NSMapInsertIfAbsent",
5055
+ "NSMapInsertKnownAbsent",
5056
+ "NSMapMember",
5057
+ "NSMapRemove",
5058
+ "NSMapTableCopyIn",
5059
+ "NSMapTableObjectPointerPersonality",
5060
+ "NSMapTableStrongMemory",
5061
+ "NSMapTableWeakMemory",
5062
+ "NSMetadataItemContentTypeKey",
5063
+ "NSMetadataItemContentTypeTreeKey",
5064
+ "NSMetadataItemDisplayNameKey",
5065
+ "NSMetadataItemFSContentChangeDateKey",
5066
+ "NSMetadataItemFSCreationDateKey",
5067
+ "NSMetadataItemFSNameKey",
5068
+ "NSMetadataItemFSSizeKey",
5069
+ "NSMetadataItemIsUbiquitousKey",
5070
+ "NSMetadataItemPathKey",
5071
+ "NSMetadataItemURLKey",
5072
+ "NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope",
5073
+ "NSMetadataQueryResultContentRelevanceAttribute",
5074
+ "NSMetadataQueryUbiquitousDataScope",
5075
+ "NSMetadataQueryUbiquitousDocumentsScope",
5076
+ "NSMetadataQueryUpdateAddedItemsKey",
5077
+ "NSMetadataQueryUpdateChangedItemsKey",
5078
+ "NSMetadataQueryUpdateRemovedItemsKey",
5079
+ "NSMetadataUbiquitousItemContainerDisplayNameKey",
5080
+ "NSMetadataUbiquitousItemDownloadRequestedKey",
5081
+ "NSMetadataUbiquitousItemDownloadingErrorKey",
5082
+ "NSMetadataUbiquitousItemDownloadingStatusCurrent",
5083
+ "NSMetadataUbiquitousItemDownloadingStatusDownloaded",
5084
+ "NSMetadataUbiquitousItemDownloadingStatusKey",
5085
+ "NSMetadataUbiquitousItemDownloadingStatusNotDownloaded",
5086
+ "NSMetadataUbiquitousItemHasUnresolvedConflictsKey",
5087
+ "NSMetadataUbiquitousItemIsDownloadingKey",
5088
+ "NSMetadataUbiquitousItemIsExternalDocumentKey",
5089
+ "NSMetadataUbiquitousItemIsSharedKey",
5090
+ "NSMetadataUbiquitousItemIsUploadedKey",
5091
+ "NSMetadataUbiquitousItemIsUploadingKey",
5092
+ "NSMetadataUbiquitousItemPercentDownloadedKey",
5093
+ "NSMetadataUbiquitousItemPercentUploadedKey",
5094
+ "NSMetadataUbiquitousItemURLInLocalContainerKey",
5095
+ "NSMetadataUbiquitousItemUploadingErrorKey",
5096
+ "NSMetadataUbiquitousSharedItemCurrentUserPermissionsKey",
5097
+ "NSMetadataUbiquitousSharedItemCurrentUserRoleKey",
5098
+ "NSMetadataUbiquitousSharedItemMostRecentEditorNameComponentsKey",
5099
+ "NSMetadataUbiquitousSharedItemOwnerNameComponentsKey",
5100
+ "NSMetadataUbiquitousSharedItemPermissionsReadOnly",
5101
+ "NSMetadataUbiquitousSharedItemPermissionsReadWrite",
5102
+ "NSMetadataUbiquitousSharedItemRoleOwner",
5103
+ "NSMetadataUbiquitousSharedItemRoleParticipant",
5104
+ "NSMultipleUnderlyingErrorsKey",
5105
+ "NSNEXTSTEPStringEncoding",
5106
+ "NSNextHashEnumeratorItem",
5107
+ "NSNextMapEnumeratorPair",
5108
+ "NSNonLossyASCIIStringEncoding",
5109
+ "NSNonOwnedPointerHashCallBacks",
5110
+ "NSNonOwnedPointerMapKeyCallBacks",
5111
+ "NSNonOwnedPointerMapValueCallBacks",
5112
+ "NSNonOwnedPointerOrNullMapKeyCallBacks",
5113
+ "NSNonRetainedObjectHashCallBacks",
5114
+ "NSNonRetainedObjectMapKeyCallBacks",
5115
+ "NSNonRetainedObjectMapValueCallBacks",
5116
+ "NSOSF1OperatingSystem",
5117
+ "NSObjectHashCallBacks",
5118
+ "NSObjectMapKeyCallBacks",
5119
+ "NSObjectMapValueCallBacks",
5120
+ "NSOpenStepRootDirectory",
5121
+ "NSOpenStepUnicodeReservedBase",
5122
+ "NSOwnedObjectIdentityHashCallBacks",
5123
+ "NSOwnedPointerHashCallBacks",
5124
+ "NSOwnedPointerMapKeyCallBacks",
5125
+ "NSOwnedPointerMapValueCallBacks",
5126
+ "NSPersianCalendar",
5127
+ "NSPointerToStructHashCallBacks",
5128
+ "NSPropertyListErrorMaximum",
5129
+ "NSPropertyListErrorMinimum",
5130
+ "NSProprietaryStringEncoding",
5131
+ "NSProtocolFromString",
5132
+ "NSRepublicOfChinaCalendar",
5133
+ "NSResetHashTable",
5134
+ "NSResetMapTable",
5135
+ "NSShiftJISStringEncoding",
5136
+ "NSSolarisOperatingSystem",
5137
+ "NSStringFromHashTable",
5138
+ "NSStringFromMapTable",
5139
+ "NSStringFromProtocol",
5140
+ "NSSunOSOperatingSystem",
5141
+ "NSSwapBigDoubleToHost",
5142
+ "NSSwapBigFloatToHost",
5143
+ "NSSwapBigIntToHost",
5144
+ "NSSwapBigLongLongToHost",
5145
+ "NSSwapBigLongToHost",
5146
+ "NSSwapBigShortToHost",
5147
+ "NSSwapDouble",
5148
+ "NSSwapFloat",
5149
+ "NSSwapHostDoubleToBig",
5150
+ "NSSwapHostDoubleToLittle",
5151
+ "NSSwapHostFloatToBig",
5152
+ "NSSwapHostFloatToLittle",
5153
+ "NSSwapHostIntToBig",
5154
+ "NSSwapHostIntToLittle",
5155
+ "NSSwapHostLongLongToBig",
5156
+ "NSSwapHostLongLongToLittle",
5157
+ "NSSwapHostLongToBig",
5158
+ "NSSwapHostLongToLittle",
5159
+ "NSSwapHostShortToBig",
5160
+ "NSSwapHostShortToLittle",
5161
+ "NSSwapInt",
5162
+ "NSSwapLittleDoubleToHost",
5163
+ "NSSwapLittleFloatToHost",
5164
+ "NSSwapLittleIntToHost",
5165
+ "NSSwapLittleLongLongToHost",
5166
+ "NSSwapLittleLongToHost",
5167
+ "NSSwapLittleShortToHost",
5168
+ "NSSwapLong",
5169
+ "NSSwapLongLong",
5170
+ "NSSwapShort",
5171
+ "NSSymbolStringEncoding",
5172
+ "NSTextCheckingAllCustomTypes",
5173
+ "NSTextCheckingAllSystemTypes",
5174
+ "NSTextCheckingAllTypes",
5175
+ "NSURLAuthenticationMethodHTMLForm",
5176
+ "NSURLAuthenticationMethodNTLM",
5177
+ "NSURLAuthenticationMethodNegotiate",
5178
+ "NSURLCredentialStorageRemoveSynchronizableCredentials",
5179
+ "NSURLErrorFileOutsideSafeArea",
5180
+ "NSURLFileScheme",
5181
+ "NSURLProtectionSpaceFTP",
5182
+ "NSURLProtectionSpaceFTPProxy",
5183
+ "NSURLProtectionSpaceHTTP",
5184
+ "NSURLProtectionSpaceHTTPProxy",
5185
+ "NSURLProtectionSpaceHTTPS",
5186
+ "NSURLProtectionSpaceHTTPSProxy",
5187
+ "NSURLProtectionSpaceSOCKSProxy",
5188
+ "NSURLSessionDownloadTaskResumeData",
5189
+ "NSURLSessionTransferSizeUnknown",
5190
+ "NSURLSessionUploadTaskResumeData",
5191
+ "NSUTF16BigEndianStringEncoding",
5192
+ "NSUTF16LittleEndianStringEncoding",
5193
+ "NSUTF16StringEncoding",
5194
+ "NSUTF32BigEndianStringEncoding",
5195
+ "NSUTF32LittleEndianStringEncoding",
5196
+ "NSUTF32StringEncoding",
5197
+ "NSUTF8StringEncoding",
5198
+ "NSUbiquitousFileErrorMaximum",
5199
+ "NSUbiquitousFileErrorMinimum",
5200
+ "NSUbiquitousKeyValueStoreAccountChange",
5201
+ "NSUbiquitousKeyValueStoreChangeReasonKey",
5202
+ "NSUbiquitousKeyValueStoreChangedKeysKey",
5203
+ "NSUbiquitousKeyValueStoreInitialSyncChange",
5204
+ "NSUbiquitousKeyValueStoreQuotaViolationChange",
5205
+ "NSUbiquitousKeyValueStoreServerChange",
5206
+ "NSUndefinedDateComponent",
5207
+ "NSUndoCloseGroupingRunLoopOrdering",
5208
+ "NSUndoManagerGroupIsDiscardableKey",
5209
+ "NSUnicodeStringEncoding",
5210
+ "NSUserActivityErrorMaximum",
5211
+ "NSUserActivityErrorMinimum",
5212
+ "NSUserActivityTypeBrowsingWeb",
5213
+ "NSValidationErrorMaximum",
5214
+ "NSValidationErrorMinimum",
5215
+ "NSWindows95OperatingSystem",
5216
+ "NSWindowsCP1250StringEncoding",
5217
+ "NSWindowsCP1251StringEncoding",
5218
+ "NSWindowsCP1252StringEncoding",
5219
+ "NSWindowsCP1253StringEncoding",
5220
+ "NSWindowsCP1254StringEncoding",
5221
+ "NSWindowsNTOperatingSystem",
5222
+ "NSWrapCalendarComponents",
5223
+ "NSXPCConnectionCodeSigningRequirementFailure",
5224
+ "NSXPCConnectionErrorMaximum",
5225
+ "NSXPCConnectionErrorMinimum",
5226
+ "NS_BigEndian",
5227
+ "NS_LittleEndian",
5228
+ "NS_UnknownByteOrder",
5229
+ "kCFStringEncodingASCII"
5230
+ ]);
5231
+ var CORE_FOUNDATION_OVERLAY_GLOBALS = /* @__PURE__ */ new Set([
5232
+ "kCFCoreFoundationVersionNumber10_0",
5233
+ "kCFCoreFoundationVersionNumber10_0_3",
5234
+ "kCFCoreFoundationVersionNumber10_1",
5235
+ "kCFCoreFoundationVersionNumber10_10",
5236
+ "kCFCoreFoundationVersionNumber10_10_1",
5237
+ "kCFCoreFoundationVersionNumber10_10_2",
5238
+ "kCFCoreFoundationVersionNumber10_10_3",
5239
+ "kCFCoreFoundationVersionNumber10_10_4",
5240
+ "kCFCoreFoundationVersionNumber10_10_5",
5241
+ "kCFCoreFoundationVersionNumber10_10_Max",
5242
+ "kCFCoreFoundationVersionNumber10_11",
5243
+ "kCFCoreFoundationVersionNumber10_11_1",
5244
+ "kCFCoreFoundationVersionNumber10_11_2",
5245
+ "kCFCoreFoundationVersionNumber10_11_3",
5246
+ "kCFCoreFoundationVersionNumber10_11_4",
5247
+ "kCFCoreFoundationVersionNumber10_11_Max",
5248
+ "kCFCoreFoundationVersionNumber10_1_1",
5249
+ "kCFCoreFoundationVersionNumber10_1_2",
5250
+ "kCFCoreFoundationVersionNumber10_1_3",
5251
+ "kCFCoreFoundationVersionNumber10_1_4",
5252
+ "kCFCoreFoundationVersionNumber10_2",
5253
+ "kCFCoreFoundationVersionNumber10_2_1",
5254
+ "kCFCoreFoundationVersionNumber10_2_2",
5255
+ "kCFCoreFoundationVersionNumber10_2_3",
5256
+ "kCFCoreFoundationVersionNumber10_2_4",
5257
+ "kCFCoreFoundationVersionNumber10_2_5",
5258
+ "kCFCoreFoundationVersionNumber10_2_6",
5259
+ "kCFCoreFoundationVersionNumber10_2_7",
5260
+ "kCFCoreFoundationVersionNumber10_2_8",
5261
+ "kCFCoreFoundationVersionNumber10_3",
5262
+ "kCFCoreFoundationVersionNumber10_3_1",
5263
+ "kCFCoreFoundationVersionNumber10_3_2",
5264
+ "kCFCoreFoundationVersionNumber10_3_3",
5265
+ "kCFCoreFoundationVersionNumber10_3_4",
5266
+ "kCFCoreFoundationVersionNumber10_3_5",
5267
+ "kCFCoreFoundationVersionNumber10_3_6",
5268
+ "kCFCoreFoundationVersionNumber10_3_7",
5269
+ "kCFCoreFoundationVersionNumber10_3_8",
5270
+ "kCFCoreFoundationVersionNumber10_3_9",
5271
+ "kCFCoreFoundationVersionNumber10_4",
5272
+ "kCFCoreFoundationVersionNumber10_4_1",
5273
+ "kCFCoreFoundationVersionNumber10_4_10",
5274
+ "kCFCoreFoundationVersionNumber10_4_11",
5275
+ "kCFCoreFoundationVersionNumber10_4_2",
5276
+ "kCFCoreFoundationVersionNumber10_4_3",
5277
+ "kCFCoreFoundationVersionNumber10_4_4_Intel",
5278
+ "kCFCoreFoundationVersionNumber10_4_4_PowerPC",
5279
+ "kCFCoreFoundationVersionNumber10_4_5_Intel",
5280
+ "kCFCoreFoundationVersionNumber10_4_5_PowerPC",
5281
+ "kCFCoreFoundationVersionNumber10_4_6_Intel",
5282
+ "kCFCoreFoundationVersionNumber10_4_6_PowerPC",
5283
+ "kCFCoreFoundationVersionNumber10_4_7",
5284
+ "kCFCoreFoundationVersionNumber10_4_8",
5285
+ "kCFCoreFoundationVersionNumber10_4_9",
5286
+ "kCFCoreFoundationVersionNumber10_5",
5287
+ "kCFCoreFoundationVersionNumber10_5_1",
5288
+ "kCFCoreFoundationVersionNumber10_5_2",
5289
+ "kCFCoreFoundationVersionNumber10_5_3",
5290
+ "kCFCoreFoundationVersionNumber10_5_4",
5291
+ "kCFCoreFoundationVersionNumber10_5_5",
5292
+ "kCFCoreFoundationVersionNumber10_5_6",
5293
+ "kCFCoreFoundationVersionNumber10_5_7",
5294
+ "kCFCoreFoundationVersionNumber10_5_8",
5295
+ "kCFCoreFoundationVersionNumber10_6",
5296
+ "kCFCoreFoundationVersionNumber10_6_1",
5297
+ "kCFCoreFoundationVersionNumber10_6_2",
5298
+ "kCFCoreFoundationVersionNumber10_6_3",
5299
+ "kCFCoreFoundationVersionNumber10_6_4",
5300
+ "kCFCoreFoundationVersionNumber10_6_5",
5301
+ "kCFCoreFoundationVersionNumber10_6_6",
5302
+ "kCFCoreFoundationVersionNumber10_6_7",
5303
+ "kCFCoreFoundationVersionNumber10_6_8",
5304
+ "kCFCoreFoundationVersionNumber10_7",
5305
+ "kCFCoreFoundationVersionNumber10_7_1",
5306
+ "kCFCoreFoundationVersionNumber10_7_2",
5307
+ "kCFCoreFoundationVersionNumber10_7_3",
5308
+ "kCFCoreFoundationVersionNumber10_7_4",
5309
+ "kCFCoreFoundationVersionNumber10_7_5",
5310
+ "kCFCoreFoundationVersionNumber10_8",
5311
+ "kCFCoreFoundationVersionNumber10_8_1",
5312
+ "kCFCoreFoundationVersionNumber10_8_2",
5313
+ "kCFCoreFoundationVersionNumber10_8_3",
5314
+ "kCFCoreFoundationVersionNumber10_8_4",
5315
+ "kCFCoreFoundationVersionNumber10_9",
5316
+ "kCFCoreFoundationVersionNumber10_9_1",
5317
+ "kCFCoreFoundationVersionNumber10_9_2",
5318
+ "kCFCoreFoundationVersionNumber_iOS_4_0",
5319
+ "kCFCoreFoundationVersionNumber_iOS_4_1",
5320
+ "kCFCoreFoundationVersionNumber_iOS_4_2",
5321
+ "kCFCoreFoundationVersionNumber_iOS_4_3",
5322
+ "kCFCoreFoundationVersionNumber_iOS_5_0",
5323
+ "kCFCoreFoundationVersionNumber_iOS_5_1",
5324
+ "kCFCoreFoundationVersionNumber_iOS_6_0",
5325
+ "kCFCoreFoundationVersionNumber_iOS_6_1",
5326
+ "kCFCoreFoundationVersionNumber_iOS_7_0",
5327
+ "kCFCoreFoundationVersionNumber_iOS_7_1",
5328
+ "kCFCoreFoundationVersionNumber_iOS_8_0",
5329
+ "kCFCoreFoundationVersionNumber_iOS_8_1",
5330
+ "kCFCoreFoundationVersionNumber_iOS_8_2",
5331
+ "kCFCoreFoundationVersionNumber_iOS_8_3",
5332
+ "kCFCoreFoundationVersionNumber_iOS_8_4",
5333
+ "kCFCoreFoundationVersionNumber_iOS_8_x_Max",
5334
+ "kCFCoreFoundationVersionNumber_iOS_9_0",
5335
+ "kCFCoreFoundationVersionNumber_iOS_9_1",
5336
+ "kCFCoreFoundationVersionNumber_iOS_9_2",
5337
+ "kCFCoreFoundationVersionNumber_iOS_9_3",
5338
+ "kCFCoreFoundationVersionNumber_iOS_9_4",
5339
+ "kCFCoreFoundationVersionNumber_iOS_9_x_Max",
5340
+ "kCFCoreFoundationVersionNumber_iPhoneOS_2_0",
5341
+ "kCFCoreFoundationVersionNumber_iPhoneOS_2_1",
5342
+ "kCFCoreFoundationVersionNumber_iPhoneOS_2_2",
5343
+ "kCFCoreFoundationVersionNumber_iPhoneOS_3_0",
5344
+ "kCFCoreFoundationVersionNumber_iPhoneOS_3_1",
5345
+ "kCFCoreFoundationVersionNumber_iPhoneOS_3_2"
5346
+ ]);
5347
+ var CORE_FOUNDATION_GEOMETRY_TYPES = /* @__PURE__ */ new Set([
5348
+ "CGFloat",
5349
+ "CGPoint",
5350
+ "CGSize",
5351
+ "CGRect",
5352
+ "CGRectEdge"
5353
+ ]);
5354
+ var CORE_FOUNDATION_GRAPHICS_TYPES = /* @__PURE__ */ new Set([
5355
+ "CGAffineTransform",
5356
+ "CGAffineTransformComponents",
5357
+ "CGVector"
5358
+ ]);
5359
+ var CORE_FOUNDATION_HANDLE_IMPORTS = [
5360
+ "CFAllocator",
5361
+ "CFArray",
5362
+ "CFAttributedString",
5363
+ "CFBoolean",
5364
+ "CFData",
5365
+ "CFDate",
5366
+ "CFDictionary",
5367
+ "CFError",
5368
+ "CFMutableData",
5369
+ "CFNumber",
5370
+ "CFSet",
5371
+ "CFString",
5372
+ "CFURL"
5373
+ ].map((name) => `import class CoreFoundation.${name}`).concat([
5374
+ "import typealias CoreFoundation.CFPropertyList",
5375
+ "import typealias CoreFoundation.CFTypeRef",
5376
+ "import CoreGraphics"
5377
+ ]).join("; ");
4557
5378
  function swiftSourceAsIOS(original, extraObjCExtensions, objc = objcIndex([original])) {
4558
5379
  const source = liftExtensionOverrides(
4559
5380
  lowerObjCRuntimeCalls(lowerObjCOptionalRequirements(original, objc), objc),
@@ -4601,21 +5422,55 @@ function swiftSourceAsIOS(original, extraObjCExtensions, objc = objcIndex([origi
4601
5422
  const imported = /^import\s+([A-Za-z_]\w*)(?:\s*\.\s*[A-Za-z_]\w*)+/.exec(rest);
4602
5423
  if (imported) {
4603
5424
  out += conditioned.slice(copied, at) + `import ${imported[1]}`.padEnd(imported[0].length);
5425
+ if (imported[1] === "CoreFoundation") out += `; ${CORE_FOUNDATION_HANDLE_IMPORTS}`;
4604
5426
  copied = at + imported[0].length;
4605
5427
  continue;
4606
5428
  }
5429
+ const coreFoundationImport = /^import\s+CoreFoundation\b/.exec(rest);
5430
+ if (coreFoundationImport) {
5431
+ out += conditioned.slice(copied, at) + coreFoundationImport[0] + `; ${CORE_FOUNDATION_HANDLE_IMPORTS}`;
5432
+ copied = at + coreFoundationImport[0].length;
5433
+ continue;
5434
+ }
4607
5435
  if (/^NSClassFromString\b/.test(rest)) {
4608
5436
  out += conditioned.slice(copied, at) + "_peachClassFromString";
4609
5437
  copied = at + "NSClassFromString".length;
4610
5438
  continue;
4611
5439
  }
4612
- if (/^Foundation\s*\.\s*(?:HTTPURLResponse|URLAuthenticationChallenge|URLAuthenticationChallengeSender|URLCredential|URLProtectionSpace|URLRequest|URLResponse|URLSession)\b/.test(
4613
- rest
4614
- )) {
4615
- out += conditioned.slice(copied, at) + "FoundationNetworking";
5440
+ const foundationMember = /^Foundation\s*\.\s*(?:`([A-Za-z_]\w*)`|([A-Za-z_]\w*)\b)/.exec(rest);
5441
+ const foundationName = foundationMember?.[1] ?? foundationMember?.[2];
5442
+ let foundationOwner;
5443
+ if (foundationName !== void 0) {
5444
+ if (foundationName === "NSClassFromString" || foundationName === "NSKeyValueChange" || foundationName === "NSKeyValueObservedChange" || foundationName === "NSKeyValueObservation")
5445
+ foundationOwner = "PeachObjC";
5446
+ else if (foundationName === "DispatchData") foundationOwner = "Dispatch";
5447
+ else if (FOUNDATION_NETWORKING_TYPES.has(foundationName))
5448
+ foundationOwner = "FoundationNetworking";
5449
+ else if (FOUNDATION_OVERLAY_TYPES.has(foundationName) || FOUNDATION_OVERLAY_GLOBALS.has(foundationName) || CORE_FOUNDATION_OVERLAY_GLOBALS.has(foundationName))
5450
+ foundationOwner = "PeachFoundation";
5451
+ }
5452
+ if (foundationOwner !== void 0) {
5453
+ out += conditioned.slice(copied, at) + foundationOwner;
4616
5454
  copied = at + "Foundation".length;
4617
5455
  continue;
4618
5456
  }
5457
+ const coreFoundationMember = /^CoreFoundation\s*\.\s*(?:`([A-Za-z_]\w*)`|([A-Za-z_]\w*)\b)/.exec(rest);
5458
+ const coreFoundationName = coreFoundationMember?.[1] ?? coreFoundationMember?.[2];
5459
+ if (coreFoundationName !== void 0 && CORE_FOUNDATION_OVERLAY_GLOBALS.has(coreFoundationName)) {
5460
+ out += conditioned.slice(copied, at) + "PeachFoundation";
5461
+ copied = at + "CoreFoundation".length;
5462
+ continue;
5463
+ }
5464
+ if (coreFoundationName !== void 0 && CORE_FOUNDATION_GEOMETRY_TYPES.has(coreFoundationName)) {
5465
+ out += conditioned.slice(copied, at) + "Foundation";
5466
+ copied = at + "CoreFoundation".length;
5467
+ continue;
5468
+ }
5469
+ if (coreFoundationName !== void 0 && CORE_FOUNDATION_GRAPHICS_TYPES.has(coreFoundationName)) {
5470
+ out += conditioned.slice(copied, at) + "CoreGraphics";
5471
+ copied = at + "CoreFoundation".length;
5472
+ continue;
5473
+ }
4619
5474
  if (rest.startsWith("class")) {
4620
5475
  const declared2 = CLASS_BASE.exec(rest);
4621
5476
  if (declared2 && reusableViews.has(declared2[2].split(".").pop())) {
@@ -4740,7 +5595,7 @@ function swiftApplicationEntry(file, source) {
4740
5595
  else if (source[at] === "}") depth--;
4741
5596
  else if (depth === 0 && /^@(?:main|UIApplicationMain)\b/.test(source.slice(at)))
4742
5597
  return true;
4743
- else if (depth === 0 && import_node_path4.default.basename(file) === "main.swift" && /^UIApplicationMain\s*\(/.test(source.slice(at)))
5598
+ else if (depth === 0 && import_node_path5.default.basename(file) === "main.swift" && /^UIApplicationMain\s*\(/.test(source.slice(at)))
4744
5599
  return true;
4745
5600
  }
4746
5601
  return false;
@@ -4827,7 +5682,7 @@ function swiftCodeScan(source) {
4827
5682
  else top.parens--;
4828
5683
  i++;
4829
5684
  } else {
4830
- const keyword = source.startsWith("class", i) ? "class" : source.startsWith("extension", i) ? "extension" : source.startsWith("override", i) ? "override" : source.startsWith("import", i) ? "import" : source.startsWith("func", i) ? "func" : source.startsWith("UIApplicationMain", i) ? "UIApplicationMain" : source.startsWith("NSClassFromString", i) ? "NSClassFromString" : source.startsWith("Foundation", i) ? "Foundation" : null;
5685
+ const keyword = source.startsWith("class", i) ? "class" : source.startsWith("extension", i) ? "extension" : source.startsWith("override", i) ? "override" : source.startsWith("import", i) ? "import" : source.startsWith("func", i) ? "func" : source.startsWith("UIApplicationMain", i) ? "UIApplicationMain" : source.startsWith("NSClassFromString", i) ? "NSClassFromString" : source.startsWith("Foundation", i) ? "Foundation" : source.startsWith("CoreFoundation", i) ? "CoreFoundation" : null;
4831
5686
  if (keyword && !/[\w$]/.test(source[i - 1] ?? "") && !/[\w$]/.test(source[i + keyword.length] ?? "")) {
4832
5687
  tokens.push(i);
4833
5688
  i += keyword.length;
@@ -4846,14 +5701,14 @@ function prepareSwiftDependency(source, destination) {
4846
5701
  for (const entry of (0, import_node_fs3.readdirSync)(from, { withFileTypes: true })) {
4847
5702
  if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
4848
5703
  continue;
4849
- const file = import_node_path4.default.join(from, entry.name);
5704
+ const file = import_node_path5.default.join(from, entry.name);
4850
5705
  if (entry.isDirectory()) gather(file);
4851
5706
  else if (entry.isFile() && entry.name.endsWith(".swift"))
4852
- origins[import_node_path4.default.relative(source, file)] = (0, import_node_fs3.readFileSync)(file, "utf8");
5707
+ origins[import_node_path5.default.relative(source, file)] = (0, import_node_fs3.readFileSync)(file, "utf8");
4853
5708
  }
4854
5709
  };
4855
5710
  gather(source);
4856
- const manifest = import_node_path4.default.join(source, "Package.swift");
5711
+ const manifest = import_node_path5.default.join(source, "Package.swift");
4857
5712
  const targets = (0, import_node_fs3.existsSync)(manifest) ? swiftManifestTargets((0, import_node_fs3.readFileSync)(manifest, "utf8")) : [];
4858
5713
  const compiled = compiledSwiftSources(origins, targets);
4859
5714
  const copy = (from, to) => {
@@ -4861,11 +5716,11 @@ function prepareSwiftDependency(source, destination) {
4861
5716
  for (const entry of (0, import_node_fs3.readdirSync)(from, { withFileTypes: true })) {
4862
5717
  if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
4863
5718
  continue;
4864
- const file = import_node_path4.default.join(from, entry.name);
4865
- const target = import_node_path4.default.join(to, entry.name);
5719
+ const file = import_node_path5.default.join(from, entry.name);
5720
+ const target = import_node_path5.default.join(to, entry.name);
4866
5721
  if (entry.isDirectory()) copy(file, target);
4867
5722
  else if (entry.isFile() && entry.name.endsWith(".swift"))
4868
- (0, import_node_fs3.writeFileSync)(target, compiled.get(import_node_path4.default.relative(source, file)));
5723
+ (0, import_node_fs3.writeFileSync)(target, compiled.get(import_node_path5.default.relative(source, file)));
4869
5724
  else (0, import_node_fs3.cpSync)(file, target, { verbatimSymlinks: true });
4870
5725
  }
4871
5726
  };
@@ -4882,7 +5737,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
4882
5737
  const targets = distribution && compileTargets(input).length === 0 ? [
4883
5738
  {
4884
5739
  name: "App",
4885
- path: import_node_path4.default.relative(layout.root, layout.sources),
5740
+ path: import_node_path5.default.relative(layout.root, layout.sources),
4886
5741
  executable: true,
4887
5742
  languageMode: 5,
4888
5743
  mainActorIsolation: false,
@@ -4891,7 +5746,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
4891
5746
  ] : compileTargets(input);
4892
5747
  const files = /* @__PURE__ */ new Map();
4893
5748
  const native = /* @__PURE__ */ new Map();
4894
- const headerDirectory = import_node_path4.default.join(layout.root, ".build", "peach-cxx-headers");
5749
+ const headerDirectory = import_node_path5.default.join(layout.root, ".build", "peach-cxx-headers");
4895
5750
  for (const target of targets) {
4896
5751
  const prefix = target.path === "." ? "" : `${target.path}/`;
4897
5752
  const entries = Object.entries(input.files).filter(
@@ -4914,7 +5769,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
4914
5769
  if (producer && targets.some((value) => value.name === producer))
4915
5770
  producers.add(producer);
4916
5771
  const local = [
4917
- import_node_path4.default.posix.join(import_node_path4.default.posix.dirname(file), include),
5772
+ import_node_path5.default.posix.join(import_node_path5.default.posix.dirname(file), include),
4918
5773
  `${includes}${include}`
4919
5774
  ].find((candidate) => input.files[candidate] !== void 0);
4920
5775
  if (local) {
@@ -4936,7 +5791,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
4936
5791
  const late = units.filter(([file]) => consumers.get(file).size > 0);
4937
5792
  native.set(target.name, {
4938
5793
  path: target.path,
4939
- includeDirectory: import_node_path4.default.join(layout.root, includes),
5794
+ includeDirectory: import_node_path5.default.join(layout.root, includes),
4940
5795
  lateSources: late.map(([file]) => file.slice(prefix.length)),
4941
5796
  ...late.length > 0 ? {
4942
5797
  late: {
@@ -4953,7 +5808,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
4953
5808
  ([file]) => file.startsWith(includes) && /\.(?:h|hpp|hh|hxx)$/.test(file) && consumers.get(file).size === 0
4954
5809
  );
4955
5810
  files.set(
4956
- import_node_path4.default.join(layout.root, includes, "module.modulemap"),
5811
+ import_node_path5.default.join(layout.root, includes, "module.modulemap"),
4957
5812
  [
4958
5813
  `module ${target.name} {`,
4959
5814
  ...roots.map(
@@ -4970,7 +5825,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
4970
5825
  swiftModuleInputFiles(moduleRoot).join("\n")
4971
5826
  );
4972
5827
  if (!distribution) {
4973
- modulePlan.update((0, import_node_fs3.readFileSync)(import_node_path4.default.join(moduleRoot, "Package.swift")));
5828
+ modulePlan.update((0, import_node_fs3.readFileSync)(import_node_path5.default.join(moduleRoot, "Package.swift")));
4974
5829
  }
4975
5830
  const resourcePlan = (0, import_node_crypto2.createHash)("sha256").update(
4976
5831
  JSON.stringify(
@@ -4997,10 +5852,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
4997
5852
  if (targets.length === 0) {
4998
5853
  for (const [file, contents] of Object.entries(input.files)) {
4999
5854
  if (file === "Package.swift") continue;
5000
- files.set(import_node_path4.default.join(layout.sources, file), compiled.get(file) ?? contents);
5855
+ files.set(import_node_path5.default.join(layout.sources, file), compiled.get(file) ?? contents);
5001
5856
  }
5002
5857
  let manifest = (0, import_node_fs3.readFileSync)(
5003
- import_node_path4.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
5858
+ import_node_path5.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
5004
5859
  "utf8"
5005
5860
  ).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
5006
5861
  const reactor = ` ${REACTOR_FLAG}`;
@@ -5044,21 +5899,21 @@ function writeSwiftProject(layout, input, moduleRoot) {
5044
5899
  manifest = manifest.replace(anchor, `${anchor}
5045
5900
  ${SPRITEKIT_PRODUCT},`);
5046
5901
  }
5047
- files.set(import_node_path4.default.join(layout.root, "Package.swift"), manifest + moduleFiles);
5902
+ files.set(import_node_path5.default.join(layout.root, "Package.swift"), manifest + moduleFiles);
5048
5903
  } else {
5049
5904
  const base = layout.multi ? layout.root : layout.sources;
5050
5905
  const libraries = /* @__PURE__ */ new Map();
5051
5906
  for (const [target, data] of Object.entries(input.libraries ?? {})) {
5052
- const file = import_node_path4.default.join(layout.root, ".peach-libraries", `lib${target}.a`);
5907
+ const file = import_node_path5.default.join(layout.root, ".peach-libraries", `lib${target}.a`);
5053
5908
  files.set(file, Buffer.from(data, "base64"));
5054
5909
  libraries.set(target, file);
5055
5910
  }
5056
5911
  for (const [file, contents] of Object.entries(input.files)) {
5057
5912
  if (file === "Package.swift") continue;
5058
- files.set(import_node_path4.default.join(base, file), compiled.get(file) ?? contents);
5913
+ files.set(import_node_path5.default.join(base, file), compiled.get(file) ?? contents);
5059
5914
  }
5060
5915
  files.set(
5061
- import_node_path4.default.join(layout.root, "Package.swift"),
5916
+ import_node_path5.default.join(layout.root, "Package.swift"),
5062
5917
  emitSwiftPackageManifest({
5063
5918
  targets,
5064
5919
  native,
@@ -5075,7 +5930,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
5075
5930
  spriteKit: importsSpriteKit(input.files),
5076
5931
  distribution: distribution ?? void 0,
5077
5932
  distributionLink: {
5078
- path: import_node_path4.default.join(layout.root, ".peach-distribution-objects.rsp"),
5933
+ path: import_node_path5.default.join(layout.root, ".peach-distribution-objects.rsp"),
5079
5934
  files
5080
5935
  },
5081
5936
  libraries
@@ -5091,9 +5946,9 @@ function writeSwiftProject(layout, input, moduleRoot) {
5091
5946
  throw new Error(
5092
5947
  `swift resource target ${target.name} has no matching bundle assignment`
5093
5948
  );
5094
- const directory = layout.multi ? import_node_path4.default.join(layout.root, target.path) : layout.sources;
5949
+ const directory = layout.multi ? import_node_path5.default.join(layout.root, target.path) : layout.sources;
5095
5950
  files.set(
5096
- import_node_path4.default.join(directory, "ResourceBundleAccessor.generated.swift"),
5951
+ import_node_path5.default.join(directory, "ResourceBundleAccessor.generated.swift"),
5097
5952
  [
5098
5953
  "import Foundation",
5099
5954
  "",
@@ -5126,13 +5981,13 @@ function outputOf(error) {
5126
5981
  return error instanceof Error ? error.message : String(error);
5127
5982
  }
5128
5983
  function builtArtifact(layout) {
5129
- const binDir = import_node_path4.default.join(layout.root, ".build", WASM_TRIPLE, "release");
5130
- const manifest = (0, import_node_fs3.readFileSync)(import_node_path4.default.join(layout.root, "Package.swift"), "utf8");
5984
+ const binDir = import_node_path5.default.join(layout.root, ".build", WASM_TRIPLE, "release");
5985
+ const manifest = (0, import_node_fs3.readFileSync)(import_node_path5.default.join(layout.root, "Package.swift"), "utf8");
5131
5986
  const executable = swiftManifestTargets(manifest).find((target) => target.executable);
5132
5987
  if (executable === void 0) {
5133
5988
  throw new Error("swift-compile: the written manifest names no executable target");
5134
5989
  }
5135
- const file = import_node_path4.default.join(binDir, `${executable.name}.wasm`);
5990
+ const file = import_node_path5.default.join(binDir, `${executable.name}.wasm`);
5136
5991
  if (!(0, import_node_fs3.existsSync)(file)) {
5137
5992
  const found = (0, import_node_fs3.existsSync)(binDir) ? (0, import_node_fs3.readdirSync)(binDir).filter((name) => name.endsWith(".wasm")).sort() : [];
5138
5993
  throw new Error(
@@ -5143,8 +5998,8 @@ function builtArtifact(layout) {
5143
5998
  }
5144
5999
  function projectDiagnostic(output, layout, files) {
5145
6000
  const base = layout.multi ? layout.root : layout.sources;
5146
- const prefix = `${base}${import_node_path4.default.sep}`;
5147
- return designTimeDiagnostic(output, files).split("\n").map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
6001
+ const prefix = `${base}${import_node_path5.default.sep}`;
6002
+ 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();
5148
6003
  }
5149
6004
  var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
5150
6005
  var host = globalThis;
@@ -5179,12 +6034,12 @@ function serialize(root, work, signal) {
5179
6034
  function readCompiledArtifact(directory, hash) {
5180
6035
  try {
5181
6036
  const receipt = JSON.parse(
5182
- (0, import_node_fs3.readFileSync)(import_node_path4.default.join(directory, "artifact.json"), "utf8")
6037
+ (0, import_node_fs3.readFileSync)(import_node_path5.default.join(directory, "artifact.json"), "utf8")
5183
6038
  );
5184
6039
  if (!receipt || typeof receipt !== "object" || !("hash" in receipt) || receipt.hash !== hash || !("icu" in receipt) || typeof receipt.icu !== "string" || !("wasm" in receipt) || typeof receipt.wasm !== "string")
5185
6040
  return null;
5186
- const bytes = (0, import_node_fs3.readFileSync)(import_node_path4.default.join(directory, "app.wasm"));
5187
- const gzip2 = (0, import_node_fs3.readFileSync)(import_node_path4.default.join(directory, "icu.gz"));
6041
+ const bytes = (0, import_node_fs3.readFileSync)(import_node_path5.default.join(directory, "app.wasm"));
6042
+ const gzip2 = (0, import_node_fs3.readFileSync)(import_node_path5.default.join(directory, "icu.gz"));
5188
6043
  if ((0, import_node_crypto2.createHash)("sha256").update(bytes).digest("hex") !== receipt.wasm || (0, import_node_crypto2.createHash)("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
5189
6044
  return null;
5190
6045
  return { hash, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
@@ -5195,14 +6050,14 @@ function readCompiledArtifact(directory, hash) {
5195
6050
  }
5196
6051
  }
5197
6052
  function saveCompiledArtifact(root, artifact) {
5198
- const directory = import_node_path4.default.join(root, "artifact");
6053
+ const directory = import_node_path5.default.join(root, "artifact");
5199
6054
  (0, import_node_fs3.mkdirSync)(directory, { recursive: true });
5200
- const pending = (0, import_node_fs3.mkdtempSync)(import_node_path4.default.join(root, ".artifact-"));
6055
+ const pending = (0, import_node_fs3.mkdtempSync)(import_node_path5.default.join(root, ".artifact-"));
5201
6056
  try {
5202
- (0, import_node_fs3.writeFileSync)(import_node_path4.default.join(pending, "app.wasm"), artifact.bytes);
5203
- (0, import_node_fs3.writeFileSync)(import_node_path4.default.join(pending, "icu.gz"), artifact.icu.gzip);
6057
+ (0, import_node_fs3.writeFileSync)(import_node_path5.default.join(pending, "app.wasm"), artifact.bytes);
6058
+ (0, import_node_fs3.writeFileSync)(import_node_path5.default.join(pending, "icu.gz"), artifact.icu.gzip);
5204
6059
  (0, import_node_fs3.writeFileSync)(
5205
- import_node_path4.default.join(pending, "artifact.json"),
6060
+ import_node_path5.default.join(pending, "artifact.json"),
5206
6061
  JSON.stringify({
5207
6062
  hash: artifact.hash,
5208
6063
  wasm: (0, import_node_crypto2.createHash)("sha256").update(artifact.bytes).digest("hex"),
@@ -5210,7 +6065,7 @@ function saveCompiledArtifact(root, artifact) {
5210
6065
  })
5211
6066
  );
5212
6067
  for (const file of ["app.wasm", "icu.gz", "artifact.json"]) {
5213
- (0, import_node_fs3.renameSync)(import_node_path4.default.join(pending, file), import_node_path4.default.join(directory, file));
6068
+ (0, import_node_fs3.renameSync)(import_node_path5.default.join(pending, file), import_node_path5.default.join(directory, file));
5214
6069
  }
5215
6070
  } finally {
5216
6071
  (0, import_node_fs3.rmSync)(pending, { recursive: true, force: true });
@@ -5231,14 +6086,14 @@ function compileSwiftProjectUnit(input, options) {
5231
6086
  options.signal?.throwIfAborted();
5232
6087
  (0, import_node_fs3.mkdirSync)(options.buildRoot, { recursive: true });
5233
6088
  const root = (0, import_node_fs3.realpathSync)(options.buildRoot);
5234
- const moduleRoot = import_node_path4.default.resolve(options.moduleRoot);
6089
+ const moduleRoot = import_node_path5.default.resolve(options.moduleRoot);
5235
6090
  const layout = {
5236
6091
  root,
5237
- sources: import_node_path4.default.join(root, "Sources", "App"),
6092
+ sources: import_node_path5.default.join(root, "Sources", "App"),
5238
6093
  multi: compileTargets(input).length > 0
5239
6094
  };
5240
6095
  const hash = swiftArtifactHash(input, options.release, moduleRoot);
5241
- const sharedRoot = import_node_path4.default.join(rnxHomeDir(), "cache", "swift-projects", hash);
6096
+ const sharedRoot = import_node_path5.default.join(rnxHomeDir(), "cache", "swift-projects", hash);
5242
6097
  const report = (message) => console.error(`[swift-project ${hash.slice(0, 16)}] ${message}`);
5243
6098
  report("checking verified artifacts");
5244
6099
  return serialize(
@@ -5249,17 +6104,17 @@ function compileSwiftProjectUnit(input, options) {
5249
6104
  report("reusing memory artifact");
5250
6105
  return retain(root, retained);
5251
6106
  }
5252
- const cached = readCompiledArtifact(import_node_path4.default.join(sharedRoot, "artifact"), hash);
5253
- const previous = cached ?? readCompiledArtifact(import_node_path4.default.join(root, "artifact"), hash);
6107
+ const cached = readCompiledArtifact(import_node_path5.default.join(sharedRoot, "artifact"), hash);
6108
+ const previous = cached ?? readCompiledArtifact(import_node_path5.default.join(root, "artifact"), hash);
5254
6109
  if (previous) {
5255
6110
  if (!cached) saveCompiledArtifact(sharedRoot, previous);
5256
6111
  report("reusing verified disk artifact");
5257
6112
  return retain(root, previous);
5258
6113
  }
5259
- if (process.platform === "darwin" && process.env.TM_SESSION && !admittedMacBuilderSlot() && process.env.CI !== "true" && moduleRoot === import_node_path4.default.resolve(__sootsim_import_meta_dirname, "../../sootsim-swift") && !swiftDistributionAt(moduleRoot)) {
5260
- const requestRoot = (0, import_node_fs3.mkdtempSync)(import_node_path4.default.join(root, ".builder-request-"));
5261
- const output = import_node_path4.default.join(requestRoot, "output");
5262
- const request = import_node_path4.default.join(requestRoot, "request.json");
6114
+ if (process.platform === "darwin" && process.env.TM_SESSION && !admittedMacBuilderSlot() && process.env.CI !== "true" && moduleRoot === import_node_path5.default.resolve(__sootsim_import_meta_dirname, "../../sootsim-swift") && !swiftDistributionAt(moduleRoot)) {
6115
+ const requestRoot = (0, import_node_fs3.mkdtempSync)(import_node_path5.default.join(root, ".builder-request-"));
6116
+ const output = import_node_path5.default.join(requestRoot, "output");
6117
+ const request = import_node_path5.default.join(requestRoot, "request.json");
5263
6118
  (0, import_node_fs3.writeFileSync)(
5264
6119
  request,
5265
6120
  JSON.stringify({
@@ -5267,16 +6122,18 @@ function compileSwiftProjectUnit(input, options) {
5267
6122
  hash,
5268
6123
  release: options.release,
5269
6124
  timeoutMs: options.timeoutMs,
5270
- buildKey: (0, import_node_crypto2.createHash)("sha256").update(root).digest("hex").slice(0, 32)
6125
+ // framework sources and compiler inputs own the shared object tree;
6126
+ // unrelated app edits reuse it without retaining stale private ABI.
6127
+ buildKey: swiftProjectBuildKey(moduleRoot, options.release)
5271
6128
  })
5272
6129
  );
5273
6130
  try {
5274
- const repo = import_node_path4.default.resolve(moduleRoot, "../..");
6131
+ const repo = import_node_path5.default.resolve(moduleRoot, "../..");
5275
6132
  report("requesting builder admission or cached result");
5276
6133
  await runCompiler(
5277
6134
  "bun",
5278
6135
  [
5279
- import_node_path4.default.join(repo, "scripts/build/swift-project.ts"),
6136
+ import_node_path5.default.join(repo, "scripts/build/swift-project.ts"),
5280
6137
  "--request",
5281
6138
  request,
5282
6139
  "--output",
@@ -5308,7 +6165,7 @@ function compileSwiftProjectUnit(input, options) {
5308
6165
  }
5309
6166
  }
5310
6167
  writeSwiftProject(layout, input, moduleRoot);
5311
- const swift = import_node_path4.default.join(options.toolchainBin, "swift");
6168
+ const swift = import_node_path5.default.join(options.toolchainBin, "swift");
5312
6169
  if (!(0, import_node_fs3.existsSync)(swift)) {
5313
6170
  throw new Error(
5314
6171
  `swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
@@ -5325,12 +6182,14 @@ function compileSwiftProjectUnit(input, options) {
5325
6182
  const icu = swiftIcuAsset(options.toolchainBin, sdk);
5326
6183
  const buildArgs = [
5327
6184
  "build",
6185
+ ...swiftPackageCacheOptions(),
5328
6186
  "--build-system",
5329
6187
  "native",
5330
6188
  "-j",
5331
6189
  BUILD_JOBS,
5332
6190
  "--package-path",
5333
6191
  root,
6192
+ ...swiftSdkOptions(),
5334
6193
  "--swift-sdk",
5335
6194
  sdk,
5336
6195
  "-c",
@@ -5354,8 +6213,8 @@ function compileSwiftProjectUnit(input, options) {
5354
6213
  // shipped host plugins resolve against the selected compiler's runtime.
5355
6214
  ...process.platform === "linux" ? {
5356
6215
  LD_LIBRARY_PATH: [
5357
- import_node_path4.default.resolve(options.toolchainBin, "../lib/swift/linux"),
5358
- import_node_path4.default.resolve(options.toolchainBin, "../lib/swift/host"),
6216
+ import_node_path5.default.resolve(options.toolchainBin, "../lib/swift/linux"),
6217
+ import_node_path5.default.resolve(options.toolchainBin, "../lib/swift/host"),
5359
6218
  process.env.LD_LIBRARY_PATH
5360
6219
  ].filter(Boolean).join(":")
5361
6220
  } : {}
@@ -5366,10 +6225,10 @@ function compileSwiftProjectUnit(input, options) {
5366
6225
  };
5367
6226
  report("compiling and linking Swift modules");
5368
6227
  try {
5369
- await runCompiler(swift, buildArgs, buildOptions, true);
6228
+ await runCompiler(swift, buildArgs, buildOptions, SWIFTPM_PROGRESS, SWIFTPM_NOISE);
5370
6229
  } catch (error) {
5371
6230
  const output = outputOf(error);
5372
- const moduleCache = import_node_path4.default.join(
6231
+ const moduleCache = import_node_path5.default.join(
5373
6232
  root,
5374
6233
  ".build",
5375
6234
  WASM_TRIPLE,
@@ -5379,7 +6238,13 @@ function compileSwiftProjectUnit(input, options) {
5379
6238
  if (output.includes("was compiled with module cache path") && (0, import_node_fs3.existsSync)(moduleCache)) {
5380
6239
  (0, import_node_fs3.rmSync)(moduleCache, { recursive: true, force: true });
5381
6240
  try {
5382
- await runCompiler(swift, buildArgs, buildOptions, true);
6241
+ await runCompiler(
6242
+ swift,
6243
+ buildArgs,
6244
+ buildOptions,
6245
+ SWIFTPM_PROGRESS,
6246
+ SWIFTPM_NOISE
6247
+ );
5383
6248
  } catch (retryError) {
5384
6249
  throw new Error(
5385
6250
  projectDiagnostic(outputOf(retryError), layout, input.files),
@@ -5425,6 +6290,7 @@ function compileSwiftProjectUnit(input, options) {
5425
6290
  swiftApplicationEntry,
5426
6291
  swiftArtifactHash,
5427
6292
  swiftAvailableModules,
6293
+ swiftCodeMask,
5428
6294
  swiftDistributionAt,
5429
6295
  swiftIcuAsset,
5430
6296
  swiftImportNames,
@@ -5433,6 +6299,7 @@ function compileSwiftProjectUnit(input, options) {
5433
6299
  swiftModuleInputFiles,
5434
6300
  swiftModuleSdk,
5435
6301
  swiftPeachModules,
6302
+ swiftProjectBuildKey,
5436
6303
  swiftSdkPaths,
5437
6304
  swiftSourceAsIOS,
5438
6305
  swiftSourceClosure,