peachsim 0.1.2625 → 0.1.2627

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 (130) hide show
  1. package/cli/commands/diagnose-native.ts +717 -0
  2. package/cli/commands/perf-native.ts +120 -51
  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 +2 -2
  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 +5 -5
  13. package/dist-lib/bridge-contract.cjs +1 -1
  14. package/dist-lib/bridge-contract.mjs +3 -3
  15. package/dist-lib/bundle-channel.cjs +87 -17
  16. package/dist-lib/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +3 -3
  18. package/dist-lib/cloud-contract.cjs +1 -1
  19. package/dist-lib/cloud-contract.mjs +3 -3
  20. package/dist-lib/cloud-test-args.cjs +1 -1
  21. package/dist-lib/cloud-test-args.mjs +2 -2
  22. package/dist-lib/cloud.cjs +1 -1
  23. package/dist-lib/cloud.mjs +7 -7
  24. package/dist-lib/config.cjs +1 -1
  25. package/dist-lib/config.mjs +5 -5
  26. package/dist-lib/detox/index.cjs +1 -1
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/esm-chunks/{acorn-SHZZDBSI.mjs → acorn-D2TBEXUS.mjs} +3 -3
  29. package/dist-lib/esm-chunks/{chunk-DVMKYLDN.mjs → chunk-2Z47MJY7.mjs} +6 -6
  30. package/dist-lib/esm-chunks/{chunk-6PZI7TYE.mjs → chunk-3Z6TOSBM.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-P542MMIN.mjs → chunk-4PPBABST.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-RJWEWNAJ.mjs → chunk-6KAXUVL3.mjs} +3 -3
  33. package/dist-lib/esm-chunks/{chunk-F4YHL4UM.mjs → chunk-7WWBP4L4.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-Q5NI4L3Z.mjs → chunk-AE2VDAUH.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-ULHG6CND.mjs → chunk-BF54TN4C.mjs} +6 -6
  36. package/dist-lib/esm-chunks/{chunk-JRU2VXUU.mjs → chunk-D26XDATF.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-M2FEKSK3.mjs → chunk-M2K2SAAV.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-SRIRVPNX.mjs → chunk-MMKRGY33.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-RXXCTHJG.mjs → chunk-N75KNJIA.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-A4R4YGFJ.mjs → chunk-NFO2NQR3.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-KA4AQDVF.mjs → chunk-OKKGDF2H.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-A66VNSO6.mjs → chunk-OZDM3CIC.mjs} +80 -14
  43. package/dist-lib/esm-chunks/{chunk-JVEJLPJC.mjs → chunk-PFIQXQK2.mjs} +2 -2
  44. package/dist-lib/esm-chunks/{chunk-Z6AH6AQC.mjs → chunk-PNMDP4NZ.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-W4HQINQ6.mjs → chunk-PZAWOGX5.mjs} +4 -4
  46. package/dist-lib/esm-chunks/{chunk-XQBHCWS4.mjs → chunk-SUBMWAYT.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-R4FFTWPL.mjs → chunk-U5CS65KA.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-3XZGWT62.mjs → chunk-UTJKHY4H.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-LJYNZ5HM.mjs → chunk-VLH5JM4H.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-7Z7YJ4FU.mjs → chunk-WCQX636N.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{chunk-2LDG7OD4.mjs → chunk-XTQ3XPCU.mjs} +5 -5
  52. package/dist-lib/esm-chunks/{chunk-OCCZJOSA.mjs → chunk-ZSEZ76MX.mjs} +1 -1
  53. package/dist-lib/esm-chunks/{metro-layout-parser-GJHR7FCR.mjs → metro-layout-parser-XZK47I2X.mjs} +3 -3
  54. package/dist-lib/esm-chunks/{swift-package-prebuilt-UVRGKTD4.mjs → swift-package-prebuilt-G2TXZCDX.mjs} +12 -12
  55. package/dist-lib/esm-chunks/{swift-sdk-app-module-U3MUJ7QD.mjs → swift-sdk-app-module-E47CAEFE.mjs} +16 -16
  56. package/dist-lib/esm-chunks/{swift-sdk-image-U4W7QMAT.mjs → swift-sdk-image-F4JLUOXQ.mjs} +16 -16
  57. package/dist-lib/esm-chunks/{swift-sdk-image-producer-TFFZDNRK.mjs → swift-sdk-image-producer-4GDVFOQZ.mjs} +5 -5
  58. package/dist-lib/expo-swift-bundle.cjs +87 -17
  59. package/dist-lib/expo-swift-metadata.cjs +1 -1
  60. package/dist-lib/expo-swift-metadata.mjs +7 -7
  61. package/dist-lib/home-paths.cjs +1 -1
  62. package/dist-lib/host/bridge-host.cjs +148 -52
  63. package/dist-lib/host/fetch-proxy-handler.cjs +71 -4
  64. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  65. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  66. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  67. package/dist-lib/host/websocket-proxy.cjs +1 -1
  68. package/dist-lib/index.cjs +1 -1
  69. package/dist-lib/kotlin-host.cjs +1 -1
  70. package/dist-lib/menu.cjs +1 -1
  71. package/dist-lib/menu.mjs +3 -3
  72. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  73. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  74. package/dist-lib/metro-production-bundle.cjs +1 -1
  75. package/dist-lib/metro-production-bundle.mjs +4 -4
  76. package/dist-lib/native-app-identity-project.cjs +1 -1
  77. package/dist-lib/native-app-identity-project.mjs +15 -15
  78. package/dist-lib/native-app-identity.cjs +1 -1
  79. package/dist-lib/native-app-identity.mjs +6 -6
  80. package/dist-lib/native-firebase-metadata.cjs +1 -1
  81. package/dist-lib/native-firebase-metadata.mjs +3 -3
  82. package/dist-lib/pdfium-raster.cjs +1 -1
  83. package/dist-lib/pdfium-raster.mjs +2 -2
  84. package/dist-lib/plist.cjs +1 -1
  85. package/dist-lib/plist.mjs +3 -3
  86. package/dist-lib/profiles.cjs +1 -1
  87. package/dist-lib/public-brand.cjs +1 -1
  88. package/dist-lib/public-origins-lib-esm.json +85 -85
  89. package/dist-lib/public-origins-lib.json +64 -64
  90. package/dist-lib/react-native-host-modules.cjs +1 -1
  91. package/dist-lib/react-native-host-modules.mjs +2 -2
  92. package/dist-lib/reap-browser.cjs +1 -1
  93. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  94. package/dist-lib/sdk.cjs +1 -1
  95. package/dist-lib/sdk.mjs +8 -8
  96. package/dist-lib/skills.cjs +148 -52
  97. package/dist-lib/swift-compile.cjs +68 -2
  98. package/dist-lib/swift-compile.mjs +12 -12
  99. package/dist-lib/swift-package.cjs +1 -1
  100. package/dist-lib/swift-package.mjs +3 -3
  101. package/dist-lib/swift-submit.cjs +1 -1
  102. package/dist-lib/swift-submit.mjs +6 -6
  103. package/dist-lib/swift-svg-raster.cjs +1 -1
  104. package/dist-lib/swift-svg-raster.mjs +2 -2
  105. package/dist-lib/swift-toolchain.cjs +1 -1
  106. package/dist-lib/swift.cjs +1 -1
  107. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  108. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  109. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  110. package/dist-lib/vendor/acorn.cjs +1 -1
  111. package/dist-lib/vendor/magic-string.cjs +1 -1
  112. package/dist-lib/vendor/stream-json.cjs +1 -1
  113. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  114. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  115. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  116. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  117. package/dist-lib/vendor/sucrase.cjs +1 -1
  118. package/dist-lib/vendor/terser.cjs +1 -1
  119. package/dist-lib/vendor/valibot.cjs +1 -1
  120. package/dist-lib/vendor/ws.cjs +1 -1
  121. package/dist-lib/vendor/zod.cjs +1 -1
  122. package/dist-lib/worklet-executable.cjs +1 -1
  123. package/dist-lib/worklet-executable.mjs +3 -3
  124. package/kotlin/sdk.tar.gz +0 -0
  125. package/package.json +1 -1
  126. package/src/native-package-slice-build.ts +28 -4
  127. package/src/one-native-controls-package.ts +61 -35
  128. package/src/react-native-core-build.ts +12 -12
  129. package/src/react-native-core.ts +3 -7
  130. package/src/swift-compiler-digest.ts +37 -10
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2625 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2627 | (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
 
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2625 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2627 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2625 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2627 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __commonJS = (cb, mod) => function __require() {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2625 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2627 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
 
4
4
  // ../../node_modules/valibot/dist/index.cjs
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2625 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2627 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2625 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2627 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2625 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2627 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,12 +1,12 @@
1
- /*! peach v0.1.2625 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2627 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  parse
4
- } from "./esm-chunks/chunk-M2FEKSK3.mjs";
4
+ } from "./esm-chunks/chunk-M2K2SAAV.mjs";
5
5
  import {
6
6
  __privateAdd,
7
7
  __privateGet,
8
8
  __publicField
9
- } from "./esm-chunks/chunk-P542MMIN.mjs";
9
+ } from "./esm-chunks/chunk-4PPBABST.mjs";
10
10
 
11
11
  // src/worklet-kernel.ts
12
12
  var Unsupported = class extends Error {
package/kotlin/sdk.tar.gz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.2625",
3
+ "version": "0.1.2627",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -11,6 +11,7 @@ import {
11
11
  import { prepareNativeAppRoot } from './expo-native-workspace'
12
12
  import { expoPodInputs, expoPodPackages } from './expo-pod-prebuilt'
13
13
  import { cacheDir } from './home-paths'
14
+ import { installedNativeLibraries } from './installed-native-libraries'
14
15
  import { isRecord } from './is-record'
15
16
  import {
16
17
  buildExpoSwiftPackageSlice,
@@ -27,7 +28,8 @@ import { prepareNitroCompileInput } from './nitro-compile'
27
28
  import { NITRO_VIEWS_TARGET } from './nitro-source'
28
29
  import { nativePackageTreeDigest } from './package-tree-digest'
29
30
  import { reactNativeCoreFloor } from './react-native-core'
30
- import { compilerSourceDigest, compileSwiftProjectUnit } from './swift-compile'
31
+ import { compileSwiftProjectUnit } from './swift-compile'
32
+ import { swiftArchiveCompilerDigestValue } from './swift-compiler-digest'
31
33
  import { swiftDistributionRoot, swiftModuleToolchain } from './swift-distribution'
32
34
  import { swiftNativePin } from './swift-native-pin'
33
35
  import { swiftManifestTargets } from './swift-package'
@@ -144,7 +146,7 @@ export async function turboPackageSliceInputs(opts: {
144
146
  }): Promise<Record<string, string>> {
145
147
  return {
146
148
  'slice-kind': 'turbomodule',
147
- compiler: compilerSourceDigest,
149
+ compiler: swiftArchiveCompilerDigestValue(),
148
150
  'swift-pin': JSON.stringify(swiftNativePin()),
149
151
  name: opts.packageName,
150
152
  version: opts.packageVersion,
@@ -165,7 +167,7 @@ export async function nitroPackageSliceInputs(opts: {
165
167
  }): Promise<Record<string, string>> {
166
168
  return {
167
169
  'slice-kind': 'nitro',
168
- compiler: compilerSourceDigest,
170
+ compiler: swiftArchiveCompilerDigestValue(),
169
171
  'swift-pin': JSON.stringify(swiftNativePin()),
170
172
  name: opts.packageName,
171
173
  version: opts.packageVersion,
@@ -257,12 +259,25 @@ export async function buildNativePackageSlice(opts: {
257
259
  }
258
260
  }
259
261
  const reactNativeRoot = resolveReactNativeRoot(appRoot)
262
+ const installed = installedXcodeWorkspace(resolvedProjectRoot)
263
+ ? installedNativeLibraries(
264
+ providers,
265
+ resolvedProjectRoot,
266
+ moduleRoot,
267
+ opts.iosTarget,
268
+ )
269
+ : null
270
+ if (installed?.unavailable.size) {
271
+ for (const diagnostic of installed.unavailable.values()) opts.onSkip?.(diagnostic)
272
+ return null
273
+ }
260
274
  const { input, collection } = await prepareTurboCompileInput({
261
275
  appRoot,
262
276
  reactNativeRoot,
263
277
  providers,
264
278
  moduleRoot,
265
279
  projectRoot: resolvedProjectRoot,
280
+ ...(installed ? { installedPods: installed.pods } : {}),
266
281
  ...(opts.iosTarget ? { iosTarget: opts.iosTarget } : {}),
267
282
  iosDeploymentTargetFallback: reactNativeCoreFloor(reactNativeRoot),
268
283
  })
@@ -281,6 +296,13 @@ export async function buildNativePackageSlice(opts: {
281
296
  reactNativeVersion: collection.reactNative.version,
282
297
  coreMode: collection.coreMode,
283
298
  })
299
+ const pod = installed?.pods.get(providerInfo.name)
300
+ if (pod)
301
+ inputs['installed-pod'] = JSON.stringify({
302
+ files: [...pod.files].sort(),
303
+ preprocessorFlags: pod.preprocessorFlags,
304
+ mappedHeaders: [...pod.mappedHeaders].sort(),
305
+ })
284
306
  const key = nativeEntryKey(inputs)
285
307
  const cached = loadNativePackageSlice(providerInfo.name, key, { remote: false })
286
308
  if (cached) return cached
@@ -299,6 +321,7 @@ export async function buildNativePackageSlice(opts: {
299
321
  moduleRoot,
300
322
  buildRoot: compileRoot,
301
323
  intermediates: true,
324
+ linkOnly: true,
302
325
  },
303
326
  )
304
327
  const packageSwift = input.files['Package.swift'] ?? ''
@@ -401,7 +424,7 @@ export async function buildNativePackageSlice(opts: {
401
424
  // share compiled NitroCore/JsiBridge/NitroModules intermediates across slices
402
425
  const nitroCoreKey = nativeEntryKey({
403
426
  kind: 'nitro-slice-core',
404
- compiler: compilerSourceDigest,
427
+ compiler: swiftArchiveCompilerDigestValue(),
405
428
  'swift-pin': JSON.stringify(swiftNativePin()),
406
429
  'nitro-modules': collection.nitro.version,
407
430
  'react-native': collection.reactNative.version,
@@ -435,6 +458,7 @@ export async function buildNativePackageSlice(opts: {
435
458
  moduleRoot,
436
459
  buildRoot: compileRoot,
437
460
  intermediates: true,
461
+ linkOnly: true,
438
462
  },
439
463
  )
440
464
  const packageSwift = input.files['Package.swift'] ?? ''
@@ -559,44 +559,56 @@ private struct NavigationDestinationModifiers: View {
559
559
  }
560
560
  }
561
561
 
562
+ // a destination's modifier renders inside the content view of the stack that pushes it, so
563
+ // .navigationDestination runs in that stack's render pass.
564
+ private final class NavigationDestinationHost {
565
+ let model = NavigationDestinationSlots()
566
+ var controller: UIHostingController<NavigationDestinationModifiers>?
567
+
568
+ func update(_ specs: [Spec], in content: UIView, onSDKEvent: @escaping (String, String, String) -> Void) {
569
+ model.onSDKEvent = onSDKEvent
570
+ let next = specs.map { spec in
571
+ NavigationDestinationSlot(
572
+ id: spec["id"] as! String,
573
+ contentHost: spec["contentHost"] as! String,
574
+ slotValues: spec["slotValues"] as! String,
575
+ title: spec["title"] as? String ?? "",
576
+ titleMode: spec["titleMode"] as? String ?? "automatic",
577
+ barHidden: spec["barHidden"] as? Bool ?? false
578
+ )
579
+ }
580
+ guard model.slots != next else { return }
581
+ model.hosts = Dictionary(uniqueKeysWithValues: next.map { item in
582
+ let host = model.hosts[item.id] ?? UIView(frame: .zero)
583
+ host._peachReactContentHost = item.contentHost
584
+ return (item.id, host)
585
+ })
586
+ model.slots = next
587
+ if controller == nil {
588
+ let controller = UIHostingController(rootView: NavigationDestinationModifiers(model: model))
589
+ controller.view.frame = .zero
590
+ controller.view.isUserInteractionEnabled = false
591
+ controller.view.backgroundColor = .clear
592
+ content.addSubview(controller.view)
593
+ self.controller = controller
594
+ }
595
+ controller?.view.setNeedsDisplay()
596
+ }
597
+
598
+ func dismantle() {
599
+ controller?.view.removeFromSuperview()
600
+ controller = nil
601
+ }
602
+ }
603
+
562
604
  private struct NavigationStackBridge: UIViewRepresentable {
563
605
  let spec: Spec
564
606
  let emit: (String, String) -> Void
565
607
 
566
608
  final class Coordinator: ControlComposition {
567
609
  let slot = UIView(frame: .zero)
568
- let destinations = NavigationDestinationSlots()
569
- var destinationController: UIHostingController<NavigationDestinationModifiers>?
610
+ let destinations = NavigationDestinationHost()
570
611
  var toolbars: [OneNativeToolbarView] = []
571
-
572
- func updateDestinations(_ specs: [Spec]) {
573
- let next = specs.map { spec in
574
- NavigationDestinationSlot(
575
- id: spec["id"] as! String,
576
- contentHost: spec["contentHost"] as! String,
577
- slotValues: spec["slotValues"] as! String,
578
- title: spec["title"] as? String ?? "",
579
- titleMode: spec["titleMode"] as? String ?? "automatic",
580
- barHidden: spec["barHidden"] as? Bool ?? false
581
- )
582
- }
583
- guard destinations.slots != next else { return }
584
- destinations.hosts = Dictionary(uniqueKeysWithValues: next.map { item in
585
- let host = destinations.hosts[item.id] ?? UIView(frame: .zero)
586
- host._peachReactContentHost = item.contentHost
587
- return (item.id, host)
588
- })
589
- destinations.slots = next
590
- if destinationController == nil {
591
- let controller = UIHostingController(rootView: NavigationDestinationModifiers(model: destinations))
592
- controller.view.frame = .zero
593
- controller.view.isUserInteractionEnabled = false
594
- controller.view.backgroundColor = .clear
595
- slot.addSubview(controller.view)
596
- destinationController = controller
597
- }
598
- destinationController?.view.setNeedsDisplay()
599
- }
600
612
  }
601
613
 
602
614
  func makeCoordinator() -> Coordinator { Coordinator() }
@@ -617,10 +629,9 @@ private struct NavigationStackBridge: UIViewRepresentable {
617
629
  let id = root["id"] as! String
618
630
  let rootSpec = root["spec"] as! Spec
619
631
  state.slot._peachReactContentHost = spec["contentHost"] as? String
620
- state.destinations.onSDKEvent = { [weak state] id, name, value in
632
+ state.destinations.update(spec["destinationSlots"] as? [Spec] ?? [], in: state.slot) { [weak state] id, name, value in
621
633
  state?.send(id, "onNativeSDKEvent", ["name": name, "value": value])
622
634
  }
623
- state.updateDestinations(spec["destinationSlots"] as? [Spec] ?? [])
624
635
  stack.onSDKEvent = { [weak state] name, value in
625
636
  state?.send(id, "onNativeSDKEvent", ["name": name, "value": value])
626
637
  }
@@ -641,8 +652,7 @@ private struct NavigationStackBridge: UIViewRepresentable {
641
652
 
642
653
  static func dismantleUIView(_ view: OneNativeNavigationStackView, coordinator: Coordinator) {
643
654
  view.unmountContent(coordinator.slot)
644
- coordinator.destinationController?.view.removeFromSuperview()
645
- coordinator.destinationController = nil
655
+ coordinator.destinations.dismantle()
646
656
  for toolbar in coordinator.toolbars { view.unmountToolbar(toolbar) }
647
657
  coordinator.prune(keeping: [])
648
658
  coordinator.toolbars.removeAll()
@@ -783,6 +793,7 @@ private struct TabViewBridge: UIViewRepresentable {
783
793
 
784
794
  final class Coordinator: ControlComposition {
785
795
  var pageHosts: [String: OneContentHost] = [:]
796
+ var pageDestinations: [String: NavigationDestinationHost] = [:]
786
797
  var toolbars: [OneNativeToolbarView] = []
787
798
  var tabSelectionSequence = 0
788
799
 
@@ -830,6 +841,7 @@ private struct TabViewBridge: UIViewRepresentable {
830
841
  bottomAccessoryEnabled: spec["bottomAccessoryEnabled"] as? Bool ?? true
831
842
  )
832
843
  var pages: [OneNativeTabItem] = []
844
+ let destinationSlots = Dictionary(grouping: self.spec["destinationSlots"] as? [Spec] ?? []) { $0["page"] as! String }
833
845
  var toolbars: [Spec] = []
834
846
  for node in nodes {
835
847
  let page = node["spec"] as! Spec
@@ -856,6 +868,14 @@ private struct TabViewBridge: UIViewRepresentable {
856
868
  item.emit = { [weak state] name, value in
857
869
  state?.send(owner, "onNativeSDKEvent", ["name": name, "value": value])
858
870
  }
871
+ let slots = destinationSlots[owner] ?? []
872
+ if !slots.isEmpty || state.pageDestinations[owner] != nil {
873
+ let destinations = state.pageDestinations[owner] ?? NavigationDestinationHost()
874
+ state.pageDestinations[owner] = destinations
875
+ destinations.update(slots, in: item.view) { [weak state] id, name, value in
876
+ state?.send(id, "onNativeSDKEvent", ["name": name, "value": value])
877
+ }
878
+ }
859
879
  pages.append(item)
860
880
  }
861
881
  tabs.setPages(pages)
@@ -878,6 +898,10 @@ private struct TabViewBridge: UIViewRepresentable {
878
898
  state.toolbars = next
879
899
  state.prune(keeping: visited)
880
900
  state.pageHosts = state.pageHosts.filter { visited.contains($0.key) }
901
+ for (page, destinations) in state.pageDestinations where !visited.contains(page) {
902
+ destinations.dismantle()
903
+ state.pageDestinations[page] = nil
904
+ }
881
905
  }
882
906
 
883
907
  static func dismantleUIView(_ view: OneNativeTabViewView, coordinator: Coordinator) {
@@ -885,6 +909,8 @@ private struct TabViewBridge: UIViewRepresentable {
885
909
  view.reset()
886
910
  coordinator.prune(keeping: [])
887
911
  coordinator.pageHosts.removeAll()
912
+ for destinations in coordinator.pageDestinations.values { destinations.dismantle() }
913
+ coordinator.pageDestinations.removeAll()
888
914
  coordinator.toolbars.removeAll()
889
915
  }
890
916
  }
@@ -27,7 +27,18 @@ export async function buildReactNativeCore(
27
27
  const entry = reactNativeCoreEntry(reactNativeRoot, moduleRoot, mode)
28
28
  const directory = nativeEntryCache('react-native', entry.name, entry.key)
29
29
  const work = path.join(cacheDir(), 'react-native-core-build', entry.key)
30
- return withSwiftRootLock(work, async () => {
30
+ const {
31
+ compiler: _compiler,
32
+ distribution: _distribution,
33
+ recipe: _recipe,
34
+ ...nativeInputs
35
+ } = entry.inputs
36
+ const buildRoot = path.join(
37
+ cacheDir(),
38
+ 'react-native-core-products',
39
+ nativeEntryKey(nativeInputs),
40
+ )
41
+ return withSwiftRootLock(`${buildRoot}.core-lock`, async () => {
31
42
  if (fs.existsSync(path.join(directory, 'descriptor.json'))) return directory
32
43
  const module = { root: moduleRoot, ...swiftModuleToolchain(moduleRoot) }
33
44
  const floor = reactNativeCoreFloor(reactNativeRoot)
@@ -71,17 +82,6 @@ export async function buildReactNativeCore(
71
82
  input.files[input.entry] = input.entry.endsWith('.swift')
72
83
  ? '@main struct PeachCoreProducer { static func main() {} }\n'
73
84
  : 'int main() { return 0; }\n'
74
- const {
75
- compiler: _compiler,
76
- distribution: _distribution,
77
- recipe: _recipe,
78
- ...nativeInputs
79
- } = entry.inputs
80
- const buildRoot = path.join(
81
- cacheDir(),
82
- 'react-native-core-products',
83
- nativeEntryKey(nativeInputs),
84
- )
85
85
  await compileSwiftProjectUnit(input, {
86
86
  ...module,
87
87
  moduleRoot: module.root,
@@ -14,12 +14,8 @@ import {
14
14
  } from './native-prebuilt'
15
15
  import { combineNativeStaticLibraries } from './native-static-libraries'
16
16
  import { reactNativeCoreDigest } from './react-native-core-digest'
17
- import {
18
- compilerSourceDigest,
19
- swiftDistributionAt,
20
- swiftModuleDigest,
21
- swiftModuleSdk,
22
- } from './swift-compile'
17
+ import { swiftDistributionAt, swiftModuleDigest, swiftModuleSdk } from './swift-compile'
18
+ import { swiftArchiveCompilerDigestValue } from './swift-compiler-digest'
23
19
  import { swiftModuleCompiler } from './swift-distribution'
24
20
  import { isSwiftNativeTranslationUnit, swiftManifestTargets } from './swift-package'
25
21
  import { isSwiftHeaderAliases, isSwiftNativeTargets } from './swiftContract'
@@ -139,7 +135,7 @@ export function reactNativeCoreEntry(
139
135
  'react-native': manifest.version,
140
136
  headers: headers.digest('hex'),
141
137
  sources: sources.digest('hex'),
142
- compiler: compilerSourceDigest,
138
+ compiler: swiftArchiveCompilerDigestValue(),
143
139
  recipe,
144
140
  mode,
145
141
  'ios-deployment-target': reactNativeCoreFloor(reactNativeRoot),
@@ -67,18 +67,45 @@ export const SWIFT_DIGEST_SOURCES = [
67
67
  'swift-objc-sdk.ts',
68
68
  ]
69
69
 
70
- // three compiler digests fold this one in, and each read the whole sdk tree again.
71
- const digests = new Map<string, string>()
70
+ // these sources run after link-only builds have emitted their static objects.
71
+ const LINKED_IMAGE_SOURCES = new Set([
72
+ 'binaryen.lock.json',
73
+ 'swift-sdk-app-module.ts',
74
+ 'swift-sdk-image.ts',
75
+ 'wasm-optimize.ts',
76
+ ])
77
+ export const SWIFT_ARCHIVE_DIGEST_SOURCES = SWIFT_DIGEST_SOURCES.filter(
78
+ (file) => !LINKED_IMAGE_SOURCES.has(file),
79
+ )
80
+
81
+ const digests = new Map<string, { image: string; archive: string }>()
72
82
 
73
- export function swiftCompilerSourceDigest(srcDir: string): string {
83
+ export function swiftCompilerSourceDigest(
84
+ srcDir: string,
85
+ output: 'image' | 'archive' = 'image',
86
+ ): string {
74
87
  const known = digests.get(srcDir)
75
- if (known !== undefined) return known
76
- const hash = createHash('sha256')
88
+ if (known) return known[output]
89
+ const image = createHash('sha256')
90
+ const archive = createHash('sha256')
77
91
  for (const file of SWIFT_DIGEST_SOURCES) {
78
- hash.update(readFileSync(path.join(srcDir, file)))
92
+ const bytes = readFileSync(path.join(srcDir, file))
93
+ image.update(bytes)
94
+ if (!LINKED_IMAGE_SOURCES.has(file)) archive.update(bytes)
79
95
  }
80
- hash.update(JSON.stringify(readIosSdkTree(path.join(srcDir, '..', 'sdk', 'ios'))))
81
- const digest = hash.digest('hex')
82
- digests.set(srcDir, digest)
83
- return digest
96
+ const sdk = JSON.stringify(readIosSdkTree(path.join(srcDir, '..', 'sdk', 'ios')))
97
+ const result = {
98
+ image: image.update(sdk).digest('hex'),
99
+ archive: archive.update(sdk).digest('hex'),
100
+ }
101
+ digests.set(srcDir, result)
102
+ return result[output]
103
+ }
104
+
105
+ declare const __SWIFT_ARCHIVE_COMPILER_DIGEST__: string | undefined
106
+
107
+ export function swiftArchiveCompilerDigestValue(): string {
108
+ return typeof __SWIFT_ARCHIVE_COMPILER_DIGEST__ === 'string'
109
+ ? __SWIFT_ARCHIVE_COMPILER_DIGEST__
110
+ : swiftCompilerSourceDigest(import.meta.dirname, 'archive')
84
111
  }