peachsim 0.1.2300 → 0.1.2301

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 (99) hide show
  1. package/cli/commands/control.ts +1 -0
  2. package/cli/commands/shell-url.ts +5 -0
  3. package/dist-lib/agent-daemon-client.cjs +1 -1
  4. package/dist-lib/agent-events.cjs +1 -1
  5. package/dist-lib/attached-projects.cjs +1 -1
  6. package/dist-lib/auth/shared-session.cjs +1 -1
  7. package/dist-lib/backend-origin.cjs +1 -1
  8. package/dist-lib/beta.cjs +1 -1
  9. package/dist-lib/beta.mjs +1 -1
  10. package/dist-lib/bridge-constants.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.mjs +1 -1
  13. package/dist-lib/bridge-contract.cjs +1 -1
  14. package/dist-lib/bridge-contract.mjs +1 -1
  15. package/dist-lib/bundle-channel.cjs +307 -68
  16. package/dist-lib/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +1 -1
  18. package/dist-lib/cloud-contract.cjs +1 -1
  19. package/dist-lib/cloud-contract.mjs +1 -1
  20. package/dist-lib/cloud-test-args.cjs +1 -1
  21. package/dist-lib/cloud-test-args.mjs +1 -1
  22. package/dist-lib/cloud.cjs +1 -1
  23. package/dist-lib/cloud.mjs +1 -1
  24. package/dist-lib/config.cjs +1 -1
  25. package/dist-lib/config.mjs +1 -1
  26. package/dist-lib/detox/index.cjs +2 -1
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/expo-swift-bundle.cjs +306 -67
  29. package/dist-lib/expo-swift-metadata.cjs +1 -1
  30. package/dist-lib/expo-swift-metadata.mjs +1 -1
  31. package/dist-lib/home-paths.cjs +1 -1
  32. package/dist-lib/host/bridge-host.cjs +2523 -71
  33. package/dist-lib/host/fetch-proxy-handler.cjs +5 -5
  34. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  35. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  36. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  37. package/dist-lib/host/websocket-proxy.cjs +1 -1
  38. package/dist-lib/index.cjs +13 -8
  39. package/dist-lib/jump-to-source-babel.cjs +1 -1
  40. package/dist-lib/jump-to-source-native.cjs +1 -1
  41. package/dist-lib/kotlin-host.cjs +1 -1
  42. package/dist-lib/menu.cjs +1 -1
  43. package/dist-lib/menu.mjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  46. package/dist-lib/metro-production-bundle.cjs +1 -1
  47. package/dist-lib/metro-production-bundle.mjs +1 -1
  48. package/dist-lib/metro.cjs +12 -8
  49. package/dist-lib/native-app-identity-project.cjs +9 -5
  50. package/dist-lib/native-app-identity-project.mjs +9 -5
  51. package/dist-lib/native-app-identity.cjs +1 -1
  52. package/dist-lib/native-app-identity.mjs +1 -1
  53. package/dist-lib/native-firebase-metadata.cjs +1 -1
  54. package/dist-lib/native-firebase-metadata.mjs +1 -1
  55. package/dist-lib/pdfium-raster.cjs +1 -1
  56. package/dist-lib/pdfium-raster.mjs +1 -1
  57. package/dist-lib/plist.cjs +1 -1
  58. package/dist-lib/plist.mjs +1 -1
  59. package/dist-lib/profiles.cjs +1 -1
  60. package/dist-lib/public-brand.cjs +1 -1
  61. package/dist-lib/public-origins-lib-esm.json +24 -24
  62. package/dist-lib/public-origins-lib.json +56 -53
  63. package/dist-lib/react-native-host-modules.cjs +1 -1
  64. package/dist-lib/react-native-host-modules.mjs +1 -1
  65. package/dist-lib/reap-browser.cjs +1 -1
  66. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  67. package/dist-lib/sdk.cjs +2 -1
  68. package/dist-lib/sdk.mjs +2 -1
  69. package/dist-lib/skills.cjs +368 -78
  70. package/dist-lib/swift-compile.cjs +15 -7
  71. package/dist-lib/swift-compile.mjs +15 -7
  72. package/dist-lib/swift-package.cjs +1 -1
  73. package/dist-lib/swift-package.mjs +1 -1
  74. package/dist-lib/swift-submit.cjs +1 -1
  75. package/dist-lib/swift-submit.mjs +1 -1
  76. package/dist-lib/swift-toolchain.cjs +1 -1
  77. package/dist-lib/swift.cjs +1 -1
  78. package/dist-lib/vite-swift.cjs +23 -11
  79. package/dist-lib/vite.cjs +5 -5
  80. package/dist-lib/worklet-executable.cjs +1 -1
  81. package/dist-lib/worklet-executable.mjs +1 -1
  82. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -0
  83. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +2 -0
  84. package/dist-types/packages/peach-engine/src/render-worker/activitykit-activityContract.d.ts +17 -0
  85. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +1 -0
  86. package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +4 -0
  87. package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +3 -1
  88. package/package.json +1 -1
  89. package/src/expo-discovery-cache.ts +6 -6
  90. package/src/expo-swift-host.ts +19 -4
  91. package/src/host/bridge-host.ts +9 -0
  92. package/src/launchMetadataContract.ts +1 -0
  93. package/src/swift-guest-compile.ts +19 -3
  94. package/src/swift-guest-source-plan.ts +7 -2
  95. package/src/swiftContract.ts +3 -0
  96. package/src/turbo-compile.ts +60 -4
  97. package/src/turbo-source.ts +239 -35
  98. package/src/widget-extension-bundle.ts +48 -0
  99. package/src/xcode-project.ts +22 -3
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2300 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2301 | (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;
@@ -5842,6 +5842,8 @@ var init_supported_native_packages = __esm({
5842
5842
  // seam
5843
5843
  "@stripe/stripe-terminal-react-native",
5844
5844
  // seam
5845
+ "@swan-io/react-native-browser",
5846
+ // seam
5845
5847
  "@swmansion/react-native-bottom-sheet",
5846
5848
  // seam
5847
5849
  "@thehale/react-native-keep-awake",
@@ -5853,7 +5855,7 @@ var init_supported_native_packages = __esm({
5853
5855
  "@use-voltra/android-client",
5854
5856
  // seam
5855
5857
  "@use-voltra/ios-client",
5856
- // seam
5858
+ // compiled-turbo
5857
5859
  "@vonovak/react-native-theme-control",
5858
5860
  // seam
5859
5861
  "@walletconnect/react-native-compat",
@@ -9670,9 +9672,9 @@ var init_registry = __esm({
9670
9672
  {
9671
9673
  range: ">=0.1.0",
9672
9674
  coverage: 0.8,
9673
- note: "upstream package JS runs unchanged against RNSwanBrowser native module backed by window.open",
9674
- working: "TurboModuleRegistry RNSwanBrowser provides open/close, listener bookkeeping, popup URL opening; upstream openBrowser/closeBrowser/processColor/onClose wrapper stays in the app bundle",
9675
- missing: "real SFSafariViewController/Chrome Custom Tabs UI, native modal transition behavior, Custom Tabs package selection/fallbacks, OS-level user dismissal detection"
9675
+ note: "iOS compiles the packages own RNSwanBrowser.mm and Swift and the unchanged JS runs over it; Android answers from a window.open seam",
9676
+ working: "iOS: the compiled module validates the URL, rejects a second open while presented and emits swanBrowserOnClose; Android: the seam opens the URL as a popup, closes it and emits swanBrowserOnClose",
9677
+ missing: "Android Chrome Custom Tabs UI, package selection and OS-level dismissal detection: the seam is a popup and Android native intake is paused"
9676
9678
  }
9677
9679
  ]
9678
9680
  },
@@ -20513,10 +20515,10 @@ var init_registry = __esm({
20513
20515
  versions: [
20514
20516
  {
20515
20517
  range: ">=2.4.0 <2.5.0",
20516
- coverage: 0.8,
20517
- note: "native-seam only \u2014 upstream JS (live-activity/dynamic/widget apis, events, preload) runs from the bundle; the NativeVoltra TurboModule mirrors the ios native module lifecycle, guards, brotli payload budget, widget stores, and event payloads",
20518
- working: "start/update/end/endAll with name-keyed lookup and same-name replacement, latest/list/isActive in creation order, reloadLiveActivities, zero-definition dynamic behavior (unknownDefinition rejects, size validation first), isHeadless false, stateChange active/ended/dismissed payloads, exact reject codes and messages, in-memory widget stores with server-update validator strings, credentials store/clear, real image preload with native failure strings",
20519
- missing: "no Lock Screen / Dynamic Island rendering host or VoltraView rendering, no push token delivery (guest carries no push plist key), no home-screen widgets (getActiveWidgets empty), no cross-restart persistence"
20518
+ coverage: 0.5,
20519
+ note: "iOS compiles the package's own Swift and Objective-C++ (Voltra.podspec) as a TurboModule and Fabric component; the unchanged JS runs over it",
20520
+ working: "VoltraView paints its SwiftUI through the Fabric component host; live activity payloads brotli-compress byte-identically to Apple Compression; ActivityKit request, update, end and activity lists follow the measured iOS 27 rules",
20521
+ missing: "Lock Screen, Dynamic Island and home-screen widget presentation; SVG preloads hang because a snapshot of a WKWebView that was never in a window gets no reply"
20520
20522
  }
20521
20523
  ]
20522
20524
  },
@@ -37636,7 +37638,7 @@ var swiftCoverageProvenance;
37636
37638
  var init_provenance = __esm({
37637
37639
  "src/swift-coverage/provenance.ts"() {
37638
37640
  "use strict";
37639
- 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":"65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa","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":"f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c","swift-coverage/reader.ts":"da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"bfde06f157f52d3dd76577b3c6059c95c0393180b054ced773624ea89558992b","swift-package.ts":"338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb","swift-source-file.ts":"93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94","swift-toolchain.ts":"b60efa4eb7516378344cb7c48216aea5fa36590ace91a698655b48cfd0db96fe","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"f8c3d557b4eca5ddad32907545353eb7ad53b2ebd0969d9ed8f7275e109a13b1","xcode-project.ts":"96a57d4b999e75658683d635d3522d6c7ae30b4c8bc38a8114af353bce5162ff","xcode-target-members.ts":"2f25aaf5a3aa34395983c75935491c06bd68554c47ff1cb06b49c79499c03db0","xcode-json-project.ts":"41990ebbe4b488eef34e74c4608b4b48e5a5b299ba98ca7fbcfdfa0e77be63b6","openstep-plist.ts":"74e6ce1dac80c9c318e0e9f5e3e8cd19a898a8820c36fc160609695bcb59dcd3"}') : swiftCoverageSourceDigests((0, import_node_path.join)(__sootsim_import_meta_dirname, ".."));
37641
+ 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":"65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa","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":"f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c","swift-coverage/reader.ts":"da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"bfde06f157f52d3dd76577b3c6059c95c0393180b054ced773624ea89558992b","swift-package.ts":"338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb","swift-source-file.ts":"93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94","swift-toolchain.ts":"b60efa4eb7516378344cb7c48216aea5fa36590ace91a698655b48cfd0db96fe","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"f8c3d557b4eca5ddad32907545353eb7ad53b2ebd0969d9ed8f7275e109a13b1","xcode-project.ts":"f0e86caccf203fa58395cbac9fed64577bb98a061efdf24f85a289c4e5996db9","xcode-target-members.ts":"2f25aaf5a3aa34395983c75935491c06bd68554c47ff1cb06b49c79499c03db0","xcode-json-project.ts":"41990ebbe4b488eef34e74c4608b4b48e5a5b299ba98ca7fbcfdfa0e77be63b6","openstep-plist.ts":"74e6ce1dac80c9c318e0e9f5e3e8cd19a898a8820c36fc160609695bcb59dcd3"}') : swiftCoverageSourceDigests((0, import_node_path.join)(__sootsim_import_meta_dirname, ".."));
37640
37642
  }
37641
37643
  });
37642
37644
 
@@ -51035,8 +51037,8 @@ function swiftPackageLinkage(target) {
51035
51037
  function guestSourceImages(graph) {
51036
51038
  const targets = new Map(graph.targets.map((target) => [target.id, target]));
51037
51039
  const entry = targets.get(graph.entry);
51038
- if (!entry || entry.productType !== "com.apple.product-type.application")
51039
- throw new Error("source graph has no application entry");
51040
+ if (!entry || entry.productType !== "com.apple.product-type.application" && entry.productType !== "com.apple.product-type.app-extension")
51041
+ throw new Error("source graph has no application or app extension entry");
51040
51042
  const images = [
51041
51043
  { id: 0, owner: entry.id, members: [] }
51042
51044
  ];
@@ -53549,6 +53551,12 @@ async function compileGuestLink(options) {
53549
53551
  (target) => target.productName.endsWith(".framework") ? [target.productName.slice(0, -10)] : []
53550
53552
  )
53551
53553
  );
53554
+ const sourceLibraries = new Set(
53555
+ options.graph.targets.flatMap((target) => {
53556
+ const library = /^lib(.+)\.(?:a|dylib)$/.exec(target.productName);
53557
+ return library ? [library[1]] : [];
53558
+ })
53559
+ );
53552
53560
  const entry = targets.get(options.graph.entry);
53553
53561
  if (!entry) throw new Error("guest source graph has no entry");
53554
53562
  const imageBuildVersion = (value) => {
@@ -53718,10 +53726,12 @@ async function compileGuestLink(options) {
53718
53726
  images: sourceImages.map((image) => ({
53719
53727
  id: image.id,
53720
53728
  objects: selectedSource.filter((artifact) => artifact.image === image.id).map((artifact) => artifact.path),
53721
- // a `-framework Name` for a framework the source graph builds links
53722
- // that framework's own image, which the plan already depends on
53729
+ // a `-framework Name` or `-lname` for a product the source graph
53730
+ // builds links that product's own target, which the plan already holds
53723
53731
  linkerFlags: image.members.flatMap((id) => targets.get(id).linkerFlags).filter(
53724
- (flag, index, flags) => !sourceFrameworks.has(flags[index - 1] === "-framework" ? flag : "") && !(flag === "-framework" && sourceFrameworks.has(flags[index + 1] ?? ""))
53732
+ (flag, index, flags) => !sourceFrameworks.has(flags[index - 1] === "-framework" ? flag : "") && !(flag === "-framework" && sourceFrameworks.has(flags[index + 1] ?? "")) && !sourceLibraries.has(
53733
+ flag.startsWith("-l") && flag.length > 2 ? flag.slice(2) : flags[index - 1] === "-l" ? flag : ""
53734
+ ) && !(flag === "-l" && sourceLibraries.has(flags[index + 1] ?? ""))
53725
53735
  ),
53726
53736
  clangLinkOptions: selectedSource.filter((artifact) => artifact.image === image.id).map((artifact) => ({
53727
53737
  object: import_node_path42.default.resolve(rewritten.get(artifact.path) ?? artifact.path),
@@ -59871,7 +59881,7 @@ int EXUpdatesApplyBSDiffPatch(const char * _Nonnull oldFilePath,
59871
59881
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
59872
59882
  MULTI_MANIFEST_VERSION = 68;
59873
59883
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
59874
- compilerSourceDigest = true ? "3c645ce8a5442f60dce1735912506ad6fa5d09cb92da26cff3950c374b371e2b" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
59884
+ compilerSourceDigest = true ? "ad311d7f868d4920f32f2ed00502f49f84fb83ae19817180a70ef5f799334169" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
59875
59885
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
59876
59886
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
59877
59887
  cxxFlagArray = (flags) => JSON.stringify([...nativeCxxCompilerFlags, ...withoutGlogModuleMap(flags)]);
@@ -62958,7 +62968,7 @@ function defaultXcodeAppTarget(xcodeproj) {
62958
62968
  function readXcodeExtensionTargets(input) {
62959
62969
  return workspaceProjects(import_node_fs58.default.realpathSync.native(input)).projects.flatMap(
62960
62970
  (project2) => projectTargets(project2).flatMap((ref) => {
62961
- if (ref.target.productType !== "com.apple.product-type.app-extension") return [];
62971
+ if (ref.target.productType !== APP_EXTENSION) return [];
62962
62972
  const name3 = str(ref.target.name) ?? ref.id;
62963
62973
  const { get, keys, xcconfigs } = targetSettings(
62964
62974
  ref,
@@ -63155,7 +63165,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
63155
63165
  options.installedPods
63156
63166
  );
63157
63167
  const allTargets = projects2.flatMap(projectTargets);
63158
- const appTargets = allTargets.filter((ref) => isIosAppTarget(ref, options));
63168
+ const appTargets = allTargets.filter(
63169
+ (ref) => isIosAppTarget(ref, options) || targetName !== void 0 && ref.target.name === targetName && ref.target.productType === APP_EXTENSION
63170
+ );
63159
63171
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
63160
63172
  const container = import_node_path55.default.basename(xcodeprojOrWorkspace);
63161
63173
  const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
@@ -63219,7 +63231,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
63219
63231
  const words2 = settingList(flags);
63220
63232
  const linked = new Set(linkedTargets(ref).map((link) => link.target));
63221
63233
  return words2.flatMap((word, index) => {
63222
- const target = words2[index - 1] === "-framework" ? byProduct.get(`${word}.framework`) : void 0;
63234
+ const library = word.startsWith("-l") && word.length > 2 ? word.slice(2) : words2[index - 1] === "-l" ? word : void 0;
63235
+ const target = words2[index - 1] === "-framework" ? byProduct.get(`${word}.framework`) : library ? byProduct.get(`lib${library}.a`) ?? byProduct.get(`lib${library}.dylib`) : void 0;
63223
63236
  if (!target || target === ref || linked.has(target)) return [];
63224
63237
  linked.add(target);
63225
63238
  return [{ target, attributes: [] }];
@@ -64221,7 +64234,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
64221
64234
  cocoapods
64222
64235
  };
64223
64236
  }
64224
- var import_node_child_process34, import_node_crypto27, import_node_fs58, import_node_path55, import_plist2, XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET, runScriptTimeoutMs, CXX_STANDARD_ALIASES, PRE_CXX20_STANDARDS, APPLICATION, RESOURCE_BUNDLE, PRODUCT_MACH_O_TYPES, FRAMEWORK_PRODUCTS, HEADER_FILE, MODULE_PRODUCTS, CONDITIONS, isDirectory, loaded, developerDir, preparedSourcePhases, isPodsProject, targetRefs, NativeAppTargetSelectionError, workspaceResolvedFile, SwiftPackageResolutionRequired;
64237
+ var import_node_child_process34, import_node_crypto27, import_node_fs58, import_node_path55, import_plist2, XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET, runScriptTimeoutMs, CXX_STANDARD_ALIASES, PRE_CXX20_STANDARDS, APPLICATION, APP_EXTENSION, RESOURCE_BUNDLE, PRODUCT_MACH_O_TYPES, FRAMEWORK_PRODUCTS, HEADER_FILE, MODULE_PRODUCTS, CONDITIONS, isDirectory, loaded, developerDir, preparedSourcePhases, isPodsProject, targetRefs, NativeAppTargetSelectionError, workspaceResolvedFile, SwiftPackageResolutionRequired;
64225
64238
  var init_xcode_project = __esm({
64226
64239
  "src/xcode-project.ts"() {
64227
64240
  "use strict";
@@ -64260,6 +64273,7 @@ var init_xcode_project = __esm({
64260
64273
  "compiler-default"
64261
64274
  ]);
64262
64275
  APPLICATION = "com.apple.product-type.application";
64276
+ APP_EXTENSION = "com.apple.product-type.app-extension";
64263
64277
  RESOURCE_BUNDLE = "com.apple.product-type.bundle";
64264
64278
  PRODUCT_MACH_O_TYPES = {
64265
64279
  "com.apple.product-type.application": "mh_execute",
@@ -65990,7 +66004,7 @@ async function expoDiscoveryKey(options) {
65990
66004
  const key2 = (0, import_node_crypto33.createHash)("sha256").update(`${peachPin()}\0${hash}\0`).update(`${stable2(JSON.parse(options.searchText))}\0`).update(`${stable2(options.configuration)}\0`).update(stable2(JSON.parse(options.resolveText))).digest("hex");
65991
66005
  return { key: key2, root };
65992
66006
  }
65993
- function sharedDir() {
66007
+ function expoDiscoveryCacheDir() {
65994
66008
  return import_node_path63.default.join(sharedCacheDir(import_node_path63.default.join(ambientHomeDir(), "cache")), "expo-discovery");
65995
66009
  }
65996
66010
  function vanished2(error) {
@@ -66027,7 +66041,7 @@ function isStoredUnit(value) {
66027
66041
  }
66028
66042
  function readExpoDiscovery(key2) {
66029
66043
  let parsed;
66030
- const record4 = import_node_path63.default.join(sharedDir(), `${key2}.json`);
66044
+ const record4 = import_node_path63.default.join(expoDiscoveryCacheDir(), `${key2}.json`);
66031
66045
  try {
66032
66046
  parsed = JSON.parse(import_node_fs66.default.readFileSync(record4, "utf8"));
66033
66047
  } catch {
@@ -66056,7 +66070,7 @@ function readExpoDiscovery(key2) {
66056
66070
  const read = (digest3) => {
66057
66071
  const known = blobs.get(digest3);
66058
66072
  if (known !== void 0) return known;
66059
- const blob = import_node_path63.default.join(sharedDir(), "blobs", digest3);
66073
+ const blob = import_node_path63.default.join(expoDiscoveryCacheDir(), "blobs", digest3);
66060
66074
  const body = import_node_fs66.default.readFileSync(blob, "utf8");
66061
66075
  if ((0, import_node_crypto33.createHash)("sha256").update(body).digest("hex") !== digest3)
66062
66076
  throw new Error("discovery blob differs from its digest");
@@ -66100,7 +66114,7 @@ function readExpoDiscovery(key2) {
66100
66114
  }
66101
66115
  }
66102
66116
  function fileHashesPath() {
66103
- return import_node_path63.default.join(sharedDir(), "framework-file-hashes.json");
66117
+ return import_node_path63.default.join(expoDiscoveryCacheDir(), "framework-file-hashes.json");
66104
66118
  }
66105
66119
  function stampedFileHash(file) {
66106
66120
  if (!fileHashesLoaded) {
@@ -66278,7 +66292,7 @@ function rewritePreparedPaths(options) {
66278
66292
  frameworkDependencies[sourceDir] = sourceDigest;
66279
66293
  let portableDir = sourceDir;
66280
66294
  if (preparedDigest !== sourceDigest) {
66281
- const parent = import_node_path63.default.join(sharedDir(), "frameworks", preparedDigest);
66295
+ const parent = import_node_path63.default.join(expoDiscoveryCacheDir(), "frameworks", preparedDigest);
66282
66296
  portableDir = import_node_path63.default.join(parent, import_node_path63.default.basename(dir));
66283
66297
  if (!import_node_fs66.default.existsSync(portableDir)) {
66284
66298
  import_node_fs66.default.mkdirSync(parent, { recursive: true });
@@ -66309,7 +66323,7 @@ function rewritePreparedPaths(options) {
66309
66323
  }
66310
66324
  function writeExpoDiscovery(options) {
66311
66325
  try {
66312
- const dir = sharedDir();
66326
+ const dir = expoDiscoveryCacheDir();
66313
66327
  import_node_fs66.default.mkdirSync(dir, { recursive: true });
66314
66328
  const tmp = import_node_path63.default.join(dir, `.${options.key}.${process.pid}.${(0, import_node_crypto33.randomUUID)()}.tmp`);
66315
66329
  if (options.units === null) {
@@ -66505,7 +66519,7 @@ var init_swift_standin_digest = __esm({
66505
66519
  STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
66506
66520
  SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
66507
66521
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
66508
- STANDIN_SOURCE_DIGEST = true ? "8a800a5151c426f07ff690c34df9a6d538c005318051ef52635fc568c44736f6" : standinSourceDigest();
66522
+ STANDIN_SOURCE_DIGEST = true ? "7dd2fef3ceef6be07d22cfa2f397bda7721d34bc2ef8764f78e05b9637849f09" : standinSourceDigest();
66509
66523
  }
66510
66524
  });
66511
66525
 
@@ -66984,7 +66998,7 @@ __export(expo_native_prebuilt_exports, {
66984
66998
  servedExpoSwift: () => servedExpoSwift
66985
66999
  });
66986
67000
  function expoNativeCompilerDigestValue() {
66987
- return true ? "14d88f98100ab2aa1697716b744e5a82c52ac4b234218a17662b547201295088" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
67001
+ return true ? "064dc6aa590b7937e7499edee9ff07b0ef387a59a35ed48a2d820ab27209917a" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
66988
67002
  }
66989
67003
  function readSources(value) {
66990
67004
  const sources = isRecord(value) ? value.sources : null;
@@ -82166,7 +82180,8 @@ async function collectTurboSources(options) {
82166
82180
  reactNative,
82167
82181
  sources: [],
82168
82182
  externalPodSources: [],
82169
- rendererSwiftTargets: []
82183
+ rendererSwiftTargets: [],
82184
+ fabricComponents: []
82170
82185
  };
82171
82186
  const sharedLibrary = [...options.installedPods?.values() ?? []].find(
82172
82187
  (pod) => pod.sharedLibrary
@@ -82613,6 +82628,9 @@ async function collectTurboSources(options) {
82613
82628
  };
82614
82629
  let objc = Boolean(options.reactNativeProvider);
82615
82630
  let fabric = Boolean(options.reactNativeProvider);
82631
+ const fabricPackages = /* @__PURE__ */ new Set();
82632
+ const fabricViews = [];
82633
+ let fabricTarget = null;
82616
82634
  let legacyBridge = false;
82617
82635
  let hermesHeaders = null;
82618
82636
  const objcClasses = /* @__PURE__ */ new Set();
@@ -82636,7 +82654,11 @@ async function collectTurboSources(options) {
82636
82654
  { tool: "cxx", flags: pod.installed.preprocessorFlags.cxx }
82637
82655
  ];
82638
82656
  const root = pod.root;
82639
- fabric ||= fabricComponents(provider.root);
82657
+ if (fabricComponents(provider.root)) {
82658
+ fabric = true;
82659
+ fabricPackages.add(provider.name);
82660
+ fabricTarget ??= { targetName, label, root: provider.root };
82661
+ }
82640
82662
  if (pod.installed?.library) {
82641
82663
  result.libraries ??= {};
82642
82664
  result.libraries[targetName] = import_node_fs93.default.readFileSync(pod.installed.library).toString("base64");
@@ -82909,6 +82931,17 @@ async function collectTurboSources(options) {
82909
82931
  const owned = /* @__PURE__ */ new Set();
82910
82932
  walkFiles2(generated, "", owned);
82911
82933
  const spec = codegenConfig.name;
82934
+ let definedComponentNames;
82935
+ const getDefinedComponentNames = () => {
82936
+ if (definedComponentNames) return definedComponentNames;
82937
+ definedComponentNames = /* @__PURE__ */ new Set();
82938
+ const pattern = /\b(?:const\s+char|char\s+const)\s+(\w+ComponentName)\s*\[\s*\]\s*=/g;
82939
+ for (const sourceFile of sources) {
82940
+ const text6 = readPackageFile(root, import_node_path89.default.join(root, sourceFile), Infinity).toString("utf8").replace(/\/\/[^\n]*/g, "");
82941
+ for (const match of text6.matchAll(pattern)) definedComponentNames.add(match[1]);
82942
+ }
82943
+ return definedComponentNames;
82944
+ };
82912
82945
  for (const file of [...owned].sort()) {
82913
82946
  const base = import_node_path89.default.posix.basename(file);
82914
82947
  const objcSpec = providerObjC && file.startsWith(`${spec}/`);
@@ -82930,7 +82963,32 @@ async function collectTurboSources(options) {
82930
82963
  relative: file
82931
82964
  }
82932
82965
  );
82933
- else original(targetName, "ReactCodegen", generated, file);
82966
+ else {
82967
+ if (component && base === "ShadowNodes.cpp") {
82968
+ const defined = getDefinedComponentNames();
82969
+ if (defined.size) {
82970
+ const source = readPackageFile(
82971
+ generated,
82972
+ import_node_path89.default.join(generated, file),
82973
+ Infinity
82974
+ ).toString("utf8");
82975
+ const filtered = source.replace(
82976
+ /^[ \t]*(?:extern[ \t]+)?(?:const[ \t]+char|char[ \t]+const)[ \t]+(\w+ComponentName)[ \t]*\[[ \t]*\][ \t]*=[^;]*;[ \t]*\r?\n?/gm,
82977
+ (line, name3) => defined.has(name3) ? "" : line
82978
+ );
82979
+ if (filtered !== source) {
82980
+ if (!/\b(?:const\s+char|char\s+const)\s+\w+ComponentName\s*\[\s*\]\s*=/.test(
82981
+ filtered
82982
+ ))
82983
+ continue;
82984
+ const key2 = original(targetName, "ReactCodegen", generated, file);
82985
+ result.files[key2] = filtered;
82986
+ continue;
82987
+ }
82988
+ }
82989
+ }
82990
+ original(targetName, "ReactCodegen", generated, file);
82991
+ }
82934
82992
  }
82935
82993
  }
82936
82994
  for (const file of sources) original(targetName, label, root, file);
@@ -82991,7 +83049,7 @@ ${declared.map((symbol2) => `extern "C" void ${symbol2}();
82991
83049
  add2(`${core}/include/PeachJsiRuntime.hpp`, TURBO_RUNTIME_HEADER);
82992
83050
  add2(
82993
83051
  `${core}/${TURBO_CORE_PUBLIC_HEADERS}/${TURBO_ENTRY_HEADER}`,
82994
- '#pragma once\nextern "C" void peachTurboInitialize();\n'
83052
+ '#pragma once\nextern "C" void peachTurboInitialize();\n// the +1 Fabric component view a root of the process shows, in an app with one\nextern "C" void *peach_fabric_view_content(int tag);\n'
82995
83053
  );
82996
83054
  add2(
82997
83055
  `${core}/${TURBO_CORE_PUBLIC_HEADERS}/module.modulemap`,
@@ -83117,6 +83175,21 @@ ${declared.map((symbol2) => `extern "C" void ${symbol2}();
83117
83175
  original(TURBO_CORE_TARGET, "ReactCodegen", generated, "RCTModuleProviders.h")
83118
83176
  );
83119
83177
  }
83178
+ const thirdParty = import_node_path89.default.join(generated, "RCTThirdPartyComponentsProvider.mm");
83179
+ if (fabricPackages.size > 0 && import_node_fs93.default.existsSync(thirdParty)) {
83180
+ for (const [, name3, className2, owner] of import_node_fs93.default.readFileSync(thirdParty, "utf8").matchAll(/@"([^"]+)": NSClassFromString\(@"([^"]+)"\), \/\/ (\S+)/g))
83181
+ if (fabricPackages.has(owner))
83182
+ fabricViews.push({ name: name3, className: className2 });
83183
+ }
83184
+ if (fabricViews.length > 0 && fabricTarget) {
83185
+ result.fabricComponents = fabricViews.map(({ name: name3 }) => name3);
83186
+ const unit2 = `${targetPath(fabricTarget.targetName)}/PeachFabricHost.mm`;
83187
+ add2(unit2, fabricHostSource(fabricViews));
83188
+ scanText(
83189
+ { key: unit2, ...fabricTarget, relative: "PeachFabricHost.mm" },
83190
+ result.files[unit2]
83191
+ );
83192
+ }
83120
83193
  }
83121
83194
  if (fabric || legacyBridge) {
83122
83195
  if (legacyBridge) {
@@ -83460,38 +83533,6 @@ void dispatchToJSThread(dispatch_block_t block) {
83460
83533
  }
83461
83534
  } // namespace
83462
83535
 
83463
- static CGFloat peachScreenBrightness = 0.5;
83464
-
83465
- @implementation UIScreen (PeachTurboRuntime)
83466
- + (UIScreen *)mainScreen {
83467
- static UIScreen *screen = nil;
83468
- if (!screen) screen = [[UIScreen alloc] init];
83469
- return screen;
83470
- }
83471
- - (CGFloat)brightness {
83472
- return peachScreenBrightness;
83473
- }
83474
- - (void)setBrightness:(CGFloat)value {
83475
- peachScreenBrightness = value;
83476
- }
83477
- @end
83478
-
83479
- static BOOL peachIdleTimerDisabled = NO;
83480
-
83481
- @implementation UIApplication (PeachTurboRuntime)
83482
- + (UIApplication *)sharedApplication {
83483
- static UIApplication *app = nil;
83484
- if (!app) app = [[UIApplication alloc] init];
83485
- return app;
83486
- }
83487
- - (BOOL)isIdleTimerDisabled {
83488
- return peachIdleTimerDisabled;
83489
- }
83490
- - (void)setIdleTimerDisabled:(BOOL)disabled {
83491
- peachIdleTimerDisabled = disabled;
83492
- }
83493
- @end
83494
-
83495
83536
  // React Native's own modules register before any provider's, and RCTBridge.mm
83496
83537
  // creates the registry's queue in the first RCTRegisterModule. the engine
83497
83538
  // supplies those modules, so a process whose providers register none (codegen
@@ -83608,6 +83649,12 @@ ${moduleProviders ? `- (id<RCTModuleProvider>)getModuleProvider:(const char *)na
83608
83649
 
83609
83650
  @end
83610
83651
 
83652
+ // an app's Fabric component views, which its own Fabric host defines
83653
+ extern "C" void peachInstallFabricViews(facebook::jsi::Runtime &runtime) __attribute__((weak));
83654
+
83655
+ // UIKitCore: the key window and root view controller an app delegate makes at launch
83656
+ extern "C" void PeachLaunchReactNativeWindow(void);
83657
+
83611
83658
  extern "C" void peachTurboInitialize() {
83612
83659
  objc_create_block_classes_as_subclasses_of([NSObject class]);
83613
83660
  if (Class blockClass = NSClassFromString(@"_NSBlock")) {
@@ -83621,6 +83668,7 @@ extern "C" void peachTurboInitialize() {
83621
83668
  static_cast<uint32_t *>((__bridge void *)mainQueueClass)[4] &= ~2048u;
83622
83669
  *reinterpret_cast<void **>(&_dispatch_main_q) = (__bridge void *)mainQueueClass;
83623
83670
  }
83671
+ PeachLaunchReactNativeWindow();
83624
83672
  auto& runtime = peach::jsi_runtime::create(
83625
83673
  [] { invoker->drain(); },
83626
83674
  [] {
@@ -83681,6 +83729,7 @@ ${bridgeProxy ? ` // as RCTInstance does: the proxy modules reach as their brid
83681
83729
  }];
83682
83730
  [decorator.moduleRegistry setTurboModuleRegistry:manager];
83683
83731
  [manager installJSBindings:runtime];
83732
+ if (peachInstallFabricViews) peachInstallFabricViews(runtime);
83684
83733
  }
83685
83734
 
83686
83735
  // the screenshot the device took, as UIKit posts it to every observer in the
@@ -83726,7 +83775,129 @@ ${moduleProviders ? " [found addObjectsFromArray:RCTModuleProviders.moduleProvi
83726
83775
  }
83727
83776
  `;
83728
83777
  }
83729
- var import_node_child_process50, import_node_crypto48, import_node_fs93, import_node_path89, import_node_util15, execFileAsync3, TURBO_CORE_TARGET, TURBO_FMT_TARGET, TURBO_ENTRY_HEADER, TURBO_CORE_PUBLIC_HEADERS, REGISTRATION, CODEGEN_OBJC, UNIT, HEADER3, OBJC2, OBJC_TURBO, OBJC_BRIDGE, OBJC_REGISTERED, REACT_NATIVE_UNITS, REACT_NATIVE_INCLUDE_ROOTS, REACT_NATIVE_OBJC_UNITS, REACT_NATIVE_OBJC_VERSIONED_UNITS, REACT_NATIVE_HEADER_DIRS, REACT_NATIVE_BARE_HEADER_DIRS, DECLARED_MODULE_NAME, EXPORTED_MODULE, sha2564, versionParts, iosOf, JS_CALL_INVOKER;
83778
+ function fabricHostSource(views) {
83779
+ const entries = views.map(
83780
+ ({ name: name3, className: className2 }) => `@${JSON.stringify(name3)}: NSClassFromString(@${JSON.stringify(className2)})`
83781
+ ).join(", ");
83782
+ return `${FABRIC_HOST_INCLUDES}
83783
+ @interface PeachFabricComponents : NSObject <RCTComponentViewFactoryComponentProvider>
83784
+ @end
83785
+
83786
+ @implementation PeachFabricComponents
83787
+ - (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
83788
+ {
83789
+ return @{${entries}};
83790
+ }
83791
+ @end
83792
+
83793
+ namespace {
83794
+ struct PeachFabricView {
83795
+ react::ComponentHandle handle;
83796
+ const react::ComponentDescriptor *descriptor;
83797
+ react::Props::Shared props;
83798
+ react::LayoutMetrics layoutMetrics;
83799
+ };
83800
+ PeachFabricComponents *fabricComponents;
83801
+ RCTComponentViewRegistry *fabricRegistry;
83802
+ std::shared_ptr<const react::ContextContainer> fabricContext;
83803
+ react::ComponentDescriptorRegistry::Shared fabricDescriptors;
83804
+ std::unordered_map<int, PeachFabricView> fabricViews;
83805
+ int nextFabricView = 1;
83806
+ std::string fabricNames = ${JSON.stringify(views.map(({ name: name3 }) => name3).join("\n"))};
83807
+
83808
+ PeachFabricView &fabricView(int tag) {
83809
+ auto found = fabricViews.find(tag);
83810
+ if (found == fabricViews.end()) {
83811
+ std::fprintf(stderr, "no mounted Fabric view %d\\n", tag);
83812
+ std::abort();
83813
+ }
83814
+ return found->second;
83815
+ }
83816
+
83817
+ react::Props::Shared fabricCloneProps(jsi::Runtime &rt, const PeachFabricView &view, const jsi::Value &props) {
83818
+ react::PropsParserContext context{-1, *fabricContext};
83819
+ return view.descriptor->cloneProps(context, view.props, react::RawProps(rt, props));
83820
+ }
83821
+
83822
+ } // namespace
83823
+
83824
+ extern "C" void peachInstallFabricViews(jsi::Runtime &rt) {
83825
+ fabricComponents = [PeachFabricComponents new];
83826
+ RCTComponentViewFactory *factory = [RCTComponentViewFactory currentComponentViewFactory];
83827
+ factory.thirdPartyFabricComponentsProvider = fabricComponents;
83828
+ fabricRegistry = [RCTComponentViewRegistry new];
83829
+ fabricContext = std::make_shared<const react::ContextContainer>();
83830
+ react::ComponentDescriptorParameters parameters{{}, fabricContext, nullptr};
83831
+ fabricDescriptors = [factory createComponentDescriptorRegistryWithParameters:parameters];
83832
+ auto views = jsi::Object(rt);
83833
+ auto method = [&](const char *name, unsigned count, jsi::HostFunctionType body) {
83834
+ views.setProperty(rt, name, jsi::Function::createFromHostFunction(rt, jsi::PropNameID::forAscii(rt, name), count, std::move(body)));
83835
+ };
83836
+ // Create then Insert: the first props, no event emitter or state, and the
83837
+ // layout the view has before the engine measures it
83838
+ method("create", 2, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
83839
+ const auto &descriptor = fabricDescriptors->at(args[0].asString(rt).utf8(rt));
83840
+ int tag = nextFabricView++;
83841
+ auto &view = fabricViews.emplace(tag, PeachFabricView{descriptor.getComponentHandle(), &descriptor, nullptr, {}}).first->second;
83842
+ view.props = fabricCloneProps(rt, view, args[1]);
83843
+ UIView<RCTComponentViewProtocol> *componentView =
83844
+ [fabricRegistry dequeueComponentViewWithComponentHandle:view.handle tag:tag].view;
83845
+ [componentView updateProps:view.props oldProps:nullptr];
83846
+ [componentView updateEventEmitter:nullptr];
83847
+ [componentView updateState:nullptr oldState:nullptr];
83848
+ [componentView updateLayoutMetrics:view.layoutMetrics oldLayoutMetrics:react::EmptyLayoutMetrics];
83849
+ [componentView finalizeUpdates:RNComponentViewUpdateMaskAll];
83850
+ return jsi::Value(tag);
83851
+ });
83852
+ // Update with the props React changed since the last commit
83853
+ method("update", 2, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
83854
+ int tag = static_cast<int>(args[0].asNumber());
83855
+ auto &view = fabricView(tag);
83856
+ auto oldProps = view.props;
83857
+ view.props = fabricCloneProps(rt, view, args[1]);
83858
+ UIView<RCTComponentViewProtocol> *componentView = [fabricRegistry componentViewDescriptorWithTag:tag].view;
83859
+ [componentView updateProps:view.props oldProps:oldProps];
83860
+ [componentView finalizeUpdates:RNComponentViewUpdateMaskProps];
83861
+ return jsi::Value::undefined();
83862
+ });
83863
+ // Update with the size and scale the engine laid the view out at
83864
+ method("layout", 4, [](jsi::Runtime &, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
83865
+ int tag = static_cast<int>(args[0].asNumber());
83866
+ auto &view = fabricView(tag);
83867
+ auto metrics = view.layoutMetrics;
83868
+ metrics.frame = react::Rect{{0, 0}, {static_cast<react::Float>(args[1].asNumber()), static_cast<react::Float>(args[2].asNumber())}};
83869
+ metrics.pointScaleFactor = static_cast<react::Float>(args[3].asNumber());
83870
+ if (metrics == view.layoutMetrics) return jsi::Value::undefined();
83871
+ UIView<RCTComponentViewProtocol> *componentView = [fabricRegistry componentViewDescriptorWithTag:tag].view;
83872
+ [componentView updateLayoutMetrics:metrics oldLayoutMetrics:view.layoutMetrics];
83873
+ view.layoutMetrics = metrics;
83874
+ [componentView finalizeUpdates:RNComponentViewUpdateMaskLayoutMetrics];
83875
+ return jsi::Value::undefined();
83876
+ });
83877
+ // Remove then Delete: the registry recycles the view
83878
+ method("drop", 1, [](jsi::Runtime &, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
83879
+ int tag = static_cast<int>(args[0].asNumber());
83880
+ auto &view = fabricView(tag);
83881
+ RCTComponentViewDescriptor descriptor = [fabricRegistry componentViewDescriptorWithTag:tag];
83882
+ [descriptor.view removeFromSuperview];
83883
+ [fabricRegistry enqueueComponentViewWithComponentHandle:view.handle tag:tag componentViewDescriptor:descriptor];
83884
+ fabricViews.erase(tag);
83885
+ return jsi::Value::undefined();
83886
+ });
83887
+ rt.global().setProperty(rt, "peachFabricViews", std::move(views));
83888
+ }
83889
+
83890
+ extern "C" void *peach_fabric_view_content(int tag) {
83891
+ return (__bridge_retained void *)[fabricRegistry componentViewDescriptorWithTag:tag].view;
83892
+ }
83893
+
83894
+ // the component names the host registers as views, newline separated
83895
+ extern "C" __attribute__((export_name("peach_fabric_component_names"))) const char *peachFabricComponentNames() {
83896
+ return fabricNames.c_str();
83897
+ }
83898
+ `;
83899
+ }
83900
+ var import_node_child_process50, import_node_crypto48, import_node_fs93, import_node_path89, import_node_util15, execFileAsync3, TURBO_CORE_TARGET, TURBO_FMT_TARGET, TURBO_ENTRY_HEADER, TURBO_CORE_PUBLIC_HEADERS, REGISTRATION, CODEGEN_OBJC, UNIT, HEADER3, OBJC2, OBJC_TURBO, OBJC_BRIDGE, OBJC_REGISTERED, REACT_NATIVE_UNITS, REACT_NATIVE_INCLUDE_ROOTS, REACT_NATIVE_OBJC_UNITS, REACT_NATIVE_OBJC_VERSIONED_UNITS, REACT_NATIVE_HEADER_DIRS, REACT_NATIVE_BARE_HEADER_DIRS, DECLARED_MODULE_NAME, EXPORTED_MODULE, sha2564, versionParts, iosOf, JS_CALL_INVOKER, FABRIC_HOST_INCLUDES;
83730
83901
  var init_turbo_source = __esm({
83731
83902
  "src/turbo-source.ts"() {
83732
83903
  "use strict";
@@ -83889,6 +84060,22 @@ class JsCallInvoker final : public react::CallInvoker {
83889
84060
  std::deque<react::CallFunc> pending;
83890
84061
  };
83891
84062
 
84063
+ `;
84064
+ FABRIC_HOST_INCLUDES = `#import <Foundation/Foundation.h>
84065
+ #import <React/RCTComponentViewFactory.h>
84066
+ #import <React/RCTComponentViewProtocol.h>
84067
+ #import <React/RCTComponentViewRegistry.h>
84068
+ #include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
84069
+ #include <react/renderer/core/LayoutMetrics.h>
84070
+ #include <react/renderer/core/PropsParserContext.h>
84071
+ #include <react/renderer/core/RawProps.h>
84072
+ #include <react/utils/ContextContainer.h>
84073
+ #include <cstdio>
84074
+ #include <cstdlib>
84075
+ #include <unordered_map>
84076
+ #include <jsi/jsi.h>
84077
+
84078
+ using namespace facebook;
83892
84079
  `;
83893
84080
  }
83894
84081
  });
@@ -83944,7 +84131,7 @@ function collectTurboCompileInput(collection, runtime, iosDeploymentTarget, depe
83944
84131
  dependencyTargets = dependencyTargets.filter(
83945
84132
  (_, index) => !providerNames.has(parsedTargets[index].name)
83946
84133
  );
83947
- const swift = Object.keys(files2).some((file) => file.endsWith(".swift"));
84134
+ const swift = collection.coreMode === "turbo" || Object.keys(files2).some((file) => file.endsWith(".swift"));
83948
84135
  const entry = `Sources/PeachTurboApp/main.${swift ? "swift" : "cpp"}`;
83949
84136
  const targetNames = targets.map(({ name: name3 }) => name3);
83950
84137
  const loadTargetNames = new Set(collection.loads.map(({ target }) => target));
@@ -83953,10 +84140,56 @@ function collectTurboCompileInput(collection, runtime, iosDeploymentTarget, depe
83953
84140
  (file) => file.startsWith(`${target.path}/`) && file.endsWith(".swift")
83954
84141
  )
83955
84142
  ).map(({ name: name3 }) => name3);
83956
- files2[entry] = swift ? "@_spi(Peach) import PeachFoundation\n" + swiftImportedTargetNames.map((target) => `import ${target}
83957
- `).join("") + `PeachHostDriver.installExecutor()
83958
- ${collection.loads.map(({ symbol: symbol2 }) => `${symbol2}()
83959
- `).join("")}${runtime ? "peachTurboInitialize()\n" : ""}` : [
84143
+ const initialize = [
84144
+ "_PeachReactNativeWindow.launch()",
84145
+ ...collection.loads.map(({ symbol: symbol2 }) => `${symbol2}()`),
84146
+ ...runtime ? ["peachTurboInitialize()"] : []
84147
+ ];
84148
+ const fabric = collection.fabricComponents.length > 0;
84149
+ files2[entry] = swift ? [
84150
+ "import SwiftUI",
84151
+ "import UIKit",
84152
+ "import PeachJSON",
84153
+ ...swiftImportedTargetNames.map((target) => `import ${target}`),
84154
+ "",
84155
+ "@main struct PeachTurboApp: PeachPackage {",
84156
+ ` init() { ${initialize.join("; ")} }`,
84157
+ ...fabric ? [
84158
+ " func view(props: JSON) -> PeachTurboRoot { PeachTurboRoot(props: props) }",
84159
+ "}",
84160
+ "",
84161
+ "struct PeachTurboRoot: View {",
84162
+ " let fabric: Int32?",
84163
+ "",
84164
+ " init(props: JSON) {",
84165
+ ' guard case .object(let fields) = props, let field = fields.first(where: { $0.0 == "fabric" }), case .number(let tag) = field.1 else {',
84166
+ " fabric = nil",
84167
+ " return",
84168
+ " }",
84169
+ " fabric = Int32(tag)",
84170
+ " }",
84171
+ "",
84172
+ " var body: some View {",
84173
+ " if let fabric { PeachFabricComponent(tag: fabric) } else { _PeachReactNativeWindow() }",
84174
+ " }",
84175
+ "}",
84176
+ "",
84177
+ "struct PeachFabricComponent: UIViewRepresentable {",
84178
+ " let tag: Int32",
84179
+ "",
84180
+ " func makeUIView(context: Context) -> UIView {",
84181
+ ' guard let view = peach_fabric_view_content(tag) else { fatalError("Fabric view \\(tag) is not mounted") }',
84182
+ " return Unmanaged<UIView>.fromOpaque(view).takeRetainedValue()",
84183
+ " }",
84184
+ "",
84185
+ " func updateUIView(_ view: UIView, context: Context) {}",
84186
+ "}"
84187
+ ] : [
84188
+ " func view(props: JSON) -> _PeachReactNativeWindow { _PeachReactNativeWindow() }",
84189
+ "}"
84190
+ ],
84191
+ ""
84192
+ ].join("\n") : [
83960
84193
  'extern "C" void peachTurboInitialize();',
83961
84194
  ...collection.loads.map(({ symbol: symbol2 }) => `extern "C" void ${symbol2}();`),
83962
84195
  "int main(int argc, char **argv) {",
@@ -84593,7 +84826,7 @@ var init_react_native_core = __esm({
84593
84826
  init_swift_distribution();
84594
84827
  init_swift_package();
84595
84828
  init_swiftContract();
84596
- recipe = true ? "f30840269a1f4be9434de5fb0adcd21490990ef2b55e4f3e6c159fcb6752a29d" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
84829
+ recipe = true ? "96416de7238919b274266f095ef4213211a2a26c133d0df7ab5e0459ded52ef1" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
84597
84830
  strings4 = (value) => isRecord(value) && Object.values(value).every((item) => typeof item === "string");
84598
84831
  building = /* @__PURE__ */ new Map();
84599
84832
  }
@@ -84726,7 +84959,9 @@ function installSwiftInputTrace() {
84726
84959
  import_node_path93.default.join(swiftCacheDir(), "swift-builds"),
84727
84960
  import_node_path93.default.join(swiftCacheDir(), "swift-sdk-views"),
84728
84961
  swiftRootLocksDir(),
84729
- import_node_path93.default.join(cacheDir(), "swift-tmp")
84962
+ import_node_path93.default.join(cacheDir(), "swift-tmp"),
84963
+ // content-addressed records whose reads renew their timestamps for expiry.
84964
+ expoDiscoveryCacheDir()
84730
84965
  ].filter((prefix, index, all) => all.indexOf(prefix) === index);
84731
84966
  ignoredRoots = prefixes.flatMap((root) => {
84732
84967
  try {
@@ -84832,11 +85067,13 @@ async function witnessMatches(witness) {
84832
85067
  return true;
84833
85068
  }
84834
85069
  async function discoveryKey(root, installedWorkspace, prepareNative, iosTarget, moduleRoot) {
84835
- const [config, expoConfig] = await Promise.all([
85070
+ const preparesWorkspace = prepareNative && !installedWorkspace && nativeWorkspaceAvailable();
85071
+ const [config, expoConfig, workspace] = await Promise.all([
84836
85072
  loadRNXAppConfig(resolveAppProject(root)),
84837
- readExpoConfigAsync(root)
85073
+ readExpoConfigAsync(root),
85074
+ preparesWorkspace ? traceStore.exit(() => hashExpoWorkspace(root)) : null
84838
85075
  ]);
84839
- return `${import_node_fs97.default.realpathSync(root)}\0${installedWorkspace ?? ""}\0${iosTarget ?? ""}\0${moduleRoot ?? ""}\0${prepareNative ? "1" : "0"}\0${JSON.stringify(config)}\0${JSON.stringify(expoConfig)}`;
85076
+ return `${import_node_fs97.default.realpathSync(root)}\0${installedWorkspace ?? ""}\0${iosTarget ?? ""}\0${moduleRoot ?? ""}\0${prepareNative ? "1" : "0"}\0${JSON.stringify(config)}\0${JSON.stringify(expoConfig)}\0${workspace?.hash ?? ""}`;
84840
85077
  }
84841
85078
  function cloneNativeTarget(target) {
84842
85079
  return {
@@ -86119,7 +86356,11 @@ function expoEntry(units, oneSDK = false) {
86119
86356
  (unit2) => Object.keys(unit2.files).some((file) => file.startsWith(`Sources/${namespace}/`))
86120
86357
  )
86121
86358
  );
86122
- const bridgeModules = units.flatMap((unit2) => unit2.bridgeModules);
86359
+ const bridgeModules = units.flatMap(
86360
+ (unit2) => unit2.bridgeModules.map(
86361
+ (registration) => registration === `${unit2.namespace}.__peachReactModule_${unit2.namespace}()` ? registration.slice(unit2.namespace.length + 1) : registration
86362
+ )
86363
+ );
86123
86364
  const subscribers = units.flatMap((unit2) => unit2.appDelegateSubscribers);
86124
86365
  const handlers = units.flatMap((unit2) => unit2.reactDelegateHandlers);
86125
86366
  const delegates = subscribers.length + handlers.length > 0 ? `; PeachExpoRuntime.registerDelegates(subscribers: [${subscribers.join(", ")}], handlers: [${handlers.join(", ")}])` : "";
@@ -87116,6 +87357,7 @@ var init_launchMetadataContract = __esm({
87116
87357
  "expoKotlin",
87117
87358
  "nitro",
87118
87359
  "turbo",
87360
+ "widgetExtension",
87119
87361
  "appManifest",
87120
87362
  "packageVersions",
87121
87363
  "dotEnv",
@@ -88507,7 +88749,7 @@ var init_nitro_superset = __esm({
88507
88749
  init_nitroContract();
88508
88750
  init_swift_standin_digest();
88509
88751
  NITRO_SUPERSET_ENTRY_NAME = "superset";
88510
- NITRO_COMPILER_DIGEST = true ? "9393367a8c7442a5ce3f6e81f9ff408f0afdbf5eeadaeed359561a348a6b1818" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
88752
+ NITRO_COMPILER_DIGEST = true ? "3f4226b3727dae50227ba7f4fd8d517c59939e4f4d2f56ef11e1dafd09705f5c" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
88511
88753
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
88512
88754
  nitroSupersetKey = (inputs) => nativeEntryKey({ ...inputs, compiler: NITRO_COMPILER_DIGEST });
88513
88755
  published2 = /* @__PURE__ */ new Map();
@@ -89629,6 +89871,43 @@ var init_turbo_bundle = __esm({
89629
89871
  }
89630
89872
  });
89631
89873
 
89874
+ // src/widget-extension-bundle.ts
89875
+ async function compileWidgetExtension(appRoot, origin) {
89876
+ const projectRoot = await prepareNativeAppRoot(appRoot);
89877
+ const workspace = installedXcodeWorkspace(projectRoot);
89878
+ if (!workspace) return null;
89879
+ const extensions = readXcodeExtensionTargets(workspace).filter(({ infoPlist }) => {
89880
+ const extension = infoPlist.NSExtension;
89881
+ return typeof extension === "object" && extension !== null && "NSExtensionPointIdentifier" in extension && extension.NSExtensionPointIdentifier === "com.apple.widgetkit-extension";
89882
+ });
89883
+ if (extensions.length === 0) return null;
89884
+ if (extensions.length > 1)
89885
+ throw new Error(
89886
+ `${workspace}: more than one WidgetKit extension (${extensions.map(({ name: name4 }) => name4).join(", ")}) is unmeasured`
89887
+ );
89888
+ const { name: name3 } = extensions[0];
89889
+ const moduleRoot = await swiftDistributionRoot();
89890
+ await prepareXcodeSwiftPackages(workspace, name3, "Release");
89891
+ const root = openXcodeProject(workspace, name3, moduleRoot, "Release");
89892
+ return { metadata: await swiftPackageMetadata(root, name3, moduleRoot, origin) };
89893
+ }
89894
+ var WIDGET_EXTENSION_ROUTE, handleWidgetExtensionRequest;
89895
+ var init_widget_extension_bundle = __esm({
89896
+ "src/widget-extension-bundle.ts"() {
89897
+ "use strict";
89898
+ init_expo_native_workspace();
89899
+ init_nitro_bundle();
89900
+ init_swift_distribution();
89901
+ init_swift_host();
89902
+ init_xcode_project();
89903
+ WIDGET_EXTENSION_ROUTE = "/__peach/widget-extension";
89904
+ handleWidgetExtensionRequest = compiledModuleRequestHandler(
89905
+ "Widget extension",
89906
+ (root, origin) => compileWidgetExtension(root, origin)
89907
+ );
89908
+ }
89909
+ });
89910
+
89632
89911
  // src/expo-manifest-body.ts
89633
89912
  function parseExpoManifestBody(body) {
89634
89913
  const opening = /^(--[^\r\n]+)\r?\n/.exec(body);
@@ -105490,6 +105769,7 @@ var init_bridge_host = __esm({
105490
105769
  init_runtime_delivery();
105491
105770
  init_runtime_packs();
105492
105771
  init_turbo_bundle();
105772
+ init_widget_extension_bundle();
105493
105773
  init_agent_host();
105494
105774
  init_app_package_handler();
105495
105775
  init_fetch_proxy_handler();
@@ -106522,7 +106802,7 @@ var init_bridge_host = __esm({
106522
106802
  return;
106523
106803
  }
106524
106804
  const route = req.url?.split("?")[0] ?? "";
106525
- if (route === EXPO_WIDGETS_ROUTE || route === NITRO_ROUTE || route === ONE_SDK_ROUTE || route === TURBO_ROUTE || /^\/__peach\/(?:expo-swift|swift|expo-kotlin|kotlin-artifact\/)/.test(route)) {
106805
+ if (route === EXPO_WIDGETS_ROUTE || route === WIDGET_EXTENSION_ROUTE || route === NITRO_ROUTE || route === ONE_SDK_ROUTE || route === TURBO_ROUTE || /^\/__peach\/(?:expo-swift|swift|expo-kotlin|kotlin-artifact\/)/.test(route)) {
106526
106806
  this.nativeWorkInFlight++;
106527
106807
  res.once("close", () => {
106528
106808
  this.nativeWorkInFlight--;
@@ -106533,6 +106813,10 @@ var init_bridge_host = __esm({
106533
106813
  void handleExpoWidgetsRequest(req, res);
106534
106814
  return;
106535
106815
  }
106816
+ if (route === WIDGET_EXTENSION_ROUTE) {
106817
+ void handleWidgetExtensionRequest(req, res);
106818
+ return;
106819
+ }
106536
106820
  if (route === ONE_SDK_ROUTE) {
106537
106821
  void handleOneSDKRequest(req, res);
106538
106822
  return;
@@ -118071,6 +118355,7 @@ async function buildShellUrl(target, baseUrl = resolveDefaultShellBaseUrl(), opt
118071
118355
  "expoWidgets",
118072
118356
  "nitro",
118073
118357
  "turbo",
118358
+ "widgetExtension",
118074
118359
  "expoKotlin"
118075
118360
  ].some((key2) => supplied.searchParams.has(key2)))
118076
118361
  return applyShellLaunchOptions(supplied, opts).toString();
@@ -118208,6 +118493,10 @@ async function buildShellUrl(target, baseUrl = resolveDefaultShellBaseUrl(), opt
118208
118493
  "turbo",
118209
118494
  `${nativeAssetOrigin}/__peach/turbo?root=${encodeURIComponent(expoRoot)}${opts.iosTarget ? `&iosTarget=${encodeURIComponent(opts.iosTarget)}` : ""}`
118210
118495
  );
118496
+ expoStamped.searchParams.set(
118497
+ "widgetExtension",
118498
+ `${nativeAssetOrigin}/__peach/widget-extension?root=${encodeURIComponent(expoRoot)}`
118499
+ );
118211
118500
  expoStamped.searchParams.set(
118212
118501
  "oneSDK",
118213
118502
  `${nativeAssetOrigin}/__peach/one-sdk?root=${encodeURIComponent(expoRoot)}`
@@ -133359,6 +133648,7 @@ function deriveCurrentSimBaseUrl(sim, fallback) {
133359
133648
  url.searchParams.delete("nitro");
133360
133649
  url.searchParams.delete("oneSDK");
133361
133650
  url.searchParams.delete("turbo");
133651
+ url.searchParams.delete("widgetExtension");
133362
133652
  return url.toString();
133363
133653
  } catch {
133364
133654
  return fallback;