peachsim 0.1.2605 → 0.1.2607

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 (147) hide show
  1. package/cli/commands/package.ts +71 -39
  2. package/cli/commands/perf-native.ts +259 -6
  3. package/cli/commands/shell-url.ts +1 -0
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +2 -2
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +5 -5
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +3 -3
  16. package/dist-lib/bundle-channel.cjs +1520 -932
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +3 -3
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +3 -3
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +2 -2
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +7 -7
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +5 -5
  27. package/dist-lib/detox/index.cjs +1 -1
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/esm-chunks/{acorn-UNOYFUKI.mjs → acorn-KFWXYMX5.mjs} +3 -3
  30. package/dist-lib/esm-chunks/{chunk-WSRPZF7M.mjs → chunk-6JPUMAC2.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-M4G5YUO7.mjs → chunk-6NDABMDX.mjs} +3 -3
  32. package/dist-lib/esm-chunks/{chunk-GT54N3GG.mjs → chunk-7SKDPTZN.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-FXONOT2L.mjs → chunk-ACAXWH62.mjs} +1 -1
  34. package/dist-lib/esm-chunks/chunk-ARYRQJUB.mjs +326 -0
  35. package/dist-lib/esm-chunks/{chunk-WB2EBX5Q.mjs → chunk-BNAXRY5Q.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-AST6VA7D.mjs → chunk-CA64UUHF.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-B54SPDLA.mjs → chunk-DBW62F4N.mjs} +3 -2
  38. package/dist-lib/esm-chunks/{chunk-7K33ENH6.mjs → chunk-ESS2CG5G.mjs} +5 -5
  39. package/dist-lib/esm-chunks/{chunk-LFN7VAPB.mjs → chunk-IGSLOAPL.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-RJCM34J7.mjs → chunk-KIIALACX.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-YO756PYQ.mjs → chunk-LJZ373SO.mjs} +819 -681
  42. package/dist-lib/esm-chunks/{chunk-VRQPEROV.mjs → chunk-M4ORY3NH.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-3XUIDCBF.mjs → chunk-MBWWOGI5.mjs} +4 -4
  44. package/dist-lib/esm-chunks/{chunk-M3V4F5OV.mjs → chunk-O5BPZVLB.mjs} +5 -5
  45. package/dist-lib/esm-chunks/chunk-P5Q5QCTP.mjs +32 -0
  46. package/dist-lib/esm-chunks/{chunk-O55DZ2EL.mjs → chunk-QJUAWJDB.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-HHS4A7GI.mjs → chunk-RIDXKGBZ.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-LG76KUUO.mjs → chunk-TD2DBEKQ.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-AYHTHFG4.mjs → chunk-UTSB5CDG.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-UPUOCALX.mjs → chunk-WMWOBH7E.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{chunk-6TE7WLSF.mjs → chunk-ZNGLVJYL.mjs} +1 -1
  52. package/dist-lib/esm-chunks/{metro-layout-parser-YRBZCLVD.mjs → metro-layout-parser-UY3B6VGU.mjs} +3 -3
  53. package/dist-lib/esm-chunks/{swift-package-prebuilt-S7KR6TKE.mjs → swift-package-prebuilt-HDHPWS44.mjs} +10 -10
  54. package/dist-lib/esm-chunks/{swift-sdk-app-module-3JNA7PCB.mjs → swift-sdk-app-module-U6G5RZV2.mjs} +14 -14
  55. package/dist-lib/esm-chunks/{swift-sdk-image-3P4IUP2A.mjs → swift-sdk-image-PVDA2MVM.mjs} +14 -14
  56. package/dist-lib/esm-chunks/{swift-sdk-image-producer-EA2RYBM4.mjs → swift-sdk-image-producer-YHPS3KNR.mjs} +4 -4
  57. package/dist-lib/expo-swift-bundle.cjs +1519 -931
  58. package/dist-lib/expo-swift-metadata.cjs +1 -1
  59. package/dist-lib/expo-swift-metadata.mjs +7 -7
  60. package/dist-lib/home-paths.cjs +1 -1
  61. package/dist-lib/host/bridge-host.cjs +1677 -947
  62. package/dist-lib/host/fetch-proxy-handler.cjs +44 -37
  63. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  64. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  65. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  66. package/dist-lib/host/websocket-proxy.cjs +1 -1
  67. package/dist-lib/index.cjs +1 -1
  68. package/dist-lib/kotlin-host.cjs +1 -1
  69. package/dist-lib/menu.cjs +1 -1
  70. package/dist-lib/menu.mjs +3 -3
  71. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  72. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  73. package/dist-lib/metro-production-bundle.cjs +1 -1
  74. package/dist-lib/metro-production-bundle.mjs +4 -4
  75. package/dist-lib/native-app-identity-project.cjs +540 -247
  76. package/dist-lib/native-app-identity-project.mjs +218 -1828
  77. package/dist-lib/native-app-identity.cjs +1 -1
  78. package/dist-lib/native-app-identity.mjs +6 -6
  79. package/dist-lib/native-firebase-metadata.cjs +1 -1
  80. package/dist-lib/native-firebase-metadata.mjs +3 -3
  81. package/dist-lib/pdfium-raster.cjs +1 -1
  82. package/dist-lib/pdfium-raster.mjs +2 -2
  83. package/dist-lib/plist.cjs +327 -15
  84. package/dist-lib/plist.mjs +13 -5
  85. package/dist-lib/profiles.cjs +1 -1
  86. package/dist-lib/public-brand.cjs +1 -1
  87. package/dist-lib/public-origins-lib-esm.json +82 -129
  88. package/dist-lib/public-origins-lib.json +69 -140
  89. package/dist-lib/react-native-host-modules.cjs +1 -1
  90. package/dist-lib/react-native-host-modules.mjs +2 -2
  91. package/dist-lib/reap-browser.cjs +1 -1
  92. package/dist-lib/scripts/dev-server-scanner.cjs +211 -3
  93. package/dist-lib/sdk.cjs +1 -1
  94. package/dist-lib/sdk.mjs +8 -8
  95. package/dist-lib/skills.cjs +1693 -963
  96. package/dist-lib/swift-compile.cjs +812 -673
  97. package/dist-lib/swift-compile.mjs +10 -10
  98. package/dist-lib/swift-package.cjs +1 -1
  99. package/dist-lib/swift-package.mjs +3 -3
  100. package/dist-lib/swift-submit.cjs +1 -1
  101. package/dist-lib/swift-submit.mjs +6 -6
  102. package/dist-lib/swift-svg-raster.cjs +1 -1
  103. package/dist-lib/swift-svg-raster.mjs +2 -2
  104. package/dist-lib/swift-toolchain.cjs +3 -2
  105. package/dist-lib/swift.cjs +1 -1
  106. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  107. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  108. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  109. package/dist-lib/vendor/acorn.cjs +1 -1
  110. package/dist-lib/vendor/magic-string.cjs +1 -1
  111. package/dist-lib/vendor/stream-json.cjs +1 -1
  112. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  113. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  114. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  115. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  116. package/dist-lib/vendor/sucrase.cjs +1 -1
  117. package/dist-lib/vendor/terser.cjs +1 -1
  118. package/dist-lib/vendor/valibot.cjs +1 -1
  119. package/dist-lib/vendor/ws.cjs +1 -1
  120. package/dist-lib/vendor/zod.cjs +1 -1
  121. package/dist-lib/worklet-executable.cjs +1 -1
  122. package/dist-lib/worklet-executable.mjs +3 -3
  123. package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +38 -2
  124. package/dist-types/packages/peach-globals/src/canvasAgentContract.d.ts +8 -0
  125. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  126. package/package.json +1 -6
  127. package/src/agent-prompt.ts +5 -1
  128. package/src/bazel-project.ts +1 -1
  129. package/src/expo-native-prebuilt.ts +1 -1
  130. package/src/expo-workspace-exclusion.ts +1 -1
  131. package/src/gitignore.ts +175 -0
  132. package/src/intent-definition/plist-reader.ts +22 -168
  133. package/src/one-native-controls-package.ts +143 -1
  134. package/src/oneNativeControlsContract.ts +1 -0
  135. package/src/plist-bytes.ts +144 -2
  136. package/src/plist.ts +359 -2
  137. package/src/swift-compile-budget.ts +28 -7
  138. package/src/swift-compile.ts +972 -809
  139. package/src/swift-guest-compile.ts +3 -0
  140. package/src/swift-toolchain.ts +4 -1
  141. package/src/xcode-project.ts +1 -1
  142. package/dist-lib/esm-chunks/chunk-OW4VRQKO.mjs +0 -10993
  143. package/dist-lib/esm-chunks/chunk-ZSHGFGW7.mjs +0 -65
  144. package/dist-lib/vendor/@xmldom/xmldom.cjs +0 -6481
  145. package/dist-lib/vendor/bplist-parser.cjs +0 -1589
  146. package/dist-lib/vendor/ignore.cjs +0 -455
  147. package/dist-lib/vendor/plist.cjs +0 -10978
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -5284,23 +5284,23 @@ function isNativeAppIdentity(value) {
5284
5284
  if (platform2 === "android" && !/^[1-9][0-9]*$/.test(buildVersion)) return false;
5285
5285
  return true;
5286
5286
  }
5287
- function readGoogleSignInConfiguration(plist6, resources) {
5287
+ function readGoogleSignInConfiguration(plist2, resources) {
5288
5288
  const clientIds = {};
5289
5289
  for (const [file, value] of Object.entries(resources)) {
5290
5290
  if (isRecord(value) && typeof value.CLIENT_ID === "string")
5291
5291
  clientIds[file.split("/").pop()?.replace(/\.plist$/, "") ?? file] = value.CLIENT_ID;
5292
5292
  }
5293
5293
  const urlSchemes = [];
5294
- for (const entry of Array.isArray(plist6.CFBundleURLTypes) ? plist6.CFBundleURLTypes : []) {
5294
+ for (const entry of Array.isArray(plist2.CFBundleURLTypes) ? plist2.CFBundleURLTypes : []) {
5295
5295
  if (!isRecord(entry) || !Array.isArray(entry.CFBundleURLSchemes)) continue;
5296
5296
  for (const scheme of entry.CFBundleURLSchemes)
5297
5297
  if (typeof scheme === "string") urlSchemes.push(scheme);
5298
5298
  }
5299
5299
  return {
5300
- clientId: plist6.GIDClientID,
5301
- serverClientId: plist6.GIDServerClientID,
5302
- hostedDomain: plist6.GIDHostedDomain,
5303
- openIDRealm: plist6.GIDOpenIDRealm,
5300
+ clientId: plist2.GIDClientID,
5301
+ serverClientId: plist2.GIDServerClientID,
5302
+ hostedDomain: plist2.GIDHostedDomain,
5303
+ openIDRealm: plist2.GIDOpenIDRealm,
5304
5304
  urlSchemes,
5305
5305
  clientIds
5306
5306
  };
@@ -5935,6 +5935,160 @@ var init_admitted_mac_build = __esm({
5935
5935
  }
5936
5936
  });
5937
5937
 
5938
+ // src/gitignore.ts
5939
+ function stripTrailingSpaces(line) {
5940
+ let end = line.length;
5941
+ while (end > 0 && line[end - 1] === " ") {
5942
+ let slashes = 0;
5943
+ for (let i = end - 2; i >= 0 && line[i] === "\\"; i--) slashes++;
5944
+ if (slashes % 2 === 1) break;
5945
+ end--;
5946
+ }
5947
+ return line.slice(0, end);
5948
+ }
5949
+ function globToRegexSource(pattern) {
5950
+ let out = "";
5951
+ let i = 0;
5952
+ while (i < pattern.length) {
5953
+ const ch = pattern[i];
5954
+ if (ch === "\\" && i + 1 < pattern.length) {
5955
+ out += pattern[i + 1].replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5956
+ i += 2;
5957
+ continue;
5958
+ }
5959
+ if (ch === "*") {
5960
+ if (pattern[i + 1] === "*") {
5961
+ const prevIsSlashOrStart = i === 0 || pattern[i - 1] === "/";
5962
+ const nextIsSlash = pattern[i + 2] === "/";
5963
+ const nextIsEnd = i + 2 === pattern.length;
5964
+ if (prevIsSlashOrStart && nextIsSlash) {
5965
+ out += "(?:.+/)?";
5966
+ i += 3;
5967
+ continue;
5968
+ }
5969
+ if (prevIsSlashOrStart && nextIsEnd) {
5970
+ out += ".*";
5971
+ i += 2;
5972
+ continue;
5973
+ }
5974
+ out += ".*";
5975
+ i += 2;
5976
+ continue;
5977
+ }
5978
+ out += "[^/]*";
5979
+ i++;
5980
+ continue;
5981
+ }
5982
+ if (ch === "?") {
5983
+ out += "[^/]";
5984
+ i++;
5985
+ continue;
5986
+ }
5987
+ if (ch === "[") {
5988
+ let j = i + 1;
5989
+ if (j < pattern.length && (pattern[j] === "!" || pattern[j] === "^")) j++;
5990
+ if (j < pattern.length && pattern[j] === "]") j++;
5991
+ while (j < pattern.length && pattern[j] !== "]") {
5992
+ if (pattern[j] === "\\" && j + 1 < pattern.length) j += 2;
5993
+ else j++;
5994
+ }
5995
+ if (j < pattern.length) {
5996
+ let body = pattern.slice(i + 1, j);
5997
+ if (body.startsWith("!")) body = `^${body.slice(1)}`;
5998
+ out += `[${body}]`;
5999
+ i = j + 1;
6000
+ continue;
6001
+ }
6002
+ }
6003
+ out += ch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6004
+ i++;
6005
+ }
6006
+ return out;
6007
+ }
6008
+ function compileRule(rawLine) {
6009
+ const withoutCr = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
6010
+ const trimmed = stripTrailingSpaces(withoutCr);
6011
+ if (!trimmed || trimmed.startsWith("#")) return null;
6012
+ let negative = false;
6013
+ let pattern = trimmed;
6014
+ if (pattern.startsWith("!")) {
6015
+ negative = true;
6016
+ pattern = pattern.slice(1);
6017
+ }
6018
+ if (!pattern) return null;
6019
+ const directoryOnly = pattern.endsWith("/");
6020
+ if (directoryOnly) {
6021
+ pattern = pattern.slice(0, -1);
6022
+ if (!pattern) return null;
6023
+ }
6024
+ const anchored = pattern.includes("/");
6025
+ if (pattern.startsWith("/")) {
6026
+ pattern = pattern.slice(1);
6027
+ }
6028
+ const body = globToRegexSource(pattern);
6029
+ const prefix = anchored ? "^" : "(?:^|/)";
6030
+ const regex2 = new RegExp(`${prefix}${body}$`, "i");
6031
+ return { negative, directoryOnly, regex: regex2 };
6032
+ }
6033
+ function normalizePath(input) {
6034
+ const isDirectory5 = input.endsWith("/");
6035
+ let normalized = isDirectory5 ? input.slice(0, -1) : input;
6036
+ if (normalized.startsWith("./")) normalized = normalized.slice(2);
6037
+ return { path: normalized, isDirectory: isDirectory5 };
6038
+ }
6039
+ function createGitignoreMatcher() {
6040
+ const rules2 = [];
6041
+ const matchSingle = (candidate, isDirectory5) => {
6042
+ let ignored = false;
6043
+ let unignored = false;
6044
+ for (const rule of rules2) {
6045
+ if (rule.directoryOnly && !isDirectory5) continue;
6046
+ if (!rule.regex.test(candidate)) continue;
6047
+ if (rule.negative) {
6048
+ ignored = false;
6049
+ unignored = true;
6050
+ } else {
6051
+ ignored = true;
6052
+ unignored = false;
6053
+ }
6054
+ }
6055
+ return { ignored, unignored };
6056
+ };
6057
+ const matcher = {
6058
+ add(patterns) {
6059
+ const list2 = typeof patterns === "string" ? patterns.split("\n") : patterns;
6060
+ for (const entry of list2) {
6061
+ for (const line of entry.split("\n")) {
6062
+ const compiled = compileRule(line);
6063
+ if (compiled) rules2.push(compiled);
6064
+ }
6065
+ }
6066
+ return matcher;
6067
+ },
6068
+ test(relativePath2) {
6069
+ const { path: path139, isDirectory: isDirectory5 } = normalizePath(relativePath2);
6070
+ if (!path139) return { ignored: false, unignored: false };
6071
+ const parts = path139.split("/");
6072
+ let prefix = "";
6073
+ for (let i = 0; i < parts.length - 1; i++) {
6074
+ prefix = prefix ? `${prefix}/${parts[i]}` : parts[i];
6075
+ const parent = matchSingle(prefix, true);
6076
+ if (parent.ignored) return { ignored: true, unignored: false };
6077
+ }
6078
+ return matchSingle(path139, isDirectory5);
6079
+ },
6080
+ ignores(relativePath2) {
6081
+ return matcher.test(relativePath2).ignored;
6082
+ }
6083
+ };
6084
+ return matcher;
6085
+ }
6086
+ var init_gitignore = __esm({
6087
+ "src/gitignore.ts"() {
6088
+ "use strict";
6089
+ }
6090
+ });
6091
+
5938
6092
  // src/expo-workspace-exclusion.ts
5939
6093
  async function workspaceExclusion(root, portable = false, linkedPackages = []) {
5940
6094
  const listed = await (0, import_node_util.promisify)(import_node_child_process6.execFile)(
@@ -6004,7 +6158,7 @@ function gitignoreRules(root) {
6004
6158
  let rules2 = ignoreFiles.get(directory2);
6005
6159
  if (rules2 === void 0) {
6006
6160
  const file = import_node_path9.default.join(root, directory2, ".gitignore");
6007
- rules2 = import_node_fs11.default.existsSync(file) ? (0, import_ignore.default)().add(import_node_fs11.default.readFileSync(file, "utf8")) : null;
6161
+ rules2 = import_node_fs11.default.existsSync(file) ? createGitignoreMatcher().add(import_node_fs11.default.readFileSync(file, "utf8")) : null;
6008
6162
  ignoreFiles.set(directory2, rules2);
6009
6163
  }
6010
6164
  if (!rules2) continue;
@@ -6016,7 +6170,7 @@ function gitignoreRules(root) {
6016
6170
  return excluded;
6017
6171
  };
6018
6172
  }
6019
- var import_node_child_process6, import_node_fs11, import_node_path9, import_node_util, import_ignore, gitEnvironment;
6173
+ var import_node_child_process6, import_node_fs11, import_node_path9, import_node_util, gitEnvironment;
6020
6174
  var init_expo_workspace_exclusion = __esm({
6021
6175
  "src/expo-workspace-exclusion.ts"() {
6022
6176
  "use strict";
@@ -6024,7 +6178,7 @@ var init_expo_workspace_exclusion = __esm({
6024
6178
  import_node_fs11 = __toESM(require("node:fs"), 1);
6025
6179
  import_node_path9 = __toESM(require("node:path"), 1);
6026
6180
  import_node_util = require("node:util");
6027
- import_ignore = __toESM(require("peachsim/vendor/ignore"), 1);
6181
+ init_gitignore();
6028
6182
  gitEnvironment = () => ({
6029
6183
  ...process.env,
6030
6184
  GIT_CONFIG_GLOBAL: "/dev/null",
@@ -6419,7 +6573,8 @@ function swiftCompilerRelease(release) {
6419
6573
  }
6420
6574
  function swiftToolchainBin(release) {
6421
6575
  if (process.platform === "darwin") {
6422
- const dirs = [import_node_os5.default.homedir(), "/"].map(
6576
+ const bases = [.../* @__PURE__ */ new Set([import_node_os5.default.homedir(), import_node_path12.default.dirname(peachHome()), "/"])];
6577
+ const dirs = bases.map(
6423
6578
  (base2) => import_node_path12.default.join(base2, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`)
6424
6579
  );
6425
6580
  const found = dirs.find((dir) => import_node_fs14.default.existsSync(import_node_path12.default.join(dir, "swift")));
@@ -9842,24 +9997,37 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
9842
9997
  async function withSwiftCompileBudget(compileTimeoutMs, signal, work) {
9843
9998
  const deadline = new AbortController();
9844
9999
  const combined = signal ? AbortSignal.any([signal, deadline.signal]) : deadline.signal;
10000
+ const stallMs = compileTimeoutMs ?? SWIFT_COMPILE_TIMEOUT_MS;
10001
+ let compiling = false;
9845
10002
  let timer = setTimeout(
9846
10003
  () => deadline.abort(new Error("Swift build lock wait timed out")),
9847
10004
  SWIFT_LOCK_WAIT_TIMEOUT_MS
9848
10005
  );
10006
+ const restart = () => {
10007
+ clearTimeout(timer);
10008
+ timer = setTimeout(
10009
+ () => deadline.abort(
10010
+ new Error(
10011
+ `Swift compilation made no progress for ${Math.round(stallMs / 1e3)}s`
10012
+ )
10013
+ ),
10014
+ stallMs
10015
+ );
10016
+ };
9849
10017
  try {
9850
10018
  combined.throwIfAborted();
9851
10019
  const result = await work({
9852
10020
  signal: combined,
9853
10021
  startCompile() {
9854
10022
  combined.throwIfAborted();
9855
- clearTimeout(timer);
9856
- timer = setTimeout(
9857
- () => deadline.abort(new Error("Swift compilation timed out")),
9858
- compileTimeoutMs ?? SWIFT_COMPILE_TIMEOUT_MS
9859
- );
10023
+ compiling = true;
10024
+ restart();
10025
+ },
10026
+ progress() {
10027
+ if (compiling && !deadline.signal.aborted) restart();
9860
10028
  }
9861
10029
  });
9862
- combined.throwIfAborted();
10030
+ signal?.throwIfAborted();
9863
10031
  return result;
9864
10032
  } finally {
9865
10033
  clearTimeout(timer);
@@ -31310,6 +31478,7 @@ async function compileGuestLink(options2) {
31310
31478
  );
31311
31479
  continue;
31312
31480
  }
31481
+ options2.onStage("lowering the app image");
31313
31482
  const lowerPromise = link.lower();
31314
31483
  await new Promise((resolve4) => setImmediate(resolve4));
31315
31484
  let binding;
@@ -31340,6 +31509,7 @@ async function compileGuestLink(options2) {
31340
31509
  return binding;
31341
31510
  }
31342
31511
  }
31512
+ options2.onStage("lowering the app image");
31343
31513
  await lowerWasm(options2.output, options2.optimized, {
31344
31514
  optimize: options2.optimize,
31345
31515
  skipPasses: ["duplicate-function-elimination"],
@@ -32793,8 +32963,18 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
32793
32963
  void stopping.catch(() => {
32794
32964
  });
32795
32965
  };
32966
+ const restartTimeout = () => {
32967
+ if (!options2.timeout) return;
32968
+ clearTimeout(timeout);
32969
+ timeout = setTimeout(() => {
32970
+ failure2 = new Error(`Swift compiler was silent for ${options2.timeout}ms`);
32971
+ stop();
32972
+ }, options2.timeout);
32973
+ };
32796
32974
  for (const name3 of ["stdout", "stderr"]) {
32797
32975
  child[name3].on("data", (bytes) => {
32976
+ restartTimeout();
32977
+ options2.onOutput?.();
32798
32978
  if (stream === true) process[name3].write(bytes);
32799
32979
  else if (stream) {
32800
32980
  const lines = (partial[name3] + bytes.toString()).split("\n");
@@ -32843,11 +33023,7 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
32843
33023
  resolve4(Buffer.concat(chunks.stdout).toString());
32844
33024
  }
32845
33025
  });
32846
- if (options2.timeout)
32847
- timeout = setTimeout(() => {
32848
- failure2 = new Error("Swift compiler timed out");
32849
- stop();
32850
- }, options2.timeout);
33026
+ restartTimeout();
32851
33027
  if (signal?.aborted) stop();
32852
33028
  });
32853
33029
  } finally {
@@ -35464,7 +35640,6 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
35464
35640
  (left, right) => right.path.length - left.path.length
35465
35641
  );
35466
35642
  const targetsByDir = indexTargetsByDirectory(bySourcePath);
35467
- const targetByName = new Map(targets.map((target) => [target.name, target]));
35468
35643
  const nativeTargets2 = input.nativeTargets ?? [];
35469
35644
  const nativeTargetByName = new Map(nativeTargets2.map((target) => [target.name, target]));
35470
35645
  const nativeTargetIndex = new Map(
@@ -35540,7 +35715,6 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
35540
35715
  checkedToolchain = swiftToolchain(pin2.release, swiftModuleSdk(moduleRoot));
35541
35716
  return checkedToolchain;
35542
35717
  };
35543
- const deploymentTarget = (name3) => nativeTargetByName.get(name3)?.deploymentTarget ?? targetByName.get(name3)?.iosDeploymentTarget ?? null;
35544
35718
  const targetStagedFiles = /* @__PURE__ */ new Map();
35545
35719
  const stageTargetFile = (target, file, contents2, options2) => {
35546
35720
  const relative4 = import_node_path53.default.relative(layout2.root, file).split(import_node_path53.default.sep).join(import_node_path53.default.posix.sep);
@@ -36615,7 +36789,7 @@ ${entry}`);
36615
36789
  };
36616
36790
  for (const target of targets) {
36617
36791
  if (!target.executable && !reachesNative(target.name)) continue;
36618
- const version2 = deploymentTarget(target.name);
36792
+ const version2 = nativeTargetByName.get(target.name)?.deploymentTarget ?? target.iosDeploymentTarget ?? null;
36619
36793
  const minimum = iosDeploymentMinimum(version2);
36620
36794
  if (minimum === void 0)
36621
36795
  throw new Error(
@@ -37727,24 +37901,18 @@ function readFrameworkProductsReceipt(scratch2, receiptKey) {
37727
37901
  } catch {
37728
37902
  return null;
37729
37903
  }
37730
- const archive = import_node_path53.default.join(scratch2, "lib");
37731
- const archiveStamp = import_node_path53.default.join(archive, ".receipt");
37732
- const archiveMatches = (0, import_node_fs53.existsSync)(archiveStamp) && (0, import_node_fs53.readFileSync)(archiveStamp, "utf8") === receiptKey;
37904
+ const archiveRoot = import_node_path53.default.join(scratch2, "products-lib", receiptKey);
37905
+ if (parsed2.root !== archiveRoot) return null;
37733
37906
  if (!(0, import_node_fs53.existsSync)(parsed2.modules)) return null;
37734
- for (const [object8] of parsed2.archived) if (!(0, import_node_fs53.existsSync)(object8)) return null;
37907
+ for (const [object8, rel] of parsed2.archived) {
37908
+ if (!(0, import_node_fs53.existsSync)(object8) || !(0, import_node_fs53.existsSync)(import_node_path53.default.join(archiveRoot, rel))) return null;
37909
+ }
37735
37910
  for (const file of parsed2.providers) if (!(0, import_node_fs53.existsSync)(file)) return null;
37736
37911
  for (const file of parsed2.moduleMaps) if (!(0, import_node_fs53.existsSync)(file)) return null;
37737
- if (!archiveMatches) {
37738
- (0, import_node_fs53.rmSync)(archive, { recursive: true, force: true });
37739
- (0, import_node_fs53.mkdirSync)(archive, { recursive: true });
37740
- for (const [object8, rel] of parsed2.archived)
37741
- (0, import_node_fs53.symlinkSync)(object8, import_node_path53.default.join(scratch2, rel));
37742
- (0, import_node_fs53.writeFileSync)(archiveStamp, receiptKey);
37743
- }
37744
37912
  for (const file of parsed2.objects) if (!(0, import_node_fs53.existsSync)(file)) return null;
37745
37913
  for (const file of parsed2.lazyObjects) if (!(0, import_node_fs53.existsSync)(file)) return null;
37746
37914
  return {
37747
- root: scratch2,
37915
+ root: parsed2.root,
37748
37916
  modules: parsed2.modules,
37749
37917
  objects: parsed2.objects,
37750
37918
  lazyObjects: parsed2.lazyObjects,
@@ -37762,7 +37930,7 @@ async function buildFrameworkProducts(scratch2, args) {
37762
37930
  const selectorOptions = swiftObjCSelectorOptions(args.moduleRoot);
37763
37931
  const receiptKey = (0, import_node_crypto32.createHash)("sha256").update(
37764
37932
  JSON.stringify([
37765
- "framework-products/v1",
37933
+ "framework-products/v2",
37766
37934
  args.frameworkKey,
37767
37935
  unoptimized,
37768
37936
  args.sdk,
@@ -37920,28 +38088,40 @@ async function buildFrameworkProducts(scratch2, args) {
37920
38088
  }
37921
38089
  const providers = (0, import_node_fs53.readdirSync)(providerDir).filter((file) => file.endsWith(".o")).sort().map((file) => import_node_path53.default.join(providerDir, file));
37922
38090
  for (const provider of providers) linked.owners.set(provider, "DarwinRecords");
37923
- const archive = import_node_path53.default.join(scratch2, "lib");
37924
- (0, import_node_fs53.rmSync)(archive, { recursive: true, force: true });
37925
- (0, import_node_fs53.mkdirSync)(archive);
38091
+ const archiveBase = import_node_path53.default.join(scratch2, "products-lib");
38092
+ (0, import_node_fs53.mkdirSync)(archiveBase, { recursive: true });
38093
+ const archiveRoot = import_node_path53.default.join(archiveBase, receiptKey);
38094
+ const stagedArchiveRoot = `${archiveRoot}.tmp-${process.pid}-${(0, import_node_crypto32.randomUUID)()}`;
38095
+ const stagedArchive = import_node_path53.default.join(stagedArchiveRoot, "lib");
38096
+ (0, import_node_fs53.mkdirSync)(stagedArchive, { recursive: true });
37926
38097
  const archived = /* @__PURE__ */ new Map();
37927
- for (const object8 of objects) {
37928
- const target = linked.owners.get(object8);
37929
- const dir = import_node_path53.default.join(release, `${target}.build`);
37930
- if (!target || target === "Darwin" || !object8.startsWith(dir + import_node_path53.default.sep)) continue;
37931
- const name3 = `${target}-${import_node_path53.default.relative(dir, object8).replaceAll(import_node_path53.default.sep, "-").replace(/\.swift\.o$/, ".o")}`;
37932
- (0, import_node_fs53.symlinkSync)(object8, import_node_path53.default.join(archive, name3));
37933
- archived.set(object8, `lib/${name3}`);
37934
- }
37935
- const roots = swiftObjcRootObjects(`${scratch2}
37936
- ${args.frameworkKey}`, scratch2, [
37937
- ...archived.values()
37938
- ]);
38098
+ try {
38099
+ for (const object8 of objects) {
38100
+ const target = linked.owners.get(object8);
38101
+ const dir = import_node_path53.default.join(release, `${target}.build`);
38102
+ if (!target || target === "Darwin" || !object8.startsWith(dir + import_node_path53.default.sep)) continue;
38103
+ const name3 = `${target}-${import_node_path53.default.relative(dir, object8).replaceAll(import_node_path53.default.sep, "-").replace(/\.swift\.o$/, ".o")}`;
38104
+ (0, import_node_fs53.symlinkSync)(object8, import_node_path53.default.join(stagedArchive, name3));
38105
+ archived.set(object8, `lib/${name3}`);
38106
+ }
38107
+ (0, import_node_fs53.rmSync)(archiveRoot, { recursive: true, force: true });
38108
+ (0, import_node_fs53.renameSync)(stagedArchiveRoot, archiveRoot);
38109
+ } catch (error) {
38110
+ (0, import_node_fs53.rmSync)(stagedArchiveRoot, { recursive: true, force: true });
38111
+ throw error;
38112
+ }
38113
+ const roots = swiftObjcRootObjects(
38114
+ `${archiveRoot}
38115
+ ${args.frameworkKey}`,
38116
+ archiveRoot,
38117
+ [...archived.values()]
38118
+ );
37939
38119
  const linkedObjects = objects.map((object8) => {
37940
38120
  const name3 = archived.get(object8);
37941
- return name3 ? { path: import_node_path53.default.join(scratch2, name3), lazy: !roots.has(name3) } : { path: object8, lazy: false };
38121
+ return name3 ? { path: import_node_path53.default.join(archiveRoot, name3), lazy: !roots.has(name3) } : { path: object8, lazy: false };
37942
38122
  });
37943
38123
  const result = {
37944
- root: scratch2,
38124
+ root: archiveRoot,
37945
38125
  modules: import_node_path53.default.join(release, "Modules"),
37946
38126
  objects: linkedObjects.filter((object8) => !object8.lazy).map((object8) => object8.path),
37947
38127
  lazyObjects: linkedObjects.filter((object8) => object8.lazy).map((object8) => object8.path),
@@ -37951,7 +38131,6 @@ ${args.frameworkKey}`, scratch2, [
37951
38131
  moduleMaps: linked.moduleMaps,
37952
38132
  objcHeaders: linked.objcHeaders
37953
38133
  };
37954
- (0, import_node_fs53.writeFileSync)(import_node_path53.default.join(archive, ".receipt"), receiptKey);
37955
38134
  const receiptsDir = import_node_path53.default.join(scratch2, "products-ready");
37956
38135
  (0, import_node_fs53.mkdirSync)(receiptsDir, { recursive: true });
37957
38136
  const receiptFile2 = import_node_path53.default.join(receiptsDir, `${receiptKey}.json`);
@@ -37959,6 +38138,7 @@ ${args.frameworkKey}`, scratch2, [
37959
38138
  (0, import_node_fs53.writeFileSync)(
37960
38139
  partialReceipt,
37961
38140
  JSON.stringify({
38141
+ root: result.root,
37962
38142
  modules: result.modules,
37963
38143
  objects: result.objects,
37964
38144
  lazyObjects: result.lazyObjects,
@@ -37990,7 +38170,10 @@ function swiftFrameworkSlotRecord(slot, record5) {
37990
38170
  function swiftFrameworkSlotKey(slot) {
37991
38171
  return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_KEY);
37992
38172
  }
37993
- async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, unoptimized = false) {
38173
+ function swiftFrameworkSlotRelease(slot) {
38174
+ return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_RELEASE);
38175
+ }
38176
+ async function withSwiftFrameworkSlot(frameworkKey, release, moduleRoot, signal, work, unoptimized = false) {
37994
38177
  const slotCount = unoptimized ? SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS : SWIFT_FRAMEWORK_SLOTS;
37995
38178
  const slotsDir = swiftFrameworksDir(unoptimized);
37996
38179
  const slots = Array.from({ length: slotCount }, (_, index) => {
@@ -38013,9 +38196,12 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
38013
38196
  (0, import_node_fs53.readFileSync)(import_node_path53.default.join(moduleRoot, file))
38014
38197
  ])
38015
38198
  );
38016
- const ranked = slots.map((slot) => {
38199
+ const ranked = slots.map((slot, index) => {
38200
+ const slotKey = swiftFrameworkSlotKey(slot);
38201
+ if (slotKey === null) return { slot, index, tier: 1, changes: Infinity };
38202
+ if (swiftFrameworkSlotRelease(slot) !== release)
38203
+ return { slot, index, tier: 2, changes: Infinity };
38017
38204
  let changes = 0;
38018
- if (swiftFrameworkSlotKey(slot) === null) return { slot, changes: Infinity };
38019
38205
  const source = import_node_path53.default.join(slot, "source", "packages", import_node_path53.default.basename(moduleRoot));
38020
38206
  for (const [file, contents2] of inputs2) {
38021
38207
  try {
@@ -38027,18 +38213,22 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
38027
38213
  changes++;
38028
38214
  }
38029
38215
  }
38030
- return { slot, changes };
38031
- }).sort(
38032
- (left, right) => left.changes - right.changes || Number(own2(right.slot)) - Number(own2(left.slot)) || (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0)
38033
- );
38034
- for (const { slot, changes } of ranked) {
38216
+ return { slot, index, tier: 0, changes };
38217
+ }).sort((left, right) => {
38218
+ if (left.tier !== right.tier) return left.tier - right.tier;
38219
+ if (left.tier === 0)
38220
+ return left.changes - right.changes || Number(own2(right.slot)) - Number(own2(left.slot)) || (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0);
38221
+ if (left.tier === 1) return left.index - right.index;
38222
+ return (built2.get(left.slot) ?? 0) - (built2.get(right.slot) ?? 0);
38223
+ });
38224
+ for (const { slot, tier, changes } of ranked) {
38035
38225
  if (await hasLiveSwiftRootReaders(slot, signal)) continue;
38036
38226
  const result = await withSwiftRootLock(
38037
38227
  slot,
38038
38228
  async (lease) => {
38039
38229
  if (await hasLiveSwiftRootReaders(slot, signal)) return void 0;
38040
38230
  console.error(
38041
- `[swift-framework-cache] ${import_node_path53.default.basename(slot)} changedInputs=${changes} totalInputs=${inputs2.size}`
38231
+ `[swift-framework-cache] ${import_node_path53.default.basename(slot)} release=${release} tier=${tier} changedInputs=${changes} totalInputs=${inputs2.size}`
38042
38232
  );
38043
38233
  return { value: await run16(slot)(lease) };
38044
38234
  },
@@ -38050,6 +38240,43 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
38050
38240
  const nearest = ranked[0].slot;
38051
38241
  return withSwiftRootLock(nearest, run16(nearest), signal);
38052
38242
  }
38243
+ async function withSwiftBuildRootSlot(baseRoot, buildShape, signal, work) {
38244
+ const slots = Array.from({ length: SWIFT_BUILD_ROOT_SLOTS }, (_, index) => {
38245
+ const slot = index === 0 ? baseRoot : `${baseRoot}-s${index}`;
38246
+ (0, import_node_fs53.mkdirSync)(slot, { recursive: true });
38247
+ return slot;
38248
+ });
38249
+ const runInSlot = (slot, waitStart2) => (lease) => {
38250
+ const waitedMs = Date.now() - waitStart2;
38251
+ const now = /* @__PURE__ */ new Date();
38252
+ (0, import_node_fs53.utimesSync)(slot, now, now);
38253
+ return work(slot, lease, waitedMs);
38254
+ };
38255
+ const built2 = new Map(slots.map((slot) => [slot, (0, import_node_fs53.statSync)(slot).mtimeMs]));
38256
+ const ranked = slots.map((slot, index) => {
38257
+ const shape = swiftFrameworkSlotRecord(slot, SWIFT_BUILD_ROOT_SHAPE);
38258
+ const tier = shape === buildShape ? 0 : shape === null ? 1 : 2;
38259
+ return { slot, index, tier };
38260
+ }).sort((left, right) => {
38261
+ if (left.tier !== right.tier) return left.tier - right.tier;
38262
+ if (left.tier === 0)
38263
+ return (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0);
38264
+ if (left.tier === 1) return left.index - right.index;
38265
+ return (built2.get(left.slot) ?? 0) - (built2.get(right.slot) ?? 0);
38266
+ });
38267
+ for (const { slot } of ranked) {
38268
+ const result = await withSwiftRootLock(
38269
+ slot,
38270
+ async (lease) => ({ value: await runInSlot(slot, Date.now())(lease) }),
38271
+ signal,
38272
+ false
38273
+ );
38274
+ if (result) return result.value;
38275
+ }
38276
+ const nearest = ranked[0].slot;
38277
+ const waitStart = Date.now();
38278
+ return withSwiftRootLock(nearest, runInSlot(nearest, waitStart), signal);
38279
+ }
38053
38280
  function mirrorTree2(source, target, skip) {
38054
38281
  (0, import_node_fs53.mkdirSync)(target, { recursive: true });
38055
38282
  const wanted = /* @__PURE__ */ new Set();
@@ -38099,8 +38326,10 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
38099
38326
  const hadKey = swiftFrameworkSlotKey(slot);
38100
38327
  if (hadKey !== frameworkKey) {
38101
38328
  (0, import_node_fs53.rmSync)(import_node_path53.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), { force: true });
38329
+ (0, import_node_fs53.rmSync)(import_node_path53.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), { force: true });
38102
38330
  (0, import_node_fs53.rmSync)(import_node_path53.default.join(slot, "products-ready"), { recursive: true, force: true });
38103
- (0, import_node_fs53.rmSync)(import_node_path53.default.join(slot, "lib", ".receipt"), { force: true });
38331
+ (0, import_node_fs53.rmSync)(import_node_path53.default.join(slot, "products-lib"), { recursive: true, force: true });
38332
+ (0, import_node_fs53.rmSync)(import_node_path53.default.join(slot, "lib"), { recursive: true, force: true });
38104
38333
  const moduleRestructured = mirrorTree2(moduleRoot, stagedModule, ".build");
38105
38334
  const sdkRestructured = mirrorTree2(
38106
38335
  swiftSharedSdkRoot(moduleRoot, false),
@@ -38128,8 +38357,11 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
38128
38357
  (0, import_node_fs53.rmSync)(modules, { recursive: true, force: true });
38129
38358
  (0, import_node_fs53.symlinkSync)(target, modules);
38130
38359
  }
38360
+ (0, import_node_fs53.writeFileSync)(import_node_path53.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), release);
38131
38361
  (0, import_node_fs53.writeFileSync)(import_node_path53.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), frameworkKey);
38132
38362
  (0, import_node_fs53.writeFileSync)(import_node_path53.default.join(slot, SWIFT_FRAMEWORK_SLOT_ORIGIN), moduleRoot);
38363
+ } else if (swiftFrameworkSlotRelease(slot) !== release) {
38364
+ (0, import_node_fs53.writeFileSync)(import_node_path53.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), release);
38133
38365
  }
38134
38366
  return stagedModule;
38135
38367
  }
@@ -38357,660 +38589,717 @@ ${cap}` : "";
38357
38589
  (0, import_node_fs53.rmSync)(requestRoot, { recursive: true, force: true });
38358
38590
  }
38359
38591
  }
38592
+ const baseRoot = root;
38593
+ const canPoolBuildRoot = !options2.intermediates && !options2.project && !options2.linkOnly && import_node_path53.default.basename(import_node_path53.default.dirname(baseRoot)) === "swift-builds";
38594
+ const buildShape = canPoolBuildRoot ? (0, import_node_crypto32.createHash)("sha256").update(
38595
+ JSON.stringify([
38596
+ frameworkKey,
38597
+ Boolean(sdkImage),
38598
+ compileTargets(input).map((target) => target.name).sort(),
38599
+ input.oneModule === true,
38600
+ input.optimize === true,
38601
+ input.unoptimized === true,
38602
+ Object.keys(input.files).sort()
38603
+ ])
38604
+ ).digest("hex").slice(0, 16) : "";
38360
38605
  return withSwiftCompileBudget(options2.timeoutMs, options2.signal, async (budget) => {
38361
- return withSwiftRootLock(
38362
- root,
38363
- async (lease) => {
38364
- if (!options2.intermediates) {
38365
- const built2 = readCompiledArtifact(import_node_path53.default.join(sharedRoot, "artifact"), hash);
38366
- if (built2) {
38367
- report("reusing verified disk artifact");
38368
- return retain(root, built2);
38369
- }
38370
- }
38371
- const swift = import_node_path53.default.join(options2.toolchainBin, "swift");
38372
- if (!(0, import_node_fs53.existsSync)(swift)) {
38373
- throw new Error(
38374
- `swift-compile: no swift.org toolchain at ${options2.toolchainBin}; install ${options2.release} and its matching wasm sdk`
38375
- );
38606
+ const stage = (message) => {
38607
+ budget.progress();
38608
+ report(message);
38609
+ };
38610
+ const runLocked = (work) => {
38611
+ if (canPoolBuildRoot) {
38612
+ (0, import_node_fs53.mkdirSync)(sharedRoot, { recursive: true });
38613
+ return withSwiftRootLock(
38614
+ sharedRoot,
38615
+ async () => {
38616
+ const built2 = readCompiledArtifact(
38617
+ import_node_path53.default.join(sharedRoot, "artifact"),
38618
+ hash
38619
+ );
38620
+ if (built2) {
38621
+ stage("reusing verified disk artifact");
38622
+ return retain(baseRoot, built2);
38623
+ }
38624
+ return withSwiftBuildRootSlot(baseRoot, buildShape, budget.signal, work);
38625
+ },
38626
+ budget.signal
38627
+ );
38628
+ }
38629
+ const waitStart = Date.now();
38630
+ return withSwiftRootLock(
38631
+ baseRoot,
38632
+ (lease) => work(baseRoot, lease, Date.now() - waitStart),
38633
+ budget.signal
38634
+ );
38635
+ };
38636
+ return runLocked(async (slotRoot, lease, waitedMs) => {
38637
+ const root2 = slotRoot;
38638
+ const layout3 = {
38639
+ root: root2,
38640
+ sources: import_node_path53.default.join(root2, "Sources", "App"),
38641
+ multi: compileTargets(input).length > 0
38642
+ };
38643
+ if (!options2.intermediates) {
38644
+ const built2 = readCompiledArtifact(import_node_path53.default.join(sharedRoot, "artifact"), hash);
38645
+ if (built2) {
38646
+ stage("reusing verified disk artifact");
38647
+ return retain(baseRoot, built2);
38376
38648
  }
38377
- const unoptimized = input.unoptimized === true;
38378
- const withFrameworkLock = (work) => distribution ? work(null) : withSwiftFrameworkSlot(
38379
- frameworkKey,
38380
- moduleRoot,
38649
+ }
38650
+ if (waitedMs >= 1e3)
38651
+ report(`acquired build root ${import_node_path53.default.basename(root2)} after ${waitedMs}ms`);
38652
+ if (canPoolBuildRoot) {
38653
+ refreshSwiftCacheHold(root2);
38654
+ (0, import_node_fs53.writeFileSync)(import_node_path53.default.join(root2, SWIFT_BUILD_ROOT_SHAPE), buildShape);
38655
+ }
38656
+ const swift = import_node_path53.default.join(options2.toolchainBin, "swift");
38657
+ if (!(0, import_node_fs53.existsSync)(swift)) {
38658
+ throw new Error(
38659
+ `swift-compile: no swift.org toolchain at ${options2.toolchainBin}; install ${options2.release} and its matching wasm sdk`
38660
+ );
38661
+ }
38662
+ const unoptimized = input.unoptimized === true;
38663
+ const withFrameworkLock = (work) => distribution ? work(null) : withSwiftFrameworkSlot(
38664
+ frameworkKey,
38665
+ options2.release,
38666
+ moduleRoot,
38667
+ budget.signal,
38668
+ work,
38669
+ unoptimized
38670
+ );
38671
+ const baseBuildEnv = options2.project?.env ? {
38672
+ ...options2.project.env,
38673
+ // shipped host plugins resolve against the selected compiler's runtime.
38674
+ ...process.platform === "linux" ? {
38675
+ LD_LIBRARY_PATH: [
38676
+ import_node_path53.default.resolve(options2.toolchainBin, "../lib/swift/linux"),
38677
+ import_node_path53.default.resolve(options2.toolchainBin, "../lib/swift/host"),
38678
+ process.env.LD_LIBRARY_PATH
38679
+ ].filter(Boolean).join(":")
38680
+ } : {},
38681
+ PEACH_DEFER_WASM_LINK: "1"
38682
+ } : swiftCompilerBaseEnv(options2.toolchainBin, process.env);
38683
+ const {
38684
+ frameworkRoot,
38685
+ compileFrameworkRoot,
38686
+ macroPlugins,
38687
+ sdk: sdk2,
38688
+ icu,
38689
+ prebuilt,
38690
+ readHold
38691
+ } = await withFrameworkLock(async (slot, frameworkLease) => {
38692
+ budget.startCompile();
38693
+ if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
38694
+ await waitForNoSwiftRootReaders(slot, budget.signal);
38695
+ const frameworkRoot2 = mirrorDistribution ? syncSwiftDistributionMirror(root2, moduleRoot, mirrorDistribution) : distribution ? moduleRoot : stageFrameworkSource(moduleRoot, slot, frameworkKey, options2.release);
38696
+ if (!swiftModuleDigest(frameworkRoot2).equals(moduleDigest))
38697
+ throw new Error("Swift staged project source differs from the caller");
38698
+ stage("preparing compiler plugins");
38699
+ const macroPlugins2 = await ensureMacroPlugins(
38700
+ frameworkRoot2,
38701
+ options2.toolchainBin,
38702
+ options2.release,
38381
38703
  budget.signal,
38382
- work,
38383
- unoptimized
38704
+ frameworkLease
38384
38705
  );
38385
- const baseBuildEnv = options2.project?.env ? {
38386
- ...options2.project.env,
38387
- // shipped host plugins resolve against the selected compiler's runtime.
38388
- ...process.platform === "linux" ? {
38389
- LD_LIBRARY_PATH: [
38390
- import_node_path53.default.resolve(options2.toolchainBin, "../lib/swift/linux"),
38391
- import_node_path53.default.resolve(options2.toolchainBin, "../lib/swift/host"),
38392
- process.env.LD_LIBRARY_PATH
38393
- ].filter(Boolean).join(":")
38394
- } : {},
38395
- PEACH_DEFER_WASM_LINK: "1"
38396
- } : swiftCompilerBaseEnv(options2.toolchainBin, process.env);
38397
- const {
38706
+ const compileFrameworkRoot2 = distribution ? swiftDistributionCompileView(frameworkRoot2, distribution) : frameworkRoot2;
38707
+ const sdk3 = swiftModuleSdk(frameworkRoot2).wasmSdkId;
38708
+ const icu2 = options2.linkOnly ? null : swiftIcuAsset(options2.toolchainBin, sdk3);
38709
+ let prebuilt2;
38710
+ if (!distribution) {
38711
+ stage("compiling framework products");
38712
+ prebuilt2 = await buildFrameworkProducts(slot, {
38713
+ moduleRoot: frameworkRoot2,
38714
+ frameworkKey,
38715
+ input,
38716
+ swift,
38717
+ sdk: sdk3,
38718
+ toolchainBin: options2.toolchainBin,
38719
+ plugins: macroPlugins2,
38720
+ buildOptions: {
38721
+ env: baseBuildEnv,
38722
+ maxBuffer: 64 * 1024 * 1024,
38723
+ signal: budget.signal,
38724
+ onOutput: budget.progress,
38725
+ lease,
38726
+ frameworkLease
38727
+ }
38728
+ });
38729
+ }
38730
+ const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
38731
+ return {
38732
+ frameworkRoot: frameworkRoot2,
38733
+ compileFrameworkRoot: compileFrameworkRoot2,
38734
+ macroPlugins: macroPlugins2,
38735
+ sdk: sdk3,
38736
+ icu: icu2,
38737
+ prebuilt: prebuilt2,
38738
+ readHold: readHold2
38739
+ };
38740
+ });
38741
+ const buildOptions = {
38742
+ env: baseBuildEnv,
38743
+ maxBuffer: 64 * 1024 * 1024,
38744
+ signal: budget.signal,
38745
+ onOutput: budget.progress,
38746
+ lease
38747
+ };
38748
+ try {
38749
+ if (options2.project) removeProjectLinks(root2);
38750
+ const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
38751
+ if (retireStaleSwiftLink(
38752
+ root2,
38753
+ swiftLinkStamp({
38754
+ frameworkKey: `${options2.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
38755
+ packageHostMacros
38756
+ }),
38757
+ swiftLinkStamp({
38758
+ // a distribution's objects reach only the deferred link, and
38759
+ // the root's mirror keeps its compile inputs at fixed paths
38760
+ frameworkKey: distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
38761
+ prebuilt,
38762
+ packageHostMacros
38763
+ }),
38764
+ Boolean(options2.linkOnly)
38765
+ ))
38766
+ stage("framework revision changed; rebuilding the app link");
38767
+ const nativeToolset = needsNativeToolset(input, prebuilt);
38768
+ const preparation = writeSwiftProject(
38769
+ layout3,
38770
+ input,
38398
38771
  frameworkRoot,
38399
- compileFrameworkRoot,
38400
- macroPlugins,
38401
- sdk: sdk2,
38402
- icu,
38403
38772
  prebuilt,
38404
- readHold
38405
- } = await withFrameworkLock(async (slot, frameworkLease) => {
38406
- budget.startCompile();
38407
- if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
38408
- await waitForNoSwiftRootReaders(slot, budget.signal);
38409
- const frameworkRoot2 = mirrorDistribution ? syncSwiftDistributionMirror(root, moduleRoot, mirrorDistribution) : distribution ? moduleRoot : stageFrameworkSource(moduleRoot, slot, frameworkKey, options2.release);
38410
- if (!swiftModuleDigest(frameworkRoot2).equals(moduleDigest))
38411
- throw new Error("Swift staged project source differs from the caller");
38412
- report("preparing compiler plugins");
38413
- const macroPlugins2 = await ensureMacroPlugins(
38414
- frameworkRoot2,
38415
- options2.toolchainBin,
38416
- options2.release,
38417
- budget.signal,
38418
- frameworkLease
38773
+ !options2.project,
38774
+ options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0)
38775
+ );
38776
+ const productFile = import_node_path53.default.join(frameworkRoot, SWIFT_FRAMEWORK_PRODUCT_FILE);
38777
+ writeSwiftAutolinkLinker(
38778
+ root2,
38779
+ options2.toolchainBin,
38780
+ (0, import_node_fs53.existsSync)(productFile) ? [
38781
+ v6.parse(
38782
+ swiftFrameworkProductSchema,
38783
+ JSON.parse((0, import_node_fs53.readFileSync)(productFile, "utf8"))
38784
+ ).product.name
38785
+ ] : []
38786
+ );
38787
+ const compiler = preparation.targetToolset ? { CC: import_node_path53.default.join(root2, CLANG_TARGET_MODULE_WRAPPER) } : {};
38788
+ if (packageHostMacros?.length) {
38789
+ const swiftc = import_node_path53.default.join(root2, SWIFT_HOST_COMPILER_WRAPPER);
38790
+ writeBuildFile(
38791
+ swiftc,
38792
+ [
38793
+ "#!/bin/sh",
38794
+ "target=",
38795
+ "module=",
38796
+ "compile=",
38797
+ "previous=",
38798
+ "for argument do",
38799
+ ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
38800
+ ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
38801
+ " previous=$argument",
38802
+ "done",
38803
+ 'case "$target/$compile" in',
38804
+ " *-*-linux*/1)",
38805
+ ' case ",$PEACH_SWIFT_HOST_MACROS," in',
38806
+ ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
38807
+ " esac ;;",
38808
+ "esac",
38809
+ 'exec "$PEACH_SWIFTC" "$@"',
38810
+ ""
38811
+ ].join("\n")
38419
38812
  );
38420
- const compileFrameworkRoot2 = distribution ? swiftDistributionCompileView(frameworkRoot2, distribution) : frameworkRoot2;
38421
- const sdk3 = swiftModuleSdk(frameworkRoot2).wasmSdkId;
38422
- const icu2 = options2.linkOnly ? null : swiftIcuAsset(options2.toolchainBin, sdk3);
38423
- let prebuilt2;
38424
- if (!distribution) {
38425
- report("compiling framework products");
38426
- prebuilt2 = await buildFrameworkProducts(slot, {
38427
- moduleRoot: frameworkRoot2,
38428
- frameworkKey,
38429
- input,
38430
- swift,
38431
- sdk: sdk3,
38432
- toolchainBin: options2.toolchainBin,
38433
- plugins: macroPlugins2,
38434
- buildOptions: {
38435
- env: baseBuildEnv,
38436
- maxBuffer: 64 * 1024 * 1024,
38437
- signal: budget.signal,
38438
- lease,
38439
- frameworkLease
38440
- }
38441
- });
38813
+ (0, import_node_fs53.chmodSync)(swiftc, 493);
38814
+ compiler.SWIFT_EXEC = swiftc;
38815
+ compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
38816
+ compiler.PEACH_SWIFTC = import_node_path53.default.join(options2.toolchainBin, "swiftc");
38817
+ }
38818
+ const projectProcess = options2.project ? prepareSwiftProjectProcess(root2, options2.project) : void 0;
38819
+ const temporaryDirectory = projectProcess ? void 0 : import_node_path53.default.join(root2, ".build", "peach-compiler-tmp");
38820
+ const appOptions = projectProcess ? {
38821
+ ...buildOptions,
38822
+ uid: projectProcess.uid,
38823
+ gid: projectProcess.gid,
38824
+ confined: { ...projectProcess.env, ...compiler }
38825
+ } : {
38826
+ ...buildOptions,
38827
+ temporaryDirectory,
38828
+ env: {
38829
+ ...buildOptions.env,
38830
+ ...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
38831
+ ...compiler
38442
38832
  }
38443
- const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
38444
- return {
38445
- frameworkRoot: frameworkRoot2,
38446
- compileFrameworkRoot: compileFrameworkRoot2,
38447
- macroPlugins: macroPlugins2,
38448
- sdk: sdk3,
38449
- icu: icu2,
38450
- prebuilt: prebuilt2,
38451
- readHold: readHold2
38452
- };
38453
- });
38454
- const buildOptions = {
38455
- env: baseBuildEnv,
38456
- maxBuffer: 64 * 1024 * 1024,
38457
- signal: budget.signal,
38458
- lease
38459
38833
  };
38460
- try {
38461
- if (options2.project) removeProjectLinks(root);
38462
- const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
38463
- if (retireStaleSwiftLink(
38464
- root,
38465
- swiftLinkStamp({
38466
- frameworkKey: `${options2.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
38467
- packageHostMacros
38468
- }),
38469
- swiftLinkStamp({
38470
- // a distribution's objects reach only the deferred link, and
38471
- // the root's mirror keeps its compile inputs at fixed paths
38472
- frameworkKey: distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
38473
- prebuilt,
38474
- packageHostMacros
38475
- }),
38476
- Boolean(options2.linkOnly)
38477
- ))
38478
- report("framework revision changed; rebuilding the app link");
38479
- const nativeToolset = needsNativeToolset(input, prebuilt);
38480
- const preparation = writeSwiftProject(
38481
- layout2,
38482
- input,
38483
- frameworkRoot,
38484
- prebuilt,
38485
- !options2.project,
38486
- options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0)
38834
+ const unprepared = preparation.targetFailures.map(
38835
+ (failure2) => `error: target ${failure2}`
38836
+ );
38837
+ const forwarders = /* @__PURE__ */ new Map();
38838
+ for (const [file, text7] of Object.entries(input.files)) {
38839
+ const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text7)?.[1];
38840
+ if (!parents) continue;
38841
+ const directory2 = import_node_path53.default.posix.dirname(file);
38842
+ forwarders.set(
38843
+ `${import_node_path53.default.join(root2, directory2)}/${parents.slice(0, -1)}`,
38844
+ import_node_path53.default.posix.join("build", directory2, parents).replace(/\/$/, "")
38487
38845
  );
38488
- const productFile = import_node_path53.default.join(frameworkRoot, SWIFT_FRAMEWORK_PRODUCT_FILE);
38489
- writeSwiftAutolinkLinker(
38490
- root,
38491
- options2.toolchainBin,
38492
- (0, import_node_fs53.existsSync)(productFile) ? [
38493
- v6.parse(
38494
- swiftFrameworkProductSchema,
38495
- JSON.parse((0, import_node_fs53.readFileSync)(productFile, "utf8"))
38496
- ).product.name
38497
- ] : []
38846
+ }
38847
+ const jobs = swiftCompilerJobs();
38848
+ const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
38849
+ const perFile = input.unoptimized || incrementalPreview;
38850
+ const buildArgs = [
38851
+ "build",
38852
+ ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
38853
+ "--build-system",
38854
+ "native",
38855
+ "-j",
38856
+ String(jobs),
38857
+ "--package-path",
38858
+ root2,
38859
+ ...swiftCompileSdkOptions(frameworkRoot, options2.toolchainBin),
38860
+ ...swiftObjCSelectorOptions(frameworkRoot),
38861
+ "--swift-sdk",
38862
+ sdk2,
38863
+ ...preparation.targetToolset ? ["--toolset", import_node_path53.default.join(root2, ".peach-target-toolset.json")] : [],
38864
+ "-c",
38865
+ "release",
38866
+ ...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
38867
+ ...perFile ? [
38868
+ "-Xswiftc",
38869
+ "-no-whole-module-optimization",
38870
+ "-Xswiftc",
38871
+ "-j",
38872
+ "-Xswiftc",
38873
+ String(jobs)
38874
+ ] : [],
38875
+ ...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
38876
+ // the mirror finds a changed sdk header's readers in their
38877
+ // dependency files, which omit system headers by default
38878
+ ...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
38879
+ // the link strips debug info, so none is generated (as for the framework).
38880
+ // keep -num-threads fixed across caller core caps so llbuild does not
38881
+ // rebuild every target when callers alternate --cores, and bound backend
38882
+ // fan-out under high -j.
38883
+ "-Xswiftc",
38884
+ "-gnone",
38885
+ ...incrementalPreview ? [] : [
38886
+ "-Xswiftc",
38887
+ "-num-threads",
38888
+ "-Xswiftc",
38889
+ String(perFile ? 1 : Math.min(8, import_node_os12.default.availableParallelism()))
38890
+ ],
38891
+ ...swiftReproducibleBuildFlags([
38892
+ [import_node_path53.default.dirname(options2.toolchainBin), "toolchain"],
38893
+ [compileFrameworkRoot, "framework"],
38894
+ [root2, "build"],
38895
+ ...forwarders
38896
+ ]).flatMap((flag, index, flags) => {
38897
+ if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
38898
+ return [flag];
38899
+ const toolchainDir = import_node_path53.default.dirname(options2.toolchainBin);
38900
+ let mapped = flag;
38901
+ for (const [dir, target] of [
38902
+ [root2, "/peach/build"],
38903
+ [compileFrameworkRoot, "/peach/framework"],
38904
+ [(0, import_node_fs53.realpathSync)(compileFrameworkRoot), "/peach/framework"],
38905
+ [toolchainDir, "/peach/toolchain"],
38906
+ [(0, import_node_fs53.realpathSync)(toolchainDir), "/peach/toolchain"]
38907
+ ]) {
38908
+ mapped = mapped.replaceAll(dir, target);
38909
+ }
38910
+ const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
38911
+ const tool = flags[index - 1];
38912
+ return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
38913
+ }),
38914
+ ...macroPlugins.libraries.flatMap((plugin) => [
38915
+ "-Xswiftc",
38916
+ "-load-plugin-library",
38917
+ "-Xswiftc",
38918
+ plugin
38919
+ ]),
38920
+ ...macroPlugins.executables.flatMap((plugin) => [
38921
+ "-Xswiftc",
38922
+ "-load-plugin-executable",
38923
+ "-Xswiftc",
38924
+ `${plugin}#ExpoModulesMacros`
38925
+ ])
38926
+ ];
38927
+ const linked = builtArtifact(layout3);
38928
+ (0, import_node_fs53.rmSync)(import_node_path53.default.join(root2, ".peach-link.rsp"), { force: true });
38929
+ if (options2.linkOnly || (0, import_node_fs53.existsSync)(linked) && (0, import_node_fs53.statSync)(linked).size <= 8)
38930
+ (0, import_node_fs53.rmSync)(linked, { force: true });
38931
+ stage("compiling and linking Swift modules");
38932
+ const frameworkInterfaces = /* @__PURE__ */ new Map();
38933
+ const sdkFrameworks = import_node_path53.default.join(
38934
+ swiftSdkPaths(frameworkRoot, options2.toolchainBin).darwin,
38935
+ "System/Library/Frameworks"
38936
+ );
38937
+ const generatedInterface = (source) => withoutImportedSdkEnumForwards(
38938
+ clangInterfaceHeader((0, import_node_fs53.readFileSync)(source, "utf8"), frameworkRoot),
38939
+ sdkObjCDeclarationOwners(sdkFrameworks)
38940
+ );
38941
+ const nativeDeclarations = /* @__PURE__ */ new Map();
38942
+ const nativeHeaders = Object.entries(input.files).filter(([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")).map(([, source]) => source);
38943
+ for (const [file, contents2] of Object.entries(input.files)) {
38944
+ if (!file.endsWith(".modulemap")) continue;
38945
+ const name3 = moduleMapName(contents2);
38946
+ const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents2)?.[1];
38947
+ if (!name3 || !umbrella) continue;
38948
+ const header = input.files[import_node_path53.default.posix.join(import_node_path53.default.posix.dirname(file), umbrella)];
38949
+ if (header === void 0) continue;
38950
+ const included = new Set(
38951
+ [
38952
+ ...header.matchAll(/^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm)
38953
+ ].map((match) => import_node_path53.default.posix.basename(match[1]))
38498
38954
  );
38499
- const compiler = preparation.targetToolset ? { CC: import_node_path53.default.join(root, CLANG_TARGET_MODULE_WRAPPER) } : {};
38500
- if (packageHostMacros?.length) {
38501
- const swiftc = import_node_path53.default.join(root, SWIFT_HOST_COMPILER_WRAPPER);
38502
- writeBuildFile(
38503
- swiftc,
38504
- [
38505
- "#!/bin/sh",
38506
- "target=",
38507
- "module=",
38508
- "compile=",
38509
- "previous=",
38510
- "for argument do",
38511
- ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
38512
- ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
38513
- " previous=$argument",
38514
- "done",
38515
- 'case "$target/$compile" in',
38516
- " *-*-linux*/1)",
38517
- ' case ",$PEACH_SWIFT_HOST_MACROS," in',
38518
- ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
38519
- " esac ;;",
38520
- "esac",
38521
- 'exec "$PEACH_SWIFTC" "$@"',
38522
- ""
38523
- ].join("\n")
38524
- );
38525
- (0, import_node_fs53.chmodSync)(swiftc, 493);
38526
- compiler.SWIFT_EXEC = swiftc;
38527
- compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
38528
- compiler.PEACH_SWIFTC = import_node_path53.default.join(options2.toolchainBin, "swiftc");
38955
+ const declarations = nativeDeclarations.get(name3) ?? /* @__PURE__ */ new Set();
38956
+ for (const declaration of swiftInterfaceDeclarations(header))
38957
+ declarations.add(declaration);
38958
+ for (const [candidate, source] of Object.entries(input.files))
38959
+ if (included.has(import_node_path53.default.posix.basename(candidate)))
38960
+ for (const declaration of swiftInterfaceDeclarations(source))
38961
+ declarations.add(declaration);
38962
+ nativeDeclarations.set(name3, declarations);
38963
+ }
38964
+ const frameworkInterface = (name3) => {
38965
+ if (frameworkInterfaces.has(name3)) return frameworkInterfaces.get(name3);
38966
+ const source = distribution ? import_node_path53.default.join(frameworkRoot, "modules", `${name3}-Swift.h`) : prebuilt.objcHeaders.get(name3);
38967
+ if (!source || !(0, import_node_fs53.existsSync)(source)) {
38968
+ frameworkInterfaces.set(name3, null);
38969
+ return null;
38529
38970
  }
38530
- const projectProcess = options2.project ? prepareSwiftProjectProcess(root, options2.project) : void 0;
38531
- const temporaryDirectory = projectProcess ? void 0 : import_node_path53.default.join(root, ".build", "peach-compiler-tmp");
38532
- const appOptions = projectProcess ? {
38533
- ...buildOptions,
38534
- uid: projectProcess.uid,
38535
- gid: projectProcess.gid,
38536
- confined: { ...projectProcess.env, ...compiler }
38537
- } : {
38538
- ...buildOptions,
38539
- temporaryDirectory,
38540
- env: {
38541
- ...buildOptions.env,
38542
- ...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
38543
- ...compiler
38544
- }
38545
- };
38546
- const unprepared = preparation.targetFailures.map(
38547
- (failure2) => `error: target ${failure2}`
38971
+ const headers = import_node_path53.default.join(sdkFrameworks, `${name3}.framework/Headers`);
38972
+ const declared = /* @__PURE__ */ new Set();
38973
+ if ((0, import_node_fs53.existsSync)(headers)) {
38974
+ for (const file of (0, import_node_fs53.readdirSync)(headers, {
38975
+ recursive: true,
38976
+ encoding: "utf8"
38977
+ }))
38978
+ if (file.endsWith(".h"))
38979
+ for (const name4 of swiftInterfaceDeclarations(
38980
+ (0, import_node_fs53.readFileSync)(import_node_path53.default.join(headers, file), "utf8")
38981
+ ))
38982
+ declared.add(name4);
38983
+ }
38984
+ for (const declaration of nativeDeclarations.get(name3) ?? [])
38985
+ declared.add(declaration);
38986
+ const own2 = withoutSwiftDeclarations(
38987
+ generatedInterface(source),
38988
+ declared,
38989
+ nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
38548
38990
  );
38549
- const forwarders = /* @__PURE__ */ new Map();
38550
- for (const [file, text7] of Object.entries(input.files)) {
38551
- const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text7)?.[1];
38552
- if (!parents) continue;
38553
- const directory2 = import_node_path53.default.posix.dirname(file);
38554
- forwarders.set(
38555
- `${import_node_path53.default.join(root, directory2)}/${parents.slice(0, -1)}`,
38556
- import_node_path53.default.posix.join("build", directory2, parents).replace(/\/$/, "")
38557
- );
38991
+ const owners = sdkObjCDeclarationOwners(sdkFrameworks);
38992
+ const foreign = /* @__PURE__ */ new Map();
38993
+ for (const declaration of [
38994
+ ...swiftInterfaceDeclarations(own2),
38995
+ ...objcEnumerations(own2),
38996
+ ...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
38997
+ (match) => match[1]
38998
+ )
38999
+ ]) {
39000
+ const owner = owners.get(declaration);
39001
+ if (owner && owner !== name3) foreign.set(declaration, owner);
38558
39002
  }
38559
- const jobs = swiftCompilerJobs();
38560
- const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
38561
- const perFile = input.unoptimized || incrementalPreview;
38562
- const buildArgs = [
38563
- "build",
38564
- ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
38565
- "--build-system",
38566
- "native",
38567
- "-j",
38568
- String(jobs),
38569
- "--package-path",
38570
- root,
38571
- ...swiftCompileSdkOptions(frameworkRoot, options2.toolchainBin),
38572
- ...swiftObjCSelectorOptions(frameworkRoot),
38573
- "--swift-sdk",
38574
- sdk2,
38575
- ...preparation.targetToolset ? ["--toolset", import_node_path53.default.join(root, ".peach-target-toolset.json")] : [],
38576
- "-c",
38577
- "release",
38578
- ...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
38579
- ...perFile ? [
38580
- "-Xswiftc",
38581
- "-no-whole-module-optimization",
38582
- "-Xswiftc",
38583
- "-j",
38584
- "-Xswiftc",
38585
- String(jobs)
38586
- ] : [],
38587
- ...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
38588
- // the mirror finds a changed sdk header's readers in their
38589
- // dependency files, which omit system headers by default
38590
- ...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
38591
- // the link strips debug info, so none is generated (as for the framework).
38592
- // keep -num-threads fixed across caller core caps so llbuild does not
38593
- // rebuild every target when callers alternate --cores, and bound backend
38594
- // fan-out under high -j.
38595
- "-Xswiftc",
38596
- "-gnone",
38597
- ...incrementalPreview ? [] : [
38598
- "-Xswiftc",
38599
- "-num-threads",
38600
- "-Xswiftc",
38601
- String(perFile ? 1 : Math.min(8, import_node_os12.default.availableParallelism()))
38602
- ],
38603
- ...swiftReproducibleBuildFlags([
38604
- [import_node_path53.default.dirname(options2.toolchainBin), "toolchain"],
38605
- [compileFrameworkRoot, "framework"],
38606
- [root, "build"],
38607
- ...forwarders
38608
- ]).flatMap((flag, index, flags) => {
38609
- if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
38610
- return [flag];
38611
- const toolchainDir = import_node_path53.default.dirname(options2.toolchainBin);
38612
- let mapped = flag;
38613
- for (const [dir, target] of [
38614
- [root, "/peach/build"],
38615
- [compileFrameworkRoot, "/peach/framework"],
38616
- [(0, import_node_fs53.realpathSync)(compileFrameworkRoot), "/peach/framework"],
38617
- [toolchainDir, "/peach/toolchain"],
38618
- [(0, import_node_fs53.realpathSync)(toolchainDir), "/peach/toolchain"]
38619
- ]) {
38620
- mapped = mapped.replaceAll(dir, target);
38621
- }
38622
- const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
38623
- const tool = flags[index - 1];
38624
- return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
38625
- }),
38626
- ...macroPlugins.libraries.flatMap((plugin) => [
38627
- "-Xswiftc",
38628
- "-load-plugin-library",
38629
- "-Xswiftc",
38630
- plugin
38631
- ]),
38632
- ...macroPlugins.executables.flatMap((plugin) => [
38633
- "-Xswiftc",
38634
- "-load-plugin-executable",
38635
- "-Xswiftc",
38636
- `${plugin}#ExpoModulesMacros`
38637
- ])
38638
- ];
38639
- const linked = builtArtifact(layout2);
38640
- (0, import_node_fs53.rmSync)(import_node_path53.default.join(root, ".peach-link.rsp"), { force: true });
38641
- if (options2.linkOnly || (0, import_node_fs53.existsSync)(linked) && (0, import_node_fs53.statSync)(linked).size <= 8)
38642
- (0, import_node_fs53.rmSync)(linked, { force: true });
38643
- report("compiling and linking Swift modules");
38644
- const frameworkInterfaces = /* @__PURE__ */ new Map();
38645
- const sdkFrameworks = import_node_path53.default.join(
38646
- swiftSdkPaths(frameworkRoot, options2.toolchainBin).darwin,
38647
- "System/Library/Frameworks"
39003
+ const header = foreign.size ? withoutSwiftDeclarations(
39004
+ own2,
39005
+ new Set(foreign.keys()),
39006
+ [...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
39007
+ ) : own2;
39008
+ const value = {
39009
+ file: import_node_path53.default.join(root2, ".build/peach-framework-objc", `${name3}-Swift.h`),
39010
+ header,
39011
+ module: (0, import_node_fs53.existsSync)(headers)
39012
+ };
39013
+ frameworkInterfaces.set(name3, value);
39014
+ writeBuildFile(
39015
+ value.file,
39016
+ ((0, import_node_fs53.existsSync)(import_node_path53.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
39017
+ ` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
38648
39018
  );
38649
- const generatedInterface = (source) => withoutImportedSdkEnumForwards(
38650
- clangInterfaceHeader((0, import_node_fs53.readFileSync)(source, "utf8"), frameworkRoot),
38651
- sdkObjCDeclarationOwners(sdkFrameworks)
39019
+ return value;
39020
+ };
39021
+ const headerPaths = (producer) => {
39022
+ const stem2 = import_node_path53.default.join(
39023
+ root2,
39024
+ ".build",
39025
+ "peach-cxx-headers",
39026
+ `${producer}-Swift`
38652
39027
  );
38653
- const nativeDeclarations = /* @__PURE__ */ new Map();
38654
- const nativeHeaders = Object.entries(input.files).filter(([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")).map(([, source]) => source);
38655
- for (const [file, contents2] of Object.entries(input.files)) {
38656
- if (!file.endsWith(".modulemap")) continue;
38657
- const name3 = moduleMapName(contents2);
38658
- const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents2)?.[1];
38659
- if (!name3 || !umbrella) continue;
38660
- const header = input.files[import_node_path53.default.posix.join(import_node_path53.default.posix.dirname(file), umbrella)];
38661
- if (header === void 0) continue;
38662
- const included = new Set(
38663
- [
38664
- ...header.matchAll(/^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm)
38665
- ].map((match) => import_node_path53.default.posix.basename(match[1]))
38666
- );
38667
- const declarations = nativeDeclarations.get(name3) ?? /* @__PURE__ */ new Set();
38668
- for (const declaration of swiftInterfaceDeclarations(header))
38669
- declarations.add(declaration);
38670
- for (const [candidate, source] of Object.entries(input.files))
38671
- if (included.has(import_node_path53.default.posix.basename(candidate)))
38672
- for (const declaration of swiftInterfaceDeclarations(source))
38673
- declarations.add(declaration);
38674
- nativeDeclarations.set(name3, declarations);
38675
- }
38676
- const frameworkInterface = (name3) => {
38677
- if (frameworkInterfaces.has(name3)) return frameworkInterfaces.get(name3);
38678
- const source = distribution ? import_node_path53.default.join(frameworkRoot, "modules", `${name3}-Swift.h`) : prebuilt.objcHeaders.get(name3);
38679
- if (!source || !(0, import_node_fs53.existsSync)(source)) {
38680
- frameworkInterfaces.set(name3, null);
38681
- return null;
38682
- }
38683
- const headers = import_node_path53.default.join(sdkFrameworks, `${name3}.framework/Headers`);
38684
- const declared = /* @__PURE__ */ new Set();
38685
- if ((0, import_node_fs53.existsSync)(headers)) {
38686
- for (const file of (0, import_node_fs53.readdirSync)(headers, {
38687
- recursive: true,
38688
- encoding: "utf8"
38689
- }))
38690
- if (file.endsWith(".h"))
38691
- for (const name4 of swiftInterfaceDeclarations(
38692
- (0, import_node_fs53.readFileSync)(import_node_path53.default.join(headers, file), "utf8")
38693
- ))
38694
- declared.add(name4);
38695
- }
38696
- for (const declaration of nativeDeclarations.get(name3) ?? [])
38697
- declared.add(declaration);
38698
- const own2 = withoutSwiftDeclarations(
38699
- generatedInterface(source),
38700
- declared,
38701
- nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
38702
- );
38703
- const owners = sdkObjCDeclarationOwners(sdkFrameworks);
38704
- const foreign = /* @__PURE__ */ new Map();
38705
- for (const declaration of [
38706
- ...swiftInterfaceDeclarations(own2),
38707
- ...objcEnumerations(own2),
38708
- ...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
38709
- (match) => match[1]
38710
- )
38711
- ]) {
38712
- const owner = owners.get(declaration);
38713
- if (owner && owner !== name3) foreign.set(declaration, owner);
39028
+ return { producer, original: `${stem2}.original.h`, emitted: `${stem2}.h` };
39029
+ };
39030
+ const publishHeader = ({
39031
+ producer,
39032
+ original,
39033
+ emitted
39034
+ }) => {
39035
+ const generated = generatedInterface(original);
39036
+ writeBuildFile(
39037
+ emitted,
39038
+ withoutSwiftDeclarations(
39039
+ swiftHeaderWithSuperclassImports(generated, frameworkInterface),
39040
+ /* @__PURE__ */ new Set([
39041
+ ...preparation.nativeHeaderDeclarations[producer] ?? [],
39042
+ ...nativelyDeclaredFunctions(generated, nativeHeaders)
39043
+ ]),
39044
+ `#import <${producer}/${producer}.h>`
39045
+ )
39046
+ );
39047
+ };
39048
+ const recipe2 = inputHash.copy().update(
39049
+ distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
39050
+ ).update((0, import_node_fs53.readFileSync)(import_node_path53.default.join(root2, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
39051
+ const runApp = async (compiler2) => {
39052
+ const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
39053
+ const stages = [
39054
+ ...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
39055
+ target,
39056
+ producers: []
39057
+ })),
39058
+ ...preparation.headerBuilds,
39059
+ ...(preparation.nativeProductTargets ?? []).map((target) => ({
39060
+ target,
39061
+ producers: []
39062
+ }))
39063
+ ];
39064
+ const checkpoints = import_node_path53.default.join(root2, ".build", "peach-product-checkpoints");
39065
+ const buildDbExists = (0, import_node_fs53.existsSync)(import_node_path53.default.join(root2, ".build", "build.db"));
39066
+ const releaseDir = import_node_path53.default.dirname(linked);
39067
+ for (const { target, producers } of stages) {
39068
+ if (!options2.project && producers.length === 0 && buildDbExists) {
39069
+ const expectedObjects = preparation.nativeStageObjects.get(target);
39070
+ if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
39071
+ (relative4) => (0, import_node_fs53.statSync)(import_node_path53.default.join(releaseDir, relative4), {
39072
+ throwIfNoEntry: false
39073
+ })?.isFile()
39074
+ ))
39075
+ continue;
38714
39076
  }
38715
- const header = foreign.size ? withoutSwiftDeclarations(
38716
- own2,
38717
- new Set(foreign.keys()),
38718
- [...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
38719
- ) : own2;
38720
- const value = {
38721
- file: import_node_path53.default.join(root, ".build/peach-framework-objc", `${name3}-Swift.h`),
38722
- header,
38723
- module: (0, import_node_fs53.existsSync)(headers)
38724
- };
38725
- frameworkInterfaces.set(name3, value);
38726
- writeBuildFile(
38727
- value.file,
38728
- ((0, import_node_fs53.existsSync)(import_node_path53.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
38729
- ` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
38730
- );
38731
- return value;
38732
- };
38733
- const headerPaths = (producer) => {
38734
- const stem2 = import_node_path53.default.join(
38735
- root,
38736
- ".build",
38737
- "peach-cxx-headers",
38738
- `${producer}-Swift`
39077
+ const receipt = import_node_path53.default.join(
39078
+ checkpoints,
39079
+ (0, import_node_crypto32.createHash)("sha256").update(target).digest("hex")
38739
39080
  );
38740
- return { producer, original: `${stem2}.original.h`, emitted: `${stem2}.h` };
38741
- };
38742
- const publishHeader = ({
38743
- producer,
38744
- original,
38745
- emitted
38746
- }) => {
38747
- const generated = generatedInterface(original);
38748
- writeBuildFile(
38749
- emitted,
38750
- withoutSwiftDeclarations(
38751
- swiftHeaderWithSuperclassImports(generated, frameworkInterface),
38752
- /* @__PURE__ */ new Set([
38753
- ...preparation.nativeHeaderDeclarations[producer] ?? [],
38754
- ...nativelyDeclaredFunctions(generated, nativeHeaders)
38755
- ]),
38756
- `#import <${producer}/${producer}.h>`
38757
- )
38758
- );
38759
- };
38760
- const recipe2 = inputHash.copy().update(
38761
- distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
38762
- ).update((0, import_node_fs53.readFileSync)(import_node_path53.default.join(root, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
38763
- const runApp = async (compiler2) => {
38764
- const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
38765
- const stages = [
38766
- ...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
38767
- target,
38768
- producers: []
38769
- })),
38770
- ...preparation.headerBuilds,
38771
- ...(preparation.nativeProductTargets ?? []).map((target) => ({
38772
- target,
38773
- producers: []
38774
- }))
38775
- ];
38776
- const checkpoints = import_node_path53.default.join(root, ".build", "peach-product-checkpoints");
38777
- const buildDbExists = (0, import_node_fs53.existsSync)(import_node_path53.default.join(root, ".build", "build.db"));
38778
- const releaseDir = import_node_path53.default.dirname(linked);
38779
- for (const { target, producers } of stages) {
38780
- if (!options2.project && producers.length === 0 && buildDbExists) {
38781
- const expectedObjects = preparation.nativeStageObjects.get(target);
38782
- if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
38783
- (relative4) => (0, import_node_fs53.statSync)(import_node_path53.default.join(releaseDir, relative4), {
38784
- throwIfNoEntry: false
38785
- })?.isFile()
38786
- ))
38787
- continue;
38788
- }
38789
- const receipt = import_node_path53.default.join(
38790
- checkpoints,
38791
- (0, import_node_crypto32.createHash)("sha256").update(target).digest("hex")
38792
- );
38793
- const headers = producers.map(headerPaths);
38794
- for (const header of headers)
38795
- if ((0, import_node_fs53.existsSync)(header.original)) publishHeader(header);
38796
- const fingerprint = () => {
38797
- const digest3 = (0, import_node_crypto32.createHash)("sha256").update(recipe2);
38798
- for (const { original, emitted } of headers) {
38799
- if (!(0, import_node_fs53.existsSync)(original) || !(0, import_node_fs53.existsSync)(emitted)) return;
38800
- digest3.update(
38801
- (0, import_node_crypto32.createHash)("sha256").update((0, import_node_fs53.readFileSync)(emitted)).digest()
38802
- );
38803
- }
38804
- return digest3.digest("hex");
38805
- };
38806
- if (!options2.project && (0, import_node_fs53.existsSync)(receipt) && (0, import_node_fs53.readFileSync)(receipt, "utf8") === fingerprint())
38807
- continue;
38808
- if (!options2.project) (0, import_node_fs53.rmSync)(receipt, { force: true });
38809
- for (const header of headers) {
38810
- if (!(0, import_node_fs53.existsSync)(header.original))
38811
- (0, import_node_fs53.rmSync)(
38812
- import_node_path53.default.join(
38813
- import_node_path53.default.dirname(linked),
38814
- "Modules",
38815
- `${swiftTargetModuleName(header.producer)}.swiftmodule`
38816
- ),
38817
- { force: true }
38818
- );
38819
- }
38820
- await runCompiler(
38821
- swift,
38822
- [...buildArgs, "--target", target],
38823
- optionsWithCompiler,
38824
- /^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
38825
- SWIFTPM_NOISE
38826
- );
38827
- if (!compiler2) for (const header of headers) publishHeader(header);
38828
- if (!options2.project) {
38829
- const checkpoint = fingerprint();
38830
- if (checkpoint === void 0)
38831
- throw new Error(`missing Swift headers after building ${target}`);
38832
- (0, import_node_fs53.mkdirSync)(checkpoints, { recursive: true });
38833
- (0, import_node_fs53.writeFileSync)(`${receipt}.partial`, checkpoint);
38834
- (0, import_node_fs53.renameSync)(`${receipt}.partial`, receipt);
39081
+ const headers = producers.map(headerPaths);
39082
+ for (const header of headers)
39083
+ if ((0, import_node_fs53.existsSync)(header.original)) publishHeader(header);
39084
+ const fingerprint = () => {
39085
+ const digest3 = (0, import_node_crypto32.createHash)("sha256").update(recipe2);
39086
+ for (const { original, emitted } of headers) {
39087
+ if (!(0, import_node_fs53.existsSync)(original) || !(0, import_node_fs53.existsSync)(emitted)) return;
39088
+ digest3.update(
39089
+ (0, import_node_crypto32.createHash)("sha256").update((0, import_node_fs53.readFileSync)(emitted)).digest()
39090
+ );
38835
39091
  }
39092
+ return digest3.digest("hex");
39093
+ };
39094
+ if (!options2.project && (0, import_node_fs53.existsSync)(receipt) && (0, import_node_fs53.readFileSync)(receipt, "utf8") === fingerprint())
39095
+ continue;
39096
+ if (!options2.project) (0, import_node_fs53.rmSync)(receipt, { force: true });
39097
+ for (const header of headers) {
39098
+ if (!(0, import_node_fs53.existsSync)(header.original))
39099
+ (0, import_node_fs53.rmSync)(
39100
+ import_node_path53.default.join(
39101
+ import_node_path53.default.dirname(linked),
39102
+ "Modules",
39103
+ `${swiftTargetModuleName(header.producer)}.swiftmodule`
39104
+ ),
39105
+ { force: true }
39106
+ );
38836
39107
  }
38837
39108
  await runCompiler(
38838
39109
  swift,
38839
- buildArgs,
39110
+ [...buildArgs, "--target", target],
38840
39111
  optionsWithCompiler,
38841
- SWIFTPM_PROGRESS,
39112
+ /^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
38842
39113
  SWIFTPM_NOISE
38843
39114
  );
38844
- };
38845
- const compileApp = () => preparation.headerCompiler ? withSwiftHeaderCompiler(
38846
- root,
38847
- options2.toolchainBin,
38848
- recipe2,
38849
- new Map(
38850
- preparation.headerBuilds[0].producers.map((producer) => {
38851
- const paths = headerPaths(producer);
38852
- return [
38853
- swiftTargetModuleName(producer),
38854
- {
38855
- header: paths.original,
38856
- publish: () => publishHeader(paths)
38857
- }
38858
- ];
38859
- })
38860
- ),
38861
- runApp
38862
- ) : runApp();
38863
- try {
38864
- if (temporaryDirectory) (0, import_node_fs53.mkdirSync)(temporaryDirectory, { recursive: true });
38865
- await compileApp();
38866
- } catch (error) {
38867
- const output2 = outputOf(error);
38868
- const moduleCache = import_node_path53.default.join(
38869
- root,
38870
- ".build",
38871
- WASM_TRIPLE,
38872
- "release",
38873
- "ModuleCache"
38874
- );
38875
- if (output2.includes("was compiled with module cache path") && (0, import_node_fs53.existsSync)(moduleCache)) {
38876
- (0, import_node_fs53.rmSync)(moduleCache, { recursive: true, force: true });
38877
- try {
38878
- await compileApp();
38879
- } catch (retryError) {
38880
- throw new Error(
38881
- [
38882
- ...unprepared,
38883
- projectDiagnostic(outputOf(retryError), layout2, input.files)
38884
- ].join("\n"),
38885
- { cause: retryError }
38886
- );
38887
- }
38888
- } else {
39115
+ if (!compiler2) for (const header of headers) publishHeader(header);
39116
+ if (!options2.project) {
39117
+ const checkpoint = fingerprint();
39118
+ if (checkpoint === void 0)
39119
+ throw new Error(`missing Swift headers after building ${target}`);
39120
+ (0, import_node_fs53.mkdirSync)(checkpoints, { recursive: true });
39121
+ (0, import_node_fs53.writeFileSync)(`${receipt}.partial`, checkpoint);
39122
+ (0, import_node_fs53.renameSync)(`${receipt}.partial`, receipt);
39123
+ }
39124
+ }
39125
+ await runCompiler(
39126
+ swift,
39127
+ buildArgs,
39128
+ optionsWithCompiler,
39129
+ SWIFTPM_PROGRESS,
39130
+ SWIFTPM_NOISE
39131
+ );
39132
+ };
39133
+ const compileApp = () => preparation.headerCompiler ? withSwiftHeaderCompiler(
39134
+ root2,
39135
+ options2.toolchainBin,
39136
+ recipe2,
39137
+ new Map(
39138
+ preparation.headerBuilds[0].producers.map((producer) => {
39139
+ const paths = headerPaths(producer);
39140
+ return [
39141
+ swiftTargetModuleName(producer),
39142
+ {
39143
+ header: paths.original,
39144
+ publish: () => publishHeader(paths)
39145
+ }
39146
+ ];
39147
+ })
39148
+ ),
39149
+ runApp
39150
+ ) : runApp();
39151
+ try {
39152
+ if (temporaryDirectory) (0, import_node_fs53.mkdirSync)(temporaryDirectory, { recursive: true });
39153
+ await compileApp();
39154
+ } catch (error) {
39155
+ const output2 = outputOf(error);
39156
+ const moduleCache = import_node_path53.default.join(
39157
+ root2,
39158
+ ".build",
39159
+ WASM_TRIPLE,
39160
+ "release",
39161
+ "ModuleCache"
39162
+ );
39163
+ if (output2.includes("was compiled with module cache path") && (0, import_node_fs53.existsSync)(moduleCache)) {
39164
+ (0, import_node_fs53.rmSync)(moduleCache, { recursive: true, force: true });
39165
+ try {
39166
+ await compileApp();
39167
+ } catch (retryError) {
38889
39168
  throw new Error(
38890
- [...unprepared, projectDiagnostic(output2, layout2, input.files)].join(
38891
- "\n"
38892
- ),
38893
- { cause: error }
39169
+ [
39170
+ ...unprepared,
39171
+ projectDiagnostic(outputOf(retryError), layout3, input.files)
39172
+ ].join("\n"),
39173
+ { cause: retryError }
38894
39174
  );
38895
39175
  }
38896
- } finally {
38897
- if (temporaryDirectory)
38898
- (0, import_node_fs53.rmSync)(temporaryDirectory, { recursive: true, force: true });
38899
- if (options2.project) endSwiftProjectProcesses(options2.project);
38900
- }
38901
- if (unprepared.length) throw new Error(unprepared.join("\n"));
38902
- if (!(0, import_node_fs53.existsSync)(linked)) {
38903
- const binDir = import_node_path53.default.dirname(linked);
38904
- const found = (0, import_node_fs53.existsSync)(binDir) ? (0, import_node_fs53.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
39176
+ } else {
38905
39177
  throw new Error(
38906
- `swift-compile: the build produced no ${import_node_path53.default.basename(linked)} (found: ${found.join(", ") || "none"})`
39178
+ [...unprepared, projectDiagnostic(output2, layout3, input.files)].join(
39179
+ "\n"
39180
+ ),
39181
+ { cause: error }
38907
39182
  );
38908
39183
  }
38909
- if (options2.project) removeProjectLinks(root);
38910
- const resourceReferences = Object.values(input.resources ?? {}).map(
38911
- (value) => Buffer.from(value, "base64")
39184
+ } finally {
39185
+ if (temporaryDirectory)
39186
+ (0, import_node_fs53.rmSync)(temporaryDirectory, { recursive: true, force: true });
39187
+ if (options2.project) endSwiftProjectProcesses(options2.project);
39188
+ }
39189
+ if (unprepared.length) throw new Error(unprepared.join("\n"));
39190
+ if (!(0, import_node_fs53.existsSync)(linked)) {
39191
+ const binDir = import_node_path53.default.dirname(linked);
39192
+ const found = (0, import_node_fs53.existsSync)(binDir) ? (0, import_node_fs53.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
39193
+ throw new Error(
39194
+ `swift-compile: the build produced no ${import_node_path53.default.basename(linked)} (found: ${found.join(", ") || "none"})`
38912
39195
  );
38913
- if (!guestGraph)
38914
- pruneSwiftWasmLink(
38915
- root,
38916
- options2.toolchainBin,
38917
- prebuilt?.root ?? frameworkRoot,
38918
- input.staticClangTargets,
38919
- options2.project,
38920
- void 0,
38921
- resourceReferences
38922
- );
38923
- if (options2.linkOnly) {
38924
- if ((0, import_node_fs53.statSync)(linked).size <= 8)
38925
- throw new Error("swift-compile: deferred linker produced no executable");
38926
- report("project link verified");
38927
- return;
38928
- }
38929
- const output = options2.project ? projectOutputFile(root, linked, options2.project) : linked;
38930
- const optimized = `${output}.optimized`;
38931
- if (sdkImage && options2.project) (0, import_node_fs53.rmSync)(optimized, { force: true });
38932
- let sdkAsset;
38933
- if (guestGraph) {
38934
- const binding = await compileGuestLink({
38935
- graph: guestGraph,
38936
- buildDirectory: root,
38937
- releaseDirectory: import_node_path53.default.dirname(linked),
38938
- moduleRoot: frameworkRoot,
38939
- toolchainBin: options2.toolchainBin,
38940
- swiftCompiler: preparation.headerCompiler ? import_node_path53.default.join(root, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path53.default.join(options2.toolchainBin, "swiftc"),
38941
- sysroot: swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot,
38942
- sdk: swiftModuleSdk(frameworkRoot),
38943
- sdkImage,
38944
- compilerDigest: compilerSourceDigest,
38945
- project: options2.project && {
38946
- ...options2.project,
38947
- env: { ...options2.project.env, ...projectProcess?.env }
38948
- },
38949
- staticClangTargets: input.staticClangTargets ?? [],
38950
- resourceReferences,
38951
- resourceBundles: input.resourceBundles ?? [],
38952
- generatedOwners: preparation.generatedOwners,
38953
- output,
38954
- optimized,
38955
- optimize: input.optimize === true,
38956
- jobs: swiftBuildJobs()
38957
- });
38958
- if (sdkImage && binding)
38959
- sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
38960
- } else if (sdkImage) {
38961
- const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
38962
- const binding = await buildSwiftAppModule2({
38963
- buildRoot: root,
38964
- toolchainBin: options2.toolchainBin,
38965
- sdk: sdkImage,
38966
- output: optimized,
38967
- optimize: input.optimize === true,
38968
- project: options2.project && {
38969
- ...options2.project,
38970
- env: { ...options2.project.env, ...projectProcess?.env },
38971
- sdkRoot: import_node_path53.default.dirname(
38972
- swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot
38973
- ),
38974
- linked: output
38975
- }
38976
- });
38977
- sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
38978
- } else {
38979
- const bytes = (0, import_node_fs53.readFileSync)(output);
38980
- const ordered = orderObjCConstructors(bytes);
38981
- if (ordered !== bytes) (0, import_node_fs53.writeFileSync)(output, ordered);
38982
- await lowerWasm(output, optimized, { optimize: input.optimize === true });
38983
- }
38984
- if (!sdkImage)
38985
- await runCompiler(
38986
- import_node_path53.default.join(options2.toolchainBin, "llvm-objcopy"),
38987
- ["--remove-section=.swift1_autolink_entries", optimized],
38988
- buildOptions
38989
- );
38990
- const artifact = {
38991
- hash,
38992
- bytes: (0, import_node_fs53.readFileSync)(optimized),
38993
- icu: await icu,
38994
- sdk: sdkAsset
38995
- };
38996
- if (artifact.bytes.length <= 8)
39196
+ }
39197
+ if (options2.project) removeProjectLinks(root2);
39198
+ const resourceReferences = Object.values(input.resources ?? {}).map(
39199
+ (value) => Buffer.from(value, "base64")
39200
+ );
39201
+ if (!guestGraph)
39202
+ pruneSwiftWasmLink(
39203
+ root2,
39204
+ options2.toolchainBin,
39205
+ prebuilt?.root ?? frameworkRoot,
39206
+ input.staticClangTargets,
39207
+ options2.project,
39208
+ void 0,
39209
+ resourceReferences
39210
+ );
39211
+ if (options2.linkOnly) {
39212
+ if ((0, import_node_fs53.statSync)(linked).size <= 8)
38997
39213
  throw new Error("swift-compile: deferred linker produced no executable");
38998
- if (!options2.project) saveCompiledArtifact(root, artifact);
38999
- saveSharedArtifact(sharedRoot, artifact);
39000
- report("compiled artifact verified");
39001
- return retain(root, artifact);
39002
- } finally {
39003
- readHold?.release();
39214
+ stage("project link verified");
39215
+ return;
39004
39216
  }
39005
- },
39006
- budget.signal
39007
- );
39217
+ const output = options2.project ? projectOutputFile(root2, linked, options2.project) : linked;
39218
+ const optimized = `${output}.optimized`;
39219
+ if (sdkImage && options2.project) (0, import_node_fs53.rmSync)(optimized, { force: true });
39220
+ let sdkAsset;
39221
+ stage("linking the app image");
39222
+ if (guestGraph) {
39223
+ const binding = await compileGuestLink({
39224
+ graph: guestGraph,
39225
+ buildDirectory: root2,
39226
+ releaseDirectory: import_node_path53.default.dirname(linked),
39227
+ moduleRoot: frameworkRoot,
39228
+ toolchainBin: options2.toolchainBin,
39229
+ swiftCompiler: preparation.headerCompiler ? import_node_path53.default.join(root2, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path53.default.join(options2.toolchainBin, "swiftc"),
39230
+ sysroot: swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot,
39231
+ sdk: swiftModuleSdk(frameworkRoot),
39232
+ sdkImage,
39233
+ compilerDigest: compilerSourceDigest,
39234
+ project: options2.project && {
39235
+ ...options2.project,
39236
+ env: { ...options2.project.env, ...projectProcess?.env }
39237
+ },
39238
+ staticClangTargets: input.staticClangTargets ?? [],
39239
+ resourceReferences,
39240
+ resourceBundles: input.resourceBundles ?? [],
39241
+ generatedOwners: preparation.generatedOwners,
39242
+ output,
39243
+ optimized,
39244
+ optimize: input.optimize === true,
39245
+ jobs: swiftBuildJobs(),
39246
+ onStage: stage
39247
+ });
39248
+ if (sdkImage && binding)
39249
+ sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
39250
+ } else if (sdkImage) {
39251
+ const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
39252
+ const binding = await buildSwiftAppModule2({
39253
+ buildRoot: root2,
39254
+ toolchainBin: options2.toolchainBin,
39255
+ sdk: sdkImage,
39256
+ output: optimized,
39257
+ optimize: input.optimize === true,
39258
+ project: options2.project && {
39259
+ ...options2.project,
39260
+ env: { ...options2.project.env, ...projectProcess?.env },
39261
+ sdkRoot: import_node_path53.default.dirname(
39262
+ swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot
39263
+ ),
39264
+ linked: output
39265
+ }
39266
+ });
39267
+ sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
39268
+ } else {
39269
+ const bytes = (0, import_node_fs53.readFileSync)(output);
39270
+ const ordered = orderObjCConstructors(bytes);
39271
+ if (ordered !== bytes) (0, import_node_fs53.writeFileSync)(output, ordered);
39272
+ stage("lowering the app image");
39273
+ await lowerWasm(output, optimized, { optimize: input.optimize === true });
39274
+ }
39275
+ if (!sdkImage)
39276
+ await runCompiler(
39277
+ import_node_path53.default.join(options2.toolchainBin, "llvm-objcopy"),
39278
+ ["--remove-section=.swift1_autolink_entries", optimized],
39279
+ buildOptions
39280
+ );
39281
+ const artifact = {
39282
+ hash,
39283
+ bytes: (0, import_node_fs53.readFileSync)(optimized),
39284
+ icu: await icu,
39285
+ sdk: sdkAsset
39286
+ };
39287
+ if (artifact.bytes.length <= 8)
39288
+ throw new Error("swift-compile: deferred linker produced no executable");
39289
+ if (!options2.project) saveCompiledArtifact(root2, artifact);
39290
+ saveSharedArtifact(sharedRoot, artifact);
39291
+ stage("compiled artifact verified");
39292
+ return retain(baseRoot, artifact);
39293
+ } finally {
39294
+ readHold?.release();
39295
+ }
39296
+ });
39008
39297
  });
39009
39298
  },
39010
39299
  options2.signal
39011
39300
  );
39012
39301
  }
39013
- var import_node_child_process32, import_node_crypto32, import_node_fs53, import_node_os12, import_node_path53, v6, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_COMPILER_ENV_KEYS, distributionManifests, distributionCompileViews, REACH_STAGED_FRAMEWORKS, objcEnumerations, clangDeclarationEnumCache, objcEnumForward, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, compileSurfaces, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, NON_IOS_MODULES, sdkPaths, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, CLANG_DISTRIBUTION_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, FOUNDATION_IMPLICIT_MODULES, FRAMEWORK_COMPANION_IMPORT, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, MODULE_MAP_RESPONSE_FILE_RUN, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, codeMasks, codeMaskChars, CODE_MASK_CACHE_CHARS, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, emptyMacroEnvironment, wasmMacroEnvironment, cPredefineTable, cPredefineCache, HIDDEN_UNITS, FIRST_WINS_PAIRS, LAST_WINS_PAIRS, VALUE_FLAGS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, frameworkProductsReceiptSchema, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN;
39302
+ var import_node_child_process32, import_node_crypto32, import_node_fs53, import_node_os12, import_node_path53, v6, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_COMPILER_ENV_KEYS, distributionManifests, distributionCompileViews, REACH_STAGED_FRAMEWORKS, objcEnumerations, clangDeclarationEnumCache, objcEnumForward, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, compileSurfaces, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, NON_IOS_MODULES, sdkPaths, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, CLANG_DISTRIBUTION_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, FOUNDATION_IMPLICIT_MODULES, FRAMEWORK_COMPANION_IMPORT, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, MODULE_MAP_RESPONSE_FILE_RUN, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, codeMasks, codeMaskChars, CODE_MASK_CACHE_CHARS, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, emptyMacroEnvironment, wasmMacroEnvironment, cPredefineTable, cPredefineCache, HIDDEN_UNITS, FIRST_WINS_PAIRS, LAST_WINS_PAIRS, VALUE_FLAGS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, frameworkProductsReceiptSchema, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN, SWIFT_FRAMEWORK_SLOT_RELEASE, SWIFT_BUILD_ROOT_SLOTS, SWIFT_BUILD_ROOT_SHAPE;
39014
39303
  var init_swift_compile = __esm({
39015
39304
  "src/swift-compile.ts"() {
39016
39305
  "use strict";
@@ -39281,7 +39570,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
39281
39570
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
39282
39571
  MULTI_MANIFEST_VERSION = 76;
39283
39572
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
39284
- compilerSourceDigest = true ? "6fbcbab3535da2f464a19f4d3c1db8a7e4b393927e5158477332f4cc978cc22f" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
39573
+ compilerSourceDigest = true ? "203439fc20df8d328b0c245496fc6db90092265409adb61b593725e82ce837de" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
39285
39574
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
39286
39575
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
39287
39576
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -39705,6 +39994,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
39705
39994
  retainedArtifacts = /* @__PURE__ */ new Map();
39706
39995
  FRAMEWORK_LINK_TARGET = "PeachFrameworkLink";
39707
39996
  frameworkProductsReceiptSchema = v6.object({
39997
+ root: v6.string(),
39708
39998
  modules: v6.string(),
39709
39999
  objects: v6.array(v6.string()),
39710
40000
  lazyObjects: v6.array(v6.string()),
@@ -39721,6 +40011,9 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
39721
40011
  SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS = 4;
39722
40012
  SWIFT_FRAMEWORK_SLOT_KEY = ".peach-framework-key";
39723
40013
  SWIFT_FRAMEWORK_SLOT_ORIGIN = ".peach-framework-origin";
40014
+ SWIFT_FRAMEWORK_SLOT_RELEASE = ".peach-framework-release";
40015
+ SWIFT_BUILD_ROOT_SLOTS = 4;
40016
+ SWIFT_BUILD_ROOT_SHAPE = ".peach-build-shape";
39724
40017
  }
39725
40018
  });
39726
40019
 
@@ -57110,21 +57403,457 @@ end
57110
57403
  });
57111
57404
 
57112
57405
  // src/plist.ts
57406
+ function decodeXmlEntities(text7) {
57407
+ if (!text7.includes("&")) return text7;
57408
+ return text7.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);/g, (full, entity2) => {
57409
+ if (entity2.startsWith("#x") || entity2.startsWith("#X")) {
57410
+ const code = Number.parseInt(entity2.slice(2), 16);
57411
+ return Number.isFinite(code) ? String.fromCodePoint(code) : full;
57412
+ }
57413
+ if (entity2.startsWith("#")) {
57414
+ const code = Number.parseInt(entity2.slice(1), 10);
57415
+ return Number.isFinite(code) ? String.fromCodePoint(code) : full;
57416
+ }
57417
+ return NAMED_ENTITIES[entity2] ?? full;
57418
+ });
57419
+ }
57420
+ function escapeXmlText(text7) {
57421
+ return text7.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
57422
+ }
57423
+ function parseXmlDocument(input) {
57424
+ const source = input.startsWith("\uFEFF") ? input.slice(1) : input;
57425
+ const len = source.length;
57426
+ let pos = 0;
57427
+ const skipIgnorable = () => {
57428
+ while (pos < len) {
57429
+ while (pos < len && /\s/.test(source[pos])) pos++;
57430
+ if (source.startsWith("<!--", pos)) {
57431
+ const end = source.indexOf("-->", pos + 4);
57432
+ if (end === -1) throw new Error("unterminated XML comment");
57433
+ pos = end + 3;
57434
+ continue;
57435
+ }
57436
+ if (source.startsWith("<?", pos)) {
57437
+ const end = source.indexOf("?>", pos + 2);
57438
+ if (end === -1) throw new Error("unterminated XML processing instruction");
57439
+ pos = end + 2;
57440
+ continue;
57441
+ }
57442
+ if (source.startsWith("<!DOCTYPE", pos)) {
57443
+ pos += 9;
57444
+ let depth = 0;
57445
+ let quote3 = "";
57446
+ while (pos < len) {
57447
+ const ch = source[pos];
57448
+ pos++;
57449
+ if (quote3) {
57450
+ if (ch === quote3) quote3 = "";
57451
+ } else if (ch === '"' || ch === "'") {
57452
+ quote3 = ch;
57453
+ } else if (ch === "[") {
57454
+ depth++;
57455
+ } else if (ch === "]") {
57456
+ depth = Math.max(0, depth - 1);
57457
+ } else if (ch === ">" && depth === 0) {
57458
+ break;
57459
+ }
57460
+ }
57461
+ continue;
57462
+ }
57463
+ break;
57464
+ }
57465
+ };
57466
+ const readElement = () => {
57467
+ if (source[pos] !== "<") {
57468
+ throw new Error(`expected XML tag at offset ${pos}`);
57469
+ }
57470
+ pos++;
57471
+ const nameStart = pos;
57472
+ while (pos < len && /[^\s/>]/.test(source[pos])) pos++;
57473
+ const tag = source.slice(nameStart, pos);
57474
+ if (!tag) throw new Error(`empty XML tag name at offset ${nameStart}`);
57475
+ let quote3 = "";
57476
+ let selfClosing = false;
57477
+ while (pos < len) {
57478
+ const ch = source[pos];
57479
+ if (quote3) {
57480
+ pos++;
57481
+ if (ch === quote3) quote3 = "";
57482
+ continue;
57483
+ }
57484
+ if (ch === '"' || ch === "'") {
57485
+ quote3 = ch;
57486
+ pos++;
57487
+ continue;
57488
+ }
57489
+ if (ch === "/" && source[pos + 1] === ">") {
57490
+ selfClosing = true;
57491
+ pos += 2;
57492
+ break;
57493
+ }
57494
+ if (ch === ">") {
57495
+ pos++;
57496
+ break;
57497
+ }
57498
+ pos++;
57499
+ }
57500
+ if (selfClosing) {
57501
+ return { tag, children: [], text: "" };
57502
+ }
57503
+ const children = [];
57504
+ let text7 = "";
57505
+ while (pos < len) {
57506
+ if (source.startsWith("<!--", pos)) {
57507
+ const end2 = source.indexOf("-->", pos + 4);
57508
+ if (end2 === -1) throw new Error("unterminated XML comment");
57509
+ pos = end2 + 3;
57510
+ continue;
57511
+ }
57512
+ if (source.startsWith("<![CDATA[", pos)) {
57513
+ const end2 = source.indexOf("]]>", pos + 9);
57514
+ if (end2 === -1) throw new Error("unterminated CDATA section");
57515
+ text7 += source.slice(pos + 9, end2);
57516
+ pos = end2 + 3;
57517
+ continue;
57518
+ }
57519
+ if (source.startsWith("</", pos)) {
57520
+ pos += 2;
57521
+ const closeStart = pos;
57522
+ while (pos < len && /[^\s>]/.test(source[pos])) pos++;
57523
+ const closeTag = source.slice(closeStart, pos);
57524
+ while (pos < len && /\s/.test(source[pos])) pos++;
57525
+ if (source[pos] !== ">") throw new Error(`malformed closing tag </${closeTag}>`);
57526
+ pos++;
57527
+ if (closeTag !== tag) {
57528
+ throw new Error(`mismatched XML closing tag </${closeTag}> for <${tag}>`);
57529
+ }
57530
+ return { tag, children, text: text7 };
57531
+ }
57532
+ if (source[pos] === "<") {
57533
+ children.push(readElement());
57534
+ continue;
57535
+ }
57536
+ const nextTag = source.indexOf("<", pos);
57537
+ const end = nextTag === -1 ? len : nextTag;
57538
+ text7 += decodeXmlEntities(source.slice(pos, end));
57539
+ pos = end;
57540
+ }
57541
+ throw new Error(`unclosed XML tag <${tag}>`);
57542
+ };
57543
+ skipIgnorable();
57544
+ if (pos >= len) throw new Error("empty XML plist document");
57545
+ return readElement();
57546
+ }
57547
+ function parseXmlPlist(source, options2 = {}) {
57548
+ const root = parseXmlDocument(source);
57549
+ if (root.tag !== "plist") {
57550
+ throw new Error(`expected <plist> root element, got <${root.tag}>`);
57551
+ }
57552
+ if (root.children.length === 0) {
57553
+ if (options2.strict) throw new Error("<plist> element has no root value");
57554
+ return void 0;
57555
+ }
57556
+ if (options2.strict && root.children.length !== 1) {
57557
+ throw new Error("<plist> element must contain exactly one root value");
57558
+ }
57559
+ const leafText = (node) => {
57560
+ if (options2.strict && node.children.length > 0) {
57561
+ throw new Error(`<${node.tag}> must not contain child elements`);
57562
+ }
57563
+ return node.text;
57564
+ };
57565
+ const visit3 = (node) => {
57566
+ switch (node.tag) {
57567
+ case "dict": {
57568
+ const result = {};
57569
+ if (options2.strict && node.children.length % 2 !== 0) {
57570
+ throw new Error("<dict> must contain key/value pairs");
57571
+ }
57572
+ for (let i = 0; i + 1 < node.children.length; i += 2) {
57573
+ const keyNode = node.children[i];
57574
+ if (keyNode.tag !== "key") {
57575
+ throw new Error(`expected <key> in <dict>, got <${keyNode.tag}>`);
57576
+ }
57577
+ result[leafText(keyNode)] = visit3(node.children[i + 1]);
57578
+ }
57579
+ return result;
57580
+ }
57581
+ case "array":
57582
+ return node.children.map(visit3);
57583
+ case "string":
57584
+ return leafText(node);
57585
+ case "integer": {
57586
+ const raw2 = leafText(node).trim();
57587
+ if (options2.onInteger) return options2.onInteger(raw2);
57588
+ if (!raw2) throw new Error("empty <integer> element");
57589
+ return Number.parseInt(raw2, 10);
57590
+ }
57591
+ case "real": {
57592
+ const raw2 = leafText(node).trim();
57593
+ if (options2.onReal) return options2.onReal(raw2);
57594
+ if (!raw2) throw new Error("empty <real> element");
57595
+ return Number.parseFloat(raw2);
57596
+ }
57597
+ case "true":
57598
+ return true;
57599
+ case "false":
57600
+ return false;
57601
+ case "data":
57602
+ return Buffer.from(leafText(node).replace(/\s+/g, ""), "base64");
57603
+ case "date":
57604
+ return new Date(leafText(node).trim());
57605
+ default:
57606
+ throw new Error(`unsupported plist element ${node.tag}`);
57607
+ }
57608
+ };
57609
+ return visit3(root.children[0]);
57610
+ }
57611
+ function parsePlist(source) {
57612
+ const root = parseXmlDocument(source);
57613
+ if (root.tag !== "plist") {
57614
+ throw new Error(`expected <plist> root element, got <${root.tag}>`);
57615
+ }
57616
+ if (root.children.length === 0) return {};
57617
+ const visit3 = (node) => {
57618
+ switch (node.tag) {
57619
+ case "dict": {
57620
+ const result = {};
57621
+ for (let i = 0; i + 1 < node.children.length; i += 2) {
57622
+ const keyNode = node.children[i];
57623
+ if (keyNode.tag !== "key") {
57624
+ throw new Error(`expected <key> in <dict>, got <${keyNode.tag}>`);
57625
+ }
57626
+ result[keyNode.text] = visit3(node.children[i + 1]);
57627
+ }
57628
+ return result;
57629
+ }
57630
+ case "array":
57631
+ return node.children.map(visit3);
57632
+ case "string":
57633
+ return node.text;
57634
+ case "integer": {
57635
+ const raw2 = node.text.trim();
57636
+ if (!raw2) throw new Error("empty <integer> element");
57637
+ return Number.parseInt(raw2, 10);
57638
+ }
57639
+ case "real": {
57640
+ const raw2 = node.text.trim();
57641
+ if (!raw2) throw new Error("empty <real> element");
57642
+ return Number.parseFloat(raw2);
57643
+ }
57644
+ case "true":
57645
+ return true;
57646
+ case "false":
57647
+ return false;
57648
+ case "data":
57649
+ return Buffer.from(node.text.replace(/\s+/g, ""), "base64");
57650
+ case "date":
57651
+ return new Date(node.text.trim());
57652
+ default:
57653
+ throw new Error(`unsupported plist element ${node.tag}`);
57654
+ }
57655
+ };
57656
+ return visit3(root.children[0]);
57657
+ }
57113
57658
  function parsePlistSource(source) {
57114
- return import_plist.default.parse(source);
57659
+ return parseXmlPlist(source);
57660
+ }
57661
+ function renderValue(value, indent2) {
57662
+ if (value === void 0 || value === null) return null;
57663
+ if (typeof value === "string") {
57664
+ return `${indent2}<string>${escapeXmlText(value)}</string>`;
57665
+ }
57666
+ if (typeof value === "boolean") {
57667
+ return `${indent2}${value ? "<true/>" : "<false/>"}`;
57668
+ }
57669
+ if (typeof value === "number") {
57670
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
57671
+ return `${indent2}<integer>${value}</integer>`;
57672
+ }
57673
+ return `${indent2}<real>${value}</real>`;
57674
+ }
57675
+ if (value instanceof Date) {
57676
+ return `${indent2}<date>${value.toISOString().replace(/\.\d{3}Z$/, "Z")}</date>`;
57677
+ }
57678
+ if (Buffer.isBuffer(value) || value instanceof Uint8Array) {
57679
+ const encoded = Buffer.from(value).toString("base64");
57680
+ return encoded ? `${indent2}<data>${encoded}</data>` : `${indent2}<data/>`;
57681
+ }
57682
+ if (Array.isArray(value)) {
57683
+ const items2 = value.map((entry) => renderValue(entry, `${indent2} `)).filter((entry) => entry !== null);
57684
+ if (items2.length === 0) return `${indent2}<array/>`;
57685
+ return `${indent2}<array>
57686
+ ${items2.join("\n")}
57687
+ ${indent2}</array>`;
57688
+ }
57689
+ if (typeof value === "object") {
57690
+ const lines = [];
57691
+ for (const [key2, entry] of Object.entries(value)) {
57692
+ const rendered = renderValue(entry, `${indent2} `);
57693
+ if (rendered === null) continue;
57694
+ lines.push(`${indent2} <key>${escapeXmlText(key2)}</key>`);
57695
+ lines.push(rendered);
57696
+ }
57697
+ if (lines.length === 0) return `${indent2}<dict/>`;
57698
+ return `${indent2}<dict>
57699
+ ${lines.join("\n")}
57700
+ ${indent2}</dict>`;
57701
+ }
57702
+ throw new Error(`unsupported plist value type: ${typeof value}`);
57115
57703
  }
57116
- var import_plist;
57704
+ function buildPlist(value) {
57705
+ const body = renderValue(value, " ");
57706
+ return [
57707
+ '<?xml version="1.0" encoding="UTF-8"?>',
57708
+ '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
57709
+ '<plist version="1.0">',
57710
+ ...body ? [body] : [],
57711
+ "</plist>",
57712
+ ""
57713
+ ].join("\n");
57714
+ }
57715
+ var NAMED_ENTITIES;
57117
57716
  var init_plist = __esm({
57118
57717
  "src/plist.ts"() {
57119
57718
  "use strict";
57120
- import_plist = __toESM(require("peachsim/vendor/plist"), 1);
57719
+ NAMED_ENTITIES = {
57720
+ amp: "&",
57721
+ lt: "<",
57722
+ gt: ">",
57723
+ quot: '"',
57724
+ apos: "'"
57725
+ };
57121
57726
  }
57122
57727
  });
57123
57728
 
57124
57729
  // src/plist-bytes.ts
57730
+ function defaultInteger(value) {
57731
+ return value >= BigInt(Number.MIN_SAFE_INTEGER) && value <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(value) : value;
57732
+ }
57733
+ function parseBinaryPlist(source, options2 = {}) {
57734
+ const bytes = Buffer.isBuffer(source) ? source : Buffer.from(source);
57735
+ (0, import_strict.default)(bytes.length >= 40, "binary plist is too short");
57736
+ (0, import_strict.default)(bytes.toString("ascii", 0, 8) === "bplist00", "invalid binary plist header");
57737
+ const trailer = bytes.length - 32;
57738
+ const offsetWidth = bytes[trailer + 6];
57739
+ const refWidth = bytes[trailer + 7];
57740
+ (0, import_strict.default)(offsetWidth > 0 && offsetWidth <= 8 && refWidth > 0 && refWidth <= 8);
57741
+ const count = Number(bytes.readBigUInt64BE(trailer + 8));
57742
+ const root = Number(bytes.readBigUInt64BE(trailer + 16));
57743
+ const table = Number(bytes.readBigUInt64BE(trailer + 24));
57744
+ (0, import_strict.default)(
57745
+ table >= 8 && table < trailer && count > 0 && count <= (trailer - table) / offsetWidth
57746
+ );
57747
+ const unsigned = (at, width) => {
57748
+ (0, import_strict.default)(at >= 8 && at + width <= trailer);
57749
+ let result = 0n;
57750
+ for (let i = at; i < at + width; i++) result = result * 256n + BigInt(bytes[i]);
57751
+ return result;
57752
+ };
57753
+ const cache = /* @__PURE__ */ new Map();
57754
+ const visiting = /* @__PURE__ */ new Set();
57755
+ const visit3 = (ref) => {
57756
+ (0, import_strict.default)(ref >= 0 && ref < count && !visiting.has(ref));
57757
+ if (cache.has(ref)) return cache.get(ref);
57758
+ visiting.add(ref);
57759
+ const at = Number(unsigned(table + ref * offsetWidth, offsetWidth));
57760
+ (0, import_strict.default)(at >= 8 && at < table);
57761
+ const marker = bytes[at];
57762
+ const type = marker >> 4;
57763
+ let length = marker & 15;
57764
+ let data = at + 1;
57765
+ if (length === 15 && [4, 5, 6, 7, 10, 12, 13].includes(type)) {
57766
+ (0, import_strict.default)(data < table && bytes[data] >> 4 === 1);
57767
+ const width = 2 ** (bytes[data] & 15);
57768
+ (0, import_strict.default)(width <= 8 && data + 1 + width <= table);
57769
+ length = Number(unsigned(data + 1, width));
57770
+ data += 1 + width;
57771
+ }
57772
+ const end = (size2) => {
57773
+ (0, import_strict.default)(Number.isSafeInteger(size2) && data + size2 <= table);
57774
+ return data + size2;
57775
+ };
57776
+ const references = (total) => {
57777
+ end(total * refWidth);
57778
+ return Array.from(
57779
+ { length: total },
57780
+ (_, i) => visit3(Number(unsigned(data + i * refWidth, refWidth)))
57781
+ );
57782
+ };
57783
+ let value;
57784
+ switch (type) {
57785
+ case 0:
57786
+ if (!options2.strict && marker === 0) {
57787
+ value = null;
57788
+ break;
57789
+ }
57790
+ (0, import_strict.default)(marker === 8 || marker === 9);
57791
+ value = marker === 9;
57792
+ break;
57793
+ case 1: {
57794
+ const size2 = 2 ** length;
57795
+ (0, import_strict.default)(size2 <= 16);
57796
+ end(size2);
57797
+ const raw2 = unsigned(data, size2);
57798
+ const signed = size2 >= 8 ? BigInt.asIntN(size2 * 8, raw2) : raw2;
57799
+ value = options2.onInteger ? options2.onInteger(signed) : defaultInteger(signed);
57800
+ break;
57801
+ }
57802
+ case 2: {
57803
+ (0, import_strict.default)(length === 2 || length === 3);
57804
+ end(2 ** length);
57805
+ const real = length === 2 ? bytes.readFloatBE(data) : bytes.readDoubleBE(data);
57806
+ value = options2.onReal ? options2.onReal(real) : real;
57807
+ break;
57808
+ }
57809
+ case 3:
57810
+ (0, import_strict.default)(length === 3);
57811
+ end(8);
57812
+ value = new Date(Date.UTC(2001, 0, 1) + bytes.readDoubleBE(data) * 1e3);
57813
+ break;
57814
+ case 4:
57815
+ value = bytes.subarray(data, end(length));
57816
+ break;
57817
+ case 5:
57818
+ value = bytes.toString("ascii", data, end(length));
57819
+ break;
57820
+ case 6:
57821
+ value = Buffer.from(bytes.subarray(data, end(length * 2))).swap16().toString("utf16le");
57822
+ break;
57823
+ case 7:
57824
+ value = bytes.toString("utf8", data, end(length));
57825
+ break;
57826
+ case 8: {
57827
+ if (options2.strict) throw new Error(`unsupported binary plist type ${type}`);
57828
+ const size2 = length + 1;
57829
+ (0, import_strict.default)(size2 >= 1 && size2 <= 8);
57830
+ end(size2);
57831
+ value = { UID: Number(unsigned(data, size2)) };
57832
+ break;
57833
+ }
57834
+ case 10:
57835
+ case 12:
57836
+ value = references(length);
57837
+ break;
57838
+ case 13: {
57839
+ const elements = references(length * 2);
57840
+ const keys = elements.slice(0, length);
57841
+ (0, import_strict.default)(keys.every((key2) => typeof key2 === "string"));
57842
+ value = Object.fromEntries(keys.map((key2, i) => [key2, elements[length + i]]));
57843
+ break;
57844
+ }
57845
+ default:
57846
+ throw new Error(`unsupported binary plist type ${type}`);
57847
+ }
57848
+ visiting.delete(ref);
57849
+ cache.set(ref, value);
57850
+ return value;
57851
+ };
57852
+ return visit3(root);
57853
+ }
57125
57854
  function parsePlistBytes(source, parseXml2 = parsePlistSource) {
57126
57855
  const bytes = Buffer.from(source);
57127
- return bytes.subarray(0, 8).toString("ascii") === "bplist00" ? import_bplist_parser.default.parseBuffer(bytes)[0] : parseXml2(bytes.toString("utf8"));
57856
+ return bytes.subarray(0, 8).toString("ascii") === "bplist00" ? parseBinaryPlist(bytes) : parseXml2(bytes.toString("utf8"));
57128
57857
  }
57129
57858
  function buildBinaryPlist(top) {
57130
57859
  const nodes = [];
@@ -57210,11 +57939,11 @@ function buildBinaryPlist(top) {
57210
57939
  trailer
57211
57940
  ]);
57212
57941
  }
57213
- var import_bplist_parser, isList, isUid;
57942
+ var import_strict, isList, isUid;
57214
57943
  var init_plist_bytes = __esm({
57215
57944
  "src/plist-bytes.ts"() {
57216
57945
  "use strict";
57217
- import_bplist_parser = __toESM(require("peachsim/vendor/bplist-parser"), 1);
57946
+ import_strict = __toESM(require("node:assert/strict"), 1);
57218
57947
  init_plist();
57219
57948
  isList = (value) => Array.isArray(value);
57220
57949
  isUid = (value) => typeof value === "object" && !isList(value) && !Buffer.isBuffer(value) && Object.keys(value).length === 1 && typeof value["CF$UID"] === "number";
@@ -57409,10 +58138,10 @@ var init_pods_files = __esm({
57409
58138
  constructor(targetName, path139) {
57410
58139
  this.targetName = targetName;
57411
58140
  this.path = path139;
57412
- const plist6 = parsePlistBytes(import_node_fs63.default.readFileSync(`${path139}/Info.plist`));
57413
- if (!isRecord(plist6) || !Array.isArray(plist6.AvailableLibraries))
58141
+ const plist2 = parsePlistBytes(import_node_fs63.default.readFileSync(`${path139}/Info.plist`));
58142
+ if (!isRecord(plist2) || !Array.isArray(plist2.AvailableLibraries))
57414
58143
  throw new Error(`${path139}/Info.plist declares no AvailableLibraries`);
57415
- this.slices = plist6.AvailableLibraries.map((library) => {
58144
+ this.slices = plist2.AvailableLibraries.map((library) => {
57416
58145
  if (!isRecord(library) || typeof library.LibraryIdentifier !== "string" || typeof library.LibraryPath !== "string" || typeof library.SupportedPlatform !== "string")
57417
58146
  throw new Error(`${path139}/Info.plist has an invalid library entry`);
57418
58147
  const root = `${path139}/${library.LibraryIdentifier}`;
@@ -65570,7 +66299,7 @@ ${published3.map(
65570
66299
  const contents2 = new Map([
65571
66300
  [
65572
66301
  "Info.plist",
65573
- import_plist3.default.build({
66302
+ buildPlist({
65574
66303
  AvailableLibraries: [
65575
66304
  {
65576
66305
  LibraryIdentifier: "ios-arm64-simulator",
@@ -65655,7 +66384,7 @@ ${published3.map(
65655
66384
  const infoPlistReady = infoPlistFiles.every((file) => import_node_fs71.default.existsSync(file));
65656
66385
  const info = {};
65657
66386
  for (const file of infoPlistReady ? infoPlistFiles : []) {
65658
- const fragment = import_plist3.default.parse(import_node_fs71.default.readFileSync(file, "utf8"));
66387
+ const fragment = parsePlist(import_node_fs71.default.readFileSync(file, "utf8"));
65659
66388
  if (!fragment || typeof fragment !== "object" || Array.isArray(fragment) || fragment instanceof Date || Buffer.isBuffer(fragment))
65660
66389
  throw new Error(`${file} is not a plist dictionary`);
65661
66390
  for (const [key2, value] of Object.entries(fragment)) {
@@ -65724,7 +66453,7 @@ ${published3.map(
65724
66453
  rootDir: root,
65725
66454
  projectFiles: buildFiles.sort(),
65726
66455
  projectDirs: [root],
65727
- infoPlist: infoPlistReady ? import_plist3.default.build(info) : null,
66456
+ infoPlist: infoPlistReady ? buildPlist(info) : null,
65728
66457
  infoPlistFile: null,
65729
66458
  postBundleScripts: [],
65730
66459
  appIconName: "",
@@ -65776,7 +66505,7 @@ function shellTokens(options2) {
65776
66505
  return words2;
65777
66506
  });
65778
66507
  }
65779
- var import_node_child_process38, import_node_crypto40, import_node_fs71, import_node_os16, import_node_path71, import_plist3, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER3, PRODUCTS, graphs, CLANG_CONFIGURATION_FLAGS, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
66508
+ var import_node_child_process38, import_node_crypto40, import_node_fs71, import_node_os16, import_node_path71, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER3, PRODUCTS, graphs, CLANG_CONFIGURATION_FLAGS, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
65780
66509
  var init_bazel_project = __esm({
65781
66510
  "src/bazel-project.ts"() {
65782
66511
  "use strict";
@@ -65785,8 +66514,8 @@ var init_bazel_project = __esm({
65785
66514
  import_node_fs71 = __toESM(require("node:fs"), 1);
65786
66515
  import_node_os16 = __toESM(require("node:os"), 1);
65787
66516
  import_node_path71 = __toESM(require("node:path"), 1);
65788
- import_plist3 = __toESM(require("peachsim/vendor/plist"), 1);
65789
66517
  init_is_record();
66518
+ init_plist();
65790
66519
  LIBRARY_RULES = /* @__PURE__ */ new Set(["swift_library", "objc_library", "cc_library"]);
65791
66520
  QUERIED_RULES = [
65792
66521
  "swift_library",
@@ -66275,7 +67004,7 @@ var init_provenance = __esm({
66275
67004
  import_node_crypto42 = require("node:crypto");
66276
67005
  import_node_fs73 = require("node:fs");
66277
67006
  import_node_path73 = require("node:path");
66278
- swiftCoverageProvenance = true ? JSON.parse('{"swift-coverage/indexdump.ts":"0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412","swift-coverage/indexing.ts":"633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272","swift-coverage/types.ts":"bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1","swift-coverage/source.ts":"c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee","swift-coverage/package.ts":"1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b","swift-coverage/xcode.ts":"d6a3228567a46c6d5280895383093889d9b868958a117881061bdd74729a225f","swift-coverage/xcode-assets.ts":"d98d6294b359528f7733b26db6f80f554782354faa235605f9562be4ad98b8a3","swift-coverage/xcode-asset-symbols.ts":"1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671","swift-coverage/xcode-bridging.ts":"33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11","swift-coverage/xcode-packages.ts":"5c83f56357d880243ab485b260d23abd0094583ffa2287dac6e9e7eb18c3673d","swift-coverage/xcode-strings.ts":"facdbeb9de6bb12da4ab4954553edfaadd0e486f1181443138be70c3d8396236","swift-coverage/reader.ts":"da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"c64b677c93e48d61c71b371d887e9db8506c32ef968ed50d9468de1f67fe5d8d","swift-package.ts":"05c6cf101fbc944f6684a70db0a9c5aede846b2f0482a6b4a5a0abed737d4658","swift-source-file.ts":"8becce5e73b76a61d9d202c1ecfb39b1238e9bbf0e77841f1c51c98fa9ac7bd3","swift-toolchain.ts":"4f54e110f6f2f72da6d20ca6fc1a10c7dbd0cd462b7dd3959351e107c4aa7548","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"c72b724fc497e4cf603c355f86eb3c07c929ad299758cffbc6ff88ed241654c6","xcode-project.ts":"81f36daeda9ac5c81a5631fdcab42fb12d09a74705915b8861f404d0db2e01c5","xcode-target-members.ts":"96f6a9f5567a4fbd9806252229b35b9a451a112b20f70f8c20189ffd428815fd","xcode-json-project.ts":"df6d6db28e0c8cfdf1f480e1e32d35f12c9cf1936642d5dda923889fb18a8fd6","openstep-plist.ts":"da11f86885ef1e25979ad989f332195c113c4b7a43f108e8d36646973430b81b"}') : swiftCoverageSourceDigests((0, import_node_path73.join)(__sootsim_import_meta_dirname, ".."));
67007
+ swiftCoverageProvenance = true ? JSON.parse('{"swift-coverage/indexdump.ts":"0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412","swift-coverage/indexing.ts":"633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272","swift-coverage/types.ts":"bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1","swift-coverage/source.ts":"c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee","swift-coverage/package.ts":"1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b","swift-coverage/xcode.ts":"d6a3228567a46c6d5280895383093889d9b868958a117881061bdd74729a225f","swift-coverage/xcode-assets.ts":"d98d6294b359528f7733b26db6f80f554782354faa235605f9562be4ad98b8a3","swift-coverage/xcode-asset-symbols.ts":"1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671","swift-coverage/xcode-bridging.ts":"33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11","swift-coverage/xcode-packages.ts":"5c83f56357d880243ab485b260d23abd0094583ffa2287dac6e9e7eb18c3673d","swift-coverage/xcode-strings.ts":"facdbeb9de6bb12da4ab4954553edfaadd0e486f1181443138be70c3d8396236","swift-coverage/reader.ts":"da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"c64b677c93e48d61c71b371d887e9db8506c32ef968ed50d9468de1f67fe5d8d","swift-package.ts":"05c6cf101fbc944f6684a70db0a9c5aede846b2f0482a6b4a5a0abed737d4658","swift-source-file.ts":"8becce5e73b76a61d9d202c1ecfb39b1238e9bbf0e77841f1c51c98fa9ac7bd3","swift-toolchain.ts":"32bf10d6f3396dd1a20ff6d415499a5990ec2550c63306fd9ef071bdf4a58f1e","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"c72b724fc497e4cf603c355f86eb3c07c929ad299758cffbc6ff88ed241654c6","xcode-project.ts":"fe50b74f53082e75bb32393ada42bbbcb0ff982024a026b4b673f2004dd404d8","xcode-target-members.ts":"96f6a9f5567a4fbd9806252229b35b9a451a112b20f70f8c20189ffd428815fd","xcode-json-project.ts":"df6d6db28e0c8cfdf1f480e1e32d35f12c9cf1936642d5dda923889fb18a8fd6","openstep-plist.ts":"da11f86885ef1e25979ad989f332195c113c4b7a43f108e8d36646973430b81b"}') : swiftCoverageSourceDigests((0, import_node_path73.join)(__sootsim_import_meta_dirname, ".."));
66279
67008
  }
66280
67009
  });
66281
67010
 
@@ -68228,13 +68957,13 @@ function intentModelVersion(value) {
68228
68957
  return value === "1.0" || value === "1.1" ? value : "1.2";
68229
68958
  }
68230
68959
  function modelList(value, key2) {
68231
- (0, import_strict.default)(value && typeof value === "object");
68960
+ (0, import_strict2.default)(value && typeof value === "object");
68232
68961
  const entries2 = Reflect.get(value, key2) ?? [];
68233
- (0, import_strict.default)(Array.isArray(entries2));
68962
+ (0, import_strict2.default)(Array.isArray(entries2));
68234
68963
  return entries2;
68235
68964
  }
68236
68965
  function identifier(value) {
68237
- (0, import_strict.default)(
68966
+ (0, import_strict2.default)(
68238
68967
  typeof value === "string" && /^[_\p{ID_Start}][_\p{ID_Continue}]*$/u.test(value),
68239
68968
  `invalid intent identifier ${String(value)}`
68240
68969
  );
@@ -68242,18 +68971,18 @@ function identifier(value) {
68242
68971
  }
68243
68972
  function intentClassIdentifier(value) {
68244
68973
  const name3 = identifier(value);
68245
- (0, import_strict.default)(/^[A-Za-z_0-9]+$/.test(name3), `invalid intent class name ${name3}`);
68974
+ (0, import_strict2.default)(/^[A-Za-z_0-9]+$/.test(name3), `invalid intent class name ${name3}`);
68246
68975
  return name3;
68247
68976
  }
68248
68977
  function readSwiftField(value, key2, customTypes) {
68249
- (0, import_strict.default)(value && typeof value === "object");
68978
+ (0, import_strict2.default)(value && typeof value === "object");
68250
68979
  const get = (property) => Reflect.get(value, key2 + property);
68251
68980
  const name3 = identifier(get("Name"));
68252
68981
  let kind = intentParameterKind(get("Type"));
68253
68982
  let enumeration = get("EnumType");
68254
68983
  let object8 = get("ObjectType");
68255
- (0, import_strict.default)(enumeration === void 0 || kind === "Integer");
68256
- (0, import_strict.default)(object8 === void 0 || kind === "Object");
68984
+ (0, import_strict2.default)(enumeration === void 0 || kind === "Integer");
68985
+ (0, import_strict2.default)(object8 === void 0 || kind === "Object");
68257
68986
  const custom = enumeration ?? object8;
68258
68987
  let customName;
68259
68988
  if (custom !== void 0) {
@@ -68268,7 +68997,7 @@ function readSwiftField(value, key2, customTypes) {
68268
68997
  }
68269
68998
  } else {
68270
68999
  customName = customTypes.get(name4);
68271
- (0, import_strict.default)(customName, "unknown intent parameter type: " + name4);
69000
+ (0, import_strict2.default)(customName, "unknown intent parameter type: " + name4);
68272
69001
  }
68273
69002
  }
68274
69003
  const type = types.get(kind);
@@ -68278,7 +69007,7 @@ function readSwiftField(value, key2, customTypes) {
68278
69007
  const valueType = multiple ? `[${array8}]` : base2;
68279
69008
  const resolves = get("SupportsResolution") === true;
68280
69009
  const explicitReasons = modelList(value, key2 + "UnsupportedReasons").map((entry) => {
68281
- (0, import_strict.default)(entry && typeof entry === "object");
69010
+ (0, import_strict2.default)(entry && typeof entry === "object");
68282
69011
  return identifier(Reflect.get(entry, key2 + "UnsupportedReasonCode"));
68283
69012
  });
68284
69013
  const defaults = resolves && !customName ? defaultUnsupportedReasons(kind) : [];
@@ -68369,18 +69098,18 @@ fatalError()
68369
69098
  }
68370
69099
  function customObjectFields(definition2, customTypes) {
68371
69100
  return modelList(definition2, "INTypeProperties").filter((entry) => {
68372
- (0, import_strict.default)(entry && typeof entry === "object");
69101
+ (0, import_strict2.default)(entry && typeof entry === "object");
68373
69102
  return Reflect.get(entry, "INTypePropertyDefault") !== true;
68374
69103
  }).map((entry) => {
68375
69104
  const field = readSwiftField(entry, "INTypeProperty", customTypes);
68376
69105
  return { ...field, availability: field.availability ?? swiftResolutionAvailable };
68377
69106
  });
68378
69107
  }
68379
- var import_strict, swiftAvailable, swiftResolutionAvailable, swiftOptionsAvailable, upper, iOS13, numericReasons, builtin2, types;
69108
+ var import_strict2, swiftAvailable, swiftResolutionAvailable, swiftOptionsAvailable, upper, iOS13, numericReasons, builtin2, types;
68380
69109
  var init_fields = __esm({
68381
69110
  "src/intent-definition/fields.ts"() {
68382
69111
  "use strict";
68383
- import_strict = __toESM(require("node:assert/strict"), 1);
69112
+ import_strict2 = __toESM(require("node:assert/strict"), 1);
68384
69113
  init_system_types();
68385
69114
  swiftAvailable = "@available(iOS 12.0, macOS 11.0, watchOS 5.0, *) @available(tvOS, unavailable)";
68386
69115
  swiftResolutionAvailable = "@available(iOS 13.0, macOS 11.0, watchOS 6.0, *)";
@@ -68555,7 +69284,7 @@ function intentHashInput(root, propertyTypes = []) {
68555
69284
  integer2(18, BigInt(value.length));
68556
69285
  for (const item of value) append(item);
68557
69286
  } else {
68558
- (0, import_strict2.default)(
69287
+ (0, import_strict3.default)(
68559
69288
  value && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype
68560
69289
  );
68561
69290
  const keys = Object.keys(value).sort();
@@ -68570,11 +69299,11 @@ function intentHashInput(root, propertyTypes = []) {
68570
69299
  for (const propertyType of propertyTypes) append(propertyType);
68571
69300
  return Buffer.concat(chunks);
68572
69301
  }
68573
- var import_strict2, IntentReal;
69302
+ var import_strict3, IntentReal;
68574
69303
  var init_hash_input = __esm({
68575
69304
  "src/intent-definition/hash-input.ts"() {
68576
69305
  "use strict";
68577
- import_strict2 = __toESM(require("node:assert/strict"), 1);
69306
+ import_strict3 = __toESM(require("node:assert/strict"), 1);
68578
69307
  IntentReal = class {
68579
69308
  constructor(value) {
68580
69309
  this.value = value;
@@ -68634,7 +69363,7 @@ function dictionary(value) {
68634
69363
  }
68635
69364
  function normalizedEnums(input) {
68636
69365
  return modelList(input, "INEnums").map((value) => {
68637
- (0, import_strict3.default)(dictionary(value));
69366
+ (0, import_strict4.default)(dictionary(value));
68638
69367
  return {
68639
69368
  ...value,
68640
69369
  INEnumName: intentClassIdentifier(value.INEnumName),
@@ -68652,7 +69381,7 @@ function localizationIdentifier(field, key2) {
68652
69381
  }
68653
69382
  function normalizedMetadata(type, source, field) {
68654
69383
  const defaults = typeMetadata.get(type) ?? {};
68655
- (0, import_strict3.default)(source === void 0 || dictionary(source));
69384
+ (0, import_strict4.default)(source === void 0 || dictionary(source));
68656
69385
  const metadata = source ? { ...source } : Object.fromEntries(
68657
69386
  Object.entries(defaults).map(([key2, value]) => {
68658
69387
  const qualified3 = `INIntentParameterMetadata${key2}`;
@@ -68676,7 +69405,7 @@ function normalizedMetadata(type, source, field) {
68676
69405
  function normalizedReasons(parameter, kind, field) {
68677
69406
  const reasons = /* @__PURE__ */ new Map();
68678
69407
  for (const reason of modelList(parameter, "INIntentParameterUnsupportedReasons")) {
68679
- (0, import_strict3.default)(dictionary(reason));
69408
+ (0, import_strict4.default)(dictionary(reason));
68680
69409
  const code = identifier(reason.INIntentParameterUnsupportedReasonCode);
68681
69410
  const text7 = reason.INIntentParameterUnsupportedReasonFormatString;
68682
69411
  reasons.set(
@@ -68713,17 +69442,17 @@ function compileIntentMetadata(input, enums, prefix) {
68713
69442
  }
68714
69443
  const objectHashes = /* @__PURE__ */ new Map();
68715
69444
  for (const declaration of modelList(input, "INTypes")) {
68716
- (0, import_strict3.default)(dictionary(declaration) && typeof declaration.INTypeName === "string");
69445
+ (0, import_strict4.default)(dictionary(declaration) && typeof declaration.INTypeName === "string");
68717
69446
  objectHashes.set(declaration.INTypeName, intentSipHash(intentHashInput(declaration)));
68718
69447
  }
68719
69448
  const intents = modelList(input, "INIntents").map((value) => {
68720
- (0, import_strict3.default)(dictionary(value));
69449
+ (0, import_strict4.default)(dictionary(value));
68721
69450
  const name3 = intentClassIdentifier(value.INIntentName);
68722
69451
  const system = value.INIntentType === "System";
68723
69452
  const propertyTypes = [];
68724
69453
  const parameters = modelList(value, "INIntentParameters").map(
68725
69454
  (parameter, position) => {
68726
- (0, import_strict3.default)(dictionary(parameter));
69455
+ (0, import_strict4.default)(dictionary(parameter));
68727
69456
  const enumName = parameter.INIntentParameterEnumType;
68728
69457
  const objectName = parameter.INIntentParameterObjectType;
68729
69458
  const reference = enumName ?? objectName;
@@ -68750,7 +69479,7 @@ function compileIntentMetadata(input, enums, prefix) {
68750
69479
  }
68751
69480
  } else {
68752
69481
  const localHash = hashes.get(typeName);
68753
- (0, import_strict3.default)(localHash !== void 0, `unknown intent parameter type: ${typeName}`);
69482
+ (0, import_strict4.default)(localHash !== void 0, `unknown intent parameter type: ${typeName}`);
68754
69483
  hash2 = localHash;
68755
69484
  }
68756
69485
  }
@@ -68776,7 +69505,7 @@ function compileIntentMetadata(input, enums, prefix) {
68776
69505
  if (parameter.INIntentParameterSupportsMultipleValues && parameter.INIntentParameterFixedSizeArray) {
68777
69506
  const sizes = /* @__PURE__ */ new Map();
68778
69507
  for (const size2 of modelList(parameter, "INIntentParameterArraySizes")) {
68779
- (0, import_strict3.default)(
69508
+ (0, import_strict4.default)(
68780
69509
  dictionary(size2) && typeof size2.INIntentParameterArraySizeSizeClass === "string"
68781
69510
  );
68782
69511
  sizes.set(size2.INIntentParameterArraySizeSizeClass, size2);
@@ -68900,7 +69629,7 @@ function formatPlistReal(value) {
68900
69629
  return `${sign}${digits.slice(0, point)}.${digits.slice(point)}`;
68901
69630
  }
68902
69631
  function writeIntentDefinition(input, prefix) {
68903
- (0, import_strict3.default)(dictionary(input));
69632
+ (0, import_strict4.default)(dictionary(input));
68904
69633
  const escape2 = (text7) => text7.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
68905
69634
  const lines = [
68906
69635
  '<?xml version="1.0" encoding="UTF-8"?>',
@@ -68937,7 +69666,7 @@ function writeIntentDefinition(input, prefix) {
68937
69666
  lines.push(`${indent2}</array>`);
68938
69667
  }
68939
69668
  } else {
68940
- (0, import_strict3.default)(dictionary(value));
69669
+ (0, import_strict4.default)(dictionary(value));
68941
69670
  const keys = Object.keys(value).sort();
68942
69671
  if (keys.length === 0) lines.push(`${indent2}<dict/>`);
68943
69672
  else {
@@ -68969,11 +69698,11 @@ function writeIntentDefinition(input, prefix) {
68969
69698
  lines.push("</plist>", "");
68970
69699
  return lines.join("\n");
68971
69700
  }
68972
- var import_strict3, import_node_crypto45, typeMetadata, initializeMetadata, widgetArraySizes, defaultReasonMessages;
69701
+ var import_strict4, import_node_crypto45, typeMetadata, initializeMetadata, widgetArraySizes, defaultReasonMessages;
68973
69702
  var init_metadata = __esm({
68974
69703
  "src/intent-definition/metadata.ts"() {
68975
69704
  "use strict";
68976
- import_strict3 = __toESM(require("node:assert/strict"), 1);
69705
+ import_strict4 = __toESM(require("node:assert/strict"), 1);
68977
69706
  import_node_crypto45 = require("node:crypto");
68978
69707
  init_fields();
68979
69708
  init_hash_input();
@@ -69044,175 +69773,34 @@ function safeNumber(value) {
69044
69773
  function xmlPlist2(bytes) {
69045
69774
  const encoding = bytes[0] === 255 && bytes[1] === 254 ? "utf-16le" : bytes[0] === 254 && bytes[1] === 255 ? "utf-16be" : "utf-8";
69046
69775
  const text7 = new TextDecoder(encoding, { fatal: true }).decode(bytes);
69047
- const document = new import_xmldom.DOMParser({
69048
- onError(_level, message) {
69049
- throw new Error(message);
69050
- }
69051
- }).parseFromString(text7, "application/xml");
69052
- const children = (element) => Array.from(element.children);
69053
- const contents2 = (element) => {
69054
- (0, import_strict4.default)(element.children.length === 0);
69055
- return element.textContent ?? "";
69056
- };
69057
- const visit3 = (element) => {
69058
- switch (element.tagName) {
69059
- case "dict": {
69060
- const entries2 = children(element);
69061
- (0, import_strict4.default)(entries2.length % 2 === 0);
69062
- const pairs2 = [];
69063
- for (let i = 0; i < entries2.length; i += 2) {
69064
- const key2 = entries2[i];
69065
- (0, import_strict4.default)(key2.tagName === "key");
69066
- pairs2.push([contents2(key2), visit3(entries2[i + 1])]);
69067
- }
69068
- return Object.fromEntries(pairs2);
69069
- }
69070
- case "array":
69071
- return children(element).map(visit3);
69072
- case "string":
69073
- return contents2(element);
69074
- case "integer": {
69075
- const value = contents2(element).trim();
69076
- (0, import_strict4.default)(value.length > 0);
69077
- return safeNumber(BigInt(value));
69078
- }
69079
- case "real": {
69080
- const value = contents2(element).trim();
69081
- (0, import_strict4.default)(value.length > 0);
69082
- return new IntentReal(
69083
- /^[+-]?inf(?:inity)?$/i.test(value) ? value.startsWith("-") ? -Infinity : Infinity : Number(value)
69084
- );
69085
- }
69086
- case "true":
69087
- return true;
69088
- case "false":
69089
- return false;
69090
- case "data":
69091
- return Buffer.from(contents2(element), "base64");
69092
- case "date":
69093
- return new Date(contents2(element));
69094
- default:
69095
- throw new Error(`unsupported plist element ${element.tagName}`);
69096
- }
69097
- };
69098
- const plist6 = document.documentElement;
69099
- (0, import_strict4.default)(plist6?.tagName === "plist" && plist6.children.length === 1);
69100
- return visit3(plist6.children[0]);
69101
- }
69102
- function binaryPlist2(bytes) {
69103
- (0, import_strict4.default)(bytes.length >= 40);
69104
- const trailer = bytes.length - 32;
69105
- const offsetWidth = bytes[trailer + 6];
69106
- const refWidth = bytes[trailer + 7];
69107
- (0, import_strict4.default)(offsetWidth > 0 && offsetWidth <= 8 && refWidth > 0 && refWidth <= 8);
69108
- const count = Number(bytes.readBigUInt64BE(trailer + 8));
69109
- const root = Number(bytes.readBigUInt64BE(trailer + 16));
69110
- const table = Number(bytes.readBigUInt64BE(trailer + 24));
69111
- (0, import_strict4.default)(
69112
- table >= 8 && table < trailer && count > 0 && count <= (trailer - table) / offsetWidth
69113
- );
69114
- const unsigned = (at, width) => {
69115
- (0, import_strict4.default)(at >= 8 && at + width <= trailer);
69116
- let result = 0n;
69117
- for (let i = at; i < at + width; i++) result = result * 256n + BigInt(bytes[i]);
69118
- return result;
69119
- };
69120
- const cache = /* @__PURE__ */ new Map();
69121
- const visiting = /* @__PURE__ */ new Set();
69122
- const visit3 = (ref) => {
69123
- (0, import_strict4.default)(ref >= 0 && ref < count && !visiting.has(ref));
69124
- if (cache.has(ref)) return cache.get(ref);
69125
- visiting.add(ref);
69126
- const at = Number(unsigned(table + ref * offsetWidth, offsetWidth));
69127
- (0, import_strict4.default)(at >= 8 && at < table);
69128
- const marker = bytes[at];
69129
- const type = marker >> 4;
69130
- let length = marker & 15;
69131
- let data = at + 1;
69132
- if (length === 15 && [4, 5, 6, 7, 10, 13].includes(type)) {
69133
- (0, import_strict4.default)(data < table && bytes[data] >> 4 === 1);
69134
- const width = 2 ** (bytes[data] & 15);
69135
- (0, import_strict4.default)(width <= 8 && data + 1 + width <= table);
69136
- length = Number(unsigned(data + 1, width));
69137
- data += 1 + width;
69138
- }
69139
- const end = (size2) => {
69140
- (0, import_strict4.default)(Number.isSafeInteger(size2) && data + size2 <= table);
69141
- return data + size2;
69142
- };
69143
- const references = (total) => {
69144
- end(total * refWidth);
69145
- return Array.from(
69146
- { length: total },
69147
- (_, i) => visit3(Number(unsigned(data + i * refWidth, refWidth)))
69776
+ return parseXmlPlist(text7, {
69777
+ strict: true,
69778
+ onInteger(raw2) {
69779
+ (0, import_strict5.default)(raw2.length > 0);
69780
+ return safeNumber(BigInt(raw2));
69781
+ },
69782
+ onReal(raw2) {
69783
+ (0, import_strict5.default)(raw2.length > 0);
69784
+ return new IntentReal(
69785
+ /^[+-]?inf(?:inity)?$/i.test(raw2) ? raw2.startsWith("-") ? -Infinity : Infinity : Number(raw2)
69148
69786
  );
69149
- };
69150
- let value;
69151
- switch (type) {
69152
- case 0:
69153
- (0, import_strict4.default)(marker === 8 || marker === 9);
69154
- value = marker === 9;
69155
- break;
69156
- case 1: {
69157
- const size2 = 2 ** length;
69158
- (0, import_strict4.default)(size2 <= 16);
69159
- end(size2);
69160
- const integer2 = unsigned(data, size2);
69161
- value = safeNumber(size2 >= 8 ? BigInt.asIntN(size2 * 8, integer2) : integer2);
69162
- break;
69163
- }
69164
- case 2:
69165
- (0, import_strict4.default)(length === 2 || length === 3);
69166
- end(2 ** length);
69167
- value = new IntentReal(
69168
- length === 2 ? bytes.readFloatBE(data) : bytes.readDoubleBE(data)
69169
- );
69170
- break;
69171
- case 3:
69172
- (0, import_strict4.default)(length === 3);
69173
- end(8);
69174
- value = new Date(Date.UTC(2001, 0, 1) + bytes.readDoubleBE(data) * 1e3);
69175
- break;
69176
- case 4:
69177
- value = bytes.subarray(data, end(length));
69178
- break;
69179
- case 5:
69180
- value = bytes.toString("ascii", data, end(length));
69181
- break;
69182
- case 6:
69183
- value = Buffer.from(bytes.subarray(data, end(length * 2))).swap16().toString("utf16le");
69184
- break;
69185
- case 7:
69186
- value = bytes.toString("utf8", data, end(length));
69187
- break;
69188
- case 10:
69189
- value = references(length);
69190
- break;
69191
- case 13: {
69192
- const elements = references(length * 2);
69193
- const keys = elements.slice(0, length);
69194
- (0, import_strict4.default)(keys.every((key2) => typeof key2 === "string"));
69195
- value = Object.fromEntries(keys.map((key2, i) => [key2, elements[length + i]]));
69196
- break;
69197
- }
69198
- default:
69199
- throw new Error(`unsupported binary plist type ${type}`);
69200
69787
  }
69201
- visiting.delete(ref);
69202
- cache.set(ref, value);
69203
- return value;
69204
- };
69205
- return visit3(root);
69788
+ });
69206
69789
  }
69207
69790
  function parseIntentPlist(bytes) {
69208
- return bytes.toString("ascii", 0, 8) === "bplist00" ? binaryPlist2(bytes) : xmlPlist2(bytes);
69791
+ return bytes.toString("ascii", 0, 8) === "bplist00" ? parseBinaryPlist(bytes, {
69792
+ strict: true,
69793
+ onInteger: safeNumber,
69794
+ onReal: (value) => new IntentReal(value)
69795
+ }) : xmlPlist2(bytes);
69209
69796
  }
69210
- var import_strict4, import_xmldom;
69797
+ var import_strict5;
69211
69798
  var init_plist_reader = __esm({
69212
69799
  "src/intent-definition/plist-reader.ts"() {
69213
69800
  "use strict";
69214
- import_strict4 = __toESM(require("node:assert/strict"), 1);
69215
- import_xmldom = require("peachsim/vendor/@xmldom/xmldom");
69801
+ import_strict5 = __toESM(require("node:assert/strict"), 1);
69802
+ init_plist();
69803
+ init_plist_bytes();
69216
69804
  init_hash_input();
69217
69805
  }
69218
69806
  });
@@ -69224,10 +69812,10 @@ function readIntentResponse(definition2, customTypes) {
69224
69812
  );
69225
69813
  const definitions = new Map(
69226
69814
  modelList(definition2, "INIntentResponseCodes").map((entry) => {
69227
- (0, import_strict5.default)(entry && typeof entry === "object");
69815
+ (0, import_strict6.default)(entry && typeof entry === "object");
69228
69816
  const name3 = identifier(Reflect.get(entry, "INIntentResponseCodeName"));
69229
69817
  const message = Reflect.get(entry, "INIntentResponseCodeFormatString");
69230
- (0, import_strict5.default)(message === void 0 || typeof message === "string");
69818
+ (0, import_strict6.default)(message === void 0 || typeof message === "string");
69231
69819
  const referenced = new Set(
69232
69820
  [
69233
69821
  ...String(message ?? "").matchAll(
@@ -69238,7 +69826,7 @@ function readIntentResponse(definition2, customTypes) {
69238
69826
  const names = [...referenced].sort();
69239
69827
  const parameters = names.map((name4) => {
69240
69828
  const field = fields.find((field2) => field2.name === name4);
69241
- (0, import_strict5.default)(field, "unknown intent response field " + name4);
69829
+ (0, import_strict6.default)(field, "unknown intent response field " + name4);
69242
69830
  return field;
69243
69831
  });
69244
69832
  return [
@@ -69290,11 +69878,11 @@ ${access} static func ${code}(${parameters.map((field) => `${field.name}: ${fiel
69290
69878
  }).join("\n")}
69291
69879
  }`;
69292
69880
  }
69293
- var import_strict5, responseCodes;
69881
+ var import_strict6, responseCodes;
69294
69882
  var init_response = __esm({
69295
69883
  "src/intent-definition/response.ts"() {
69296
69884
  "use strict";
69297
- import_strict5 = __toESM(require("node:assert/strict"), 1);
69885
+ import_strict6 = __toESM(require("node:assert/strict"), 1);
69298
69886
  init_fields();
69299
69887
  responseCodes = [
69300
69888
  "unspecified",
@@ -69312,7 +69900,7 @@ var init_response = __esm({
69312
69900
  function objcAvailability(swift) {
69313
69901
  if (!swift) return "";
69314
69902
  const version2 = /^@available\(iOS ([\d.]+), macOS ([\d.]+), watchOS ([\d.]+), \*\)$/.exec(swift);
69315
- (0, import_strict6.default)(version2);
69903
+ (0, import_strict7.default)(version2);
69316
69904
  return ` API_AVAILABLE(ios(${version2[1]}), macos(${version2[2]}), watchos(${version2[3]}))`;
69317
69905
  }
69318
69906
  function objcElement(field) {
@@ -69341,7 +69929,7 @@ function headerImports(fields, visibility, module2) {
69341
69929
  return [...imports2].join("\n");
69342
69930
  }
69343
69931
  function objcIntentSource(name3, prefix, definition2, customTypes, version2, visibility, module2) {
69344
- (0, import_strict6.default)(definition2 && typeof definition2 === "object");
69932
+ (0, import_strict7.default)(definition2 && typeof definition2 === "object");
69345
69933
  const klass = prefix + name3 + "Intent";
69346
69934
  const response = klass + "Response";
69347
69935
  const attr = hidden(visibility);
@@ -69380,7 +69968,7 @@ function objcIntentSource(name3, prefix, definition2, customTypes, version2, vis
69380
69968
  };
69381
69969
  const constructors = [...definitions].filter(([, definition3]) => definition3.parameters.length > 0).map(([code, { parameters: parameters2, availability }]) => {
69382
69970
  const [first, ...rest] = parameters2;
69383
- (0, import_strict6.default)(first);
69971
+ (0, import_strict7.default)(first);
69384
69972
  const selector = `${code}IntentResponseWith${upper(first.name)}:(${objcType(first)})${first.name}` + rest.map((field) => ` ${field.name}:(${objcType(field)})${field.name}`).join("");
69385
69973
  return {
69386
69974
  code,
@@ -69478,15 +70066,15 @@ ${reasons.map(
69478
70066
  return { header, implementation };
69479
70067
  }
69480
70068
  function objcEnumSource(definition2, label, prefix, visibility) {
69481
- (0, import_strict6.default)(definition2 && typeof definition2 === "object");
70069
+ (0, import_strict7.default)(definition2 && typeof definition2 === "object");
69482
70070
  const name3 = prefix + label;
69483
70071
  const attr = hidden(visibility);
69484
70072
  const bases = [attr, available].filter(Boolean).join(" ");
69485
70073
  const cases = modelList(definition2, "INEnumValues").map((entry) => {
69486
- (0, import_strict6.default)(entry && typeof entry === "object");
70074
+ (0, import_strict7.default)(entry && typeof entry === "object");
69487
70075
  const value = identifier(Reflect.get(entry, "INEnumValueName"));
69488
70076
  const index = Reflect.get(entry, "INEnumValueIndex") ?? 0;
69489
- (0, import_strict6.default)(typeof index === "number" && Number.isSafeInteger(index));
70077
+ (0, import_strict7.default)(typeof index === "number" && Number.isSafeInteger(index));
69490
70078
  return ` ${name3}${upper(value)} = ${index}`;
69491
70079
  });
69492
70080
  const success = `+ (instancetype)successWithResolved${label}:(${name3})resolvedValue`;
@@ -69570,11 +70158,11 @@ ${confirm} {
69570
70158
  `
69571
70159
  };
69572
70160
  }
69573
- var import_strict6, available, resolution, options, hiddenAttribute, hidden, headerStart, headerEnd, pointer, array6;
70161
+ var import_strict7, available, resolution, options, hiddenAttribute, hidden, headerStart, headerEnd, pointer, array6;
69574
70162
  var init_objective_c = __esm({
69575
70163
  "src/intent-definition/objective-c.ts"() {
69576
70164
  "use strict";
69577
- import_strict6 = __toESM(require("node:assert/strict"), 1);
70165
+ import_strict7 = __toESM(require("node:assert/strict"), 1);
69578
70166
  init_fields();
69579
70167
  init_response();
69580
70168
  available = "API_AVAILABLE(ios(12.0), macos(11.0), watchos(5.0)) API_UNAVAILABLE(tvos)";
@@ -69591,7 +70179,7 @@ var init_objective_c = __esm({
69591
70179
 
69592
70180
  // src/intent-definition/swift.ts
69593
70181
  function swiftIntentSource(name3, prefix, definition2, customTypes, version2, access) {
69594
- (0, import_strict7.default)(definition2 && typeof definition2 === "object");
70182
+ (0, import_strict8.default)(definition2 && typeof definition2 === "object");
69595
70183
  const klass = `${prefix}${name3}Intent`;
69596
70184
  const response = `${klass}Response`;
69597
70185
  const parameters = modelList(definition2, "INIntentParameters").map(
@@ -69692,11 +70280,11 @@ ${access} class func unsupported(forReason reason: ${base2}UnsupportedReason) ->
69692
70280
  #endif
69693
70281
  `;
69694
70282
  }
69695
- var import_strict7;
70283
+ var import_strict8;
69696
70284
  var init_swift = __esm({
69697
70285
  "src/intent-definition/swift.ts"() {
69698
70286
  "use strict";
69699
- import_strict7 = __toESM(require("node:assert/strict"), 1);
70287
+ import_strict8 = __toESM(require("node:assert/strict"), 1);
69700
70288
  init_fields();
69701
70289
  init_response();
69702
70290
  }
@@ -69704,17 +70292,17 @@ var init_swift = __esm({
69704
70292
 
69705
70293
  // src/intent-definition/source.ts
69706
70294
  function swiftEnumSource(definition2, visibility, prefix = "") {
69707
- (0, import_strict8.default)(definition2 && typeof definition2 === "object");
70295
+ (0, import_strict9.default)(definition2 && typeof definition2 === "object");
69708
70296
  const unprefixed = identifier(Reflect.get(definition2, "INEnumName"));
69709
70297
  const name3 = prefix + unprefixed;
69710
70298
  const values = Reflect.get(definition2, "INEnumValues");
69711
- (0, import_strict8.default)(Array.isArray(values));
70299
+ (0, import_strict9.default)(Array.isArray(values));
69712
70300
  const access = visibility === "project" ? "internal" : "public";
69713
70301
  const cases = values.map((entry) => {
69714
- (0, import_strict8.default)(entry && typeof entry === "object");
70302
+ (0, import_strict9.default)(entry && typeof entry === "object");
69715
70303
  const name4 = identifier(Reflect.get(entry, "INEnumValueName"));
69716
70304
  const index = Reflect.get(entry, "INEnumValueIndex") ?? 0;
69717
- (0, import_strict8.default)(typeof index === "number" && Number.isSafeInteger(index));
70305
+ (0, import_strict9.default)(typeof index === "number" && Number.isSafeInteger(index));
69718
70306
  return ` case \`${name4}\` = ${index}`;
69719
70307
  });
69720
70308
  return `#if canImport(Intents)
@@ -69739,7 +70327,7 @@ ${access} class ${name3}ResolutionResult: INEnumResolutionResult {
69739
70327
  `;
69740
70328
  }
69741
70329
  function emitIntentSource(definition2, prefix, visibility, language, module2) {
69742
- (0, import_strict8.default)(definition2 && typeof definition2 === "object");
70330
+ (0, import_strict9.default)(definition2 && typeof definition2 === "object");
69743
70331
  const intents = modelList(definition2, "INIntents");
69744
70332
  const types2 = modelList(definition2, "INTypes");
69745
70333
  const enums = modelList(definition2, "INEnums");
@@ -69749,7 +70337,7 @@ function emitIntentSource(definition2, prefix, visibility, language, module2) {
69749
70337
  intentModelVersion(Reflect.get(definition2, "INIntentDefinitionModelVersion"))
69750
70338
  );
69751
70339
  const nameOf = (entry, key2) => {
69752
- (0, import_strict8.default)(entry && typeof entry === "object");
70340
+ (0, import_strict9.default)(entry && typeof entry === "object");
69753
70341
  return identifier(Reflect.get(entry, key2));
69754
70342
  };
69755
70343
  const typeNames = types2.map((type) => nameOf(type, "INTypeName"));
@@ -69789,7 +70377,7 @@ function emitIntentSource(definition2, prefix, visibility, language, module2) {
69789
70377
  });
69790
70378
  }
69791
70379
  for (const intent of intents) {
69792
- (0, import_strict8.default)(intent && typeof intent === "object");
70380
+ (0, import_strict9.default)(intent && typeof intent === "object");
69793
70381
  if (Reflect.get(intent, "INIntentType") === "System") continue;
69794
70382
  const name3 = identifier(Reflect.get(intent, "INIntentName"));
69795
70383
  const filename = `${prefix}${name3}Intent`;
@@ -69806,11 +70394,11 @@ function emitIntentSource(definition2, prefix, visibility, language, module2) {
69806
70394
  }
69807
70395
  return output;
69808
70396
  }
69809
- var import_strict8;
70397
+ var import_strict9;
69810
70398
  var init_source = __esm({
69811
70399
  "src/intent-definition/source.ts"() {
69812
70400
  "use strict";
69813
- import_strict8 = __toESM(require("node:assert/strict"), 1);
70401
+ import_strict9 = __toESM(require("node:assert/strict"), 1);
69814
70402
  init_fields();
69815
70403
  init_objective_c();
69816
70404
  init_swift();
@@ -70642,7 +71230,7 @@ function expandValue(value, settings) {
70642
71230
  return value;
70643
71231
  }
70644
71232
  function processedInfoPlist(name3, file, settings, settingKeys) {
70645
- const source = file ? import_plist4.default.parse(import_node_fs78.default.readFileSync(file, "utf8")) : {};
71233
+ const source = file ? parsePlist(import_node_fs78.default.readFileSync(file, "utf8")) : {};
70646
71234
  if (!source || typeof source !== "object" || Array.isArray(source) || source instanceof Date || Buffer.isBuffer(source))
70647
71235
  throw new Error(`${name3} Info.plist must contain a dictionary`);
70648
71236
  const info = {};
@@ -71216,7 +71804,7 @@ ${output}`
71216
71804
  );
71217
71805
  let launchName = settings("INFOPLIST_KEY_UILaunchStoryboardName");
71218
71806
  if (process.platform !== "darwin" && !launchName && infoPlistOutput && import_node_fs78.default.existsSync(infoPlistOutput)) {
71219
- const info = import_plist4.default.parse(import_node_fs78.default.readFileSync(infoPlistOutput, "utf8"));
71807
+ const info = parsePlist(import_node_fs78.default.readFileSync(infoPlistOutput, "utf8"));
71220
71808
  const declared = isRecord(info) ? info.UILaunchStoryboardName : void 0;
71221
71809
  if (typeof declared === "string") launchName = expand(declared, settings);
71222
71810
  }
@@ -72248,7 +72836,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
72248
72836
  }
72249
72837
  return {
72250
72838
  ref,
72251
- framework: Object.assign(module3, { frameworkInfoPlist: import_plist4.default.build(info2) })
72839
+ framework: Object.assign(module3, { frameworkInfoPlist: buildPlist(info2) })
72252
72840
  };
72253
72841
  });
72254
72842
  const frameworks = frameworkTargets.map(({ framework }) => framework);
@@ -72315,9 +72903,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
72315
72903
  path: bundlePath,
72316
72904
  ...product ? {
72317
72905
  resources: product.module.resources,
72318
- infoPlist: import_plist4.default.build(
72906
+ infoPlist: buildPlist(
72319
72907
  expandValue(
72320
- import_plist4.default.parse(import_node_fs78.default.readFileSync(infoFile, "utf8")),
72908
+ parsePlist(import_node_fs78.default.readFileSync(infoFile, "utf8")),
72321
72909
  product.productSettings
72322
72910
  )
72323
72911
  )
@@ -72339,7 +72927,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
72339
72927
  settingKeys
72340
72928
  );
72341
72929
  const bundleIdentifier = productSettings("PRODUCT_BUNDLE_IDENTIFIER") || (typeof info.CFBundleIdentifier === "string" ? info.CFBundleIdentifier : "");
72342
- const entitlements = entitlementsFile ? import_plist4.default.parse(import_node_fs78.default.readFileSync(entitlementsFile, "utf8")) : void 0;
72930
+ const entitlements = entitlementsFile ? parsePlist(import_node_fs78.default.readFileSync(entitlementsFile, "utf8")) : void 0;
72343
72931
  const keychainAccessGroups = entitlementsFile ? readKeychainAccessGroups(
72344
72932
  entitlements,
72345
72933
  (value) => expand(value, (key2) => {
@@ -72685,7 +73273,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
72685
73273
  ].sort(),
72686
73274
  projectDirs: [...new Set(used.map((project2) => project2.projectDir))].sort(),
72687
73275
  appIconName: settings("ASSETCATALOG_COMPILER_APPICON_NAME"),
72688
- infoPlist: infoPlistPending ? null : import_plist4.default.build(info),
73276
+ infoPlist: infoPlistPending ? null : buildPlist(info),
72689
73277
  infoPlistFile,
72690
73278
  ...keychainAccessGroups === void 0 ? {} : { keychainAccessGroups },
72691
73279
  siriEntitled: readSiriEntitlement(entitlements),
@@ -72708,7 +73296,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
72708
73296
  cocoapods
72709
73297
  };
72710
73298
  }
72711
- var import_node_child_process40, import_node_crypto47, import_node_fs78, import_node_module5, import_node_path79, import_plist4, XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET, runScriptTimeoutMs, CXX_STANDARD_ALIASES, PRE_CXX20_STANDARDS, APPLICATION, APP_EXTENSION, RESOURCE_BUNDLE, PRODUCT_MACH_O_TYPES, FRAMEWORK_PRODUCTS, HEADER_FILE, MODULE_PRODUCTS, CONDITIONS, isDirectory3, loaded3, developerDir, preparedSourcePhases, isPodsProject, targetRefs, NativeAppTargetSelectionError, workspaceResolvedFile, SwiftPackageResolutionRequired;
73299
+ var import_node_child_process40, import_node_crypto47, import_node_fs78, import_node_module5, import_node_path79, XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET, runScriptTimeoutMs, CXX_STANDARD_ALIASES, PRE_CXX20_STANDARDS, APPLICATION, APP_EXTENSION, RESOURCE_BUNDLE, PRODUCT_MACH_O_TYPES, FRAMEWORK_PRODUCTS, HEADER_FILE, MODULE_PRODUCTS, CONDITIONS, isDirectory3, loaded3, developerDir, preparedSourcePhases, isPodsProject, targetRefs, NativeAppTargetSelectionError, workspaceResolvedFile, SwiftPackageResolutionRequired;
72712
73300
  var init_xcode_project = __esm({
72713
73301
  "src/xcode-project.ts"() {
72714
73302
  "use strict";
@@ -72717,11 +73305,11 @@ var init_xcode_project = __esm({
72717
73305
  import_node_fs78 = __toESM(require("node:fs"), 1);
72718
73306
  import_node_module5 = require("node:module");
72719
73307
  import_node_path79 = __toESM(require("node:path"), 1);
72720
- import_plist4 = __toESM(require("peachsim/vendor/plist"), 1);
72721
73308
  init_bazel_project();
72722
73309
  init_ios_sdk_frameworks();
72723
73310
  init_is_record();
72724
73311
  init_native_app_identity();
73312
+ init_plist();
72725
73313
  init_pod_graph_specifications();
72726
73314
  init_swift_binary_modules();
72727
73315
  init_xcode_assets();
@@ -82059,7 +82647,7 @@ function compileCatalogTables(source, name3) {
82059
82647
  }
82060
82648
  return output;
82061
82649
  }
82062
- function plist4(value, depth) {
82650
+ function plist(value, depth) {
82063
82651
  const indent2 = " ".repeat(depth);
82064
82652
  const escaped = (text7) => text7.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
82065
82653
  if (typeof value === "string") return `${indent2}<string>${escaped(value)}</string>
@@ -82070,7 +82658,7 @@ function plist4(value, depth) {
82070
82658
  return `${indent2}<dict>
82071
82659
  ` + keys.map(
82072
82660
  (key2) => `${indent2} <key>${escaped(key2)}</key>
82073
- ` + plist4(value[key2] ?? "", depth + 1)
82661
+ ` + plist(value[key2] ?? "", depth + 1)
82074
82662
  ).join("") + `${indent2}</dict>
82075
82663
  `;
82076
82664
  }
@@ -82078,7 +82666,7 @@ function compileStringCatalog(source, name3) {
82078
82666
  return Object.fromEntries(
82079
82667
  Object.entries(compileCatalogTables(source, name3)).map(([path139, table]) => [
82080
82668
  path139,
82081
- '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n' + plist4(table, 0) + "</plist>\n"
82669
+ '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n' + plist(table, 0) + "</plist>\n"
82082
82670
  ])
82083
82671
  );
82084
82672
  }
@@ -85007,7 +85595,7 @@ var require_packer_async = __commonJS({
85007
85595
  var require_sync_inflate = __commonJS({
85008
85596
  "../../node_modules/pngjs/lib/sync-inflate.js"(exports2, module2) {
85009
85597
  "use strict";
85010
- var assert9 = require("assert").ok;
85598
+ var assert10 = require("assert").ok;
85011
85599
  var zlib4 = require("zlib");
85012
85600
  var util = require("util");
85013
85601
  var kMaxLength = require("buffer").kMaxLength;
@@ -85058,7 +85646,7 @@ var require_sync_inflate = __commonJS({
85058
85646
  return;
85059
85647
  }
85060
85648
  let have = availOutBefore - availOutAfter;
85061
- assert9(have >= 0, "have should not go down");
85649
+ assert10(have >= 0, "have should not go down");
85062
85650
  if (have > 0) {
85063
85651
  let out = self._buffer.slice(self._offset, self._offset + have);
85064
85652
  self._offset += have;
@@ -85084,7 +85672,7 @@ var require_sync_inflate = __commonJS({
85084
85672
  }
85085
85673
  return false;
85086
85674
  }
85087
- assert9(this._handle, "zlib binding closed");
85675
+ assert10(this._handle, "zlib binding closed");
85088
85676
  let res;
85089
85677
  do {
85090
85678
  res = this._handle.writeSync(
@@ -86879,7 +87467,7 @@ var init_swift_standin_digest = __esm({
86879
87467
  STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
86880
87468
  SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
86881
87469
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
86882
- STANDIN_SOURCE_DIGEST = true ? "cb9d3dbcce3fdc3dbbec1990247cf5b2a1f9fd7cd32791740e313792bd8bcfcc" : standinSourceDigest();
87470
+ STANDIN_SOURCE_DIGEST = true ? "fde0b0b7ddf441a32e71680bc17ba12f69f2cbaed1a0a024505e7f4a5394772d" : standinSourceDigest();
86883
87471
  }
86884
87472
  });
86885
87473
 
@@ -103341,7 +103929,7 @@ var init_nitro_superset = __esm({
103341
103929
  init_nitroContract();
103342
103930
  init_swift_standin_digest();
103343
103931
  NITRO_SUPERSET_ENTRY_NAME = "superset";
103344
- NITRO_COMPILER_DIGEST = true ? "228003f16f1b081fea0ab10bb0ba40a8192beee02eb15e1a3363090ee53f71ef" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
103932
+ NITRO_COMPILER_DIGEST = true ? "74b5613216c94c9a712253659e2803b31d4fe1a7f0ff32f2ad7d3fa7ef57f2ab" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
103345
103933
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
103346
103934
  nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
103347
103935
  published = /* @__PURE__ */ new Map();
@@ -104209,7 +104797,7 @@ var init_expo_eager_seam_contract = __esm({
104209
104797
 
104210
104798
  // src/expo-native-compiler-digest.ts
104211
104799
  function expoNativeCompilerDigestValue() {
104212
- return true ? "6aedf26bc25b6a36f195ca561d0ac7cf616934f0decbe54a770edcae5bda1407" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
104800
+ return true ? "0eb8b57c26c74de660f5dc029f1ae0ffa0af503b67afa64e2c93b02b517a2e68" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
104213
104801
  }
104214
104802
  var import_node_crypto78;
104215
104803
  var init_expo_native_compiler_digest = __esm({
@@ -104892,14 +105480,14 @@ function isPlistValue(value) {
104892
105480
  return isRecord(value) && Object.values(value).every(isPlistValue);
104893
105481
  }
104894
105482
  function parsePlistDictionary(source) {
104895
- const parsed2 = import_plist9.default.parse(source);
105483
+ const parsed2 = parsePlist(source);
104896
105484
  if (typeof parsed2 !== "object" || isPlistArray(parsed2) || parsed2 instanceof Date || Buffer.isBuffer(parsed2))
104897
105485
  throw new Error("Info.plist is not a dictionary");
104898
105486
  return parsed2;
104899
105487
  }
104900
105488
  function installedInfoPlist(prebuilt, additions) {
104901
105489
  const merged = { ...parsePlistDictionary(prebuilt), ...additions };
104902
- return import_plist9.default.build(
105490
+ return buildPlist(
104903
105491
  Object.fromEntries(
104904
105492
  Object.keys(merged).sort().map((key2) => [key2, merged[key2]])
104905
105493
  )
@@ -105007,7 +105595,7 @@ async function prebuiltExpoSwiftResult(appRoot, entry, signal) {
105007
105595
  await prebuiltAppTarget(appRoot, signal, "installed")
105008
105596
  );
105009
105597
  }
105010
- var import_node_crypto80, import_node_fs130, import_node_module18, import_node_path132, import_node_util16, import_plist9, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published2, lookups, answers;
105598
+ var import_node_crypto80, import_node_fs130, import_node_module18, import_node_path132, import_node_util16, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published2, lookups, answers;
105011
105599
  var init_expo_native_prebuilt = __esm({
105012
105600
  "src/expo-native-prebuilt.ts"() {
105013
105601
  "use strict";
@@ -105016,7 +105604,6 @@ var init_expo_native_prebuilt = __esm({
105016
105604
  import_node_module18 = require("node:module");
105017
105605
  import_node_path132 = __toESM(require("node:path"), 1);
105018
105606
  import_node_util16 = require("node:util");
105019
- import_plist9 = __toESM(require("peachsim/vendor/plist"), 1);
105020
105607
  init_answeredNativePackages();
105021
105608
  init_expo_native_compiler_digest();
105022
105609
  init_expo_native_workspace();
@@ -105027,6 +105614,7 @@ var init_expo_native_prebuilt = __esm({
105027
105614
  init_native_prebuilt();
105028
105615
  init_nitroContract();
105029
105616
  init_package_tree_digest();
105617
+ init_plist();
105030
105618
  init_swift_native_pin();
105031
105619
  init_xcode_project();
105032
105620
  EXPO_NATIVE_ENTRY_NAME = "ios";