peachsim 0.1.2743 → 0.1.2745

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 (124) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +2 -2
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +5 -5
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +3 -3
  13. package/dist-lib/bundle-channel.cjs +23 -24
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +3 -3
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +3 -3
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +2 -2
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +7 -7
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +5 -5
  24. package/dist-lib/detox/index.cjs +1 -1
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/esm-chunks/{acorn-4LW63VJO.mjs → acorn-4PRSNL7D.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-GIZQHA6L.mjs → chunk-3GDQDE3G.mjs} +6 -6
  28. package/dist-lib/esm-chunks/{chunk-ZLQX4SVV.mjs → chunk-3XWVOEVJ.mjs} +1 -1
  29. package/dist-lib/esm-chunks/{chunk-JHOZWSFF.mjs → chunk-57IBEXZ7.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-6FHNPTCA.mjs → chunk-AM2DC7NA.mjs} +6 -6
  31. package/dist-lib/esm-chunks/{chunk-BQUYNIMY.mjs → chunk-AXNPA4CI.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-THSR72MV.mjs → chunk-BRVVBFDT.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-BJSA6VP6.mjs → chunk-CLQBDTGC.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-THJMTM3L.mjs → chunk-DPQFKGWK.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-V3SRJIBE.mjs → chunk-FLEVN7IJ.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-BNJ5YG7V.mjs → chunk-FYJWNZXZ.mjs} +2 -2
  37. package/dist-lib/esm-chunks/{chunk-XP5F6PNN.mjs → chunk-GCNULNUC.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-EES2SLJK.mjs → chunk-GUSFQUZD.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-2HP5FPCA.mjs → chunk-GYBNX5MY.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-HOUFNDEV.mjs → chunk-GYUYO4YT.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-SG7MN2KW.mjs → chunk-HSK5BQLE.mjs} +3 -3
  42. package/dist-lib/esm-chunks/{chunk-7NBU6OXB.mjs → chunk-JN2C772U.mjs} +4 -4
  43. package/dist-lib/esm-chunks/{chunk-VJKLZAU2.mjs → chunk-JT327IEG.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-WKGJ6LAU.mjs → chunk-KTMFARKZ.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-BW3KZJV5.mjs → chunk-MAITHQ5S.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-OEQBNK6V.mjs → chunk-NADMCUMF.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-LVCSLWR2.mjs → chunk-OCBYCFDU.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-EAAYQS4L.mjs → chunk-V6AO52UA.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-B3F4HKM6.mjs → chunk-VJGH2L5T.mjs} +5 -5
  50. package/dist-lib/esm-chunks/{chunk-23OQSLRP.mjs → chunk-WLLS6DA3.mjs} +32 -33
  51. package/dist-lib/esm-chunks/{metro-layout-parser-L57PU3TD.mjs → metro-layout-parser-MFSWKUZV.mjs} +3 -3
  52. package/dist-lib/esm-chunks/{swift-package-prebuilt-UNXWJN7B.mjs → swift-package-prebuilt-RPFJWIPU.mjs} +12 -12
  53. package/dist-lib/esm-chunks/{swift-sdk-app-module-DZV3XYCP.mjs → swift-sdk-app-module-C6XR5HMX.mjs} +16 -16
  54. package/dist-lib/esm-chunks/{swift-sdk-image-WRYMP64Z.mjs → swift-sdk-image-6U5P377S.mjs} +16 -16
  55. package/dist-lib/esm-chunks/{swift-sdk-image-producer-D6DOCCCR.mjs → swift-sdk-image-producer-ZKU3LVLR.mjs} +5 -5
  56. package/dist-lib/expo-swift-bundle.cjs +23 -24
  57. package/dist-lib/expo-swift-metadata.cjs +1 -1
  58. package/dist-lib/expo-swift-metadata.mjs +7 -7
  59. package/dist-lib/home-paths.cjs +1 -1
  60. package/dist-lib/host/bridge-host.cjs +46 -48
  61. package/dist-lib/host/fetch-proxy-handler.cjs +5 -5
  62. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  63. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  64. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  65. package/dist-lib/host/websocket-proxy.cjs +1 -1
  66. package/dist-lib/index.cjs +1 -1
  67. package/dist-lib/kotlin-host.cjs +1 -1
  68. package/dist-lib/menu.cjs +1 -1
  69. package/dist-lib/menu.mjs +3 -3
  70. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  71. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  72. package/dist-lib/metro-production-bundle.cjs +1 -1
  73. package/dist-lib/metro-production-bundle.mjs +4 -4
  74. package/dist-lib/native-app-identity-project.cjs +1 -1
  75. package/dist-lib/native-app-identity-project.mjs +15 -15
  76. package/dist-lib/native-app-identity.cjs +1 -1
  77. package/dist-lib/native-app-identity.mjs +6 -6
  78. package/dist-lib/native-firebase-metadata.cjs +1 -1
  79. package/dist-lib/native-firebase-metadata.mjs +3 -3
  80. package/dist-lib/pdfium-raster.cjs +1 -1
  81. package/dist-lib/pdfium-raster.mjs +2 -2
  82. package/dist-lib/plist.cjs +1 -1
  83. package/dist-lib/plist.mjs +3 -3
  84. package/dist-lib/profiles.cjs +1 -1
  85. package/dist-lib/public-brand.cjs +1 -1
  86. package/dist-lib/public-origins-lib-esm.json +85 -85
  87. package/dist-lib/public-origins-lib.json +64 -64
  88. package/dist-lib/react-native-host-modules.cjs +1 -1
  89. package/dist-lib/react-native-host-modules.mjs +2 -2
  90. package/dist-lib/reap-browser.cjs +1 -1
  91. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  92. package/dist-lib/sdk.cjs +1 -1
  93. package/dist-lib/sdk.mjs +8 -8
  94. package/dist-lib/skills.cjs +46 -48
  95. package/dist-lib/swift-compile.cjs +20 -21
  96. package/dist-lib/swift-compile.mjs +12 -12
  97. package/dist-lib/swift-package.cjs +1 -1
  98. package/dist-lib/swift-package.mjs +3 -3
  99. package/dist-lib/swift-submit.cjs +1 -1
  100. package/dist-lib/swift-submit.mjs +6 -6
  101. package/dist-lib/swift-svg-raster.cjs +1 -1
  102. package/dist-lib/swift-svg-raster.mjs +2 -2
  103. package/dist-lib/swift-toolchain.cjs +1 -1
  104. package/dist-lib/swift.cjs +1 -1
  105. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  106. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  107. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  108. package/dist-lib/vendor/acorn.cjs +1 -1
  109. package/dist-lib/vendor/magic-string.cjs +1 -1
  110. package/dist-lib/vendor/stream-json.cjs +1 -1
  111. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  112. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  113. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  114. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  115. package/dist-lib/vendor/sucrase.cjs +1 -1
  116. package/dist-lib/vendor/terser.cjs +1 -1
  117. package/dist-lib/vendor/valibot.cjs +1 -1
  118. package/dist-lib/vendor/ws.cjs +1 -1
  119. package/dist-lib/vendor/zod.cjs +1 -1
  120. package/dist-lib/worklet-executable.cjs +1 -1
  121. package/dist-lib/worklet-executable.mjs +3 -3
  122. package/package.json +1 -1
  123. package/src/one-direct-host-source.ts +23 -24
  124. package/src/swift-compile.ts +26 -32
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2743 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2745 | (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
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __commonJS = (cb, mod) => function __require() {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2743 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2745 | (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
 
4
4
  // ../../node_modules/valibot/dist/index.cjs
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2743 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2745 | (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 __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2743 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2745 | (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 __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2743 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2745 | (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 __defProp = Object.defineProperty;
@@ -1,12 +1,12 @@
1
- /*! peach v0.1.2743 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2745 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  parse
4
- } from "./esm-chunks/chunk-THSR72MV.mjs";
4
+ } from "./esm-chunks/chunk-BRVVBFDT.mjs";
5
5
  import {
6
6
  __privateAdd,
7
7
  __privateGet,
8
8
  __publicField
9
- } from "./esm-chunks/chunk-LVCSLWR2.mjs";
9
+ } from "./esm-chunks/chunk-OCBYCFDU.mjs";
10
10
 
11
11
  // src/worklet-kernel.ts
12
12
  var Unsupported = class extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.2743",
3
+ "version": "0.1.2745",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -60,19 +60,10 @@ public final class PeachOneDirectStage: NSObject {
60
60
  }
61
61
  }
62
62
 
63
- @objc public func attachHostView(_ view: UIView, frame: CGRect) {
64
- if view.superview !== stageView {
65
- view.removeFromSuperview()
66
- stageView.addSubview(view)
67
- }
68
- if view.frame != frame {
69
- view.frame = frame
70
- }
71
- }
72
-
73
63
  @objc public func detachHostView(_ view: UIView) {
64
+ let wasDirectHost = view._peachReactContentHost != nil
74
65
  view._peachReactContentHost = nil
75
- if view.superview === stageView {
66
+ if wasDirectHost {
76
67
  view.removeFromSuperview()
77
68
  }
78
69
  }
@@ -1918,6 +1909,7 @@ struct DirectContainerRecord {
1918
1909
  BOOL composed = NO;
1919
1910
  peach_node hostContentNode = 0;
1920
1911
  CGRect frame = CGRectZero;
1912
+ __weak UIView* hostParent = nil;
1921
1913
  };
1922
1914
 
1923
1915
  std::unordered_map<peach_node, DirectContainerRecord> gRecords;
@@ -1925,6 +1917,16 @@ std::unordered_map<peach_node, UIView*> gContentViews;
1925
1917
  std::unordered_map<peach_node, UIView*> gTriggerViews;
1926
1918
  peach_node gInPlaceTriggerNode = 0;
1927
1919
 
1920
+ UIView* contentViewForNode(peach_node node) {
1921
+ auto& slot = gContentViews[node];
1922
+ if (!slot) {
1923
+ slot = [[UIView alloc] initWithFrame:CGRectZero];
1924
+ slot.backgroundColor = UIColor.clearColor;
1925
+ [PeachOneDirectStage.shared tagContentView:slot node:node];
1926
+ }
1927
+ return slot;
1928
+ }
1929
+
1928
1930
  NSString* nsStringFromBytes(const char* ptr, uint32_t len) {
1929
1931
  if (!ptr || !len) return @"";
1930
1932
  return [[NSString alloc] initWithBytes:ptr length:len encoding:NSUTF8StringEncoding] ?: @"";
@@ -2026,6 +2028,7 @@ id<PeachContainer> makeContainer(NSString* kind, peach_node node, NSDictionary*
2026
2028
  it->second.hostView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, it->second.frame.size.width, it->second.frame.size.height)];
2027
2029
  }
2028
2030
  UIView* hostView = it->second.hostView;
2031
+ it->second.hostParent = nil;
2029
2032
  [PeachOneDirectStage.shared detachHostView:hostView];
2030
2033
  return hostView;
2031
2034
  }
@@ -2039,13 +2042,7 @@ id<PeachContainer> makeContainer(NSString* kind, peach_node node, NSDictionary*
2039
2042
  }
2040
2043
  return trigger;
2041
2044
  }
2042
- auto& slot = gContentViews[node];
2043
- if (!slot) {
2044
- slot = [[UIView alloc] initWithFrame:CGRectZero];
2045
- slot.backgroundColor = UIColor.clearColor;
2046
- [PeachOneDirectStage.shared tagContentView:slot node:node];
2047
- }
2048
- return slot;
2045
+ return contentViewForNode(node);
2049
2046
  }
2050
2047
 
2051
2048
  - (CGSize)layoutSizeForNode:(peach_node)node {
@@ -2222,13 +2219,16 @@ void peach_one_container_mount(uint32_t targetLo, uint32_t targetHi, uint32_t pa
2222
2219
  record.hostView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, w, h)];
2223
2220
  record.hostView.backgroundColor = UIColor.clearColor;
2224
2221
  }
2225
- UIView* stageView = PeachOneDirectStage.shared.stageView;
2226
- if (record.hostView.superview == nil || record.hostView.superview == stageView) {
2222
+ UIView* currentParent = record.hostView.superview;
2223
+ if (!currentParent || currentParent == record.hostParent) {
2224
+ UIView* parent = hostContentNode ? contentViewForNode(hostContentNode) : PeachOneDirectStage.shared.stageView;
2225
+ record.hostParent = parent;
2227
2226
  [PeachOneDirectStage.shared tagHostView:record.hostView
2228
2227
  node:node
2229
2228
  hostContentNode:hostContentNode];
2230
- [PeachOneDirectStage.shared attachHostView:record.hostView
2231
- frame:CGRectMake(0, 0, w, h)];
2229
+ if (currentParent != parent) [parent addSubview:record.hostView];
2230
+ const CGRect next = CGRectMake(0, 0, w, h);
2231
+ if (!CGRectEqualToRect(record.hostView.frame, next)) record.hostView.frame = next;
2232
2232
  } else {
2233
2233
  CGRect current = record.hostView.frame;
2234
2234
  current.size = CGSizeMake(w, h);
@@ -2262,8 +2262,7 @@ void peach_one_container_mount(uint32_t targetLo, uint32_t targetHi, uint32_t pa
2262
2262
 
2263
2263
  // bounds-only update after layout (never re-runs mountIn on PeachSwiftUI)
2264
2264
  if (!record.composed && record.hostView) {
2265
- UIView* stageView = PeachOneDirectStage.shared.stageView;
2266
- if (record.hostView.superview == stageView) {
2265
+ if (record.hostParent && record.hostView.superview == record.hostParent) {
2267
2266
  const CGRect next = CGRectMake(0, 0, w, h);
2268
2267
  if (!CGRectEqualToRect(record.hostView.frame, next)) {
2269
2268
  record.hostView.frame = next;
@@ -6825,6 +6825,7 @@ const SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS = 4
6825
6825
  const SWIFT_FRAMEWORK_SLOT_KEY = '.peach-framework-key'
6826
6826
  const SWIFT_FRAMEWORK_SLOT_ORIGIN = '.peach-framework-origin'
6827
6827
  const SWIFT_FRAMEWORK_SLOT_RELEASE = '.peach-framework-release'
6828
+ const SWIFT_FRAMEWORK_SLOT_HANDOFF = '.peach-framework-handoff'
6828
6829
 
6829
6830
  const SWIFT_BUILD_ROOT_SLOTS = 4
6830
6831
  const SWIFT_BUILD_ROOT_SHAPE = '.peach-build-shape'
@@ -6869,20 +6870,7 @@ function swiftFrameworkSlotRelease(slot: string): string | null {
6869
6870
  return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_RELEASE)
6870
6871
  }
6871
6872
 
6872
- // protect another caller's verified framework receipt long enough for a
6873
- // producer's caller or iterative guest build to reuse it before restaging.
6874
- const SWIFT_FRAMEWORK_HOT_RECEIPT_MS = 15 * 60 * 1000
6875
-
6876
- function swiftFrameworkSlotHasReceipt(slot: string): boolean {
6877
- try {
6878
- return readdirSync(path.join(slot, 'products-ready')).some((entry) =>
6879
- entry.endsWith('.json'),
6880
- )
6881
- } catch (error) {
6882
- if (vanished(error)) return false
6883
- throw error
6884
- }
6885
- }
6873
+ const SWIFT_FRAMEWORK_HANDOFF_MS = 15 * 60 * 1000
6886
6874
 
6887
6875
  async function withSwiftFrameworkSlot<T>(
6888
6876
  frameworkKey: string,
@@ -6894,7 +6882,8 @@ async function withSwiftFrameworkSlot<T>(
6894
6882
  lease: SwiftRootLease,
6895
6883
  allowWrite: boolean,
6896
6884
  ) => Promise<T | undefined>,
6897
- unoptimized = false,
6885
+ unoptimized: boolean,
6886
+ linkOnly: boolean,
6898
6887
  ): Promise<T> {
6899
6888
  const slotCount = swiftFrameworkSlotCount(unoptimized)
6900
6889
  const slotsDir = swiftFrameworksDir(unoptimized)
@@ -6913,15 +6902,20 @@ async function withSwiftFrameworkSlot<T>(
6913
6902
  throw error
6914
6903
  }
6915
6904
  }
6916
- const isRecentForeignReceipt = (slot: string, now: number) =>
6917
- !own(slot) &&
6918
- swiftFrameworkSlotHasReceipt(slot) &&
6919
- now - slotMtimeMs(slot) < SWIFT_FRAMEWORK_HOT_RECEIPT_MS
6905
+ const handoffFile = (slot: string) => path.join(slot, SWIFT_FRAMEWORK_SLOT_HANDOFF)
6906
+ const hasPendingForeignHandoff = (slot: string, now: number) => {
6907
+ const stamp = statSync(handoffFile(slot), { throwIfNoEntry: false })
6908
+ return (
6909
+ stamp !== undefined &&
6910
+ !own(slot) &&
6911
+ now - stamp.mtimeMs < SWIFT_FRAMEWORK_HANDOFF_MS
6912
+ )
6913
+ }
6920
6914
  const trySlot = (
6921
6915
  slot: string,
6922
6916
  mode: 'reuse' | 'extend' | 'restage',
6923
6917
  logSelection?: () => void,
6924
- allowHotForeign = true,
6918
+ allowPendingHandoff = true,
6925
6919
  ) => {
6926
6920
  return withSwiftRootLock(
6927
6921
  slot,
@@ -6930,13 +6924,12 @@ async function withSwiftFrameworkSlot<T>(
6930
6924
  if (mode !== 'restage' && !matches) return
6931
6925
  const allowWrite = mode !== 'reuse'
6932
6926
  if (allowWrite && (await hasLiveSwiftRootReaders(slot, signal))) return
6933
- // re-check recency under the lock so a queued stale rank cannot evict
6934
- // a foreign receipt written while waiting when cold/empty slots exist.
6927
+ // an image producer can finish preparing this slot after we ranked it.
6935
6928
  if (
6936
6929
  mode === 'restage' &&
6937
6930
  !matches &&
6938
- !allowHotForeign &&
6939
- isRecentForeignReceipt(slot, Date.now())
6931
+ !allowPendingHandoff &&
6932
+ hasPendingForeignHandoff(slot, Date.now())
6940
6933
  )
6941
6934
  return
6942
6935
  if (!matches) logSelection?.()
@@ -6951,6 +6944,8 @@ async function withSwiftFrameworkSlot<T>(
6951
6944
  `[swift-framework-cache] ${path.basename(slot)} hit=products release=${release}`,
6952
6945
  )
6953
6946
  const now = new Date()
6947
+ if (linkOnly) writeFileSync(handoffFile(slot), '')
6948
+ else rmSync(handoffFile(slot), { force: true })
6954
6949
  utimesSync(slot, now, now)
6955
6950
  return { value }
6956
6951
  },
@@ -7000,10 +6995,10 @@ async function withSwiftFrameworkSlot<T>(
7000
6995
  }
7001
6996
  // swiftc's swift-version hash invalidates every framework target when a slot
7002
6997
  // switches compiler release. keep each compiler release in its own slot and
7003
- // preserve recent foreign verified receipts while cold or empty slots exist:
7004
- // tier 0: own or cold same-release slot (nearest source, own first, LRU ties),
6998
+ // protect a foreign producer's products until an app has reused them.
6999
+ // tier 0: available same-release slot (nearest source, own first, LRU ties),
7005
7000
  // tier 1: empty slot,
7006
- // tier 2: recent foreign verified receipt (LRU first, immediate restage if all hot),
7001
+ // tier 2: pending foreign handoff (LRU first),
7007
7002
  // tier 3: another release (LRU).
7008
7003
  const rankSlots = (now: number) =>
7009
7004
  slots
@@ -7016,11 +7011,8 @@ async function withSwiftFrameworkSlot<T>(
7016
7011
  return { slot, index, tier: 3, changes: Infinity, own: false, mtimeMs }
7017
7012
  const changes = changedInputsFor(slot, slotKey)
7018
7013
  const isOwn = own(slot)
7019
- const hotForeign =
7020
- !isOwn &&
7021
- swiftFrameworkSlotHasReceipt(slot) &&
7022
- now - mtimeMs < SWIFT_FRAMEWORK_HOT_RECEIPT_MS
7023
- return { slot, index, tier: hotForeign ? 2 : 0, changes, own: isOwn, mtimeMs }
7014
+ const tier = hasPendingForeignHandoff(slot, now) ? 2 : 0
7015
+ return { slot, index, tier, changes, own: isOwn, mtimeMs }
7024
7016
  })
7025
7017
  .sort((left, right) => {
7026
7018
  if (left.tier !== right.tier) return left.tier - right.tier
@@ -7195,6 +7187,7 @@ function stageFrameworkSource(
7195
7187
  // an interrupted restage must not look like a finished one
7196
7188
  rmSync(path.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), { force: true })
7197
7189
  rmSync(path.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), { force: true })
7190
+ rmSync(path.join(slot, SWIFT_FRAMEWORK_SLOT_HANDOFF), { force: true })
7198
7191
  rmSync(path.join(slot, 'products-ready'), { recursive: true, force: true })
7199
7192
  rmSync(path.join(slot, 'products-lib'), { recursive: true, force: true })
7200
7193
  rmSync(path.join(slot, 'lib'), { recursive: true, force: true })
@@ -7650,6 +7643,7 @@ async function compileSwiftProjectOnce(
7650
7643
  budget.signal,
7651
7644
  prepareFrameworks,
7652
7645
  unoptimized,
7646
+ options.linkOnly === true,
7653
7647
  )
7654
7648
  if (!frameworks)
7655
7649
  throw new Error('Swift distribution did not provide its frameworks')