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;
@@ -8900,7 +8900,8 @@ function swiftCompilerRelease(release) {
8900
8900
  }
8901
8901
  function swiftToolchainBin(release) {
8902
8902
  if (process.platform === "darwin") {
8903
- const dirs = [import_node_os6.default.homedir(), "/"].map(
8903
+ const bases = [.../* @__PURE__ */ new Set([import_node_os6.default.homedir(), import_node_path14.default.dirname(peachHome()), "/"])];
8904
+ const dirs = bases.map(
8904
8905
  (base) => import_node_path14.default.join(base, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`)
8905
8906
  );
8906
8907
  const found = dirs.find((dir) => import_node_fs17.default.existsSync(import_node_path14.default.join(dir, "swift")));
@@ -17979,13 +17980,13 @@ var init_swift_standin_digest = __esm({
17979
17980
  STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
17980
17981
  SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
17981
17982
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
17982
- STANDIN_SOURCE_DIGEST = true ? "cb9d3dbcce3fdc3dbbec1990247cf5b2a1f9fd7cd32791740e313792bd8bcfcc" : standinSourceDigest();
17983
+ STANDIN_SOURCE_DIGEST = true ? "fde0b0b7ddf441a32e71680bc17ba12f69f2cbaed1a0a024505e7f4a5394772d" : standinSourceDigest();
17983
17984
  }
17984
17985
  });
17985
17986
 
17986
17987
  // src/expo-native-compiler-digest.ts
17987
17988
  function expoNativeCompilerDigestValue() {
17988
- return true ? "6aedf26bc25b6a36f195ca561d0ac7cf616934f0decbe54a770edcae5bda1407" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
17989
+ return true ? "0eb8b57c26c74de660f5dc029f1ae0ffa0af503b67afa64e2c93b02b517a2e68" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
17989
17990
  }
17990
17991
  var import_node_crypto17;
17991
17992
  var init_expo_native_compiler_digest = __esm({
@@ -18041,6 +18042,160 @@ var init_admitted_mac_build = __esm({
18041
18042
  }
18042
18043
  });
18043
18044
 
18045
+ // src/gitignore.ts
18046
+ function stripTrailingSpaces(line) {
18047
+ let end = line.length;
18048
+ while (end > 0 && line[end - 1] === " ") {
18049
+ let slashes = 0;
18050
+ for (let i = end - 2; i >= 0 && line[i] === "\\"; i--) slashes++;
18051
+ if (slashes % 2 === 1) break;
18052
+ end--;
18053
+ }
18054
+ return line.slice(0, end);
18055
+ }
18056
+ function globToRegexSource(pattern) {
18057
+ let out = "";
18058
+ let i = 0;
18059
+ while (i < pattern.length) {
18060
+ const ch = pattern[i];
18061
+ if (ch === "\\" && i + 1 < pattern.length) {
18062
+ out += pattern[i + 1].replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
18063
+ i += 2;
18064
+ continue;
18065
+ }
18066
+ if (ch === "*") {
18067
+ if (pattern[i + 1] === "*") {
18068
+ const prevIsSlashOrStart = i === 0 || pattern[i - 1] === "/";
18069
+ const nextIsSlash = pattern[i + 2] === "/";
18070
+ const nextIsEnd = i + 2 === pattern.length;
18071
+ if (prevIsSlashOrStart && nextIsSlash) {
18072
+ out += "(?:.+/)?";
18073
+ i += 3;
18074
+ continue;
18075
+ }
18076
+ if (prevIsSlashOrStart && nextIsEnd) {
18077
+ out += ".*";
18078
+ i += 2;
18079
+ continue;
18080
+ }
18081
+ out += ".*";
18082
+ i += 2;
18083
+ continue;
18084
+ }
18085
+ out += "[^/]*";
18086
+ i++;
18087
+ continue;
18088
+ }
18089
+ if (ch === "?") {
18090
+ out += "[^/]";
18091
+ i++;
18092
+ continue;
18093
+ }
18094
+ if (ch === "[") {
18095
+ let j = i + 1;
18096
+ if (j < pattern.length && (pattern[j] === "!" || pattern[j] === "^")) j++;
18097
+ if (j < pattern.length && pattern[j] === "]") j++;
18098
+ while (j < pattern.length && pattern[j] !== "]") {
18099
+ if (pattern[j] === "\\" && j + 1 < pattern.length) j += 2;
18100
+ else j++;
18101
+ }
18102
+ if (j < pattern.length) {
18103
+ let body = pattern.slice(i + 1, j);
18104
+ if (body.startsWith("!")) body = `^${body.slice(1)}`;
18105
+ out += `[${body}]`;
18106
+ i = j + 1;
18107
+ continue;
18108
+ }
18109
+ }
18110
+ out += ch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
18111
+ i++;
18112
+ }
18113
+ return out;
18114
+ }
18115
+ function compileRule(rawLine) {
18116
+ const withoutCr = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
18117
+ const trimmed = stripTrailingSpaces(withoutCr);
18118
+ if (!trimmed || trimmed.startsWith("#")) return null;
18119
+ let negative = false;
18120
+ let pattern = trimmed;
18121
+ if (pattern.startsWith("!")) {
18122
+ negative = true;
18123
+ pattern = pattern.slice(1);
18124
+ }
18125
+ if (!pattern) return null;
18126
+ const directoryOnly = pattern.endsWith("/");
18127
+ if (directoryOnly) {
18128
+ pattern = pattern.slice(0, -1);
18129
+ if (!pattern) return null;
18130
+ }
18131
+ const anchored = pattern.includes("/");
18132
+ if (pattern.startsWith("/")) {
18133
+ pattern = pattern.slice(1);
18134
+ }
18135
+ const body = globToRegexSource(pattern);
18136
+ const prefix = anchored ? "^" : "(?:^|/)";
18137
+ const regex2 = new RegExp(`${prefix}${body}$`, "i");
18138
+ return { negative, directoryOnly, regex: regex2 };
18139
+ }
18140
+ function normalizePath(input) {
18141
+ const isDirectory5 = input.endsWith("/");
18142
+ let normalized = isDirectory5 ? input.slice(0, -1) : input;
18143
+ if (normalized.startsWith("./")) normalized = normalized.slice(2);
18144
+ return { path: normalized, isDirectory: isDirectory5 };
18145
+ }
18146
+ function createGitignoreMatcher() {
18147
+ const rules2 = [];
18148
+ const matchSingle = (candidate, isDirectory5) => {
18149
+ let ignored = false;
18150
+ let unignored = false;
18151
+ for (const rule of rules2) {
18152
+ if (rule.directoryOnly && !isDirectory5) continue;
18153
+ if (!rule.regex.test(candidate)) continue;
18154
+ if (rule.negative) {
18155
+ ignored = false;
18156
+ unignored = true;
18157
+ } else {
18158
+ ignored = true;
18159
+ unignored = false;
18160
+ }
18161
+ }
18162
+ return { ignored, unignored };
18163
+ };
18164
+ const matcher = {
18165
+ add(patterns) {
18166
+ const list2 = typeof patterns === "string" ? patterns.split("\n") : patterns;
18167
+ for (const entry of list2) {
18168
+ for (const line of entry.split("\n")) {
18169
+ const compiled = compileRule(line);
18170
+ if (compiled) rules2.push(compiled);
18171
+ }
18172
+ }
18173
+ return matcher;
18174
+ },
18175
+ test(relativePath2) {
18176
+ const { path: path116, isDirectory: isDirectory5 } = normalizePath(relativePath2);
18177
+ if (!path116) return { ignored: false, unignored: false };
18178
+ const parts = path116.split("/");
18179
+ let prefix = "";
18180
+ for (let i = 0; i < parts.length - 1; i++) {
18181
+ prefix = prefix ? `${prefix}/${parts[i]}` : parts[i];
18182
+ const parent = matchSingle(prefix, true);
18183
+ if (parent.ignored) return { ignored: true, unignored: false };
18184
+ }
18185
+ return matchSingle(path116, isDirectory5);
18186
+ },
18187
+ ignores(relativePath2) {
18188
+ return matcher.test(relativePath2).ignored;
18189
+ }
18190
+ };
18191
+ return matcher;
18192
+ }
18193
+ var init_gitignore = __esm({
18194
+ "src/gitignore.ts"() {
18195
+ "use strict";
18196
+ }
18197
+ });
18198
+
18044
18199
  // src/expo-workspace-exclusion.ts
18045
18200
  async function workspaceExclusion(root, portable = false, linkedPackages = []) {
18046
18201
  const listed = await (0, import_node_util4.promisify)(import_node_child_process15.execFile)(
@@ -18110,7 +18265,7 @@ function gitignoreRules(root) {
18110
18265
  let rules2 = ignoreFiles.get(directory2);
18111
18266
  if (rules2 === void 0) {
18112
18267
  const file = import_node_path32.default.join(root, directory2, ".gitignore");
18113
- rules2 = import_node_fs33.default.existsSync(file) ? (0, import_ignore.default)().add(import_node_fs33.default.readFileSync(file, "utf8")) : null;
18268
+ rules2 = import_node_fs33.default.existsSync(file) ? createGitignoreMatcher().add(import_node_fs33.default.readFileSync(file, "utf8")) : null;
18114
18269
  ignoreFiles.set(directory2, rules2);
18115
18270
  }
18116
18271
  if (!rules2) continue;
@@ -18122,7 +18277,7 @@ function gitignoreRules(root) {
18122
18277
  return excluded;
18123
18278
  };
18124
18279
  }
18125
- var import_node_child_process15, import_node_fs33, import_node_path32, import_node_util4, import_ignore, gitEnvironment;
18280
+ var import_node_child_process15, import_node_fs33, import_node_path32, import_node_util4, gitEnvironment;
18126
18281
  var init_expo_workspace_exclusion = __esm({
18127
18282
  "src/expo-workspace-exclusion.ts"() {
18128
18283
  "use strict";
@@ -18130,7 +18285,7 @@ var init_expo_workspace_exclusion = __esm({
18130
18285
  import_node_fs33 = __toESM(require("node:fs"), 1);
18131
18286
  import_node_path32 = __toESM(require("node:path"), 1);
18132
18287
  import_node_util4 = require("node:util");
18133
- import_ignore = __toESM(require("peachsim/vendor/ignore"), 1);
18288
+ init_gitignore();
18134
18289
  gitEnvironment = () => ({
18135
18290
  ...process.env,
18136
18291
  GIT_CONFIG_GLOBAL: "/dev/null",
@@ -20987,24 +21142,37 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
20987
21142
  async function withSwiftCompileBudget(compileTimeoutMs, signal, work) {
20988
21143
  const deadline = new AbortController();
20989
21144
  const combined = signal ? AbortSignal.any([signal, deadline.signal]) : deadline.signal;
21145
+ const stallMs = compileTimeoutMs ?? SWIFT_COMPILE_TIMEOUT_MS;
21146
+ let compiling = false;
20990
21147
  let timer = setTimeout(
20991
21148
  () => deadline.abort(new Error("Swift build lock wait timed out")),
20992
21149
  SWIFT_LOCK_WAIT_TIMEOUT_MS
20993
21150
  );
21151
+ const restart = () => {
21152
+ clearTimeout(timer);
21153
+ timer = setTimeout(
21154
+ () => deadline.abort(
21155
+ new Error(
21156
+ `Swift compilation made no progress for ${Math.round(stallMs / 1e3)}s`
21157
+ )
21158
+ ),
21159
+ stallMs
21160
+ );
21161
+ };
20994
21162
  try {
20995
21163
  combined.throwIfAborted();
20996
21164
  const result = await work({
20997
21165
  signal: combined,
20998
21166
  startCompile() {
20999
21167
  combined.throwIfAborted();
21000
- clearTimeout(timer);
21001
- timer = setTimeout(
21002
- () => deadline.abort(new Error("Swift compilation timed out")),
21003
- compileTimeoutMs ?? SWIFT_COMPILE_TIMEOUT_MS
21004
- );
21168
+ compiling = true;
21169
+ restart();
21170
+ },
21171
+ progress() {
21172
+ if (compiling && !deadline.signal.aborted) restart();
21005
21173
  }
21006
21174
  });
21007
- combined.throwIfAborted();
21175
+ signal?.throwIfAborted();
21008
21176
  return result;
21009
21177
  } finally {
21010
21178
  clearTimeout(timer);
@@ -38447,6 +38615,7 @@ async function compileGuestLink(options2) {
38447
38615
  );
38448
38616
  continue;
38449
38617
  }
38618
+ options2.onStage("lowering the app image");
38450
38619
  const lowerPromise = link.lower();
38451
38620
  await new Promise((resolve3) => setImmediate(resolve3));
38452
38621
  let binding;
@@ -38477,6 +38646,7 @@ async function compileGuestLink(options2) {
38477
38646
  return binding;
38478
38647
  }
38479
38648
  }
38649
+ options2.onStage("lowering the app image");
38480
38650
  await lowerWasm(options2.output, options2.optimized, {
38481
38651
  optimize: options2.optimize,
38482
38652
  skipPasses: ["duplicate-function-elimination"],
@@ -39912,8 +40082,18 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
39912
40082
  void stopping.catch(() => {
39913
40083
  });
39914
40084
  };
40085
+ const restartTimeout = () => {
40086
+ if (!options2.timeout) return;
40087
+ clearTimeout(timeout);
40088
+ timeout = setTimeout(() => {
40089
+ failure2 = new Error(`Swift compiler was silent for ${options2.timeout}ms`);
40090
+ stop();
40091
+ }, options2.timeout);
40092
+ };
39915
40093
  for (const name3 of ["stdout", "stderr"]) {
39916
40094
  child[name3].on("data", (bytes) => {
40095
+ restartTimeout();
40096
+ options2.onOutput?.();
39917
40097
  if (stream === true) process[name3].write(bytes);
39918
40098
  else if (stream) {
39919
40099
  const lines = (partial[name3] + bytes.toString()).split("\n");
@@ -39962,11 +40142,7 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
39962
40142
  resolve3(Buffer.concat(chunks.stdout).toString());
39963
40143
  }
39964
40144
  });
39965
- if (options2.timeout)
39966
- timeout = setTimeout(() => {
39967
- failure2 = new Error("Swift compiler timed out");
39968
- stop();
39969
- }, options2.timeout);
40145
+ restartTimeout();
39970
40146
  if (signal?.aborted) stop();
39971
40147
  });
39972
40148
  } finally {
@@ -42583,7 +42759,6 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
42583
42759
  (left, right) => right.path.length - left.path.length
42584
42760
  );
42585
42761
  const targetsByDir = indexTargetsByDirectory(bySourcePath);
42586
- const targetByName = new Map(targets.map((target) => [target.name, target]));
42587
42762
  const nativeTargets2 = input.nativeTargets ?? [];
42588
42763
  const nativeTargetByName = new Map(nativeTargets2.map((target) => [target.name, target]));
42589
42764
  const nativeTargetIndex = new Map(
@@ -42659,7 +42834,6 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
42659
42834
  checkedToolchain = swiftToolchain(pin2.release, swiftModuleSdk(moduleRoot));
42660
42835
  return checkedToolchain;
42661
42836
  };
42662
- const deploymentTarget = (name3) => nativeTargetByName.get(name3)?.deploymentTarget ?? targetByName.get(name3)?.iosDeploymentTarget ?? null;
42663
42837
  const targetStagedFiles = /* @__PURE__ */ new Map();
42664
42838
  const stageTargetFile = (target, file, contents2, options2) => {
42665
42839
  const relative3 = import_node_path68.default.relative(layout2.root, file).split(import_node_path68.default.sep).join(import_node_path68.default.posix.sep);
@@ -43734,7 +43908,7 @@ ${entry}`);
43734
43908
  };
43735
43909
  for (const target of targets) {
43736
43910
  if (!target.executable && !reachesNative(target.name)) continue;
43737
- const version2 = deploymentTarget(target.name);
43911
+ const version2 = nativeTargetByName.get(target.name)?.deploymentTarget ?? target.iosDeploymentTarget ?? null;
43738
43912
  const minimum = iosDeploymentMinimum(version2);
43739
43913
  if (minimum === void 0)
43740
43914
  throw new Error(
@@ -44846,24 +45020,18 @@ function readFrameworkProductsReceipt(scratch2, receiptKey) {
44846
45020
  } catch {
44847
45021
  return null;
44848
45022
  }
44849
- const archive = import_node_path68.default.join(scratch2, "lib");
44850
- const archiveStamp = import_node_path68.default.join(archive, ".receipt");
44851
- const archiveMatches = (0, import_node_fs68.existsSync)(archiveStamp) && (0, import_node_fs68.readFileSync)(archiveStamp, "utf8") === receiptKey;
45023
+ const archiveRoot = import_node_path68.default.join(scratch2, "products-lib", receiptKey);
45024
+ if (parsed2.root !== archiveRoot) return null;
44852
45025
  if (!(0, import_node_fs68.existsSync)(parsed2.modules)) return null;
44853
- for (const [object8] of parsed2.archived) if (!(0, import_node_fs68.existsSync)(object8)) return null;
45026
+ for (const [object8, rel] of parsed2.archived) {
45027
+ if (!(0, import_node_fs68.existsSync)(object8) || !(0, import_node_fs68.existsSync)(import_node_path68.default.join(archiveRoot, rel))) return null;
45028
+ }
44854
45029
  for (const file of parsed2.providers) if (!(0, import_node_fs68.existsSync)(file)) return null;
44855
45030
  for (const file of parsed2.moduleMaps) if (!(0, import_node_fs68.existsSync)(file)) return null;
44856
- if (!archiveMatches) {
44857
- (0, import_node_fs68.rmSync)(archive, { recursive: true, force: true });
44858
- (0, import_node_fs68.mkdirSync)(archive, { recursive: true });
44859
- for (const [object8, rel] of parsed2.archived)
44860
- (0, import_node_fs68.symlinkSync)(object8, import_node_path68.default.join(scratch2, rel));
44861
- (0, import_node_fs68.writeFileSync)(archiveStamp, receiptKey);
44862
- }
44863
45031
  for (const file of parsed2.objects) if (!(0, import_node_fs68.existsSync)(file)) return null;
44864
45032
  for (const file of parsed2.lazyObjects) if (!(0, import_node_fs68.existsSync)(file)) return null;
44865
45033
  return {
44866
- root: scratch2,
45034
+ root: parsed2.root,
44867
45035
  modules: parsed2.modules,
44868
45036
  objects: parsed2.objects,
44869
45037
  lazyObjects: parsed2.lazyObjects,
@@ -44881,7 +45049,7 @@ async function buildFrameworkProducts(scratch2, args) {
44881
45049
  const selectorOptions = swiftObjCSelectorOptions(args.moduleRoot);
44882
45050
  const receiptKey = (0, import_node_crypto42.createHash)("sha256").update(
44883
45051
  JSON.stringify([
44884
- "framework-products/v1",
45052
+ "framework-products/v2",
44885
45053
  args.frameworkKey,
44886
45054
  unoptimized,
44887
45055
  args.sdk,
@@ -45039,28 +45207,40 @@ async function buildFrameworkProducts(scratch2, args) {
45039
45207
  }
45040
45208
  const providers = (0, import_node_fs68.readdirSync)(providerDir).filter((file) => file.endsWith(".o")).sort().map((file) => import_node_path68.default.join(providerDir, file));
45041
45209
  for (const provider of providers) linked.owners.set(provider, "DarwinRecords");
45042
- const archive = import_node_path68.default.join(scratch2, "lib");
45043
- (0, import_node_fs68.rmSync)(archive, { recursive: true, force: true });
45044
- (0, import_node_fs68.mkdirSync)(archive);
45210
+ const archiveBase = import_node_path68.default.join(scratch2, "products-lib");
45211
+ (0, import_node_fs68.mkdirSync)(archiveBase, { recursive: true });
45212
+ const archiveRoot = import_node_path68.default.join(archiveBase, receiptKey);
45213
+ const stagedArchiveRoot = `${archiveRoot}.tmp-${process.pid}-${(0, import_node_crypto42.randomUUID)()}`;
45214
+ const stagedArchive = import_node_path68.default.join(stagedArchiveRoot, "lib");
45215
+ (0, import_node_fs68.mkdirSync)(stagedArchive, { recursive: true });
45045
45216
  const archived = /* @__PURE__ */ new Map();
45046
- for (const object8 of objects) {
45047
- const target = linked.owners.get(object8);
45048
- const dir = import_node_path68.default.join(release, `${target}.build`);
45049
- if (!target || target === "Darwin" || !object8.startsWith(dir + import_node_path68.default.sep)) continue;
45050
- const name3 = `${target}-${import_node_path68.default.relative(dir, object8).replaceAll(import_node_path68.default.sep, "-").replace(/\.swift\.o$/, ".o")}`;
45051
- (0, import_node_fs68.symlinkSync)(object8, import_node_path68.default.join(archive, name3));
45052
- archived.set(object8, `lib/${name3}`);
45053
- }
45054
- const roots = swiftObjcRootObjects(`${scratch2}
45055
- ${args.frameworkKey}`, scratch2, [
45056
- ...archived.values()
45057
- ]);
45217
+ try {
45218
+ for (const object8 of objects) {
45219
+ const target = linked.owners.get(object8);
45220
+ const dir = import_node_path68.default.join(release, `${target}.build`);
45221
+ if (!target || target === "Darwin" || !object8.startsWith(dir + import_node_path68.default.sep)) continue;
45222
+ const name3 = `${target}-${import_node_path68.default.relative(dir, object8).replaceAll(import_node_path68.default.sep, "-").replace(/\.swift\.o$/, ".o")}`;
45223
+ (0, import_node_fs68.symlinkSync)(object8, import_node_path68.default.join(stagedArchive, name3));
45224
+ archived.set(object8, `lib/${name3}`);
45225
+ }
45226
+ (0, import_node_fs68.rmSync)(archiveRoot, { recursive: true, force: true });
45227
+ (0, import_node_fs68.renameSync)(stagedArchiveRoot, archiveRoot);
45228
+ } catch (error) {
45229
+ (0, import_node_fs68.rmSync)(stagedArchiveRoot, { recursive: true, force: true });
45230
+ throw error;
45231
+ }
45232
+ const roots = swiftObjcRootObjects(
45233
+ `${archiveRoot}
45234
+ ${args.frameworkKey}`,
45235
+ archiveRoot,
45236
+ [...archived.values()]
45237
+ );
45058
45238
  const linkedObjects = objects.map((object8) => {
45059
45239
  const name3 = archived.get(object8);
45060
- return name3 ? { path: import_node_path68.default.join(scratch2, name3), lazy: !roots.has(name3) } : { path: object8, lazy: false };
45240
+ return name3 ? { path: import_node_path68.default.join(archiveRoot, name3), lazy: !roots.has(name3) } : { path: object8, lazy: false };
45061
45241
  });
45062
45242
  const result = {
45063
- root: scratch2,
45243
+ root: archiveRoot,
45064
45244
  modules: import_node_path68.default.join(release, "Modules"),
45065
45245
  objects: linkedObjects.filter((object8) => !object8.lazy).map((object8) => object8.path),
45066
45246
  lazyObjects: linkedObjects.filter((object8) => object8.lazy).map((object8) => object8.path),
@@ -45070,7 +45250,6 @@ ${args.frameworkKey}`, scratch2, [
45070
45250
  moduleMaps: linked.moduleMaps,
45071
45251
  objcHeaders: linked.objcHeaders
45072
45252
  };
45073
- (0, import_node_fs68.writeFileSync)(import_node_path68.default.join(archive, ".receipt"), receiptKey);
45074
45253
  const receiptsDir = import_node_path68.default.join(scratch2, "products-ready");
45075
45254
  (0, import_node_fs68.mkdirSync)(receiptsDir, { recursive: true });
45076
45255
  const receiptFile2 = import_node_path68.default.join(receiptsDir, `${receiptKey}.json`);
@@ -45078,6 +45257,7 @@ ${args.frameworkKey}`, scratch2, [
45078
45257
  (0, import_node_fs68.writeFileSync)(
45079
45258
  partialReceipt,
45080
45259
  JSON.stringify({
45260
+ root: result.root,
45081
45261
  modules: result.modules,
45082
45262
  objects: result.objects,
45083
45263
  lazyObjects: result.lazyObjects,
@@ -45109,7 +45289,10 @@ function swiftFrameworkSlotRecord(slot, record4) {
45109
45289
  function swiftFrameworkSlotKey(slot) {
45110
45290
  return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_KEY);
45111
45291
  }
45112
- async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, unoptimized = false) {
45292
+ function swiftFrameworkSlotRelease(slot) {
45293
+ return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_RELEASE);
45294
+ }
45295
+ async function withSwiftFrameworkSlot(frameworkKey, release, moduleRoot, signal, work, unoptimized = false) {
45113
45296
  const slotCount = unoptimized ? SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS : SWIFT_FRAMEWORK_SLOTS;
45114
45297
  const slotsDir = swiftFrameworksDir(unoptimized);
45115
45298
  const slots = Array.from({ length: slotCount }, (_, index) => {
@@ -45132,9 +45315,12 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
45132
45315
  (0, import_node_fs68.readFileSync)(import_node_path68.default.join(moduleRoot, file))
45133
45316
  ])
45134
45317
  );
45135
- const ranked = slots.map((slot) => {
45318
+ const ranked = slots.map((slot, index) => {
45319
+ const slotKey = swiftFrameworkSlotKey(slot);
45320
+ if (slotKey === null) return { slot, index, tier: 1, changes: Infinity };
45321
+ if (swiftFrameworkSlotRelease(slot) !== release)
45322
+ return { slot, index, tier: 2, changes: Infinity };
45136
45323
  let changes = 0;
45137
- if (swiftFrameworkSlotKey(slot) === null) return { slot, changes: Infinity };
45138
45324
  const source = import_node_path68.default.join(slot, "source", "packages", import_node_path68.default.basename(moduleRoot));
45139
45325
  for (const [file, contents2] of inputs2) {
45140
45326
  try {
@@ -45146,18 +45332,22 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
45146
45332
  changes++;
45147
45333
  }
45148
45334
  }
45149
- return { slot, changes };
45150
- }).sort(
45151
- (left, right) => left.changes - right.changes || Number(own2(right.slot)) - Number(own2(left.slot)) || (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0)
45152
- );
45153
- for (const { slot, changes } of ranked) {
45335
+ return { slot, index, tier: 0, changes };
45336
+ }).sort((left, right) => {
45337
+ if (left.tier !== right.tier) return left.tier - right.tier;
45338
+ if (left.tier === 0)
45339
+ return left.changes - right.changes || Number(own2(right.slot)) - Number(own2(left.slot)) || (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0);
45340
+ if (left.tier === 1) return left.index - right.index;
45341
+ return (built2.get(left.slot) ?? 0) - (built2.get(right.slot) ?? 0);
45342
+ });
45343
+ for (const { slot, tier, changes } of ranked) {
45154
45344
  if (await hasLiveSwiftRootReaders(slot, signal)) continue;
45155
45345
  const result = await withSwiftRootLock(
45156
45346
  slot,
45157
45347
  async (lease) => {
45158
45348
  if (await hasLiveSwiftRootReaders(slot, signal)) return void 0;
45159
45349
  console.error(
45160
- `[swift-framework-cache] ${import_node_path68.default.basename(slot)} changedInputs=${changes} totalInputs=${inputs2.size}`
45350
+ `[swift-framework-cache] ${import_node_path68.default.basename(slot)} release=${release} tier=${tier} changedInputs=${changes} totalInputs=${inputs2.size}`
45161
45351
  );
45162
45352
  return { value: await run12(slot)(lease) };
45163
45353
  },
@@ -45169,6 +45359,43 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
45169
45359
  const nearest = ranked[0].slot;
45170
45360
  return withSwiftRootLock(nearest, run12(nearest), signal);
45171
45361
  }
45362
+ async function withSwiftBuildRootSlot(baseRoot, buildShape, signal, work) {
45363
+ const slots = Array.from({ length: SWIFT_BUILD_ROOT_SLOTS }, (_, index) => {
45364
+ const slot = index === 0 ? baseRoot : `${baseRoot}-s${index}`;
45365
+ (0, import_node_fs68.mkdirSync)(slot, { recursive: true });
45366
+ return slot;
45367
+ });
45368
+ const runInSlot = (slot, waitStart2) => (lease) => {
45369
+ const waitedMs = Date.now() - waitStart2;
45370
+ const now = /* @__PURE__ */ new Date();
45371
+ (0, import_node_fs68.utimesSync)(slot, now, now);
45372
+ return work(slot, lease, waitedMs);
45373
+ };
45374
+ const built2 = new Map(slots.map((slot) => [slot, (0, import_node_fs68.statSync)(slot).mtimeMs]));
45375
+ const ranked = slots.map((slot, index) => {
45376
+ const shape = swiftFrameworkSlotRecord(slot, SWIFT_BUILD_ROOT_SHAPE);
45377
+ const tier = shape === buildShape ? 0 : shape === null ? 1 : 2;
45378
+ return { slot, index, tier };
45379
+ }).sort((left, right) => {
45380
+ if (left.tier !== right.tier) return left.tier - right.tier;
45381
+ if (left.tier === 0)
45382
+ return (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0);
45383
+ if (left.tier === 1) return left.index - right.index;
45384
+ return (built2.get(left.slot) ?? 0) - (built2.get(right.slot) ?? 0);
45385
+ });
45386
+ for (const { slot } of ranked) {
45387
+ const result = await withSwiftRootLock(
45388
+ slot,
45389
+ async (lease) => ({ value: await runInSlot(slot, Date.now())(lease) }),
45390
+ signal,
45391
+ false
45392
+ );
45393
+ if (result) return result.value;
45394
+ }
45395
+ const nearest = ranked[0].slot;
45396
+ const waitStart = Date.now();
45397
+ return withSwiftRootLock(nearest, runInSlot(nearest, waitStart), signal);
45398
+ }
45172
45399
  function mirrorTree2(source, target, skip) {
45173
45400
  (0, import_node_fs68.mkdirSync)(target, { recursive: true });
45174
45401
  const wanted = /* @__PURE__ */ new Set();
@@ -45218,8 +45445,10 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
45218
45445
  const hadKey = swiftFrameworkSlotKey(slot);
45219
45446
  if (hadKey !== frameworkKey) {
45220
45447
  (0, import_node_fs68.rmSync)(import_node_path68.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), { force: true });
45448
+ (0, import_node_fs68.rmSync)(import_node_path68.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), { force: true });
45221
45449
  (0, import_node_fs68.rmSync)(import_node_path68.default.join(slot, "products-ready"), { recursive: true, force: true });
45222
- (0, import_node_fs68.rmSync)(import_node_path68.default.join(slot, "lib", ".receipt"), { force: true });
45450
+ (0, import_node_fs68.rmSync)(import_node_path68.default.join(slot, "products-lib"), { recursive: true, force: true });
45451
+ (0, import_node_fs68.rmSync)(import_node_path68.default.join(slot, "lib"), { recursive: true, force: true });
45223
45452
  const moduleRestructured = mirrorTree2(moduleRoot, stagedModule, ".build");
45224
45453
  const sdkRestructured = mirrorTree2(
45225
45454
  swiftSharedSdkRoot(moduleRoot, false),
@@ -45247,8 +45476,11 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
45247
45476
  (0, import_node_fs68.rmSync)(modules, { recursive: true, force: true });
45248
45477
  (0, import_node_fs68.symlinkSync)(target, modules);
45249
45478
  }
45479
+ (0, import_node_fs68.writeFileSync)(import_node_path68.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), release);
45250
45480
  (0, import_node_fs68.writeFileSync)(import_node_path68.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), frameworkKey);
45251
45481
  (0, import_node_fs68.writeFileSync)(import_node_path68.default.join(slot, SWIFT_FRAMEWORK_SLOT_ORIGIN), moduleRoot);
45482
+ } else if (swiftFrameworkSlotRelease(slot) !== release) {
45483
+ (0, import_node_fs68.writeFileSync)(import_node_path68.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), release);
45252
45484
  }
45253
45485
  return stagedModule;
45254
45486
  }
@@ -45476,660 +45708,717 @@ ${cap}` : "";
45476
45708
  (0, import_node_fs68.rmSync)(requestRoot, { recursive: true, force: true });
45477
45709
  }
45478
45710
  }
45711
+ const baseRoot = root;
45712
+ const canPoolBuildRoot = !options2.intermediates && !options2.project && !options2.linkOnly && import_node_path68.default.basename(import_node_path68.default.dirname(baseRoot)) === "swift-builds";
45713
+ const buildShape = canPoolBuildRoot ? (0, import_node_crypto42.createHash)("sha256").update(
45714
+ JSON.stringify([
45715
+ frameworkKey,
45716
+ Boolean(sdkImage),
45717
+ compileTargets(input).map((target) => target.name).sort(),
45718
+ input.oneModule === true,
45719
+ input.optimize === true,
45720
+ input.unoptimized === true,
45721
+ Object.keys(input.files).sort()
45722
+ ])
45723
+ ).digest("hex").slice(0, 16) : "";
45479
45724
  return withSwiftCompileBudget(options2.timeoutMs, options2.signal, async (budget) => {
45480
- return withSwiftRootLock(
45481
- root,
45482
- async (lease) => {
45483
- if (!options2.intermediates) {
45484
- const built2 = readCompiledArtifact(import_node_path68.default.join(sharedRoot, "artifact"), hash);
45485
- if (built2) {
45486
- report("reusing verified disk artifact");
45487
- return retain(root, built2);
45488
- }
45489
- }
45490
- const swift = import_node_path68.default.join(options2.toolchainBin, "swift");
45491
- if (!(0, import_node_fs68.existsSync)(swift)) {
45492
- throw new Error(
45493
- `swift-compile: no swift.org toolchain at ${options2.toolchainBin}; install ${options2.release} and its matching wasm sdk`
45494
- );
45725
+ const stage = (message) => {
45726
+ budget.progress();
45727
+ report(message);
45728
+ };
45729
+ const runLocked = (work) => {
45730
+ if (canPoolBuildRoot) {
45731
+ (0, import_node_fs68.mkdirSync)(sharedRoot, { recursive: true });
45732
+ return withSwiftRootLock(
45733
+ sharedRoot,
45734
+ async () => {
45735
+ const built2 = readCompiledArtifact(
45736
+ import_node_path68.default.join(sharedRoot, "artifact"),
45737
+ hash
45738
+ );
45739
+ if (built2) {
45740
+ stage("reusing verified disk artifact");
45741
+ return retain(baseRoot, built2);
45742
+ }
45743
+ return withSwiftBuildRootSlot(baseRoot, buildShape, budget.signal, work);
45744
+ },
45745
+ budget.signal
45746
+ );
45747
+ }
45748
+ const waitStart = Date.now();
45749
+ return withSwiftRootLock(
45750
+ baseRoot,
45751
+ (lease) => work(baseRoot, lease, Date.now() - waitStart),
45752
+ budget.signal
45753
+ );
45754
+ };
45755
+ return runLocked(async (slotRoot, lease, waitedMs) => {
45756
+ const root2 = slotRoot;
45757
+ const layout3 = {
45758
+ root: root2,
45759
+ sources: import_node_path68.default.join(root2, "Sources", "App"),
45760
+ multi: compileTargets(input).length > 0
45761
+ };
45762
+ if (!options2.intermediates) {
45763
+ const built2 = readCompiledArtifact(import_node_path68.default.join(sharedRoot, "artifact"), hash);
45764
+ if (built2) {
45765
+ stage("reusing verified disk artifact");
45766
+ return retain(baseRoot, built2);
45495
45767
  }
45496
- const unoptimized = input.unoptimized === true;
45497
- const withFrameworkLock = (work) => distribution ? work(null) : withSwiftFrameworkSlot(
45498
- frameworkKey,
45499
- moduleRoot,
45768
+ }
45769
+ if (waitedMs >= 1e3)
45770
+ report(`acquired build root ${import_node_path68.default.basename(root2)} after ${waitedMs}ms`);
45771
+ if (canPoolBuildRoot) {
45772
+ refreshSwiftCacheHold(root2);
45773
+ (0, import_node_fs68.writeFileSync)(import_node_path68.default.join(root2, SWIFT_BUILD_ROOT_SHAPE), buildShape);
45774
+ }
45775
+ const swift = import_node_path68.default.join(options2.toolchainBin, "swift");
45776
+ if (!(0, import_node_fs68.existsSync)(swift)) {
45777
+ throw new Error(
45778
+ `swift-compile: no swift.org toolchain at ${options2.toolchainBin}; install ${options2.release} and its matching wasm sdk`
45779
+ );
45780
+ }
45781
+ const unoptimized = input.unoptimized === true;
45782
+ const withFrameworkLock = (work) => distribution ? work(null) : withSwiftFrameworkSlot(
45783
+ frameworkKey,
45784
+ options2.release,
45785
+ moduleRoot,
45786
+ budget.signal,
45787
+ work,
45788
+ unoptimized
45789
+ );
45790
+ const baseBuildEnv = options2.project?.env ? {
45791
+ ...options2.project.env,
45792
+ // shipped host plugins resolve against the selected compiler's runtime.
45793
+ ...process.platform === "linux" ? {
45794
+ LD_LIBRARY_PATH: [
45795
+ import_node_path68.default.resolve(options2.toolchainBin, "../lib/swift/linux"),
45796
+ import_node_path68.default.resolve(options2.toolchainBin, "../lib/swift/host"),
45797
+ process.env.LD_LIBRARY_PATH
45798
+ ].filter(Boolean).join(":")
45799
+ } : {},
45800
+ PEACH_DEFER_WASM_LINK: "1"
45801
+ } : swiftCompilerBaseEnv(options2.toolchainBin, process.env);
45802
+ const {
45803
+ frameworkRoot,
45804
+ compileFrameworkRoot,
45805
+ macroPlugins,
45806
+ sdk: sdk2,
45807
+ icu,
45808
+ prebuilt,
45809
+ readHold
45810
+ } = await withFrameworkLock(async (slot, frameworkLease) => {
45811
+ budget.startCompile();
45812
+ if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
45813
+ await waitForNoSwiftRootReaders(slot, budget.signal);
45814
+ const frameworkRoot2 = mirrorDistribution ? syncSwiftDistributionMirror(root2, moduleRoot, mirrorDistribution) : distribution ? moduleRoot : stageFrameworkSource(moduleRoot, slot, frameworkKey, options2.release);
45815
+ if (!swiftModuleDigest(frameworkRoot2).equals(moduleDigest))
45816
+ throw new Error("Swift staged project source differs from the caller");
45817
+ stage("preparing compiler plugins");
45818
+ const macroPlugins2 = await ensureMacroPlugins(
45819
+ frameworkRoot2,
45820
+ options2.toolchainBin,
45821
+ options2.release,
45500
45822
  budget.signal,
45501
- work,
45502
- unoptimized
45823
+ frameworkLease
45503
45824
  );
45504
- const baseBuildEnv = options2.project?.env ? {
45505
- ...options2.project.env,
45506
- // shipped host plugins resolve against the selected compiler's runtime.
45507
- ...process.platform === "linux" ? {
45508
- LD_LIBRARY_PATH: [
45509
- import_node_path68.default.resolve(options2.toolchainBin, "../lib/swift/linux"),
45510
- import_node_path68.default.resolve(options2.toolchainBin, "../lib/swift/host"),
45511
- process.env.LD_LIBRARY_PATH
45512
- ].filter(Boolean).join(":")
45513
- } : {},
45514
- PEACH_DEFER_WASM_LINK: "1"
45515
- } : swiftCompilerBaseEnv(options2.toolchainBin, process.env);
45516
- const {
45825
+ const compileFrameworkRoot2 = distribution ? swiftDistributionCompileView(frameworkRoot2, distribution) : frameworkRoot2;
45826
+ const sdk3 = swiftModuleSdk(frameworkRoot2).wasmSdkId;
45827
+ const icu2 = options2.linkOnly ? null : swiftIcuAsset(options2.toolchainBin, sdk3);
45828
+ let prebuilt2;
45829
+ if (!distribution) {
45830
+ stage("compiling framework products");
45831
+ prebuilt2 = await buildFrameworkProducts(slot, {
45832
+ moduleRoot: frameworkRoot2,
45833
+ frameworkKey,
45834
+ input,
45835
+ swift,
45836
+ sdk: sdk3,
45837
+ toolchainBin: options2.toolchainBin,
45838
+ plugins: macroPlugins2,
45839
+ buildOptions: {
45840
+ env: baseBuildEnv,
45841
+ maxBuffer: 64 * 1024 * 1024,
45842
+ signal: budget.signal,
45843
+ onOutput: budget.progress,
45844
+ lease,
45845
+ frameworkLease
45846
+ }
45847
+ });
45848
+ }
45849
+ const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
45850
+ return {
45851
+ frameworkRoot: frameworkRoot2,
45852
+ compileFrameworkRoot: compileFrameworkRoot2,
45853
+ macroPlugins: macroPlugins2,
45854
+ sdk: sdk3,
45855
+ icu: icu2,
45856
+ prebuilt: prebuilt2,
45857
+ readHold: readHold2
45858
+ };
45859
+ });
45860
+ const buildOptions = {
45861
+ env: baseBuildEnv,
45862
+ maxBuffer: 64 * 1024 * 1024,
45863
+ signal: budget.signal,
45864
+ onOutput: budget.progress,
45865
+ lease
45866
+ };
45867
+ try {
45868
+ if (options2.project) removeProjectLinks(root2);
45869
+ const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
45870
+ if (retireStaleSwiftLink(
45871
+ root2,
45872
+ swiftLinkStamp({
45873
+ frameworkKey: `${options2.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
45874
+ packageHostMacros
45875
+ }),
45876
+ swiftLinkStamp({
45877
+ // a distribution's objects reach only the deferred link, and
45878
+ // the root's mirror keeps its compile inputs at fixed paths
45879
+ frameworkKey: distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
45880
+ prebuilt,
45881
+ packageHostMacros
45882
+ }),
45883
+ Boolean(options2.linkOnly)
45884
+ ))
45885
+ stage("framework revision changed; rebuilding the app link");
45886
+ const nativeToolset = needsNativeToolset(input, prebuilt);
45887
+ const preparation = writeSwiftProject(
45888
+ layout3,
45889
+ input,
45517
45890
  frameworkRoot,
45518
- compileFrameworkRoot,
45519
- macroPlugins,
45520
- sdk: sdk2,
45521
- icu,
45522
45891
  prebuilt,
45523
- readHold
45524
- } = await withFrameworkLock(async (slot, frameworkLease) => {
45525
- budget.startCompile();
45526
- if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
45527
- await waitForNoSwiftRootReaders(slot, budget.signal);
45528
- const frameworkRoot2 = mirrorDistribution ? syncSwiftDistributionMirror(root, moduleRoot, mirrorDistribution) : distribution ? moduleRoot : stageFrameworkSource(moduleRoot, slot, frameworkKey, options2.release);
45529
- if (!swiftModuleDigest(frameworkRoot2).equals(moduleDigest))
45530
- throw new Error("Swift staged project source differs from the caller");
45531
- report("preparing compiler plugins");
45532
- const macroPlugins2 = await ensureMacroPlugins(
45533
- frameworkRoot2,
45534
- options2.toolchainBin,
45535
- options2.release,
45536
- budget.signal,
45537
- frameworkLease
45892
+ !options2.project,
45893
+ options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0)
45894
+ );
45895
+ const productFile = import_node_path68.default.join(frameworkRoot, SWIFT_FRAMEWORK_PRODUCT_FILE);
45896
+ writeSwiftAutolinkLinker(
45897
+ root2,
45898
+ options2.toolchainBin,
45899
+ (0, import_node_fs68.existsSync)(productFile) ? [
45900
+ v6.parse(
45901
+ swiftFrameworkProductSchema,
45902
+ JSON.parse((0, import_node_fs68.readFileSync)(productFile, "utf8"))
45903
+ ).product.name
45904
+ ] : []
45905
+ );
45906
+ const compiler = preparation.targetToolset ? { CC: import_node_path68.default.join(root2, CLANG_TARGET_MODULE_WRAPPER) } : {};
45907
+ if (packageHostMacros?.length) {
45908
+ const swiftc = import_node_path68.default.join(root2, SWIFT_HOST_COMPILER_WRAPPER);
45909
+ writeBuildFile(
45910
+ swiftc,
45911
+ [
45912
+ "#!/bin/sh",
45913
+ "target=",
45914
+ "module=",
45915
+ "compile=",
45916
+ "previous=",
45917
+ "for argument do",
45918
+ ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
45919
+ ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
45920
+ " previous=$argument",
45921
+ "done",
45922
+ 'case "$target/$compile" in',
45923
+ " *-*-linux*/1)",
45924
+ ' case ",$PEACH_SWIFT_HOST_MACROS," in',
45925
+ ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
45926
+ " esac ;;",
45927
+ "esac",
45928
+ 'exec "$PEACH_SWIFTC" "$@"',
45929
+ ""
45930
+ ].join("\n")
45538
45931
  );
45539
- const compileFrameworkRoot2 = distribution ? swiftDistributionCompileView(frameworkRoot2, distribution) : frameworkRoot2;
45540
- const sdk3 = swiftModuleSdk(frameworkRoot2).wasmSdkId;
45541
- const icu2 = options2.linkOnly ? null : swiftIcuAsset(options2.toolchainBin, sdk3);
45542
- let prebuilt2;
45543
- if (!distribution) {
45544
- report("compiling framework products");
45545
- prebuilt2 = await buildFrameworkProducts(slot, {
45546
- moduleRoot: frameworkRoot2,
45547
- frameworkKey,
45548
- input,
45549
- swift,
45550
- sdk: sdk3,
45551
- toolchainBin: options2.toolchainBin,
45552
- plugins: macroPlugins2,
45553
- buildOptions: {
45554
- env: baseBuildEnv,
45555
- maxBuffer: 64 * 1024 * 1024,
45556
- signal: budget.signal,
45557
- lease,
45558
- frameworkLease
45559
- }
45560
- });
45932
+ (0, import_node_fs68.chmodSync)(swiftc, 493);
45933
+ compiler.SWIFT_EXEC = swiftc;
45934
+ compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
45935
+ compiler.PEACH_SWIFTC = import_node_path68.default.join(options2.toolchainBin, "swiftc");
45936
+ }
45937
+ const projectProcess = options2.project ? prepareSwiftProjectProcess(root2, options2.project) : void 0;
45938
+ const temporaryDirectory = projectProcess ? void 0 : import_node_path68.default.join(root2, ".build", "peach-compiler-tmp");
45939
+ const appOptions = projectProcess ? {
45940
+ ...buildOptions,
45941
+ uid: projectProcess.uid,
45942
+ gid: projectProcess.gid,
45943
+ confined: { ...projectProcess.env, ...compiler }
45944
+ } : {
45945
+ ...buildOptions,
45946
+ temporaryDirectory,
45947
+ env: {
45948
+ ...buildOptions.env,
45949
+ ...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
45950
+ ...compiler
45561
45951
  }
45562
- const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
45563
- return {
45564
- frameworkRoot: frameworkRoot2,
45565
- compileFrameworkRoot: compileFrameworkRoot2,
45566
- macroPlugins: macroPlugins2,
45567
- sdk: sdk3,
45568
- icu: icu2,
45569
- prebuilt: prebuilt2,
45570
- readHold: readHold2
45571
- };
45572
- });
45573
- const buildOptions = {
45574
- env: baseBuildEnv,
45575
- maxBuffer: 64 * 1024 * 1024,
45576
- signal: budget.signal,
45577
- lease
45578
45952
  };
45579
- try {
45580
- if (options2.project) removeProjectLinks(root);
45581
- const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
45582
- if (retireStaleSwiftLink(
45583
- root,
45584
- swiftLinkStamp({
45585
- frameworkKey: `${options2.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
45586
- packageHostMacros
45587
- }),
45588
- swiftLinkStamp({
45589
- // a distribution's objects reach only the deferred link, and
45590
- // the root's mirror keeps its compile inputs at fixed paths
45591
- frameworkKey: distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
45592
- prebuilt,
45593
- packageHostMacros
45594
- }),
45595
- Boolean(options2.linkOnly)
45596
- ))
45597
- report("framework revision changed; rebuilding the app link");
45598
- const nativeToolset = needsNativeToolset(input, prebuilt);
45599
- const preparation = writeSwiftProject(
45600
- layout2,
45601
- input,
45602
- frameworkRoot,
45603
- prebuilt,
45604
- !options2.project,
45605
- options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0)
45953
+ const unprepared = preparation.targetFailures.map(
45954
+ (failure2) => `error: target ${failure2}`
45955
+ );
45956
+ const forwarders = /* @__PURE__ */ new Map();
45957
+ for (const [file, text7] of Object.entries(input.files)) {
45958
+ const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text7)?.[1];
45959
+ if (!parents) continue;
45960
+ const directory2 = import_node_path68.default.posix.dirname(file);
45961
+ forwarders.set(
45962
+ `${import_node_path68.default.join(root2, directory2)}/${parents.slice(0, -1)}`,
45963
+ import_node_path68.default.posix.join("build", directory2, parents).replace(/\/$/, "")
45606
45964
  );
45607
- const productFile = import_node_path68.default.join(frameworkRoot, SWIFT_FRAMEWORK_PRODUCT_FILE);
45608
- writeSwiftAutolinkLinker(
45609
- root,
45610
- options2.toolchainBin,
45611
- (0, import_node_fs68.existsSync)(productFile) ? [
45612
- v6.parse(
45613
- swiftFrameworkProductSchema,
45614
- JSON.parse((0, import_node_fs68.readFileSync)(productFile, "utf8"))
45615
- ).product.name
45616
- ] : []
45965
+ }
45966
+ const jobs = swiftCompilerJobs();
45967
+ const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
45968
+ const perFile = input.unoptimized || incrementalPreview;
45969
+ const buildArgs = [
45970
+ "build",
45971
+ ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
45972
+ "--build-system",
45973
+ "native",
45974
+ "-j",
45975
+ String(jobs),
45976
+ "--package-path",
45977
+ root2,
45978
+ ...swiftCompileSdkOptions(frameworkRoot, options2.toolchainBin),
45979
+ ...swiftObjCSelectorOptions(frameworkRoot),
45980
+ "--swift-sdk",
45981
+ sdk2,
45982
+ ...preparation.targetToolset ? ["--toolset", import_node_path68.default.join(root2, ".peach-target-toolset.json")] : [],
45983
+ "-c",
45984
+ "release",
45985
+ ...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
45986
+ ...perFile ? [
45987
+ "-Xswiftc",
45988
+ "-no-whole-module-optimization",
45989
+ "-Xswiftc",
45990
+ "-j",
45991
+ "-Xswiftc",
45992
+ String(jobs)
45993
+ ] : [],
45994
+ ...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
45995
+ // the mirror finds a changed sdk header's readers in their
45996
+ // dependency files, which omit system headers by default
45997
+ ...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
45998
+ // the link strips debug info, so none is generated (as for the framework).
45999
+ // keep -num-threads fixed across caller core caps so llbuild does not
46000
+ // rebuild every target when callers alternate --cores, and bound backend
46001
+ // fan-out under high -j.
46002
+ "-Xswiftc",
46003
+ "-gnone",
46004
+ ...incrementalPreview ? [] : [
46005
+ "-Xswiftc",
46006
+ "-num-threads",
46007
+ "-Xswiftc",
46008
+ String(perFile ? 1 : Math.min(8, import_node_os14.default.availableParallelism()))
46009
+ ],
46010
+ ...swiftReproducibleBuildFlags([
46011
+ [import_node_path68.default.dirname(options2.toolchainBin), "toolchain"],
46012
+ [compileFrameworkRoot, "framework"],
46013
+ [root2, "build"],
46014
+ ...forwarders
46015
+ ]).flatMap((flag, index, flags) => {
46016
+ if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
46017
+ return [flag];
46018
+ const toolchainDir = import_node_path68.default.dirname(options2.toolchainBin);
46019
+ let mapped = flag;
46020
+ for (const [dir, target] of [
46021
+ [root2, "/peach/build"],
46022
+ [compileFrameworkRoot, "/peach/framework"],
46023
+ [(0, import_node_fs68.realpathSync)(compileFrameworkRoot), "/peach/framework"],
46024
+ [toolchainDir, "/peach/toolchain"],
46025
+ [(0, import_node_fs68.realpathSync)(toolchainDir), "/peach/toolchain"]
46026
+ ]) {
46027
+ mapped = mapped.replaceAll(dir, target);
46028
+ }
46029
+ const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
46030
+ const tool = flags[index - 1];
46031
+ return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
46032
+ }),
46033
+ ...macroPlugins.libraries.flatMap((plugin) => [
46034
+ "-Xswiftc",
46035
+ "-load-plugin-library",
46036
+ "-Xswiftc",
46037
+ plugin
46038
+ ]),
46039
+ ...macroPlugins.executables.flatMap((plugin) => [
46040
+ "-Xswiftc",
46041
+ "-load-plugin-executable",
46042
+ "-Xswiftc",
46043
+ `${plugin}#ExpoModulesMacros`
46044
+ ])
46045
+ ];
46046
+ const linked = builtArtifact(layout3);
46047
+ (0, import_node_fs68.rmSync)(import_node_path68.default.join(root2, ".peach-link.rsp"), { force: true });
46048
+ if (options2.linkOnly || (0, import_node_fs68.existsSync)(linked) && (0, import_node_fs68.statSync)(linked).size <= 8)
46049
+ (0, import_node_fs68.rmSync)(linked, { force: true });
46050
+ stage("compiling and linking Swift modules");
46051
+ const frameworkInterfaces = /* @__PURE__ */ new Map();
46052
+ const sdkFrameworks = import_node_path68.default.join(
46053
+ swiftSdkPaths(frameworkRoot, options2.toolchainBin).darwin,
46054
+ "System/Library/Frameworks"
46055
+ );
46056
+ const generatedInterface = (source) => withoutImportedSdkEnumForwards(
46057
+ clangInterfaceHeader((0, import_node_fs68.readFileSync)(source, "utf8"), frameworkRoot),
46058
+ sdkObjCDeclarationOwners(sdkFrameworks)
46059
+ );
46060
+ const nativeDeclarations = /* @__PURE__ */ new Map();
46061
+ const nativeHeaders = Object.entries(input.files).filter(([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")).map(([, source]) => source);
46062
+ for (const [file, contents2] of Object.entries(input.files)) {
46063
+ if (!file.endsWith(".modulemap")) continue;
46064
+ const name3 = moduleMapName(contents2);
46065
+ const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents2)?.[1];
46066
+ if (!name3 || !umbrella) continue;
46067
+ const header = input.files[import_node_path68.default.posix.join(import_node_path68.default.posix.dirname(file), umbrella)];
46068
+ if (header === void 0) continue;
46069
+ const included = new Set(
46070
+ [
46071
+ ...header.matchAll(/^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm)
46072
+ ].map((match) => import_node_path68.default.posix.basename(match[1]))
45617
46073
  );
45618
- const compiler = preparation.targetToolset ? { CC: import_node_path68.default.join(root, CLANG_TARGET_MODULE_WRAPPER) } : {};
45619
- if (packageHostMacros?.length) {
45620
- const swiftc = import_node_path68.default.join(root, SWIFT_HOST_COMPILER_WRAPPER);
45621
- writeBuildFile(
45622
- swiftc,
45623
- [
45624
- "#!/bin/sh",
45625
- "target=",
45626
- "module=",
45627
- "compile=",
45628
- "previous=",
45629
- "for argument do",
45630
- ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
45631
- ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
45632
- " previous=$argument",
45633
- "done",
45634
- 'case "$target/$compile" in',
45635
- " *-*-linux*/1)",
45636
- ' case ",$PEACH_SWIFT_HOST_MACROS," in',
45637
- ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
45638
- " esac ;;",
45639
- "esac",
45640
- 'exec "$PEACH_SWIFTC" "$@"',
45641
- ""
45642
- ].join("\n")
45643
- );
45644
- (0, import_node_fs68.chmodSync)(swiftc, 493);
45645
- compiler.SWIFT_EXEC = swiftc;
45646
- compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
45647
- compiler.PEACH_SWIFTC = import_node_path68.default.join(options2.toolchainBin, "swiftc");
46074
+ const declarations = nativeDeclarations.get(name3) ?? /* @__PURE__ */ new Set();
46075
+ for (const declaration of swiftInterfaceDeclarations(header))
46076
+ declarations.add(declaration);
46077
+ for (const [candidate, source] of Object.entries(input.files))
46078
+ if (included.has(import_node_path68.default.posix.basename(candidate)))
46079
+ for (const declaration of swiftInterfaceDeclarations(source))
46080
+ declarations.add(declaration);
46081
+ nativeDeclarations.set(name3, declarations);
46082
+ }
46083
+ const frameworkInterface = (name3) => {
46084
+ if (frameworkInterfaces.has(name3)) return frameworkInterfaces.get(name3);
46085
+ const source = distribution ? import_node_path68.default.join(frameworkRoot, "modules", `${name3}-Swift.h`) : prebuilt.objcHeaders.get(name3);
46086
+ if (!source || !(0, import_node_fs68.existsSync)(source)) {
46087
+ frameworkInterfaces.set(name3, null);
46088
+ return null;
45648
46089
  }
45649
- const projectProcess = options2.project ? prepareSwiftProjectProcess(root, options2.project) : void 0;
45650
- const temporaryDirectory = projectProcess ? void 0 : import_node_path68.default.join(root, ".build", "peach-compiler-tmp");
45651
- const appOptions = projectProcess ? {
45652
- ...buildOptions,
45653
- uid: projectProcess.uid,
45654
- gid: projectProcess.gid,
45655
- confined: { ...projectProcess.env, ...compiler }
45656
- } : {
45657
- ...buildOptions,
45658
- temporaryDirectory,
45659
- env: {
45660
- ...buildOptions.env,
45661
- ...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
45662
- ...compiler
45663
- }
45664
- };
45665
- const unprepared = preparation.targetFailures.map(
45666
- (failure2) => `error: target ${failure2}`
46090
+ const headers = import_node_path68.default.join(sdkFrameworks, `${name3}.framework/Headers`);
46091
+ const declared = /* @__PURE__ */ new Set();
46092
+ if ((0, import_node_fs68.existsSync)(headers)) {
46093
+ for (const file of (0, import_node_fs68.readdirSync)(headers, {
46094
+ recursive: true,
46095
+ encoding: "utf8"
46096
+ }))
46097
+ if (file.endsWith(".h"))
46098
+ for (const name4 of swiftInterfaceDeclarations(
46099
+ (0, import_node_fs68.readFileSync)(import_node_path68.default.join(headers, file), "utf8")
46100
+ ))
46101
+ declared.add(name4);
46102
+ }
46103
+ for (const declaration of nativeDeclarations.get(name3) ?? [])
46104
+ declared.add(declaration);
46105
+ const own2 = withoutSwiftDeclarations(
46106
+ generatedInterface(source),
46107
+ declared,
46108
+ nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
45667
46109
  );
45668
- const forwarders = /* @__PURE__ */ new Map();
45669
- for (const [file, text7] of Object.entries(input.files)) {
45670
- const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text7)?.[1];
45671
- if (!parents) continue;
45672
- const directory2 = import_node_path68.default.posix.dirname(file);
45673
- forwarders.set(
45674
- `${import_node_path68.default.join(root, directory2)}/${parents.slice(0, -1)}`,
45675
- import_node_path68.default.posix.join("build", directory2, parents).replace(/\/$/, "")
45676
- );
46110
+ const owners = sdkObjCDeclarationOwners(sdkFrameworks);
46111
+ const foreign = /* @__PURE__ */ new Map();
46112
+ for (const declaration of [
46113
+ ...swiftInterfaceDeclarations(own2),
46114
+ ...objcEnumerations(own2),
46115
+ ...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
46116
+ (match) => match[1]
46117
+ )
46118
+ ]) {
46119
+ const owner = owners.get(declaration);
46120
+ if (owner && owner !== name3) foreign.set(declaration, owner);
45677
46121
  }
45678
- const jobs = swiftCompilerJobs();
45679
- const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
45680
- const perFile = input.unoptimized || incrementalPreview;
45681
- const buildArgs = [
45682
- "build",
45683
- ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
45684
- "--build-system",
45685
- "native",
45686
- "-j",
45687
- String(jobs),
45688
- "--package-path",
45689
- root,
45690
- ...swiftCompileSdkOptions(frameworkRoot, options2.toolchainBin),
45691
- ...swiftObjCSelectorOptions(frameworkRoot),
45692
- "--swift-sdk",
45693
- sdk2,
45694
- ...preparation.targetToolset ? ["--toolset", import_node_path68.default.join(root, ".peach-target-toolset.json")] : [],
45695
- "-c",
45696
- "release",
45697
- ...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
45698
- ...perFile ? [
45699
- "-Xswiftc",
45700
- "-no-whole-module-optimization",
45701
- "-Xswiftc",
45702
- "-j",
45703
- "-Xswiftc",
45704
- String(jobs)
45705
- ] : [],
45706
- ...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
45707
- // the mirror finds a changed sdk header's readers in their
45708
- // dependency files, which omit system headers by default
45709
- ...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
45710
- // the link strips debug info, so none is generated (as for the framework).
45711
- // keep -num-threads fixed across caller core caps so llbuild does not
45712
- // rebuild every target when callers alternate --cores, and bound backend
45713
- // fan-out under high -j.
45714
- "-Xswiftc",
45715
- "-gnone",
45716
- ...incrementalPreview ? [] : [
45717
- "-Xswiftc",
45718
- "-num-threads",
45719
- "-Xswiftc",
45720
- String(perFile ? 1 : Math.min(8, import_node_os14.default.availableParallelism()))
45721
- ],
45722
- ...swiftReproducibleBuildFlags([
45723
- [import_node_path68.default.dirname(options2.toolchainBin), "toolchain"],
45724
- [compileFrameworkRoot, "framework"],
45725
- [root, "build"],
45726
- ...forwarders
45727
- ]).flatMap((flag, index, flags) => {
45728
- if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
45729
- return [flag];
45730
- const toolchainDir = import_node_path68.default.dirname(options2.toolchainBin);
45731
- let mapped = flag;
45732
- for (const [dir, target] of [
45733
- [root, "/peach/build"],
45734
- [compileFrameworkRoot, "/peach/framework"],
45735
- [(0, import_node_fs68.realpathSync)(compileFrameworkRoot), "/peach/framework"],
45736
- [toolchainDir, "/peach/toolchain"],
45737
- [(0, import_node_fs68.realpathSync)(toolchainDir), "/peach/toolchain"]
45738
- ]) {
45739
- mapped = mapped.replaceAll(dir, target);
45740
- }
45741
- const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
45742
- const tool = flags[index - 1];
45743
- return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
45744
- }),
45745
- ...macroPlugins.libraries.flatMap((plugin) => [
45746
- "-Xswiftc",
45747
- "-load-plugin-library",
45748
- "-Xswiftc",
45749
- plugin
45750
- ]),
45751
- ...macroPlugins.executables.flatMap((plugin) => [
45752
- "-Xswiftc",
45753
- "-load-plugin-executable",
45754
- "-Xswiftc",
45755
- `${plugin}#ExpoModulesMacros`
45756
- ])
45757
- ];
45758
- const linked = builtArtifact(layout2);
45759
- (0, import_node_fs68.rmSync)(import_node_path68.default.join(root, ".peach-link.rsp"), { force: true });
45760
- if (options2.linkOnly || (0, import_node_fs68.existsSync)(linked) && (0, import_node_fs68.statSync)(linked).size <= 8)
45761
- (0, import_node_fs68.rmSync)(linked, { force: true });
45762
- report("compiling and linking Swift modules");
45763
- const frameworkInterfaces = /* @__PURE__ */ new Map();
45764
- const sdkFrameworks = import_node_path68.default.join(
45765
- swiftSdkPaths(frameworkRoot, options2.toolchainBin).darwin,
45766
- "System/Library/Frameworks"
46122
+ const header = foreign.size ? withoutSwiftDeclarations(
46123
+ own2,
46124
+ new Set(foreign.keys()),
46125
+ [...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
46126
+ ) : own2;
46127
+ const value = {
46128
+ file: import_node_path68.default.join(root2, ".build/peach-framework-objc", `${name3}-Swift.h`),
46129
+ header,
46130
+ module: (0, import_node_fs68.existsSync)(headers)
46131
+ };
46132
+ frameworkInterfaces.set(name3, value);
46133
+ writeBuildFile(
46134
+ value.file,
46135
+ ((0, import_node_fs68.existsSync)(import_node_path68.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
46136
+ ` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
45767
46137
  );
45768
- const generatedInterface = (source) => withoutImportedSdkEnumForwards(
45769
- clangInterfaceHeader((0, import_node_fs68.readFileSync)(source, "utf8"), frameworkRoot),
45770
- sdkObjCDeclarationOwners(sdkFrameworks)
46138
+ return value;
46139
+ };
46140
+ const headerPaths = (producer) => {
46141
+ const stem2 = import_node_path68.default.join(
46142
+ root2,
46143
+ ".build",
46144
+ "peach-cxx-headers",
46145
+ `${producer}-Swift`
45771
46146
  );
45772
- const nativeDeclarations = /* @__PURE__ */ new Map();
45773
- const nativeHeaders = Object.entries(input.files).filter(([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")).map(([, source]) => source);
45774
- for (const [file, contents2] of Object.entries(input.files)) {
45775
- if (!file.endsWith(".modulemap")) continue;
45776
- const name3 = moduleMapName(contents2);
45777
- const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents2)?.[1];
45778
- if (!name3 || !umbrella) continue;
45779
- const header = input.files[import_node_path68.default.posix.join(import_node_path68.default.posix.dirname(file), umbrella)];
45780
- if (header === void 0) continue;
45781
- const included = new Set(
45782
- [
45783
- ...header.matchAll(/^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm)
45784
- ].map((match) => import_node_path68.default.posix.basename(match[1]))
45785
- );
45786
- const declarations = nativeDeclarations.get(name3) ?? /* @__PURE__ */ new Set();
45787
- for (const declaration of swiftInterfaceDeclarations(header))
45788
- declarations.add(declaration);
45789
- for (const [candidate, source] of Object.entries(input.files))
45790
- if (included.has(import_node_path68.default.posix.basename(candidate)))
45791
- for (const declaration of swiftInterfaceDeclarations(source))
45792
- declarations.add(declaration);
45793
- nativeDeclarations.set(name3, declarations);
45794
- }
45795
- const frameworkInterface = (name3) => {
45796
- if (frameworkInterfaces.has(name3)) return frameworkInterfaces.get(name3);
45797
- const source = distribution ? import_node_path68.default.join(frameworkRoot, "modules", `${name3}-Swift.h`) : prebuilt.objcHeaders.get(name3);
45798
- if (!source || !(0, import_node_fs68.existsSync)(source)) {
45799
- frameworkInterfaces.set(name3, null);
45800
- return null;
45801
- }
45802
- const headers = import_node_path68.default.join(sdkFrameworks, `${name3}.framework/Headers`);
45803
- const declared = /* @__PURE__ */ new Set();
45804
- if ((0, import_node_fs68.existsSync)(headers)) {
45805
- for (const file of (0, import_node_fs68.readdirSync)(headers, {
45806
- recursive: true,
45807
- encoding: "utf8"
45808
- }))
45809
- if (file.endsWith(".h"))
45810
- for (const name4 of swiftInterfaceDeclarations(
45811
- (0, import_node_fs68.readFileSync)(import_node_path68.default.join(headers, file), "utf8")
45812
- ))
45813
- declared.add(name4);
46147
+ return { producer, original: `${stem2}.original.h`, emitted: `${stem2}.h` };
46148
+ };
46149
+ const publishHeader = ({
46150
+ producer,
46151
+ original,
46152
+ emitted
46153
+ }) => {
46154
+ const generated = generatedInterface(original);
46155
+ writeBuildFile(
46156
+ emitted,
46157
+ withoutSwiftDeclarations(
46158
+ swiftHeaderWithSuperclassImports(generated, frameworkInterface),
46159
+ /* @__PURE__ */ new Set([
46160
+ ...preparation.nativeHeaderDeclarations[producer] ?? [],
46161
+ ...nativelyDeclaredFunctions(generated, nativeHeaders)
46162
+ ]),
46163
+ `#import <${producer}/${producer}.h>`
46164
+ )
46165
+ );
46166
+ };
46167
+ const recipe2 = inputHash.copy().update(
46168
+ distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
46169
+ ).update((0, import_node_fs68.readFileSync)(import_node_path68.default.join(root2, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
46170
+ const runApp = async (compiler2) => {
46171
+ const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
46172
+ const stages = [
46173
+ ...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
46174
+ target,
46175
+ producers: []
46176
+ })),
46177
+ ...preparation.headerBuilds,
46178
+ ...(preparation.nativeProductTargets ?? []).map((target) => ({
46179
+ target,
46180
+ producers: []
46181
+ }))
46182
+ ];
46183
+ const checkpoints = import_node_path68.default.join(root2, ".build", "peach-product-checkpoints");
46184
+ const buildDbExists = (0, import_node_fs68.existsSync)(import_node_path68.default.join(root2, ".build", "build.db"));
46185
+ const releaseDir = import_node_path68.default.dirname(linked);
46186
+ for (const { target, producers } of stages) {
46187
+ if (!options2.project && producers.length === 0 && buildDbExists) {
46188
+ const expectedObjects = preparation.nativeStageObjects.get(target);
46189
+ if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
46190
+ (relative3) => (0, import_node_fs68.statSync)(import_node_path68.default.join(releaseDir, relative3), {
46191
+ throwIfNoEntry: false
46192
+ })?.isFile()
46193
+ ))
46194
+ continue;
45814
46195
  }
45815
- for (const declaration of nativeDeclarations.get(name3) ?? [])
45816
- declared.add(declaration);
45817
- const own2 = withoutSwiftDeclarations(
45818
- generatedInterface(source),
45819
- declared,
45820
- nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
46196
+ const receipt = import_node_path68.default.join(
46197
+ checkpoints,
46198
+ (0, import_node_crypto42.createHash)("sha256").update(target).digest("hex")
45821
46199
  );
45822
- const owners = sdkObjCDeclarationOwners(sdkFrameworks);
45823
- const foreign = /* @__PURE__ */ new Map();
45824
- for (const declaration of [
45825
- ...swiftInterfaceDeclarations(own2),
45826
- ...objcEnumerations(own2),
45827
- ...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
45828
- (match) => match[1]
45829
- )
45830
- ]) {
45831
- const owner = owners.get(declaration);
45832
- if (owner && owner !== name3) foreign.set(declaration, owner);
45833
- }
45834
- const header = foreign.size ? withoutSwiftDeclarations(
45835
- own2,
45836
- new Set(foreign.keys()),
45837
- [...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
45838
- ) : own2;
45839
- const value = {
45840
- file: import_node_path68.default.join(root, ".build/peach-framework-objc", `${name3}-Swift.h`),
45841
- header,
45842
- module: (0, import_node_fs68.existsSync)(headers)
45843
- };
45844
- frameworkInterfaces.set(name3, value);
45845
- writeBuildFile(
45846
- value.file,
45847
- ((0, import_node_fs68.existsSync)(import_node_path68.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
45848
- ` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
45849
- );
45850
- return value;
45851
- };
45852
- const headerPaths = (producer) => {
45853
- const stem2 = import_node_path68.default.join(
45854
- root,
45855
- ".build",
45856
- "peach-cxx-headers",
45857
- `${producer}-Swift`
45858
- );
45859
- return { producer, original: `${stem2}.original.h`, emitted: `${stem2}.h` };
45860
- };
45861
- const publishHeader = ({
45862
- producer,
45863
- original,
45864
- emitted
45865
- }) => {
45866
- const generated = generatedInterface(original);
45867
- writeBuildFile(
45868
- emitted,
45869
- withoutSwiftDeclarations(
45870
- swiftHeaderWithSuperclassImports(generated, frameworkInterface),
45871
- /* @__PURE__ */ new Set([
45872
- ...preparation.nativeHeaderDeclarations[producer] ?? [],
45873
- ...nativelyDeclaredFunctions(generated, nativeHeaders)
45874
- ]),
45875
- `#import <${producer}/${producer}.h>`
45876
- )
45877
- );
45878
- };
45879
- const recipe2 = inputHash.copy().update(
45880
- distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
45881
- ).update((0, import_node_fs68.readFileSync)(import_node_path68.default.join(root, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
45882
- const runApp = async (compiler2) => {
45883
- const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
45884
- const stages = [
45885
- ...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
45886
- target,
45887
- producers: []
45888
- })),
45889
- ...preparation.headerBuilds,
45890
- ...(preparation.nativeProductTargets ?? []).map((target) => ({
45891
- target,
45892
- producers: []
45893
- }))
45894
- ];
45895
- const checkpoints = import_node_path68.default.join(root, ".build", "peach-product-checkpoints");
45896
- const buildDbExists = (0, import_node_fs68.existsSync)(import_node_path68.default.join(root, ".build", "build.db"));
45897
- const releaseDir = import_node_path68.default.dirname(linked);
45898
- for (const { target, producers } of stages) {
45899
- if (!options2.project && producers.length === 0 && buildDbExists) {
45900
- const expectedObjects = preparation.nativeStageObjects.get(target);
45901
- if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
45902
- (relative3) => (0, import_node_fs68.statSync)(import_node_path68.default.join(releaseDir, relative3), {
45903
- throwIfNoEntry: false
45904
- })?.isFile()
45905
- ))
45906
- continue;
45907
- }
45908
- const receipt = import_node_path68.default.join(
45909
- checkpoints,
45910
- (0, import_node_crypto42.createHash)("sha256").update(target).digest("hex")
45911
- );
45912
- const headers = producers.map(headerPaths);
45913
- for (const header of headers)
45914
- if ((0, import_node_fs68.existsSync)(header.original)) publishHeader(header);
45915
- const fingerprint = () => {
45916
- const digest2 = (0, import_node_crypto42.createHash)("sha256").update(recipe2);
45917
- for (const { original, emitted } of headers) {
45918
- if (!(0, import_node_fs68.existsSync)(original) || !(0, import_node_fs68.existsSync)(emitted)) return;
45919
- digest2.update(
45920
- (0, import_node_crypto42.createHash)("sha256").update((0, import_node_fs68.readFileSync)(emitted)).digest()
45921
- );
45922
- }
45923
- return digest2.digest("hex");
45924
- };
45925
- if (!options2.project && (0, import_node_fs68.existsSync)(receipt) && (0, import_node_fs68.readFileSync)(receipt, "utf8") === fingerprint())
45926
- continue;
45927
- if (!options2.project) (0, import_node_fs68.rmSync)(receipt, { force: true });
45928
- for (const header of headers) {
45929
- if (!(0, import_node_fs68.existsSync)(header.original))
45930
- (0, import_node_fs68.rmSync)(
45931
- import_node_path68.default.join(
45932
- import_node_path68.default.dirname(linked),
45933
- "Modules",
45934
- `${swiftTargetModuleName(header.producer)}.swiftmodule`
45935
- ),
45936
- { force: true }
45937
- );
45938
- }
45939
- await runCompiler(
45940
- swift,
45941
- [...buildArgs, "--target", target],
45942
- optionsWithCompiler,
45943
- /^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
45944
- SWIFTPM_NOISE
45945
- );
45946
- if (!compiler2) for (const header of headers) publishHeader(header);
45947
- if (!options2.project) {
45948
- const checkpoint = fingerprint();
45949
- if (checkpoint === void 0)
45950
- throw new Error(`missing Swift headers after building ${target}`);
45951
- (0, import_node_fs68.mkdirSync)(checkpoints, { recursive: true });
45952
- (0, import_node_fs68.writeFileSync)(`${receipt}.partial`, checkpoint);
45953
- (0, import_node_fs68.renameSync)(`${receipt}.partial`, receipt);
46200
+ const headers = producers.map(headerPaths);
46201
+ for (const header of headers)
46202
+ if ((0, import_node_fs68.existsSync)(header.original)) publishHeader(header);
46203
+ const fingerprint = () => {
46204
+ const digest2 = (0, import_node_crypto42.createHash)("sha256").update(recipe2);
46205
+ for (const { original, emitted } of headers) {
46206
+ if (!(0, import_node_fs68.existsSync)(original) || !(0, import_node_fs68.existsSync)(emitted)) return;
46207
+ digest2.update(
46208
+ (0, import_node_crypto42.createHash)("sha256").update((0, import_node_fs68.readFileSync)(emitted)).digest()
46209
+ );
45954
46210
  }
46211
+ return digest2.digest("hex");
46212
+ };
46213
+ if (!options2.project && (0, import_node_fs68.existsSync)(receipt) && (0, import_node_fs68.readFileSync)(receipt, "utf8") === fingerprint())
46214
+ continue;
46215
+ if (!options2.project) (0, import_node_fs68.rmSync)(receipt, { force: true });
46216
+ for (const header of headers) {
46217
+ if (!(0, import_node_fs68.existsSync)(header.original))
46218
+ (0, import_node_fs68.rmSync)(
46219
+ import_node_path68.default.join(
46220
+ import_node_path68.default.dirname(linked),
46221
+ "Modules",
46222
+ `${swiftTargetModuleName(header.producer)}.swiftmodule`
46223
+ ),
46224
+ { force: true }
46225
+ );
45955
46226
  }
45956
46227
  await runCompiler(
45957
46228
  swift,
45958
- buildArgs,
46229
+ [...buildArgs, "--target", target],
45959
46230
  optionsWithCompiler,
45960
- SWIFTPM_PROGRESS,
46231
+ /^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
45961
46232
  SWIFTPM_NOISE
45962
46233
  );
45963
- };
45964
- const compileApp = () => preparation.headerCompiler ? withSwiftHeaderCompiler(
45965
- root,
45966
- options2.toolchainBin,
45967
- recipe2,
45968
- new Map(
45969
- preparation.headerBuilds[0].producers.map((producer) => {
45970
- const paths = headerPaths(producer);
45971
- return [
45972
- swiftTargetModuleName(producer),
45973
- {
45974
- header: paths.original,
45975
- publish: () => publishHeader(paths)
45976
- }
45977
- ];
45978
- })
45979
- ),
45980
- runApp
45981
- ) : runApp();
45982
- try {
45983
- if (temporaryDirectory) (0, import_node_fs68.mkdirSync)(temporaryDirectory, { recursive: true });
45984
- await compileApp();
45985
- } catch (error) {
45986
- const output2 = outputOf(error);
45987
- const moduleCache = import_node_path68.default.join(
45988
- root,
45989
- ".build",
45990
- WASM_TRIPLE,
45991
- "release",
45992
- "ModuleCache"
45993
- );
45994
- if (output2.includes("was compiled with module cache path") && (0, import_node_fs68.existsSync)(moduleCache)) {
45995
- (0, import_node_fs68.rmSync)(moduleCache, { recursive: true, force: true });
45996
- try {
45997
- await compileApp();
45998
- } catch (retryError) {
45999
- throw new Error(
46000
- [
46001
- ...unprepared,
46002
- projectDiagnostic(outputOf(retryError), layout2, input.files)
46003
- ].join("\n"),
46004
- { cause: retryError }
46005
- );
46006
- }
46007
- } else {
46234
+ if (!compiler2) for (const header of headers) publishHeader(header);
46235
+ if (!options2.project) {
46236
+ const checkpoint = fingerprint();
46237
+ if (checkpoint === void 0)
46238
+ throw new Error(`missing Swift headers after building ${target}`);
46239
+ (0, import_node_fs68.mkdirSync)(checkpoints, { recursive: true });
46240
+ (0, import_node_fs68.writeFileSync)(`${receipt}.partial`, checkpoint);
46241
+ (0, import_node_fs68.renameSync)(`${receipt}.partial`, receipt);
46242
+ }
46243
+ }
46244
+ await runCompiler(
46245
+ swift,
46246
+ buildArgs,
46247
+ optionsWithCompiler,
46248
+ SWIFTPM_PROGRESS,
46249
+ SWIFTPM_NOISE
46250
+ );
46251
+ };
46252
+ const compileApp = () => preparation.headerCompiler ? withSwiftHeaderCompiler(
46253
+ root2,
46254
+ options2.toolchainBin,
46255
+ recipe2,
46256
+ new Map(
46257
+ preparation.headerBuilds[0].producers.map((producer) => {
46258
+ const paths = headerPaths(producer);
46259
+ return [
46260
+ swiftTargetModuleName(producer),
46261
+ {
46262
+ header: paths.original,
46263
+ publish: () => publishHeader(paths)
46264
+ }
46265
+ ];
46266
+ })
46267
+ ),
46268
+ runApp
46269
+ ) : runApp();
46270
+ try {
46271
+ if (temporaryDirectory) (0, import_node_fs68.mkdirSync)(temporaryDirectory, { recursive: true });
46272
+ await compileApp();
46273
+ } catch (error) {
46274
+ const output2 = outputOf(error);
46275
+ const moduleCache = import_node_path68.default.join(
46276
+ root2,
46277
+ ".build",
46278
+ WASM_TRIPLE,
46279
+ "release",
46280
+ "ModuleCache"
46281
+ );
46282
+ if (output2.includes("was compiled with module cache path") && (0, import_node_fs68.existsSync)(moduleCache)) {
46283
+ (0, import_node_fs68.rmSync)(moduleCache, { recursive: true, force: true });
46284
+ try {
46285
+ await compileApp();
46286
+ } catch (retryError) {
46008
46287
  throw new Error(
46009
- [...unprepared, projectDiagnostic(output2, layout2, input.files)].join(
46010
- "\n"
46011
- ),
46012
- { cause: error }
46288
+ [
46289
+ ...unprepared,
46290
+ projectDiagnostic(outputOf(retryError), layout3, input.files)
46291
+ ].join("\n"),
46292
+ { cause: retryError }
46013
46293
  );
46014
46294
  }
46015
- } finally {
46016
- if (temporaryDirectory)
46017
- (0, import_node_fs68.rmSync)(temporaryDirectory, { recursive: true, force: true });
46018
- if (options2.project) endSwiftProjectProcesses(options2.project);
46019
- }
46020
- if (unprepared.length) throw new Error(unprepared.join("\n"));
46021
- if (!(0, import_node_fs68.existsSync)(linked)) {
46022
- const binDir = import_node_path68.default.dirname(linked);
46023
- const found = (0, import_node_fs68.existsSync)(binDir) ? (0, import_node_fs68.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
46295
+ } else {
46024
46296
  throw new Error(
46025
- `swift-compile: the build produced no ${import_node_path68.default.basename(linked)} (found: ${found.join(", ") || "none"})`
46297
+ [...unprepared, projectDiagnostic(output2, layout3, input.files)].join(
46298
+ "\n"
46299
+ ),
46300
+ { cause: error }
46026
46301
  );
46027
46302
  }
46028
- if (options2.project) removeProjectLinks(root);
46029
- const resourceReferences = Object.values(input.resources ?? {}).map(
46030
- (value) => Buffer.from(value, "base64")
46303
+ } finally {
46304
+ if (temporaryDirectory)
46305
+ (0, import_node_fs68.rmSync)(temporaryDirectory, { recursive: true, force: true });
46306
+ if (options2.project) endSwiftProjectProcesses(options2.project);
46307
+ }
46308
+ if (unprepared.length) throw new Error(unprepared.join("\n"));
46309
+ if (!(0, import_node_fs68.existsSync)(linked)) {
46310
+ const binDir = import_node_path68.default.dirname(linked);
46311
+ const found = (0, import_node_fs68.existsSync)(binDir) ? (0, import_node_fs68.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
46312
+ throw new Error(
46313
+ `swift-compile: the build produced no ${import_node_path68.default.basename(linked)} (found: ${found.join(", ") || "none"})`
46031
46314
  );
46032
- if (!guestGraph)
46033
- pruneSwiftWasmLink(
46034
- root,
46035
- options2.toolchainBin,
46036
- prebuilt?.root ?? frameworkRoot,
46037
- input.staticClangTargets,
46038
- options2.project,
46039
- void 0,
46040
- resourceReferences
46041
- );
46042
- if (options2.linkOnly) {
46043
- if ((0, import_node_fs68.statSync)(linked).size <= 8)
46044
- throw new Error("swift-compile: deferred linker produced no executable");
46045
- report("project link verified");
46046
- return;
46047
- }
46048
- const output = options2.project ? projectOutputFile(root, linked, options2.project) : linked;
46049
- const optimized = `${output}.optimized`;
46050
- if (sdkImage && options2.project) (0, import_node_fs68.rmSync)(optimized, { force: true });
46051
- let sdkAsset;
46052
- if (guestGraph) {
46053
- const binding = await compileGuestLink({
46054
- graph: guestGraph,
46055
- buildDirectory: root,
46056
- releaseDirectory: import_node_path68.default.dirname(linked),
46057
- moduleRoot: frameworkRoot,
46058
- toolchainBin: options2.toolchainBin,
46059
- swiftCompiler: preparation.headerCompiler ? import_node_path68.default.join(root, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path68.default.join(options2.toolchainBin, "swiftc"),
46060
- sysroot: swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot,
46061
- sdk: swiftModuleSdk(frameworkRoot),
46062
- sdkImage,
46063
- compilerDigest: compilerSourceDigest,
46064
- project: options2.project && {
46065
- ...options2.project,
46066
- env: { ...options2.project.env, ...projectProcess?.env }
46067
- },
46068
- staticClangTargets: input.staticClangTargets ?? [],
46069
- resourceReferences,
46070
- resourceBundles: input.resourceBundles ?? [],
46071
- generatedOwners: preparation.generatedOwners,
46072
- output,
46073
- optimized,
46074
- optimize: input.optimize === true,
46075
- jobs: swiftBuildJobs()
46076
- });
46077
- if (sdkImage && binding)
46078
- sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
46079
- } else if (sdkImage) {
46080
- const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
46081
- const binding = await buildSwiftAppModule2({
46082
- buildRoot: root,
46083
- toolchainBin: options2.toolchainBin,
46084
- sdk: sdkImage,
46085
- output: optimized,
46086
- optimize: input.optimize === true,
46087
- project: options2.project && {
46088
- ...options2.project,
46089
- env: { ...options2.project.env, ...projectProcess?.env },
46090
- sdkRoot: import_node_path68.default.dirname(
46091
- swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot
46092
- ),
46093
- linked: output
46094
- }
46095
- });
46096
- sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
46097
- } else {
46098
- const bytes = (0, import_node_fs68.readFileSync)(output);
46099
- const ordered = orderObjCConstructors(bytes);
46100
- if (ordered !== bytes) (0, import_node_fs68.writeFileSync)(output, ordered);
46101
- await lowerWasm(output, optimized, { optimize: input.optimize === true });
46102
- }
46103
- if (!sdkImage)
46104
- await runCompiler(
46105
- import_node_path68.default.join(options2.toolchainBin, "llvm-objcopy"),
46106
- ["--remove-section=.swift1_autolink_entries", optimized],
46107
- buildOptions
46108
- );
46109
- const artifact = {
46110
- hash,
46111
- bytes: (0, import_node_fs68.readFileSync)(optimized),
46112
- icu: await icu,
46113
- sdk: sdkAsset
46114
- };
46115
- if (artifact.bytes.length <= 8)
46315
+ }
46316
+ if (options2.project) removeProjectLinks(root2);
46317
+ const resourceReferences = Object.values(input.resources ?? {}).map(
46318
+ (value) => Buffer.from(value, "base64")
46319
+ );
46320
+ if (!guestGraph)
46321
+ pruneSwiftWasmLink(
46322
+ root2,
46323
+ options2.toolchainBin,
46324
+ prebuilt?.root ?? frameworkRoot,
46325
+ input.staticClangTargets,
46326
+ options2.project,
46327
+ void 0,
46328
+ resourceReferences
46329
+ );
46330
+ if (options2.linkOnly) {
46331
+ if ((0, import_node_fs68.statSync)(linked).size <= 8)
46116
46332
  throw new Error("swift-compile: deferred linker produced no executable");
46117
- if (!options2.project) saveCompiledArtifact(root, artifact);
46118
- saveSharedArtifact(sharedRoot, artifact);
46119
- report("compiled artifact verified");
46120
- return retain(root, artifact);
46121
- } finally {
46122
- readHold?.release();
46333
+ stage("project link verified");
46334
+ return;
46123
46335
  }
46124
- },
46125
- budget.signal
46126
- );
46336
+ const output = options2.project ? projectOutputFile(root2, linked, options2.project) : linked;
46337
+ const optimized = `${output}.optimized`;
46338
+ if (sdkImage && options2.project) (0, import_node_fs68.rmSync)(optimized, { force: true });
46339
+ let sdkAsset;
46340
+ stage("linking the app image");
46341
+ if (guestGraph) {
46342
+ const binding = await compileGuestLink({
46343
+ graph: guestGraph,
46344
+ buildDirectory: root2,
46345
+ releaseDirectory: import_node_path68.default.dirname(linked),
46346
+ moduleRoot: frameworkRoot,
46347
+ toolchainBin: options2.toolchainBin,
46348
+ swiftCompiler: preparation.headerCompiler ? import_node_path68.default.join(root2, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path68.default.join(options2.toolchainBin, "swiftc"),
46349
+ sysroot: swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot,
46350
+ sdk: swiftModuleSdk(frameworkRoot),
46351
+ sdkImage,
46352
+ compilerDigest: compilerSourceDigest,
46353
+ project: options2.project && {
46354
+ ...options2.project,
46355
+ env: { ...options2.project.env, ...projectProcess?.env }
46356
+ },
46357
+ staticClangTargets: input.staticClangTargets ?? [],
46358
+ resourceReferences,
46359
+ resourceBundles: input.resourceBundles ?? [],
46360
+ generatedOwners: preparation.generatedOwners,
46361
+ output,
46362
+ optimized,
46363
+ optimize: input.optimize === true,
46364
+ jobs: swiftBuildJobs(),
46365
+ onStage: stage
46366
+ });
46367
+ if (sdkImage && binding)
46368
+ sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
46369
+ } else if (sdkImage) {
46370
+ const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
46371
+ const binding = await buildSwiftAppModule2({
46372
+ buildRoot: root2,
46373
+ toolchainBin: options2.toolchainBin,
46374
+ sdk: sdkImage,
46375
+ output: optimized,
46376
+ optimize: input.optimize === true,
46377
+ project: options2.project && {
46378
+ ...options2.project,
46379
+ env: { ...options2.project.env, ...projectProcess?.env },
46380
+ sdkRoot: import_node_path68.default.dirname(
46381
+ swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot
46382
+ ),
46383
+ linked: output
46384
+ }
46385
+ });
46386
+ sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
46387
+ } else {
46388
+ const bytes = (0, import_node_fs68.readFileSync)(output);
46389
+ const ordered = orderObjCConstructors(bytes);
46390
+ if (ordered !== bytes) (0, import_node_fs68.writeFileSync)(output, ordered);
46391
+ stage("lowering the app image");
46392
+ await lowerWasm(output, optimized, { optimize: input.optimize === true });
46393
+ }
46394
+ if (!sdkImage)
46395
+ await runCompiler(
46396
+ import_node_path68.default.join(options2.toolchainBin, "llvm-objcopy"),
46397
+ ["--remove-section=.swift1_autolink_entries", optimized],
46398
+ buildOptions
46399
+ );
46400
+ const artifact = {
46401
+ hash,
46402
+ bytes: (0, import_node_fs68.readFileSync)(optimized),
46403
+ icu: await icu,
46404
+ sdk: sdkAsset
46405
+ };
46406
+ if (artifact.bytes.length <= 8)
46407
+ throw new Error("swift-compile: deferred linker produced no executable");
46408
+ if (!options2.project) saveCompiledArtifact(root2, artifact);
46409
+ saveSharedArtifact(sharedRoot, artifact);
46410
+ stage("compiled artifact verified");
46411
+ return retain(baseRoot, artifact);
46412
+ } finally {
46413
+ readHold?.release();
46414
+ }
46415
+ });
46127
46416
  });
46128
46417
  },
46129
46418
  options2.signal
46130
46419
  );
46131
46420
  }
46132
- var import_node_child_process38, import_node_crypto42, import_node_fs68, import_node_os14, import_node_path68, 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;
46421
+ var import_node_child_process38, import_node_crypto42, import_node_fs68, import_node_os14, import_node_path68, 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;
46133
46422
  var init_swift_compile = __esm({
46134
46423
  "src/swift-compile.ts"() {
46135
46424
  "use strict";
@@ -46400,7 +46689,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
46400
46689
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
46401
46690
  MULTI_MANIFEST_VERSION = 76;
46402
46691
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
46403
- compilerSourceDigest = true ? "6fbcbab3535da2f464a19f4d3c1db8a7e4b393927e5158477332f4cc978cc22f" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
46692
+ compilerSourceDigest = true ? "203439fc20df8d328b0c245496fc6db90092265409adb61b593725e82ce837de" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
46404
46693
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
46405
46694
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
46406
46695
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -46824,6 +47113,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
46824
47113
  retainedArtifacts = /* @__PURE__ */ new Map();
46825
47114
  FRAMEWORK_LINK_TARGET = "PeachFrameworkLink";
46826
47115
  frameworkProductsReceiptSchema = v6.object({
47116
+ root: v6.string(),
46827
47117
  modules: v6.string(),
46828
47118
  objects: v6.array(v6.string()),
46829
47119
  lazyObjects: v6.array(v6.string()),
@@ -46840,6 +47130,9 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
46840
47130
  SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS = 4;
46841
47131
  SWIFT_FRAMEWORK_SLOT_KEY = ".peach-framework-key";
46842
47132
  SWIFT_FRAMEWORK_SLOT_ORIGIN = ".peach-framework-origin";
47133
+ SWIFT_FRAMEWORK_SLOT_RELEASE = ".peach-framework-release";
47134
+ SWIFT_BUILD_ROOT_SLOTS = 4;
47135
+ SWIFT_BUILD_ROOT_SHAPE = ".peach-build-shape";
46843
47136
  }
46844
47137
  });
46845
47138
 
@@ -56952,21 +57245,457 @@ end
56952
57245
  });
56953
57246
 
56954
57247
  // src/plist.ts
57248
+ function decodeXmlEntities(text7) {
57249
+ if (!text7.includes("&")) return text7;
57250
+ return text7.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);/g, (full, entity2) => {
57251
+ if (entity2.startsWith("#x") || entity2.startsWith("#X")) {
57252
+ const code = Number.parseInt(entity2.slice(2), 16);
57253
+ return Number.isFinite(code) ? String.fromCodePoint(code) : full;
57254
+ }
57255
+ if (entity2.startsWith("#")) {
57256
+ const code = Number.parseInt(entity2.slice(1), 10);
57257
+ return Number.isFinite(code) ? String.fromCodePoint(code) : full;
57258
+ }
57259
+ return NAMED_ENTITIES[entity2] ?? full;
57260
+ });
57261
+ }
57262
+ function escapeXmlText(text7) {
57263
+ return text7.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
57264
+ }
57265
+ function parseXmlDocument(input) {
57266
+ const source = input.startsWith("\uFEFF") ? input.slice(1) : input;
57267
+ const len = source.length;
57268
+ let pos = 0;
57269
+ const skipIgnorable = () => {
57270
+ while (pos < len) {
57271
+ while (pos < len && /\s/.test(source[pos])) pos++;
57272
+ if (source.startsWith("<!--", pos)) {
57273
+ const end = source.indexOf("-->", pos + 4);
57274
+ if (end === -1) throw new Error("unterminated XML comment");
57275
+ pos = end + 3;
57276
+ continue;
57277
+ }
57278
+ if (source.startsWith("<?", pos)) {
57279
+ const end = source.indexOf("?>", pos + 2);
57280
+ if (end === -1) throw new Error("unterminated XML processing instruction");
57281
+ pos = end + 2;
57282
+ continue;
57283
+ }
57284
+ if (source.startsWith("<!DOCTYPE", pos)) {
57285
+ pos += 9;
57286
+ let depth = 0;
57287
+ let quote3 = "";
57288
+ while (pos < len) {
57289
+ const ch = source[pos];
57290
+ pos++;
57291
+ if (quote3) {
57292
+ if (ch === quote3) quote3 = "";
57293
+ } else if (ch === '"' || ch === "'") {
57294
+ quote3 = ch;
57295
+ } else if (ch === "[") {
57296
+ depth++;
57297
+ } else if (ch === "]") {
57298
+ depth = Math.max(0, depth - 1);
57299
+ } else if (ch === ">" && depth === 0) {
57300
+ break;
57301
+ }
57302
+ }
57303
+ continue;
57304
+ }
57305
+ break;
57306
+ }
57307
+ };
57308
+ const readElement = () => {
57309
+ if (source[pos] !== "<") {
57310
+ throw new Error(`expected XML tag at offset ${pos}`);
57311
+ }
57312
+ pos++;
57313
+ const nameStart = pos;
57314
+ while (pos < len && /[^\s/>]/.test(source[pos])) pos++;
57315
+ const tag = source.slice(nameStart, pos);
57316
+ if (!tag) throw new Error(`empty XML tag name at offset ${nameStart}`);
57317
+ let quote3 = "";
57318
+ let selfClosing = false;
57319
+ while (pos < len) {
57320
+ const ch = source[pos];
57321
+ if (quote3) {
57322
+ pos++;
57323
+ if (ch === quote3) quote3 = "";
57324
+ continue;
57325
+ }
57326
+ if (ch === '"' || ch === "'") {
57327
+ quote3 = ch;
57328
+ pos++;
57329
+ continue;
57330
+ }
57331
+ if (ch === "/" && source[pos + 1] === ">") {
57332
+ selfClosing = true;
57333
+ pos += 2;
57334
+ break;
57335
+ }
57336
+ if (ch === ">") {
57337
+ pos++;
57338
+ break;
57339
+ }
57340
+ pos++;
57341
+ }
57342
+ if (selfClosing) {
57343
+ return { tag, children: [], text: "" };
57344
+ }
57345
+ const children = [];
57346
+ let text7 = "";
57347
+ while (pos < len) {
57348
+ if (source.startsWith("<!--", pos)) {
57349
+ const end2 = source.indexOf("-->", pos + 4);
57350
+ if (end2 === -1) throw new Error("unterminated XML comment");
57351
+ pos = end2 + 3;
57352
+ continue;
57353
+ }
57354
+ if (source.startsWith("<![CDATA[", pos)) {
57355
+ const end2 = source.indexOf("]]>", pos + 9);
57356
+ if (end2 === -1) throw new Error("unterminated CDATA section");
57357
+ text7 += source.slice(pos + 9, end2);
57358
+ pos = end2 + 3;
57359
+ continue;
57360
+ }
57361
+ if (source.startsWith("</", pos)) {
57362
+ pos += 2;
57363
+ const closeStart = pos;
57364
+ while (pos < len && /[^\s>]/.test(source[pos])) pos++;
57365
+ const closeTag = source.slice(closeStart, pos);
57366
+ while (pos < len && /\s/.test(source[pos])) pos++;
57367
+ if (source[pos] !== ">") throw new Error(`malformed closing tag </${closeTag}>`);
57368
+ pos++;
57369
+ if (closeTag !== tag) {
57370
+ throw new Error(`mismatched XML closing tag </${closeTag}> for <${tag}>`);
57371
+ }
57372
+ return { tag, children, text: text7 };
57373
+ }
57374
+ if (source[pos] === "<") {
57375
+ children.push(readElement());
57376
+ continue;
57377
+ }
57378
+ const nextTag = source.indexOf("<", pos);
57379
+ const end = nextTag === -1 ? len : nextTag;
57380
+ text7 += decodeXmlEntities(source.slice(pos, end));
57381
+ pos = end;
57382
+ }
57383
+ throw new Error(`unclosed XML tag <${tag}>`);
57384
+ };
57385
+ skipIgnorable();
57386
+ if (pos >= len) throw new Error("empty XML plist document");
57387
+ return readElement();
57388
+ }
57389
+ function parseXmlPlist(source, options2 = {}) {
57390
+ const root = parseXmlDocument(source);
57391
+ if (root.tag !== "plist") {
57392
+ throw new Error(`expected <plist> root element, got <${root.tag}>`);
57393
+ }
57394
+ if (root.children.length === 0) {
57395
+ if (options2.strict) throw new Error("<plist> element has no root value");
57396
+ return void 0;
57397
+ }
57398
+ if (options2.strict && root.children.length !== 1) {
57399
+ throw new Error("<plist> element must contain exactly one root value");
57400
+ }
57401
+ const leafText = (node) => {
57402
+ if (options2.strict && node.children.length > 0) {
57403
+ throw new Error(`<${node.tag}> must not contain child elements`);
57404
+ }
57405
+ return node.text;
57406
+ };
57407
+ const visit3 = (node) => {
57408
+ switch (node.tag) {
57409
+ case "dict": {
57410
+ const result = {};
57411
+ if (options2.strict && node.children.length % 2 !== 0) {
57412
+ throw new Error("<dict> must contain key/value pairs");
57413
+ }
57414
+ for (let i = 0; i + 1 < node.children.length; i += 2) {
57415
+ const keyNode = node.children[i];
57416
+ if (keyNode.tag !== "key") {
57417
+ throw new Error(`expected <key> in <dict>, got <${keyNode.tag}>`);
57418
+ }
57419
+ result[leafText(keyNode)] = visit3(node.children[i + 1]);
57420
+ }
57421
+ return result;
57422
+ }
57423
+ case "array":
57424
+ return node.children.map(visit3);
57425
+ case "string":
57426
+ return leafText(node);
57427
+ case "integer": {
57428
+ const raw2 = leafText(node).trim();
57429
+ if (options2.onInteger) return options2.onInteger(raw2);
57430
+ if (!raw2) throw new Error("empty <integer> element");
57431
+ return Number.parseInt(raw2, 10);
57432
+ }
57433
+ case "real": {
57434
+ const raw2 = leafText(node).trim();
57435
+ if (options2.onReal) return options2.onReal(raw2);
57436
+ if (!raw2) throw new Error("empty <real> element");
57437
+ return Number.parseFloat(raw2);
57438
+ }
57439
+ case "true":
57440
+ return true;
57441
+ case "false":
57442
+ return false;
57443
+ case "data":
57444
+ return Buffer.from(leafText(node).replace(/\s+/g, ""), "base64");
57445
+ case "date":
57446
+ return new Date(leafText(node).trim());
57447
+ default:
57448
+ throw new Error(`unsupported plist element ${node.tag}`);
57449
+ }
57450
+ };
57451
+ return visit3(root.children[0]);
57452
+ }
57453
+ function parsePlist(source) {
57454
+ const root = parseXmlDocument(source);
57455
+ if (root.tag !== "plist") {
57456
+ throw new Error(`expected <plist> root element, got <${root.tag}>`);
57457
+ }
57458
+ if (root.children.length === 0) return {};
57459
+ const visit3 = (node) => {
57460
+ switch (node.tag) {
57461
+ case "dict": {
57462
+ const result = {};
57463
+ for (let i = 0; i + 1 < node.children.length; i += 2) {
57464
+ const keyNode = node.children[i];
57465
+ if (keyNode.tag !== "key") {
57466
+ throw new Error(`expected <key> in <dict>, got <${keyNode.tag}>`);
57467
+ }
57468
+ result[keyNode.text] = visit3(node.children[i + 1]);
57469
+ }
57470
+ return result;
57471
+ }
57472
+ case "array":
57473
+ return node.children.map(visit3);
57474
+ case "string":
57475
+ return node.text;
57476
+ case "integer": {
57477
+ const raw2 = node.text.trim();
57478
+ if (!raw2) throw new Error("empty <integer> element");
57479
+ return Number.parseInt(raw2, 10);
57480
+ }
57481
+ case "real": {
57482
+ const raw2 = node.text.trim();
57483
+ if (!raw2) throw new Error("empty <real> element");
57484
+ return Number.parseFloat(raw2);
57485
+ }
57486
+ case "true":
57487
+ return true;
57488
+ case "false":
57489
+ return false;
57490
+ case "data":
57491
+ return Buffer.from(node.text.replace(/\s+/g, ""), "base64");
57492
+ case "date":
57493
+ return new Date(node.text.trim());
57494
+ default:
57495
+ throw new Error(`unsupported plist element ${node.tag}`);
57496
+ }
57497
+ };
57498
+ return visit3(root.children[0]);
57499
+ }
56955
57500
  function parsePlistSource(source) {
56956
- return import_plist.default.parse(source);
57501
+ return parseXmlPlist(source);
57502
+ }
57503
+ function renderValue(value, indent2) {
57504
+ if (value === void 0 || value === null) return null;
57505
+ if (typeof value === "string") {
57506
+ return `${indent2}<string>${escapeXmlText(value)}</string>`;
57507
+ }
57508
+ if (typeof value === "boolean") {
57509
+ return `${indent2}${value ? "<true/>" : "<false/>"}`;
57510
+ }
57511
+ if (typeof value === "number") {
57512
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
57513
+ return `${indent2}<integer>${value}</integer>`;
57514
+ }
57515
+ return `${indent2}<real>${value}</real>`;
57516
+ }
57517
+ if (value instanceof Date) {
57518
+ return `${indent2}<date>${value.toISOString().replace(/\.\d{3}Z$/, "Z")}</date>`;
57519
+ }
57520
+ if (Buffer.isBuffer(value) || value instanceof Uint8Array) {
57521
+ const encoded = Buffer.from(value).toString("base64");
57522
+ return encoded ? `${indent2}<data>${encoded}</data>` : `${indent2}<data/>`;
57523
+ }
57524
+ if (Array.isArray(value)) {
57525
+ const items2 = value.map((entry) => renderValue(entry, `${indent2} `)).filter((entry) => entry !== null);
57526
+ if (items2.length === 0) return `${indent2}<array/>`;
57527
+ return `${indent2}<array>
57528
+ ${items2.join("\n")}
57529
+ ${indent2}</array>`;
57530
+ }
57531
+ if (typeof value === "object") {
57532
+ const lines = [];
57533
+ for (const [key2, entry] of Object.entries(value)) {
57534
+ const rendered = renderValue(entry, `${indent2} `);
57535
+ if (rendered === null) continue;
57536
+ lines.push(`${indent2} <key>${escapeXmlText(key2)}</key>`);
57537
+ lines.push(rendered);
57538
+ }
57539
+ if (lines.length === 0) return `${indent2}<dict/>`;
57540
+ return `${indent2}<dict>
57541
+ ${lines.join("\n")}
57542
+ ${indent2}</dict>`;
57543
+ }
57544
+ throw new Error(`unsupported plist value type: ${typeof value}`);
57545
+ }
57546
+ function buildPlist(value) {
57547
+ const body = renderValue(value, " ");
57548
+ return [
57549
+ '<?xml version="1.0" encoding="UTF-8"?>',
57550
+ '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
57551
+ '<plist version="1.0">',
57552
+ ...body ? [body] : [],
57553
+ "</plist>",
57554
+ ""
57555
+ ].join("\n");
56957
57556
  }
56958
- var import_plist;
57557
+ var NAMED_ENTITIES;
56959
57558
  var init_plist = __esm({
56960
57559
  "src/plist.ts"() {
56961
57560
  "use strict";
56962
- import_plist = __toESM(require("peachsim/vendor/plist"), 1);
57561
+ NAMED_ENTITIES = {
57562
+ amp: "&",
57563
+ lt: "<",
57564
+ gt: ">",
57565
+ quot: '"',
57566
+ apos: "'"
57567
+ };
56963
57568
  }
56964
57569
  });
56965
57570
 
56966
57571
  // src/plist-bytes.ts
57572
+ function defaultInteger(value) {
57573
+ return value >= BigInt(Number.MIN_SAFE_INTEGER) && value <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(value) : value;
57574
+ }
57575
+ function parseBinaryPlist(source, options2 = {}) {
57576
+ const bytes = Buffer.isBuffer(source) ? source : Buffer.from(source);
57577
+ (0, import_strict.default)(bytes.length >= 40, "binary plist is too short");
57578
+ (0, import_strict.default)(bytes.toString("ascii", 0, 8) === "bplist00", "invalid binary plist header");
57579
+ const trailer = bytes.length - 32;
57580
+ const offsetWidth = bytes[trailer + 6];
57581
+ const refWidth = bytes[trailer + 7];
57582
+ (0, import_strict.default)(offsetWidth > 0 && offsetWidth <= 8 && refWidth > 0 && refWidth <= 8);
57583
+ const count = Number(bytes.readBigUInt64BE(trailer + 8));
57584
+ const root = Number(bytes.readBigUInt64BE(trailer + 16));
57585
+ const table = Number(bytes.readBigUInt64BE(trailer + 24));
57586
+ (0, import_strict.default)(
57587
+ table >= 8 && table < trailer && count > 0 && count <= (trailer - table) / offsetWidth
57588
+ );
57589
+ const unsigned = (at, width) => {
57590
+ (0, import_strict.default)(at >= 8 && at + width <= trailer);
57591
+ let result = 0n;
57592
+ for (let i = at; i < at + width; i++) result = result * 256n + BigInt(bytes[i]);
57593
+ return result;
57594
+ };
57595
+ const cache = /* @__PURE__ */ new Map();
57596
+ const visiting = /* @__PURE__ */ new Set();
57597
+ const visit3 = (ref) => {
57598
+ (0, import_strict.default)(ref >= 0 && ref < count && !visiting.has(ref));
57599
+ if (cache.has(ref)) return cache.get(ref);
57600
+ visiting.add(ref);
57601
+ const at = Number(unsigned(table + ref * offsetWidth, offsetWidth));
57602
+ (0, import_strict.default)(at >= 8 && at < table);
57603
+ const marker = bytes[at];
57604
+ const type = marker >> 4;
57605
+ let length = marker & 15;
57606
+ let data = at + 1;
57607
+ if (length === 15 && [4, 5, 6, 7, 10, 12, 13].includes(type)) {
57608
+ (0, import_strict.default)(data < table && bytes[data] >> 4 === 1);
57609
+ const width = 2 ** (bytes[data] & 15);
57610
+ (0, import_strict.default)(width <= 8 && data + 1 + width <= table);
57611
+ length = Number(unsigned(data + 1, width));
57612
+ data += 1 + width;
57613
+ }
57614
+ const end = (size2) => {
57615
+ (0, import_strict.default)(Number.isSafeInteger(size2) && data + size2 <= table);
57616
+ return data + size2;
57617
+ };
57618
+ const references = (total) => {
57619
+ end(total * refWidth);
57620
+ return Array.from(
57621
+ { length: total },
57622
+ (_, i) => visit3(Number(unsigned(data + i * refWidth, refWidth)))
57623
+ );
57624
+ };
57625
+ let value;
57626
+ switch (type) {
57627
+ case 0:
57628
+ if (!options2.strict && marker === 0) {
57629
+ value = null;
57630
+ break;
57631
+ }
57632
+ (0, import_strict.default)(marker === 8 || marker === 9);
57633
+ value = marker === 9;
57634
+ break;
57635
+ case 1: {
57636
+ const size2 = 2 ** length;
57637
+ (0, import_strict.default)(size2 <= 16);
57638
+ end(size2);
57639
+ const raw2 = unsigned(data, size2);
57640
+ const signed = size2 >= 8 ? BigInt.asIntN(size2 * 8, raw2) : raw2;
57641
+ value = options2.onInteger ? options2.onInteger(signed) : defaultInteger(signed);
57642
+ break;
57643
+ }
57644
+ case 2: {
57645
+ (0, import_strict.default)(length === 2 || length === 3);
57646
+ end(2 ** length);
57647
+ const real = length === 2 ? bytes.readFloatBE(data) : bytes.readDoubleBE(data);
57648
+ value = options2.onReal ? options2.onReal(real) : real;
57649
+ break;
57650
+ }
57651
+ case 3:
57652
+ (0, import_strict.default)(length === 3);
57653
+ end(8);
57654
+ value = new Date(Date.UTC(2001, 0, 1) + bytes.readDoubleBE(data) * 1e3);
57655
+ break;
57656
+ case 4:
57657
+ value = bytes.subarray(data, end(length));
57658
+ break;
57659
+ case 5:
57660
+ value = bytes.toString("ascii", data, end(length));
57661
+ break;
57662
+ case 6:
57663
+ value = Buffer.from(bytes.subarray(data, end(length * 2))).swap16().toString("utf16le");
57664
+ break;
57665
+ case 7:
57666
+ value = bytes.toString("utf8", data, end(length));
57667
+ break;
57668
+ case 8: {
57669
+ if (options2.strict) throw new Error(`unsupported binary plist type ${type}`);
57670
+ const size2 = length + 1;
57671
+ (0, import_strict.default)(size2 >= 1 && size2 <= 8);
57672
+ end(size2);
57673
+ value = { UID: Number(unsigned(data, size2)) };
57674
+ break;
57675
+ }
57676
+ case 10:
57677
+ case 12:
57678
+ value = references(length);
57679
+ break;
57680
+ case 13: {
57681
+ const elements = references(length * 2);
57682
+ const keys = elements.slice(0, length);
57683
+ (0, import_strict.default)(keys.every((key2) => typeof key2 === "string"));
57684
+ value = Object.fromEntries(keys.map((key2, i) => [key2, elements[length + i]]));
57685
+ break;
57686
+ }
57687
+ default:
57688
+ throw new Error(`unsupported binary plist type ${type}`);
57689
+ }
57690
+ visiting.delete(ref);
57691
+ cache.set(ref, value);
57692
+ return value;
57693
+ };
57694
+ return visit3(root);
57695
+ }
56967
57696
  function parsePlistBytes(source, parseXml2 = parsePlistSource) {
56968
57697
  const bytes = Buffer.from(source);
56969
- return bytes.subarray(0, 8).toString("ascii") === "bplist00" ? import_bplist_parser.default.parseBuffer(bytes)[0] : parseXml2(bytes.toString("utf8"));
57698
+ return bytes.subarray(0, 8).toString("ascii") === "bplist00" ? parseBinaryPlist(bytes) : parseXml2(bytes.toString("utf8"));
56970
57699
  }
56971
57700
  function buildBinaryPlist(top) {
56972
57701
  const nodes = [];
@@ -57052,11 +57781,11 @@ function buildBinaryPlist(top) {
57052
57781
  trailer
57053
57782
  ]);
57054
57783
  }
57055
- var import_bplist_parser, isList, isUid;
57784
+ var import_strict, isList, isUid;
57056
57785
  var init_plist_bytes = __esm({
57057
57786
  "src/plist-bytes.ts"() {
57058
57787
  "use strict";
57059
- import_bplist_parser = __toESM(require("peachsim/vendor/bplist-parser"), 1);
57788
+ import_strict = __toESM(require("node:assert/strict"), 1);
57060
57789
  init_plist();
57061
57790
  isList = (value) => Array.isArray(value);
57062
57791
  isUid = (value) => typeof value === "object" && !isList(value) && !Buffer.isBuffer(value) && Object.keys(value).length === 1 && typeof value["CF$UID"] === "number";
@@ -57251,10 +57980,10 @@ var init_pods_files = __esm({
57251
57980
  constructor(targetName, path116) {
57252
57981
  this.targetName = targetName;
57253
57982
  this.path = path116;
57254
- const plist6 = parsePlistBytes(import_node_fs74.default.readFileSync(`${path116}/Info.plist`));
57255
- if (!isRecord(plist6) || !Array.isArray(plist6.AvailableLibraries))
57983
+ const plist2 = parsePlistBytes(import_node_fs74.default.readFileSync(`${path116}/Info.plist`));
57984
+ if (!isRecord(plist2) || !Array.isArray(plist2.AvailableLibraries))
57256
57985
  throw new Error(`${path116}/Info.plist declares no AvailableLibraries`);
57257
- this.slices = plist6.AvailableLibraries.map((library) => {
57986
+ this.slices = plist2.AvailableLibraries.map((library) => {
57258
57987
  if (!isRecord(library) || typeof library.LibraryIdentifier !== "string" || typeof library.LibraryPath !== "string" || typeof library.SupportedPlatform !== "string")
57259
57988
  throw new Error(`${path116}/Info.plist has an invalid library entry`);
57260
57989
  const root = `${path116}/${library.LibraryIdentifier}`;
@@ -65000,7 +65729,7 @@ ${published2.map(
65000
65729
  const contents2 = new Map([
65001
65730
  [
65002
65731
  "Info.plist",
65003
- import_plist3.default.build({
65732
+ buildPlist({
65004
65733
  AvailableLibraries: [
65005
65734
  {
65006
65735
  LibraryIdentifier: "ios-arm64-simulator",
@@ -65085,7 +65814,7 @@ ${published2.map(
65085
65814
  const infoPlistReady = infoPlistFiles.every((file) => import_node_fs80.default.existsSync(file));
65086
65815
  const info = {};
65087
65816
  for (const file of infoPlistReady ? infoPlistFiles : []) {
65088
- const fragment = import_plist3.default.parse(import_node_fs80.default.readFileSync(file, "utf8"));
65817
+ const fragment = parsePlist(import_node_fs80.default.readFileSync(file, "utf8"));
65089
65818
  if (!fragment || typeof fragment !== "object" || Array.isArray(fragment) || fragment instanceof Date || Buffer.isBuffer(fragment))
65090
65819
  throw new Error(`${file} is not a plist dictionary`);
65091
65820
  for (const [key2, value] of Object.entries(fragment)) {
@@ -65154,7 +65883,7 @@ ${published2.map(
65154
65883
  rootDir: root,
65155
65884
  projectFiles: buildFiles.sort(),
65156
65885
  projectDirs: [root],
65157
- infoPlist: infoPlistReady ? import_plist3.default.build(info) : null,
65886
+ infoPlist: infoPlistReady ? buildPlist(info) : null,
65158
65887
  infoPlistFile: null,
65159
65888
  postBundleScripts: [],
65160
65889
  appIconName: "",
@@ -65206,7 +65935,7 @@ function shellTokens(options2) {
65206
65935
  return words2;
65207
65936
  });
65208
65937
  }
65209
- var import_node_child_process41, import_node_crypto46, import_node_fs80, import_node_os16, import_node_path81, import_plist3, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER4, PRODUCTS, graphs, CLANG_CONFIGURATION_FLAGS, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
65938
+ var import_node_child_process41, import_node_crypto46, import_node_fs80, import_node_os16, import_node_path81, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER4, PRODUCTS, graphs, CLANG_CONFIGURATION_FLAGS, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
65210
65939
  var init_bazel_project = __esm({
65211
65940
  "src/bazel-project.ts"() {
65212
65941
  "use strict";
@@ -65215,8 +65944,8 @@ var init_bazel_project = __esm({
65215
65944
  import_node_fs80 = __toESM(require("node:fs"), 1);
65216
65945
  import_node_os16 = __toESM(require("node:os"), 1);
65217
65946
  import_node_path81 = __toESM(require("node:path"), 1);
65218
- import_plist3 = __toESM(require("peachsim/vendor/plist"), 1);
65219
65947
  init_is_record();
65948
+ init_plist();
65220
65949
  LIBRARY_RULES = /* @__PURE__ */ new Set(["swift_library", "objc_library", "cc_library"]);
65221
65950
  QUERIED_RULES = [
65222
65951
  "swift_library",
@@ -65979,23 +66708,23 @@ function isNativeAppIdentity(value) {
65979
66708
  if (platform === "android" && !/^[1-9][0-9]*$/.test(buildVersion)) return false;
65980
66709
  return true;
65981
66710
  }
65982
- function readGoogleSignInConfiguration(plist6, resources) {
66711
+ function readGoogleSignInConfiguration(plist2, resources) {
65983
66712
  const clientIds = {};
65984
66713
  for (const [file, value] of Object.entries(resources)) {
65985
66714
  if (isRecord(value) && typeof value.CLIENT_ID === "string")
65986
66715
  clientIds[file.split("/").pop()?.replace(/\.plist$/, "") ?? file] = value.CLIENT_ID;
65987
66716
  }
65988
66717
  const urlSchemes = [];
65989
- for (const entry of Array.isArray(plist6.CFBundleURLTypes) ? plist6.CFBundleURLTypes : []) {
66718
+ for (const entry of Array.isArray(plist2.CFBundleURLTypes) ? plist2.CFBundleURLTypes : []) {
65990
66719
  if (!isRecord(entry) || !Array.isArray(entry.CFBundleURLSchemes)) continue;
65991
66720
  for (const scheme of entry.CFBundleURLSchemes)
65992
66721
  if (typeof scheme === "string") urlSchemes.push(scheme);
65993
66722
  }
65994
66723
  return {
65995
- clientId: plist6.GIDClientID,
65996
- serverClientId: plist6.GIDServerClientID,
65997
- hostedDomain: plist6.GIDHostedDomain,
65998
- openIDRealm: plist6.GIDOpenIDRealm,
66724
+ clientId: plist2.GIDClientID,
66725
+ serverClientId: plist2.GIDServerClientID,
66726
+ hostedDomain: plist2.GIDHostedDomain,
66727
+ openIDRealm: plist2.GIDOpenIDRealm,
65999
66728
  urlSchemes,
66000
66729
  clientIds
66001
66730
  };
@@ -66139,7 +66868,7 @@ var init_provenance = __esm({
66139
66868
  import_node_crypto48 = require("node:crypto");
66140
66869
  import_node_fs82 = require("node:fs");
66141
66870
  import_node_path83 = require("node:path");
66142
- 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_path83.join)(__sootsim_import_meta_dirname, ".."));
66871
+ 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_path83.join)(__sootsim_import_meta_dirname, ".."));
66143
66872
  }
66144
66873
  });
66145
66874
 
@@ -68092,13 +68821,13 @@ function intentModelVersion(value) {
68092
68821
  return value === "1.0" || value === "1.1" ? value : "1.2";
68093
68822
  }
68094
68823
  function modelList(value, key2) {
68095
- (0, import_strict.default)(value && typeof value === "object");
68824
+ (0, import_strict2.default)(value && typeof value === "object");
68096
68825
  const entries2 = Reflect.get(value, key2) ?? [];
68097
- (0, import_strict.default)(Array.isArray(entries2));
68826
+ (0, import_strict2.default)(Array.isArray(entries2));
68098
68827
  return entries2;
68099
68828
  }
68100
68829
  function identifier(value) {
68101
- (0, import_strict.default)(
68830
+ (0, import_strict2.default)(
68102
68831
  typeof value === "string" && /^[_\p{ID_Start}][_\p{ID_Continue}]*$/u.test(value),
68103
68832
  `invalid intent identifier ${String(value)}`
68104
68833
  );
@@ -68106,18 +68835,18 @@ function identifier(value) {
68106
68835
  }
68107
68836
  function intentClassIdentifier(value) {
68108
68837
  const name3 = identifier(value);
68109
- (0, import_strict.default)(/^[A-Za-z_0-9]+$/.test(name3), `invalid intent class name ${name3}`);
68838
+ (0, import_strict2.default)(/^[A-Za-z_0-9]+$/.test(name3), `invalid intent class name ${name3}`);
68110
68839
  return name3;
68111
68840
  }
68112
68841
  function readSwiftField(value, key2, customTypes) {
68113
- (0, import_strict.default)(value && typeof value === "object");
68842
+ (0, import_strict2.default)(value && typeof value === "object");
68114
68843
  const get = (property) => Reflect.get(value, key2 + property);
68115
68844
  const name3 = identifier(get("Name"));
68116
68845
  let kind = intentParameterKind(get("Type"));
68117
68846
  let enumeration = get("EnumType");
68118
68847
  let object8 = get("ObjectType");
68119
- (0, import_strict.default)(enumeration === void 0 || kind === "Integer");
68120
- (0, import_strict.default)(object8 === void 0 || kind === "Object");
68848
+ (0, import_strict2.default)(enumeration === void 0 || kind === "Integer");
68849
+ (0, import_strict2.default)(object8 === void 0 || kind === "Object");
68121
68850
  const custom = enumeration ?? object8;
68122
68851
  let customName;
68123
68852
  if (custom !== void 0) {
@@ -68132,7 +68861,7 @@ function readSwiftField(value, key2, customTypes) {
68132
68861
  }
68133
68862
  } else {
68134
68863
  customName = customTypes.get(name4);
68135
- (0, import_strict.default)(customName, "unknown intent parameter type: " + name4);
68864
+ (0, import_strict2.default)(customName, "unknown intent parameter type: " + name4);
68136
68865
  }
68137
68866
  }
68138
68867
  const type = types.get(kind);
@@ -68142,7 +68871,7 @@ function readSwiftField(value, key2, customTypes) {
68142
68871
  const valueType = multiple ? `[${array8}]` : base;
68143
68872
  const resolves = get("SupportsResolution") === true;
68144
68873
  const explicitReasons = modelList(value, key2 + "UnsupportedReasons").map((entry) => {
68145
- (0, import_strict.default)(entry && typeof entry === "object");
68874
+ (0, import_strict2.default)(entry && typeof entry === "object");
68146
68875
  return identifier(Reflect.get(entry, key2 + "UnsupportedReasonCode"));
68147
68876
  });
68148
68877
  const defaults = resolves && !customName ? defaultUnsupportedReasons(kind) : [];
@@ -68233,18 +68962,18 @@ fatalError()
68233
68962
  }
68234
68963
  function customObjectFields(definition2, customTypes) {
68235
68964
  return modelList(definition2, "INTypeProperties").filter((entry) => {
68236
- (0, import_strict.default)(entry && typeof entry === "object");
68965
+ (0, import_strict2.default)(entry && typeof entry === "object");
68237
68966
  return Reflect.get(entry, "INTypePropertyDefault") !== true;
68238
68967
  }).map((entry) => {
68239
68968
  const field = readSwiftField(entry, "INTypeProperty", customTypes);
68240
68969
  return { ...field, availability: field.availability ?? swiftResolutionAvailable };
68241
68970
  });
68242
68971
  }
68243
- var import_strict, swiftAvailable, swiftResolutionAvailable, swiftOptionsAvailable, upper, iOS13, numericReasons, builtin2, types;
68972
+ var import_strict2, swiftAvailable, swiftResolutionAvailable, swiftOptionsAvailable, upper, iOS13, numericReasons, builtin2, types;
68244
68973
  var init_fields = __esm({
68245
68974
  "src/intent-definition/fields.ts"() {
68246
68975
  "use strict";
68247
- import_strict = __toESM(require("node:assert/strict"), 1);
68976
+ import_strict2 = __toESM(require("node:assert/strict"), 1);
68248
68977
  init_system_types();
68249
68978
  swiftAvailable = "@available(iOS 12.0, macOS 11.0, watchOS 5.0, *) @available(tvOS, unavailable)";
68250
68979
  swiftResolutionAvailable = "@available(iOS 13.0, macOS 11.0, watchOS 6.0, *)";
@@ -68419,7 +69148,7 @@ function intentHashInput(root, propertyTypes = []) {
68419
69148
  integer2(18, BigInt(value.length));
68420
69149
  for (const item of value) append(item);
68421
69150
  } else {
68422
- (0, import_strict2.default)(
69151
+ (0, import_strict3.default)(
68423
69152
  value && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype
68424
69153
  );
68425
69154
  const keys = Object.keys(value).sort();
@@ -68434,11 +69163,11 @@ function intentHashInput(root, propertyTypes = []) {
68434
69163
  for (const propertyType of propertyTypes) append(propertyType);
68435
69164
  return Buffer.concat(chunks);
68436
69165
  }
68437
- var import_strict2, IntentReal;
69166
+ var import_strict3, IntentReal;
68438
69167
  var init_hash_input = __esm({
68439
69168
  "src/intent-definition/hash-input.ts"() {
68440
69169
  "use strict";
68441
- import_strict2 = __toESM(require("node:assert/strict"), 1);
69170
+ import_strict3 = __toESM(require("node:assert/strict"), 1);
68442
69171
  IntentReal = class {
68443
69172
  constructor(value) {
68444
69173
  this.value = value;
@@ -68498,7 +69227,7 @@ function dictionary(value) {
68498
69227
  }
68499
69228
  function normalizedEnums(input) {
68500
69229
  return modelList(input, "INEnums").map((value) => {
68501
- (0, import_strict3.default)(dictionary(value));
69230
+ (0, import_strict4.default)(dictionary(value));
68502
69231
  return {
68503
69232
  ...value,
68504
69233
  INEnumName: intentClassIdentifier(value.INEnumName),
@@ -68516,7 +69245,7 @@ function localizationIdentifier(field, key2) {
68516
69245
  }
68517
69246
  function normalizedMetadata(type, source, field) {
68518
69247
  const defaults = typeMetadata.get(type) ?? {};
68519
- (0, import_strict3.default)(source === void 0 || dictionary(source));
69248
+ (0, import_strict4.default)(source === void 0 || dictionary(source));
68520
69249
  const metadata = source ? { ...source } : Object.fromEntries(
68521
69250
  Object.entries(defaults).map(([key2, value]) => {
68522
69251
  const qualified2 = `INIntentParameterMetadata${key2}`;
@@ -68540,7 +69269,7 @@ function normalizedMetadata(type, source, field) {
68540
69269
  function normalizedReasons(parameter, kind, field) {
68541
69270
  const reasons = /* @__PURE__ */ new Map();
68542
69271
  for (const reason of modelList(parameter, "INIntentParameterUnsupportedReasons")) {
68543
- (0, import_strict3.default)(dictionary(reason));
69272
+ (0, import_strict4.default)(dictionary(reason));
68544
69273
  const code = identifier(reason.INIntentParameterUnsupportedReasonCode);
68545
69274
  const text7 = reason.INIntentParameterUnsupportedReasonFormatString;
68546
69275
  reasons.set(
@@ -68577,17 +69306,17 @@ function compileIntentMetadata(input, enums, prefix) {
68577
69306
  }
68578
69307
  const objectHashes = /* @__PURE__ */ new Map();
68579
69308
  for (const declaration of modelList(input, "INTypes")) {
68580
- (0, import_strict3.default)(dictionary(declaration) && typeof declaration.INTypeName === "string");
69309
+ (0, import_strict4.default)(dictionary(declaration) && typeof declaration.INTypeName === "string");
68581
69310
  objectHashes.set(declaration.INTypeName, intentSipHash(intentHashInput(declaration)));
68582
69311
  }
68583
69312
  const intents = modelList(input, "INIntents").map((value) => {
68584
- (0, import_strict3.default)(dictionary(value));
69313
+ (0, import_strict4.default)(dictionary(value));
68585
69314
  const name3 = intentClassIdentifier(value.INIntentName);
68586
69315
  const system = value.INIntentType === "System";
68587
69316
  const propertyTypes = [];
68588
69317
  const parameters = modelList(value, "INIntentParameters").map(
68589
69318
  (parameter, position) => {
68590
- (0, import_strict3.default)(dictionary(parameter));
69319
+ (0, import_strict4.default)(dictionary(parameter));
68591
69320
  const enumName = parameter.INIntentParameterEnumType;
68592
69321
  const objectName = parameter.INIntentParameterObjectType;
68593
69322
  const reference = enumName ?? objectName;
@@ -68614,7 +69343,7 @@ function compileIntentMetadata(input, enums, prefix) {
68614
69343
  }
68615
69344
  } else {
68616
69345
  const localHash = hashes.get(typeName);
68617
- (0, import_strict3.default)(localHash !== void 0, `unknown intent parameter type: ${typeName}`);
69346
+ (0, import_strict4.default)(localHash !== void 0, `unknown intent parameter type: ${typeName}`);
68618
69347
  hash2 = localHash;
68619
69348
  }
68620
69349
  }
@@ -68640,7 +69369,7 @@ function compileIntentMetadata(input, enums, prefix) {
68640
69369
  if (parameter.INIntentParameterSupportsMultipleValues && parameter.INIntentParameterFixedSizeArray) {
68641
69370
  const sizes = /* @__PURE__ */ new Map();
68642
69371
  for (const size2 of modelList(parameter, "INIntentParameterArraySizes")) {
68643
- (0, import_strict3.default)(
69372
+ (0, import_strict4.default)(
68644
69373
  dictionary(size2) && typeof size2.INIntentParameterArraySizeSizeClass === "string"
68645
69374
  );
68646
69375
  sizes.set(size2.INIntentParameterArraySizeSizeClass, size2);
@@ -68764,7 +69493,7 @@ function formatPlistReal(value) {
68764
69493
  return `${sign}${digits.slice(0, point)}.${digits.slice(point)}`;
68765
69494
  }
68766
69495
  function writeIntentDefinition(input, prefix) {
68767
- (0, import_strict3.default)(dictionary(input));
69496
+ (0, import_strict4.default)(dictionary(input));
68768
69497
  const escape2 = (text7) => text7.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
68769
69498
  const lines = [
68770
69499
  '<?xml version="1.0" encoding="UTF-8"?>',
@@ -68801,7 +69530,7 @@ function writeIntentDefinition(input, prefix) {
68801
69530
  lines.push(`${indent2}</array>`);
68802
69531
  }
68803
69532
  } else {
68804
- (0, import_strict3.default)(dictionary(value));
69533
+ (0, import_strict4.default)(dictionary(value));
68805
69534
  const keys = Object.keys(value).sort();
68806
69535
  if (keys.length === 0) lines.push(`${indent2}<dict/>`);
68807
69536
  else {
@@ -68833,11 +69562,11 @@ function writeIntentDefinition(input, prefix) {
68833
69562
  lines.push("</plist>", "");
68834
69563
  return lines.join("\n");
68835
69564
  }
68836
- var import_strict3, import_node_crypto51, typeMetadata, initializeMetadata, widgetArraySizes, defaultReasonMessages;
69565
+ var import_strict4, import_node_crypto51, typeMetadata, initializeMetadata, widgetArraySizes, defaultReasonMessages;
68837
69566
  var init_metadata = __esm({
68838
69567
  "src/intent-definition/metadata.ts"() {
68839
69568
  "use strict";
68840
- import_strict3 = __toESM(require("node:assert/strict"), 1);
69569
+ import_strict4 = __toESM(require("node:assert/strict"), 1);
68841
69570
  import_node_crypto51 = require("node:crypto");
68842
69571
  init_fields();
68843
69572
  init_hash_input();
@@ -68908,175 +69637,34 @@ function safeNumber(value) {
68908
69637
  function xmlPlist2(bytes) {
68909
69638
  const encoding = bytes[0] === 255 && bytes[1] === 254 ? "utf-16le" : bytes[0] === 254 && bytes[1] === 255 ? "utf-16be" : "utf-8";
68910
69639
  const text7 = new TextDecoder(encoding, { fatal: true }).decode(bytes);
68911
- const document = new import_xmldom.DOMParser({
68912
- onError(_level, message) {
68913
- throw new Error(message);
68914
- }
68915
- }).parseFromString(text7, "application/xml");
68916
- const children = (element) => Array.from(element.children);
68917
- const contents2 = (element) => {
68918
- (0, import_strict4.default)(element.children.length === 0);
68919
- return element.textContent ?? "";
68920
- };
68921
- const visit3 = (element) => {
68922
- switch (element.tagName) {
68923
- case "dict": {
68924
- const entries2 = children(element);
68925
- (0, import_strict4.default)(entries2.length % 2 === 0);
68926
- const pairs2 = [];
68927
- for (let i = 0; i < entries2.length; i += 2) {
68928
- const key2 = entries2[i];
68929
- (0, import_strict4.default)(key2.tagName === "key");
68930
- pairs2.push([contents2(key2), visit3(entries2[i + 1])]);
68931
- }
68932
- return Object.fromEntries(pairs2);
68933
- }
68934
- case "array":
68935
- return children(element).map(visit3);
68936
- case "string":
68937
- return contents2(element);
68938
- case "integer": {
68939
- const value = contents2(element).trim();
68940
- (0, import_strict4.default)(value.length > 0);
68941
- return safeNumber(BigInt(value));
68942
- }
68943
- case "real": {
68944
- const value = contents2(element).trim();
68945
- (0, import_strict4.default)(value.length > 0);
68946
- return new IntentReal(
68947
- /^[+-]?inf(?:inity)?$/i.test(value) ? value.startsWith("-") ? -Infinity : Infinity : Number(value)
68948
- );
68949
- }
68950
- case "true":
68951
- return true;
68952
- case "false":
68953
- return false;
68954
- case "data":
68955
- return Buffer.from(contents2(element), "base64");
68956
- case "date":
68957
- return new Date(contents2(element));
68958
- default:
68959
- throw new Error(`unsupported plist element ${element.tagName}`);
68960
- }
68961
- };
68962
- const plist6 = document.documentElement;
68963
- (0, import_strict4.default)(plist6?.tagName === "plist" && plist6.children.length === 1);
68964
- return visit3(plist6.children[0]);
68965
- }
68966
- function binaryPlist2(bytes) {
68967
- (0, import_strict4.default)(bytes.length >= 40);
68968
- const trailer = bytes.length - 32;
68969
- const offsetWidth = bytes[trailer + 6];
68970
- const refWidth = bytes[trailer + 7];
68971
- (0, import_strict4.default)(offsetWidth > 0 && offsetWidth <= 8 && refWidth > 0 && refWidth <= 8);
68972
- const count = Number(bytes.readBigUInt64BE(trailer + 8));
68973
- const root = Number(bytes.readBigUInt64BE(trailer + 16));
68974
- const table = Number(bytes.readBigUInt64BE(trailer + 24));
68975
- (0, import_strict4.default)(
68976
- table >= 8 && table < trailer && count > 0 && count <= (trailer - table) / offsetWidth
68977
- );
68978
- const unsigned = (at, width) => {
68979
- (0, import_strict4.default)(at >= 8 && at + width <= trailer);
68980
- let result = 0n;
68981
- for (let i = at; i < at + width; i++) result = result * 256n + BigInt(bytes[i]);
68982
- return result;
68983
- };
68984
- const cache = /* @__PURE__ */ new Map();
68985
- const visiting = /* @__PURE__ */ new Set();
68986
- const visit3 = (ref) => {
68987
- (0, import_strict4.default)(ref >= 0 && ref < count && !visiting.has(ref));
68988
- if (cache.has(ref)) return cache.get(ref);
68989
- visiting.add(ref);
68990
- const at = Number(unsigned(table + ref * offsetWidth, offsetWidth));
68991
- (0, import_strict4.default)(at >= 8 && at < table);
68992
- const marker = bytes[at];
68993
- const type = marker >> 4;
68994
- let length = marker & 15;
68995
- let data = at + 1;
68996
- if (length === 15 && [4, 5, 6, 7, 10, 13].includes(type)) {
68997
- (0, import_strict4.default)(data < table && bytes[data] >> 4 === 1);
68998
- const width = 2 ** (bytes[data] & 15);
68999
- (0, import_strict4.default)(width <= 8 && data + 1 + width <= table);
69000
- length = Number(unsigned(data + 1, width));
69001
- data += 1 + width;
69002
- }
69003
- const end = (size2) => {
69004
- (0, import_strict4.default)(Number.isSafeInteger(size2) && data + size2 <= table);
69005
- return data + size2;
69006
- };
69007
- const references = (total) => {
69008
- end(total * refWidth);
69009
- return Array.from(
69010
- { length: total },
69011
- (_, i) => visit3(Number(unsigned(data + i * refWidth, refWidth)))
69640
+ return parseXmlPlist(text7, {
69641
+ strict: true,
69642
+ onInteger(raw2) {
69643
+ (0, import_strict5.default)(raw2.length > 0);
69644
+ return safeNumber(BigInt(raw2));
69645
+ },
69646
+ onReal(raw2) {
69647
+ (0, import_strict5.default)(raw2.length > 0);
69648
+ return new IntentReal(
69649
+ /^[+-]?inf(?:inity)?$/i.test(raw2) ? raw2.startsWith("-") ? -Infinity : Infinity : Number(raw2)
69012
69650
  );
69013
- };
69014
- let value;
69015
- switch (type) {
69016
- case 0:
69017
- (0, import_strict4.default)(marker === 8 || marker === 9);
69018
- value = marker === 9;
69019
- break;
69020
- case 1: {
69021
- const size2 = 2 ** length;
69022
- (0, import_strict4.default)(size2 <= 16);
69023
- end(size2);
69024
- const integer2 = unsigned(data, size2);
69025
- value = safeNumber(size2 >= 8 ? BigInt.asIntN(size2 * 8, integer2) : integer2);
69026
- break;
69027
- }
69028
- case 2:
69029
- (0, import_strict4.default)(length === 2 || length === 3);
69030
- end(2 ** length);
69031
- value = new IntentReal(
69032
- length === 2 ? bytes.readFloatBE(data) : bytes.readDoubleBE(data)
69033
- );
69034
- break;
69035
- case 3:
69036
- (0, import_strict4.default)(length === 3);
69037
- end(8);
69038
- value = new Date(Date.UTC(2001, 0, 1) + bytes.readDoubleBE(data) * 1e3);
69039
- break;
69040
- case 4:
69041
- value = bytes.subarray(data, end(length));
69042
- break;
69043
- case 5:
69044
- value = bytes.toString("ascii", data, end(length));
69045
- break;
69046
- case 6:
69047
- value = Buffer.from(bytes.subarray(data, end(length * 2))).swap16().toString("utf16le");
69048
- break;
69049
- case 7:
69050
- value = bytes.toString("utf8", data, end(length));
69051
- break;
69052
- case 10:
69053
- value = references(length);
69054
- break;
69055
- case 13: {
69056
- const elements = references(length * 2);
69057
- const keys = elements.slice(0, length);
69058
- (0, import_strict4.default)(keys.every((key2) => typeof key2 === "string"));
69059
- value = Object.fromEntries(keys.map((key2, i) => [key2, elements[length + i]]));
69060
- break;
69061
- }
69062
- default:
69063
- throw new Error(`unsupported binary plist type ${type}`);
69064
69651
  }
69065
- visiting.delete(ref);
69066
- cache.set(ref, value);
69067
- return value;
69068
- };
69069
- return visit3(root);
69652
+ });
69070
69653
  }
69071
69654
  function parseIntentPlist(bytes) {
69072
- return bytes.toString("ascii", 0, 8) === "bplist00" ? binaryPlist2(bytes) : xmlPlist2(bytes);
69655
+ return bytes.toString("ascii", 0, 8) === "bplist00" ? parseBinaryPlist(bytes, {
69656
+ strict: true,
69657
+ onInteger: safeNumber,
69658
+ onReal: (value) => new IntentReal(value)
69659
+ }) : xmlPlist2(bytes);
69073
69660
  }
69074
- var import_strict4, import_xmldom;
69661
+ var import_strict5;
69075
69662
  var init_plist_reader = __esm({
69076
69663
  "src/intent-definition/plist-reader.ts"() {
69077
69664
  "use strict";
69078
- import_strict4 = __toESM(require("node:assert/strict"), 1);
69079
- import_xmldom = require("peachsim/vendor/@xmldom/xmldom");
69665
+ import_strict5 = __toESM(require("node:assert/strict"), 1);
69666
+ init_plist();
69667
+ init_plist_bytes();
69080
69668
  init_hash_input();
69081
69669
  }
69082
69670
  });
@@ -69088,10 +69676,10 @@ function readIntentResponse(definition2, customTypes) {
69088
69676
  );
69089
69677
  const definitions = new Map(
69090
69678
  modelList(definition2, "INIntentResponseCodes").map((entry) => {
69091
- (0, import_strict5.default)(entry && typeof entry === "object");
69679
+ (0, import_strict6.default)(entry && typeof entry === "object");
69092
69680
  const name3 = identifier(Reflect.get(entry, "INIntentResponseCodeName"));
69093
69681
  const message = Reflect.get(entry, "INIntentResponseCodeFormatString");
69094
- (0, import_strict5.default)(message === void 0 || typeof message === "string");
69682
+ (0, import_strict6.default)(message === void 0 || typeof message === "string");
69095
69683
  const referenced = new Set(
69096
69684
  [
69097
69685
  ...String(message ?? "").matchAll(
@@ -69102,7 +69690,7 @@ function readIntentResponse(definition2, customTypes) {
69102
69690
  const names = [...referenced].sort();
69103
69691
  const parameters = names.map((name4) => {
69104
69692
  const field = fields.find((field2) => field2.name === name4);
69105
- (0, import_strict5.default)(field, "unknown intent response field " + name4);
69693
+ (0, import_strict6.default)(field, "unknown intent response field " + name4);
69106
69694
  return field;
69107
69695
  });
69108
69696
  return [
@@ -69154,11 +69742,11 @@ ${access} static func ${code}(${parameters.map((field) => `${field.name}: ${fiel
69154
69742
  }).join("\n")}
69155
69743
  }`;
69156
69744
  }
69157
- var import_strict5, responseCodes;
69745
+ var import_strict6, responseCodes;
69158
69746
  var init_response = __esm({
69159
69747
  "src/intent-definition/response.ts"() {
69160
69748
  "use strict";
69161
- import_strict5 = __toESM(require("node:assert/strict"), 1);
69749
+ import_strict6 = __toESM(require("node:assert/strict"), 1);
69162
69750
  init_fields();
69163
69751
  responseCodes = [
69164
69752
  "unspecified",
@@ -69176,7 +69764,7 @@ var init_response = __esm({
69176
69764
  function objcAvailability(swift) {
69177
69765
  if (!swift) return "";
69178
69766
  const version2 = /^@available\(iOS ([\d.]+), macOS ([\d.]+), watchOS ([\d.]+), \*\)$/.exec(swift);
69179
- (0, import_strict6.default)(version2);
69767
+ (0, import_strict7.default)(version2);
69180
69768
  return ` API_AVAILABLE(ios(${version2[1]}), macos(${version2[2]}), watchos(${version2[3]}))`;
69181
69769
  }
69182
69770
  function objcElement(field) {
@@ -69205,7 +69793,7 @@ function headerImports(fields, visibility, module2) {
69205
69793
  return [...imports2].join("\n");
69206
69794
  }
69207
69795
  function objcIntentSource(name3, prefix, definition2, customTypes, version2, visibility, module2) {
69208
- (0, import_strict6.default)(definition2 && typeof definition2 === "object");
69796
+ (0, import_strict7.default)(definition2 && typeof definition2 === "object");
69209
69797
  const klass = prefix + name3 + "Intent";
69210
69798
  const response = klass + "Response";
69211
69799
  const attr = hidden(visibility);
@@ -69244,7 +69832,7 @@ function objcIntentSource(name3, prefix, definition2, customTypes, version2, vis
69244
69832
  };
69245
69833
  const constructors = [...definitions].filter(([, definition3]) => definition3.parameters.length > 0).map(([code, { parameters: parameters2, availability }]) => {
69246
69834
  const [first, ...rest] = parameters2;
69247
- (0, import_strict6.default)(first);
69835
+ (0, import_strict7.default)(first);
69248
69836
  const selector = `${code}IntentResponseWith${upper(first.name)}:(${objcType(first)})${first.name}` + rest.map((field) => ` ${field.name}:(${objcType(field)})${field.name}`).join("");
69249
69837
  return {
69250
69838
  code,
@@ -69342,15 +69930,15 @@ ${reasons.map(
69342
69930
  return { header, implementation };
69343
69931
  }
69344
69932
  function objcEnumSource(definition2, label, prefix, visibility) {
69345
- (0, import_strict6.default)(definition2 && typeof definition2 === "object");
69933
+ (0, import_strict7.default)(definition2 && typeof definition2 === "object");
69346
69934
  const name3 = prefix + label;
69347
69935
  const attr = hidden(visibility);
69348
69936
  const bases = [attr, available].filter(Boolean).join(" ");
69349
69937
  const cases = modelList(definition2, "INEnumValues").map((entry) => {
69350
- (0, import_strict6.default)(entry && typeof entry === "object");
69938
+ (0, import_strict7.default)(entry && typeof entry === "object");
69351
69939
  const value = identifier(Reflect.get(entry, "INEnumValueName"));
69352
69940
  const index = Reflect.get(entry, "INEnumValueIndex") ?? 0;
69353
- (0, import_strict6.default)(typeof index === "number" && Number.isSafeInteger(index));
69941
+ (0, import_strict7.default)(typeof index === "number" && Number.isSafeInteger(index));
69354
69942
  return ` ${name3}${upper(value)} = ${index}`;
69355
69943
  });
69356
69944
  const success = `+ (instancetype)successWithResolved${label}:(${name3})resolvedValue`;
@@ -69434,11 +70022,11 @@ ${confirm} {
69434
70022
  `
69435
70023
  };
69436
70024
  }
69437
- var import_strict6, available, resolution, options, hiddenAttribute, hidden, headerStart, headerEnd, pointer, array7;
70025
+ var import_strict7, available, resolution, options, hiddenAttribute, hidden, headerStart, headerEnd, pointer, array7;
69438
70026
  var init_objective_c = __esm({
69439
70027
  "src/intent-definition/objective-c.ts"() {
69440
70028
  "use strict";
69441
- import_strict6 = __toESM(require("node:assert/strict"), 1);
70029
+ import_strict7 = __toESM(require("node:assert/strict"), 1);
69442
70030
  init_fields();
69443
70031
  init_response();
69444
70032
  available = "API_AVAILABLE(ios(12.0), macos(11.0), watchos(5.0)) API_UNAVAILABLE(tvos)";
@@ -69455,7 +70043,7 @@ var init_objective_c = __esm({
69455
70043
 
69456
70044
  // src/intent-definition/swift.ts
69457
70045
  function swiftIntentSource(name3, prefix, definition2, customTypes, version2, access) {
69458
- (0, import_strict7.default)(definition2 && typeof definition2 === "object");
70046
+ (0, import_strict8.default)(definition2 && typeof definition2 === "object");
69459
70047
  const klass = `${prefix}${name3}Intent`;
69460
70048
  const response = `${klass}Response`;
69461
70049
  const parameters = modelList(definition2, "INIntentParameters").map(
@@ -69556,11 +70144,11 @@ ${access} class func unsupported(forReason reason: ${base}UnsupportedReason) ->
69556
70144
  #endif
69557
70145
  `;
69558
70146
  }
69559
- var import_strict7;
70147
+ var import_strict8;
69560
70148
  var init_swift = __esm({
69561
70149
  "src/intent-definition/swift.ts"() {
69562
70150
  "use strict";
69563
- import_strict7 = __toESM(require("node:assert/strict"), 1);
70151
+ import_strict8 = __toESM(require("node:assert/strict"), 1);
69564
70152
  init_fields();
69565
70153
  init_response();
69566
70154
  }
@@ -69568,17 +70156,17 @@ var init_swift = __esm({
69568
70156
 
69569
70157
  // src/intent-definition/source.ts
69570
70158
  function swiftEnumSource(definition2, visibility, prefix = "") {
69571
- (0, import_strict8.default)(definition2 && typeof definition2 === "object");
70159
+ (0, import_strict9.default)(definition2 && typeof definition2 === "object");
69572
70160
  const unprefixed = identifier(Reflect.get(definition2, "INEnumName"));
69573
70161
  const name3 = prefix + unprefixed;
69574
70162
  const values = Reflect.get(definition2, "INEnumValues");
69575
- (0, import_strict8.default)(Array.isArray(values));
70163
+ (0, import_strict9.default)(Array.isArray(values));
69576
70164
  const access = visibility === "project" ? "internal" : "public";
69577
70165
  const cases = values.map((entry) => {
69578
- (0, import_strict8.default)(entry && typeof entry === "object");
70166
+ (0, import_strict9.default)(entry && typeof entry === "object");
69579
70167
  const name4 = identifier(Reflect.get(entry, "INEnumValueName"));
69580
70168
  const index = Reflect.get(entry, "INEnumValueIndex") ?? 0;
69581
- (0, import_strict8.default)(typeof index === "number" && Number.isSafeInteger(index));
70169
+ (0, import_strict9.default)(typeof index === "number" && Number.isSafeInteger(index));
69582
70170
  return ` case \`${name4}\` = ${index}`;
69583
70171
  });
69584
70172
  return `#if canImport(Intents)
@@ -69603,7 +70191,7 @@ ${access} class ${name3}ResolutionResult: INEnumResolutionResult {
69603
70191
  `;
69604
70192
  }
69605
70193
  function emitIntentSource(definition2, prefix, visibility, language, module2) {
69606
- (0, import_strict8.default)(definition2 && typeof definition2 === "object");
70194
+ (0, import_strict9.default)(definition2 && typeof definition2 === "object");
69607
70195
  const intents = modelList(definition2, "INIntents");
69608
70196
  const types2 = modelList(definition2, "INTypes");
69609
70197
  const enums = modelList(definition2, "INEnums");
@@ -69613,7 +70201,7 @@ function emitIntentSource(definition2, prefix, visibility, language, module2) {
69613
70201
  intentModelVersion(Reflect.get(definition2, "INIntentDefinitionModelVersion"))
69614
70202
  );
69615
70203
  const nameOf = (entry, key2) => {
69616
- (0, import_strict8.default)(entry && typeof entry === "object");
70204
+ (0, import_strict9.default)(entry && typeof entry === "object");
69617
70205
  return identifier(Reflect.get(entry, key2));
69618
70206
  };
69619
70207
  const typeNames = types2.map((type) => nameOf(type, "INTypeName"));
@@ -69653,7 +70241,7 @@ function emitIntentSource(definition2, prefix, visibility, language, module2) {
69653
70241
  });
69654
70242
  }
69655
70243
  for (const intent of intents) {
69656
- (0, import_strict8.default)(intent && typeof intent === "object");
70244
+ (0, import_strict9.default)(intent && typeof intent === "object");
69657
70245
  if (Reflect.get(intent, "INIntentType") === "System") continue;
69658
70246
  const name3 = identifier(Reflect.get(intent, "INIntentName"));
69659
70247
  const filename = `${prefix}${name3}Intent`;
@@ -69670,11 +70258,11 @@ function emitIntentSource(definition2, prefix, visibility, language, module2) {
69670
70258
  }
69671
70259
  return output;
69672
70260
  }
69673
- var import_strict8;
70261
+ var import_strict9;
69674
70262
  var init_source = __esm({
69675
70263
  "src/intent-definition/source.ts"() {
69676
70264
  "use strict";
69677
- import_strict8 = __toESM(require("node:assert/strict"), 1);
70265
+ import_strict9 = __toESM(require("node:assert/strict"), 1);
69678
70266
  init_fields();
69679
70267
  init_objective_c();
69680
70268
  init_swift();
@@ -70498,7 +71086,7 @@ function expandValue(value, settings) {
70498
71086
  return value;
70499
71087
  }
70500
71088
  function processedInfoPlist(name3, file, settings, settingKeys) {
70501
- const source = file ? import_plist4.default.parse(import_node_fs87.default.readFileSync(file, "utf8")) : {};
71089
+ const source = file ? parsePlist(import_node_fs87.default.readFileSync(file, "utf8")) : {};
70502
71090
  if (!source || typeof source !== "object" || Array.isArray(source) || source instanceof Date || Buffer.isBuffer(source))
70503
71091
  throw new Error(`${name3} Info.plist must contain a dictionary`);
70504
71092
  const info = {};
@@ -71072,7 +71660,7 @@ ${output}`
71072
71660
  );
71073
71661
  let launchName = settings("INFOPLIST_KEY_UILaunchStoryboardName");
71074
71662
  if (process.platform !== "darwin" && !launchName && infoPlistOutput && import_node_fs87.default.existsSync(infoPlistOutput)) {
71075
- const info = import_plist4.default.parse(import_node_fs87.default.readFileSync(infoPlistOutput, "utf8"));
71663
+ const info = parsePlist(import_node_fs87.default.readFileSync(infoPlistOutput, "utf8"));
71076
71664
  const declared = isRecord(info) ? info.UILaunchStoryboardName : void 0;
71077
71665
  if (typeof declared === "string") launchName = expand(declared, settings);
71078
71666
  }
@@ -71961,7 +72549,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
71961
72549
  }
71962
72550
  return {
71963
72551
  ref,
71964
- framework: Object.assign(module3, { frameworkInfoPlist: import_plist4.default.build(info2) })
72552
+ framework: Object.assign(module3, { frameworkInfoPlist: buildPlist(info2) })
71965
72553
  };
71966
72554
  });
71967
72555
  const frameworks = frameworkTargets.map(({ framework }) => framework);
@@ -72028,9 +72616,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
72028
72616
  path: bundlePath,
72029
72617
  ...product ? {
72030
72618
  resources: product.module.resources,
72031
- infoPlist: import_plist4.default.build(
72619
+ infoPlist: buildPlist(
72032
72620
  expandValue(
72033
- import_plist4.default.parse(import_node_fs87.default.readFileSync(infoFile, "utf8")),
72621
+ parsePlist(import_node_fs87.default.readFileSync(infoFile, "utf8")),
72034
72622
  product.productSettings
72035
72623
  )
72036
72624
  )
@@ -72052,7 +72640,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
72052
72640
  settingKeys
72053
72641
  );
72054
72642
  const bundleIdentifier = productSettings("PRODUCT_BUNDLE_IDENTIFIER") || (typeof info.CFBundleIdentifier === "string" ? info.CFBundleIdentifier : "");
72055
- const entitlements = entitlementsFile ? import_plist4.default.parse(import_node_fs87.default.readFileSync(entitlementsFile, "utf8")) : void 0;
72643
+ const entitlements = entitlementsFile ? parsePlist(import_node_fs87.default.readFileSync(entitlementsFile, "utf8")) : void 0;
72056
72644
  const keychainAccessGroups = entitlementsFile ? readKeychainAccessGroups(
72057
72645
  entitlements,
72058
72646
  (value) => expand(value, (key2) => {
@@ -72398,7 +72986,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
72398
72986
  ].sort(),
72399
72987
  projectDirs: [...new Set(used.map((project) => project.projectDir))].sort(),
72400
72988
  appIconName: settings("ASSETCATALOG_COMPILER_APPICON_NAME"),
72401
- infoPlist: infoPlistPending ? null : import_plist4.default.build(info),
72989
+ infoPlist: infoPlistPending ? null : buildPlist(info),
72402
72990
  infoPlistFile,
72403
72991
  ...keychainAccessGroups === void 0 ? {} : { keychainAccessGroups },
72404
72992
  siriEntitled: readSiriEntitlement(entitlements),
@@ -72421,7 +73009,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
72421
73009
  cocoapods
72422
73010
  };
72423
73011
  }
72424
- var import_node_child_process43, import_node_crypto53, import_node_fs87, import_node_module8, import_node_path89, 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, loaded2, developerDir, preparedSourcePhases, isPodsProject, targetRefs, workspaceResolvedFile, SwiftPackageResolutionRequired;
73012
+ var import_node_child_process43, import_node_crypto53, import_node_fs87, import_node_module8, import_node_path89, 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, loaded2, developerDir, preparedSourcePhases, isPodsProject, targetRefs, workspaceResolvedFile, SwiftPackageResolutionRequired;
72425
73013
  var init_xcode_project = __esm({
72426
73014
  "src/xcode-project.ts"() {
72427
73015
  "use strict";
@@ -72430,11 +73018,11 @@ var init_xcode_project = __esm({
72430
73018
  import_node_fs87 = __toESM(require("node:fs"), 1);
72431
73019
  import_node_module8 = require("node:module");
72432
73020
  import_node_path89 = __toESM(require("node:path"), 1);
72433
- import_plist4 = __toESM(require("peachsim/vendor/plist"), 1);
72434
73021
  init_bazel_project();
72435
73022
  init_ios_sdk_frameworks();
72436
73023
  init_is_record();
72437
73024
  init_native_app_identity();
73025
+ init_plist();
72438
73026
  init_pod_graph_specifications();
72439
73027
  init_swift_binary_modules();
72440
73028
  init_xcode_assets();
@@ -74348,14 +74936,14 @@ function isPlistValue(value) {
74348
74936
  return isRecord(value) && Object.values(value).every(isPlistValue);
74349
74937
  }
74350
74938
  function parsePlistDictionary(source) {
74351
- const parsed2 = import_plist7.default.parse(source);
74939
+ const parsed2 = parsePlist(source);
74352
74940
  if (typeof parsed2 !== "object" || isPlistArray(parsed2) || parsed2 instanceof Date || Buffer.isBuffer(parsed2))
74353
74941
  throw new Error("Info.plist is not a dictionary");
74354
74942
  return parsed2;
74355
74943
  }
74356
74944
  function installedInfoPlist(prebuilt, additions) {
74357
74945
  const merged = { ...parsePlistDictionary(prebuilt), ...additions };
74358
- return import_plist7.default.build(
74946
+ return buildPlist(
74359
74947
  Object.fromEntries(
74360
74948
  Object.keys(merged).sort().map((key2) => [key2, merged[key2]])
74361
74949
  )
@@ -74463,7 +75051,7 @@ async function prebuiltExpoSwiftResult(appRoot, entry, signal) {
74463
75051
  await prebuiltAppTarget(appRoot, signal, "installed")
74464
75052
  );
74465
75053
  }
74466
- var import_node_crypto57, import_node_fs93, import_node_module12, import_node_path95, import_node_util13, import_plist7, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published, lookups, answers;
75054
+ var import_node_crypto57, import_node_fs93, import_node_module12, import_node_path95, import_node_util13, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published, lookups, answers;
74467
75055
  var init_expo_native_prebuilt = __esm({
74468
75056
  "src/expo-native-prebuilt.ts"() {
74469
75057
  "use strict";
@@ -74472,7 +75060,6 @@ var init_expo_native_prebuilt = __esm({
74472
75060
  import_node_module12 = require("node:module");
74473
75061
  import_node_path95 = __toESM(require("node:path"), 1);
74474
75062
  import_node_util13 = require("node:util");
74475
- import_plist7 = __toESM(require("peachsim/vendor/plist"), 1);
74476
75063
  init_answeredNativePackages();
74477
75064
  init_expo_native_compiler_digest();
74478
75065
  init_expo_native_workspace();
@@ -74483,6 +75070,7 @@ var init_expo_native_prebuilt = __esm({
74483
75070
  init_native_prebuilt();
74484
75071
  init_nitroContract();
74485
75072
  init_package_tree_digest();
75073
+ init_plist();
74486
75074
  init_swift_native_pin();
74487
75075
  init_xcode_project();
74488
75076
  EXPO_NATIVE_ENTRY_NAME = "ios";
@@ -85459,7 +86047,7 @@ function compileCatalogTables(source, name3) {
85459
86047
  }
85460
86048
  return output;
85461
86049
  }
85462
- function plist5(value, depth) {
86050
+ function plist(value, depth) {
85463
86051
  const indent2 = " ".repeat(depth);
85464
86052
  const escaped = (text7) => text7.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
85465
86053
  if (typeof value === "string") return `${indent2}<string>${escaped(value)}</string>
@@ -85470,7 +86058,7 @@ function plist5(value, depth) {
85470
86058
  return `${indent2}<dict>
85471
86059
  ` + keys.map(
85472
86060
  (key2) => `${indent2} <key>${escaped(key2)}</key>
85473
- ` + plist5(value[key2] ?? "", depth + 1)
86061
+ ` + plist(value[key2] ?? "", depth + 1)
85474
86062
  ).join("") + `${indent2}</dict>
85475
86063
  `;
85476
86064
  }
@@ -85478,7 +86066,7 @@ function compileStringCatalog(source, name3) {
85478
86066
  return Object.fromEntries(
85479
86067
  Object.entries(compileCatalogTables(source, name3)).map(([path116, table]) => [
85480
86068
  path116,
85481
- '<?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' + plist5(table, 0) + "</plist>\n"
86069
+ '<?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"
85482
86070
  ])
85483
86071
  );
85484
86072
  }
@@ -88407,7 +88995,7 @@ var require_packer_async = __commonJS({
88407
88995
  var require_sync_inflate = __commonJS({
88408
88996
  "../../node_modules/pngjs/lib/sync-inflate.js"(exports2, module2) {
88409
88997
  "use strict";
88410
- var assert9 = require("assert").ok;
88998
+ var assert10 = require("assert").ok;
88411
88999
  var zlib3 = require("zlib");
88412
89000
  var util = require("util");
88413
89001
  var kMaxLength = require("buffer").kMaxLength;
@@ -88458,7 +89046,7 @@ var require_sync_inflate = __commonJS({
88458
89046
  return;
88459
89047
  }
88460
89048
  let have = availOutBefore - availOutAfter;
88461
- assert9(have >= 0, "have should not go down");
89049
+ assert10(have >= 0, "have should not go down");
88462
89050
  if (have > 0) {
88463
89051
  let out = self._buffer.slice(self._offset, self._offset + have);
88464
89052
  self._offset += have;
@@ -88484,7 +89072,7 @@ var require_sync_inflate = __commonJS({
88484
89072
  }
88485
89073
  return false;
88486
89074
  }
88487
- assert9(this._handle, "zlib binding closed");
89075
+ assert10(this._handle, "zlib binding closed");
88488
89076
  let res;
88489
89077
  do {
88490
89078
  res = this._handle.writeSync(