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;
@@ -29529,17 +29529,17 @@ function verifyHost(dir) {
29529
29529
  }
29530
29530
  }
29531
29531
  function bundleValue(app, key2) {
29532
- const plist6 = import_node_path6.default.join(app, "Contents/Info.plist");
29533
- const stat2 = import_node_fs10.default.statSync(plist6, { throwIfNoEntry: false });
29532
+ const plist2 = import_node_path6.default.join(app, "Contents/Info.plist");
29533
+ const stat2 = import_node_fs10.default.statSync(plist2, { throwIfNoEntry: false });
29534
29534
  if (!stat2) return null;
29535
29535
  const stamp = `${stat2.ino}:${stat2.size}:${stat2.mtimeMs}`;
29536
- let entry = bundleValues.get(plist6);
29536
+ let entry = bundleValues.get(plist2);
29537
29537
  if (entry?.stamp !== stamp) {
29538
29538
  entry = { stamp, values: /* @__PURE__ */ new Map() };
29539
- bundleValues.set(plist6, entry);
29539
+ bundleValues.set(plist2, entry);
29540
29540
  }
29541
29541
  if (entry.values.has(key2)) return entry.values.get(key2) ?? null;
29542
- const read = (0, import_node_child_process6.spawnSync)("plutil", ["-extract", key2, "raw", "-o", "-", plist6], {
29542
+ const read = (0, import_node_child_process6.spawnSync)("plutil", ["-extract", key2, "raw", "-o", "-", plist2], {
29543
29543
  encoding: "utf8"
29544
29544
  });
29545
29545
  const value = read.status === 0 ? read.stdout.trim() : null;
@@ -31705,14 +31705,326 @@ var init_dev_bundle_resolution = __esm({
31705
31705
  });
31706
31706
 
31707
31707
  // src/plist.ts
31708
+ function decodeXmlEntities(text7) {
31709
+ if (!text7.includes("&")) return text7;
31710
+ return text7.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);/g, (full, entity2) => {
31711
+ if (entity2.startsWith("#x") || entity2.startsWith("#X")) {
31712
+ const code = Number.parseInt(entity2.slice(2), 16);
31713
+ return Number.isFinite(code) ? String.fromCodePoint(code) : full;
31714
+ }
31715
+ if (entity2.startsWith("#")) {
31716
+ const code = Number.parseInt(entity2.slice(1), 10);
31717
+ return Number.isFinite(code) ? String.fromCodePoint(code) : full;
31718
+ }
31719
+ return NAMED_ENTITIES[entity2] ?? full;
31720
+ });
31721
+ }
31722
+ function escapeXmlText(text7) {
31723
+ return text7.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
31724
+ }
31725
+ function parseXmlDocument(input) {
31726
+ const source = input.startsWith("\uFEFF") ? input.slice(1) : input;
31727
+ const len = source.length;
31728
+ let pos = 0;
31729
+ const skipIgnorable = () => {
31730
+ while (pos < len) {
31731
+ while (pos < len && /\s/.test(source[pos])) pos++;
31732
+ if (source.startsWith("<!--", pos)) {
31733
+ const end = source.indexOf("-->", pos + 4);
31734
+ if (end === -1) throw new Error("unterminated XML comment");
31735
+ pos = end + 3;
31736
+ continue;
31737
+ }
31738
+ if (source.startsWith("<?", pos)) {
31739
+ const end = source.indexOf("?>", pos + 2);
31740
+ if (end === -1) throw new Error("unterminated XML processing instruction");
31741
+ pos = end + 2;
31742
+ continue;
31743
+ }
31744
+ if (source.startsWith("<!DOCTYPE", pos)) {
31745
+ pos += 9;
31746
+ let depth = 0;
31747
+ let quote3 = "";
31748
+ while (pos < len) {
31749
+ const ch = source[pos];
31750
+ pos++;
31751
+ if (quote3) {
31752
+ if (ch === quote3) quote3 = "";
31753
+ } else if (ch === '"' || ch === "'") {
31754
+ quote3 = ch;
31755
+ } else if (ch === "[") {
31756
+ depth++;
31757
+ } else if (ch === "]") {
31758
+ depth = Math.max(0, depth - 1);
31759
+ } else if (ch === ">" && depth === 0) {
31760
+ break;
31761
+ }
31762
+ }
31763
+ continue;
31764
+ }
31765
+ break;
31766
+ }
31767
+ };
31768
+ const readElement = () => {
31769
+ if (source[pos] !== "<") {
31770
+ throw new Error(`expected XML tag at offset ${pos}`);
31771
+ }
31772
+ pos++;
31773
+ const nameStart = pos;
31774
+ while (pos < len && /[^\s/>]/.test(source[pos])) pos++;
31775
+ const tag = source.slice(nameStart, pos);
31776
+ if (!tag) throw new Error(`empty XML tag name at offset ${nameStart}`);
31777
+ let quote3 = "";
31778
+ let selfClosing = false;
31779
+ while (pos < len) {
31780
+ const ch = source[pos];
31781
+ if (quote3) {
31782
+ pos++;
31783
+ if (ch === quote3) quote3 = "";
31784
+ continue;
31785
+ }
31786
+ if (ch === '"' || ch === "'") {
31787
+ quote3 = ch;
31788
+ pos++;
31789
+ continue;
31790
+ }
31791
+ if (ch === "/" && source[pos + 1] === ">") {
31792
+ selfClosing = true;
31793
+ pos += 2;
31794
+ break;
31795
+ }
31796
+ if (ch === ">") {
31797
+ pos++;
31798
+ break;
31799
+ }
31800
+ pos++;
31801
+ }
31802
+ if (selfClosing) {
31803
+ return { tag, children: [], text: "" };
31804
+ }
31805
+ const children = [];
31806
+ let text7 = "";
31807
+ while (pos < len) {
31808
+ if (source.startsWith("<!--", pos)) {
31809
+ const end2 = source.indexOf("-->", pos + 4);
31810
+ if (end2 === -1) throw new Error("unterminated XML comment");
31811
+ pos = end2 + 3;
31812
+ continue;
31813
+ }
31814
+ if (source.startsWith("<![CDATA[", pos)) {
31815
+ const end2 = source.indexOf("]]>", pos + 9);
31816
+ if (end2 === -1) throw new Error("unterminated CDATA section");
31817
+ text7 += source.slice(pos + 9, end2);
31818
+ pos = end2 + 3;
31819
+ continue;
31820
+ }
31821
+ if (source.startsWith("</", pos)) {
31822
+ pos += 2;
31823
+ const closeStart = pos;
31824
+ while (pos < len && /[^\s>]/.test(source[pos])) pos++;
31825
+ const closeTag = source.slice(closeStart, pos);
31826
+ while (pos < len && /\s/.test(source[pos])) pos++;
31827
+ if (source[pos] !== ">") throw new Error(`malformed closing tag </${closeTag}>`);
31828
+ pos++;
31829
+ if (closeTag !== tag) {
31830
+ throw new Error(`mismatched XML closing tag </${closeTag}> for <${tag}>`);
31831
+ }
31832
+ return { tag, children, text: text7 };
31833
+ }
31834
+ if (source[pos] === "<") {
31835
+ children.push(readElement());
31836
+ continue;
31837
+ }
31838
+ const nextTag = source.indexOf("<", pos);
31839
+ const end = nextTag === -1 ? len : nextTag;
31840
+ text7 += decodeXmlEntities(source.slice(pos, end));
31841
+ pos = end;
31842
+ }
31843
+ throw new Error(`unclosed XML tag <${tag}>`);
31844
+ };
31845
+ skipIgnorable();
31846
+ if (pos >= len) throw new Error("empty XML plist document");
31847
+ return readElement();
31848
+ }
31849
+ function parseXmlPlist(source, options2 = {}) {
31850
+ const root = parseXmlDocument(source);
31851
+ if (root.tag !== "plist") {
31852
+ throw new Error(`expected <plist> root element, got <${root.tag}>`);
31853
+ }
31854
+ if (root.children.length === 0) {
31855
+ if (options2.strict) throw new Error("<plist> element has no root value");
31856
+ return void 0;
31857
+ }
31858
+ if (options2.strict && root.children.length !== 1) {
31859
+ throw new Error("<plist> element must contain exactly one root value");
31860
+ }
31861
+ const leafText = (node) => {
31862
+ if (options2.strict && node.children.length > 0) {
31863
+ throw new Error(`<${node.tag}> must not contain child elements`);
31864
+ }
31865
+ return node.text;
31866
+ };
31867
+ const visit3 = (node) => {
31868
+ switch (node.tag) {
31869
+ case "dict": {
31870
+ const result = {};
31871
+ if (options2.strict && node.children.length % 2 !== 0) {
31872
+ throw new Error("<dict> must contain key/value pairs");
31873
+ }
31874
+ for (let i = 0; i + 1 < node.children.length; i += 2) {
31875
+ const keyNode = node.children[i];
31876
+ if (keyNode.tag !== "key") {
31877
+ throw new Error(`expected <key> in <dict>, got <${keyNode.tag}>`);
31878
+ }
31879
+ result[leafText(keyNode)] = visit3(node.children[i + 1]);
31880
+ }
31881
+ return result;
31882
+ }
31883
+ case "array":
31884
+ return node.children.map(visit3);
31885
+ case "string":
31886
+ return leafText(node);
31887
+ case "integer": {
31888
+ const raw2 = leafText(node).trim();
31889
+ if (options2.onInteger) return options2.onInteger(raw2);
31890
+ if (!raw2) throw new Error("empty <integer> element");
31891
+ return Number.parseInt(raw2, 10);
31892
+ }
31893
+ case "real": {
31894
+ const raw2 = leafText(node).trim();
31895
+ if (options2.onReal) return options2.onReal(raw2);
31896
+ if (!raw2) throw new Error("empty <real> element");
31897
+ return Number.parseFloat(raw2);
31898
+ }
31899
+ case "true":
31900
+ return true;
31901
+ case "false":
31902
+ return false;
31903
+ case "data":
31904
+ return Buffer.from(leafText(node).replace(/\s+/g, ""), "base64");
31905
+ case "date":
31906
+ return new Date(leafText(node).trim());
31907
+ default:
31908
+ throw new Error(`unsupported plist element ${node.tag}`);
31909
+ }
31910
+ };
31911
+ return visit3(root.children[0]);
31912
+ }
31913
+ function parsePlist(source) {
31914
+ const root = parseXmlDocument(source);
31915
+ if (root.tag !== "plist") {
31916
+ throw new Error(`expected <plist> root element, got <${root.tag}>`);
31917
+ }
31918
+ if (root.children.length === 0) return {};
31919
+ const visit3 = (node) => {
31920
+ switch (node.tag) {
31921
+ case "dict": {
31922
+ const result = {};
31923
+ for (let i = 0; i + 1 < node.children.length; i += 2) {
31924
+ const keyNode = node.children[i];
31925
+ if (keyNode.tag !== "key") {
31926
+ throw new Error(`expected <key> in <dict>, got <${keyNode.tag}>`);
31927
+ }
31928
+ result[keyNode.text] = visit3(node.children[i + 1]);
31929
+ }
31930
+ return result;
31931
+ }
31932
+ case "array":
31933
+ return node.children.map(visit3);
31934
+ case "string":
31935
+ return node.text;
31936
+ case "integer": {
31937
+ const raw2 = node.text.trim();
31938
+ if (!raw2) throw new Error("empty <integer> element");
31939
+ return Number.parseInt(raw2, 10);
31940
+ }
31941
+ case "real": {
31942
+ const raw2 = node.text.trim();
31943
+ if (!raw2) throw new Error("empty <real> element");
31944
+ return Number.parseFloat(raw2);
31945
+ }
31946
+ case "true":
31947
+ return true;
31948
+ case "false":
31949
+ return false;
31950
+ case "data":
31951
+ return Buffer.from(node.text.replace(/\s+/g, ""), "base64");
31952
+ case "date":
31953
+ return new Date(node.text.trim());
31954
+ default:
31955
+ throw new Error(`unsupported plist element ${node.tag}`);
31956
+ }
31957
+ };
31958
+ return visit3(root.children[0]);
31959
+ }
31708
31960
  function parsePlistSource(source) {
31709
- return import_plist.default.parse(source);
31961
+ return parseXmlPlist(source);
31962
+ }
31963
+ function renderValue(value, indent2) {
31964
+ if (value === void 0 || value === null) return null;
31965
+ if (typeof value === "string") {
31966
+ return `${indent2}<string>${escapeXmlText(value)}</string>`;
31967
+ }
31968
+ if (typeof value === "boolean") {
31969
+ return `${indent2}${value ? "<true/>" : "<false/>"}`;
31970
+ }
31971
+ if (typeof value === "number") {
31972
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
31973
+ return `${indent2}<integer>${value}</integer>`;
31974
+ }
31975
+ return `${indent2}<real>${value}</real>`;
31976
+ }
31977
+ if (value instanceof Date) {
31978
+ return `${indent2}<date>${value.toISOString().replace(/\.\d{3}Z$/, "Z")}</date>`;
31979
+ }
31980
+ if (Buffer.isBuffer(value) || value instanceof Uint8Array) {
31981
+ const encoded = Buffer.from(value).toString("base64");
31982
+ return encoded ? `${indent2}<data>${encoded}</data>` : `${indent2}<data/>`;
31983
+ }
31984
+ if (Array.isArray(value)) {
31985
+ const items2 = value.map((entry) => renderValue(entry, `${indent2} `)).filter((entry) => entry !== null);
31986
+ if (items2.length === 0) return `${indent2}<array/>`;
31987
+ return `${indent2}<array>
31988
+ ${items2.join("\n")}
31989
+ ${indent2}</array>`;
31990
+ }
31991
+ if (typeof value === "object") {
31992
+ const lines = [];
31993
+ for (const [key2, entry] of Object.entries(value)) {
31994
+ const rendered = renderValue(entry, `${indent2} `);
31995
+ if (rendered === null) continue;
31996
+ lines.push(`${indent2} <key>${escapeXmlText(key2)}</key>`);
31997
+ lines.push(rendered);
31998
+ }
31999
+ if (lines.length === 0) return `${indent2}<dict/>`;
32000
+ return `${indent2}<dict>
32001
+ ${lines.join("\n")}
32002
+ ${indent2}</dict>`;
32003
+ }
32004
+ throw new Error(`unsupported plist value type: ${typeof value}`);
31710
32005
  }
31711
- var import_plist;
32006
+ function buildPlist(value) {
32007
+ const body = renderValue(value, " ");
32008
+ return [
32009
+ '<?xml version="1.0" encoding="UTF-8"?>',
32010
+ '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
32011
+ '<plist version="1.0">',
32012
+ ...body ? [body] : [],
32013
+ "</plist>",
32014
+ ""
32015
+ ].join("\n");
32016
+ }
32017
+ var NAMED_ENTITIES;
31712
32018
  var init_plist = __esm({
31713
32019
  "src/plist.ts"() {
31714
32020
  "use strict";
31715
- import_plist = __toESM(require("peachsim/vendor/plist"), 1);
32021
+ NAMED_ENTITIES = {
32022
+ amp: "&",
32023
+ lt: "<",
32024
+ gt: ">",
32025
+ quot: '"',
32026
+ apos: "'"
32027
+ };
31716
32028
  }
31717
32029
  });
31718
32030
 
@@ -35538,13 +35850,13 @@ var init_swift_standin_digest = __esm({
35538
35850
  STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
35539
35851
  SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
35540
35852
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
35541
- STANDIN_SOURCE_DIGEST = true ? "cb9d3dbcce3fdc3dbbec1990247cf5b2a1f9fd7cd32791740e313792bd8bcfcc" : standinSourceDigest();
35853
+ STANDIN_SOURCE_DIGEST = true ? "fde0b0b7ddf441a32e71680bc17ba12f69f2cbaed1a0a024505e7f4a5394772d" : standinSourceDigest();
35542
35854
  }
35543
35855
  });
35544
35856
 
35545
35857
  // src/expo-native-compiler-digest.ts
35546
35858
  function expoNativeCompilerDigestValue() {
35547
- return true ? "6aedf26bc25b6a36f195ca561d0ac7cf616934f0decbe54a770edcae5bda1407" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
35859
+ return true ? "0eb8b57c26c74de660f5dc029f1ae0ffa0af503b67afa64e2c93b02b517a2e68" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
35548
35860
  }
35549
35861
  var import_node_crypto12;
35550
35862
  var init_expo_native_compiler_digest = __esm({
@@ -42905,7 +43217,8 @@ function swiftCompilerRelease(release) {
42905
43217
  }
42906
43218
  function swiftToolchainBin(release) {
42907
43219
  if (process.platform === "darwin") {
42908
- const dirs = [import_node_os8.default.homedir(), "/"].map(
43220
+ const bases = [.../* @__PURE__ */ new Set([import_node_os8.default.homedir(), import_node_path33.default.dirname(peachHome()), "/"])];
43221
+ const dirs = bases.map(
42909
43222
  (base2) => import_node_path33.default.join(base2, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`)
42910
43223
  );
42911
43224
  const found2 = dirs.find((dir) => import_node_fs37.default.existsSync(import_node_path33.default.join(dir, "swift")));
@@ -53040,6 +53353,160 @@ var init_admitted_mac_build = __esm({
53040
53353
  }
53041
53354
  });
53042
53355
 
53356
+ // src/gitignore.ts
53357
+ function stripTrailingSpaces(line) {
53358
+ let end = line.length;
53359
+ while (end > 0 && line[end - 1] === " ") {
53360
+ let slashes = 0;
53361
+ for (let i = end - 2; i >= 0 && line[i] === "\\"; i--) slashes++;
53362
+ if (slashes % 2 === 1) break;
53363
+ end--;
53364
+ }
53365
+ return line.slice(0, end);
53366
+ }
53367
+ function globToRegexSource(pattern) {
53368
+ let out = "";
53369
+ let i = 0;
53370
+ while (i < pattern.length) {
53371
+ const ch = pattern[i];
53372
+ if (ch === "\\" && i + 1 < pattern.length) {
53373
+ out += pattern[i + 1].replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
53374
+ i += 2;
53375
+ continue;
53376
+ }
53377
+ if (ch === "*") {
53378
+ if (pattern[i + 1] === "*") {
53379
+ const prevIsSlashOrStart = i === 0 || pattern[i - 1] === "/";
53380
+ const nextIsSlash = pattern[i + 2] === "/";
53381
+ const nextIsEnd = i + 2 === pattern.length;
53382
+ if (prevIsSlashOrStart && nextIsSlash) {
53383
+ out += "(?:.+/)?";
53384
+ i += 3;
53385
+ continue;
53386
+ }
53387
+ if (prevIsSlashOrStart && nextIsEnd) {
53388
+ out += ".*";
53389
+ i += 2;
53390
+ continue;
53391
+ }
53392
+ out += ".*";
53393
+ i += 2;
53394
+ continue;
53395
+ }
53396
+ out += "[^/]*";
53397
+ i++;
53398
+ continue;
53399
+ }
53400
+ if (ch === "?") {
53401
+ out += "[^/]";
53402
+ i++;
53403
+ continue;
53404
+ }
53405
+ if (ch === "[") {
53406
+ let j = i + 1;
53407
+ if (j < pattern.length && (pattern[j] === "!" || pattern[j] === "^")) j++;
53408
+ if (j < pattern.length && pattern[j] === "]") j++;
53409
+ while (j < pattern.length && pattern[j] !== "]") {
53410
+ if (pattern[j] === "\\" && j + 1 < pattern.length) j += 2;
53411
+ else j++;
53412
+ }
53413
+ if (j < pattern.length) {
53414
+ let body = pattern.slice(i + 1, j);
53415
+ if (body.startsWith("!")) body = `^${body.slice(1)}`;
53416
+ out += `[${body}]`;
53417
+ i = j + 1;
53418
+ continue;
53419
+ }
53420
+ }
53421
+ out += ch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
53422
+ i++;
53423
+ }
53424
+ return out;
53425
+ }
53426
+ function compileRule(rawLine) {
53427
+ const withoutCr = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
53428
+ const trimmed = stripTrailingSpaces(withoutCr);
53429
+ if (!trimmed || trimmed.startsWith("#")) return null;
53430
+ let negative = false;
53431
+ let pattern = trimmed;
53432
+ if (pattern.startsWith("!")) {
53433
+ negative = true;
53434
+ pattern = pattern.slice(1);
53435
+ }
53436
+ if (!pattern) return null;
53437
+ const directoryOnly = pattern.endsWith("/");
53438
+ if (directoryOnly) {
53439
+ pattern = pattern.slice(0, -1);
53440
+ if (!pattern) return null;
53441
+ }
53442
+ const anchored = pattern.includes("/");
53443
+ if (pattern.startsWith("/")) {
53444
+ pattern = pattern.slice(1);
53445
+ }
53446
+ const body = globToRegexSource(pattern);
53447
+ const prefix = anchored ? "^" : "(?:^|/)";
53448
+ const regex2 = new RegExp(`${prefix}${body}$`, "i");
53449
+ return { negative, directoryOnly, regex: regex2 };
53450
+ }
53451
+ function normalizePath(input) {
53452
+ const isDirectory5 = input.endsWith("/");
53453
+ let normalized = isDirectory5 ? input.slice(0, -1) : input;
53454
+ if (normalized.startsWith("./")) normalized = normalized.slice(2);
53455
+ return { path: normalized, isDirectory: isDirectory5 };
53456
+ }
53457
+ function createGitignoreMatcher() {
53458
+ const rules2 = [];
53459
+ const matchSingle = (candidate, isDirectory5) => {
53460
+ let ignored = false;
53461
+ let unignored = false;
53462
+ for (const rule of rules2) {
53463
+ if (rule.directoryOnly && !isDirectory5) continue;
53464
+ if (!rule.regex.test(candidate)) continue;
53465
+ if (rule.negative) {
53466
+ ignored = false;
53467
+ unignored = true;
53468
+ } else {
53469
+ ignored = true;
53470
+ unignored = false;
53471
+ }
53472
+ }
53473
+ return { ignored, unignored };
53474
+ };
53475
+ const matcher = {
53476
+ add(patterns) {
53477
+ const list2 = typeof patterns === "string" ? patterns.split("\n") : patterns;
53478
+ for (const entry of list2) {
53479
+ for (const line of entry.split("\n")) {
53480
+ const compiled = compileRule(line);
53481
+ if (compiled) rules2.push(compiled);
53482
+ }
53483
+ }
53484
+ return matcher;
53485
+ },
53486
+ test(relativePath2) {
53487
+ const { path: path190, isDirectory: isDirectory5 } = normalizePath(relativePath2);
53488
+ if (!path190) return { ignored: false, unignored: false };
53489
+ const parts2 = path190.split("/");
53490
+ let prefix = "";
53491
+ for (let i = 0; i < parts2.length - 1; i++) {
53492
+ prefix = prefix ? `${prefix}/${parts2[i]}` : parts2[i];
53493
+ const parent = matchSingle(prefix, true);
53494
+ if (parent.ignored) return { ignored: true, unignored: false };
53495
+ }
53496
+ return matchSingle(path190, isDirectory5);
53497
+ },
53498
+ ignores(relativePath2) {
53499
+ return matcher.test(relativePath2).ignored;
53500
+ }
53501
+ };
53502
+ return matcher;
53503
+ }
53504
+ var init_gitignore = __esm({
53505
+ "src/gitignore.ts"() {
53506
+ "use strict";
53507
+ }
53508
+ });
53509
+
53043
53510
  // src/expo-workspace-exclusion.ts
53044
53511
  async function workspaceExclusion(root, portable = false, linkedPackages = []) {
53045
53512
  const listed = await (0, import_node_util4.promisify)(import_node_child_process20.execFile)(
@@ -53109,7 +53576,7 @@ function gitignoreRules(root) {
53109
53576
  let rules2 = ignoreFiles.get(directory2);
53110
53577
  if (rules2 === void 0) {
53111
53578
  const file = import_node_path46.default.join(root, directory2, ".gitignore");
53112
- rules2 = import_node_fs48.default.existsSync(file) ? (0, import_ignore.default)().add(import_node_fs48.default.readFileSync(file, "utf8")) : null;
53579
+ rules2 = import_node_fs48.default.existsSync(file) ? createGitignoreMatcher().add(import_node_fs48.default.readFileSync(file, "utf8")) : null;
53113
53580
  ignoreFiles.set(directory2, rules2);
53114
53581
  }
53115
53582
  if (!rules2) continue;
@@ -53121,7 +53588,7 @@ function gitignoreRules(root) {
53121
53588
  return excluded;
53122
53589
  };
53123
53590
  }
53124
- var import_node_child_process20, import_node_fs48, import_node_path46, import_node_util4, import_ignore, gitEnvironment;
53591
+ var import_node_child_process20, import_node_fs48, import_node_path46, import_node_util4, gitEnvironment;
53125
53592
  var init_expo_workspace_exclusion = __esm({
53126
53593
  "src/expo-workspace-exclusion.ts"() {
53127
53594
  "use strict";
@@ -53129,7 +53596,7 @@ var init_expo_workspace_exclusion = __esm({
53129
53596
  import_node_fs48 = __toESM(require("node:fs"), 1);
53130
53597
  import_node_path46 = __toESM(require("node:path"), 1);
53131
53598
  import_node_util4 = require("node:util");
53132
- import_ignore = __toESM(require("peachsim/vendor/ignore"), 1);
53599
+ init_gitignore();
53133
53600
  gitEnvironment = () => ({
53134
53601
  ...process.env,
53135
53602
  GIT_CONFIG_GLOBAL: "/dev/null",
@@ -55961,24 +56428,37 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
55961
56428
  async function withSwiftCompileBudget(compileTimeoutMs, signal, work) {
55962
56429
  const deadline = new AbortController();
55963
56430
  const combined = signal ? AbortSignal.any([signal, deadline.signal]) : deadline.signal;
56431
+ const stallMs = compileTimeoutMs ?? SWIFT_COMPILE_TIMEOUT_MS;
56432
+ let compiling2 = false;
55964
56433
  let timer = setTimeout(
55965
56434
  () => deadline.abort(new Error("Swift build lock wait timed out")),
55966
56435
  SWIFT_LOCK_WAIT_TIMEOUT_MS
55967
56436
  );
56437
+ const restart = () => {
56438
+ clearTimeout(timer);
56439
+ timer = setTimeout(
56440
+ () => deadline.abort(
56441
+ new Error(
56442
+ `Swift compilation made no progress for ${Math.round(stallMs / 1e3)}s`
56443
+ )
56444
+ ),
56445
+ stallMs
56446
+ );
56447
+ };
55968
56448
  try {
55969
56449
  combined.throwIfAborted();
55970
56450
  const result = await work({
55971
56451
  signal: combined,
55972
56452
  startCompile() {
55973
56453
  combined.throwIfAborted();
55974
- clearTimeout(timer);
55975
- timer = setTimeout(
55976
- () => deadline.abort(new Error("Swift compilation timed out")),
55977
- compileTimeoutMs ?? SWIFT_COMPILE_TIMEOUT_MS
55978
- );
56454
+ compiling2 = true;
56455
+ restart();
56456
+ },
56457
+ progress() {
56458
+ if (compiling2 && !deadline.signal.aborted) restart();
55979
56459
  }
55980
56460
  });
55981
- combined.throwIfAborted();
56461
+ signal?.throwIfAborted();
55982
56462
  return result;
55983
56463
  } finally {
55984
56464
  clearTimeout(timer);
@@ -73984,6 +74464,7 @@ async function compileGuestLink(options2) {
73984
74464
  );
73985
74465
  continue;
73986
74466
  }
74467
+ options2.onStage("lowering the app image");
73987
74468
  const lowerPromise = link.lower();
73988
74469
  await new Promise((resolve16) => setImmediate(resolve16));
73989
74470
  let binding;
@@ -74014,6 +74495,7 @@ async function compileGuestLink(options2) {
74014
74495
  return binding;
74015
74496
  }
74016
74497
  }
74498
+ options2.onStage("lowering the app image");
74017
74499
  await lowerWasm(options2.output, options2.optimized, {
74018
74500
  optimize: options2.optimize,
74019
74501
  skipPasses: ["duplicate-function-elimination"],
@@ -75437,8 +75919,18 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
75437
75919
  void stopping.catch(() => {
75438
75920
  });
75439
75921
  };
75922
+ const restartTimeout = () => {
75923
+ if (!options2.timeout) return;
75924
+ clearTimeout(timeout);
75925
+ timeout = setTimeout(() => {
75926
+ failure3 = new Error(`Swift compiler was silent for ${options2.timeout}ms`);
75927
+ stop2();
75928
+ }, options2.timeout);
75929
+ };
75440
75930
  for (const name3 of ["stdout", "stderr"]) {
75441
75931
  child[name3].on("data", (bytes) => {
75932
+ restartTimeout();
75933
+ options2.onOutput?.();
75442
75934
  if (stream === true) process[name3].write(bytes);
75443
75935
  else if (stream) {
75444
75936
  const lines = (partial[name3] + bytes.toString()).split("\n");
@@ -75487,11 +75979,7 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
75487
75979
  resolve16(Buffer.concat(chunks.stdout).toString());
75488
75980
  }
75489
75981
  });
75490
- if (options2.timeout)
75491
- timeout = setTimeout(() => {
75492
- failure3 = new Error("Swift compiler timed out");
75493
- stop2();
75494
- }, options2.timeout);
75982
+ restartTimeout();
75495
75983
  if (signal?.aborted) stop2();
75496
75984
  });
75497
75985
  } finally {
@@ -78117,7 +78605,6 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
78117
78605
  (left, right) => right.path.length - left.path.length
78118
78606
  );
78119
78607
  const targetsByDir = indexTargetsByDirectory(bySourcePath);
78120
- const targetByName = new Map(targets.map((target) => [target.name, target]));
78121
78608
  const nativeTargets2 = input.nativeTargets ?? [];
78122
78609
  const nativeTargetByName = new Map(nativeTargets2.map((target) => [target.name, target]));
78123
78610
  const nativeTargetIndex = new Map(
@@ -78193,7 +78680,6 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
78193
78680
  checkedToolchain = swiftToolchain(pin2.release, swiftModuleSdk(moduleRoot));
78194
78681
  return checkedToolchain;
78195
78682
  };
78196
- const deploymentTarget = (name3) => nativeTargetByName.get(name3)?.deploymentTarget ?? targetByName.get(name3)?.iosDeploymentTarget ?? null;
78197
78683
  const targetStagedFiles = /* @__PURE__ */ new Map();
78198
78684
  const stageTargetFile = (target, file, contents2, options2) => {
78199
78685
  const relative7 = import_node_path81.default.relative(layout2.root, file).split(import_node_path81.default.sep).join(import_node_path81.default.posix.sep);
@@ -79268,7 +79754,7 @@ ${entry}`);
79268
79754
  };
79269
79755
  for (const target of targets) {
79270
79756
  if (!target.executable && !reachesNative(target.name)) continue;
79271
- const version2 = deploymentTarget(target.name);
79757
+ const version2 = nativeTargetByName.get(target.name)?.deploymentTarget ?? target.iosDeploymentTarget ?? null;
79272
79758
  const minimum = iosDeploymentMinimum(version2);
79273
79759
  if (minimum === void 0)
79274
79760
  throw new Error(
@@ -80380,24 +80866,18 @@ function readFrameworkProductsReceipt(scratch2, receiptKey) {
80380
80866
  } catch {
80381
80867
  return null;
80382
80868
  }
80383
- const archive = import_node_path81.default.join(scratch2, "lib");
80384
- const archiveStamp = import_node_path81.default.join(archive, ".receipt");
80385
- const archiveMatches = (0, import_node_fs81.existsSync)(archiveStamp) && (0, import_node_fs81.readFileSync)(archiveStamp, "utf8") === receiptKey;
80869
+ const archiveRoot = import_node_path81.default.join(scratch2, "products-lib", receiptKey);
80870
+ if (parsed2.root !== archiveRoot) return null;
80386
80871
  if (!(0, import_node_fs81.existsSync)(parsed2.modules)) return null;
80387
- for (const [object9] of parsed2.archived) if (!(0, import_node_fs81.existsSync)(object9)) return null;
80872
+ for (const [object9, rel] of parsed2.archived) {
80873
+ if (!(0, import_node_fs81.existsSync)(object9) || !(0, import_node_fs81.existsSync)(import_node_path81.default.join(archiveRoot, rel))) return null;
80874
+ }
80388
80875
  for (const file of parsed2.providers) if (!(0, import_node_fs81.existsSync)(file)) return null;
80389
80876
  for (const file of parsed2.moduleMaps) if (!(0, import_node_fs81.existsSync)(file)) return null;
80390
- if (!archiveMatches) {
80391
- (0, import_node_fs81.rmSync)(archive, { recursive: true, force: true });
80392
- (0, import_node_fs81.mkdirSync)(archive, { recursive: true });
80393
- for (const [object9, rel] of parsed2.archived)
80394
- (0, import_node_fs81.symlinkSync)(object9, import_node_path81.default.join(scratch2, rel));
80395
- (0, import_node_fs81.writeFileSync)(archiveStamp, receiptKey);
80396
- }
80397
80877
  for (const file of parsed2.objects) if (!(0, import_node_fs81.existsSync)(file)) return null;
80398
80878
  for (const file of parsed2.lazyObjects) if (!(0, import_node_fs81.existsSync)(file)) return null;
80399
80879
  return {
80400
- root: scratch2,
80880
+ root: parsed2.root,
80401
80881
  modules: parsed2.modules,
80402
80882
  objects: parsed2.objects,
80403
80883
  lazyObjects: parsed2.lazyObjects,
@@ -80415,7 +80895,7 @@ async function buildFrameworkProducts(scratch2, args) {
80415
80895
  const selectorOptions = swiftObjCSelectorOptions(args.moduleRoot);
80416
80896
  const receiptKey = (0, import_node_crypto48.createHash)("sha256").update(
80417
80897
  JSON.stringify([
80418
- "framework-products/v1",
80898
+ "framework-products/v2",
80419
80899
  args.frameworkKey,
80420
80900
  unoptimized,
80421
80901
  args.sdk,
@@ -80573,28 +81053,40 @@ async function buildFrameworkProducts(scratch2, args) {
80573
81053
  }
80574
81054
  const providers = (0, import_node_fs81.readdirSync)(providerDir).filter((file) => file.endsWith(".o")).sort().map((file) => import_node_path81.default.join(providerDir, file));
80575
81055
  for (const provider of providers) linked.owners.set(provider, "DarwinRecords");
80576
- const archive = import_node_path81.default.join(scratch2, "lib");
80577
- (0, import_node_fs81.rmSync)(archive, { recursive: true, force: true });
80578
- (0, import_node_fs81.mkdirSync)(archive);
81056
+ const archiveBase = import_node_path81.default.join(scratch2, "products-lib");
81057
+ (0, import_node_fs81.mkdirSync)(archiveBase, { recursive: true });
81058
+ const archiveRoot = import_node_path81.default.join(archiveBase, receiptKey);
81059
+ const stagedArchiveRoot = `${archiveRoot}.tmp-${process.pid}-${(0, import_node_crypto48.randomUUID)()}`;
81060
+ const stagedArchive = import_node_path81.default.join(stagedArchiveRoot, "lib");
81061
+ (0, import_node_fs81.mkdirSync)(stagedArchive, { recursive: true });
80579
81062
  const archived = /* @__PURE__ */ new Map();
80580
- for (const object9 of objects) {
80581
- const target = linked.owners.get(object9);
80582
- const dir = import_node_path81.default.join(release, `${target}.build`);
80583
- if (!target || target === "Darwin" || !object9.startsWith(dir + import_node_path81.default.sep)) continue;
80584
- const name3 = `${target}-${import_node_path81.default.relative(dir, object9).replaceAll(import_node_path81.default.sep, "-").replace(/\.swift\.o$/, ".o")}`;
80585
- (0, import_node_fs81.symlinkSync)(object9, import_node_path81.default.join(archive, name3));
80586
- archived.set(object9, `lib/${name3}`);
80587
- }
80588
- const roots = swiftObjcRootObjects(`${scratch2}
80589
- ${args.frameworkKey}`, scratch2, [
80590
- ...archived.values()
80591
- ]);
81063
+ try {
81064
+ for (const object9 of objects) {
81065
+ const target = linked.owners.get(object9);
81066
+ const dir = import_node_path81.default.join(release, `${target}.build`);
81067
+ if (!target || target === "Darwin" || !object9.startsWith(dir + import_node_path81.default.sep)) continue;
81068
+ const name3 = `${target}-${import_node_path81.default.relative(dir, object9).replaceAll(import_node_path81.default.sep, "-").replace(/\.swift\.o$/, ".o")}`;
81069
+ (0, import_node_fs81.symlinkSync)(object9, import_node_path81.default.join(stagedArchive, name3));
81070
+ archived.set(object9, `lib/${name3}`);
81071
+ }
81072
+ (0, import_node_fs81.rmSync)(archiveRoot, { recursive: true, force: true });
81073
+ (0, import_node_fs81.renameSync)(stagedArchiveRoot, archiveRoot);
81074
+ } catch (error) {
81075
+ (0, import_node_fs81.rmSync)(stagedArchiveRoot, { recursive: true, force: true });
81076
+ throw error;
81077
+ }
81078
+ const roots = swiftObjcRootObjects(
81079
+ `${archiveRoot}
81080
+ ${args.frameworkKey}`,
81081
+ archiveRoot,
81082
+ [...archived.values()]
81083
+ );
80592
81084
  const linkedObjects = objects.map((object9) => {
80593
81085
  const name3 = archived.get(object9);
80594
- return name3 ? { path: import_node_path81.default.join(scratch2, name3), lazy: !roots.has(name3) } : { path: object9, lazy: false };
81086
+ return name3 ? { path: import_node_path81.default.join(archiveRoot, name3), lazy: !roots.has(name3) } : { path: object9, lazy: false };
80595
81087
  });
80596
81088
  const result = {
80597
- root: scratch2,
81089
+ root: archiveRoot,
80598
81090
  modules: import_node_path81.default.join(release, "Modules"),
80599
81091
  objects: linkedObjects.filter((object9) => !object9.lazy).map((object9) => object9.path),
80600
81092
  lazyObjects: linkedObjects.filter((object9) => object9.lazy).map((object9) => object9.path),
@@ -80604,7 +81096,6 @@ ${args.frameworkKey}`, scratch2, [
80604
81096
  moduleMaps: linked.moduleMaps,
80605
81097
  objcHeaders: linked.objcHeaders
80606
81098
  };
80607
- (0, import_node_fs81.writeFileSync)(import_node_path81.default.join(archive, ".receipt"), receiptKey);
80608
81099
  const receiptsDir = import_node_path81.default.join(scratch2, "products-ready");
80609
81100
  (0, import_node_fs81.mkdirSync)(receiptsDir, { recursive: true });
80610
81101
  const receiptFile2 = import_node_path81.default.join(receiptsDir, `${receiptKey}.json`);
@@ -80612,6 +81103,7 @@ ${args.frameworkKey}`, scratch2, [
80612
81103
  (0, import_node_fs81.writeFileSync)(
80613
81104
  partialReceipt,
80614
81105
  JSON.stringify({
81106
+ root: result.root,
80615
81107
  modules: result.modules,
80616
81108
  objects: result.objects,
80617
81109
  lazyObjects: result.lazyObjects,
@@ -80643,7 +81135,10 @@ function swiftFrameworkSlotRecord(slot, record6) {
80643
81135
  function swiftFrameworkSlotKey(slot) {
80644
81136
  return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_KEY);
80645
81137
  }
80646
- async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, unoptimized = false) {
81138
+ function swiftFrameworkSlotRelease(slot) {
81139
+ return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_RELEASE);
81140
+ }
81141
+ async function withSwiftFrameworkSlot(frameworkKey, release, moduleRoot, signal, work, unoptimized = false) {
80647
81142
  const slotCount = unoptimized ? SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS : SWIFT_FRAMEWORK_SLOTS;
80648
81143
  const slotsDir = swiftFrameworksDir(unoptimized);
80649
81144
  const slots = Array.from({ length: slotCount }, (_, index) => {
@@ -80666,9 +81161,12 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
80666
81161
  (0, import_node_fs81.readFileSync)(import_node_path81.default.join(moduleRoot, file))
80667
81162
  ])
80668
81163
  );
80669
- const ranked = slots.map((slot) => {
81164
+ const ranked = slots.map((slot, index) => {
81165
+ const slotKey = swiftFrameworkSlotKey(slot);
81166
+ if (slotKey === null) return { slot, index, tier: 1, changes: Infinity };
81167
+ if (swiftFrameworkSlotRelease(slot) !== release)
81168
+ return { slot, index, tier: 2, changes: Infinity };
80670
81169
  let changes = 0;
80671
- if (swiftFrameworkSlotKey(slot) === null) return { slot, changes: Infinity };
80672
81170
  const source = import_node_path81.default.join(slot, "source", "packages", import_node_path81.default.basename(moduleRoot));
80673
81171
  for (const [file, contents2] of inputs2) {
80674
81172
  try {
@@ -80680,18 +81178,22 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
80680
81178
  changes++;
80681
81179
  }
80682
81180
  }
80683
- return { slot, changes };
80684
- }).sort(
80685
- (left, right) => left.changes - right.changes || Number(own2(right.slot)) - Number(own2(left.slot)) || (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0)
80686
- );
80687
- for (const { slot, changes } of ranked) {
81181
+ return { slot, index, tier: 0, changes };
81182
+ }).sort((left, right) => {
81183
+ if (left.tier !== right.tier) return left.tier - right.tier;
81184
+ if (left.tier === 0)
81185
+ return left.changes - right.changes || Number(own2(right.slot)) - Number(own2(left.slot)) || (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0);
81186
+ if (left.tier === 1) return left.index - right.index;
81187
+ return (built2.get(left.slot) ?? 0) - (built2.get(right.slot) ?? 0);
81188
+ });
81189
+ for (const { slot, tier, changes } of ranked) {
80688
81190
  if (await hasLiveSwiftRootReaders(slot, signal)) continue;
80689
81191
  const result = await withSwiftRootLock(
80690
81192
  slot,
80691
81193
  async (lease) => {
80692
81194
  if (await hasLiveSwiftRootReaders(slot, signal)) return void 0;
80693
81195
  console.error(
80694
- `[swift-framework-cache] ${import_node_path81.default.basename(slot)} changedInputs=${changes} totalInputs=${inputs2.size}`
81196
+ `[swift-framework-cache] ${import_node_path81.default.basename(slot)} release=${release} tier=${tier} changedInputs=${changes} totalInputs=${inputs2.size}`
80695
81197
  );
80696
81198
  return { value: await run18(slot)(lease) };
80697
81199
  },
@@ -80703,6 +81205,43 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
80703
81205
  const nearest = ranked[0].slot;
80704
81206
  return withSwiftRootLock(nearest, run18(nearest), signal);
80705
81207
  }
81208
+ async function withSwiftBuildRootSlot(baseRoot, buildShape, signal, work) {
81209
+ const slots = Array.from({ length: SWIFT_BUILD_ROOT_SLOTS }, (_, index) => {
81210
+ const slot = index === 0 ? baseRoot : `${baseRoot}-s${index}`;
81211
+ (0, import_node_fs81.mkdirSync)(slot, { recursive: true });
81212
+ return slot;
81213
+ });
81214
+ const runInSlot = (slot, waitStart2) => (lease) => {
81215
+ const waitedMs = Date.now() - waitStart2;
81216
+ const now = /* @__PURE__ */ new Date();
81217
+ (0, import_node_fs81.utimesSync)(slot, now, now);
81218
+ return work(slot, lease, waitedMs);
81219
+ };
81220
+ const built2 = new Map(slots.map((slot) => [slot, (0, import_node_fs81.statSync)(slot).mtimeMs]));
81221
+ const ranked = slots.map((slot, index) => {
81222
+ const shape = swiftFrameworkSlotRecord(slot, SWIFT_BUILD_ROOT_SHAPE);
81223
+ const tier = shape === buildShape ? 0 : shape === null ? 1 : 2;
81224
+ return { slot, index, tier };
81225
+ }).sort((left, right) => {
81226
+ if (left.tier !== right.tier) return left.tier - right.tier;
81227
+ if (left.tier === 0)
81228
+ return (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0);
81229
+ if (left.tier === 1) return left.index - right.index;
81230
+ return (built2.get(left.slot) ?? 0) - (built2.get(right.slot) ?? 0);
81231
+ });
81232
+ for (const { slot } of ranked) {
81233
+ const result = await withSwiftRootLock(
81234
+ slot,
81235
+ async (lease) => ({ value: await runInSlot(slot, Date.now())(lease) }),
81236
+ signal,
81237
+ false
81238
+ );
81239
+ if (result) return result.value;
81240
+ }
81241
+ const nearest = ranked[0].slot;
81242
+ const waitStart = Date.now();
81243
+ return withSwiftRootLock(nearest, runInSlot(nearest, waitStart), signal);
81244
+ }
80706
81245
  function mirrorTree2(source, target, skip) {
80707
81246
  (0, import_node_fs81.mkdirSync)(target, { recursive: true });
80708
81247
  const wanted = /* @__PURE__ */ new Set();
@@ -80752,8 +81291,10 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
80752
81291
  const hadKey = swiftFrameworkSlotKey(slot);
80753
81292
  if (hadKey !== frameworkKey) {
80754
81293
  (0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), { force: true });
81294
+ (0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), { force: true });
80755
81295
  (0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, "products-ready"), { recursive: true, force: true });
80756
- (0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, "lib", ".receipt"), { force: true });
81296
+ (0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, "products-lib"), { recursive: true, force: true });
81297
+ (0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, "lib"), { recursive: true, force: true });
80757
81298
  const moduleRestructured = mirrorTree2(moduleRoot, stagedModule, ".build");
80758
81299
  const sdkRestructured = mirrorTree2(
80759
81300
  swiftSharedSdkRoot(moduleRoot, false),
@@ -80781,8 +81322,11 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
80781
81322
  (0, import_node_fs81.rmSync)(modules, { recursive: true, force: true });
80782
81323
  (0, import_node_fs81.symlinkSync)(target, modules);
80783
81324
  }
81325
+ (0, import_node_fs81.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), release);
80784
81326
  (0, import_node_fs81.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), frameworkKey);
80785
81327
  (0, import_node_fs81.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_ORIGIN), moduleRoot);
81328
+ } else if (swiftFrameworkSlotRelease(slot) !== release) {
81329
+ (0, import_node_fs81.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), release);
80786
81330
  }
80787
81331
  return stagedModule;
80788
81332
  }
@@ -81010,660 +81554,717 @@ ${cap}` : "";
81010
81554
  (0, import_node_fs81.rmSync)(requestRoot, { recursive: true, force: true });
81011
81555
  }
81012
81556
  }
81557
+ const baseRoot = root;
81558
+ const canPoolBuildRoot = !options2.intermediates && !options2.project && !options2.linkOnly && import_node_path81.default.basename(import_node_path81.default.dirname(baseRoot)) === "swift-builds";
81559
+ const buildShape = canPoolBuildRoot ? (0, import_node_crypto48.createHash)("sha256").update(
81560
+ JSON.stringify([
81561
+ frameworkKey,
81562
+ Boolean(sdkImage),
81563
+ compileTargets(input).map((target) => target.name).sort(),
81564
+ input.oneModule === true,
81565
+ input.optimize === true,
81566
+ input.unoptimized === true,
81567
+ Object.keys(input.files).sort()
81568
+ ])
81569
+ ).digest("hex").slice(0, 16) : "";
81013
81570
  return withSwiftCompileBudget(options2.timeoutMs, options2.signal, async (budget) => {
81014
- return withSwiftRootLock(
81015
- root,
81016
- async (lease) => {
81017
- if (!options2.intermediates) {
81018
- const built2 = readCompiledArtifact(import_node_path81.default.join(sharedRoot, "artifact"), hash);
81019
- if (built2) {
81020
- report("reusing verified disk artifact");
81021
- return retain(root, built2);
81022
- }
81023
- }
81024
- const swift = import_node_path81.default.join(options2.toolchainBin, "swift");
81025
- if (!(0, import_node_fs81.existsSync)(swift)) {
81026
- throw new Error(
81027
- `swift-compile: no swift.org toolchain at ${options2.toolchainBin}; install ${options2.release} and its matching wasm sdk`
81028
- );
81571
+ const stage = (message) => {
81572
+ budget.progress();
81573
+ report(message);
81574
+ };
81575
+ const runLocked = (work) => {
81576
+ if (canPoolBuildRoot) {
81577
+ (0, import_node_fs81.mkdirSync)(sharedRoot, { recursive: true });
81578
+ return withSwiftRootLock(
81579
+ sharedRoot,
81580
+ async () => {
81581
+ const built2 = readCompiledArtifact(
81582
+ import_node_path81.default.join(sharedRoot, "artifact"),
81583
+ hash
81584
+ );
81585
+ if (built2) {
81586
+ stage("reusing verified disk artifact");
81587
+ return retain(baseRoot, built2);
81588
+ }
81589
+ return withSwiftBuildRootSlot(baseRoot, buildShape, budget.signal, work);
81590
+ },
81591
+ budget.signal
81592
+ );
81593
+ }
81594
+ const waitStart = Date.now();
81595
+ return withSwiftRootLock(
81596
+ baseRoot,
81597
+ (lease) => work(baseRoot, lease, Date.now() - waitStart),
81598
+ budget.signal
81599
+ );
81600
+ };
81601
+ return runLocked(async (slotRoot, lease, waitedMs) => {
81602
+ const root2 = slotRoot;
81603
+ const layout3 = {
81604
+ root: root2,
81605
+ sources: import_node_path81.default.join(root2, "Sources", "App"),
81606
+ multi: compileTargets(input).length > 0
81607
+ };
81608
+ if (!options2.intermediates) {
81609
+ const built2 = readCompiledArtifact(import_node_path81.default.join(sharedRoot, "artifact"), hash);
81610
+ if (built2) {
81611
+ stage("reusing verified disk artifact");
81612
+ return retain(baseRoot, built2);
81029
81613
  }
81030
- const unoptimized = input.unoptimized === true;
81031
- const withFrameworkLock = (work) => distribution ? work(null) : withSwiftFrameworkSlot(
81032
- frameworkKey,
81033
- moduleRoot,
81614
+ }
81615
+ if (waitedMs >= 1e3)
81616
+ report(`acquired build root ${import_node_path81.default.basename(root2)} after ${waitedMs}ms`);
81617
+ if (canPoolBuildRoot) {
81618
+ refreshSwiftCacheHold(root2);
81619
+ (0, import_node_fs81.writeFileSync)(import_node_path81.default.join(root2, SWIFT_BUILD_ROOT_SHAPE), buildShape);
81620
+ }
81621
+ const swift = import_node_path81.default.join(options2.toolchainBin, "swift");
81622
+ if (!(0, import_node_fs81.existsSync)(swift)) {
81623
+ throw new Error(
81624
+ `swift-compile: no swift.org toolchain at ${options2.toolchainBin}; install ${options2.release} and its matching wasm sdk`
81625
+ );
81626
+ }
81627
+ const unoptimized = input.unoptimized === true;
81628
+ const withFrameworkLock = (work) => distribution ? work(null) : withSwiftFrameworkSlot(
81629
+ frameworkKey,
81630
+ options2.release,
81631
+ moduleRoot,
81632
+ budget.signal,
81633
+ work,
81634
+ unoptimized
81635
+ );
81636
+ const baseBuildEnv = options2.project?.env ? {
81637
+ ...options2.project.env,
81638
+ // shipped host plugins resolve against the selected compiler's runtime.
81639
+ ...process.platform === "linux" ? {
81640
+ LD_LIBRARY_PATH: [
81641
+ import_node_path81.default.resolve(options2.toolchainBin, "../lib/swift/linux"),
81642
+ import_node_path81.default.resolve(options2.toolchainBin, "../lib/swift/host"),
81643
+ process.env.LD_LIBRARY_PATH
81644
+ ].filter(Boolean).join(":")
81645
+ } : {},
81646
+ PEACH_DEFER_WASM_LINK: "1"
81647
+ } : swiftCompilerBaseEnv(options2.toolchainBin, process.env);
81648
+ const {
81649
+ frameworkRoot,
81650
+ compileFrameworkRoot,
81651
+ macroPlugins,
81652
+ sdk: sdk2,
81653
+ icu,
81654
+ prebuilt,
81655
+ readHold
81656
+ } = await withFrameworkLock(async (slot, frameworkLease) => {
81657
+ budget.startCompile();
81658
+ if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
81659
+ await waitForNoSwiftRootReaders(slot, budget.signal);
81660
+ const frameworkRoot2 = mirrorDistribution ? syncSwiftDistributionMirror(root2, moduleRoot, mirrorDistribution) : distribution ? moduleRoot : stageFrameworkSource(moduleRoot, slot, frameworkKey, options2.release);
81661
+ if (!swiftModuleDigest(frameworkRoot2).equals(moduleDigest))
81662
+ throw new Error("Swift staged project source differs from the caller");
81663
+ stage("preparing compiler plugins");
81664
+ const macroPlugins2 = await ensureMacroPlugins(
81665
+ frameworkRoot2,
81666
+ options2.toolchainBin,
81667
+ options2.release,
81034
81668
  budget.signal,
81035
- work,
81036
- unoptimized
81669
+ frameworkLease
81037
81670
  );
81038
- const baseBuildEnv = options2.project?.env ? {
81039
- ...options2.project.env,
81040
- // shipped host plugins resolve against the selected compiler's runtime.
81041
- ...process.platform === "linux" ? {
81042
- LD_LIBRARY_PATH: [
81043
- import_node_path81.default.resolve(options2.toolchainBin, "../lib/swift/linux"),
81044
- import_node_path81.default.resolve(options2.toolchainBin, "../lib/swift/host"),
81045
- process.env.LD_LIBRARY_PATH
81046
- ].filter(Boolean).join(":")
81047
- } : {},
81048
- PEACH_DEFER_WASM_LINK: "1"
81049
- } : swiftCompilerBaseEnv(options2.toolchainBin, process.env);
81050
- const {
81671
+ const compileFrameworkRoot2 = distribution ? swiftDistributionCompileView(frameworkRoot2, distribution) : frameworkRoot2;
81672
+ const sdk3 = swiftModuleSdk(frameworkRoot2).wasmSdkId;
81673
+ const icu2 = options2.linkOnly ? null : swiftIcuAsset(options2.toolchainBin, sdk3);
81674
+ let prebuilt2;
81675
+ if (!distribution) {
81676
+ stage("compiling framework products");
81677
+ prebuilt2 = await buildFrameworkProducts(slot, {
81678
+ moduleRoot: frameworkRoot2,
81679
+ frameworkKey,
81680
+ input,
81681
+ swift,
81682
+ sdk: sdk3,
81683
+ toolchainBin: options2.toolchainBin,
81684
+ plugins: macroPlugins2,
81685
+ buildOptions: {
81686
+ env: baseBuildEnv,
81687
+ maxBuffer: 64 * 1024 * 1024,
81688
+ signal: budget.signal,
81689
+ onOutput: budget.progress,
81690
+ lease,
81691
+ frameworkLease
81692
+ }
81693
+ });
81694
+ }
81695
+ const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
81696
+ return {
81697
+ frameworkRoot: frameworkRoot2,
81698
+ compileFrameworkRoot: compileFrameworkRoot2,
81699
+ macroPlugins: macroPlugins2,
81700
+ sdk: sdk3,
81701
+ icu: icu2,
81702
+ prebuilt: prebuilt2,
81703
+ readHold: readHold2
81704
+ };
81705
+ });
81706
+ const buildOptions = {
81707
+ env: baseBuildEnv,
81708
+ maxBuffer: 64 * 1024 * 1024,
81709
+ signal: budget.signal,
81710
+ onOutput: budget.progress,
81711
+ lease
81712
+ };
81713
+ try {
81714
+ if (options2.project) removeProjectLinks(root2);
81715
+ const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
81716
+ if (retireStaleSwiftLink(
81717
+ root2,
81718
+ swiftLinkStamp({
81719
+ frameworkKey: `${options2.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
81720
+ packageHostMacros
81721
+ }),
81722
+ swiftLinkStamp({
81723
+ // a distribution's objects reach only the deferred link, and
81724
+ // the root's mirror keeps its compile inputs at fixed paths
81725
+ frameworkKey: distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
81726
+ prebuilt,
81727
+ packageHostMacros
81728
+ }),
81729
+ Boolean(options2.linkOnly)
81730
+ ))
81731
+ stage("framework revision changed; rebuilding the app link");
81732
+ const nativeToolset = needsNativeToolset(input, prebuilt);
81733
+ const preparation = writeSwiftProject(
81734
+ layout3,
81735
+ input,
81051
81736
  frameworkRoot,
81052
- compileFrameworkRoot,
81053
- macroPlugins,
81054
- sdk: sdk2,
81055
- icu,
81056
81737
  prebuilt,
81057
- readHold
81058
- } = await withFrameworkLock(async (slot, frameworkLease) => {
81059
- budget.startCompile();
81060
- if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
81061
- await waitForNoSwiftRootReaders(slot, budget.signal);
81062
- const frameworkRoot2 = mirrorDistribution ? syncSwiftDistributionMirror(root, moduleRoot, mirrorDistribution) : distribution ? moduleRoot : stageFrameworkSource(moduleRoot, slot, frameworkKey, options2.release);
81063
- if (!swiftModuleDigest(frameworkRoot2).equals(moduleDigest))
81064
- throw new Error("Swift staged project source differs from the caller");
81065
- report("preparing compiler plugins");
81066
- const macroPlugins2 = await ensureMacroPlugins(
81067
- frameworkRoot2,
81068
- options2.toolchainBin,
81069
- options2.release,
81070
- budget.signal,
81071
- frameworkLease
81738
+ !options2.project,
81739
+ options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0)
81740
+ );
81741
+ const productFile = import_node_path81.default.join(frameworkRoot, SWIFT_FRAMEWORK_PRODUCT_FILE);
81742
+ writeSwiftAutolinkLinker(
81743
+ root2,
81744
+ options2.toolchainBin,
81745
+ (0, import_node_fs81.existsSync)(productFile) ? [
81746
+ v6.parse(
81747
+ swiftFrameworkProductSchema,
81748
+ JSON.parse((0, import_node_fs81.readFileSync)(productFile, "utf8"))
81749
+ ).product.name
81750
+ ] : []
81751
+ );
81752
+ const compiler = preparation.targetToolset ? { CC: import_node_path81.default.join(root2, CLANG_TARGET_MODULE_WRAPPER) } : {};
81753
+ if (packageHostMacros?.length) {
81754
+ const swiftc = import_node_path81.default.join(root2, SWIFT_HOST_COMPILER_WRAPPER);
81755
+ writeBuildFile(
81756
+ swiftc,
81757
+ [
81758
+ "#!/bin/sh",
81759
+ "target=",
81760
+ "module=",
81761
+ "compile=",
81762
+ "previous=",
81763
+ "for argument do",
81764
+ ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
81765
+ ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
81766
+ " previous=$argument",
81767
+ "done",
81768
+ 'case "$target/$compile" in',
81769
+ " *-*-linux*/1)",
81770
+ ' case ",$PEACH_SWIFT_HOST_MACROS," in',
81771
+ ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
81772
+ " esac ;;",
81773
+ "esac",
81774
+ 'exec "$PEACH_SWIFTC" "$@"',
81775
+ ""
81776
+ ].join("\n")
81072
81777
  );
81073
- const compileFrameworkRoot2 = distribution ? swiftDistributionCompileView(frameworkRoot2, distribution) : frameworkRoot2;
81074
- const sdk3 = swiftModuleSdk(frameworkRoot2).wasmSdkId;
81075
- const icu2 = options2.linkOnly ? null : swiftIcuAsset(options2.toolchainBin, sdk3);
81076
- let prebuilt2;
81077
- if (!distribution) {
81078
- report("compiling framework products");
81079
- prebuilt2 = await buildFrameworkProducts(slot, {
81080
- moduleRoot: frameworkRoot2,
81081
- frameworkKey,
81082
- input,
81083
- swift,
81084
- sdk: sdk3,
81085
- toolchainBin: options2.toolchainBin,
81086
- plugins: macroPlugins2,
81087
- buildOptions: {
81088
- env: baseBuildEnv,
81089
- maxBuffer: 64 * 1024 * 1024,
81090
- signal: budget.signal,
81091
- lease,
81092
- frameworkLease
81093
- }
81094
- });
81778
+ (0, import_node_fs81.chmodSync)(swiftc, 493);
81779
+ compiler.SWIFT_EXEC = swiftc;
81780
+ compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
81781
+ compiler.PEACH_SWIFTC = import_node_path81.default.join(options2.toolchainBin, "swiftc");
81782
+ }
81783
+ const projectProcess = options2.project ? prepareSwiftProjectProcess(root2, options2.project) : void 0;
81784
+ const temporaryDirectory = projectProcess ? void 0 : import_node_path81.default.join(root2, ".build", "peach-compiler-tmp");
81785
+ const appOptions = projectProcess ? {
81786
+ ...buildOptions,
81787
+ uid: projectProcess.uid,
81788
+ gid: projectProcess.gid,
81789
+ confined: { ...projectProcess.env, ...compiler }
81790
+ } : {
81791
+ ...buildOptions,
81792
+ temporaryDirectory,
81793
+ env: {
81794
+ ...buildOptions.env,
81795
+ ...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
81796
+ ...compiler
81095
81797
  }
81096
- const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
81097
- return {
81098
- frameworkRoot: frameworkRoot2,
81099
- compileFrameworkRoot: compileFrameworkRoot2,
81100
- macroPlugins: macroPlugins2,
81101
- sdk: sdk3,
81102
- icu: icu2,
81103
- prebuilt: prebuilt2,
81104
- readHold: readHold2
81105
- };
81106
- });
81107
- const buildOptions = {
81108
- env: baseBuildEnv,
81109
- maxBuffer: 64 * 1024 * 1024,
81110
- signal: budget.signal,
81111
- lease
81112
81798
  };
81113
- try {
81114
- if (options2.project) removeProjectLinks(root);
81115
- const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
81116
- if (retireStaleSwiftLink(
81117
- root,
81118
- swiftLinkStamp({
81119
- frameworkKey: `${options2.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
81120
- packageHostMacros
81121
- }),
81122
- swiftLinkStamp({
81123
- // a distribution's objects reach only the deferred link, and
81124
- // the root's mirror keeps its compile inputs at fixed paths
81125
- frameworkKey: distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
81126
- prebuilt,
81127
- packageHostMacros
81128
- }),
81129
- Boolean(options2.linkOnly)
81130
- ))
81131
- report("framework revision changed; rebuilding the app link");
81132
- const nativeToolset = needsNativeToolset(input, prebuilt);
81133
- const preparation = writeSwiftProject(
81134
- layout2,
81135
- input,
81136
- frameworkRoot,
81137
- prebuilt,
81138
- !options2.project,
81139
- options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0)
81799
+ const unprepared = preparation.targetFailures.map(
81800
+ (failure3) => `error: target ${failure3}`
81801
+ );
81802
+ const forwarders = /* @__PURE__ */ new Map();
81803
+ for (const [file, text7] of Object.entries(input.files)) {
81804
+ const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text7)?.[1];
81805
+ if (!parents) continue;
81806
+ const directory2 = import_node_path81.default.posix.dirname(file);
81807
+ forwarders.set(
81808
+ `${import_node_path81.default.join(root2, directory2)}/${parents.slice(0, -1)}`,
81809
+ import_node_path81.default.posix.join("build", directory2, parents).replace(/\/$/, "")
81140
81810
  );
81141
- const productFile = import_node_path81.default.join(frameworkRoot, SWIFT_FRAMEWORK_PRODUCT_FILE);
81142
- writeSwiftAutolinkLinker(
81143
- root,
81144
- options2.toolchainBin,
81145
- (0, import_node_fs81.existsSync)(productFile) ? [
81146
- v6.parse(
81147
- swiftFrameworkProductSchema,
81148
- JSON.parse((0, import_node_fs81.readFileSync)(productFile, "utf8"))
81149
- ).product.name
81150
- ] : []
81811
+ }
81812
+ const jobs = swiftCompilerJobs();
81813
+ const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
81814
+ const perFile = input.unoptimized || incrementalPreview;
81815
+ const buildArgs = [
81816
+ "build",
81817
+ ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
81818
+ "--build-system",
81819
+ "native",
81820
+ "-j",
81821
+ String(jobs),
81822
+ "--package-path",
81823
+ root2,
81824
+ ...swiftCompileSdkOptions(frameworkRoot, options2.toolchainBin),
81825
+ ...swiftObjCSelectorOptions(frameworkRoot),
81826
+ "--swift-sdk",
81827
+ sdk2,
81828
+ ...preparation.targetToolset ? ["--toolset", import_node_path81.default.join(root2, ".peach-target-toolset.json")] : [],
81829
+ "-c",
81830
+ "release",
81831
+ ...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
81832
+ ...perFile ? [
81833
+ "-Xswiftc",
81834
+ "-no-whole-module-optimization",
81835
+ "-Xswiftc",
81836
+ "-j",
81837
+ "-Xswiftc",
81838
+ String(jobs)
81839
+ ] : [],
81840
+ ...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
81841
+ // the mirror finds a changed sdk header's readers in their
81842
+ // dependency files, which omit system headers by default
81843
+ ...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
81844
+ // the link strips debug info, so none is generated (as for the framework).
81845
+ // keep -num-threads fixed across caller core caps so llbuild does not
81846
+ // rebuild every target when callers alternate --cores, and bound backend
81847
+ // fan-out under high -j.
81848
+ "-Xswiftc",
81849
+ "-gnone",
81850
+ ...incrementalPreview ? [] : [
81851
+ "-Xswiftc",
81852
+ "-num-threads",
81853
+ "-Xswiftc",
81854
+ String(perFile ? 1 : Math.min(8, import_node_os16.default.availableParallelism()))
81855
+ ],
81856
+ ...swiftReproducibleBuildFlags([
81857
+ [import_node_path81.default.dirname(options2.toolchainBin), "toolchain"],
81858
+ [compileFrameworkRoot, "framework"],
81859
+ [root2, "build"],
81860
+ ...forwarders
81861
+ ]).flatMap((flag, index, flags) => {
81862
+ if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
81863
+ return [flag];
81864
+ const toolchainDir = import_node_path81.default.dirname(options2.toolchainBin);
81865
+ let mapped = flag;
81866
+ for (const [dir, target] of [
81867
+ [root2, "/peach/build"],
81868
+ [compileFrameworkRoot, "/peach/framework"],
81869
+ [(0, import_node_fs81.realpathSync)(compileFrameworkRoot), "/peach/framework"],
81870
+ [toolchainDir, "/peach/toolchain"],
81871
+ [(0, import_node_fs81.realpathSync)(toolchainDir), "/peach/toolchain"]
81872
+ ]) {
81873
+ mapped = mapped.replaceAll(dir, target);
81874
+ }
81875
+ const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
81876
+ const tool = flags[index - 1];
81877
+ return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
81878
+ }),
81879
+ ...macroPlugins.libraries.flatMap((plugin) => [
81880
+ "-Xswiftc",
81881
+ "-load-plugin-library",
81882
+ "-Xswiftc",
81883
+ plugin
81884
+ ]),
81885
+ ...macroPlugins.executables.flatMap((plugin) => [
81886
+ "-Xswiftc",
81887
+ "-load-plugin-executable",
81888
+ "-Xswiftc",
81889
+ `${plugin}#ExpoModulesMacros`
81890
+ ])
81891
+ ];
81892
+ const linked = builtArtifact(layout3);
81893
+ (0, import_node_fs81.rmSync)(import_node_path81.default.join(root2, ".peach-link.rsp"), { force: true });
81894
+ if (options2.linkOnly || (0, import_node_fs81.existsSync)(linked) && (0, import_node_fs81.statSync)(linked).size <= 8)
81895
+ (0, import_node_fs81.rmSync)(linked, { force: true });
81896
+ stage("compiling and linking Swift modules");
81897
+ const frameworkInterfaces = /* @__PURE__ */ new Map();
81898
+ const sdkFrameworks = import_node_path81.default.join(
81899
+ swiftSdkPaths(frameworkRoot, options2.toolchainBin).darwin,
81900
+ "System/Library/Frameworks"
81901
+ );
81902
+ const generatedInterface = (source) => withoutImportedSdkEnumForwards(
81903
+ clangInterfaceHeader((0, import_node_fs81.readFileSync)(source, "utf8"), frameworkRoot),
81904
+ sdkObjCDeclarationOwners(sdkFrameworks)
81905
+ );
81906
+ const nativeDeclarations = /* @__PURE__ */ new Map();
81907
+ const nativeHeaders = Object.entries(input.files).filter(([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")).map(([, source]) => source);
81908
+ for (const [file, contents2] of Object.entries(input.files)) {
81909
+ if (!file.endsWith(".modulemap")) continue;
81910
+ const name3 = moduleMapName(contents2);
81911
+ const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents2)?.[1];
81912
+ if (!name3 || !umbrella) continue;
81913
+ const header = input.files[import_node_path81.default.posix.join(import_node_path81.default.posix.dirname(file), umbrella)];
81914
+ if (header === void 0) continue;
81915
+ const included = new Set(
81916
+ [
81917
+ ...header.matchAll(/^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm)
81918
+ ].map((match) => import_node_path81.default.posix.basename(match[1]))
81151
81919
  );
81152
- const compiler = preparation.targetToolset ? { CC: import_node_path81.default.join(root, CLANG_TARGET_MODULE_WRAPPER) } : {};
81153
- if (packageHostMacros?.length) {
81154
- const swiftc = import_node_path81.default.join(root, SWIFT_HOST_COMPILER_WRAPPER);
81155
- writeBuildFile(
81156
- swiftc,
81157
- [
81158
- "#!/bin/sh",
81159
- "target=",
81160
- "module=",
81161
- "compile=",
81162
- "previous=",
81163
- "for argument do",
81164
- ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
81165
- ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
81166
- " previous=$argument",
81167
- "done",
81168
- 'case "$target/$compile" in',
81169
- " *-*-linux*/1)",
81170
- ' case ",$PEACH_SWIFT_HOST_MACROS," in',
81171
- ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
81172
- " esac ;;",
81173
- "esac",
81174
- 'exec "$PEACH_SWIFTC" "$@"',
81175
- ""
81176
- ].join("\n")
81177
- );
81178
- (0, import_node_fs81.chmodSync)(swiftc, 493);
81179
- compiler.SWIFT_EXEC = swiftc;
81180
- compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
81181
- compiler.PEACH_SWIFTC = import_node_path81.default.join(options2.toolchainBin, "swiftc");
81920
+ const declarations = nativeDeclarations.get(name3) ?? /* @__PURE__ */ new Set();
81921
+ for (const declaration of swiftInterfaceDeclarations(header))
81922
+ declarations.add(declaration);
81923
+ for (const [candidate, source] of Object.entries(input.files))
81924
+ if (included.has(import_node_path81.default.posix.basename(candidate)))
81925
+ for (const declaration of swiftInterfaceDeclarations(source))
81926
+ declarations.add(declaration);
81927
+ nativeDeclarations.set(name3, declarations);
81928
+ }
81929
+ const frameworkInterface = (name3) => {
81930
+ if (frameworkInterfaces.has(name3)) return frameworkInterfaces.get(name3);
81931
+ const source = distribution ? import_node_path81.default.join(frameworkRoot, "modules", `${name3}-Swift.h`) : prebuilt.objcHeaders.get(name3);
81932
+ if (!source || !(0, import_node_fs81.existsSync)(source)) {
81933
+ frameworkInterfaces.set(name3, null);
81934
+ return null;
81182
81935
  }
81183
- const projectProcess = options2.project ? prepareSwiftProjectProcess(root, options2.project) : void 0;
81184
- const temporaryDirectory = projectProcess ? void 0 : import_node_path81.default.join(root, ".build", "peach-compiler-tmp");
81185
- const appOptions = projectProcess ? {
81186
- ...buildOptions,
81187
- uid: projectProcess.uid,
81188
- gid: projectProcess.gid,
81189
- confined: { ...projectProcess.env, ...compiler }
81190
- } : {
81191
- ...buildOptions,
81192
- temporaryDirectory,
81193
- env: {
81194
- ...buildOptions.env,
81195
- ...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
81196
- ...compiler
81197
- }
81198
- };
81199
- const unprepared = preparation.targetFailures.map(
81200
- (failure3) => `error: target ${failure3}`
81936
+ const headers = import_node_path81.default.join(sdkFrameworks, `${name3}.framework/Headers`);
81937
+ const declared = /* @__PURE__ */ new Set();
81938
+ if ((0, import_node_fs81.existsSync)(headers)) {
81939
+ for (const file of (0, import_node_fs81.readdirSync)(headers, {
81940
+ recursive: true,
81941
+ encoding: "utf8"
81942
+ }))
81943
+ if (file.endsWith(".h"))
81944
+ for (const name4 of swiftInterfaceDeclarations(
81945
+ (0, import_node_fs81.readFileSync)(import_node_path81.default.join(headers, file), "utf8")
81946
+ ))
81947
+ declared.add(name4);
81948
+ }
81949
+ for (const declaration of nativeDeclarations.get(name3) ?? [])
81950
+ declared.add(declaration);
81951
+ const own2 = withoutSwiftDeclarations(
81952
+ generatedInterface(source),
81953
+ declared,
81954
+ nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
81201
81955
  );
81202
- const forwarders = /* @__PURE__ */ new Map();
81203
- for (const [file, text7] of Object.entries(input.files)) {
81204
- const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text7)?.[1];
81205
- if (!parents) continue;
81206
- const directory2 = import_node_path81.default.posix.dirname(file);
81207
- forwarders.set(
81208
- `${import_node_path81.default.join(root, directory2)}/${parents.slice(0, -1)}`,
81209
- import_node_path81.default.posix.join("build", directory2, parents).replace(/\/$/, "")
81210
- );
81956
+ const owners = sdkObjCDeclarationOwners(sdkFrameworks);
81957
+ const foreign = /* @__PURE__ */ new Map();
81958
+ for (const declaration of [
81959
+ ...swiftInterfaceDeclarations(own2),
81960
+ ...objcEnumerations(own2),
81961
+ ...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
81962
+ (match) => match[1]
81963
+ )
81964
+ ]) {
81965
+ const owner = owners.get(declaration);
81966
+ if (owner && owner !== name3) foreign.set(declaration, owner);
81211
81967
  }
81212
- const jobs = swiftCompilerJobs();
81213
- const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
81214
- const perFile = input.unoptimized || incrementalPreview;
81215
- const buildArgs = [
81216
- "build",
81217
- ...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
81218
- "--build-system",
81219
- "native",
81220
- "-j",
81221
- String(jobs),
81222
- "--package-path",
81223
- root,
81224
- ...swiftCompileSdkOptions(frameworkRoot, options2.toolchainBin),
81225
- ...swiftObjCSelectorOptions(frameworkRoot),
81226
- "--swift-sdk",
81227
- sdk2,
81228
- ...preparation.targetToolset ? ["--toolset", import_node_path81.default.join(root, ".peach-target-toolset.json")] : [],
81229
- "-c",
81230
- "release",
81231
- ...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
81232
- ...perFile ? [
81233
- "-Xswiftc",
81234
- "-no-whole-module-optimization",
81235
- "-Xswiftc",
81236
- "-j",
81237
- "-Xswiftc",
81238
- String(jobs)
81239
- ] : [],
81240
- ...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
81241
- // the mirror finds a changed sdk header's readers in their
81242
- // dependency files, which omit system headers by default
81243
- ...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
81244
- // the link strips debug info, so none is generated (as for the framework).
81245
- // keep -num-threads fixed across caller core caps so llbuild does not
81246
- // rebuild every target when callers alternate --cores, and bound backend
81247
- // fan-out under high -j.
81248
- "-Xswiftc",
81249
- "-gnone",
81250
- ...incrementalPreview ? [] : [
81251
- "-Xswiftc",
81252
- "-num-threads",
81253
- "-Xswiftc",
81254
- String(perFile ? 1 : Math.min(8, import_node_os16.default.availableParallelism()))
81255
- ],
81256
- ...swiftReproducibleBuildFlags([
81257
- [import_node_path81.default.dirname(options2.toolchainBin), "toolchain"],
81258
- [compileFrameworkRoot, "framework"],
81259
- [root, "build"],
81260
- ...forwarders
81261
- ]).flatMap((flag, index, flags) => {
81262
- if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
81263
- return [flag];
81264
- const toolchainDir = import_node_path81.default.dirname(options2.toolchainBin);
81265
- let mapped = flag;
81266
- for (const [dir, target] of [
81267
- [root, "/peach/build"],
81268
- [compileFrameworkRoot, "/peach/framework"],
81269
- [(0, import_node_fs81.realpathSync)(compileFrameworkRoot), "/peach/framework"],
81270
- [toolchainDir, "/peach/toolchain"],
81271
- [(0, import_node_fs81.realpathSync)(toolchainDir), "/peach/toolchain"]
81272
- ]) {
81273
- mapped = mapped.replaceAll(dir, target);
81274
- }
81275
- const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
81276
- const tool = flags[index - 1];
81277
- return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
81278
- }),
81279
- ...macroPlugins.libraries.flatMap((plugin) => [
81280
- "-Xswiftc",
81281
- "-load-plugin-library",
81282
- "-Xswiftc",
81283
- plugin
81284
- ]),
81285
- ...macroPlugins.executables.flatMap((plugin) => [
81286
- "-Xswiftc",
81287
- "-load-plugin-executable",
81288
- "-Xswiftc",
81289
- `${plugin}#ExpoModulesMacros`
81290
- ])
81291
- ];
81292
- const linked = builtArtifact(layout2);
81293
- (0, import_node_fs81.rmSync)(import_node_path81.default.join(root, ".peach-link.rsp"), { force: true });
81294
- if (options2.linkOnly || (0, import_node_fs81.existsSync)(linked) && (0, import_node_fs81.statSync)(linked).size <= 8)
81295
- (0, import_node_fs81.rmSync)(linked, { force: true });
81296
- report("compiling and linking Swift modules");
81297
- const frameworkInterfaces = /* @__PURE__ */ new Map();
81298
- const sdkFrameworks = import_node_path81.default.join(
81299
- swiftSdkPaths(frameworkRoot, options2.toolchainBin).darwin,
81300
- "System/Library/Frameworks"
81968
+ const header = foreign.size ? withoutSwiftDeclarations(
81969
+ own2,
81970
+ new Set(foreign.keys()),
81971
+ [...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
81972
+ ) : own2;
81973
+ const value = {
81974
+ file: import_node_path81.default.join(root2, ".build/peach-framework-objc", `${name3}-Swift.h`),
81975
+ header,
81976
+ module: (0, import_node_fs81.existsSync)(headers)
81977
+ };
81978
+ frameworkInterfaces.set(name3, value);
81979
+ writeBuildFile(
81980
+ value.file,
81981
+ ((0, import_node_fs81.existsSync)(import_node_path81.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
81982
+ ` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
81301
81983
  );
81302
- const generatedInterface = (source) => withoutImportedSdkEnumForwards(
81303
- clangInterfaceHeader((0, import_node_fs81.readFileSync)(source, "utf8"), frameworkRoot),
81304
- sdkObjCDeclarationOwners(sdkFrameworks)
81984
+ return value;
81985
+ };
81986
+ const headerPaths = (producer) => {
81987
+ const stem2 = import_node_path81.default.join(
81988
+ root2,
81989
+ ".build",
81990
+ "peach-cxx-headers",
81991
+ `${producer}-Swift`
81305
81992
  );
81306
- const nativeDeclarations = /* @__PURE__ */ new Map();
81307
- const nativeHeaders = Object.entries(input.files).filter(([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")).map(([, source]) => source);
81308
- for (const [file, contents2] of Object.entries(input.files)) {
81309
- if (!file.endsWith(".modulemap")) continue;
81310
- const name3 = moduleMapName(contents2);
81311
- const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents2)?.[1];
81312
- if (!name3 || !umbrella) continue;
81313
- const header = input.files[import_node_path81.default.posix.join(import_node_path81.default.posix.dirname(file), umbrella)];
81314
- if (header === void 0) continue;
81315
- const included = new Set(
81316
- [
81317
- ...header.matchAll(/^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm)
81318
- ].map((match) => import_node_path81.default.posix.basename(match[1]))
81319
- );
81320
- const declarations = nativeDeclarations.get(name3) ?? /* @__PURE__ */ new Set();
81321
- for (const declaration of swiftInterfaceDeclarations(header))
81322
- declarations.add(declaration);
81323
- for (const [candidate, source] of Object.entries(input.files))
81324
- if (included.has(import_node_path81.default.posix.basename(candidate)))
81325
- for (const declaration of swiftInterfaceDeclarations(source))
81326
- declarations.add(declaration);
81327
- nativeDeclarations.set(name3, declarations);
81328
- }
81329
- const frameworkInterface = (name3) => {
81330
- if (frameworkInterfaces.has(name3)) return frameworkInterfaces.get(name3);
81331
- const source = distribution ? import_node_path81.default.join(frameworkRoot, "modules", `${name3}-Swift.h`) : prebuilt.objcHeaders.get(name3);
81332
- if (!source || !(0, import_node_fs81.existsSync)(source)) {
81333
- frameworkInterfaces.set(name3, null);
81334
- return null;
81335
- }
81336
- const headers = import_node_path81.default.join(sdkFrameworks, `${name3}.framework/Headers`);
81337
- const declared = /* @__PURE__ */ new Set();
81338
- if ((0, import_node_fs81.existsSync)(headers)) {
81339
- for (const file of (0, import_node_fs81.readdirSync)(headers, {
81340
- recursive: true,
81341
- encoding: "utf8"
81342
- }))
81343
- if (file.endsWith(".h"))
81344
- for (const name4 of swiftInterfaceDeclarations(
81345
- (0, import_node_fs81.readFileSync)(import_node_path81.default.join(headers, file), "utf8")
81346
- ))
81347
- declared.add(name4);
81348
- }
81349
- for (const declaration of nativeDeclarations.get(name3) ?? [])
81350
- declared.add(declaration);
81351
- const own2 = withoutSwiftDeclarations(
81352
- generatedInterface(source),
81353
- declared,
81354
- nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
81355
- );
81356
- const owners = sdkObjCDeclarationOwners(sdkFrameworks);
81357
- const foreign = /* @__PURE__ */ new Map();
81358
- for (const declaration of [
81359
- ...swiftInterfaceDeclarations(own2),
81360
- ...objcEnumerations(own2),
81361
- ...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
81362
- (match) => match[1]
81363
- )
81364
- ]) {
81365
- const owner = owners.get(declaration);
81366
- if (owner && owner !== name3) foreign.set(declaration, owner);
81993
+ return { producer, original: `${stem2}.original.h`, emitted: `${stem2}.h` };
81994
+ };
81995
+ const publishHeader = ({
81996
+ producer,
81997
+ original,
81998
+ emitted
81999
+ }) => {
82000
+ const generated = generatedInterface(original);
82001
+ writeBuildFile(
82002
+ emitted,
82003
+ withoutSwiftDeclarations(
82004
+ swiftHeaderWithSuperclassImports(generated, frameworkInterface),
82005
+ /* @__PURE__ */ new Set([
82006
+ ...preparation.nativeHeaderDeclarations[producer] ?? [],
82007
+ ...nativelyDeclaredFunctions(generated, nativeHeaders)
82008
+ ]),
82009
+ `#import <${producer}/${producer}.h>`
82010
+ )
82011
+ );
82012
+ };
82013
+ const recipe2 = inputHash.copy().update(
82014
+ distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
82015
+ ).update((0, import_node_fs81.readFileSync)(import_node_path81.default.join(root2, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
82016
+ const runApp = async (compiler2) => {
82017
+ const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
82018
+ const stages = [
82019
+ ...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
82020
+ target,
82021
+ producers: []
82022
+ })),
82023
+ ...preparation.headerBuilds,
82024
+ ...(preparation.nativeProductTargets ?? []).map((target) => ({
82025
+ target,
82026
+ producers: []
82027
+ }))
82028
+ ];
82029
+ const checkpoints = import_node_path81.default.join(root2, ".build", "peach-product-checkpoints");
82030
+ const buildDbExists = (0, import_node_fs81.existsSync)(import_node_path81.default.join(root2, ".build", "build.db"));
82031
+ const releaseDir = import_node_path81.default.dirname(linked);
82032
+ for (const { target, producers } of stages) {
82033
+ if (!options2.project && producers.length === 0 && buildDbExists) {
82034
+ const expectedObjects = preparation.nativeStageObjects.get(target);
82035
+ if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
82036
+ (relative7) => (0, import_node_fs81.statSync)(import_node_path81.default.join(releaseDir, relative7), {
82037
+ throwIfNoEntry: false
82038
+ })?.isFile()
82039
+ ))
82040
+ continue;
81367
82041
  }
81368
- const header = foreign.size ? withoutSwiftDeclarations(
81369
- own2,
81370
- new Set(foreign.keys()),
81371
- [...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
81372
- ) : own2;
81373
- const value = {
81374
- file: import_node_path81.default.join(root, ".build/peach-framework-objc", `${name3}-Swift.h`),
81375
- header,
81376
- module: (0, import_node_fs81.existsSync)(headers)
81377
- };
81378
- frameworkInterfaces.set(name3, value);
81379
- writeBuildFile(
81380
- value.file,
81381
- ((0, import_node_fs81.existsSync)(import_node_path81.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
81382
- ` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
81383
- );
81384
- return value;
81385
- };
81386
- const headerPaths = (producer) => {
81387
- const stem2 = import_node_path81.default.join(
81388
- root,
81389
- ".build",
81390
- "peach-cxx-headers",
81391
- `${producer}-Swift`
82042
+ const receipt = import_node_path81.default.join(
82043
+ checkpoints,
82044
+ (0, import_node_crypto48.createHash)("sha256").update(target).digest("hex")
81392
82045
  );
81393
- return { producer, original: `${stem2}.original.h`, emitted: `${stem2}.h` };
81394
- };
81395
- const publishHeader = ({
81396
- producer,
81397
- original,
81398
- emitted
81399
- }) => {
81400
- const generated = generatedInterface(original);
81401
- writeBuildFile(
81402
- emitted,
81403
- withoutSwiftDeclarations(
81404
- swiftHeaderWithSuperclassImports(generated, frameworkInterface),
81405
- /* @__PURE__ */ new Set([
81406
- ...preparation.nativeHeaderDeclarations[producer] ?? [],
81407
- ...nativelyDeclaredFunctions(generated, nativeHeaders)
81408
- ]),
81409
- `#import <${producer}/${producer}.h>`
81410
- )
81411
- );
81412
- };
81413
- const recipe2 = inputHash.copy().update(
81414
- distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
81415
- ).update((0, import_node_fs81.readFileSync)(import_node_path81.default.join(root, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
81416
- const runApp = async (compiler2) => {
81417
- const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
81418
- const stages = [
81419
- ...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
81420
- target,
81421
- producers: []
81422
- })),
81423
- ...preparation.headerBuilds,
81424
- ...(preparation.nativeProductTargets ?? []).map((target) => ({
81425
- target,
81426
- producers: []
81427
- }))
81428
- ];
81429
- const checkpoints = import_node_path81.default.join(root, ".build", "peach-product-checkpoints");
81430
- const buildDbExists = (0, import_node_fs81.existsSync)(import_node_path81.default.join(root, ".build", "build.db"));
81431
- const releaseDir = import_node_path81.default.dirname(linked);
81432
- for (const { target, producers } of stages) {
81433
- if (!options2.project && producers.length === 0 && buildDbExists) {
81434
- const expectedObjects = preparation.nativeStageObjects.get(target);
81435
- if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
81436
- (relative7) => (0, import_node_fs81.statSync)(import_node_path81.default.join(releaseDir, relative7), {
81437
- throwIfNoEntry: false
81438
- })?.isFile()
81439
- ))
81440
- continue;
81441
- }
81442
- const receipt = import_node_path81.default.join(
81443
- checkpoints,
81444
- (0, import_node_crypto48.createHash)("sha256").update(target).digest("hex")
81445
- );
81446
- const headers = producers.map(headerPaths);
81447
- for (const header of headers)
81448
- if ((0, import_node_fs81.existsSync)(header.original)) publishHeader(header);
81449
- const fingerprint = () => {
81450
- const digest3 = (0, import_node_crypto48.createHash)("sha256").update(recipe2);
81451
- for (const { original, emitted } of headers) {
81452
- if (!(0, import_node_fs81.existsSync)(original) || !(0, import_node_fs81.existsSync)(emitted)) return;
81453
- digest3.update(
81454
- (0, import_node_crypto48.createHash)("sha256").update((0, import_node_fs81.readFileSync)(emitted)).digest()
81455
- );
81456
- }
81457
- return digest3.digest("hex");
81458
- };
81459
- if (!options2.project && (0, import_node_fs81.existsSync)(receipt) && (0, import_node_fs81.readFileSync)(receipt, "utf8") === fingerprint())
81460
- continue;
81461
- if (!options2.project) (0, import_node_fs81.rmSync)(receipt, { force: true });
81462
- for (const header of headers) {
81463
- if (!(0, import_node_fs81.existsSync)(header.original))
81464
- (0, import_node_fs81.rmSync)(
81465
- import_node_path81.default.join(
81466
- import_node_path81.default.dirname(linked),
81467
- "Modules",
81468
- `${swiftTargetModuleName(header.producer)}.swiftmodule`
81469
- ),
81470
- { force: true }
81471
- );
81472
- }
81473
- await runCompiler(
81474
- swift,
81475
- [...buildArgs, "--target", target],
81476
- optionsWithCompiler,
81477
- /^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
81478
- SWIFTPM_NOISE
81479
- );
81480
- if (!compiler2) for (const header of headers) publishHeader(header);
81481
- if (!options2.project) {
81482
- const checkpoint = fingerprint();
81483
- if (checkpoint === void 0)
81484
- throw new Error(`missing Swift headers after building ${target}`);
81485
- (0, import_node_fs81.mkdirSync)(checkpoints, { recursive: true });
81486
- (0, import_node_fs81.writeFileSync)(`${receipt}.partial`, checkpoint);
81487
- (0, import_node_fs81.renameSync)(`${receipt}.partial`, receipt);
82046
+ const headers = producers.map(headerPaths);
82047
+ for (const header of headers)
82048
+ if ((0, import_node_fs81.existsSync)(header.original)) publishHeader(header);
82049
+ const fingerprint = () => {
82050
+ const digest3 = (0, import_node_crypto48.createHash)("sha256").update(recipe2);
82051
+ for (const { original, emitted } of headers) {
82052
+ if (!(0, import_node_fs81.existsSync)(original) || !(0, import_node_fs81.existsSync)(emitted)) return;
82053
+ digest3.update(
82054
+ (0, import_node_crypto48.createHash)("sha256").update((0, import_node_fs81.readFileSync)(emitted)).digest()
82055
+ );
81488
82056
  }
82057
+ return digest3.digest("hex");
82058
+ };
82059
+ if (!options2.project && (0, import_node_fs81.existsSync)(receipt) && (0, import_node_fs81.readFileSync)(receipt, "utf8") === fingerprint())
82060
+ continue;
82061
+ if (!options2.project) (0, import_node_fs81.rmSync)(receipt, { force: true });
82062
+ for (const header of headers) {
82063
+ if (!(0, import_node_fs81.existsSync)(header.original))
82064
+ (0, import_node_fs81.rmSync)(
82065
+ import_node_path81.default.join(
82066
+ import_node_path81.default.dirname(linked),
82067
+ "Modules",
82068
+ `${swiftTargetModuleName(header.producer)}.swiftmodule`
82069
+ ),
82070
+ { force: true }
82071
+ );
81489
82072
  }
81490
82073
  await runCompiler(
81491
82074
  swift,
81492
- buildArgs,
82075
+ [...buildArgs, "--target", target],
81493
82076
  optionsWithCompiler,
81494
- SWIFTPM_PROGRESS,
82077
+ /^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
81495
82078
  SWIFTPM_NOISE
81496
82079
  );
81497
- };
81498
- const compileApp = () => preparation.headerCompiler ? withSwiftHeaderCompiler(
81499
- root,
81500
- options2.toolchainBin,
81501
- recipe2,
81502
- new Map(
81503
- preparation.headerBuilds[0].producers.map((producer) => {
81504
- const paths = headerPaths(producer);
81505
- return [
81506
- swiftTargetModuleName(producer),
81507
- {
81508
- header: paths.original,
81509
- publish: () => publishHeader(paths)
81510
- }
81511
- ];
81512
- })
81513
- ),
81514
- runApp
81515
- ) : runApp();
81516
- try {
81517
- if (temporaryDirectory) (0, import_node_fs81.mkdirSync)(temporaryDirectory, { recursive: true });
81518
- await compileApp();
81519
- } catch (error) {
81520
- const output2 = outputOf(error);
81521
- const moduleCache = import_node_path81.default.join(
81522
- root,
81523
- ".build",
81524
- WASM_TRIPLE,
81525
- "release",
81526
- "ModuleCache"
81527
- );
81528
- if (output2.includes("was compiled with module cache path") && (0, import_node_fs81.existsSync)(moduleCache)) {
81529
- (0, import_node_fs81.rmSync)(moduleCache, { recursive: true, force: true });
81530
- try {
81531
- await compileApp();
81532
- } catch (retryError) {
81533
- throw new Error(
81534
- [
81535
- ...unprepared,
81536
- projectDiagnostic(outputOf(retryError), layout2, input.files)
81537
- ].join("\n"),
81538
- { cause: retryError }
81539
- );
81540
- }
81541
- } else {
82080
+ if (!compiler2) for (const header of headers) publishHeader(header);
82081
+ if (!options2.project) {
82082
+ const checkpoint = fingerprint();
82083
+ if (checkpoint === void 0)
82084
+ throw new Error(`missing Swift headers after building ${target}`);
82085
+ (0, import_node_fs81.mkdirSync)(checkpoints, { recursive: true });
82086
+ (0, import_node_fs81.writeFileSync)(`${receipt}.partial`, checkpoint);
82087
+ (0, import_node_fs81.renameSync)(`${receipt}.partial`, receipt);
82088
+ }
82089
+ }
82090
+ await runCompiler(
82091
+ swift,
82092
+ buildArgs,
82093
+ optionsWithCompiler,
82094
+ SWIFTPM_PROGRESS,
82095
+ SWIFTPM_NOISE
82096
+ );
82097
+ };
82098
+ const compileApp = () => preparation.headerCompiler ? withSwiftHeaderCompiler(
82099
+ root2,
82100
+ options2.toolchainBin,
82101
+ recipe2,
82102
+ new Map(
82103
+ preparation.headerBuilds[0].producers.map((producer) => {
82104
+ const paths = headerPaths(producer);
82105
+ return [
82106
+ swiftTargetModuleName(producer),
82107
+ {
82108
+ header: paths.original,
82109
+ publish: () => publishHeader(paths)
82110
+ }
82111
+ ];
82112
+ })
82113
+ ),
82114
+ runApp
82115
+ ) : runApp();
82116
+ try {
82117
+ if (temporaryDirectory) (0, import_node_fs81.mkdirSync)(temporaryDirectory, { recursive: true });
82118
+ await compileApp();
82119
+ } catch (error) {
82120
+ const output2 = outputOf(error);
82121
+ const moduleCache = import_node_path81.default.join(
82122
+ root2,
82123
+ ".build",
82124
+ WASM_TRIPLE,
82125
+ "release",
82126
+ "ModuleCache"
82127
+ );
82128
+ if (output2.includes("was compiled with module cache path") && (0, import_node_fs81.existsSync)(moduleCache)) {
82129
+ (0, import_node_fs81.rmSync)(moduleCache, { recursive: true, force: true });
82130
+ try {
82131
+ await compileApp();
82132
+ } catch (retryError) {
81542
82133
  throw new Error(
81543
- [...unprepared, projectDiagnostic(output2, layout2, input.files)].join(
81544
- "\n"
81545
- ),
81546
- { cause: error }
82134
+ [
82135
+ ...unprepared,
82136
+ projectDiagnostic(outputOf(retryError), layout3, input.files)
82137
+ ].join("\n"),
82138
+ { cause: retryError }
81547
82139
  );
81548
82140
  }
81549
- } finally {
81550
- if (temporaryDirectory)
81551
- (0, import_node_fs81.rmSync)(temporaryDirectory, { recursive: true, force: true });
81552
- if (options2.project) endSwiftProjectProcesses(options2.project);
81553
- }
81554
- if (unprepared.length) throw new Error(unprepared.join("\n"));
81555
- if (!(0, import_node_fs81.existsSync)(linked)) {
81556
- const binDir = import_node_path81.default.dirname(linked);
81557
- const found2 = (0, import_node_fs81.existsSync)(binDir) ? (0, import_node_fs81.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
82141
+ } else {
81558
82142
  throw new Error(
81559
- `swift-compile: the build produced no ${import_node_path81.default.basename(linked)} (found: ${found2.join(", ") || "none"})`
82143
+ [...unprepared, projectDiagnostic(output2, layout3, input.files)].join(
82144
+ "\n"
82145
+ ),
82146
+ { cause: error }
81560
82147
  );
81561
82148
  }
81562
- if (options2.project) removeProjectLinks(root);
81563
- const resourceReferences = Object.values(input.resources ?? {}).map(
81564
- (value) => Buffer.from(value, "base64")
82149
+ } finally {
82150
+ if (temporaryDirectory)
82151
+ (0, import_node_fs81.rmSync)(temporaryDirectory, { recursive: true, force: true });
82152
+ if (options2.project) endSwiftProjectProcesses(options2.project);
82153
+ }
82154
+ if (unprepared.length) throw new Error(unprepared.join("\n"));
82155
+ if (!(0, import_node_fs81.existsSync)(linked)) {
82156
+ const binDir = import_node_path81.default.dirname(linked);
82157
+ const found2 = (0, import_node_fs81.existsSync)(binDir) ? (0, import_node_fs81.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
82158
+ throw new Error(
82159
+ `swift-compile: the build produced no ${import_node_path81.default.basename(linked)} (found: ${found2.join(", ") || "none"})`
81565
82160
  );
81566
- if (!guestGraph)
81567
- pruneSwiftWasmLink(
81568
- root,
81569
- options2.toolchainBin,
81570
- prebuilt?.root ?? frameworkRoot,
81571
- input.staticClangTargets,
81572
- options2.project,
81573
- void 0,
81574
- resourceReferences
81575
- );
81576
- if (options2.linkOnly) {
81577
- if ((0, import_node_fs81.statSync)(linked).size <= 8)
81578
- throw new Error("swift-compile: deferred linker produced no executable");
81579
- report("project link verified");
81580
- return;
81581
- }
81582
- const output = options2.project ? projectOutputFile(root, linked, options2.project) : linked;
81583
- const optimized = `${output}.optimized`;
81584
- if (sdkImage && options2.project) (0, import_node_fs81.rmSync)(optimized, { force: true });
81585
- let sdkAsset;
81586
- if (guestGraph) {
81587
- const binding = await compileGuestLink({
81588
- graph: guestGraph,
81589
- buildDirectory: root,
81590
- releaseDirectory: import_node_path81.default.dirname(linked),
81591
- moduleRoot: frameworkRoot,
81592
- toolchainBin: options2.toolchainBin,
81593
- swiftCompiler: preparation.headerCompiler ? import_node_path81.default.join(root, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path81.default.join(options2.toolchainBin, "swiftc"),
81594
- sysroot: swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot,
81595
- sdk: swiftModuleSdk(frameworkRoot),
81596
- sdkImage,
81597
- compilerDigest: compilerSourceDigest,
81598
- project: options2.project && {
81599
- ...options2.project,
81600
- env: { ...options2.project.env, ...projectProcess?.env }
81601
- },
81602
- staticClangTargets: input.staticClangTargets ?? [],
81603
- resourceReferences,
81604
- resourceBundles: input.resourceBundles ?? [],
81605
- generatedOwners: preparation.generatedOwners,
81606
- output,
81607
- optimized,
81608
- optimize: input.optimize === true,
81609
- jobs: swiftBuildJobs()
81610
- });
81611
- if (sdkImage && binding)
81612
- sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
81613
- } else if (sdkImage) {
81614
- const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
81615
- const binding = await buildSwiftAppModule2({
81616
- buildRoot: root,
81617
- toolchainBin: options2.toolchainBin,
81618
- sdk: sdkImage,
81619
- output: optimized,
81620
- optimize: input.optimize === true,
81621
- project: options2.project && {
81622
- ...options2.project,
81623
- env: { ...options2.project.env, ...projectProcess?.env },
81624
- sdkRoot: import_node_path81.default.dirname(
81625
- swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot
81626
- ),
81627
- linked: output
81628
- }
81629
- });
81630
- sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
81631
- } else {
81632
- const bytes = (0, import_node_fs81.readFileSync)(output);
81633
- const ordered = orderObjCConstructors(bytes);
81634
- if (ordered !== bytes) (0, import_node_fs81.writeFileSync)(output, ordered);
81635
- await lowerWasm(output, optimized, { optimize: input.optimize === true });
81636
- }
81637
- if (!sdkImage)
81638
- await runCompiler(
81639
- import_node_path81.default.join(options2.toolchainBin, "llvm-objcopy"),
81640
- ["--remove-section=.swift1_autolink_entries", optimized],
81641
- buildOptions
81642
- );
81643
- const artifact = {
81644
- hash,
81645
- bytes: (0, import_node_fs81.readFileSync)(optimized),
81646
- icu: await icu,
81647
- sdk: sdkAsset
81648
- };
81649
- if (artifact.bytes.length <= 8)
82161
+ }
82162
+ if (options2.project) removeProjectLinks(root2);
82163
+ const resourceReferences = Object.values(input.resources ?? {}).map(
82164
+ (value) => Buffer.from(value, "base64")
82165
+ );
82166
+ if (!guestGraph)
82167
+ pruneSwiftWasmLink(
82168
+ root2,
82169
+ options2.toolchainBin,
82170
+ prebuilt?.root ?? frameworkRoot,
82171
+ input.staticClangTargets,
82172
+ options2.project,
82173
+ void 0,
82174
+ resourceReferences
82175
+ );
82176
+ if (options2.linkOnly) {
82177
+ if ((0, import_node_fs81.statSync)(linked).size <= 8)
81650
82178
  throw new Error("swift-compile: deferred linker produced no executable");
81651
- if (!options2.project) saveCompiledArtifact(root, artifact);
81652
- saveSharedArtifact(sharedRoot, artifact);
81653
- report("compiled artifact verified");
81654
- return retain(root, artifact);
81655
- } finally {
81656
- readHold?.release();
82179
+ stage("project link verified");
82180
+ return;
81657
82181
  }
81658
- },
81659
- budget.signal
81660
- );
82182
+ const output = options2.project ? projectOutputFile(root2, linked, options2.project) : linked;
82183
+ const optimized = `${output}.optimized`;
82184
+ if (sdkImage && options2.project) (0, import_node_fs81.rmSync)(optimized, { force: true });
82185
+ let sdkAsset;
82186
+ stage("linking the app image");
82187
+ if (guestGraph) {
82188
+ const binding = await compileGuestLink({
82189
+ graph: guestGraph,
82190
+ buildDirectory: root2,
82191
+ releaseDirectory: import_node_path81.default.dirname(linked),
82192
+ moduleRoot: frameworkRoot,
82193
+ toolchainBin: options2.toolchainBin,
82194
+ swiftCompiler: preparation.headerCompiler ? import_node_path81.default.join(root2, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path81.default.join(options2.toolchainBin, "swiftc"),
82195
+ sysroot: swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot,
82196
+ sdk: swiftModuleSdk(frameworkRoot),
82197
+ sdkImage,
82198
+ compilerDigest: compilerSourceDigest,
82199
+ project: options2.project && {
82200
+ ...options2.project,
82201
+ env: { ...options2.project.env, ...projectProcess?.env }
82202
+ },
82203
+ staticClangTargets: input.staticClangTargets ?? [],
82204
+ resourceReferences,
82205
+ resourceBundles: input.resourceBundles ?? [],
82206
+ generatedOwners: preparation.generatedOwners,
82207
+ output,
82208
+ optimized,
82209
+ optimize: input.optimize === true,
82210
+ jobs: swiftBuildJobs(),
82211
+ onStage: stage
82212
+ });
82213
+ if (sdkImage && binding)
82214
+ sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
82215
+ } else if (sdkImage) {
82216
+ const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
82217
+ const binding = await buildSwiftAppModule2({
82218
+ buildRoot: root2,
82219
+ toolchainBin: options2.toolchainBin,
82220
+ sdk: sdkImage,
82221
+ output: optimized,
82222
+ optimize: input.optimize === true,
82223
+ project: options2.project && {
82224
+ ...options2.project,
82225
+ env: { ...options2.project.env, ...projectProcess?.env },
82226
+ sdkRoot: import_node_path81.default.dirname(
82227
+ swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot
82228
+ ),
82229
+ linked: output
82230
+ }
82231
+ });
82232
+ sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
82233
+ } else {
82234
+ const bytes = (0, import_node_fs81.readFileSync)(output);
82235
+ const ordered = orderObjCConstructors(bytes);
82236
+ if (ordered !== bytes) (0, import_node_fs81.writeFileSync)(output, ordered);
82237
+ stage("lowering the app image");
82238
+ await lowerWasm(output, optimized, { optimize: input.optimize === true });
82239
+ }
82240
+ if (!sdkImage)
82241
+ await runCompiler(
82242
+ import_node_path81.default.join(options2.toolchainBin, "llvm-objcopy"),
82243
+ ["--remove-section=.swift1_autolink_entries", optimized],
82244
+ buildOptions
82245
+ );
82246
+ const artifact = {
82247
+ hash,
82248
+ bytes: (0, import_node_fs81.readFileSync)(optimized),
82249
+ icu: await icu,
82250
+ sdk: sdkAsset
82251
+ };
82252
+ if (artifact.bytes.length <= 8)
82253
+ throw new Error("swift-compile: deferred linker produced no executable");
82254
+ if (!options2.project) saveCompiledArtifact(root2, artifact);
82255
+ saveSharedArtifact(sharedRoot, artifact);
82256
+ stage("compiled artifact verified");
82257
+ return retain(baseRoot, artifact);
82258
+ } finally {
82259
+ readHold?.release();
82260
+ }
82261
+ });
81661
82262
  });
81662
82263
  },
81663
82264
  options2.signal
81664
82265
  );
81665
82266
  }
81666
- var import_node_child_process42, import_node_crypto48, import_node_fs81, import_node_os16, import_node_path81, 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;
82267
+ var import_node_child_process42, import_node_crypto48, import_node_fs81, import_node_os16, import_node_path81, 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;
81667
82268
  var init_swift_compile = __esm({
81668
82269
  "src/swift-compile.ts"() {
81669
82270
  "use strict";
@@ -81934,7 +82535,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
81934
82535
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
81935
82536
  MULTI_MANIFEST_VERSION = 76;
81936
82537
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
81937
- compilerSourceDigest = true ? "6fbcbab3535da2f464a19f4d3c1db8a7e4b393927e5158477332f4cc978cc22f" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
82538
+ compilerSourceDigest = true ? "203439fc20df8d328b0c245496fc6db90092265409adb61b593725e82ce837de" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
81938
82539
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
81939
82540
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
81940
82541
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -82358,6 +82959,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
82358
82959
  retainedArtifacts = /* @__PURE__ */ new Map();
82359
82960
  FRAMEWORK_LINK_TARGET = "PeachFrameworkLink";
82360
82961
  frameworkProductsReceiptSchema = v6.object({
82962
+ root: v6.string(),
82361
82963
  modules: v6.string(),
82362
82964
  objects: v6.array(v6.string()),
82363
82965
  lazyObjects: v6.array(v6.string()),
@@ -82374,6 +82976,9 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
82374
82976
  SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS = 4;
82375
82977
  SWIFT_FRAMEWORK_SLOT_KEY = ".peach-framework-key";
82376
82978
  SWIFT_FRAMEWORK_SLOT_ORIGIN = ".peach-framework-origin";
82979
+ SWIFT_FRAMEWORK_SLOT_RELEASE = ".peach-framework-release";
82980
+ SWIFT_BUILD_ROOT_SLOTS = 4;
82981
+ SWIFT_BUILD_ROOT_SHAPE = ".peach-build-shape";
82377
82982
  }
82378
82983
  });
82379
82984
 
@@ -85316,9 +85921,133 @@ end
85316
85921
  });
85317
85922
 
85318
85923
  // src/plist-bytes.ts
85924
+ function defaultInteger(value) {
85925
+ return value >= BigInt(Number.MIN_SAFE_INTEGER) && value <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(value) : value;
85926
+ }
85927
+ function parseBinaryPlist(source, options2 = {}) {
85928
+ const bytes = Buffer.isBuffer(source) ? source : Buffer.from(source);
85929
+ (0, import_strict.default)(bytes.length >= 40, "binary plist is too short");
85930
+ (0, import_strict.default)(bytes.toString("ascii", 0, 8) === "bplist00", "invalid binary plist header");
85931
+ const trailer = bytes.length - 32;
85932
+ const offsetWidth = bytes[trailer + 6];
85933
+ const refWidth = bytes[trailer + 7];
85934
+ (0, import_strict.default)(offsetWidth > 0 && offsetWidth <= 8 && refWidth > 0 && refWidth <= 8);
85935
+ const count = Number(bytes.readBigUInt64BE(trailer + 8));
85936
+ const root = Number(bytes.readBigUInt64BE(trailer + 16));
85937
+ const table = Number(bytes.readBigUInt64BE(trailer + 24));
85938
+ (0, import_strict.default)(
85939
+ table >= 8 && table < trailer && count > 0 && count <= (trailer - table) / offsetWidth
85940
+ );
85941
+ const unsigned = (at, width) => {
85942
+ (0, import_strict.default)(at >= 8 && at + width <= trailer);
85943
+ let result = 0n;
85944
+ for (let i = at; i < at + width; i++) result = result * 256n + BigInt(bytes[i]);
85945
+ return result;
85946
+ };
85947
+ const cache = /* @__PURE__ */ new Map();
85948
+ const visiting = /* @__PURE__ */ new Set();
85949
+ const visit3 = (ref) => {
85950
+ (0, import_strict.default)(ref >= 0 && ref < count && !visiting.has(ref));
85951
+ if (cache.has(ref)) return cache.get(ref);
85952
+ visiting.add(ref);
85953
+ const at = Number(unsigned(table + ref * offsetWidth, offsetWidth));
85954
+ (0, import_strict.default)(at >= 8 && at < table);
85955
+ const marker = bytes[at];
85956
+ const type = marker >> 4;
85957
+ let length = marker & 15;
85958
+ let data = at + 1;
85959
+ if (length === 15 && [4, 5, 6, 7, 10, 12, 13].includes(type)) {
85960
+ (0, import_strict.default)(data < table && bytes[data] >> 4 === 1);
85961
+ const width = 2 ** (bytes[data] & 15);
85962
+ (0, import_strict.default)(width <= 8 && data + 1 + width <= table);
85963
+ length = Number(unsigned(data + 1, width));
85964
+ data += 1 + width;
85965
+ }
85966
+ const end = (size2) => {
85967
+ (0, import_strict.default)(Number.isSafeInteger(size2) && data + size2 <= table);
85968
+ return data + size2;
85969
+ };
85970
+ const references = (total) => {
85971
+ end(total * refWidth);
85972
+ return Array.from(
85973
+ { length: total },
85974
+ (_, i) => visit3(Number(unsigned(data + i * refWidth, refWidth)))
85975
+ );
85976
+ };
85977
+ let value;
85978
+ switch (type) {
85979
+ case 0:
85980
+ if (!options2.strict && marker === 0) {
85981
+ value = null;
85982
+ break;
85983
+ }
85984
+ (0, import_strict.default)(marker === 8 || marker === 9);
85985
+ value = marker === 9;
85986
+ break;
85987
+ case 1: {
85988
+ const size2 = 2 ** length;
85989
+ (0, import_strict.default)(size2 <= 16);
85990
+ end(size2);
85991
+ const raw2 = unsigned(data, size2);
85992
+ const signed = size2 >= 8 ? BigInt.asIntN(size2 * 8, raw2) : raw2;
85993
+ value = options2.onInteger ? options2.onInteger(signed) : defaultInteger(signed);
85994
+ break;
85995
+ }
85996
+ case 2: {
85997
+ (0, import_strict.default)(length === 2 || length === 3);
85998
+ end(2 ** length);
85999
+ const real = length === 2 ? bytes.readFloatBE(data) : bytes.readDoubleBE(data);
86000
+ value = options2.onReal ? options2.onReal(real) : real;
86001
+ break;
86002
+ }
86003
+ case 3:
86004
+ (0, import_strict.default)(length === 3);
86005
+ end(8);
86006
+ value = new Date(Date.UTC(2001, 0, 1) + bytes.readDoubleBE(data) * 1e3);
86007
+ break;
86008
+ case 4:
86009
+ value = bytes.subarray(data, end(length));
86010
+ break;
86011
+ case 5:
86012
+ value = bytes.toString("ascii", data, end(length));
86013
+ break;
86014
+ case 6:
86015
+ value = Buffer.from(bytes.subarray(data, end(length * 2))).swap16().toString("utf16le");
86016
+ break;
86017
+ case 7:
86018
+ value = bytes.toString("utf8", data, end(length));
86019
+ break;
86020
+ case 8: {
86021
+ if (options2.strict) throw new Error(`unsupported binary plist type ${type}`);
86022
+ const size2 = length + 1;
86023
+ (0, import_strict.default)(size2 >= 1 && size2 <= 8);
86024
+ end(size2);
86025
+ value = { UID: Number(unsigned(data, size2)) };
86026
+ break;
86027
+ }
86028
+ case 10:
86029
+ case 12:
86030
+ value = references(length);
86031
+ break;
86032
+ case 13: {
86033
+ const elements = references(length * 2);
86034
+ const keys = elements.slice(0, length);
86035
+ (0, import_strict.default)(keys.every((key2) => typeof key2 === "string"));
86036
+ value = Object.fromEntries(keys.map((key2, i) => [key2, elements[length + i]]));
86037
+ break;
86038
+ }
86039
+ default:
86040
+ throw new Error(`unsupported binary plist type ${type}`);
86041
+ }
86042
+ visiting.delete(ref);
86043
+ cache.set(ref, value);
86044
+ return value;
86045
+ };
86046
+ return visit3(root);
86047
+ }
85319
86048
  function parsePlistBytes(source, parseXml2 = parsePlistSource) {
85320
86049
  const bytes = Buffer.from(source);
85321
- return bytes.subarray(0, 8).toString("ascii") === "bplist00" ? import_bplist_parser.default.parseBuffer(bytes)[0] : parseXml2(bytes.toString("utf8"));
86050
+ return bytes.subarray(0, 8).toString("ascii") === "bplist00" ? parseBinaryPlist(bytes) : parseXml2(bytes.toString("utf8"));
85322
86051
  }
85323
86052
  function buildBinaryPlist(top) {
85324
86053
  const nodes = [];
@@ -85404,11 +86133,11 @@ function buildBinaryPlist(top) {
85404
86133
  trailer
85405
86134
  ]);
85406
86135
  }
85407
- var import_bplist_parser, isList, isUid;
86136
+ var import_strict, isList, isUid;
85408
86137
  var init_plist_bytes = __esm({
85409
86138
  "src/plist-bytes.ts"() {
85410
86139
  "use strict";
85411
- import_bplist_parser = __toESM(require("peachsim/vendor/bplist-parser"), 1);
86140
+ import_strict = __toESM(require("node:assert/strict"), 1);
85412
86141
  init_plist();
85413
86142
  isList = (value) => Array.isArray(value);
85414
86143
  isUid = (value) => typeof value === "object" && !isList(value) && !Buffer.isBuffer(value) && Object.keys(value).length === 1 && typeof value["CF$UID"] === "number";
@@ -85603,10 +86332,10 @@ var init_pods_files = __esm({
85603
86332
  constructor(targetName, path190) {
85604
86333
  this.targetName = targetName;
85605
86334
  this.path = path190;
85606
- const plist6 = parsePlistBytes(import_node_fs87.default.readFileSync(`${path190}/Info.plist`));
85607
- if (!isRecord(plist6) || !Array.isArray(plist6.AvailableLibraries))
86335
+ const plist2 = parsePlistBytes(import_node_fs87.default.readFileSync(`${path190}/Info.plist`));
86336
+ if (!isRecord(plist2) || !Array.isArray(plist2.AvailableLibraries))
85608
86337
  throw new Error(`${path190}/Info.plist declares no AvailableLibraries`);
85609
- this.slices = plist6.AvailableLibraries.map((library) => {
86338
+ this.slices = plist2.AvailableLibraries.map((library) => {
85610
86339
  if (!isRecord(library) || typeof library.LibraryIdentifier !== "string" || typeof library.LibraryPath !== "string" || typeof library.SupportedPlatform !== "string")
85611
86340
  throw new Error(`${path190}/Info.plist has an invalid library entry`);
85612
86341
  const root = `${path190}/${library.LibraryIdentifier}`;
@@ -93352,7 +94081,7 @@ ${published4.map(
93352
94081
  const contents2 = new Map([
93353
94082
  [
93354
94083
  "Info.plist",
93355
- import_plist4.default.build({
94084
+ buildPlist({
93356
94085
  AvailableLibraries: [
93357
94086
  {
93358
94087
  LibraryIdentifier: "ios-arm64-simulator",
@@ -93437,7 +94166,7 @@ ${published4.map(
93437
94166
  const infoPlistReady = infoPlistFiles.every((file) => import_node_fs93.default.existsSync(file));
93438
94167
  const info = {};
93439
94168
  for (const file of infoPlistReady ? infoPlistFiles : []) {
93440
- const fragment = import_plist4.default.parse(import_node_fs93.default.readFileSync(file, "utf8"));
94169
+ const fragment = parsePlist(import_node_fs93.default.readFileSync(file, "utf8"));
93441
94170
  if (!fragment || typeof fragment !== "object" || Array.isArray(fragment) || fragment instanceof Date || Buffer.isBuffer(fragment))
93442
94171
  throw new Error(`${file} is not a plist dictionary`);
93443
94172
  for (const [key2, value] of Object.entries(fragment)) {
@@ -93506,7 +94235,7 @@ ${published4.map(
93506
94235
  rootDir: root,
93507
94236
  projectFiles: buildFiles.sort(),
93508
94237
  projectDirs: [root],
93509
- infoPlist: infoPlistReady ? import_plist4.default.build(info) : null,
94238
+ infoPlist: infoPlistReady ? buildPlist(info) : null,
93510
94239
  infoPlistFile: null,
93511
94240
  postBundleScripts: [],
93512
94241
  appIconName: "",
@@ -93558,7 +94287,7 @@ function shellTokens(options2) {
93558
94287
  return words2;
93559
94288
  });
93560
94289
  }
93561
- var import_node_child_process45, import_node_crypto52, import_node_fs93, import_node_os18, import_node_path94, import_plist4, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER4, PRODUCTS, graphs, CLANG_CONFIGURATION_FLAGS, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
94290
+ var import_node_child_process45, import_node_crypto52, import_node_fs93, import_node_os18, import_node_path94, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER4, PRODUCTS, graphs, CLANG_CONFIGURATION_FLAGS, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
93562
94291
  var init_bazel_project = __esm({
93563
94292
  "src/bazel-project.ts"() {
93564
94293
  "use strict";
@@ -93567,8 +94296,8 @@ var init_bazel_project = __esm({
93567
94296
  import_node_fs93 = __toESM(require("node:fs"), 1);
93568
94297
  import_node_os18 = __toESM(require("node:os"), 1);
93569
94298
  import_node_path94 = __toESM(require("node:path"), 1);
93570
- import_plist4 = __toESM(require("peachsim/vendor/plist"), 1);
93571
94299
  init_is_record();
94300
+ init_plist();
93572
94301
  LIBRARY_RULES = /* @__PURE__ */ new Set(["swift_library", "objc_library", "cc_library"]);
93573
94302
  QUERIED_RULES = [
93574
94303
  "swift_library",
@@ -94618,29 +95347,29 @@ function insertNativeAppIdentityFooter(source, identity2) {
94618
95347
  if (moduleFooter < 0) return withoutExisting + footer;
94619
95348
  return withoutExisting.slice(0, moduleFooter) + footer + withoutExisting.slice(moduleFooter);
94620
95349
  }
94621
- function readGoogleSignInConfiguration(plist6, resources) {
95350
+ function readGoogleSignInConfiguration(plist2, resources) {
94622
95351
  const clientIds = {};
94623
95352
  for (const [file, value] of Object.entries(resources)) {
94624
95353
  if (isRecord(value) && typeof value.CLIENT_ID === "string")
94625
95354
  clientIds[file.split("/").pop()?.replace(/\.plist$/, "") ?? file] = value.CLIENT_ID;
94626
95355
  }
94627
95356
  const urlSchemes = [];
94628
- for (const entry of Array.isArray(plist6.CFBundleURLTypes) ? plist6.CFBundleURLTypes : []) {
95357
+ for (const entry of Array.isArray(plist2.CFBundleURLTypes) ? plist2.CFBundleURLTypes : []) {
94629
95358
  if (!isRecord(entry) || !Array.isArray(entry.CFBundleURLSchemes)) continue;
94630
95359
  for (const scheme of entry.CFBundleURLSchemes)
94631
95360
  if (typeof scheme === "string") urlSchemes.push(scheme);
94632
95361
  }
94633
95362
  return {
94634
- clientId: plist6.GIDClientID,
94635
- serverClientId: plist6.GIDServerClientID,
94636
- hostedDomain: plist6.GIDHostedDomain,
94637
- openIDRealm: plist6.GIDOpenIDRealm,
95363
+ clientId: plist2.GIDClientID,
95364
+ serverClientId: plist2.GIDServerClientID,
95365
+ hostedDomain: plist2.GIDHostedDomain,
95366
+ openIDRealm: plist2.GIDOpenIDRealm,
94638
95367
  urlSchemes,
94639
95368
  clientIds
94640
95369
  };
94641
95370
  }
94642
- function plistString(plist6, key2) {
94643
- const match = plist6.match(new RegExp(`<key>${key2}</key>\\s*<string>([^<]*)</string>`));
95371
+ function plistString(plist2, key2) {
95372
+ const match = plist2.match(new RegExp(`<key>${key2}</key>\\s*<string>([^<]*)</string>`));
94644
95373
  return match ? match[1].trim() : null;
94645
95374
  }
94646
95375
  function resolvePlistStrings(value, settings) {
@@ -94716,9 +95445,9 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
94716
95445
  candidates.push({ name: match[1], settings });
94717
95446
  }
94718
95447
  const plistMatch = (settings) => {
94719
- const plist6 = settings.INFOPLIST_FILE;
94720
- if (!plist6) return false;
94721
- const normalized = plist6.replace(/^"|"$/g, "");
95448
+ const plist2 = settings.INFOPLIST_FILE;
95449
+ if (!plist2) return false;
95450
+ const normalized = plist2.replace(/^"|"$/g, "");
94722
95451
  return normalized === infoPlistRelativePath || infoPlistRelativePath.endsWith(`/${normalized}`) || normalized.endsWith(`/${infoPlistRelativePath}`);
94723
95452
  };
94724
95453
  const named = (settings) => resolveBuildSetting(settings.PRODUCT_NAME ?? "", settings) === targetName;
@@ -94830,41 +95559,41 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
94830
95559
  );
94831
95560
  if (legacy2) Object.assign(settings, legacy2);
94832
95561
  }
94833
- let plist6;
95562
+ let plist2;
94834
95563
  const infoPlistPath = settings.INFOPLIST_FILE;
94835
95564
  if (infoPlistPath) {
94836
95565
  const normalized = infoPlistPath.replace(/^"|"$/g, "");
94837
- plist6 = files2[`ios/${normalized}`] ?? files2[normalized] ?? Object.entries(files2).find(([k]) => k.endsWith(`/${normalized}`))?.[1];
95566
+ plist2 = files2[`ios/${normalized}`] ?? files2[normalized] ?? Object.entries(files2).find(([k]) => k.endsWith(`/${normalized}`))?.[1];
94838
95567
  }
94839
- if (!plist6) {
94840
- plist6 = files2[`ios/${targetName}/Info.plist`] ?? files2[`${targetName}/Info.plist`] ?? Object.entries(files2).find(([k]) => k.endsWith(`/${targetName}/Info.plist`))?.[1];
95568
+ if (!plist2) {
95569
+ plist2 = files2[`ios/${targetName}/Info.plist`] ?? files2[`${targetName}/Info.plist`] ?? Object.entries(files2).find(([k]) => k.endsWith(`/${targetName}/Info.plist`))?.[1];
94841
95570
  }
94842
- if (!plist6) return null;
95571
+ if (!plist2) return null;
94843
95572
  const bundleIdentifier = identityFieldFrom(
94844
95573
  settings,
94845
- plistString(plist6, "CFBundleIdentifier"),
95574
+ plistString(plist2, "CFBundleIdentifier"),
94846
95575
  settings.PRODUCT_BUNDLE_IDENTIFIER
94847
95576
  );
94848
95577
  if (!bundleIdentifier) return null;
94849
95578
  const appVersion = identityFieldFrom(
94850
95579
  settings,
94851
- plistString(plist6, "CFBundleShortVersionString"),
95580
+ plistString(plist2, "CFBundleShortVersionString"),
94852
95581
  settings.MARKETING_VERSION
94853
95582
  );
94854
95583
  const buildVersion = identityFieldFrom(
94855
95584
  settings,
94856
- plistString(plist6, "CFBundleVersion"),
95585
+ plistString(plist2, "CFBundleVersion"),
94857
95586
  settings.CURRENT_PROJECT_VERSION
94858
95587
  );
94859
95588
  if (!appVersion || !buildVersion) return null;
94860
95589
  const bundleName = identityFieldFrom(
94861
95590
  settings,
94862
- plistString(plist6, "CFBundleName"),
95591
+ plistString(plist2, "CFBundleName"),
94863
95592
  settings.PRODUCT_NAME
94864
95593
  ) ?? resolvedIdentityField(resolveBuildSetting(settings.PRODUCT_NAME ?? "", settings)) ?? resolvedIdentityField(targetName);
94865
95594
  if (!bundleName) return null;
94866
- const applicationName = identityFieldFrom(settings, plistString(plist6, "CFBundleDisplayName"), void 0) ?? bundleName;
94867
- const dictionary3 = parseInfoPlist(plist6);
95595
+ const applicationName = identityFieldFrom(settings, plistString(plist2, "CFBundleDisplayName"), void 0) ?? bundleName;
95596
+ const dictionary3 = parseInfoPlist(plist2);
94868
95597
  if (!isRecord(dictionary3)) throw new Error("native app Info.plist is not a dictionary");
94869
95598
  let keychainAccessGroups;
94870
95599
  let siriEntitled = false;
@@ -95250,7 +95979,7 @@ var init_provenance = __esm({
95250
95979
  import_node_crypto54 = require("node:crypto");
95251
95980
  import_node_fs95 = require("node:fs");
95252
95981
  import_node_path96 = require("node:path");
95253
- 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_path96.join)(__sootsim_import_meta_dirname, ".."));
95982
+ 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_path96.join)(__sootsim_import_meta_dirname, ".."));
95254
95983
  }
95255
95984
  });
95256
95985
 
@@ -97203,13 +97932,13 @@ function intentModelVersion(value) {
97203
97932
  return value === "1.0" || value === "1.1" ? value : "1.2";
97204
97933
  }
97205
97934
  function modelList(value, key2) {
97206
- (0, import_strict.default)(value && typeof value === "object");
97935
+ (0, import_strict2.default)(value && typeof value === "object");
97207
97936
  const entries2 = Reflect.get(value, key2) ?? [];
97208
- (0, import_strict.default)(Array.isArray(entries2));
97937
+ (0, import_strict2.default)(Array.isArray(entries2));
97209
97938
  return entries2;
97210
97939
  }
97211
97940
  function identifier(value) {
97212
- (0, import_strict.default)(
97941
+ (0, import_strict2.default)(
97213
97942
  typeof value === "string" && /^[_\p{ID_Start}][_\p{ID_Continue}]*$/u.test(value),
97214
97943
  `invalid intent identifier ${String(value)}`
97215
97944
  );
@@ -97217,18 +97946,18 @@ function identifier(value) {
97217
97946
  }
97218
97947
  function intentClassIdentifier(value) {
97219
97948
  const name3 = identifier(value);
97220
- (0, import_strict.default)(/^[A-Za-z_0-9]+$/.test(name3), `invalid intent class name ${name3}`);
97949
+ (0, import_strict2.default)(/^[A-Za-z_0-9]+$/.test(name3), `invalid intent class name ${name3}`);
97221
97950
  return name3;
97222
97951
  }
97223
97952
  function readSwiftField(value, key2, customTypes) {
97224
- (0, import_strict.default)(value && typeof value === "object");
97953
+ (0, import_strict2.default)(value && typeof value === "object");
97225
97954
  const get2 = (property2) => Reflect.get(value, key2 + property2);
97226
97955
  const name3 = identifier(get2("Name"));
97227
97956
  let kind = intentParameterKind(get2("Type"));
97228
97957
  let enumeration = get2("EnumType");
97229
97958
  let object9 = get2("ObjectType");
97230
- (0, import_strict.default)(enumeration === void 0 || kind === "Integer");
97231
- (0, import_strict.default)(object9 === void 0 || kind === "Object");
97959
+ (0, import_strict2.default)(enumeration === void 0 || kind === "Integer");
97960
+ (0, import_strict2.default)(object9 === void 0 || kind === "Object");
97232
97961
  const custom = enumeration ?? object9;
97233
97962
  let customName;
97234
97963
  if (custom !== void 0) {
@@ -97243,7 +97972,7 @@ function readSwiftField(value, key2, customTypes) {
97243
97972
  }
97244
97973
  } else {
97245
97974
  customName = customTypes.get(name4);
97246
- (0, import_strict.default)(customName, "unknown intent parameter type: " + name4);
97975
+ (0, import_strict2.default)(customName, "unknown intent parameter type: " + name4);
97247
97976
  }
97248
97977
  }
97249
97978
  const type = types.get(kind);
@@ -97253,7 +97982,7 @@ function readSwiftField(value, key2, customTypes) {
97253
97982
  const valueType = multiple ? `[${array9}]` : base2;
97254
97983
  const resolves = get2("SupportsResolution") === true;
97255
97984
  const explicitReasons = modelList(value, key2 + "UnsupportedReasons").map((entry) => {
97256
- (0, import_strict.default)(entry && typeof entry === "object");
97985
+ (0, import_strict2.default)(entry && typeof entry === "object");
97257
97986
  return identifier(Reflect.get(entry, key2 + "UnsupportedReasonCode"));
97258
97987
  });
97259
97988
  const defaults = resolves && !customName ? defaultUnsupportedReasons(kind) : [];
@@ -97344,18 +98073,18 @@ fatalError()
97344
98073
  }
97345
98074
  function customObjectFields(definition2, customTypes) {
97346
98075
  return modelList(definition2, "INTypeProperties").filter((entry) => {
97347
- (0, import_strict.default)(entry && typeof entry === "object");
98076
+ (0, import_strict2.default)(entry && typeof entry === "object");
97348
98077
  return Reflect.get(entry, "INTypePropertyDefault") !== true;
97349
98078
  }).map((entry) => {
97350
98079
  const field2 = readSwiftField(entry, "INTypeProperty", customTypes);
97351
98080
  return { ...field2, availability: field2.availability ?? swiftResolutionAvailable };
97352
98081
  });
97353
98082
  }
97354
- var import_strict, swiftAvailable, swiftResolutionAvailable, swiftOptionsAvailable, upper, iOS13, numericReasons, builtin2, types;
98083
+ var import_strict2, swiftAvailable, swiftResolutionAvailable, swiftOptionsAvailable, upper, iOS13, numericReasons, builtin2, types;
97355
98084
  var init_fields = __esm({
97356
98085
  "src/intent-definition/fields.ts"() {
97357
98086
  "use strict";
97358
- import_strict = __toESM(require("node:assert/strict"), 1);
98087
+ import_strict2 = __toESM(require("node:assert/strict"), 1);
97359
98088
  init_system_types();
97360
98089
  swiftAvailable = "@available(iOS 12.0, macOS 11.0, watchOS 5.0, *) @available(tvOS, unavailable)";
97361
98090
  swiftResolutionAvailable = "@available(iOS 13.0, macOS 11.0, watchOS 6.0, *)";
@@ -97530,7 +98259,7 @@ function intentHashInput(root, propertyTypes = []) {
97530
98259
  integer2(18, BigInt(value.length));
97531
98260
  for (const item of value) append(item);
97532
98261
  } else {
97533
- (0, import_strict2.default)(
98262
+ (0, import_strict3.default)(
97534
98263
  value && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype
97535
98264
  );
97536
98265
  const keys = Object.keys(value).sort();
@@ -97545,11 +98274,11 @@ function intentHashInput(root, propertyTypes = []) {
97545
98274
  for (const propertyType of propertyTypes) append(propertyType);
97546
98275
  return Buffer.concat(chunks);
97547
98276
  }
97548
- var import_strict2, IntentReal;
98277
+ var import_strict3, IntentReal;
97549
98278
  var init_hash_input = __esm({
97550
98279
  "src/intent-definition/hash-input.ts"() {
97551
98280
  "use strict";
97552
- import_strict2 = __toESM(require("node:assert/strict"), 1);
98281
+ import_strict3 = __toESM(require("node:assert/strict"), 1);
97553
98282
  IntentReal = class {
97554
98283
  constructor(value) {
97555
98284
  this.value = value;
@@ -97609,7 +98338,7 @@ function dictionary(value) {
97609
98338
  }
97610
98339
  function normalizedEnums(input) {
97611
98340
  return modelList(input, "INEnums").map((value) => {
97612
- (0, import_strict3.default)(dictionary(value));
98341
+ (0, import_strict4.default)(dictionary(value));
97613
98342
  return {
97614
98343
  ...value,
97615
98344
  INEnumName: intentClassIdentifier(value.INEnumName),
@@ -97627,7 +98356,7 @@ function localizationIdentifier(field2, key2) {
97627
98356
  }
97628
98357
  function normalizedMetadata(type, source, field2) {
97629
98358
  const defaults = typeMetadata.get(type) ?? {};
97630
- (0, import_strict3.default)(source === void 0 || dictionary(source));
98359
+ (0, import_strict4.default)(source === void 0 || dictionary(source));
97631
98360
  const metadata = source ? { ...source } : Object.fromEntries(
97632
98361
  Object.entries(defaults).map(([key2, value]) => {
97633
98362
  const qualified3 = `INIntentParameterMetadata${key2}`;
@@ -97651,7 +98380,7 @@ function normalizedMetadata(type, source, field2) {
97651
98380
  function normalizedReasons(parameter, kind, field2) {
97652
98381
  const reasons = /* @__PURE__ */ new Map();
97653
98382
  for (const reason of modelList(parameter, "INIntentParameterUnsupportedReasons")) {
97654
- (0, import_strict3.default)(dictionary(reason));
98383
+ (0, import_strict4.default)(dictionary(reason));
97655
98384
  const code = identifier(reason.INIntentParameterUnsupportedReasonCode);
97656
98385
  const text7 = reason.INIntentParameterUnsupportedReasonFormatString;
97657
98386
  reasons.set(
@@ -97688,17 +98417,17 @@ function compileIntentMetadata(input, enums, prefix) {
97688
98417
  }
97689
98418
  const objectHashes = /* @__PURE__ */ new Map();
97690
98419
  for (const declaration of modelList(input, "INTypes")) {
97691
- (0, import_strict3.default)(dictionary(declaration) && typeof declaration.INTypeName === "string");
98420
+ (0, import_strict4.default)(dictionary(declaration) && typeof declaration.INTypeName === "string");
97692
98421
  objectHashes.set(declaration.INTypeName, intentSipHash(intentHashInput(declaration)));
97693
98422
  }
97694
98423
  const intents = modelList(input, "INIntents").map((value) => {
97695
- (0, import_strict3.default)(dictionary(value));
98424
+ (0, import_strict4.default)(dictionary(value));
97696
98425
  const name3 = intentClassIdentifier(value.INIntentName);
97697
98426
  const system = value.INIntentType === "System";
97698
98427
  const propertyTypes = [];
97699
98428
  const parameters = modelList(value, "INIntentParameters").map(
97700
98429
  (parameter, position) => {
97701
- (0, import_strict3.default)(dictionary(parameter));
98430
+ (0, import_strict4.default)(dictionary(parameter));
97702
98431
  const enumName = parameter.INIntentParameterEnumType;
97703
98432
  const objectName = parameter.INIntentParameterObjectType;
97704
98433
  const reference = enumName ?? objectName;
@@ -97725,7 +98454,7 @@ function compileIntentMetadata(input, enums, prefix) {
97725
98454
  }
97726
98455
  } else {
97727
98456
  const localHash = hashes.get(typeName);
97728
- (0, import_strict3.default)(localHash !== void 0, `unknown intent parameter type: ${typeName}`);
98457
+ (0, import_strict4.default)(localHash !== void 0, `unknown intent parameter type: ${typeName}`);
97729
98458
  hash2 = localHash;
97730
98459
  }
97731
98460
  }
@@ -97751,7 +98480,7 @@ function compileIntentMetadata(input, enums, prefix) {
97751
98480
  if (parameter.INIntentParameterSupportsMultipleValues && parameter.INIntentParameterFixedSizeArray) {
97752
98481
  const sizes = /* @__PURE__ */ new Map();
97753
98482
  for (const size2 of modelList(parameter, "INIntentParameterArraySizes")) {
97754
- (0, import_strict3.default)(
98483
+ (0, import_strict4.default)(
97755
98484
  dictionary(size2) && typeof size2.INIntentParameterArraySizeSizeClass === "string"
97756
98485
  );
97757
98486
  sizes.set(size2.INIntentParameterArraySizeSizeClass, size2);
@@ -97875,7 +98604,7 @@ function formatPlistReal(value) {
97875
98604
  return `${sign}${digits.slice(0, point)}.${digits.slice(point)}`;
97876
98605
  }
97877
98606
  function writeIntentDefinition(input, prefix) {
97878
- (0, import_strict3.default)(dictionary(input));
98607
+ (0, import_strict4.default)(dictionary(input));
97879
98608
  const escape2 = (text7) => text7.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
97880
98609
  const lines = [
97881
98610
  '<?xml version="1.0" encoding="UTF-8"?>',
@@ -97912,7 +98641,7 @@ function writeIntentDefinition(input, prefix) {
97912
98641
  lines.push(`${indent2}</array>`);
97913
98642
  }
97914
98643
  } else {
97915
- (0, import_strict3.default)(dictionary(value));
98644
+ (0, import_strict4.default)(dictionary(value));
97916
98645
  const keys = Object.keys(value).sort();
97917
98646
  if (keys.length === 0) lines.push(`${indent2}<dict/>`);
97918
98647
  else {
@@ -97944,11 +98673,11 @@ function writeIntentDefinition(input, prefix) {
97944
98673
  lines.push("</plist>", "");
97945
98674
  return lines.join("\n");
97946
98675
  }
97947
- var import_strict3, import_node_crypto57, typeMetadata, initializeMetadata, widgetArraySizes, defaultReasonMessages;
98676
+ var import_strict4, import_node_crypto57, typeMetadata, initializeMetadata, widgetArraySizes, defaultReasonMessages;
97948
98677
  var init_metadata = __esm({
97949
98678
  "src/intent-definition/metadata.ts"() {
97950
98679
  "use strict";
97951
- import_strict3 = __toESM(require("node:assert/strict"), 1);
98680
+ import_strict4 = __toESM(require("node:assert/strict"), 1);
97952
98681
  import_node_crypto57 = require("node:crypto");
97953
98682
  init_fields();
97954
98683
  init_hash_input();
@@ -98019,175 +98748,34 @@ function safeNumber(value) {
98019
98748
  function xmlPlist2(bytes) {
98020
98749
  const encoding = bytes[0] === 255 && bytes[1] === 254 ? "utf-16le" : bytes[0] === 254 && bytes[1] === 255 ? "utf-16be" : "utf-8";
98021
98750
  const text7 = new TextDecoder(encoding, { fatal: true }).decode(bytes);
98022
- const document = new import_xmldom.DOMParser({
98023
- onError(_level, message) {
98024
- throw new Error(message);
98025
- }
98026
- }).parseFromString(text7, "application/xml");
98027
- const children = (element) => Array.from(element.children);
98028
- const contents2 = (element) => {
98029
- (0, import_strict4.default)(element.children.length === 0);
98030
- return element.textContent ?? "";
98031
- };
98032
- const visit3 = (element) => {
98033
- switch (element.tagName) {
98034
- case "dict": {
98035
- const entries2 = children(element);
98036
- (0, import_strict4.default)(entries2.length % 2 === 0);
98037
- const pairs2 = [];
98038
- for (let i = 0; i < entries2.length; i += 2) {
98039
- const key2 = entries2[i];
98040
- (0, import_strict4.default)(key2.tagName === "key");
98041
- pairs2.push([contents2(key2), visit3(entries2[i + 1])]);
98042
- }
98043
- return Object.fromEntries(pairs2);
98044
- }
98045
- case "array":
98046
- return children(element).map(visit3);
98047
- case "string":
98048
- return contents2(element);
98049
- case "integer": {
98050
- const value = contents2(element).trim();
98051
- (0, import_strict4.default)(value.length > 0);
98052
- return safeNumber(BigInt(value));
98053
- }
98054
- case "real": {
98055
- const value = contents2(element).trim();
98056
- (0, import_strict4.default)(value.length > 0);
98057
- return new IntentReal(
98058
- /^[+-]?inf(?:inity)?$/i.test(value) ? value.startsWith("-") ? -Infinity : Infinity : Number(value)
98059
- );
98060
- }
98061
- case "true":
98062
- return true;
98063
- case "false":
98064
- return false;
98065
- case "data":
98066
- return Buffer.from(contents2(element), "base64");
98067
- case "date":
98068
- return new Date(contents2(element));
98069
- default:
98070
- throw new Error(`unsupported plist element ${element.tagName}`);
98071
- }
98072
- };
98073
- const plist6 = document.documentElement;
98074
- (0, import_strict4.default)(plist6?.tagName === "plist" && plist6.children.length === 1);
98075
- return visit3(plist6.children[0]);
98076
- }
98077
- function binaryPlist2(bytes) {
98078
- (0, import_strict4.default)(bytes.length >= 40);
98079
- const trailer = bytes.length - 32;
98080
- const offsetWidth = bytes[trailer + 6];
98081
- const refWidth = bytes[trailer + 7];
98082
- (0, import_strict4.default)(offsetWidth > 0 && offsetWidth <= 8 && refWidth > 0 && refWidth <= 8);
98083
- const count = Number(bytes.readBigUInt64BE(trailer + 8));
98084
- const root = Number(bytes.readBigUInt64BE(trailer + 16));
98085
- const table = Number(bytes.readBigUInt64BE(trailer + 24));
98086
- (0, import_strict4.default)(
98087
- table >= 8 && table < trailer && count > 0 && count <= (trailer - table) / offsetWidth
98088
- );
98089
- const unsigned = (at, width) => {
98090
- (0, import_strict4.default)(at >= 8 && at + width <= trailer);
98091
- let result = 0n;
98092
- for (let i = at; i < at + width; i++) result = result * 256n + BigInt(bytes[i]);
98093
- return result;
98094
- };
98095
- const cache = /* @__PURE__ */ new Map();
98096
- const visiting = /* @__PURE__ */ new Set();
98097
- const visit3 = (ref) => {
98098
- (0, import_strict4.default)(ref >= 0 && ref < count && !visiting.has(ref));
98099
- if (cache.has(ref)) return cache.get(ref);
98100
- visiting.add(ref);
98101
- const at = Number(unsigned(table + ref * offsetWidth, offsetWidth));
98102
- (0, import_strict4.default)(at >= 8 && at < table);
98103
- const marker = bytes[at];
98104
- const type = marker >> 4;
98105
- let length = marker & 15;
98106
- let data = at + 1;
98107
- if (length === 15 && [4, 5, 6, 7, 10, 13].includes(type)) {
98108
- (0, import_strict4.default)(data < table && bytes[data] >> 4 === 1);
98109
- const width = 2 ** (bytes[data] & 15);
98110
- (0, import_strict4.default)(width <= 8 && data + 1 + width <= table);
98111
- length = Number(unsigned(data + 1, width));
98112
- data += 1 + width;
98113
- }
98114
- const end = (size2) => {
98115
- (0, import_strict4.default)(Number.isSafeInteger(size2) && data + size2 <= table);
98116
- return data + size2;
98117
- };
98118
- const references = (total) => {
98119
- end(total * refWidth);
98120
- return Array.from(
98121
- { length: total },
98122
- (_, i) => visit3(Number(unsigned(data + i * refWidth, refWidth)))
98751
+ return parseXmlPlist(text7, {
98752
+ strict: true,
98753
+ onInteger(raw2) {
98754
+ (0, import_strict5.default)(raw2.length > 0);
98755
+ return safeNumber(BigInt(raw2));
98756
+ },
98757
+ onReal(raw2) {
98758
+ (0, import_strict5.default)(raw2.length > 0);
98759
+ return new IntentReal(
98760
+ /^[+-]?inf(?:inity)?$/i.test(raw2) ? raw2.startsWith("-") ? -Infinity : Infinity : Number(raw2)
98123
98761
  );
98124
- };
98125
- let value;
98126
- switch (type) {
98127
- case 0:
98128
- (0, import_strict4.default)(marker === 8 || marker === 9);
98129
- value = marker === 9;
98130
- break;
98131
- case 1: {
98132
- const size2 = 2 ** length;
98133
- (0, import_strict4.default)(size2 <= 16);
98134
- end(size2);
98135
- const integer2 = unsigned(data, size2);
98136
- value = safeNumber(size2 >= 8 ? BigInt.asIntN(size2 * 8, integer2) : integer2);
98137
- break;
98138
- }
98139
- case 2:
98140
- (0, import_strict4.default)(length === 2 || length === 3);
98141
- end(2 ** length);
98142
- value = new IntentReal(
98143
- length === 2 ? bytes.readFloatBE(data) : bytes.readDoubleBE(data)
98144
- );
98145
- break;
98146
- case 3:
98147
- (0, import_strict4.default)(length === 3);
98148
- end(8);
98149
- value = new Date(Date.UTC(2001, 0, 1) + bytes.readDoubleBE(data) * 1e3);
98150
- break;
98151
- case 4:
98152
- value = bytes.subarray(data, end(length));
98153
- break;
98154
- case 5:
98155
- value = bytes.toString("ascii", data, end(length));
98156
- break;
98157
- case 6:
98158
- value = Buffer.from(bytes.subarray(data, end(length * 2))).swap16().toString("utf16le");
98159
- break;
98160
- case 7:
98161
- value = bytes.toString("utf8", data, end(length));
98162
- break;
98163
- case 10:
98164
- value = references(length);
98165
- break;
98166
- case 13: {
98167
- const elements = references(length * 2);
98168
- const keys = elements.slice(0, length);
98169
- (0, import_strict4.default)(keys.every((key2) => typeof key2 === "string"));
98170
- value = Object.fromEntries(keys.map((key2, i) => [key2, elements[length + i]]));
98171
- break;
98172
- }
98173
- default:
98174
- throw new Error(`unsupported binary plist type ${type}`);
98175
98762
  }
98176
- visiting.delete(ref);
98177
- cache.set(ref, value);
98178
- return value;
98179
- };
98180
- return visit3(root);
98763
+ });
98181
98764
  }
98182
98765
  function parseIntentPlist(bytes) {
98183
- return bytes.toString("ascii", 0, 8) === "bplist00" ? binaryPlist2(bytes) : xmlPlist2(bytes);
98766
+ return bytes.toString("ascii", 0, 8) === "bplist00" ? parseBinaryPlist(bytes, {
98767
+ strict: true,
98768
+ onInteger: safeNumber,
98769
+ onReal: (value) => new IntentReal(value)
98770
+ }) : xmlPlist2(bytes);
98184
98771
  }
98185
- var import_strict4, import_xmldom;
98772
+ var import_strict5;
98186
98773
  var init_plist_reader = __esm({
98187
98774
  "src/intent-definition/plist-reader.ts"() {
98188
98775
  "use strict";
98189
- import_strict4 = __toESM(require("node:assert/strict"), 1);
98190
- import_xmldom = require("peachsim/vendor/@xmldom/xmldom");
98776
+ import_strict5 = __toESM(require("node:assert/strict"), 1);
98777
+ init_plist();
98778
+ init_plist_bytes();
98191
98779
  init_hash_input();
98192
98780
  }
98193
98781
  });
@@ -98199,10 +98787,10 @@ function readIntentResponse(definition2, customTypes) {
98199
98787
  );
98200
98788
  const definitions = new Map(
98201
98789
  modelList(definition2, "INIntentResponseCodes").map((entry) => {
98202
- (0, import_strict5.default)(entry && typeof entry === "object");
98790
+ (0, import_strict6.default)(entry && typeof entry === "object");
98203
98791
  const name3 = identifier(Reflect.get(entry, "INIntentResponseCodeName"));
98204
98792
  const message = Reflect.get(entry, "INIntentResponseCodeFormatString");
98205
- (0, import_strict5.default)(message === void 0 || typeof message === "string");
98793
+ (0, import_strict6.default)(message === void 0 || typeof message === "string");
98206
98794
  const referenced = new Set(
98207
98795
  [
98208
98796
  ...String(message ?? "").matchAll(
@@ -98213,7 +98801,7 @@ function readIntentResponse(definition2, customTypes) {
98213
98801
  const names = [...referenced].sort();
98214
98802
  const parameters = names.map((name4) => {
98215
98803
  const field2 = fields.find((field3) => field3.name === name4);
98216
- (0, import_strict5.default)(field2, "unknown intent response field " + name4);
98804
+ (0, import_strict6.default)(field2, "unknown intent response field " + name4);
98217
98805
  return field2;
98218
98806
  });
98219
98807
  return [
@@ -98265,11 +98853,11 @@ ${access} static func ${code}(${parameters.map((field2) => `${field2.name}: ${fi
98265
98853
  }).join("\n")}
98266
98854
  }`;
98267
98855
  }
98268
- var import_strict5, responseCodes;
98856
+ var import_strict6, responseCodes;
98269
98857
  var init_response = __esm({
98270
98858
  "src/intent-definition/response.ts"() {
98271
98859
  "use strict";
98272
- import_strict5 = __toESM(require("node:assert/strict"), 1);
98860
+ import_strict6 = __toESM(require("node:assert/strict"), 1);
98273
98861
  init_fields();
98274
98862
  responseCodes = [
98275
98863
  "unspecified",
@@ -98287,7 +98875,7 @@ var init_response = __esm({
98287
98875
  function objcAvailability(swift) {
98288
98876
  if (!swift) return "";
98289
98877
  const version2 = /^@available\(iOS ([\d.]+), macOS ([\d.]+), watchOS ([\d.]+), \*\)$/.exec(swift);
98290
- (0, import_strict6.default)(version2);
98878
+ (0, import_strict7.default)(version2);
98291
98879
  return ` API_AVAILABLE(ios(${version2[1]}), macos(${version2[2]}), watchos(${version2[3]}))`;
98292
98880
  }
98293
98881
  function objcElement(field2) {
@@ -98316,7 +98904,7 @@ function headerImports(fields, visibility, module2) {
98316
98904
  return [...imports2].join("\n");
98317
98905
  }
98318
98906
  function objcIntentSource(name3, prefix, definition2, customTypes, version2, visibility, module2) {
98319
- (0, import_strict6.default)(definition2 && typeof definition2 === "object");
98907
+ (0, import_strict7.default)(definition2 && typeof definition2 === "object");
98320
98908
  const klass = prefix + name3 + "Intent";
98321
98909
  const response = klass + "Response";
98322
98910
  const attr = hidden(visibility);
@@ -98355,7 +98943,7 @@ function objcIntentSource(name3, prefix, definition2, customTypes, version2, vis
98355
98943
  };
98356
98944
  const constructors = [...definitions].filter(([, definition3]) => definition3.parameters.length > 0).map(([code, { parameters: parameters2, availability }]) => {
98357
98945
  const [first, ...rest] = parameters2;
98358
- (0, import_strict6.default)(first);
98946
+ (0, import_strict7.default)(first);
98359
98947
  const selector = `${code}IntentResponseWith${upper(first.name)}:(${objcType(first)})${first.name}` + rest.map((field2) => ` ${field2.name}:(${objcType(field2)})${field2.name}`).join("");
98360
98948
  return {
98361
98949
  code,
@@ -98453,15 +99041,15 @@ ${reasons.map(
98453
99041
  return { header, implementation };
98454
99042
  }
98455
99043
  function objcEnumSource(definition2, label, prefix, visibility) {
98456
- (0, import_strict6.default)(definition2 && typeof definition2 === "object");
99044
+ (0, import_strict7.default)(definition2 && typeof definition2 === "object");
98457
99045
  const name3 = prefix + label;
98458
99046
  const attr = hidden(visibility);
98459
99047
  const bases = [attr, available].filter(Boolean).join(" ");
98460
99048
  const cases = modelList(definition2, "INEnumValues").map((entry) => {
98461
- (0, import_strict6.default)(entry && typeof entry === "object");
99049
+ (0, import_strict7.default)(entry && typeof entry === "object");
98462
99050
  const value = identifier(Reflect.get(entry, "INEnumValueName"));
98463
99051
  const index = Reflect.get(entry, "INEnumValueIndex") ?? 0;
98464
- (0, import_strict6.default)(typeof index === "number" && Number.isSafeInteger(index));
99052
+ (0, import_strict7.default)(typeof index === "number" && Number.isSafeInteger(index));
98465
99053
  return ` ${name3}${upper(value)} = ${index}`;
98466
99054
  });
98467
99055
  const success2 = `+ (instancetype)successWithResolved${label}:(${name3})resolvedValue`;
@@ -98545,11 +99133,11 @@ ${confirm2} {
98545
99133
  `
98546
99134
  };
98547
99135
  }
98548
- var import_strict6, available, resolution, options, hiddenAttribute, hidden, headerStart, headerEnd, pointer, array7;
99136
+ var import_strict7, available, resolution, options, hiddenAttribute, hidden, headerStart, headerEnd, pointer, array7;
98549
99137
  var init_objective_c = __esm({
98550
99138
  "src/intent-definition/objective-c.ts"() {
98551
99139
  "use strict";
98552
- import_strict6 = __toESM(require("node:assert/strict"), 1);
99140
+ import_strict7 = __toESM(require("node:assert/strict"), 1);
98553
99141
  init_fields();
98554
99142
  init_response();
98555
99143
  available = "API_AVAILABLE(ios(12.0), macos(11.0), watchos(5.0)) API_UNAVAILABLE(tvos)";
@@ -98566,7 +99154,7 @@ var init_objective_c = __esm({
98566
99154
 
98567
99155
  // src/intent-definition/swift.ts
98568
99156
  function swiftIntentSource(name3, prefix, definition2, customTypes, version2, access) {
98569
- (0, import_strict7.default)(definition2 && typeof definition2 === "object");
99157
+ (0, import_strict8.default)(definition2 && typeof definition2 === "object");
98570
99158
  const klass = `${prefix}${name3}Intent`;
98571
99159
  const response = `${klass}Response`;
98572
99160
  const parameters = modelList(definition2, "INIntentParameters").map(
@@ -98667,11 +99255,11 @@ ${access} class func unsupported(forReason reason: ${base2}UnsupportedReason) ->
98667
99255
  #endif
98668
99256
  `;
98669
99257
  }
98670
- var import_strict7;
99258
+ var import_strict8;
98671
99259
  var init_swift = __esm({
98672
99260
  "src/intent-definition/swift.ts"() {
98673
99261
  "use strict";
98674
- import_strict7 = __toESM(require("node:assert/strict"), 1);
99262
+ import_strict8 = __toESM(require("node:assert/strict"), 1);
98675
99263
  init_fields();
98676
99264
  init_response();
98677
99265
  }
@@ -98679,17 +99267,17 @@ var init_swift = __esm({
98679
99267
 
98680
99268
  // src/intent-definition/source.ts
98681
99269
  function swiftEnumSource(definition2, visibility, prefix = "") {
98682
- (0, import_strict8.default)(definition2 && typeof definition2 === "object");
99270
+ (0, import_strict9.default)(definition2 && typeof definition2 === "object");
98683
99271
  const unprefixed = identifier(Reflect.get(definition2, "INEnumName"));
98684
99272
  const name3 = prefix + unprefixed;
98685
99273
  const values = Reflect.get(definition2, "INEnumValues");
98686
- (0, import_strict8.default)(Array.isArray(values));
99274
+ (0, import_strict9.default)(Array.isArray(values));
98687
99275
  const access = visibility === "project" ? "internal" : "public";
98688
99276
  const cases = values.map((entry) => {
98689
- (0, import_strict8.default)(entry && typeof entry === "object");
99277
+ (0, import_strict9.default)(entry && typeof entry === "object");
98690
99278
  const name4 = identifier(Reflect.get(entry, "INEnumValueName"));
98691
99279
  const index = Reflect.get(entry, "INEnumValueIndex") ?? 0;
98692
- (0, import_strict8.default)(typeof index === "number" && Number.isSafeInteger(index));
99280
+ (0, import_strict9.default)(typeof index === "number" && Number.isSafeInteger(index));
98693
99281
  return ` case \`${name4}\` = ${index}`;
98694
99282
  });
98695
99283
  return `#if canImport(Intents)
@@ -98714,7 +99302,7 @@ ${access} class ${name3}ResolutionResult: INEnumResolutionResult {
98714
99302
  `;
98715
99303
  }
98716
99304
  function emitIntentSource(definition2, prefix, visibility, language, module2) {
98717
- (0, import_strict8.default)(definition2 && typeof definition2 === "object");
99305
+ (0, import_strict9.default)(definition2 && typeof definition2 === "object");
98718
99306
  const intents = modelList(definition2, "INIntents");
98719
99307
  const types2 = modelList(definition2, "INTypes");
98720
99308
  const enums = modelList(definition2, "INEnums");
@@ -98724,7 +99312,7 @@ function emitIntentSource(definition2, prefix, visibility, language, module2) {
98724
99312
  intentModelVersion(Reflect.get(definition2, "INIntentDefinitionModelVersion"))
98725
99313
  );
98726
99314
  const nameOf = (entry, key2) => {
98727
- (0, import_strict8.default)(entry && typeof entry === "object");
99315
+ (0, import_strict9.default)(entry && typeof entry === "object");
98728
99316
  return identifier(Reflect.get(entry, key2));
98729
99317
  };
98730
99318
  const typeNames = types2.map((type) => nameOf(type, "INTypeName"));
@@ -98764,7 +99352,7 @@ function emitIntentSource(definition2, prefix, visibility, language, module2) {
98764
99352
  });
98765
99353
  }
98766
99354
  for (const intent of intents) {
98767
- (0, import_strict8.default)(intent && typeof intent === "object");
99355
+ (0, import_strict9.default)(intent && typeof intent === "object");
98768
99356
  if (Reflect.get(intent, "INIntentType") === "System") continue;
98769
99357
  const name3 = identifier(Reflect.get(intent, "INIntentName"));
98770
99358
  const filename = `${prefix}${name3}Intent`;
@@ -98781,11 +99369,11 @@ function emitIntentSource(definition2, prefix, visibility, language, module2) {
98781
99369
  }
98782
99370
  return output;
98783
99371
  }
98784
- var import_strict8;
99372
+ var import_strict9;
98785
99373
  var init_source = __esm({
98786
99374
  "src/intent-definition/source.ts"() {
98787
99375
  "use strict";
98788
- import_strict8 = __toESM(require("node:assert/strict"), 1);
99376
+ import_strict9 = __toESM(require("node:assert/strict"), 1);
98789
99377
  init_fields();
98790
99378
  init_objective_c();
98791
99379
  init_swift();
@@ -99617,7 +100205,7 @@ function expandValue(value, settings) {
99617
100205
  return value;
99618
100206
  }
99619
100207
  function processedInfoPlist(name3, file, settings, settingKeys) {
99620
- const source = file ? import_plist5.default.parse(import_node_fs100.default.readFileSync(file, "utf8")) : {};
100208
+ const source = file ? parsePlist(import_node_fs100.default.readFileSync(file, "utf8")) : {};
99621
100209
  if (!source || typeof source !== "object" || Array.isArray(source) || source instanceof Date || Buffer.isBuffer(source))
99622
100210
  throw new Error(`${name3} Info.plist must contain a dictionary`);
99623
100211
  const info = {};
@@ -100191,7 +100779,7 @@ ${output}`
100191
100779
  );
100192
100780
  let launchName = settings("INFOPLIST_KEY_UILaunchStoryboardName");
100193
100781
  if (process.platform !== "darwin" && !launchName && infoPlistOutput && import_node_fs100.default.existsSync(infoPlistOutput)) {
100194
- const info = import_plist5.default.parse(import_node_fs100.default.readFileSync(infoPlistOutput, "utf8"));
100782
+ const info = parsePlist(import_node_fs100.default.readFileSync(infoPlistOutput, "utf8"));
100195
100783
  const declared = isRecord(info) ? info.UILaunchStoryboardName : void 0;
100196
100784
  if (typeof declared === "string") launchName = expand(declared, settings);
100197
100785
  }
@@ -100429,7 +101017,7 @@ function readXcodeExtensionTargets(input) {
100429
101017
  );
100430
101018
  const infoFile = get2("INFOPLIST_FILE");
100431
101019
  if (!infoFile) throw new Error(`${name3}: extension has no INFOPLIST_FILE`);
100432
- const info = import_plist5.default.parse(
101020
+ const info = parsePlist(
100433
101021
  import_node_fs100.default.readFileSync(import_node_path102.default.resolve(project2.projectDir, infoFile), "utf8")
100434
101022
  );
100435
101023
  if (!isRecord(info))
@@ -101263,7 +101851,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
101263
101851
  }
101264
101852
  return {
101265
101853
  ref,
101266
- framework: Object.assign(module3, { frameworkInfoPlist: import_plist5.default.build(info2) })
101854
+ framework: Object.assign(module3, { frameworkInfoPlist: buildPlist(info2) })
101267
101855
  };
101268
101856
  });
101269
101857
  const frameworks = frameworkTargets.map(({ framework }) => framework);
@@ -101330,9 +101918,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
101330
101918
  path: bundlePath,
101331
101919
  ...product ? {
101332
101920
  resources: product.module.resources,
101333
- infoPlist: import_plist5.default.build(
101921
+ infoPlist: buildPlist(
101334
101922
  expandValue(
101335
- import_plist5.default.parse(import_node_fs100.default.readFileSync(infoFile, "utf8")),
101923
+ parsePlist(import_node_fs100.default.readFileSync(infoFile, "utf8")),
101336
101924
  product.productSettings
101337
101925
  )
101338
101926
  )
@@ -101354,7 +101942,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
101354
101942
  settingKeys
101355
101943
  );
101356
101944
  const bundleIdentifier = productSettings("PRODUCT_BUNDLE_IDENTIFIER") || (typeof info.CFBundleIdentifier === "string" ? info.CFBundleIdentifier : "");
101357
- const entitlements = entitlementsFile ? import_plist5.default.parse(import_node_fs100.default.readFileSync(entitlementsFile, "utf8")) : void 0;
101945
+ const entitlements = entitlementsFile ? parsePlist(import_node_fs100.default.readFileSync(entitlementsFile, "utf8")) : void 0;
101358
101946
  const keychainAccessGroups = entitlementsFile ? readKeychainAccessGroups(
101359
101947
  entitlements,
101360
101948
  (value) => expand(value, (key2) => {
@@ -101700,7 +102288,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
101700
102288
  ].sort(),
101701
102289
  projectDirs: [...new Set(used.map((project2) => project2.projectDir))].sort(),
101702
102290
  appIconName: settings("ASSETCATALOG_COMPILER_APPICON_NAME"),
101703
- infoPlist: infoPlistPending ? null : import_plist5.default.build(info),
102291
+ infoPlist: infoPlistPending ? null : buildPlist(info),
101704
102292
  infoPlistFile,
101705
102293
  ...keychainAccessGroups === void 0 ? {} : { keychainAccessGroups },
101706
102294
  siriEntitled: readSiriEntitlement(entitlements),
@@ -101723,7 +102311,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
101723
102311
  cocoapods
101724
102312
  };
101725
102313
  }
101726
- var import_node_child_process47, import_node_crypto59, import_node_fs100, import_node_module9, import_node_path102, import_plist5, XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET, runScriptTimeoutMs, CXX_STANDARD_ALIASES, PRE_CXX20_STANDARDS, APPLICATION, APP_EXTENSION, RESOURCE_BUNDLE, PRODUCT_MACH_O_TYPES, FRAMEWORK_PRODUCTS, HEADER_FILE, MODULE_PRODUCTS, CONDITIONS, isDirectory3, loaded3, developerDir, preparedSourcePhases, isPodsProject, targetRefs, NativeAppTargetSelectionError, workspaceResolvedFile, SwiftPackageResolutionRequired;
102314
+ var import_node_child_process47, import_node_crypto59, import_node_fs100, import_node_module9, import_node_path102, XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET, runScriptTimeoutMs, CXX_STANDARD_ALIASES, PRE_CXX20_STANDARDS, APPLICATION, APP_EXTENSION, RESOURCE_BUNDLE, PRODUCT_MACH_O_TYPES, FRAMEWORK_PRODUCTS, HEADER_FILE, MODULE_PRODUCTS, CONDITIONS, isDirectory3, loaded3, developerDir, preparedSourcePhases, isPodsProject, targetRefs, NativeAppTargetSelectionError, workspaceResolvedFile, SwiftPackageResolutionRequired;
101727
102315
  var init_xcode_project = __esm({
101728
102316
  "src/xcode-project.ts"() {
101729
102317
  "use strict";
@@ -101732,11 +102320,11 @@ var init_xcode_project = __esm({
101732
102320
  import_node_fs100 = __toESM(require("node:fs"), 1);
101733
102321
  import_node_module9 = require("node:module");
101734
102322
  import_node_path102 = __toESM(require("node:path"), 1);
101735
- import_plist5 = __toESM(require("peachsim/vendor/plist"), 1);
101736
102323
  init_bazel_project();
101737
102324
  init_ios_sdk_frameworks();
101738
102325
  init_is_record();
101739
102326
  init_native_app_identity();
102327
+ init_plist();
101740
102328
  init_pod_graph_specifications();
101741
102329
  init_swift_binary_modules();
101742
102330
  init_xcode_assets();
@@ -104316,14 +104904,14 @@ function isPlistValue(value) {
104316
104904
  return isRecord(value) && Object.values(value).every(isPlistValue);
104317
104905
  }
104318
104906
  function parsePlistDictionary(source) {
104319
- const parsed2 = import_plist8.default.parse(source);
104907
+ const parsed2 = parsePlist(source);
104320
104908
  if (typeof parsed2 !== "object" || isPlistArray(parsed2) || parsed2 instanceof Date || Buffer.isBuffer(parsed2))
104321
104909
  throw new Error("Info.plist is not a dictionary");
104322
104910
  return parsed2;
104323
104911
  }
104324
104912
  function installedInfoPlist(prebuilt, additions) {
104325
104913
  const merged = { ...parsePlistDictionary(prebuilt), ...additions };
104326
- return import_plist8.default.build(
104914
+ return buildPlist(
104327
104915
  Object.fromEntries(
104328
104916
  Object.keys(merged).sort().map((key2) => [key2, merged[key2]])
104329
104917
  )
@@ -104443,7 +105031,7 @@ async function prebuiltExpoSwiftResult(appRoot, entry, signal) {
104443
105031
  await prebuiltAppTarget(appRoot, signal, "installed")
104444
105032
  );
104445
105033
  }
104446
- var import_node_crypto63, import_node_fs106, import_node_module13, import_node_path108, import_node_util13, import_plist8, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published, lookups, answers;
105034
+ var import_node_crypto63, import_node_fs106, import_node_module13, import_node_path108, import_node_util13, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published, lookups, answers;
104447
105035
  var init_expo_native_prebuilt = __esm({
104448
105036
  "src/expo-native-prebuilt.ts"() {
104449
105037
  "use strict";
@@ -104452,7 +105040,6 @@ var init_expo_native_prebuilt = __esm({
104452
105040
  import_node_module13 = require("node:module");
104453
105041
  import_node_path108 = __toESM(require("node:path"), 1);
104454
105042
  import_node_util13 = require("node:util");
104455
- import_plist8 = __toESM(require("peachsim/vendor/plist"), 1);
104456
105043
  init_answeredNativePackages();
104457
105044
  init_expo_native_compiler_digest();
104458
105045
  init_expo_native_workspace();
@@ -104463,6 +105050,7 @@ var init_expo_native_prebuilt = __esm({
104463
105050
  init_native_prebuilt();
104464
105051
  init_nitroContract();
104465
105052
  init_package_tree_digest();
105053
+ init_plist();
104466
105054
  init_swift_native_pin();
104467
105055
  init_xcode_project();
104468
105056
  EXPO_NATIVE_ENTRY_NAME = "ios";
@@ -115560,7 +116148,7 @@ function compileCatalogTables(source, name3) {
115560
116148
  }
115561
116149
  return output;
115562
116150
  }
115563
- function plist5(value, depth) {
116151
+ function plist(value, depth) {
115564
116152
  const indent2 = " ".repeat(depth);
115565
116153
  const escaped = (text7) => text7.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
115566
116154
  if (typeof value === "string") return `${indent2}<string>${escaped(value)}</string>
@@ -115571,7 +116159,7 @@ function plist5(value, depth) {
115571
116159
  return `${indent2}<dict>
115572
116160
  ` + keys.map(
115573
116161
  (key2) => `${indent2} <key>${escaped(key2)}</key>
115574
- ` + plist5(value[key2] ?? "", depth + 1)
116162
+ ` + plist(value[key2] ?? "", depth + 1)
115575
116163
  ).join("") + `${indent2}</dict>
115576
116164
  `;
115577
116165
  }
@@ -115579,7 +116167,7 @@ function compileStringCatalog(source, name3) {
115579
116167
  return Object.fromEntries(
115580
116168
  Object.entries(compileCatalogTables(source, name3)).map(([path190, table]) => [
115581
116169
  path190,
115582
- '<?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"
116170
+ '<?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"
115583
116171
  ])
115584
116172
  );
115585
116173
  }
@@ -118508,7 +119096,7 @@ var require_packer_async = __commonJS({
118508
119096
  var require_sync_inflate = __commonJS({
118509
119097
  "../../node_modules/pngjs/lib/sync-inflate.js"(exports2, module2) {
118510
119098
  "use strict";
118511
- var assert10 = require("assert").ok;
119099
+ var assert11 = require("assert").ok;
118512
119100
  var zlib4 = require("zlib");
118513
119101
  var util = require("util");
118514
119102
  var kMaxLength = require("buffer").kMaxLength;
@@ -118559,7 +119147,7 @@ var require_sync_inflate = __commonJS({
118559
119147
  return;
118560
119148
  }
118561
119149
  let have = availOutBefore - availOutAfter;
118562
- assert10(have >= 0, "have should not go down");
119150
+ assert11(have >= 0, "have should not go down");
118563
119151
  if (have > 0) {
118564
119152
  let out = self._buffer.slice(self._offset, self._offset + have);
118565
119153
  self._offset += have;
@@ -118585,7 +119173,7 @@ var require_sync_inflate = __commonJS({
118585
119173
  }
118586
119174
  return false;
118587
119175
  }
118588
- assert10(this._handle, "zlib binding closed");
119176
+ assert11(this._handle, "zlib binding closed");
118589
119177
  let res;
118590
119178
  do {
118591
119179
  res = this._handle.writeSync(
@@ -139915,7 +140503,7 @@ public func peachOneSDK(_ pointer: UnsafePointer<UInt8>, _ length: Int32) -> Uns
139915
140503
  });
139916
140504
 
139917
140505
  // ../peach-globals/src/oneNativeControlsContract.ts
139918
- var ONE_NATIVE_CONTROLS_PACKAGE, ONE_NATIVE_CONTROLS_CONTRACT, ONE_NATIVE_CONTROLS_NAVIGATION_STACK_VIEW, ONE_NATIVE_CONTROLS_NAVIGATION_SPLIT_VIEW, ONE_NATIVE_CONTROLS_VISUAL_VIEWS;
140506
+ var ONE_NATIVE_CONTROLS_PACKAGE, ONE_NATIVE_CONTROLS_CONTRACT, ONE_NATIVE_CONTROLS_NAVIGATION_STACK_VIEW, ONE_NATIVE_CONTROLS_NAVIGATION_SPLIT_VIEW, ONE_NATIVE_CONTROLS_VISUAL_VIEWS, ONE_NATIVE_CONTROLS_TAB_VIEW;
139919
140507
  var init_oneNativeControlsContract = __esm({
139920
140508
  "../peach-globals/src/oneNativeControlsContract.ts"() {
139921
140509
  "use strict";
@@ -139928,6 +140516,7 @@ var init_oneNativeControlsContract = __esm({
139928
140516
  "OneNativeLinearGradient",
139929
140517
  "OneNativeGlass"
139930
140518
  ];
140519
+ ONE_NATIVE_CONTROLS_TAB_VIEW = "OneNativeTabView";
139931
140520
  }
139932
140521
  });
139933
140522
 
@@ -140128,12 +140717,33 @@ var init_one_native_controls_package = __esm({
140128
140717
  init_swift_submit();
140129
140718
  init_swift_toolchain();
140130
140719
  ONE_SDK_DEFINES = ["ONE_IOS_26_SDK", "ONE_IOS_27_SDK", "ONE_IOS_27_1_SDK"];
140131
- BRIDGE_SWIFT = `import SwiftUI
140720
+ BRIDGE_SWIFT = `@_spi(Peach) import SwiftUI
140132
140721
  @_spi(Peach) import UIKit
140133
140722
  import PeachJSON
140134
140723
 
140135
140724
  typealias Spec = [String: Any]
140136
140725
 
140726
+ private final class OneContentHost: UIView, _PeachToolbarTitleMenuProvider {
140727
+ var titleMenu: [Spec] = []
140728
+ var onTitleMenuAction: ((Int) -> Void)?
140729
+
140730
+ var _peachToolbarTitleMenuContent: AnyView? {
140731
+ guard !titleMenu.isEmpty else { return nil }
140732
+ return AnyView(ForEach(Array(titleMenu.enumerated()), id: \\.offset) { index, item in
140733
+ let label = item["label"] as! String
140734
+ Button(role: item["role"] as? String == "destructive" ? .destructive : nil) { [weak self] in
140735
+ self?.onTitleMenuAction?(index)
140736
+ } label: {
140737
+ if let symbol = item["systemImage"] as? String {
140738
+ Label(label, systemImage: symbol)
140739
+ } else {
140740
+ Text(label)
140741
+ }
140742
+ }
140743
+ })
140744
+ }
140745
+ }
140746
+
140137
140747
  private func platformColor(named name: String) -> UIColor? {
140138
140748
  switch name {
140139
140749
  case "label", "-apple-system-label": return UIColor.label
@@ -140750,6 +141360,122 @@ private struct NavigationSplitViewBridge: UIViewRepresentable {
140750
141360
  }
140751
141361
  }
140752
141362
 
141363
+ private struct TabViewBridge: UIViewRepresentable {
141364
+ let spec: Spec
141365
+ let emit: (String, String) -> Void
141366
+
141367
+ final class Coordinator: ControlComposition {
141368
+ var pageHosts: [String: OneContentHost] = [:]
141369
+ var toolbars: [OneNativeToolbarView] = []
141370
+ var tabSelectionSequence = 0
141371
+
141372
+ func host(_ id: String, name: String?, titleMenu: [Spec]) -> UIView {
141373
+ let host = pageHosts[id] ?? OneContentHost(frame: .zero)
141374
+ pageHosts[id] = host
141375
+ host._peachReactContentHost = name
141376
+ host.titleMenu = titleMenu
141377
+ host.onTitleMenuAction = { [weak self] index in
141378
+ self?.send(id, "onNativeTitleMenuAction", ["index": index])
141379
+ }
141380
+ return host
141381
+ }
141382
+ }
141383
+
141384
+ func makeCoordinator() -> Coordinator { Coordinator() }
141385
+ func makeUIView(context: Context) -> OneNativeTabViewView { OneNativeTabViewView(frame: .zero) }
141386
+
141387
+ func updateUIView(_ tabs: OneNativeTabViewView, context: Context) {
141388
+ let state = context.coordinator
141389
+ state.emit = emit
141390
+ let root = self.spec["root"] as! Spec
141391
+ let id = root["id"] as! String
141392
+ let spec = root["spec"] as! Spec
141393
+ let nodes = root["children"] as? [Spec] ?? []
141394
+ var visited = Set<String>()
141395
+ tabs.onSelection = { [weak state] selection, count, revision in
141396
+ state?.send(id, "onNativeTabViewSelectionChange", ["selection": selection, "eventCount": count, "revision": revision])
141397
+ }
141398
+ tabs.onAction = { [weak state] tabId in
141399
+ state?.send(id, "onNativeTabViewAction", ["tabId": tabId])
141400
+ }
141401
+ tabs.onCustomization = { [weak state] customization in
141402
+ state?.send(id, "onNativeTabViewCustomizationChange", ["customization": customization])
141403
+ }
141404
+ tabs.onSDKEvent = { [weak state] name, value in
141405
+ state?.send(id, "onNativeSDKEvent", ["name": name, "value": value])
141406
+ }
141407
+ tabs.configureStyle(normalizeStyle(spec["swiftStyle"] as? Spec))
141408
+ tabs.configure(
141409
+ tabViewStyle: spec["tabViewStyle"] as? String ?? "automatic",
141410
+ tabBarVisibility: spec["tabBarVisibility"] as? String ?? "automatic",
141411
+ customization: spec["customization"] as? String ?? "",
141412
+ customizable: spec["customizable"] as? Bool ?? false,
141413
+ bottomAccessoryEnabled: spec["bottomAccessoryEnabled"] as? Bool ?? true
141414
+ )
141415
+ var pages: [OneNativeTabItem] = []
141416
+ var toolbars: [Spec] = []
141417
+ for node in nodes {
141418
+ let page = node["spec"] as! Spec
141419
+ if page["control"] as? String == "OneNativeToolbar" {
141420
+ toolbars.append(node)
141421
+ continue
141422
+ }
141423
+ precondition(page["control"] as? String == "OneNativeTab", "Swift.TabView requires Swift.Tab or Swift.Toolbar children")
141424
+ let owner = node["id"] as! String
141425
+ visited.insert(owner)
141426
+ let item = OneNativeTabItem(
141427
+ id: page["tabId"] as! String,
141428
+ kind: page["kind"] as? String ?? "page",
141429
+ title: page["title"] as? String ?? "",
141430
+ systemImage: page["systemImage"] as? String ?? "",
141431
+ badge: page["badge"] as? String ?? "",
141432
+ role: page["tabRole"] as? String ?? "",
141433
+ slotHeight: page["slotHeight"] as? Double ?? 0,
141434
+ tabModifiers: page["tabModifiers"] as? String ?? "{}",
141435
+ view: state.host(owner, name: node["contentHost"] as? String, titleMenu: page["titleMenu"] as? [Spec] ?? []),
141436
+ onLayout: { [weak state] frame in state?.send(owner, "onNativeLayout", frameFields(frame)) }
141437
+ )
141438
+ item.configureStyle(normalizeStyle(page["swiftStyle"] as? Spec))
141439
+ item.emit = { [weak state] name, value in
141440
+ state?.send(owner, "onNativeSDKEvent", ["name": name, "value": value])
141441
+ }
141442
+ pages.append(item)
141443
+ }
141444
+ tabs.setPages(pages)
141445
+ let previousSequence = state.tabSelectionSequence
141446
+ for commit in spec["__peachTabSelections"] as? [Spec] ?? [] {
141447
+ guard let sequence = commit["sequence"] as? Int, sequence > state.tabSelectionSequence else { continue }
141448
+ state.tabSelectionSequence = sequence
141449
+ if let selection = commit["selection"] as? String, pages.contains(where: { $0.id == selection }) {
141450
+ tabs.setSelection(selection, acknowledgedEvent: commit["acknowledgedEvent"] as? Int ?? 0, revision: commit["revision"] as? Int ?? 0)
141451
+ }
141452
+ }
141453
+ tabs.setSelection(spec["selection"] as? String ?? "", acknowledgedEvent: spec["acknowledgedEvent"] as? Int ?? 0, revision: spec["revision"] as? Int ?? 0)
141454
+ if state.tabSelectionSequence > previousSequence {
141455
+ state.send(id, "onNativeTabSelectionsApplied", ["sequence": state.tabSelectionSequence])
141456
+ }
141457
+ let next = toolbars.map { state.render($0, visited: &visited) as! OneNativeToolbarView }
141458
+ state.reconcile(next, previous: state.toolbars,
141459
+ remove: { tabs.unmountToolbar($0 as! OneNativeToolbarView) },
141460
+ insert: { view, _ in tabs.mountToolbar(view as! OneNativeToolbarView) })
141461
+ state.toolbars = next
141462
+ state.prune(keeping: visited)
141463
+ state.pageHosts = state.pageHosts.filter { visited.contains($0.key) }
141464
+ }
141465
+
141466
+ static func dismantleUIView(_ view: OneNativeTabViewView, coordinator: Coordinator) {
141467
+ coordinator.emit = nil
141468
+ view.reset()
141469
+ coordinator.prune(keeping: [])
141470
+ coordinator.pageHosts.removeAll()
141471
+ coordinator.toolbars.removeAll()
141472
+ }
141473
+ }
141474
+
141475
+ private func frameFields(_ frame: CGRect) -> Spec {
141476
+ ["x": frame.minX, "y": frame.minY, "width": frame.width, "height": frame.height]
141477
+ }
141478
+
140753
141479
  @_expose(wasm, "peach_register_views")
140754
141480
  @_cdecl("peach_register_views")
140755
141481
  @MainActor public func peach_register_views() {
@@ -140767,6 +141493,10 @@ private struct NavigationSplitViewBridge: UIViewRepresentable {
140767
141493
  return AnyView(NavigationSplitViewBridge(spec: spec, emit: emit)
140768
141494
  .frame(maxWidth: .infinity, maxHeight: .infinity)
140769
141495
  .ignoresSafeArea(.container))
141496
+ case "${ONE_NATIVE_CONTROLS_TAB_VIEW}":
141497
+ return AnyView(TabViewBridge(spec: spec, emit: emit)
141498
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
141499
+ .ignoresSafeArea(.container, edges: .horizontal))
140770
141500
  default:
140771
141501
  let root = spec["root"] as! Spec
140772
141502
  precondition((root["spec"] as? Spec)?["control"] as? String == view)
@@ -145314,7 +146044,7 @@ var init_nitro_superset = __esm({
145314
146044
  init_nitroContract();
145315
146045
  init_swift_standin_digest();
145316
146046
  NITRO_SUPERSET_ENTRY_NAME = "superset";
145317
- NITRO_COMPILER_DIGEST = true ? "228003f16f1b081fea0ab10bb0ba40a8192beee02eb15e1a3363090ee53f71ef" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
146047
+ NITRO_COMPILER_DIGEST = true ? "74b5613216c94c9a712253659e2803b31d4fe1a7f0ff32f2ad7d3fa7ef57f2ab" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
145318
146048
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
145319
146049
  nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
145320
146050
  published3 = /* @__PURE__ */ new Map();
@@ -148174,14 +148904,14 @@ function stripPathFilename(path190) {
148174
148904
  return path190.slice(0, index + 1);
148175
148905
  }
148176
148906
  function mergePaths(url, base2) {
148177
- normalizePath(base2, base2.type);
148907
+ normalizePath2(base2, base2.type);
148178
148908
  if (url.path === "/") {
148179
148909
  url.path = base2.path;
148180
148910
  } else {
148181
148911
  url.path = stripPathFilename(base2.path) + url.path;
148182
148912
  }
148183
148913
  }
148184
- function normalizePath(url, type) {
148914
+ function normalizePath2(url, type) {
148185
148915
  const rel = type <= 4;
148186
148916
  const pieces = url.path.split("/");
148187
148917
  let pointer2 = 1;
@@ -148248,7 +148978,7 @@ function resolve8(input, base2) {
148248
148978
  if (baseType > inputType)
148249
148979
  inputType = baseType;
148250
148980
  }
148251
- normalizePath(url, inputType);
148981
+ normalizePath2(url, inputType);
148252
148982
  const queryHash = url.query + url.hash;
148253
148983
  switch (inputType) {
148254
148984
  // This is impossible, because of the empty checks at the start of the function.
@@ -148560,8 +149290,8 @@ function addSegmentInternal(skipable, map2, genLine, genColumn, source, sourceLi
148560
149290
  if (skipable && skipSourceless(line, index)) return;
148561
149291
  return insert(line, index, [genColumn]);
148562
149292
  }
148563
- assert9(sourceLine);
148564
- assert9(sourceColumn);
149293
+ assert10(sourceLine);
149294
+ assert10(sourceColumn);
148565
149295
  const sourcesIndex = put(sources, source);
148566
149296
  const namesIndex = name3 ? put(names, name3) : NO_NAME;
148567
149297
  if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
@@ -148574,7 +149304,7 @@ function addSegmentInternal(skipable, map2, genLine, genColumn, source, sourceLi
148574
149304
  name3 ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] : [genColumn, sourcesIndex, sourceLine, sourceColumn]
148575
149305
  );
148576
149306
  }
148577
- function assert9(_val) {
149307
+ function assert10(_val) {
148578
149308
  }
148579
149309
  function getIndex(arr, index) {
148580
149310
  for (let i = arr.length; i <= index; i++) {
@@ -148630,7 +149360,7 @@ function addMappingInternal(skipable, map2, mapping) {
148630
149360
  null
148631
149361
  );
148632
149362
  }
148633
- assert9(original);
149363
+ assert10(original);
148634
149364
  return addSegmentInternal(
148635
149365
  skipable,
148636
149366
  map2,