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;
@@ -2706,7 +2706,7 @@ var init_process_liveness = __esm({
2706
2706
  var runtime_companion_default;
2707
2707
  var init_runtime_companion = __esm({
2708
2708
  "runtime-companion.json"() {
2709
- runtime_companion_default = { abi: 1, sha256: "31b7603a64b7e420169226e41dfb40153e4f53755c48f802a93420090f66560b", file: "node/cli-31b7603a64b7e420169226e41dfb40153e4f53755c48f802a93420090f66560b.cjs" };
2709
+ runtime_companion_default = { abi: 1, sha256: "0ad3faed77929d763ea2b0a67e07d83b2b0f804b2274fbd017286c33d22db5ef", file: "node/cli-0ad3faed77929d763ea2b0a67e07d83b2b0f804b2274fbd017286c33d22db5ef.cjs" };
2710
2710
  }
2711
2711
  });
2712
2712
 
@@ -6175,7 +6175,7 @@ var init_swift_objc_sdk_tree = __esm({
6175
6175
 
6176
6176
  // src/swift-compiler-digest.ts
6177
6177
  function swiftArchiveCompilerDigestValue() {
6178
- return true ? "b5b82d054534fd9072ae1dedb5989e8e0af22b0a946ffd29ac06dd643af5fa0e" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname, "archive");
6178
+ return true ? "1d6a57a8166d9d9b3e8a4b6c03c70b1f73f858a100be595aef34f901cf8433d9" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname, "archive");
6179
6179
  }
6180
6180
  var import_node_crypto10, import_node_fs25, import_node_path25, SWIFT_DIGEST_SOURCES, LINKED_IMAGE_SOURCES, SWIFT_ARCHIVE_DIGEST_SOURCES;
6181
6181
  var init_swift_compiler_digest = __esm({
@@ -6320,13 +6320,13 @@ var init_swift_standin_digest = __esm({
6320
6320
  ];
6321
6321
  RUNTIME_IMPORT = /(?:^|[;\n])[ \t]*(?:import|export)\s+(?!type(?:\s|\{))([\s\S]*?)\s+from\s*['"]([^'"]+)['"]|(?:^|[;\n])[ \t]*import\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
6322
6322
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS, STANDIN_DIGEST_EXCLUDED_FILES);
6323
- STANDIN_SOURCE_DIGEST = true ? "1014761dfbb57f4d2590408d43a606daae2e964013bca7b63d953e956a607828" : standinSourceDigest();
6323
+ STANDIN_SOURCE_DIGEST = true ? "052de0fbd3c71d7f303b5bc9cc36a998a980e3c58320282620a45495172d86ad" : standinSourceDigest();
6324
6324
  }
6325
6325
  });
6326
6326
 
6327
6327
  // src/expo-native-compiler-digest.ts
6328
6328
  function expoNativeCompilerDigestValue() {
6329
- return true ? "cc36f727162421252689361a34c836ac4dcb9f583f2bf824531473f4e2dd3345" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
6329
+ return true ? "7c21202b510e2d8e478f15f4d1d2696e06cb8b02a9bbfa34bf6a353ab6bf8cad" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
6330
6330
  }
6331
6331
  var import_node_crypto12;
6332
6332
  var init_expo_native_compiler_digest = __esm({
@@ -14545,6 +14545,24 @@ var init_swift_toolchain = __esm({
14545
14545
  import_node_zlib3 = __toESM(require("node:zlib"), 1);
14546
14546
  init_swiftTargetContract();
14547
14547
  compilerArchives = {
14548
+ "swift-6.4.0-RELEASE-custom-747babe6f837e240": {
14549
+ identity: "747babe6f837e240",
14550
+ archive: "tar.zst",
14551
+ hosts: {
14552
+ "darwin-arm64": {
14553
+ checksum: "2bc61029a5e9f29e4d8d0ed85936edd72b249821f48e2fbbf602d1424f30aa69",
14554
+ manifest: "4bdb605f2db31b12e507bbc0998e4054226aae1926ff1361d2e1bd6a8f87d14a"
14555
+ },
14556
+ "linux-x64": {
14557
+ checksum: "99b8ee28b2afe719ae02b88b4258a05584b7a1e29bb8d429c925819de0c10144",
14558
+ manifest: "b3e5970647fb2020917fceb4b632d733bb0247523739a6eaebe11d1a96d7e3e4"
14559
+ },
14560
+ "linux-arm64": {
14561
+ checksum: "34ace308eac458cd9c808e3bb8b1689ae02f0dff3f7b9d71ab7cf779e5a0cb78",
14562
+ manifest: "87b337c62eb9c546662c21cb31082995aadb3f1088ca3624a4843ab8137452b3"
14563
+ }
14564
+ }
14565
+ },
14548
14566
  "swift-6.4.0-RELEASE-custom-77d2c2623ec68c0c": {
14549
14567
  identity: "77d2c2623ec68c0c",
14550
14568
  archive: "tar.zst",
@@ -43823,9 +43841,11 @@ var swift_root_lock_exports = {};
43823
43841
  __export(swift_root_lock_exports, {
43824
43842
  acquireSwiftRootReadHold: () => acquireSwiftRootReadHold,
43825
43843
  hasLiveSwiftRootReaders: () => hasLiveSwiftRootReaders,
43844
+ retainSwiftRootReadHold: () => retainSwiftRootReadHold,
43826
43845
  swiftRootLocksDir: () => swiftRootLocksDir,
43827
43846
  waitForNoSwiftRootReaders: () => waitForNoSwiftRootReaders,
43828
- withSwiftRootLock: () => withSwiftRootLock
43847
+ withSwiftRootLock: () => withSwiftRootLock,
43848
+ withSwiftRootReadHolds: () => withSwiftRootReadHolds
43829
43849
  });
43830
43850
  function errorCode(error) {
43831
43851
  return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : void 0;
@@ -43939,6 +43959,25 @@ function rootLockKey(root) {
43939
43959
  function swiftRootLocksDir() {
43940
43960
  return import_node_path71.default.join((0, import_node_os15.homedir)(), ".peach", "cache", "swift-root-locks");
43941
43961
  }
43962
+ function withSwiftRootReadHolds(work) {
43963
+ const holds = [];
43964
+ const release = () => {
43965
+ for (const hold of holds.splice(0)) hold.release();
43966
+ };
43967
+ return swiftRootReadHolds.run(holds, async () => {
43968
+ try {
43969
+ return await work(release);
43970
+ } finally {
43971
+ release();
43972
+ }
43973
+ });
43974
+ }
43975
+ function retainSwiftRootReadHold(hold) {
43976
+ const holds = swiftRootReadHolds.getStore();
43977
+ if (!holds) return false;
43978
+ holds.push(hold);
43979
+ return true;
43980
+ }
43942
43981
  function lockDirectoryFor(root) {
43943
43982
  const directory2 = import_node_path71.default.join(
43944
43983
  swiftRootLocksDir(),
@@ -44112,10 +44151,11 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
44112
44151
  (0, import_node_fs71.writeFileSync)(import_node_path71.default.join(directory2, name2(held, "released")), "");
44113
44152
  }
44114
44153
  }
44115
- var import_node_child_process35, import_node_crypto41, import_node_fs71, import_node_os15, import_node_path71, POLL_MS, INSPECT_ATTEMPTS, START_TOLERANCE_MS, name2;
44154
+ var import_node_async_hooks2, import_node_child_process35, import_node_crypto41, import_node_fs71, import_node_os15, import_node_path71, POLL_MS, INSPECT_ATTEMPTS, START_TOLERANCE_MS, name2, swiftRootReadHolds;
44116
44155
  var init_swift_root_lock = __esm({
44117
44156
  "src/swift-root-lock.ts"() {
44118
44157
  "use strict";
44158
+ import_node_async_hooks2 = require("node:async_hooks");
44119
44159
  import_node_child_process35 = require("node:child_process");
44120
44160
  import_node_crypto41 = require("node:crypto");
44121
44161
  import_node_fs71 = require("node:fs");
@@ -44127,6 +44167,7 @@ var init_swift_root_lock = __esm({
44127
44167
  INSPECT_ATTEMPTS = 5;
44128
44168
  START_TOLERANCE_MS = 2e3;
44129
44169
  name2 = (number4, suffix) => `${String(number4).padStart(12, "0")}.${suffix}`;
44170
+ swiftRootReadHolds = new import_node_async_hooks2.AsyncLocalStorage();
44130
44171
  }
44131
44172
  });
44132
44173
 
@@ -44577,20 +44618,23 @@ async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkIm
44577
44618
  }
44578
44619
  const work = `${directory2}.work`;
44579
44620
  try {
44580
- return await linkSwiftSdkImage(
44581
- moduleRoot,
44582
- key2,
44583
- directory2,
44584
- work,
44585
- scopedLookups,
44586
- imports2
44621
+ return await withSwiftRootReadHolds(
44622
+ (releaseFrameworks) => linkSwiftSdkImage(
44623
+ moduleRoot,
44624
+ key2,
44625
+ directory2,
44626
+ work,
44627
+ scopedLookups,
44628
+ imports2,
44629
+ releaseFrameworks
44630
+ )
44587
44631
  );
44588
44632
  } finally {
44589
44633
  (0, import_node_fs73.rmSync)(work, { recursive: true, force: true });
44590
44634
  }
44591
44635
  });
44592
44636
  }
44593
- async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLookups, imports2) {
44637
+ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLookups, imports2, releaseFrameworks) {
44594
44638
  (0, import_node_fs73.rmSync)(work, { recursive: true, force: true });
44595
44639
  (0, import_node_fs73.mkdirSync)(work, { recursive: true });
44596
44640
  const toolchain = swiftModuleToolchain(moduleRoot);
@@ -44791,6 +44835,7 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
44791
44835
  linkTo("linked", ["-Map", map2, "-o", linked]),
44792
44836
  linkTo("relocs", ["--emit-relocs", "-o", withRelocs])
44793
44837
  ]);
44838
+ releaseFrameworks();
44794
44839
  for (const result of links) {
44795
44840
  if (result.status === "rejected") throw result.reason;
44796
44841
  }
@@ -53701,7 +53746,7 @@ ${compatShape}` : "";
53701
53746
  sdk: sdk2,
53702
53747
  icu,
53703
53748
  prebuilt,
53704
- readHold
53749
+ readHold: frameworkReadHold
53705
53750
  } = await withFrameworkLock(async (slot, frameworkLease) => {
53706
53751
  budget.startCompile();
53707
53752
  if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
@@ -53752,6 +53797,7 @@ ${compatShape}` : "";
53752
53797
  readHold: readHold2
53753
53798
  };
53754
53799
  });
53800
+ let readHold = frameworkReadHold;
53755
53801
  const buildOptions = {
53756
53802
  env: baseBuildEnv,
53757
53803
  maxBuffer: 64 * 1024 * 1024,
@@ -54230,6 +54276,7 @@ ${compatShape}` : "";
54230
54276
  if ((0, import_node_fs82.statSync)(linked).size <= 8)
54231
54277
  throw new Error("swift-compile: deferred linker produced no executable");
54232
54278
  stage("project link verified");
54279
+ if (readHold && retainSwiftRootReadHold(readHold)) readHold = void 0;
54233
54280
  return;
54234
54281
  }
54235
54282
  const output = options2.project ? projectOutputFile(root2, linked, options2.project) : linked;
@@ -54550,7 +54597,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
54550
54597
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
54551
54598
  MULTI_MANIFEST_VERSION = 76;
54552
54599
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
54553
- compilerSourceDigest = true ? "62770f816d4a4c67eb9ee046aad3b137346685dd181ef4f141164a66f2454f62" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
54600
+ compilerSourceDigest = true ? "a8a1fcc341892ac0e1a3c924e733388ee30478222b3e1839692997c6dd5555a8" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
54554
54601
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
54555
54602
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
54556
54603
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -74167,7 +74214,7 @@ var init_provenance = __esm({
74167
74214
  import_node_crypto56 = require("node:crypto");
74168
74215
  import_node_fs96 = require("node:fs");
74169
74216
  import_node_path99 = require("node:path");
74170
- 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_path99.join)(__sootsim_import_meta_dirname, ".."));
74217
+ 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_path99.join)(__sootsim_import_meta_dirname, ".."));
74171
74218
  }
74172
74219
  });
74173
74220
 
@@ -103688,11 +103735,11 @@ async function swiftArtifactAssets(artifact, { sdkUrl, sdkBindingUrl }) {
103688
103735
  }
103689
103736
  return assets2;
103690
103737
  }
103691
- var import_node_async_hooks2, import_node_child_process67, import_node_crypto82, import_node_fs135, import_node_os29, import_node_path137, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SDK_PATH, SDK_BINDING_PATH, SKIP_ROOT_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, SwiftMissingModulesError, startupImages, 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, sdkStartups, sdkStartupParts, sdkStartupPlans, sdkPieces2, sdkSplitBindings, sdkBindingFiles, servedSdkBinding;
103738
+ var import_node_async_hooks3, import_node_child_process67, import_node_crypto82, import_node_fs135, import_node_os29, import_node_path137, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SDK_PATH, SDK_BINDING_PATH, SKIP_ROOT_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, SwiftMissingModulesError, startupImages, 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, sdkStartups, sdkStartupParts, sdkStartupPlans, sdkPieces2, sdkSplitBindings, sdkBindingFiles, servedSdkBinding;
103692
103739
  var init_swift_host = __esm({
103693
103740
  "src/swift-host.ts"() {
103694
103741
  "use strict";
103695
- import_node_async_hooks2 = require("node:async_hooks");
103742
+ import_node_async_hooks3 = require("node:async_hooks");
103696
103743
  import_node_child_process67 = require("node:child_process");
103697
103744
  import_node_crypto82 = require("node:crypto");
103698
103745
  import_node_fs135 = __toESM(require("node:fs"), 1);
@@ -103751,7 +103798,7 @@ var init_swift_host = __esm({
103751
103798
  startupImages = /* @__PURE__ */ new WeakMap();
103752
103799
  swiftArtifactDigests = /* @__PURE__ */ new WeakMap();
103753
103800
  sharedProjects = /* @__PURE__ */ new Map();
103754
- projectScope = new import_node_async_hooks2.AsyncLocalStorage();
103801
+ projectScope = new import_node_async_hooks3.AsyncLocalStorage();
103755
103802
  projects = () => projectScope.getStore()?.projects ?? sharedProjects;
103756
103803
  sharedSourceEntries = /* @__PURE__ */ new Map();
103757
103804
  sourceEntries = () => projectScope.getStore()?.sourceEntries ?? sharedSourceEntries;
@@ -103762,7 +103809,7 @@ var init_swift_host = __esm({
103762
103809
  XCODE_APP_DIR = "__app__";
103763
103810
  XCODE_FRAMEWORKS_DIR = "__frameworks__";
103764
103811
  XCODE_PACKAGES_DIR = SWIFT_REMOTE_PACKAGES_DIR;
103765
- layoutScope = new import_node_async_hooks2.AsyncLocalStorage();
103812
+ layoutScope = new import_node_async_hooks3.AsyncLocalStorage();
103766
103813
  HOSTED_LIMITS = {
103767
103814
  sourceBytes: MAX_SWIFT_COMPILE_SOURCE_BYTES,
103768
103815
  resources: MAX_SWIFT_COMPILE_RESOURCES,
@@ -104581,6 +104628,291 @@ var init_turbo_codegen_intake = __esm({
104581
104628
  }
104582
104629
  });
104583
104630
 
104631
+ // src/turbo-fabric-app.ts
104632
+ var FABRIC_APP_INCLUDES, FABRIC_APP_PRESENTER, FABRIC_APP_INSTALL, FABRIC_APP_METHODS, FABRIC_APP_TEARDOWN;
104633
+ var init_turbo_fabric_app = __esm({
104634
+ "src/turbo-fabric-app.ts"() {
104635
+ "use strict";
104636
+ FABRIC_APP_INCLUDES = `#import <Block.h>
104637
+ #import <React/RCTScheduler.h>
104638
+ #import <React/RCTSurfacePresenter.h>
104639
+ #include <jsi/JSIDynamic.h>
104640
+ #include <react/renderer/components/view/BaseViewProps.h>
104641
+ #include <react/renderer/components/view/ViewEventEmitter.h>
104642
+ #include <react/renderer/core/InstanceHandle.h>
104643
+ #include <react/renderer/core/LayoutableShadowNode.h>
104644
+ #include <react/renderer/mounting/ShadowTree.h>
104645
+ #include <react/renderer/uimanager/UIManager.h>
104646
+ `;
104647
+ FABRIC_APP_PRESENTER = `
104648
+ namespace {
104649
+ extern std::shared_ptr<react::CallInvoker> fabricInvoker;
104650
+ extern std::shared_ptr<react::RuntimeScheduler> fabricScheduler;
104651
+ }
104652
+
104653
+ @interface PeachAppSurfacePresenter : RCTSurfacePresenter
104654
+ @property(nonatomic) std::function<void(const react::MountingTransaction &)> publishMount;
104655
+ @property(nonatomic) std::function<void(react::Tag, folly::dynamic)> publishProps;
104656
+ @property(nonatomic) std::function<void(react::Tag, const std::string &, const folly::dynamic &)> dispatchCommand;
104657
+ @end
104658
+
104659
+ @implementation PeachAppSurfacePresenter
104660
+ - (void)schedulerDidFinishTransaction:(std::shared_ptr<const react::MountingCoordinator>)coordinator {
104661
+ // guest commits can finish outside a React Native scheduler task.
104662
+ fabricInvoker->invokeAsync([](jsi::Runtime &) {
104663
+ fabricScheduler->scheduleWork([](jsi::Runtime &) {});
104664
+ });
104665
+ }
104666
+
104667
+ - (void)schedulerShouldRenderTransactions:(std::shared_ptr<const react::MountingCoordinator>)coordinator {
104668
+ if (auto transaction = coordinator->pullTransaction()) {
104669
+ self.publishMount(*transaction);
104670
+ }
104671
+ }
104672
+
104673
+ - (void)schedulerDidSynchronouslyUpdateViewOnUIThread:(ReactTag)tag props:(folly::dynamic)props {
104674
+ self.publishProps(static_cast<react::Tag>(tag), std::move(props));
104675
+ }
104676
+
104677
+ - (void)schedulerDidDispatchCommand:(const react::ShadowView &)shadowView
104678
+ commandName:(const std::string &)name
104679
+ args:(const folly::dynamic &)args {
104680
+ self.dispatchCommand(shadowView.tag, name, args);
104681
+ }
104682
+ @end
104683
+
104684
+ namespace {
104685
+ using AppNode = std::shared_ptr<const react::ShadowNode>;
104686
+ using AppChildren = std::vector<AppNode>;
104687
+
104688
+ class PeachAppShadowTree {
104689
+ public:
104690
+ PeachAppShadowTree(std::shared_ptr<react::UIManager> manager, const react::ContextContainer &context)
104691
+ : manager_(std::move(manager)), context_(context) {}
104692
+
104693
+ ~PeachAppShadowTree() {
104694
+ if (surface_ != 0) manager_->getShadowTreeRegistry().remove(surface_);
104695
+ }
104696
+
104697
+ void commit(jsi::Runtime &rt, react::SurfaceId surface, double width, double height, double scale,
104698
+ bool rtl, const jsi::Array &roots) {
104699
+ react::LayoutConstraints constraints;
104700
+ constraints.maximumSize = {static_cast<react::Float>(width), static_cast<react::Float>(height)};
104701
+ constraints.minimumSize = constraints.maximumSize;
104702
+ constraints.layoutDirection = rtl ? react::LayoutDirection::RightToLeft : react::LayoutDirection::LeftToRight;
104703
+ react::LayoutContext layout;
104704
+ layout.pointScaleFactor = static_cast<react::Float>(scale);
104705
+ layout.viewportSize = constraints.maximumSize;
104706
+ if (surface_ != 0 && surface_ != surface)
104707
+ throw jsi::JSError(rt, "Fabric runtime is already bound to another app surface");
104708
+ if (surface_ == 0) {
104709
+ surface_ = surface;
104710
+ manager_->startEmptySurface(std::make_unique<react::ShadowTree>(surface_, constraints, layout, *manager_, context_));
104711
+ } else if (constraints != constraints_ || layout != layout_) {
104712
+ manager_->getShadowTreeRegistry().visit(surface_, [&](const react::ShadowTree &tree) {
104713
+ tree.commit([&](const react::RootShadowNode &root) {
104714
+ return root.clone({surface_, context_}, constraints, layout);
104715
+ }, {});
104716
+ });
104717
+ }
104718
+ constraints_ = constraints;
104719
+ layout_ = layout;
104720
+
104721
+ std::unordered_map<react::Tag, AppNode> next;
104722
+ auto children = readChildren(rt, roots, next);
104723
+ nodes_.swap(next);
104724
+ manager_->completeSurface(surface_, children,
104725
+ {.enableStateReconciliation = true, .mountSynchronously = false, .source = react::ShadowTree::CommitSource::React});
104726
+ }
104727
+
104728
+ jsi::Value handle(jsi::Runtime &rt, react::Tag tag, const jsi::Value &surface, const jsi::Value &generation) const {
104729
+ auto value = react::valueFromShadowNode(rt, node(rt, tag));
104730
+ auto object = value.getObject(rt);
104731
+ object.setProperty(rt, "__nativeTag", tag);
104732
+ object.setProperty(rt, "__viewTag", tag);
104733
+ object.setProperty(rt, "__surfaceId", surface);
104734
+ object.setProperty(rt, "__surfaceGeneration", generation);
104735
+ return object;
104736
+ }
104737
+
104738
+ void dispatch(jsi::Runtime &rt, react::Tag tag, std::string type, const jsi::Value &payload) const {
104739
+ const auto emitter = std::dynamic_pointer_cast<const react::ViewEventEmitter>(node(rt, tag)->getEventEmitter());
104740
+ if (emitter) emitter->dispatchEvent(std::move(type), jsi::dynamicFromValue(rt, payload));
104741
+ }
104742
+
104743
+ void publish(jsi::Runtime &rt, const react::ShadowViewMutation &mutation, const jsi::Function &apply) const {
104744
+ using Mutation = react::ShadowViewMutation;
104745
+ if (mutation.type != Mutation::Insert && mutation.type != Mutation::Update) return;
104746
+ const auto &view = mutation.newChildShadowView;
104747
+ const auto found = nodes_.find(view.tag);
104748
+ if (found == nodes_.end()) return;
104749
+ const auto newest = manager_->getNewestCloneOfShadowNode(*found->second);
104750
+ const auto *target = dynamic_cast<const react::LayoutableShadowNode *>(newest.get());
104751
+ if (!target) return;
104752
+ const react::ShadowNode *parent = nullptr;
104753
+ if (mutation.parentTag != surface_) {
104754
+ const auto mountedParent = nodes_.find(mutation.parentTag);
104755
+ if (mountedParent != nodes_.end()) parent = mountedParent->second.get();
104756
+ }
104757
+ auto layout = jsi::Value::null();
104758
+ // fabric's differ includes the offsets of ancestors it flattens into the mount parent.
104759
+ const auto targetMetrics = mutation.parentTag == surface_ || parent
104760
+ ? manager_->getRelativeLayoutMetrics(*target, parent, {.includeTransform = false})
104761
+ : react::EmptyLayoutMetrics;
104762
+ if (targetMetrics != react::EmptyLayoutMetrics && view.layoutMetrics.frame != targetMetrics.frame) {
104763
+ const auto &frame = view.layoutMetrics.frame;
104764
+ const auto &targetFrame = targetMetrics.frame;
104765
+ auto rect = jsi::Array(rt, 8);
104766
+ double dimensions[] = {frame.origin.x, frame.origin.y, frame.size.width, frame.size.height,
104767
+ targetFrame.origin.x, targetFrame.origin.y, targetFrame.size.width, targetFrame.size.height};
104768
+ for (size_t i = 0; i < 8; ++i) rect.setValueAtIndex(rt, i, dimensions[i]);
104769
+ layout = std::move(rect);
104770
+ }
104771
+ auto props = jsi::Object(rt);
104772
+ if (const auto *style = dynamic_cast<const react::BaseViewProps *>(view.props.get())) {
104773
+ const auto *targetStyle = dynamic_cast<const react::BaseViewProps *>(target->getProps().get());
104774
+ if (targetStyle && style->opacity != targetStyle->opacity) props.setProperty(rt, "opacity", style->opacity);
104775
+ if (targetStyle && style->transform != targetStyle->transform) {
104776
+ auto matrix = jsi::Array(rt, 16);
104777
+ const auto transform = style->resolveTransform(view.layoutMetrics);
104778
+ for (size_t i = 0; i < 16; ++i) matrix.setValueAtIndex(rt, i, transform.matrix[i]);
104779
+ auto operation = jsi::Object(rt);
104780
+ operation.setProperty(rt, "matrix", std::move(matrix));
104781
+ auto entries = jsi::Array(rt, 1);
104782
+ entries.setValueAtIndex(rt, 0, std::move(operation));
104783
+ props.setProperty(rt, "transform", std::move(entries));
104784
+ }
104785
+ }
104786
+ apply.call(rt, view.tag, std::move(props), std::move(layout));
104787
+ }
104788
+
104789
+ private:
104790
+ AppNode node(jsi::Runtime &rt, react::Tag tag) const {
104791
+ if (tag == surface_) {
104792
+ AppNode root;
104793
+ manager_->getShadowTreeRegistry().visit(surface_, [&](const react::ShadowTree &tree) {
104794
+ root = tree.getCurrentRevision().rootShadowNode;
104795
+ });
104796
+ if (root) return root;
104797
+ }
104798
+ auto found = nodes_.find(tag);
104799
+ if (found == nodes_.end()) throw jsi::JSError(rt, "Fabric view is absent from its committed surface");
104800
+ if (auto current = manager_->getNewestCloneOfShadowNode(*found->second)) return current;
104801
+ return found->second;
104802
+ }
104803
+
104804
+ std::shared_ptr<AppChildren> readChildren(jsi::Runtime &rt, const jsi::Array &values,
104805
+ std::unordered_map<react::Tag, AppNode> &next) const {
104806
+ auto children = std::make_shared<AppChildren>();
104807
+ children->reserve(values.size(rt));
104808
+ for (size_t i = 0; i < values.size(rt); ++i) {
104809
+ auto row = values.getValueAtIndex(rt, i).asObject(rt).asArray(rt);
104810
+ if (row.size(rt) != 5) throw jsi::JSError(rt, "invalid Fabric view in app commit");
104811
+ const auto tag = static_cast<react::Tag>(row.getValueAtIndex(rt, 0).asNumber());
104812
+ const auto component = row.getValueAtIndex(rt, 1).asString(rt).utf8(rt);
104813
+ const auto properties = row.getValueAtIndex(rt, 2);
104814
+ const auto instance = row.getValueAtIndex(rt, 3);
104815
+ auto descendants = readChildren(rt, row.getValueAtIndex(rt, 4).asObject(rt).asArray(rt), next);
104816
+ auto existing = nodes_.find(tag);
104817
+ AppNode view;
104818
+ if (existing == nodes_.end()) {
104819
+ auto initial = manager_->createNode(tag, component, surface_, react::RawProps(rt, properties),
104820
+ std::make_shared<react::InstanceHandle>(rt, instance, tag));
104821
+ for (const auto &child : *descendants) manager_->appendChild(initial, child);
104822
+ view = std::move(initial);
104823
+ } else {
104824
+ view = manager_->cloneNode(*existing->second, descendants, react::RawProps(rt, properties));
104825
+ }
104826
+ if (!next.emplace(tag, view).second) throw jsi::JSError(rt, "duplicate Fabric view tag in app commit");
104827
+ children->push_back(std::move(view));
104828
+ }
104829
+ return children;
104830
+ }
104831
+
104832
+ std::shared_ptr<react::UIManager> manager_;
104833
+ const react::ContextContainer &context_;
104834
+ react::SurfaceId surface_ = 0;
104835
+ react::LayoutConstraints constraints_;
104836
+ react::LayoutContext layout_;
104837
+ std::unordered_map<react::Tag, AppNode> nodes_;
104838
+ };
104839
+
104840
+ PeachAppSurfacePresenter *appSurfacePresenter;
104841
+ std::unique_ptr<PeachAppShadowTree> appShadowTree;
104842
+ std::optional<jsi::Function> appMountHandler;
104843
+ std::optional<jsi::Function> appPropsHandler;
104844
+ std::optional<jsi::Function> appCommandHandler;
104845
+ }
104846
+
104847
+ id peachAppSurfacePresenter() {
104848
+ return appSurfacePresenter;
104849
+ }
104850
+ `;
104851
+ FABRIC_APP_INSTALL = `
104852
+ react::RuntimeExecutor execute = [invoker = fabricInvoker](std::function<void(jsi::Runtime &)> &&work) {
104853
+ using RuntimeBlock = void (^)(jsi::Runtime &);
104854
+ if (const auto *block = work.target<RuntimeBlock>()) {
104855
+ // stack blocks need a copy before the executor can queue them.
104856
+ RuntimeBlock owned = (__bridge_transfer RuntimeBlock)_Block_copy((__bridge const void *)*block);
104857
+ work = [owned](jsi::Runtime &rt) { owned(rt); };
104858
+ }
104859
+ invoker->invokeAsync(std::move(work));
104860
+ };
104861
+ appSurfacePresenter = [[PeachAppSurfacePresenter alloc] initWithContextContainer:fabricContext
104862
+ runtimeExecutor:execute bridgelessBindingsExecutor:execute];
104863
+ appShadowTree = std::make_unique<PeachAppShadowTree>(appSurfacePresenter.scheduler.uiManager, *fabricContext);
104864
+ appSurfacePresenter.publishMount = [execute](const react::MountingTransaction &transaction) {
104865
+ execute([surface = transaction.getSurfaceId(), mutations = transaction.getMutations()](jsi::Runtime &rt) {
104866
+ if (appShadowTree && appMountHandler) {
104867
+ for (const auto &mutation : mutations) appShadowTree->publish(rt, mutation, *appMountHandler);
104868
+ [appSurfacePresenter.scheduler reportMount:surface];
104869
+ }
104870
+ });
104871
+ };
104872
+ appSurfacePresenter.publishProps = [execute](react::Tag tag, folly::dynamic props) {
104873
+ execute([tag, props = std::move(props)](jsi::Runtime &rt) {
104874
+ if (appPropsHandler) appPropsHandler->call(rt, tag, jsi::valueFromDynamic(rt, props));
104875
+ });
104876
+ };
104877
+ appSurfacePresenter.dispatchCommand = [execute](react::Tag tag, const std::string &name, const folly::dynamic &args) {
104878
+ execute([tag, name, args](jsi::Runtime &rt) {
104879
+ if (appCommandHandler) appCommandHandler->call(rt, tag, jsi::String::createFromUtf8(rt, name), jsi::valueFromDynamic(rt, args));
104880
+ });
104881
+ };
104882
+ `;
104883
+ FABRIC_APP_METHODS = `
104884
+ method("commitApp", 6, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
104885
+ appShadowTree->commit(rt, static_cast<react::SurfaceId>(args[0].asNumber()), args[1].asNumber(),
104886
+ args[2].asNumber(), args[3].asNumber(), args[4].getBool(), args[5].asObject(rt).asArray(rt));
104887
+ return jsi::Value::undefined();
104888
+ });
104889
+ method("setAppHandlers", 3, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
104890
+ appMountHandler = args[0].asObject(rt).asFunction(rt);
104891
+ appPropsHandler = args[1].asObject(rt).asFunction(rt);
104892
+ appCommandHandler = args[2].asObject(rt).asFunction(rt);
104893
+ return jsi::Value::undefined();
104894
+ });
104895
+ method("dispatchAppEvent", 3, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
104896
+ appShadowTree->dispatch(rt, static_cast<react::Tag>(args[0].asNumber()), args[1].asString(rt).utf8(rt), args[2]);
104897
+ return jsi::Value::undefined();
104898
+ });
104899
+ constexpr auto *shadowFactory = "peachCreateFabricShadowHandle";
104900
+ rt.global().setProperty(rt, shadowFactory, jsi::Function::createFromHostFunction(rt,
104901
+ jsi::PropNameID::forAscii(rt, shadowFactory), 3,
104902
+ [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
104903
+ return appShadowTree->handle(rt, static_cast<react::Tag>(args[0].asNumber()), args[1], args[2]);
104904
+ }));
104905
+ `;
104906
+ FABRIC_APP_TEARDOWN = `
104907
+ appShadowTree.reset();
104908
+ appMountHandler.reset();
104909
+ appPropsHandler.reset();
104910
+ appCommandHandler.reset();
104911
+ appSurfacePresenter = nil;
104912
+ `;
104913
+ }
104914
+ });
104915
+
104584
104916
  // src/turbo-source.ts
104585
104917
  function codegenSpecRoot(codegen) {
104586
104918
  const nested = import_node_path141.default.join(codegen, "ReactCodegen");
@@ -105763,6 +106095,7 @@ async function collectTurboSources(options2) {
105763
106095
  };
105764
106096
  let objc = Boolean(options2.reactNativeProvider);
105765
106097
  let fabric = Boolean(options2.reactNativeProvider);
106098
+ let appPresenter = false;
105766
106099
  const fabricPackages = /* @__PURE__ */ new Set();
105767
106100
  const fabricViews = [];
105768
106101
  let fabricTarget = null;
@@ -105900,6 +106233,11 @@ async function collectTurboSources(options2) {
105900
106233
  providerObjC = true;
105901
106234
  const stripped2 = stripComments2(text7);
105902
106235
  if (OBJC_TURBO.test(stripped2) || OBJC_BRIDGE.test(stripped2)) {
106236
+ if (/-\s*\(\s*void\s*\)\s*setSurfacePresenter\s*:/.test(stripped2)) {
106237
+ fabric = true;
106238
+ appPresenter = true;
106239
+ fabricTarget ??= { targetName, label, root: provider.root };
106240
+ }
105903
106241
  const registers2 = OBJC_REGISTERED.test(stripped2);
105904
106242
  for (const [, className2] of stripped2.matchAll(/@implementation\s+(\w+)/g))
105905
106243
  if (!managers.has(className2)) {
@@ -106355,7 +106693,7 @@ async function collectTurboSources(options2) {
106355
106693
  if (fabricPackages.has(owner))
106356
106694
  fabricViews.push({ name: name3, className: className2 });
106357
106695
  }
106358
- const hostTarget = (fabricViews.length > 0 ? fabricTarget : null) ?? (paperClasses.length > 0 ? paperTarget : null);
106696
+ const hostTarget = (fabricViews.length > 0 ? fabricTarget : null) ?? (paperClasses.length > 0 ? paperTarget : null) ?? (appPresenter ? fabricTarget : null);
106359
106697
  if (hostTarget) {
106360
106698
  result.fabricComponents = fabricViews.map(({ name: name3 }) => name3);
106361
106699
  result.paperViewManagers = [...new Set(paperClasses)].sort();
@@ -106389,7 +106727,7 @@ async function collectTurboSources(options2) {
106389
106727
  }
106390
106728
  }
106391
106729
  const unit2 = `${targetPath(hostTarget.targetName)}/PeachFabricHost.mm`;
106392
- add(unit2, fabricHostSource(fabricViews, result.paperViewManagers));
106730
+ add(unit2, fabricHostSource(fabricViews, result.paperViewManagers, appPresenter));
106393
106731
  scanText(
106394
106732
  { key: unit2, ...hostTarget, relative: "PeachFabricHost.mm" },
106395
106733
  result.files[unit2]
@@ -106827,6 +107165,7 @@ RCT_EXPORT_METHOD(load:(NSString *)uri
106827
107165
  extern "C" void RCTRegisterModule(Class);
106828
107166
  static PeachTurboModuleDelegate *delegate;
106829
107167
  static RCTTurboModuleManager *manager;
107168
+ id peachAppSurfacePresenter() __attribute__((weak));
106830
107169
 
106831
107170
  @implementation PeachTurboModuleDelegate
106832
107171
 
@@ -106851,6 +107190,9 @@ static RCTTurboModuleManager *manager;
106851
107190
  - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
106852
107191
  {
106853
107192
  id<RCTTurboModule> module = [moduleClass new];
107193
+ if (peachAppSurfacePresenter && [module respondsToSelector:@selector(setSurfacePresenter:)]) {
107194
+ [module performSelector:@selector(setSurfacePresenter:) withObject:peachAppSurfacePresenter()];
107195
+ }
106854
107196
  if ([module respondsToSelector:@selector(setDispatchToJSThread:)])
106855
107197
  ((id<RCTJSDispatcherModule>)module).dispatchToJSThread = ^(dispatch_block_t block) {
106856
107198
  dispatchToJSThread(block);
@@ -106926,8 +107268,8 @@ ${hasEventDispatcher ? " if (![RCTGetModuleClasses() containsObject:[RCTEventDi
106926
107268
  auto& runtime = peach::jsi_runtime::create(
106927
107269
  [] { invoker->drain(); },
106928
107270
  [] {
106929
- if (peachTeardownFabricViews) peachTeardownFabricViews();
106930
107271
  [manager invalidate];
107272
+ if (peachTeardownFabricViews) peachTeardownFabricViews();
106931
107273
  manager = nil;
106932
107274
  delegate = nil;
106933
107275
  invoker.reset();
@@ -107033,12 +107375,13 @@ ${moduleProviders ? " [found addObjectsFromArray:RCTModuleProviders.moduleProvi
107033
107375
  }
107034
107376
  `;
107035
107377
  }
107036
- function fabricHostSource(views, paperClasses) {
107378
+ function fabricHostSource(views, paperClasses, appPresenter) {
107037
107379
  const entries2 = views.map(
107038
107380
  ({ name: name3, className: className2 }) => `@${JSON.stringify(name3)}: NSClassFromString(@${JSON.stringify(className2)})`
107039
107381
  ).join(", ");
107040
107382
  const paper = paperClasses.length > 0;
107041
- return `${FABRIC_HOST_INCLUDES}${paper ? FABRIC_HOST_PAPER_INCLUDES : ""}
107383
+ return `${FABRIC_HOST_INCLUDES}${paper ? FABRIC_HOST_PAPER_INCLUDES : ""}${appPresenter ? FABRIC_APP_INCLUDES : ""}
107384
+ ${appPresenter ? FABRIC_APP_PRESENTER : ""}
107042
107385
  @interface PeachFabricComponents : NSObject <RCTComponentViewFactoryComponentProvider>
107043
107386
  @end
107044
107387
 
@@ -107778,7 +108121,8 @@ static void peachEventDispatcherDispatchEvent(id self, SEL _cmd, id<RCTEvent> ev
107778
108121
  NSNumber *reactTag = event.viewTag;
107779
108122
  if (!reactTag) return;
107780
108123
  auto found = fabricViews.find(reactTag.intValue);
107781
- if (found == fabricViews.end() || !found->second.family) return;
108124
+ if (found == fabricViews.end() || !found->second.family ||
108125
+ !dynamic_cast<const react::LegacyViewManagerInteropComponentDescriptor *>(found->second.descriptor)) return;
107782
108126
  NSArray *args = [event arguments];
107783
108127
  NSString *eventName = args.count >= 2 && [args[1] isKindOfClass:[NSString class]]
107784
108128
  ? args[1]
@@ -108058,6 +108402,7 @@ ${paper ? ` // Register missing Objective-C selectors on UIKit/QuartzCore class
108058
108402
  std::weak_ptr<react::EventLogger>());
108059
108403
  react::ComponentDescriptorParameters parameters{fabricDispatcher, fabricContext, nullptr};
108060
108404
  fabricDescriptors = [factory createComponentDescriptorRegistryWithParameters:parameters];
108405
+ ${appPresenter ? FABRIC_APP_INSTALL : ""}
108061
108406
  auto views = jsi::Object(rt);
108062
108407
  auto method = [&](const char *name, unsigned count, jsi::HostFunctionType body) {
108063
108408
  views.setProperty(
@@ -108082,6 +108427,7 @@ ${paper ? ` // Register missing Objective-C selectors on UIKit/QuartzCore class
108082
108427
  }
108083
108428
  }));
108084
108429
  };
108430
+ ${appPresenter ? FABRIC_APP_METHODS : ""}
108085
108431
  // create(name, instanceHandle, props), Create then Insert: the family the
108086
108432
  // handle's events resolve through, the first props, the initial state, and
108087
108433
  // the layout the view has before the engine measures it
@@ -108442,6 +108788,7 @@ void peachTeardownFabricViews() {
108442
108788
  fabricFocusParentTag = 0;
108443
108789
  fabricOwner.reset();
108444
108790
  fabricEventHandler.reset();
108791
+ ${appPresenter ? FABRIC_APP_TEARDOWN : ""}
108445
108792
  }
108446
108793
 
108447
108794
  extern "C" void *peach_fabric_view_content(int tag) {
@@ -108473,6 +108820,7 @@ var init_turbo_source = __esm({
108473
108820
  init_swift_source_file();
108474
108821
  init_swiftContract();
108475
108822
  init_turbo_codegen_intake();
108823
+ init_turbo_fabric_app();
108476
108824
  init_xcode_project();
108477
108825
  TURBO_CORE_TARGET = "TurboCore";
108478
108826
  TURBO_FMT_TARGET = "TurboFmt";
@@ -108732,6 +109080,7 @@ using namespace facebook;
108732
109080
  #import <React/RCTUIManager.h>
108733
109081
  #import <React/RCTUtils.h>
108734
109082
  #import <React/RCTViewManager.h>
109083
+ #include <react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h>
108735
109084
  #include <react/renderer/components/view/ViewEventEmitter.h>
108736
109085
  #include <react/renderer/core/ShadowNodeFragment.h>
108737
109086
  #include <react/utils/FollyConvert.h>
@@ -109984,7 +110333,7 @@ var init_react_native_core = __esm({
109984
110333
  init_swift_distribution();
109985
110334
  init_swift_package();
109986
110335
  init_swiftContract();
109987
- recipe = true ? "29f49a22e10d2e4d7a095ce3ceb7254c31c8822728d7410046b1d52b7be94ecd" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
110336
+ recipe = true ? "32fd4cb91d846dff44d3a53361a8b93d320b064cfdcfc0b760c1861bc7f53cea" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
109988
110337
  strings4 = (value) => isRecord(value) && Object.values(value).every((item) => typeof item === "string");
109989
110338
  building = /* @__PURE__ */ new Map();
109990
110339
  }
@@ -112612,11 +112961,11 @@ ${diagnostics}`}`
112612
112961
  }
112613
112962
  return true;
112614
112963
  }
112615
- var import_node_async_hooks3, import_node_child_process71, import_node_crypto88, import_node_fs144, import_node_module20, import_node_os31, import_node_path146, import_node_url7, import_node_util19, run12, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, WITNESS_BATCH, traceStore, discoveryCache, preparedCache, savedFs, ignoredRoots, ownTemporaryRoots, EXPO_MODULE_SCAN_TIMEOUT_MS, preparedExpoSwift, openPreparations, ExpoSwiftLinkRefusal;
112964
+ var import_node_async_hooks4, import_node_child_process71, import_node_crypto88, import_node_fs144, import_node_module20, import_node_os31, import_node_path146, import_node_url7, import_node_util19, run12, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, WITNESS_BATCH, traceStore, discoveryCache, preparedCache, savedFs, ignoredRoots, ownTemporaryRoots, EXPO_MODULE_SCAN_TIMEOUT_MS, preparedExpoSwift, openPreparations, ExpoSwiftLinkRefusal;
112616
112965
  var init_expo_swift_host = __esm({
112617
112966
  "src/expo-swift-host.ts"() {
112618
112967
  "use strict";
112619
- import_node_async_hooks3 = require("node:async_hooks");
112968
+ import_node_async_hooks4 = require("node:async_hooks");
112620
112969
  import_node_child_process71 = require("node:child_process");
112621
112970
  import_node_crypto88 = require("node:crypto");
112622
112971
  import_node_fs144 = __toESM(require("node:fs"), 1);
@@ -112659,7 +113008,7 @@ var init_expo_swift_host = __esm({
112659
113008
  EXPO_SWIFT_ROUTE = "/__peach/expo-swift";
112660
113009
  EXPO_SWIFT_ENTRY = "Sources/PeachExpoApp/PeachExpoEntry.swift";
112661
113010
  WITNESS_BATCH = 200;
112662
- traceStore = new import_node_async_hooks3.AsyncLocalStorage();
113011
+ traceStore = new import_node_async_hooks4.AsyncLocalStorage();
112663
113012
  discoveryCache = /* @__PURE__ */ new Map();
112664
113013
  preparedCache = /* @__PURE__ */ new Map();
112665
113014
  savedFs = null;
@@ -116687,11 +117036,11 @@ async function handleStagedHostFileRequest(req, res) {
116687
117036
  throw error;
116688
117037
  }
116689
117038
  }
116690
- var import_node_async_hooks4, import_node_crypto90, import_node_fs152, import_node_path154, stagedCapture, STAGED_PREFIX, STAGED_NAME, METRO_INDEX_NAME, STAGED_RETENTION_MS;
117039
+ var import_node_async_hooks5, import_node_crypto90, import_node_fs152, import_node_path154, stagedCapture, STAGED_PREFIX, STAGED_NAME, METRO_INDEX_NAME, STAGED_RETENTION_MS;
116691
117040
  var init_staged_host_files = __esm({
116692
117041
  "src/host/staged-host-files.ts"() {
116693
117042
  "use strict";
116694
- import_node_async_hooks4 = require("node:async_hooks");
117043
+ import_node_async_hooks5 = require("node:async_hooks");
116695
117044
  import_node_crypto90 = require("node:crypto");
116696
117045
  import_node_fs152 = __toESM(require("node:fs"), 1);
116697
117046
  import_node_path154 = __toESM(require("node:path"), 1);
@@ -116701,7 +117050,7 @@ var init_staged_host_files = __esm({
116701
117050
  init_launchMetadataContract();
116702
117051
  init_runtime_assets();
116703
117052
  init_app_package_handler();
116704
- stagedCapture = new import_node_async_hooks4.AsyncLocalStorage();
117053
+ stagedCapture = new import_node_async_hooks5.AsyncLocalStorage();
116705
117054
  STAGED_PREFIX = "/__peach/staged/";
116706
117055
  STAGED_NAME = /^([a-f0-9]{64})(\.[a-z0-9]{1,10})?$/;
116707
117056
  METRO_INDEX_NAME = /^metro-([a-f0-9]{64})$/;
@@ -123797,7 +124146,7 @@ var init_nitro_superset = __esm({
123797
124146
  init_nitroContract();
123798
124147
  init_swift_standin_digest();
123799
124148
  NITRO_SUPERSET_ENTRY_NAME = "superset";
123800
- NITRO_COMPILER_DIGEST = true ? "ada2143c6294cf2d8494a1eda33c2dc999201e3cba407e31a601d1a3655c911b" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
124149
+ NITRO_COMPILER_DIGEST = true ? "778407e61286034d6ed55be5fcb9b0f2902174b4539a50a46d1cb522ad8b7082" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
123801
124150
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
123802
124151
  nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
123803
124152
  published3 = /* @__PURE__ */ new Map();
@@ -124920,11 +125269,11 @@ var init_shared_session = __esm({
124920
125269
  function peachExit(code, reason) {
124921
125270
  throw new PeachExit(code, reason);
124922
125271
  }
124923
- var import_node_async_hooks5, PeachExit, sinks, rnxExit;
125272
+ var import_node_async_hooks6, PeachExit, sinks, rnxExit;
124924
125273
  var init_run_rnx = __esm({
124925
125274
  "cli/run-rnx.ts"() {
124926
125275
  "use strict";
124927
- import_node_async_hooks5 = require("node:async_hooks");
125276
+ import_node_async_hooks6 = require("node:async_hooks");
124928
125277
  PeachExit = class extends Error {
124929
125278
  code;
124930
125279
  reason;
@@ -124935,7 +125284,7 @@ var init_run_rnx = __esm({
124935
125284
  this.reason = reason;
124936
125285
  }
124937
125286
  };
124938
- sinks = new import_node_async_hooks5.AsyncLocalStorage();
125287
+ sinks = new import_node_async_hooks6.AsyncLocalStorage();
124939
125288
  rnxExit = peachExit;
124940
125289
  }
124941
125290
  });