peachsim 0.1.2773 → 0.1.2775

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 (148) 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 +318 -199
  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-3SGU25AX.mjs → acorn-CTIC3GCU.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-KMMFDGYA.mjs → chunk-2YTHEKWJ.mjs} +1 -1
  28. package/dist-lib/esm-chunks/{chunk-2HWUPAOD.mjs → chunk-3WU4YTJR.mjs} +205 -166
  29. package/dist-lib/esm-chunks/{chunk-ORGP6SSO.mjs → chunk-4B46TF64.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-QMI7ECNF.mjs → chunk-C5EU2DRL.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-DFVWY2BW.mjs → chunk-CFNSLWMQ.mjs} +4 -4
  32. package/dist-lib/esm-chunks/{chunk-HN7CHPZK.mjs → chunk-E6ULRDAP.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-IQF674WE.mjs → chunk-ESP2U4IX.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-5DQRSOJ5.mjs → chunk-ESWEEZZP.mjs} +2 -2
  35. package/dist-lib/esm-chunks/{chunk-4FVDW5QX.mjs → chunk-FBN2C43P.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-NH3CEIBN.mjs → chunk-FVUN2533.mjs} +3 -3
  37. package/dist-lib/esm-chunks/{chunk-IM2IAOAZ.mjs → chunk-GKKZLYBA.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-SZ7TVJHH.mjs → chunk-H5TBKFDB.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-GSZLZNZM.mjs → chunk-ITTQHQD5.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-XXLSXSUK.mjs → chunk-JERE5CAK.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-WBPJJXMA.mjs → chunk-MJSKVK7E.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-Q2EEH42W.mjs → chunk-NV5NLKKN.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-G5TS3L6A.mjs → chunk-RGOPQX37.mjs} +6 -6
  44. package/dist-lib/esm-chunks/{chunk-KEVJJ3QT.mjs → chunk-S47B7YHJ.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-FRPS6V6P.mjs → chunk-SK4FQLNJ.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-YZRKIUVZ.mjs → chunk-TE3WHBF3.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-ANTOZ3UC.mjs → chunk-W42DUKWD.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-DYKZYFHH.mjs → chunk-WB5OWF4G.mjs} +5 -5
  49. package/dist-lib/esm-chunks/{chunk-KZ2NH7C4.mjs → chunk-XMBGLLON.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-MRQ72NMR.mjs → chunk-YRKGWASL.mjs} +6 -6
  51. package/dist-lib/esm-chunks/{metro-layout-parser-5MEY33AK.mjs → metro-layout-parser-2RQ3WC37.mjs} +3 -3
  52. package/dist-lib/esm-chunks/{swift-package-prebuilt-3FLCNBQT.mjs → swift-package-prebuilt-L5SWVH6U.mjs} +12 -12
  53. package/dist-lib/esm-chunks/{swift-sdk-app-module-PPJ4LUOW.mjs → swift-sdk-app-module-5SWDBTBY.mjs} +107 -25
  54. package/dist-lib/esm-chunks/{swift-sdk-image-L5MERITP.mjs → swift-sdk-image-OOSMI47A.mjs} +16 -16
  55. package/dist-lib/esm-chunks/{swift-sdk-image-producer-IILRYXVN.mjs → swift-sdk-image-producer-DL4VEBXN.mjs} +5 -5
  56. package/dist-lib/expo-swift-bundle.cjs +318 -199
  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 +4327 -4209
  61. package/dist-lib/host/fetch-proxy-handler.cjs +343 -340
  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 +86 -86
  87. package/dist-lib/public-origins-lib.json +96 -96
  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 +2912 -2794
  95. package/dist-lib/swift-compile.cjs +314 -195
  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/dist-types/packages/peach-engine/src/ios/duo-vertical-bar-geometry.d.ts +0 -15
  123. package/dist-types/packages/peach-engine/src/ios/flex-interaction.d.ts +0 -1
  124. package/dist-types/packages/peach-engine/src/react-native/AppState.d.ts +0 -1
  125. package/dist-types/packages/peach-engine/src/react-native/Keyboard.d.ts +0 -1
  126. package/dist-types/packages/peach-kit/src/ring-mode-state.d.ts +0 -1
  127. package/dist-types/packages/peach-kit/src/transitions/screen-transition-math.d.ts +0 -31
  128. package/package.json +1 -1
  129. package/src/assetCatalogContract.ts +0 -6
  130. package/src/expo-pod-prebuilt.ts +0 -63
  131. package/src/native-package-slice.ts +0 -2
  132. package/src/podfile-cocoapods.ts +0 -5
  133. package/src/runtime-assets.ts +0 -9
  134. package/src/sfSymbolMetricsContract.ts +51 -23
  135. package/src/swift-compile.ts +9 -6
  136. package/src/swift-distribution-mirror.ts +16 -5
  137. package/src/swift-guest-compile.ts +18 -7
  138. package/src/swift-guest-link.ts +0 -9
  139. package/src/swift-guest-projection-storage.ts +15 -2
  140. package/src/swift-guest-projection.ts +1 -46
  141. package/src/swift-guest-runtime-plan.ts +4 -80
  142. package/src/swift-header-compiler.ts +24 -9
  143. package/src/swift-sdk-app-module.ts +113 -10
  144. package/src/swift-wasm-prune.ts +0 -5
  145. package/src/swiftRuntimeProductContract.ts +1 -0
  146. package/src/swiftSdkLinkContract.ts +10 -0
  147. package/src/wasm-narrow-boundary.ts +0 -13
  148. package/src/wasm-lazy-split-tool.ts +0 -210
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2773 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2775 | (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;
@@ -10502,7 +10502,7 @@ var init_swift_objc_sdk_tree = __esm({
10502
10502
 
10503
10503
  // src/swift-compiler-digest.ts
10504
10504
  function swiftArchiveCompilerDigestValue() {
10505
- return true ? "a3915d1d96c1d8c99b9affeff6c30dcd0a65ebdb46659725acdf5053072c6580" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname, "archive");
10505
+ return true ? "dafa6520c0bcd0e852437835ad9626e824b1e758db5c163a7de2f7fc70ac67ee" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname, "archive");
10506
10506
  }
10507
10507
  var import_node_crypto10, import_node_fs20, import_node_path17, SWIFT_DIGEST_SOURCES, LINKED_IMAGE_SOURCES, SWIFT_ARCHIVE_DIGEST_SOURCES;
10508
10508
  var init_swift_compiler_digest = __esm({
@@ -15465,6 +15465,128 @@ var init_swift_distribution_contract = __esm({
15465
15465
  }
15466
15466
  });
15467
15467
 
15468
+ // src/swiftRuntimeProductContract.ts
15469
+ var v, SWIFT_FRAMEWORK_PRODUCT_FILE, swiftFrameworkProductSchema, SWIFT_SDK_PRODUCT_FILE, SWIFT_SDK_PRODUCT_DIRECTORY, swiftSdkProductSchema, swiftSdkProductsSchema;
15470
+ var init_swiftRuntimeProductContract = __esm({
15471
+ "src/swiftRuntimeProductContract.ts"() {
15472
+ "use strict";
15473
+ v = __toESM(require("peachsim/vendor/valibot"), 1);
15474
+ init_swiftTargetContract();
15475
+ SWIFT_FRAMEWORK_PRODUCT_FILE = "lib/framework-product.json";
15476
+ swiftFrameworkProductSchema = v.object({
15477
+ version: v.literal(1),
15478
+ packageName: v.string(),
15479
+ manifestSha256: v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/)),
15480
+ product: v.object({
15481
+ name: v.string(),
15482
+ linkage: v.picklist(["static", "dynamic", "automatic"]),
15483
+ targets: v.array(v.string())
15484
+ }),
15485
+ // framework names are distinct from SDK library linkNames. they identify
15486
+ // the packaged owner, not an observed native image dependency.
15487
+ frameworkAliases: v.array(
15488
+ v.object({
15489
+ kind: v.literal("framework"),
15490
+ name: v.string(),
15491
+ targets: v.array(v.string()),
15492
+ moduleMap: v.string(),
15493
+ moduleMapSha256: v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/)),
15494
+ wasmSdkId: v.string(),
15495
+ wasmSdkChecksum: v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/))
15496
+ })
15497
+ ),
15498
+ targets: v.array(
15499
+ v.object({
15500
+ name: v.string(),
15501
+ path: v.string(),
15502
+ kind: v.picklist(["regular", "system"]),
15503
+ dependencies: v.array(v.string())
15504
+ })
15505
+ ),
15506
+ objects: v.array(v.object({ path: v.string(), target: v.string() })),
15507
+ autolink: v.array(v.string())
15508
+ });
15509
+ SWIFT_SDK_PRODUCT_FILE = "runtime-products.json";
15510
+ SWIFT_SDK_PRODUCT_DIRECTORY = "swift.xctoolchain/usr/lib/swift_static/wasi";
15511
+ swiftSdkProductSchema = v.pipe(
15512
+ v.object({
15513
+ id: v.string(),
15514
+ installName: v.string(),
15515
+ target: v.literal(SWIFT_WASM_TRIPLE),
15516
+ linkNames: v.array(v.string()),
15517
+ // absent records declare no framework namespace, even when a library name matches.
15518
+ frameworkAliases: v.optional(
15519
+ v.array(
15520
+ v.object({
15521
+ name: v.string(),
15522
+ moduleMap: v.string(),
15523
+ moduleMapSha256: v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/))
15524
+ })
15525
+ ),
15526
+ []
15527
+ ),
15528
+ buildDependencies: v.array(v.string()),
15529
+ linkOwnership: v.picklist(["image", "containing-image"]),
15530
+ linkDependencies: v.nullable(v.array(v.string())),
15531
+ autolink: v.array(v.string()),
15532
+ sources: v.array(
15533
+ v.object({
15534
+ path: v.string(),
15535
+ sha256: v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/))
15536
+ })
15537
+ ),
15538
+ artifacts: v.array(
15539
+ v.variant("kind", [
15540
+ v.object({
15541
+ kind: v.literal("archive"),
15542
+ path: v.string(),
15543
+ sha256: v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/)),
15544
+ members: v.array(
15545
+ v.object({
15546
+ name: v.string(),
15547
+ ordinal: v.pipe(v.number(), v.integer(), v.minValue(1)),
15548
+ sha256: v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/)),
15549
+ sources: v.array(v.string())
15550
+ })
15551
+ )
15552
+ }),
15553
+ v.object({
15554
+ kind: v.literal("object"),
15555
+ path: v.string(),
15556
+ sha256: v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/)),
15557
+ sources: v.array(v.string()),
15558
+ input: v.optional(
15559
+ v.object({
15560
+ product: v.string(),
15561
+ artifact: v.object({
15562
+ path: v.string(),
15563
+ sha256: v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/))
15564
+ }),
15565
+ member: v.optional(
15566
+ v.object({
15567
+ name: v.string(),
15568
+ ordinal: v.pipe(v.number(), v.integer(), v.minValue(1)),
15569
+ sha256: v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/))
15570
+ })
15571
+ )
15572
+ })
15573
+ )
15574
+ })
15575
+ ])
15576
+ )
15577
+ }),
15578
+ v.check(
15579
+ (product) => product.linkOwnership === "image" || product.linkDependencies === null,
15580
+ "containing-image products cannot declare an image scope"
15581
+ )
15582
+ );
15583
+ swiftSdkProductsSchema = v.object({
15584
+ version: v.literal(1),
15585
+ products: v.array(swiftSdkProductSchema)
15586
+ });
15587
+ }
15588
+ });
15589
+
15468
15590
  // src/swift-distribution-mirror.ts
15469
15591
  function syncSwiftDistributionMirror(root, source, manifest) {
15470
15592
  const mirror = import_node_path25.default.join(root, SWIFT_DISTRIBUTION_MIRROR);
@@ -15527,10 +15649,12 @@ function syncSwiftSdkMirrorFromView(root, frameworkRoot, sourceView, sourceSdkId
15527
15649
  const options2 = ["--swift-sdks-path", mirror];
15528
15650
  const interrupted = (0, import_node_fs26.existsSync)(syncingMarker);
15529
15651
  const previous = interrupted ? null : readSdkRecord(recordFile);
15530
- if (previous && previous.sourceView === sourceView && previous.sourceSdkId === sourceSdkId && (0, import_node_fs26.existsSync)(bundleInfo) && (0, import_node_fs26.existsSync)(import_node_path25.default.join(destTriple, "swift-sdk.json"))) {
15652
+ const sourceTriple = resolveSdkViewTripleDir(sourceView, sourceSdkId);
15653
+ const catalog = import_node_path25.default.join(destTriple, SDK_PRODUCT_CATALOG);
15654
+ const sourceCatalog = import_node_path25.default.join(sourceTriple, SDK_PRODUCT_CATALOG);
15655
+ if (previous && previous.sourceView === sourceView && previous.sourceSdkId === sourceSdkId && (0, import_node_fs26.existsSync)(bundleInfo) && (0, import_node_fs26.existsSync)(import_node_path25.default.join(destTriple, "swift-sdk.json")) && (!(0, import_node_fs26.lstatSync)(sourceCatalog, { throwIfNoEntry: false })?.isSymbolicLink() || (0, import_node_fs26.lstatSync)(catalog, { throwIfNoEntry: false })?.isSymbolicLink())) {
15531
15656
  return { id: SWIFT_SDK_MIRROR_ID, options: options2, toolsetChanged: false };
15532
15657
  }
15533
- const sourceTriple = resolveSdkViewTripleDir(sourceView, sourceSdkId);
15534
15658
  if (!previous) {
15535
15659
  if (!interrupted) (0, import_node_fs26.rmSync)(mirror, { recursive: true, force: true });
15536
15660
  (0, import_node_fs26.rmSync)(import_node_path25.default.join(root, ".build"), { recursive: true, force: true });
@@ -15570,7 +15694,7 @@ function syncSwiftSdkMirrorFromView(root, frameworkRoot, sourceView, sourceSdkId
15570
15694
  (0, import_node_fs26.rmSync)(import_node_path25.default.join(root, ".build"), { recursive: true, force: true });
15571
15695
  } else {
15572
15696
  const compileTouched = touched.filter(
15573
- (file) => !file.endsWith(".a") && !file.endsWith(".o") && !file.startsWith("rust/") && file !== "runtime-products.json"
15697
+ (file) => !file.endsWith(".a") && !file.endsWith(".o") && !file.startsWith("rust/") && file !== SWIFT_SDK_PRODUCT_FILE && file !== SDK_PRODUCT_CATALOG
15574
15698
  );
15575
15699
  const headersChanged = compileTouched.some(
15576
15700
  (file) => !file.endsWith(".swiftmodule") && !file.endsWith(".swiftdoc") && !file.endsWith(".swiftsourceinfo") && !file.endsWith(".abi.json")
@@ -15639,8 +15763,8 @@ function syncSdkTree(sourceDir, destDir, prefix, distributionPrefix, changed, re
15639
15763
  const dest = import_node_path25.default.join(destDir, entry.name);
15640
15764
  const destLstat = (0, import_node_fs26.lstatSync)(dest, { throwIfNoEntry: false });
15641
15765
  if (entry.isSymbolicLink()) {
15642
- const target = (0, import_node_fs26.readlinkSync)(src);
15643
- if (target.startsWith(distributionPrefix)) {
15766
+ const target = import_node_path25.default.resolve(sourceDir, (0, import_node_fs26.readlinkSync)(src));
15767
+ if (target.startsWith(distributionPrefix) || rel === SDK_PRODUCT_CATALOG) {
15644
15768
  if (destLstat?.isSymbolicLink() && (0, import_node_fs26.readlinkSync)(dest) === target) continue;
15645
15769
  if (destLstat) (0, import_node_fs26.rmSync)(dest, { recursive: true, force: true });
15646
15770
  (0, import_node_fs26.symlinkSync)(target, dest);
@@ -15762,7 +15886,7 @@ function invalidateBuildDependents(root, spellings, read, headersChanged) {
15762
15886
  if (headersChanged)
15763
15887
  (0, import_node_fs26.rmSync)(import_node_path25.default.join(scratch2, "ModuleCache"), { recursive: true, force: true });
15764
15888
  }
15765
- var import_node_crypto14, import_node_fs26, import_node_path25, SWIFT_DISTRIBUTION_MIRROR, SWIFT_SDK_MIRROR, SWIFT_SDK_MIRROR_ID, SWIFT_SDK_MIRROR_RECORD, SWIFT_SDK_MIRROR_SYNCING, SWIFT_SDK_MIRROR_BUNDLE, SWIFT_DISTRIBUTION_MIRROR_SYNCING;
15889
+ var import_node_crypto14, import_node_fs26, import_node_path25, SWIFT_DISTRIBUTION_MIRROR, SWIFT_SDK_MIRROR, SWIFT_SDK_MIRROR_ID, SWIFT_SDK_MIRROR_RECORD, SWIFT_SDK_MIRROR_SYNCING, SWIFT_SDK_MIRROR_BUNDLE, SWIFT_DISTRIBUTION_MIRROR_SYNCING, SDK_PRODUCT_CATALOG;
15766
15890
  var init_swift_distribution_mirror = __esm({
15767
15891
  "src/swift-distribution-mirror.ts"() {
15768
15892
  "use strict";
@@ -15774,6 +15898,7 @@ var init_swift_distribution_mirror = __esm({
15774
15898
  init_swift_distribution_contract();
15775
15899
  init_swift_shared_sdk();
15776
15900
  init_swiftContract();
15901
+ init_swiftRuntimeProductContract();
15777
15902
  init_swiftTargetContract();
15778
15903
  SWIFT_DISTRIBUTION_MIRROR = ".peach-distribution";
15779
15904
  SWIFT_SDK_MIRROR = ".peach-sdk";
@@ -15782,6 +15907,7 @@ var init_swift_distribution_mirror = __esm({
15782
15907
  SWIFT_SDK_MIRROR_SYNCING = ".peach-sdk-syncing";
15783
15908
  SWIFT_SDK_MIRROR_BUNDLE = "peach-wasm.artifactbundle";
15784
15909
  SWIFT_DISTRIBUTION_MIRROR_SYNCING = ".peach-distribution-syncing";
15910
+ SDK_PRODUCT_CATALOG = `${SWIFT_SDK_PRODUCT_DIRECTORY}/${SWIFT_SDK_PRODUCT_FILE}`;
15785
15911
  }
15786
15912
  });
15787
15913
 
@@ -15908,8 +16034,8 @@ function guestSourceImages(input, swift) {
15908
16034
  membership = sourceImageMembership(graph);
15909
16035
  }
15910
16036
  if (promoted.length) {
15911
- const names = v.parse(
15912
- v.array(v.string()),
16037
+ const names = v2.parse(
16038
+ v2.array(v2.string()),
15913
16039
  JSON.parse(
15914
16040
  (0, import_node_child_process15.execFileSync)(
15915
16041
  swift,
@@ -16100,13 +16226,13 @@ function planGuestSourceLink(graph, images, callers, artifacts, symbols) {
16100
16226
  symbols
16101
16227
  };
16102
16228
  }
16103
- var import_node_child_process15, import_node_path26, v, NATIVE_ARCHIVE_OBJECTS_DIR;
16229
+ var import_node_child_process15, import_node_path26, v2, NATIVE_ARCHIVE_OBJECTS_DIR;
16104
16230
  var init_swift_guest_source_plan = __esm({
16105
16231
  "src/swift-guest-source-plan.ts"() {
16106
16232
  "use strict";
16107
16233
  import_node_child_process15 = require("node:child_process");
16108
16234
  import_node_path26 = __toESM(require("node:path"), 1);
16109
- v = __toESM(require("peachsim/vendor/valibot"), 1);
16235
+ v2 = __toESM(require("peachsim/vendor/valibot"), 1);
16110
16236
  init_swift_package();
16111
16237
  init_swift_toolchain();
16112
16238
  NATIVE_ARCHIVE_OBJECTS_DIR = ".peach-native-libraries";
@@ -16293,7 +16419,7 @@ var init_guest_engine_services = __esm({
16293
16419
  });
16294
16420
 
16295
16421
  // src/swift-guest-linked-spans.ts
16296
- function number(bytes, start) {
16422
+ function number2(bytes, start) {
16297
16423
  let value = 0;
16298
16424
  let shift = 0;
16299
16425
  let pos = start;
@@ -16306,7 +16432,7 @@ function number(bytes, start) {
16306
16432
  }
16307
16433
  }
16308
16434
  function signedAddress(bytes, start) {
16309
- const [value, end] = number(bytes, start);
16435
+ const [value, end] = number2(bytes, start);
16310
16436
  const bits = (end - start) * 7;
16311
16437
  const signed = bits < 32 && bytes[end - 1] & 64 ? value - 2 ** bits : value;
16312
16438
  return [signed >>> 0, end];
@@ -16314,7 +16440,7 @@ function signedAddress(bytes, start) {
16314
16440
  function startupDataInitializers(body) {
16315
16441
  let pos = 0;
16316
16442
  const read = () => {
16317
- const [value, next] = number(body, pos);
16443
+ const [value, next] = number2(body, pos);
16318
16444
  pos = next;
16319
16445
  return value;
16320
16446
  };
@@ -16393,7 +16519,7 @@ function layout(bytes, readData = true, requireExports = true) {
16393
16519
  let offset = 8;
16394
16520
  while (offset < bytes.length) {
16395
16521
  const id = bytes[offset++];
16396
- const [size2, start2] = number(bytes, offset);
16522
+ const [size2, start2] = number2(bytes, offset);
16397
16523
  if (start2 + size2 > bytes.length) throw new Error("invalid wasm section");
16398
16524
  if (id) sections.set(id, [start2, start2 + size2]);
16399
16525
  offset = start2 + size2;
@@ -16402,7 +16528,7 @@ function layout(bytes, readData = true, requireExports = true) {
16402
16528
  if (!exports2) throw new Error("guest wasm does not export memory and table");
16403
16529
  let exportPosition = exports2[0];
16404
16530
  const readExport2 = () => {
16405
- const [value, next] = number(bytes, exportPosition);
16531
+ const [value, next] = number2(bytes, exportPosition);
16406
16532
  exportPosition = next;
16407
16533
  return value;
16408
16534
  };
@@ -16423,7 +16549,7 @@ function layout(bytes, readData = true, requireExports = true) {
16423
16549
  if (section2) {
16424
16550
  let pos = section2[0];
16425
16551
  const read = () => {
16426
- const [value, next] = number(bytes, pos);
16552
+ const [value, next] = number2(bytes, pos);
16427
16553
  pos = next;
16428
16554
  return value;
16429
16555
  };
@@ -16466,7 +16592,7 @@ function layout(bytes, readData = true, requireExports = true) {
16466
16592
  if (memory) {
16467
16593
  let pos = memory[0];
16468
16594
  const read = () => {
16469
- const [value, next] = number(bytes, pos);
16595
+ const [value, next] = number2(bytes, pos);
16470
16596
  pos = next;
16471
16597
  return value;
16472
16598
  };
@@ -16480,7 +16606,7 @@ function layout(bytes, readData = true, requireExports = true) {
16480
16606
  }
16481
16607
  if (memoryPages === void 0) throw new Error("guest wasm has no memory");
16482
16608
  const start = sections.get(8);
16483
- const startFunction = start ? number(bytes, start[0])[0] : void 0;
16609
+ const startFunction = start ? number2(bytes, start[0])[0] : void 0;
16484
16610
  let startup;
16485
16611
  const functionsByCodeOffset = /* @__PURE__ */ new Map();
16486
16612
  const code = sections.get(10);
@@ -16536,7 +16662,7 @@ function layout(bytes, readData = true, requireExports = true) {
16536
16662
  return b0;
16537
16663
  }
16538
16664
  }
16539
- const [value, next] = number(bytes, pos);
16665
+ const [value, next] = number2(bytes, pos);
16540
16666
  pos = next;
16541
16667
  return value;
16542
16668
  };
@@ -16573,7 +16699,7 @@ function layout(bytes, readData = true, requireExports = true) {
16573
16699
  if (dataSection && readData) {
16574
16700
  let pos = dataSection[0];
16575
16701
  const read = () => {
16576
- const [value, next] = number(bytes, pos);
16702
+ const [value, next] = number2(bytes, pos);
16577
16703
  pos = next;
16578
16704
  return value;
16579
16705
  };
@@ -16917,7 +17043,7 @@ function takeGuestStartupData(wasm, address, length) {
16917
17043
  while (offset < wasm.length) {
16918
17044
  const header = offset;
16919
17045
  const id = wasm[offset++];
16920
- const [size3, start2] = number(wasm, offset);
17046
+ const [size3, start2] = number2(wasm, offset);
16921
17047
  if (id) sections.set(id, [header, start2, start2 + size3]);
16922
17048
  offset = start2 + size3;
16923
17049
  }
@@ -16925,13 +17051,13 @@ function takeGuestStartupData(wasm, address, length) {
16925
17051
  const code = sections.get(10);
16926
17052
  const data = sections.get(11);
16927
17053
  if (!start || !code || !data) throw new Error("guest wasm has no startup data");
16928
- const [startFunction] = number(wasm, start[1]);
17054
+ const [startFunction] = number2(wasm, start[1]);
16929
17055
  let functionImports = 0;
16930
17056
  const imports2 = sections.get(2);
16931
17057
  if (imports2) {
16932
17058
  let pos2 = imports2[1];
16933
17059
  const read = () => {
16934
- const [value, next2] = number(wasm, pos2);
17060
+ const [value, next2] = number2(wasm, pos2);
16935
17061
  pos2 = next2;
16936
17062
  return value;
16937
17063
  };
@@ -16963,29 +17089,29 @@ function takeGuestStartupData(wasm, address, length) {
16963
17089
  }
16964
17090
  let pos = code[1];
16965
17091
  let body;
16966
- let [count, next] = number(wasm, pos);
17092
+ let [count, next] = number2(wasm, pos);
16967
17093
  pos = next;
16968
17094
  for (let index = 0; index < count; index++) {
16969
- const [size3, bodyStart] = number(wasm, pos);
17095
+ const [size3, bodyStart] = number2(wasm, pos);
16970
17096
  if (functionImports + index === startFunction) body = [bodyStart, bodyStart + size3];
16971
17097
  pos = bodyStart + size3;
16972
17098
  }
16973
17099
  if (!body) throw new Error("guest wasm start function has no body");
16974
17100
  const segments = [];
16975
17101
  pos = data[1];
16976
- [count, pos] = number(wasm, pos);
17102
+ [count, pos] = number2(wasm, pos);
16977
17103
  for (let index = 0; index < count; index++) {
16978
17104
  const header = pos;
16979
- const [flags, afterFlags] = number(wasm, pos);
17105
+ const [flags, afterFlags] = number2(wasm, pos);
16980
17106
  pos = afterFlags;
16981
17107
  let active;
16982
17108
  if (flags !== 1) {
16983
- if (flags === 2) pos = number(wasm, pos)[1];
17109
+ if (flags === 2) pos = number2(wasm, pos)[1];
16984
17110
  [active, pos] = signedAddress(wasm, pos + 1);
16985
17111
  pos++;
16986
17112
  }
16987
17113
  const sizeAt = pos;
16988
- const [size3, payload2] = number(wasm, pos);
17114
+ const [size3, payload2] = number2(wasm, pos);
16989
17115
  if (active !== void 0 && active < address + length && active + size3 > address)
16990
17116
  throw new Error("guest startup data range overlaps an active segment");
16991
17117
  segments.push({ header, sizeAt, payload: payload2, length: size3 });
@@ -18453,127 +18579,6 @@ var init_swift_wasm_archive = __esm({
18453
18579
  }
18454
18580
  });
18455
18581
 
18456
- // src/swiftRuntimeProductContract.ts
18457
- var v2, SWIFT_FRAMEWORK_PRODUCT_FILE, swiftFrameworkProductSchema, SWIFT_SDK_PRODUCT_FILE, swiftSdkProductSchema, swiftSdkProductsSchema;
18458
- var init_swiftRuntimeProductContract = __esm({
18459
- "src/swiftRuntimeProductContract.ts"() {
18460
- "use strict";
18461
- v2 = __toESM(require("peachsim/vendor/valibot"), 1);
18462
- init_swiftTargetContract();
18463
- SWIFT_FRAMEWORK_PRODUCT_FILE = "lib/framework-product.json";
18464
- swiftFrameworkProductSchema = v2.object({
18465
- version: v2.literal(1),
18466
- packageName: v2.string(),
18467
- manifestSha256: v2.pipe(v2.string(), v2.regex(/^[a-f0-9]{64}$/)),
18468
- product: v2.object({
18469
- name: v2.string(),
18470
- linkage: v2.picklist(["static", "dynamic", "automatic"]),
18471
- targets: v2.array(v2.string())
18472
- }),
18473
- // framework names are distinct from SDK library linkNames. they identify
18474
- // the packaged owner, not an observed native image dependency.
18475
- frameworkAliases: v2.array(
18476
- v2.object({
18477
- kind: v2.literal("framework"),
18478
- name: v2.string(),
18479
- targets: v2.array(v2.string()),
18480
- moduleMap: v2.string(),
18481
- moduleMapSha256: v2.pipe(v2.string(), v2.regex(/^[a-f0-9]{64}$/)),
18482
- wasmSdkId: v2.string(),
18483
- wasmSdkChecksum: v2.pipe(v2.string(), v2.regex(/^[a-f0-9]{64}$/))
18484
- })
18485
- ),
18486
- targets: v2.array(
18487
- v2.object({
18488
- name: v2.string(),
18489
- path: v2.string(),
18490
- kind: v2.picklist(["regular", "system"]),
18491
- dependencies: v2.array(v2.string())
18492
- })
18493
- ),
18494
- objects: v2.array(v2.object({ path: v2.string(), target: v2.string() })),
18495
- autolink: v2.array(v2.string())
18496
- });
18497
- SWIFT_SDK_PRODUCT_FILE = "runtime-products.json";
18498
- swiftSdkProductSchema = v2.pipe(
18499
- v2.object({
18500
- id: v2.string(),
18501
- installName: v2.string(),
18502
- target: v2.literal(SWIFT_WASM_TRIPLE),
18503
- linkNames: v2.array(v2.string()),
18504
- // absent records declare no framework namespace, even when a library name matches.
18505
- frameworkAliases: v2.optional(
18506
- v2.array(
18507
- v2.object({
18508
- name: v2.string(),
18509
- moduleMap: v2.string(),
18510
- moduleMapSha256: v2.pipe(v2.string(), v2.regex(/^[a-f0-9]{64}$/))
18511
- })
18512
- ),
18513
- []
18514
- ),
18515
- buildDependencies: v2.array(v2.string()),
18516
- linkOwnership: v2.picklist(["image", "containing-image"]),
18517
- linkDependencies: v2.nullable(v2.array(v2.string())),
18518
- autolink: v2.array(v2.string()),
18519
- sources: v2.array(
18520
- v2.object({
18521
- path: v2.string(),
18522
- sha256: v2.pipe(v2.string(), v2.regex(/^[a-f0-9]{64}$/))
18523
- })
18524
- ),
18525
- artifacts: v2.array(
18526
- v2.variant("kind", [
18527
- v2.object({
18528
- kind: v2.literal("archive"),
18529
- path: v2.string(),
18530
- sha256: v2.pipe(v2.string(), v2.regex(/^[a-f0-9]{64}$/)),
18531
- members: v2.array(
18532
- v2.object({
18533
- name: v2.string(),
18534
- ordinal: v2.pipe(v2.number(), v2.integer(), v2.minValue(1)),
18535
- sha256: v2.pipe(v2.string(), v2.regex(/^[a-f0-9]{64}$/)),
18536
- sources: v2.array(v2.string())
18537
- })
18538
- )
18539
- }),
18540
- v2.object({
18541
- kind: v2.literal("object"),
18542
- path: v2.string(),
18543
- sha256: v2.pipe(v2.string(), v2.regex(/^[a-f0-9]{64}$/)),
18544
- sources: v2.array(v2.string()),
18545
- input: v2.optional(
18546
- v2.object({
18547
- product: v2.string(),
18548
- artifact: v2.object({
18549
- path: v2.string(),
18550
- sha256: v2.pipe(v2.string(), v2.regex(/^[a-f0-9]{64}$/))
18551
- }),
18552
- member: v2.optional(
18553
- v2.object({
18554
- name: v2.string(),
18555
- ordinal: v2.pipe(v2.number(), v2.integer(), v2.minValue(1)),
18556
- sha256: v2.pipe(v2.string(), v2.regex(/^[a-f0-9]{64}$/))
18557
- })
18558
- )
18559
- })
18560
- )
18561
- })
18562
- ])
18563
- )
18564
- }),
18565
- v2.check(
18566
- (product) => product.linkOwnership === "image" || product.linkDependencies === null,
18567
- "containing-image products cannot declare an image scope"
18568
- )
18569
- );
18570
- swiftSdkProductsSchema = v2.object({
18571
- version: v2.literal(1),
18572
- products: v2.array(swiftSdkProductSchema)
18573
- });
18574
- }
18575
- });
18576
-
18577
18582
  // src/swift-wasm-prune.ts
18578
18583
  function sha256Hex(bytes) {
18579
18584
  if (typeof Bun !== "undefined")
@@ -23711,6 +23716,7 @@ function finalizeGuestProjectionStorage(options2) {
23711
23716
  const result = Buffer.from(options2.optimized);
23712
23717
  const locations = /* @__PURE__ */ new Map();
23713
23718
  const counts = /* @__PURE__ */ new Map();
23719
+ const countAddresses = [];
23714
23720
  const uuids = /* @__PURE__ */ new Map();
23715
23721
  const markers = new Map(
23716
23722
  options2.reserved.countMarkers.map((marker, index) => [marker, index])
@@ -23743,6 +23749,7 @@ function finalizeGuestProjectionStorage(options2) {
23743
23749
  if (counts.has(count))
23744
23750
  throw new Error("duplicate guest projection count marker");
23745
23751
  counts.set(count, offset);
23752
+ countAddresses[count] = segment3.address + offset - segment3.offset;
23746
23753
  }
23747
23754
  if (offset > end - 8 || result[offset + 3] !== 254 || result[offset + 7] !== 253)
23748
23755
  continue;
@@ -23780,7 +23787,16 @@ function finalizeGuestProjectionStorage(options2) {
23780
23787
  result.writeUInt32LE(region?.initialProtection ?? 0, offset + 8);
23781
23788
  result.writeUInt32LE(region?.maximumProtection ?? 0, offset + 12);
23782
23789
  }
23783
- return { wasm: result, images };
23790
+ return {
23791
+ wasm: result,
23792
+ images,
23793
+ countAddresses,
23794
+ appImages: options2.sdkSpans ? planGuestProjectionRegions(
23795
+ options2.reserved.images,
23796
+ options2.reserved.capacities,
23797
+ spans
23798
+ ) : images
23799
+ };
23784
23800
  }
23785
23801
  var UUID_MARKER_PREFIX, UUID_BYTES;
23786
23802
  var init_swift_guest_projection_storage = __esm({
@@ -23835,9 +23851,9 @@ function sdkArtifactBytes(root, artifact) {
23835
23851
  const linked = (0, import_node_fs32.readFileSync)(file);
23836
23852
  const hash = (bytes) => (0, import_node_crypto21.createHash)("sha256").update(bytes).digest("hex");
23837
23853
  if (hash(linked) === artifact.sha256) return { source: linked, linked };
23838
- if (artifact.kind !== "archive" || artifact.path !== `${SDK_CATALOG_DIRECTORY}/libFoundation.a`)
23854
+ if (artifact.kind !== "archive" || artifact.path !== `${SWIFT_SDK_PRODUCT_DIRECTORY}/libFoundation.a`)
23839
23855
  throw new Error(`SDK product artifact changed ${file}`);
23840
- const catalog = import_node_path31.default.join(root, SDK_CATALOG_DIRECTORY, SWIFT_SDK_PRODUCT_FILE);
23856
+ const catalog = import_node_path31.default.join(root, SWIFT_SDK_PRODUCT_DIRECTORY, SWIFT_SDK_PRODUCT_FILE);
23841
23857
  const sourceDirectory = import_node_path31.default.dirname((0, import_node_fs32.realpathSync)(catalog));
23842
23858
  const source = (0, import_node_fs32.readFileSync)(import_node_path31.default.join(sourceDirectory, "libFoundation.a"));
23843
23859
  if (hash(source) !== artifact.sha256)
@@ -23872,13 +23888,7 @@ function readGuestRuntimeCatalogs(sdkRoot, distributionRoot) {
23872
23888
  );
23873
23889
  const sdk2 = v5.parse(
23874
23890
  swiftSdkProductsSchema,
23875
- read(
23876
- import_node_path31.default.join(
23877
- sdkRoot,
23878
- "swift.xctoolchain/usr/lib/swift_static/wasi",
23879
- SWIFT_SDK_PRODUCT_FILE
23880
- )
23881
- )
23891
+ read(import_node_path31.default.join(sdkRoot, SWIFT_SDK_PRODUCT_DIRECTORY, SWIFT_SDK_PRODUCT_FILE))
23882
23892
  );
23883
23893
  const distribution = v5.parse(
23884
23894
  swiftSdkProductsSchema,
@@ -24352,7 +24362,7 @@ function guestAliasedSdkArchiveArtifacts(options2) {
24352
24362
  }
24353
24363
  return result;
24354
24364
  }
24355
- var import_node_crypto21, import_node_fs32, import_node_path31, v5, SDK_CATALOG_DIRECTORY, SDK_CONTAINING_IMAGE;
24365
+ var import_node_crypto21, import_node_fs32, import_node_path31, v5, SDK_CONTAINING_IMAGE;
24356
24366
  var init_swift_guest_runtime_plan = __esm({
24357
24367
  "src/swift-guest-runtime-plan.ts"() {
24358
24368
  "use strict";
@@ -24365,7 +24375,6 @@ var init_swift_guest_runtime_plan = __esm({
24365
24375
  init_swift_shared_sdk();
24366
24376
  init_swift_wasm_prune();
24367
24377
  init_swiftRuntimeProductContract();
24368
- SDK_CATALOG_DIRECTORY = "swift.xctoolchain/usr/lib/swift_static/wasi";
24369
24378
  SDK_CONTAINING_IMAGE = "wasi/containing-image";
24370
24379
  }
24371
24380
  });
@@ -33246,7 +33255,7 @@ async function linkSwiftAppModule(options2) {
33246
33255
  { maxBuffer: 64 << 20, ...options2.project }
33247
33256
  );
33248
33257
  const module2 = import_node_path45.default.join(work, "app.module.wasm");
33249
- const { bytes, linkage } = resolveSdkReferences(
33258
+ const { bytes, linkage, staticEnd, globalValues } = resolveSdkReferences(
33250
33259
  (0, import_node_fs46.readFileSync)(
33251
33260
  options2.project ? projectOutputFile(work, linked, options2.project) : linked
33252
33261
  ),
@@ -33279,6 +33288,8 @@ async function linkSwiftAppModule(options2) {
33279
33288
  ).update(bytes).digest("hex"));
33280
33289
  return {
33281
33290
  linkage,
33291
+ staticEnd,
33292
+ globalValues,
33282
33293
  async lower() {
33283
33294
  const receipt = loweringCache && `${loweringCache.file}.key`;
33284
33295
  if (loweringCache && receipt && (0, import_node_fs46.existsSync)(receipt) && (0, import_node_fs46.existsSync)(loweringCache.file) && (0, import_node_fs46.readFileSync)(receipt, "utf8") === loweringKey) {
@@ -33759,6 +33770,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
33759
33770
  const er = wasmReader(bytes, exportSection.start);
33760
33771
  const exportCount = er.u();
33761
33772
  const originalExportsStart = er.at;
33773
+ let staticEnd = 0;
33762
33774
  for (let i = 0; i < exportCount; i++) {
33763
33775
  const name3 = er.name();
33764
33776
  const kind = er.byte();
@@ -33771,8 +33783,10 @@ function resolveSdkReferences(source, sdk2, forwarders) {
33771
33783
  const op = raw2.byte();
33772
33784
  const value = op === 35 ? BigInt(raw2.u()) : raw2.s();
33773
33785
  raw2.skip(1);
33774
- if (j === index && value > BigInt(SWIFT_SDK_MEMORY_BASE))
33786
+ if (j !== index) continue;
33787
+ if (value <= 0n || value > BigInt(SWIFT_SDK_MEMORY_BASE))
33775
33788
  throw new Error("Swift app exceeds its reserved static memory range");
33789
+ staticEnd = Number(value);
33776
33790
  }
33777
33791
  }
33778
33792
  const exportParts = [
@@ -33809,7 +33823,12 @@ function resolveSdkReferences(source, sdk2, forwarders) {
33809
33823
  parts.push(bytes.subarray(s.offset, s.end));
33810
33824
  }
33811
33825
  }
33812
- return { bytes: Buffer.concat(parts), linkage };
33826
+ return {
33827
+ bytes: Buffer.concat(parts),
33828
+ linkage,
33829
+ staticEnd,
33830
+ globalValues: [...new Set(got.values())]
33831
+ };
33813
33832
  }
33814
33833
  function expandSdkRelocations(bytes, section2, patches) {
33815
33834
  patches.sort((a, b) => a.at - b.at);
@@ -33856,25 +33875,94 @@ function bindSwiftAppModule(linkage, sdk2) {
33856
33875
  throw new Error(`SDK image has no compatible function ${name3}`);
33857
33876
  return slot;
33858
33877
  });
33859
- const values = BigInt64Array.from(linkage.values, ({ kind, name: name3, addend }) => {
33878
+ const projection = linkage.replayProjection?.sdk === sdk2.key ? void 0 : linkage.replayProjection;
33879
+ const optional3 = projection && new Set(projection.lookupValues);
33880
+ const values = linkage.values.map(({ kind, name: name3, addend }, index) => {
33860
33881
  const value = kind === "function" ? functions[name3] : kind === "address" ? data[name3] : tls[name3];
33882
+ if (value === void 0 && optional3?.has(index)) return 0n;
33861
33883
  if (value === void 0 || kind === "tls" && tls.errno === void 0)
33862
33884
  throw new Error(`SDK image has no ${kind} symbol ${name3}`);
33863
33885
  return BigInt(value + addend - (kind === "tls" ? tls.errno : 0));
33864
33886
  });
33887
+ const fixups = projection ? appendReplayProjectionFixups(linkage.data, values, projection, sdk2) : linkage.data;
33865
33888
  const words2 = Uint32Array.from([
33866
33889
  values.length,
33867
33890
  slots.length,
33868
- linkage.data.length,
33891
+ fixups.length,
33869
33892
  linkage.tls.length
33870
33893
  ]);
33871
33894
  return Buffer.concat([
33872
- ...[words2, values, slots, Uint32Array.from(linkage.tls)].map(
33895
+ ...[words2, BigInt64Array.from(values), slots, Uint32Array.from(linkage.tls)].map(
33873
33896
  (part) => new Uint8Array(part.buffer)
33874
33897
  ),
33875
- encodeNativeSdkFixups(linkage.data)
33898
+ encodeNativeSdkFixups(fixups)
33876
33899
  ]);
33877
33900
  }
33901
+ function appendReplayProjectionFixups(data, values, projection, sdk2) {
33902
+ const { countAddresses, images, staticEnd } = projection;
33903
+ if (!Number.isSafeInteger(staticEnd) || staticEnd < SWIFT_SDK_APP_MEMORY_BASE || staticEnd >= SWIFT_SDK_MEMORY_BASE || countAddresses.length !== images.length || new Set(countAddresses).size !== images.length)
33904
+ throw new Error("invalid retained app projection storage");
33905
+ const objects = new Map(projection.objects);
33906
+ const products = new Map(projection.products);
33907
+ const sdkSpans = swiftSdkProjectionSpans(
33908
+ sdk2,
33909
+ (object8, product) => objects.get(object8) ?? products.get(product)
33910
+ );
33911
+ const regions = planGuestProjectionRegions(
33912
+ images,
33913
+ images.map(() => ({
33914
+ regions: Number.MAX_SAFE_INTEGER,
33915
+ memoryProtection: { initial: 3, maximum: 3 },
33916
+ tableProtection: { initial: 5, maximum: 5 }
33917
+ })),
33918
+ [
33919
+ ...images.flatMap(
33920
+ ({ regions: regions2 }, image) => regions2.map(({ space, address, length }) => ({ image, space, address, length }))
33921
+ ),
33922
+ ...sdkSpans
33923
+ ]
33924
+ );
33925
+ const fixups = [...data];
33926
+ const literals = /* @__PURE__ */ new Map();
33927
+ const add = (address, width, value) => {
33928
+ let index = literals.get(value);
33929
+ if (index === void 0) {
33930
+ index = values.length;
33931
+ literals.set(value, index);
33932
+ values.push(value);
33933
+ }
33934
+ fixups.push(address, width, index);
33935
+ };
33936
+ const name3 = Math.ceil(staticEnd / 8) * 8;
33937
+ let next = name3 + 8;
33938
+ if (next > SWIFT_SDK_MEMORY_BASE)
33939
+ throw new Error("rebound SDK projection exceeds the app static memory reservation");
33940
+ add(name3, 8, Buffer.from("__WASM\0\0").readBigInt64LE());
33941
+ for (const [image, { regions: ranges }] of regions.entries()) {
33942
+ const count = countAddresses[image];
33943
+ if (!Number.isSafeInteger(count) || count < SWIFT_SDK_APP_MEMORY_BASE || count + 16 > staticEnd || count % 8 !== 0)
33944
+ throw new Error("retained app projection record is out of range");
33945
+ add(count, 4, BigInt(ranges.length));
33946
+ add(count + 8, 8, BigInt(next));
33947
+ for (const range3 of ranges) {
33948
+ if (next + 40 > SWIFT_SDK_MEMORY_BASE)
33949
+ throw new Error(
33950
+ "rebound SDK projection exceeds the app static memory reservation"
33951
+ );
33952
+ add(next, 8, BigInt(name3));
33953
+ add(
33954
+ next + 8,
33955
+ 8,
33956
+ BigInt(range3.address) << 32n | BigInt(range3.space === "function-table")
33957
+ );
33958
+ add(next + 16, 8, BigInt(range3.initialProtection) << 32n | BigInt(range3.length));
33959
+ add(next + 24, 8, BigInt(range3.maximumProtection));
33960
+ add(next + 32, 8, 0n);
33961
+ next += 40;
33962
+ }
33963
+ }
33964
+ return fixups;
33965
+ }
33878
33966
  function writeSwiftSdkAppLink(file, link) {
33879
33967
  const bytes = (0, import_node_zlib5.gzipSync)(JSON.stringify(link), { level: 1 });
33880
33968
  (0, import_node_fs46.writeFileSync)(file, bytes);
@@ -34168,8 +34256,10 @@ function selectSwiftSdkData(sdk2, usage, linkage, projection) {
34168
34256
  const { functions, data } = sdk2.sdkInterface;
34169
34257
  for (const { name: name3 } of linkage.functions) boundSlots.add(functions[name3]);
34170
34258
  for (const { kind, name: name3 } of linkage.values) {
34171
- if (kind === "function") boundSlots.add(functions[name3]);
34172
- else if (kind === "address") visit3(data[name3]);
34259
+ const address2 = kind === "function" ? functions[name3] : data[name3];
34260
+ if (address2 === void 0) continue;
34261
+ if (kind === "function") boundSlots.add(address2);
34262
+ else if (kind === "address") visit3(address2);
34173
34263
  }
34174
34264
  }
34175
34265
  const slots = block2("functionSlots");
@@ -34480,6 +34570,7 @@ var init_swift_sdk_app_module = __esm({
34480
34570
  init_swift_distribution_mirror();
34481
34571
  init_swift_guest_dyld_functions();
34482
34572
  init_swift_guest_linked_spans();
34573
+ init_swift_guest_projection_storage();
34483
34574
  init_swift_project_user();
34484
34575
  init_swift_sdk_image();
34485
34576
  init_swift_sdk_image_map();
@@ -34953,7 +35044,6 @@ async function compileGuestLink(options2) {
34953
35044
  linkSwiftAppModule: linkSwiftAppModule2,
34954
35045
  readSwiftSdkUsage: readSwiftSdkUsage2,
34955
35046
  swiftAppModuleThunkSection: swiftAppModuleThunkSection2,
34956
- swiftSdkProjectionDigest: swiftSdkProjectionDigest2,
34957
35047
  swiftSdkProjectionSpans: swiftSdkProjectionSpans2,
34958
35048
  writeSwiftSdkAppLink: writeSwiftSdkAppLink2
34959
35049
  } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
@@ -35107,17 +35197,29 @@ async function compileGuestLink(options2) {
35107
35197
  if (project2) return binding;
35108
35198
  const replayDirectory = import_node_path46.default.join(options2.buildDirectory, ".peach-sdk-module");
35109
35199
  (0, import_node_fs47.mkdirSync)(replayDirectory, { recursive: true });
35200
+ const directValues = new Set(link.globalValues);
35201
+ for (const values2 of [data, linkage.tls])
35202
+ for (let index = 2; index < values2.length; index += 3)
35203
+ directValues.add(values2[index]);
35110
35204
  const appLink = writeSwiftSdkAppLink2(
35111
35205
  import_node_path46.default.join(replayDirectory, "app-link.json.gz"),
35112
35206
  {
35113
- linkage,
35207
+ linkage: {
35208
+ ...linkage,
35209
+ replayProjection: {
35210
+ sdk: sdk2.key,
35211
+ staticEnd: link.staticEnd,
35212
+ countAddresses: finalized.countAddresses,
35213
+ images: finalized.appImages,
35214
+ objects: [...sdkObjectImages],
35215
+ products: [...sdkProductImages],
35216
+ lookupValues: [...new Set(bindingRows.values())].filter(
35217
+ (index) => !directValues.has(index)
35218
+ )
35219
+ }
35220
+ },
35114
35221
  usage,
35115
- scopedLookups: true,
35116
- sdkProjection: {
35117
- objects: [...sdkObjectImages],
35118
- products: [...sdkProductImages],
35119
- layoutSha256: swiftSdkProjectionDigest2(sdkSpans)
35120
- }
35222
+ scopedLookups: true
35121
35223
  }
35122
35224
  );
35123
35225
  return { ...binding, appLink };
@@ -35158,19 +35260,32 @@ function compilerCheckpoint(root, recipe2, args, header) {
35158
35260
  };
35159
35261
  const outputMap = value("-output-file-map");
35160
35262
  const module2 = value("-emit-module-path");
35161
- if (!outputMap || !module2 || !args.includes("-whole-module-optimization")) return;
35263
+ const wholeModule = args.lastIndexOf("-whole-module-optimization") > args.lastIndexOf("-no-whole-module-optimization");
35264
+ const batch = args.includes("-enable-batch-mode") && !args.includes("-incremental");
35265
+ if (!outputMap || !module2 || !wholeModule && !batch) return;
35162
35266
  const mapText = (0, import_node_fs48.readFileSync)(outputMap, "utf8");
35163
35267
  const map2 = JSON.parse(mapText);
35164
- if (!isRecord(map2) || !isRecord(map2[""]) || typeof map2[""].dependencies !== "string")
35165
- return;
35166
- const objects = [];
35167
- for (const [source, outputs2] of Object.entries(map2)) {
35268
+ if (!isRecord(map2)) return;
35269
+ const outputs = [module2, header];
35270
+ if (wholeModule) {
35271
+ if (!isRecord(map2[""]) || typeof map2[""].dependencies !== "string") return;
35272
+ outputs.push(map2[""].dependencies);
35273
+ }
35274
+ let objects = 0;
35275
+ for (const [source, fileOutputs] of Object.entries(map2)) {
35168
35276
  if (!source) continue;
35169
- if (!isRecord(outputs2) || typeof outputs2.object !== "string") return;
35170
- objects.push(outputs2.object);
35171
- }
35172
- if (!objects.length) return;
35173
- const outputs = [module2, header, map2[""].dependencies, ...objects];
35277
+ if (!isRecord(fileOutputs) || typeof fileOutputs.object !== "string") return;
35278
+ objects++;
35279
+ const object8 = fileOutputs.object;
35280
+ outputs.push(object8);
35281
+ if (!wholeModule) {
35282
+ const dependencies = fileOutputs.dependencies;
35283
+ if (typeof dependencies === "string") outputs.push(dependencies);
35284
+ else if (object8.endsWith(".o")) outputs.push(`${object8.slice(0, -2)}.d`);
35285
+ else return;
35286
+ }
35287
+ }
35288
+ if (objects === 0) return;
35174
35289
  const digest3 = (0, import_node_crypto32.createHash)("sha256").update(recipe2).update(JSON.stringify(args)).update(mapText);
35175
35290
  for (const flag of args) {
35176
35291
  if (!flag.startsWith("@")) continue;
@@ -41716,7 +41831,9 @@ ${compatShape}` : "";
41716
41831
  }
41717
41832
  const jobs = swiftCompilerJobs();
41718
41833
  const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
41719
- const perFile = input.unoptimized || incrementalPreview;
41834
+ const batchGuest = guestGraph !== void 0 && !options2.project && !input.unoptimized;
41835
+ const batch = incrementalPreview || batchGuest;
41836
+ const perFile = input.unoptimized || batch;
41720
41837
  const reproducibleFrameworkRoot = mirrorDistribution ? frameworkRoot : compileFrameworkRoot;
41721
41838
  const buildArgs = [
41722
41839
  "build",
@@ -41741,9 +41858,11 @@ ${compatShape}` : "";
41741
41858
  "-Xswiftc",
41742
41859
  "-j",
41743
41860
  "-Xswiftc",
41744
- String(jobs)
41861
+ String(batchGuest ? Math.min(8, jobs) : jobs)
41745
41862
  ] : [],
41746
- ...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
41863
+ // optimized batches can move specialized definitions between objects.
41864
+ ...incrementalPreview ? ["-Xswiftc", "-incremental"] : [],
41865
+ ...batch ? ["-Xswiftc", "-enable-batch-mode"] : [],
41747
41866
  // the mirror finds a changed sdk header's readers in their
41748
41867
  // dependency files, which omit system headers by default
41749
41868
  ...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
@@ -41757,7 +41876,7 @@ ${compatShape}` : "";
41757
41876
  "-g0",
41758
41877
  "-Xcxx",
41759
41878
  "-g0",
41760
- ...incrementalPreview ? [] : [
41879
+ ...batch ? [] : [
41761
41880
  "-Xswiftc",
41762
41881
  "-num-threads",
41763
41882
  "-Xswiftc",
@@ -42401,7 +42520,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
42401
42520
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
42402
42521
  MULTI_MANIFEST_VERSION = 76;
42403
42522
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
42404
- compilerSourceDigest = true ? "a6326513da78eebd8cea52e4d27f4b4891f880aa2d7de55db6773c2aed5900be" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
42523
+ compilerSourceDigest = true ? "1803ba36803a88ceeca92ee7b13baa39dde72fbb72df14659f0414084afaf5d7" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
42405
42524
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
42406
42525
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
42407
42526
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -88511,7 +88630,7 @@ var init_swift_standin_digest = __esm({
88511
88630
  ];
88512
88631
  RUNTIME_IMPORT = /(?:^|[;\n])[ \t]*(?:import|export)\s+(?!type(?:\s|\{))([\s\S]*?)\s+from\s*['"]([^'"]+)['"]|(?:^|[;\n])[ \t]*import\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
88513
88632
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS, STANDIN_DIGEST_EXCLUDED_FILES);
88514
- STANDIN_SOURCE_DIGEST = true ? "46bd6373b813f44d3e812af83162f521ce032cba6bade9039bbb107120481dc5" : standinSourceDigest();
88633
+ STANDIN_SOURCE_DIGEST = true ? "c2d1c024e059538977fdd0666278d52ec2116aafae79fe0e8b1cda82a5981f3b" : standinSourceDigest();
88515
88634
  }
88516
88635
  });
88517
88636
 
@@ -107351,7 +107470,7 @@ var init_nitro_superset = __esm({
107351
107470
  init_nitroContract();
107352
107471
  init_swift_standin_digest();
107353
107472
  NITRO_SUPERSET_ENTRY_NAME = "superset";
107354
- NITRO_COMPILER_DIGEST = true ? "e999d0832c1898ff3a78c55053c6d301b602f5ee78e24312deedc93b4b4451d0" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
107473
+ NITRO_COMPILER_DIGEST = true ? "474b8b30de1650e72f19b75c50a0db7090ddaffdf79752b283fb389946014fa7" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
107355
107474
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
107356
107475
  nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
107357
107476
  published = /* @__PURE__ */ new Map();
@@ -108055,7 +108174,7 @@ var init_expo_eager_seam_contract = __esm({
108055
108174
 
108056
108175
  // src/expo-native-compiler-digest.ts
108057
108176
  function expoNativeCompilerDigestValue() {
108058
- return true ? "3aa55ede1762cf973bf737061cac6fe8e51ef2f66b9df8370329a6746d2d044a" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
108177
+ return true ? "c9950c3dbdb6ca5891145f8c4133c9b62e89b35f62d9343e8d7ef410cda838f5" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
108059
108178
  }
108060
108179
  var import_node_crypto81;
108061
108180
  var init_expo_native_compiler_digest = __esm({