peachsim 0.1.2661 → 0.1.2663

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 (131) 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 +381 -34
  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 +2 -2
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/esm-chunks/{acorn-USJ3U6EV.mjs → acorn-GXZHC6Z5.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-VO3IKPJQ.mjs → chunk-3PLIZHXJ.mjs} +4 -4
  28. package/dist-lib/esm-chunks/{chunk-22OE2SDL.mjs → chunk-45GQD2X5.mjs} +1 -1
  29. package/dist-lib/esm-chunks/{chunk-N6VYW7ST.mjs → chunk-4V256AAR.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-ZEV5QATR.mjs → chunk-5OJPOD6B.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-YG742NZE.mjs → chunk-5Z5Q5DCY.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-FH6AZQ3X.mjs → chunk-6X2G46JR.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-QLD2VNSE.mjs → chunk-CVAO4T6T.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-YR4VALGH.mjs → chunk-DPLKN4VG.mjs} +3 -3
  35. package/dist-lib/esm-chunks/{chunk-5ESYNY5Q.mjs → chunk-DUPDKR46.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-C6SGD3HB.mjs → chunk-EC5A4V5T.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-MOX3PEKS.mjs → chunk-EDANXB55.mjs} +6 -6
  38. package/dist-lib/esm-chunks/{chunk-JZNXRB2R.mjs → chunk-ILEIXGKP.mjs} +25 -2
  39. package/dist-lib/esm-chunks/{chunk-HIPO6H4T.mjs → chunk-K4YR2DYZ.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-THDPLOES.mjs → chunk-PZLZRTLG.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-I3V626NF.mjs → chunk-QZPLOMNW.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-WGKY5MW3.mjs → chunk-R53R5E3O.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-MKZYIFGO.mjs → chunk-RK2B4K2F.mjs} +5 -5
  44. package/dist-lib/esm-chunks/{chunk-AJGC4BJS.mjs → chunk-S4DRFJWS.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-445HQCQW.mjs → chunk-VGO6ZEQ4.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-B27TGLJK.mjs → chunk-VMEBFOJV.mjs} +19 -16
  47. package/dist-lib/esm-chunks/{chunk-Z6ZFDHEF.mjs → chunk-W32VR7O3.mjs} +20 -15
  48. package/dist-lib/esm-chunks/{chunk-RCQC45HG.mjs → chunk-WKSBQPZO.mjs} +19 -1
  49. package/dist-lib/esm-chunks/{chunk-OVGSRJ47.mjs → chunk-WPZBGLGG.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-GBUGHBPX.mjs → chunk-WQ2WN5E2.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{metro-layout-parser-TCSPS6GW.mjs → metro-layout-parser-N2EK3E3B.mjs} +3 -3
  52. package/dist-lib/esm-chunks/{swift-package-prebuilt-5YV2GUJW.mjs → swift-package-prebuilt-RG7C6DZN.mjs} +12 -12
  53. package/dist-lib/esm-chunks/{swift-sdk-app-module-BZ5NCBGU.mjs → swift-sdk-app-module-42W4DLYA.mjs} +16 -16
  54. package/dist-lib/esm-chunks/{swift-sdk-image-BRZLNRJ6.mjs → swift-sdk-image-JWECDNB5.mjs} +16 -16
  55. package/dist-lib/esm-chunks/{swift-sdk-image-producer-HFFFGL6R.mjs → swift-sdk-image-producer-JYBC3FRT.mjs} +5 -5
  56. package/dist-lib/expo-swift-bundle.cjs +377 -30
  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 +388 -39
  61. package/dist-lib/host/fetch-proxy-handler.cjs +43 -15
  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 +20 -2
  75. package/dist-lib/native-app-identity-project.mjs +16 -16
  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 +69 -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 +388 -39
  95. package/dist-lib/swift-compile.cjs +57 -12
  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 +19 -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/java-platform/licenses/openjdk.txt +9 -2
  123. package/kotlin/sdk.tar.gz +0 -0
  124. package/package.json +1 -1
  125. package/runtime-companion.json +1 -1
  126. package/src/swift-compile.ts +5 -1
  127. package/src/swift-root-lock.ts +26 -0
  128. package/src/swift-sdk-image.ts +13 -8
  129. package/src/swift-toolchain.ts +18 -0
  130. package/src/turbo-fabric-app.ts +281 -0
  131. package/src/turbo-source.ts +30 -5
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2661 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2663 | (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;
@@ -9555,6 +9555,24 @@ var init_swift_toolchain = __esm({
9555
9555
  import_node_zlib2 = __toESM(require("node:zlib"), 1);
9556
9556
  init_swiftTargetContract();
9557
9557
  compilerArchives = {
9558
+ "swift-6.4.0-RELEASE-custom-747babe6f837e240": {
9559
+ identity: "747babe6f837e240",
9560
+ archive: "tar.zst",
9561
+ hosts: {
9562
+ "darwin-arm64": {
9563
+ checksum: "2bc61029a5e9f29e4d8d0ed85936edd72b249821f48e2fbbf602d1424f30aa69",
9564
+ manifest: "4bdb605f2db31b12e507bbc0998e4054226aae1926ff1361d2e1bd6a8f87d14a"
9565
+ },
9566
+ "linux-x64": {
9567
+ checksum: "99b8ee28b2afe719ae02b88b4258a05584b7a1e29bb8d429c925819de0c10144",
9568
+ manifest: "b3e5970647fb2020917fceb4b632d733bb0247523739a6eaebe11d1a96d7e3e4"
9569
+ },
9570
+ "linux-arm64": {
9571
+ checksum: "34ace308eac458cd9c808e3bb8b1689ae02f0dff3f7b9d71ab7cf779e5a0cb78",
9572
+ manifest: "87b337c62eb9c546662c21cb31082995aadb3f1088ca3624a4843ab8137452b3"
9573
+ }
9574
+ }
9575
+ },
9558
9576
  "swift-6.4.0-RELEASE-custom-77d2c2623ec68c0c": {
9559
9577
  identity: "77d2c2623ec68c0c",
9560
9578
  archive: "tar.zst",
@@ -17923,7 +17941,7 @@ var init_react_native_core_digest = __esm({
17923
17941
 
17924
17942
  // src/swift-compiler-digest.ts
17925
17943
  function swiftArchiveCompilerDigestValue() {
17926
- return true ? "b5b82d054534fd9072ae1dedb5989e8e0af22b0a946ffd29ac06dd643af5fa0e" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname, "archive");
17944
+ return true ? "1d6a57a8166d9d9b3e8a4b6c03c70b1f73f858a100be595aef34f901cf8433d9" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname, "archive");
17927
17945
  }
17928
17946
  var import_node_crypto15, import_node_fs31, import_node_path30, SWIFT_DIGEST_SOURCES, LINKED_IMAGE_SOURCES, SWIFT_ARCHIVE_DIGEST_SOURCES;
17929
17947
  var init_swift_compiler_digest = __esm({
@@ -18068,13 +18086,13 @@ var init_swift_standin_digest = __esm({
18068
18086
  ];
18069
18087
  RUNTIME_IMPORT = /(?:^|[;\n])[ \t]*(?:import|export)\s+(?!type(?:\s|\{))([\s\S]*?)\s+from\s*['"]([^'"]+)['"]|(?:^|[;\n])[ \t]*import\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
18070
18088
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS, STANDIN_DIGEST_EXCLUDED_FILES);
18071
- STANDIN_SOURCE_DIGEST = true ? "1014761dfbb57f4d2590408d43a606daae2e964013bca7b63d953e956a607828" : standinSourceDigest();
18089
+ STANDIN_SOURCE_DIGEST = true ? "052de0fbd3c71d7f303b5bc9cc36a998a980e3c58320282620a45495172d86ad" : standinSourceDigest();
18072
18090
  }
18073
18091
  });
18074
18092
 
18075
18093
  // src/expo-native-compiler-digest.ts
18076
18094
  function expoNativeCompilerDigestValue() {
18077
- return true ? "cc36f727162421252689361a34c836ac4dcb9f583f2bf824531473f4e2dd3345" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
18095
+ return true ? "7c21202b510e2d8e478f15f4d1d2696e06cb8b02a9bbfa34bf6a353ab6bf8cad" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
18078
18096
  }
18079
18097
  var import_node_crypto17;
18080
18098
  var init_expo_native_compiler_digest = __esm({
@@ -37880,6 +37898,25 @@ function rootLockKey(root) {
37880
37898
  function swiftRootLocksDir() {
37881
37899
  return import_node_path56.default.join((0, import_node_os13.homedir)(), ".peach", "cache", "swift-root-locks");
37882
37900
  }
37901
+ function withSwiftRootReadHolds(work) {
37902
+ const holds = [];
37903
+ const release = () => {
37904
+ for (const hold of holds.splice(0)) hold.release();
37905
+ };
37906
+ return swiftRootReadHolds.run(holds, async () => {
37907
+ try {
37908
+ return await work(release);
37909
+ } finally {
37910
+ release();
37911
+ }
37912
+ });
37913
+ }
37914
+ function retainSwiftRootReadHold(hold) {
37915
+ const holds = swiftRootReadHolds.getStore();
37916
+ if (!holds) return false;
37917
+ holds.push(hold);
37918
+ return true;
37919
+ }
37883
37920
  function lockDirectoryFor(root) {
37884
37921
  const directory2 = import_node_path56.default.join(
37885
37922
  swiftRootLocksDir(),
@@ -38053,10 +38090,11 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
38053
38090
  (0, import_node_fs58.writeFileSync)(import_node_path56.default.join(directory2, name2(held, "released")), "");
38054
38091
  }
38055
38092
  }
38056
- var import_node_child_process32, import_node_crypto36, import_node_fs58, import_node_os13, import_node_path56, POLL_MS, INSPECT_ATTEMPTS, START_TOLERANCE_MS, name2;
38093
+ var import_node_async_hooks2, import_node_child_process32, import_node_crypto36, import_node_fs58, import_node_os13, import_node_path56, POLL_MS, INSPECT_ATTEMPTS, START_TOLERANCE_MS, name2, swiftRootReadHolds;
38057
38094
  var init_swift_root_lock = __esm({
38058
38095
  "src/swift-root-lock.ts"() {
38059
38096
  "use strict";
38097
+ import_node_async_hooks2 = require("node:async_hooks");
38060
38098
  import_node_child_process32 = require("node:child_process");
38061
38099
  import_node_crypto36 = require("node:crypto");
38062
38100
  import_node_fs58 = require("node:fs");
@@ -38068,6 +38106,7 @@ var init_swift_root_lock = __esm({
38068
38106
  INSPECT_ATTEMPTS = 5;
38069
38107
  START_TOLERANCE_MS = 2e3;
38070
38108
  name2 = (number3, suffix) => `${String(number3).padStart(12, "0")}.${suffix}`;
38109
+ swiftRootReadHolds = new import_node_async_hooks2.AsyncLocalStorage();
38071
38110
  }
38072
38111
  });
38073
38112
 
@@ -38518,20 +38557,23 @@ async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkIm
38518
38557
  }
38519
38558
  const work = `${directory2}.work`;
38520
38559
  try {
38521
- return await linkSwiftSdkImage(
38522
- moduleRoot,
38523
- key2,
38524
- directory2,
38525
- work,
38526
- scopedLookups,
38527
- imports2
38560
+ return await withSwiftRootReadHolds(
38561
+ (releaseFrameworks) => linkSwiftSdkImage(
38562
+ moduleRoot,
38563
+ key2,
38564
+ directory2,
38565
+ work,
38566
+ scopedLookups,
38567
+ imports2,
38568
+ releaseFrameworks
38569
+ )
38528
38570
  );
38529
38571
  } finally {
38530
38572
  (0, import_node_fs60.rmSync)(work, { recursive: true, force: true });
38531
38573
  }
38532
38574
  });
38533
38575
  }
38534
- async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLookups, imports2) {
38576
+ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLookups, imports2, releaseFrameworks) {
38535
38577
  (0, import_node_fs60.rmSync)(work, { recursive: true, force: true });
38536
38578
  (0, import_node_fs60.mkdirSync)(work, { recursive: true });
38537
38579
  const toolchain = swiftModuleToolchain(moduleRoot);
@@ -38732,6 +38774,7 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
38732
38774
  linkTo("linked", ["-Map", map2, "-o", linked]),
38733
38775
  linkTo("relocs", ["--emit-relocs", "-o", withRelocs])
38734
38776
  ]);
38777
+ releaseFrameworks();
38735
38778
  for (const result of links) {
38736
38779
  if (result.status === "rejected") throw result.reason;
38737
38780
  }
@@ -47536,7 +47579,7 @@ ${compatShape}` : "";
47536
47579
  sdk: sdk2,
47537
47580
  icu,
47538
47581
  prebuilt,
47539
- readHold
47582
+ readHold: frameworkReadHold
47540
47583
  } = await withFrameworkLock(async (slot, frameworkLease) => {
47541
47584
  budget.startCompile();
47542
47585
  if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
@@ -47587,6 +47630,7 @@ ${compatShape}` : "";
47587
47630
  readHold: readHold2
47588
47631
  };
47589
47632
  });
47633
+ let readHold = frameworkReadHold;
47590
47634
  const buildOptions = {
47591
47635
  env: baseBuildEnv,
47592
47636
  maxBuffer: 64 * 1024 * 1024,
@@ -48065,6 +48109,7 @@ ${compatShape}` : "";
48065
48109
  if ((0, import_node_fs70.statSync)(linked).size <= 8)
48066
48110
  throw new Error("swift-compile: deferred linker produced no executable");
48067
48111
  stage("project link verified");
48112
+ if (readHold && retainSwiftRootReadHold(readHold)) readHold = void 0;
48068
48113
  return;
48069
48114
  }
48070
48115
  const output = options2.project ? projectOutputFile(root2, linked, options2.project) : linked;
@@ -48385,7 +48430,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
48385
48430
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
48386
48431
  MULTI_MANIFEST_VERSION = 76;
48387
48432
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
48388
- compilerSourceDigest = true ? "62770f816d4a4c67eb9ee046aad3b137346685dd181ef4f141164a66f2454f62" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
48433
+ compilerSourceDigest = true ? "a8a1fcc341892ac0e1a3c924e733388ee30478222b3e1839692997c6dd5555a8" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
48389
48434
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
48390
48435
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
48391
48436
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -68200,7 +68245,7 @@ var init_provenance = __esm({
68200
68245
  import_node_crypto51 = require("node:crypto");
68201
68246
  import_node_fs84 = require("node:fs");
68202
68247
  import_node_path85 = require("node:path");
68203
- 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":"523fdfffc0cff95c8df7beeca437622a07d4fd666f0bb22b0ff67d14c42a7b10","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":"e30510099ee19d34de62d8ae859df53f77594a4ab105fdb5bcd7e005ec9689ca","xcode-target-members.ts":"96f6a9f5567a4fbd9806252229b35b9a451a112b20f70f8c20189ffd428815fd","xcode-json-project.ts":"df6d6db28e0c8cfdf1f480e1e32d35f12c9cf1936642d5dda923889fb18a8fd6","openstep-plist.ts":"da11f86885ef1e25979ad989f332195c113c4b7a43f108e8d36646973430b81b"}') : swiftCoverageSourceDigests((0, import_node_path85.join)(__sootsim_import_meta_dirname, ".."));
68248
+ 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":"523fdfffc0cff95c8df7beeca437622a07d4fd666f0bb22b0ff67d14c42a7b10","swift-package.ts":"05c6cf101fbc944f6684a70db0a9c5aede846b2f0482a6b4a5a0abed737d4658","swift-source-file.ts":"8becce5e73b76a61d9d202c1ecfb39b1238e9bbf0e77841f1c51c98fa9ac7bd3","swift-toolchain.ts":"692791414734a0fe5949c1d2638941d5de882b8737675deae2e3a49512f2a126","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"c72b724fc497e4cf603c355f86eb3c07c929ad299758cffbc6ff88ed241654c6","xcode-project.ts":"e30510099ee19d34de62d8ae859df53f77594a4ab105fdb5bcd7e005ec9689ca","xcode-target-members.ts":"96f6a9f5567a4fbd9806252229b35b9a451a112b20f70f8c20189ffd428815fd","xcode-json-project.ts":"df6d6db28e0c8cfdf1f480e1e32d35f12c9cf1936642d5dda923889fb18a8fd6","openstep-plist.ts":"da11f86885ef1e25979ad989f332195c113c4b7a43f108e8d36646973430b81b"}') : swiftCoverageSourceDigests((0, import_node_path85.join)(__sootsim_import_meta_dirname, ".."));
68204
68249
  }
68205
68250
  });
68206
68251
 
@@ -93289,11 +93334,11 @@ function swiftArtifactIsAvailable(origin, url, hash) {
93289
93334
  (project) => project.artifacts.some((artifact) => artifact.hash === hash)
93290
93335
  );
93291
93336
  }
93292
- var import_node_async_hooks2, import_node_child_process61, import_node_crypto72, import_node_fs117, import_node_os25, import_node_path119, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_ROOT_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, SwiftMissingModulesError, swiftArtifactDigests, sharedProjects, projectScope, projects, sharedSourceEntries, sourceEntries, sharedXcodeProjects, xcodeProjects, preparedScriptInputs, emptyWasmAssembly, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, layoutScope, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, IOS_SDK_FRAMEWORKS;
93337
+ var import_node_async_hooks3, import_node_child_process61, import_node_crypto72, import_node_fs117, import_node_os25, import_node_path119, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_ROOT_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, SwiftMissingModulesError, swiftArtifactDigests, sharedProjects, projectScope, projects, sharedSourceEntries, sourceEntries, sharedXcodeProjects, xcodeProjects, preparedScriptInputs, emptyWasmAssembly, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, layoutScope, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS, IOS_SDK_FRAMEWORKS;
93293
93338
  var init_swift_host = __esm({
93294
93339
  "src/swift-host.ts"() {
93295
93340
  "use strict";
93296
- import_node_async_hooks2 = require("node:async_hooks");
93341
+ import_node_async_hooks3 = require("node:async_hooks");
93297
93342
  import_node_child_process61 = require("node:child_process");
93298
93343
  import_node_crypto72 = require("node:crypto");
93299
93344
  import_node_fs117 = __toESM(require("node:fs"), 1);
@@ -93349,7 +93394,7 @@ var init_swift_host = __esm({
93349
93394
  };
93350
93395
  swiftArtifactDigests = /* @__PURE__ */ new WeakMap();
93351
93396
  sharedProjects = /* @__PURE__ */ new Map();
93352
- projectScope = new import_node_async_hooks2.AsyncLocalStorage();
93397
+ projectScope = new import_node_async_hooks3.AsyncLocalStorage();
93353
93398
  projects = () => projectScope.getStore()?.projects ?? sharedProjects;
93354
93399
  sharedSourceEntries = /* @__PURE__ */ new Map();
93355
93400
  sourceEntries = () => projectScope.getStore()?.sourceEntries ?? sharedSourceEntries;
@@ -93360,7 +93405,7 @@ var init_swift_host = __esm({
93360
93405
  XCODE_APP_DIR = "__app__";
93361
93406
  XCODE_FRAMEWORKS_DIR = "__frameworks__";
93362
93407
  XCODE_PACKAGES_DIR = SWIFT_REMOTE_PACKAGES_DIR;
93363
- layoutScope = new import_node_async_hooks2.AsyncLocalStorage();
93408
+ layoutScope = new import_node_async_hooks3.AsyncLocalStorage();
93364
93409
  HOSTED_LIMITS = {
93365
93410
  sourceBytes: MAX_SWIFT_COMPILE_SOURCE_BYTES,
93366
93411
  resources: MAX_SWIFT_COMPILE_RESOURCES,
@@ -93653,6 +93698,291 @@ var init_turbo_codegen_intake = __esm({
93653
93698
  }
93654
93699
  });
93655
93700
 
93701
+ // src/turbo-fabric-app.ts
93702
+ var FABRIC_APP_INCLUDES, FABRIC_APP_PRESENTER, FABRIC_APP_INSTALL, FABRIC_APP_METHODS, FABRIC_APP_TEARDOWN;
93703
+ var init_turbo_fabric_app = __esm({
93704
+ "src/turbo-fabric-app.ts"() {
93705
+ "use strict";
93706
+ FABRIC_APP_INCLUDES = `#import <Block.h>
93707
+ #import <React/RCTScheduler.h>
93708
+ #import <React/RCTSurfacePresenter.h>
93709
+ #include <jsi/JSIDynamic.h>
93710
+ #include <react/renderer/components/view/BaseViewProps.h>
93711
+ #include <react/renderer/components/view/ViewEventEmitter.h>
93712
+ #include <react/renderer/core/InstanceHandle.h>
93713
+ #include <react/renderer/core/LayoutableShadowNode.h>
93714
+ #include <react/renderer/mounting/ShadowTree.h>
93715
+ #include <react/renderer/uimanager/UIManager.h>
93716
+ `;
93717
+ FABRIC_APP_PRESENTER = `
93718
+ namespace {
93719
+ extern std::shared_ptr<react::CallInvoker> fabricInvoker;
93720
+ extern std::shared_ptr<react::RuntimeScheduler> fabricScheduler;
93721
+ }
93722
+
93723
+ @interface PeachAppSurfacePresenter : RCTSurfacePresenter
93724
+ @property(nonatomic) std::function<void(const react::MountingTransaction &)> publishMount;
93725
+ @property(nonatomic) std::function<void(react::Tag, folly::dynamic)> publishProps;
93726
+ @property(nonatomic) std::function<void(react::Tag, const std::string &, const folly::dynamic &)> dispatchCommand;
93727
+ @end
93728
+
93729
+ @implementation PeachAppSurfacePresenter
93730
+ - (void)schedulerDidFinishTransaction:(std::shared_ptr<const react::MountingCoordinator>)coordinator {
93731
+ // guest commits can finish outside a React Native scheduler task.
93732
+ fabricInvoker->invokeAsync([](jsi::Runtime &) {
93733
+ fabricScheduler->scheduleWork([](jsi::Runtime &) {});
93734
+ });
93735
+ }
93736
+
93737
+ - (void)schedulerShouldRenderTransactions:(std::shared_ptr<const react::MountingCoordinator>)coordinator {
93738
+ if (auto transaction = coordinator->pullTransaction()) {
93739
+ self.publishMount(*transaction);
93740
+ }
93741
+ }
93742
+
93743
+ - (void)schedulerDidSynchronouslyUpdateViewOnUIThread:(ReactTag)tag props:(folly::dynamic)props {
93744
+ self.publishProps(static_cast<react::Tag>(tag), std::move(props));
93745
+ }
93746
+
93747
+ - (void)schedulerDidDispatchCommand:(const react::ShadowView &)shadowView
93748
+ commandName:(const std::string &)name
93749
+ args:(const folly::dynamic &)args {
93750
+ self.dispatchCommand(shadowView.tag, name, args);
93751
+ }
93752
+ @end
93753
+
93754
+ namespace {
93755
+ using AppNode = std::shared_ptr<const react::ShadowNode>;
93756
+ using AppChildren = std::vector<AppNode>;
93757
+
93758
+ class PeachAppShadowTree {
93759
+ public:
93760
+ PeachAppShadowTree(std::shared_ptr<react::UIManager> manager, const react::ContextContainer &context)
93761
+ : manager_(std::move(manager)), context_(context) {}
93762
+
93763
+ ~PeachAppShadowTree() {
93764
+ if (surface_ != 0) manager_->getShadowTreeRegistry().remove(surface_);
93765
+ }
93766
+
93767
+ void commit(jsi::Runtime &rt, react::SurfaceId surface, double width, double height, double scale,
93768
+ bool rtl, const jsi::Array &roots) {
93769
+ react::LayoutConstraints constraints;
93770
+ constraints.maximumSize = {static_cast<react::Float>(width), static_cast<react::Float>(height)};
93771
+ constraints.minimumSize = constraints.maximumSize;
93772
+ constraints.layoutDirection = rtl ? react::LayoutDirection::RightToLeft : react::LayoutDirection::LeftToRight;
93773
+ react::LayoutContext layout;
93774
+ layout.pointScaleFactor = static_cast<react::Float>(scale);
93775
+ layout.viewportSize = constraints.maximumSize;
93776
+ if (surface_ != 0 && surface_ != surface)
93777
+ throw jsi::JSError(rt, "Fabric runtime is already bound to another app surface");
93778
+ if (surface_ == 0) {
93779
+ surface_ = surface;
93780
+ manager_->startEmptySurface(std::make_unique<react::ShadowTree>(surface_, constraints, layout, *manager_, context_));
93781
+ } else if (constraints != constraints_ || layout != layout_) {
93782
+ manager_->getShadowTreeRegistry().visit(surface_, [&](const react::ShadowTree &tree) {
93783
+ tree.commit([&](const react::RootShadowNode &root) {
93784
+ return root.clone({surface_, context_}, constraints, layout);
93785
+ }, {});
93786
+ });
93787
+ }
93788
+ constraints_ = constraints;
93789
+ layout_ = layout;
93790
+
93791
+ std::unordered_map<react::Tag, AppNode> next;
93792
+ auto children = readChildren(rt, roots, next);
93793
+ nodes_.swap(next);
93794
+ manager_->completeSurface(surface_, children,
93795
+ {.enableStateReconciliation = true, .mountSynchronously = false, .source = react::ShadowTree::CommitSource::React});
93796
+ }
93797
+
93798
+ jsi::Value handle(jsi::Runtime &rt, react::Tag tag, const jsi::Value &surface, const jsi::Value &generation) const {
93799
+ auto value = react::valueFromShadowNode(rt, node(rt, tag));
93800
+ auto object = value.getObject(rt);
93801
+ object.setProperty(rt, "__nativeTag", tag);
93802
+ object.setProperty(rt, "__viewTag", tag);
93803
+ object.setProperty(rt, "__surfaceId", surface);
93804
+ object.setProperty(rt, "__surfaceGeneration", generation);
93805
+ return object;
93806
+ }
93807
+
93808
+ void dispatch(jsi::Runtime &rt, react::Tag tag, std::string type, const jsi::Value &payload) const {
93809
+ const auto emitter = std::dynamic_pointer_cast<const react::ViewEventEmitter>(node(rt, tag)->getEventEmitter());
93810
+ if (emitter) emitter->dispatchEvent(std::move(type), jsi::dynamicFromValue(rt, payload));
93811
+ }
93812
+
93813
+ void publish(jsi::Runtime &rt, const react::ShadowViewMutation &mutation, const jsi::Function &apply) const {
93814
+ using Mutation = react::ShadowViewMutation;
93815
+ if (mutation.type != Mutation::Insert && mutation.type != Mutation::Update) return;
93816
+ const auto &view = mutation.newChildShadowView;
93817
+ const auto found = nodes_.find(view.tag);
93818
+ if (found == nodes_.end()) return;
93819
+ const auto newest = manager_->getNewestCloneOfShadowNode(*found->second);
93820
+ const auto *target = dynamic_cast<const react::LayoutableShadowNode *>(newest.get());
93821
+ if (!target) return;
93822
+ const react::ShadowNode *parent = nullptr;
93823
+ if (mutation.parentTag != surface_) {
93824
+ const auto mountedParent = nodes_.find(mutation.parentTag);
93825
+ if (mountedParent != nodes_.end()) parent = mountedParent->second.get();
93826
+ }
93827
+ auto layout = jsi::Value::null();
93828
+ // fabric's differ includes the offsets of ancestors it flattens into the mount parent.
93829
+ const auto targetMetrics = mutation.parentTag == surface_ || parent
93830
+ ? manager_->getRelativeLayoutMetrics(*target, parent, {.includeTransform = false})
93831
+ : react::EmptyLayoutMetrics;
93832
+ if (targetMetrics != react::EmptyLayoutMetrics && view.layoutMetrics.frame != targetMetrics.frame) {
93833
+ const auto &frame = view.layoutMetrics.frame;
93834
+ const auto &targetFrame = targetMetrics.frame;
93835
+ auto rect = jsi::Array(rt, 8);
93836
+ double dimensions[] = {frame.origin.x, frame.origin.y, frame.size.width, frame.size.height,
93837
+ targetFrame.origin.x, targetFrame.origin.y, targetFrame.size.width, targetFrame.size.height};
93838
+ for (size_t i = 0; i < 8; ++i) rect.setValueAtIndex(rt, i, dimensions[i]);
93839
+ layout = std::move(rect);
93840
+ }
93841
+ auto props = jsi::Object(rt);
93842
+ if (const auto *style = dynamic_cast<const react::BaseViewProps *>(view.props.get())) {
93843
+ const auto *targetStyle = dynamic_cast<const react::BaseViewProps *>(target->getProps().get());
93844
+ if (targetStyle && style->opacity != targetStyle->opacity) props.setProperty(rt, "opacity", style->opacity);
93845
+ if (targetStyle && style->transform != targetStyle->transform) {
93846
+ auto matrix = jsi::Array(rt, 16);
93847
+ const auto transform = style->resolveTransform(view.layoutMetrics);
93848
+ for (size_t i = 0; i < 16; ++i) matrix.setValueAtIndex(rt, i, transform.matrix[i]);
93849
+ auto operation = jsi::Object(rt);
93850
+ operation.setProperty(rt, "matrix", std::move(matrix));
93851
+ auto entries = jsi::Array(rt, 1);
93852
+ entries.setValueAtIndex(rt, 0, std::move(operation));
93853
+ props.setProperty(rt, "transform", std::move(entries));
93854
+ }
93855
+ }
93856
+ apply.call(rt, view.tag, std::move(props), std::move(layout));
93857
+ }
93858
+
93859
+ private:
93860
+ AppNode node(jsi::Runtime &rt, react::Tag tag) const {
93861
+ if (tag == surface_) {
93862
+ AppNode root;
93863
+ manager_->getShadowTreeRegistry().visit(surface_, [&](const react::ShadowTree &tree) {
93864
+ root = tree.getCurrentRevision().rootShadowNode;
93865
+ });
93866
+ if (root) return root;
93867
+ }
93868
+ auto found = nodes_.find(tag);
93869
+ if (found == nodes_.end()) throw jsi::JSError(rt, "Fabric view is absent from its committed surface");
93870
+ if (auto current = manager_->getNewestCloneOfShadowNode(*found->second)) return current;
93871
+ return found->second;
93872
+ }
93873
+
93874
+ std::shared_ptr<AppChildren> readChildren(jsi::Runtime &rt, const jsi::Array &values,
93875
+ std::unordered_map<react::Tag, AppNode> &next) const {
93876
+ auto children = std::make_shared<AppChildren>();
93877
+ children->reserve(values.size(rt));
93878
+ for (size_t i = 0; i < values.size(rt); ++i) {
93879
+ auto row = values.getValueAtIndex(rt, i).asObject(rt).asArray(rt);
93880
+ if (row.size(rt) != 5) throw jsi::JSError(rt, "invalid Fabric view in app commit");
93881
+ const auto tag = static_cast<react::Tag>(row.getValueAtIndex(rt, 0).asNumber());
93882
+ const auto component = row.getValueAtIndex(rt, 1).asString(rt).utf8(rt);
93883
+ const auto properties = row.getValueAtIndex(rt, 2);
93884
+ const auto instance = row.getValueAtIndex(rt, 3);
93885
+ auto descendants = readChildren(rt, row.getValueAtIndex(rt, 4).asObject(rt).asArray(rt), next);
93886
+ auto existing = nodes_.find(tag);
93887
+ AppNode view;
93888
+ if (existing == nodes_.end()) {
93889
+ auto initial = manager_->createNode(tag, component, surface_, react::RawProps(rt, properties),
93890
+ std::make_shared<react::InstanceHandle>(rt, instance, tag));
93891
+ for (const auto &child : *descendants) manager_->appendChild(initial, child);
93892
+ view = std::move(initial);
93893
+ } else {
93894
+ view = manager_->cloneNode(*existing->second, descendants, react::RawProps(rt, properties));
93895
+ }
93896
+ if (!next.emplace(tag, view).second) throw jsi::JSError(rt, "duplicate Fabric view tag in app commit");
93897
+ children->push_back(std::move(view));
93898
+ }
93899
+ return children;
93900
+ }
93901
+
93902
+ std::shared_ptr<react::UIManager> manager_;
93903
+ const react::ContextContainer &context_;
93904
+ react::SurfaceId surface_ = 0;
93905
+ react::LayoutConstraints constraints_;
93906
+ react::LayoutContext layout_;
93907
+ std::unordered_map<react::Tag, AppNode> nodes_;
93908
+ };
93909
+
93910
+ PeachAppSurfacePresenter *appSurfacePresenter;
93911
+ std::unique_ptr<PeachAppShadowTree> appShadowTree;
93912
+ std::optional<jsi::Function> appMountHandler;
93913
+ std::optional<jsi::Function> appPropsHandler;
93914
+ std::optional<jsi::Function> appCommandHandler;
93915
+ }
93916
+
93917
+ id peachAppSurfacePresenter() {
93918
+ return appSurfacePresenter;
93919
+ }
93920
+ `;
93921
+ FABRIC_APP_INSTALL = `
93922
+ react::RuntimeExecutor execute = [invoker = fabricInvoker](std::function<void(jsi::Runtime &)> &&work) {
93923
+ using RuntimeBlock = void (^)(jsi::Runtime &);
93924
+ if (const auto *block = work.target<RuntimeBlock>()) {
93925
+ // stack blocks need a copy before the executor can queue them.
93926
+ RuntimeBlock owned = (__bridge_transfer RuntimeBlock)_Block_copy((__bridge const void *)*block);
93927
+ work = [owned](jsi::Runtime &rt) { owned(rt); };
93928
+ }
93929
+ invoker->invokeAsync(std::move(work));
93930
+ };
93931
+ appSurfacePresenter = [[PeachAppSurfacePresenter alloc] initWithContextContainer:fabricContext
93932
+ runtimeExecutor:execute bridgelessBindingsExecutor:execute];
93933
+ appShadowTree = std::make_unique<PeachAppShadowTree>(appSurfacePresenter.scheduler.uiManager, *fabricContext);
93934
+ appSurfacePresenter.publishMount = [execute](const react::MountingTransaction &transaction) {
93935
+ execute([surface = transaction.getSurfaceId(), mutations = transaction.getMutations()](jsi::Runtime &rt) {
93936
+ if (appShadowTree && appMountHandler) {
93937
+ for (const auto &mutation : mutations) appShadowTree->publish(rt, mutation, *appMountHandler);
93938
+ [appSurfacePresenter.scheduler reportMount:surface];
93939
+ }
93940
+ });
93941
+ };
93942
+ appSurfacePresenter.publishProps = [execute](react::Tag tag, folly::dynamic props) {
93943
+ execute([tag, props = std::move(props)](jsi::Runtime &rt) {
93944
+ if (appPropsHandler) appPropsHandler->call(rt, tag, jsi::valueFromDynamic(rt, props));
93945
+ });
93946
+ };
93947
+ appSurfacePresenter.dispatchCommand = [execute](react::Tag tag, const std::string &name, const folly::dynamic &args) {
93948
+ execute([tag, name, args](jsi::Runtime &rt) {
93949
+ if (appCommandHandler) appCommandHandler->call(rt, tag, jsi::String::createFromUtf8(rt, name), jsi::valueFromDynamic(rt, args));
93950
+ });
93951
+ };
93952
+ `;
93953
+ FABRIC_APP_METHODS = `
93954
+ method("commitApp", 6, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
93955
+ appShadowTree->commit(rt, static_cast<react::SurfaceId>(args[0].asNumber()), args[1].asNumber(),
93956
+ args[2].asNumber(), args[3].asNumber(), args[4].getBool(), args[5].asObject(rt).asArray(rt));
93957
+ return jsi::Value::undefined();
93958
+ });
93959
+ method("setAppHandlers", 3, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
93960
+ appMountHandler = args[0].asObject(rt).asFunction(rt);
93961
+ appPropsHandler = args[1].asObject(rt).asFunction(rt);
93962
+ appCommandHandler = args[2].asObject(rt).asFunction(rt);
93963
+ return jsi::Value::undefined();
93964
+ });
93965
+ method("dispatchAppEvent", 3, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
93966
+ appShadowTree->dispatch(rt, static_cast<react::Tag>(args[0].asNumber()), args[1].asString(rt).utf8(rt), args[2]);
93967
+ return jsi::Value::undefined();
93968
+ });
93969
+ constexpr auto *shadowFactory = "peachCreateFabricShadowHandle";
93970
+ rt.global().setProperty(rt, shadowFactory, jsi::Function::createFromHostFunction(rt,
93971
+ jsi::PropNameID::forAscii(rt, shadowFactory), 3,
93972
+ [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
93973
+ return appShadowTree->handle(rt, static_cast<react::Tag>(args[0].asNumber()), args[1], args[2]);
93974
+ }));
93975
+ `;
93976
+ FABRIC_APP_TEARDOWN = `
93977
+ appShadowTree.reset();
93978
+ appMountHandler.reset();
93979
+ appPropsHandler.reset();
93980
+ appCommandHandler.reset();
93981
+ appSurfacePresenter = nil;
93982
+ `;
93983
+ }
93984
+ });
93985
+
93656
93986
  // src/turbo-source.ts
93657
93987
  function codegenSpecRoot(codegen) {
93658
93988
  const nested = import_node_path123.default.join(codegen, "ReactCodegen");
@@ -94763,6 +95093,7 @@ async function collectTurboSources(options2) {
94763
95093
  };
94764
95094
  let objc = Boolean(options2.reactNativeProvider);
94765
95095
  let fabric = Boolean(options2.reactNativeProvider);
95096
+ let appPresenter = false;
94766
95097
  const fabricPackages = /* @__PURE__ */ new Set();
94767
95098
  const fabricViews = [];
94768
95099
  let fabricTarget = null;
@@ -94900,6 +95231,11 @@ async function collectTurboSources(options2) {
94900
95231
  providerObjC = true;
94901
95232
  const stripped2 = stripComments2(text7);
94902
95233
  if (OBJC_TURBO.test(stripped2) || OBJC_BRIDGE.test(stripped2)) {
95234
+ if (/-\s*\(\s*void\s*\)\s*setSurfacePresenter\s*:/.test(stripped2)) {
95235
+ fabric = true;
95236
+ appPresenter = true;
95237
+ fabricTarget ??= { targetName, label, root: provider.root };
95238
+ }
94903
95239
  const registers2 = OBJC_REGISTERED.test(stripped2);
94904
95240
  for (const [, className2] of stripped2.matchAll(/@implementation\s+(\w+)/g))
94905
95241
  if (!managers.has(className2)) {
@@ -95355,7 +95691,7 @@ async function collectTurboSources(options2) {
95355
95691
  if (fabricPackages.has(owner))
95356
95692
  fabricViews.push({ name: name3, className: className2 });
95357
95693
  }
95358
- const hostTarget = (fabricViews.length > 0 ? fabricTarget : null) ?? (paperClasses.length > 0 ? paperTarget : null);
95694
+ const hostTarget = (fabricViews.length > 0 ? fabricTarget : null) ?? (paperClasses.length > 0 ? paperTarget : null) ?? (appPresenter ? fabricTarget : null);
95359
95695
  if (hostTarget) {
95360
95696
  result.fabricComponents = fabricViews.map(({ name: name3 }) => name3);
95361
95697
  result.paperViewManagers = [...new Set(paperClasses)].sort();
@@ -95389,7 +95725,7 @@ async function collectTurboSources(options2) {
95389
95725
  }
95390
95726
  }
95391
95727
  const unit2 = `${targetPath(hostTarget.targetName)}/PeachFabricHost.mm`;
95392
- add(unit2, fabricHostSource(fabricViews, result.paperViewManagers));
95728
+ add(unit2, fabricHostSource(fabricViews, result.paperViewManagers, appPresenter));
95393
95729
  scanText(
95394
95730
  { key: unit2, ...hostTarget, relative: "PeachFabricHost.mm" },
95395
95731
  result.files[unit2]
@@ -95827,6 +96163,7 @@ RCT_EXPORT_METHOD(load:(NSString *)uri
95827
96163
  extern "C" void RCTRegisterModule(Class);
95828
96164
  static PeachTurboModuleDelegate *delegate;
95829
96165
  static RCTTurboModuleManager *manager;
96166
+ id peachAppSurfacePresenter() __attribute__((weak));
95830
96167
 
95831
96168
  @implementation PeachTurboModuleDelegate
95832
96169
 
@@ -95851,6 +96188,9 @@ static RCTTurboModuleManager *manager;
95851
96188
  - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
95852
96189
  {
95853
96190
  id<RCTTurboModule> module = [moduleClass new];
96191
+ if (peachAppSurfacePresenter && [module respondsToSelector:@selector(setSurfacePresenter:)]) {
96192
+ [module performSelector:@selector(setSurfacePresenter:) withObject:peachAppSurfacePresenter()];
96193
+ }
95854
96194
  if ([module respondsToSelector:@selector(setDispatchToJSThread:)])
95855
96195
  ((id<RCTJSDispatcherModule>)module).dispatchToJSThread = ^(dispatch_block_t block) {
95856
96196
  dispatchToJSThread(block);
@@ -95926,8 +96266,8 @@ ${hasEventDispatcher ? " if (![RCTGetModuleClasses() containsObject:[RCTEventDi
95926
96266
  auto& runtime = peach::jsi_runtime::create(
95927
96267
  [] { invoker->drain(); },
95928
96268
  [] {
95929
- if (peachTeardownFabricViews) peachTeardownFabricViews();
95930
96269
  [manager invalidate];
96270
+ if (peachTeardownFabricViews) peachTeardownFabricViews();
95931
96271
  manager = nil;
95932
96272
  delegate = nil;
95933
96273
  invoker.reset();
@@ -96033,12 +96373,13 @@ ${moduleProviders ? " [found addObjectsFromArray:RCTModuleProviders.moduleProvi
96033
96373
  }
96034
96374
  `;
96035
96375
  }
96036
- function fabricHostSource(views, paperClasses) {
96376
+ function fabricHostSource(views, paperClasses, appPresenter) {
96037
96377
  const entries2 = views.map(
96038
96378
  ({ name: name3, className: className2 }) => `@${JSON.stringify(name3)}: NSClassFromString(@${JSON.stringify(className2)})`
96039
96379
  ).join(", ");
96040
96380
  const paper = paperClasses.length > 0;
96041
- return `${FABRIC_HOST_INCLUDES}${paper ? FABRIC_HOST_PAPER_INCLUDES : ""}
96381
+ return `${FABRIC_HOST_INCLUDES}${paper ? FABRIC_HOST_PAPER_INCLUDES : ""}${appPresenter ? FABRIC_APP_INCLUDES : ""}
96382
+ ${appPresenter ? FABRIC_APP_PRESENTER : ""}
96042
96383
  @interface PeachFabricComponents : NSObject <RCTComponentViewFactoryComponentProvider>
96043
96384
  @end
96044
96385
 
@@ -96778,7 +97119,8 @@ static void peachEventDispatcherDispatchEvent(id self, SEL _cmd, id<RCTEvent> ev
96778
97119
  NSNumber *reactTag = event.viewTag;
96779
97120
  if (!reactTag) return;
96780
97121
  auto found = fabricViews.find(reactTag.intValue);
96781
- if (found == fabricViews.end() || !found->second.family) return;
97122
+ if (found == fabricViews.end() || !found->second.family ||
97123
+ !dynamic_cast<const react::LegacyViewManagerInteropComponentDescriptor *>(found->second.descriptor)) return;
96782
97124
  NSArray *args = [event arguments];
96783
97125
  NSString *eventName = args.count >= 2 && [args[1] isKindOfClass:[NSString class]]
96784
97126
  ? args[1]
@@ -97058,6 +97400,7 @@ ${paper ? ` // Register missing Objective-C selectors on UIKit/QuartzCore class
97058
97400
  std::weak_ptr<react::EventLogger>());
97059
97401
  react::ComponentDescriptorParameters parameters{fabricDispatcher, fabricContext, nullptr};
97060
97402
  fabricDescriptors = [factory createComponentDescriptorRegistryWithParameters:parameters];
97403
+ ${appPresenter ? FABRIC_APP_INSTALL : ""}
97061
97404
  auto views = jsi::Object(rt);
97062
97405
  auto method = [&](const char *name, unsigned count, jsi::HostFunctionType body) {
97063
97406
  views.setProperty(
@@ -97082,6 +97425,7 @@ ${paper ? ` // Register missing Objective-C selectors on UIKit/QuartzCore class
97082
97425
  }
97083
97426
  }));
97084
97427
  };
97428
+ ${appPresenter ? FABRIC_APP_METHODS : ""}
97085
97429
  // create(name, instanceHandle, props), Create then Insert: the family the
97086
97430
  // handle's events resolve through, the first props, the initial state, and
97087
97431
  // the layout the view has before the engine measures it
@@ -97442,6 +97786,7 @@ void peachTeardownFabricViews() {
97442
97786
  fabricFocusParentTag = 0;
97443
97787
  fabricOwner.reset();
97444
97788
  fabricEventHandler.reset();
97789
+ ${appPresenter ? FABRIC_APP_TEARDOWN : ""}
97445
97790
  }
97446
97791
 
97447
97792
  extern "C" void *peach_fabric_view_content(int tag) {
@@ -97473,6 +97818,7 @@ var init_turbo_source = __esm({
97473
97818
  init_swift_source_file();
97474
97819
  init_swiftContract();
97475
97820
  init_turbo_codegen_intake();
97821
+ init_turbo_fabric_app();
97476
97822
  init_xcode_project();
97477
97823
  TURBO_CORE_TARGET = "TurboCore";
97478
97824
  TURBO_FMT_TARGET = "TurboFmt";
@@ -97730,6 +98076,7 @@ using namespace facebook;
97730
98076
  #import <React/RCTUIManager.h>
97731
98077
  #import <React/RCTUtils.h>
97732
98078
  #import <React/RCTViewManager.h>
98079
+ #include <react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h>
97733
98080
  #include <react/renderer/components/view/ViewEventEmitter.h>
97734
98081
  #include <react/renderer/core/ShadowNodeFragment.h>
97735
98082
  #include <react/utils/FollyConvert.h>
@@ -98692,7 +99039,7 @@ var init_react_native_core = __esm({
98692
99039
  init_swift_distribution();
98693
99040
  init_swift_package();
98694
99041
  init_swiftContract();
98695
- recipe = true ? "29f49a22e10d2e4d7a095ce3ceb7254c31c8822728d7410046b1d52b7be94ecd" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
99042
+ recipe = true ? "32fd4cb91d846dff44d3a53361a8b93d320b064cfdcfc0b760c1861bc7f53cea" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
98696
99043
  strings4 = (value) => isRecord(value) && Object.values(value).every((item) => typeof item === "string");
98697
99044
  building = /* @__PURE__ */ new Map();
98698
99045
  }
@@ -101208,11 +101555,11 @@ async function compileExpoSwiftModulesTraced(root, base, publishArtifact, option
101208
101555
  throw failure2;
101209
101556
  }
101210
101557
  }
101211
- var import_node_async_hooks3, import_node_child_process65, import_node_crypto78, import_node_fs126, import_node_module18, import_node_os27, import_node_path128, import_node_url4, import_node_util18, run11, scriptEnv, EXPO_SWIFT_ENTRY, WITNESS_BATCH, traceStore, discoveryCache, preparedCache, savedFs, ignoredRoots, ownTemporaryRoots, EXPO_MODULE_SCAN_TIMEOUT_MS, preparedExpoSwift, openPreparations, ExpoSwiftLinkRefusal;
101558
+ var import_node_async_hooks4, import_node_child_process65, import_node_crypto78, import_node_fs126, import_node_module18, import_node_os27, import_node_path128, import_node_url4, import_node_util18, run11, scriptEnv, EXPO_SWIFT_ENTRY, WITNESS_BATCH, traceStore, discoveryCache, preparedCache, savedFs, ignoredRoots, ownTemporaryRoots, EXPO_MODULE_SCAN_TIMEOUT_MS, preparedExpoSwift, openPreparations, ExpoSwiftLinkRefusal;
101212
101559
  var init_expo_swift_host = __esm({
101213
101560
  "src/expo-swift-host.ts"() {
101214
101561
  "use strict";
101215
- import_node_async_hooks3 = require("node:async_hooks");
101562
+ import_node_async_hooks4 = require("node:async_hooks");
101216
101563
  import_node_child_process65 = require("node:child_process");
101217
101564
  import_node_crypto78 = require("node:crypto");
101218
101565
  import_node_fs126 = __toESM(require("node:fs"), 1);
@@ -101254,7 +101601,7 @@ var init_expo_swift_host = __esm({
101254
101601
  scriptEnv = { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: "1" };
101255
101602
  EXPO_SWIFT_ENTRY = "Sources/PeachExpoApp/PeachExpoEntry.swift";
101256
101603
  WITNESS_BATCH = 200;
101257
- traceStore = new import_node_async_hooks3.AsyncLocalStorage();
101604
+ traceStore = new import_node_async_hooks4.AsyncLocalStorage();
101258
101605
  discoveryCache = /* @__PURE__ */ new Map();
101259
101606
  preparedCache = /* @__PURE__ */ new Map();
101260
101607
  savedFs = null;