peachsim 0.1.2304 → 0.1.2306

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 (92) hide show
  1. package/cli/commands/daemon.ts +31 -9
  2. package/dist-lib/agent-daemon-client.cjs +1 -1
  3. package/dist-lib/agent-events.cjs +1 -1
  4. package/dist-lib/attached-projects.cjs +1 -1
  5. package/dist-lib/auth/shared-session.cjs +1 -1
  6. package/dist-lib/backend-origin.cjs +1 -1
  7. package/dist-lib/beta.cjs +1 -1
  8. package/dist-lib/beta.mjs +1 -1
  9. package/dist-lib/bridge-constants.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.mjs +1 -1
  12. package/dist-lib/bridge-contract.cjs +1 -1
  13. package/dist-lib/bridge-contract.mjs +1 -1
  14. package/dist-lib/bundle-channel.cjs +190 -71
  15. package/dist-lib/capture-contract.cjs +1 -1
  16. package/dist-lib/capture-contract.mjs +1 -1
  17. package/dist-lib/cloud-contract.cjs +1 -1
  18. package/dist-lib/cloud-contract.mjs +1 -1
  19. package/dist-lib/cloud-test-args.cjs +1 -1
  20. package/dist-lib/cloud-test-args.mjs +1 -1
  21. package/dist-lib/cloud.cjs +1 -1
  22. package/dist-lib/cloud.mjs +1 -1
  23. package/dist-lib/config.cjs +1 -1
  24. package/dist-lib/config.mjs +1 -1
  25. package/dist-lib/detox/index.cjs +2 -2
  26. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  27. package/dist-lib/expo-swift-bundle.cjs +188 -69
  28. package/dist-lib/expo-swift-metadata.cjs +1 -1
  29. package/dist-lib/expo-swift-metadata.mjs +1 -1
  30. package/dist-lib/home-paths.cjs +1 -1
  31. package/dist-lib/host/bridge-host.cjs +190 -71
  32. package/dist-lib/host/fetch-proxy-handler.cjs +15 -5
  33. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  34. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  35. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  36. package/dist-lib/host/websocket-proxy.cjs +1 -1
  37. package/dist-lib/index.cjs +15 -5
  38. package/dist-lib/jump-to-source-babel.cjs +1 -1
  39. package/dist-lib/jump-to-source-native.cjs +1 -1
  40. package/dist-lib/kotlin-host.cjs +1 -1
  41. package/dist-lib/menu.cjs +1 -1
  42. package/dist-lib/menu.mjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  45. package/dist-lib/metro-production-bundle.cjs +1 -1
  46. package/dist-lib/metro-production-bundle.mjs +1 -1
  47. package/dist-lib/metro.cjs +15 -5
  48. package/dist-lib/native-app-identity-project.cjs +2 -2
  49. package/dist-lib/native-app-identity-project.mjs +2 -2
  50. package/dist-lib/native-app-identity.cjs +1 -1
  51. package/dist-lib/native-app-identity.mjs +1 -1
  52. package/dist-lib/native-firebase-metadata.cjs +1 -1
  53. package/dist-lib/native-firebase-metadata.mjs +1 -1
  54. package/dist-lib/pdfium-raster.cjs +1 -1
  55. package/dist-lib/pdfium-raster.mjs +1 -1
  56. package/dist-lib/plist.cjs +1 -1
  57. package/dist-lib/plist.mjs +1 -1
  58. package/dist-lib/profiles.cjs +1 -1
  59. package/dist-lib/public-brand.cjs +1 -1
  60. package/dist-lib/public-origins-lib-esm.json +24 -24
  61. package/dist-lib/public-origins-lib.json +61 -53
  62. package/dist-lib/react-native-host-modules.cjs +1 -1
  63. package/dist-lib/react-native-host-modules.mjs +1 -1
  64. package/dist-lib/reap-browser.cjs +1 -1
  65. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  66. package/dist-lib/sdk.cjs +1 -1
  67. package/dist-lib/sdk.mjs +1 -1
  68. package/dist-lib/skills.cjs +206 -75
  69. package/dist-lib/swift-compile.cjs +2 -2
  70. package/dist-lib/swift-compile.mjs +2 -2
  71. package/dist-lib/swift-package.cjs +1 -1
  72. package/dist-lib/swift-package.mjs +1 -1
  73. package/dist-lib/swift-submit.cjs +1 -1
  74. package/dist-lib/swift-submit.mjs +1 -1
  75. package/dist-lib/swift-toolchain.cjs +1 -1
  76. package/dist-lib/swift.cjs +1 -1
  77. package/dist-lib/vite-swift.cjs +4 -4
  78. package/dist-lib/vite.cjs +15 -5
  79. package/dist-lib/worklet-executable.cjs +1 -1
  80. package/dist-lib/worklet-executable.mjs +1 -1
  81. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +0 -5
  82. package/dist-types/packages/peach-globals/src/webViewBridgeContract.d.ts +3 -0
  83. package/java-platform/licenses/fdlibm.txt +3 -0
  84. package/kotlin/sdk.tar.gz +0 -0
  85. package/package.json +1 -1
  86. package/runtime-companion.json +1 -1
  87. package/sdk/ios/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewController.h +1 -1
  88. package/src/expo-native-workspace.ts +3 -23
  89. package/src/git-repo-env.ts +27 -0
  90. package/src/native-static-libraries.ts +1 -1
  91. package/src/swift-packages.ts +4 -20
  92. package/src/turbo-source.ts +148 -22
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2304 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2306 | (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;
@@ -2742,7 +2742,7 @@ var init_src = __esm({
2742
2742
  var runtime_companion_default;
2743
2743
  var init_runtime_companion = __esm({
2744
2744
  "runtime-companion.json"() {
2745
- runtime_companion_default = { abi: 1, sha256: "398e7fb3724442c4c182acf71a5188023c983cf7e0438fa4e0d668c039ce3b07", file: "node/cli-398e7fb3724442c4c182acf71a5188023c983cf7e0438fa4e0d668c039ce3b07.cjs" };
2745
+ runtime_companion_default = { abi: 1, sha256: "0fab660670984b60962d163f3e174d3f27f6685e8c3e262164e28d6e6b52ad8d", file: "node/cli-0fab660670984b60962d163f3e174d3f27f6685e8c3e262164e28d6e6b52ad8d.cjs" };
2746
2746
  }
2747
2747
  });
2748
2748
 
@@ -3105,7 +3105,7 @@ var STANDIN_SOURCE_DIGEST;
3105
3105
  var init_swift_standin_digest = __esm({
3106
3106
  "src/swift-standin-digest.ts"() {
3107
3107
  "use strict";
3108
- STANDIN_SOURCE_DIGEST = true ? "6002e019e3756e603da7a6845af874da053d7724cb1f91276d6e7928d2546e5e" : standinSourceDigest();
3108
+ STANDIN_SOURCE_DIGEST = true ? "0ffa2547ef06e12d293047c1e51c99b46325d43c9a029d4d9a9586b75f24b39b" : standinSourceDigest();
3109
3109
  }
3110
3110
  });
3111
3111
 
@@ -3116,6 +3116,13 @@ var init_admitted_mac_build = __esm({
3116
3116
  }
3117
3117
  });
3118
3118
 
3119
+ // src/git-repo-env.ts
3120
+ var init_git_repo_env = __esm({
3121
+ "src/git-repo-env.ts"() {
3122
+ "use strict";
3123
+ }
3124
+ });
3125
+
3119
3126
  // src/native-git.ts
3120
3127
  var init_native_git = __esm({
3121
3128
  "src/native-git.ts"() {
@@ -4758,7 +4765,7 @@ var init_swift_compile = __esm({
4758
4765
  FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
4759
4766
  (module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
4760
4767
  ).join("");
4761
- compilerSourceDigest = true ? "38c735ffbd31a005ec0e9662f0fa716aaed8b65aeec0d1592bde2e835f179458" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
4768
+ compilerSourceDigest = true ? "dda8eea414f224c24308031855c896c38101ab0d31acbc7060436bc1d4aadf0d" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
4762
4769
  CORE_FOUNDATION_HANDLE_IMPORTS = [
4763
4770
  "CFAllocator",
4764
4771
  "CFArray",
@@ -5148,6 +5155,7 @@ var init_swift_packages = __esm({
5148
5155
  "use strict";
5149
5156
  import_node_child_process11 = require("node:child_process");
5150
5157
  import_node_util7 = require("node:util");
5158
+ init_git_repo_env();
5151
5159
  init_home_paths();
5152
5160
  init_native_git();
5153
5161
  init_numbered_lock();
@@ -5290,7 +5298,7 @@ var init_react_native_core = __esm({
5290
5298
  init_swift_distribution();
5291
5299
  init_swift_package();
5292
5300
  init_swiftContract();
5293
- recipe = true ? "94bdffa4aff4ff16c60f96c0342d7ef854fdf80a49d5fd2cee48a92de5885962" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
5301
+ recipe = true ? "ad6a6672a4c7d5539690da16e5a429437230d138b36c48e3963d5e9f9ddad98e" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
5294
5302
  }
5295
5303
  });
5296
5304
 
@@ -5484,6 +5492,7 @@ var init_turbo_source = __esm({
5484
5492
  init_podspec_sources();
5485
5493
  init_swift_source_file();
5486
5494
  init_swift_submit();
5495
+ init_swiftContract();
5487
5496
  init_turbo_codegen_intake();
5488
5497
  init_xcode_project();
5489
5498
  execFileAsync3 = (0, import_node_util9.promisify)(import_node_child_process13.execFile);
@@ -9596,6 +9605,7 @@ init_admitted_mac_build();
9596
9605
  var import_ignore = __toESM(require("ignore"), 1);
9597
9606
 
9598
9607
  // src/expo-native-workspace.ts
9608
+ init_git_repo_env();
9599
9609
  init_home_paths();
9600
9610
 
9601
9611
  // src/native-failure-output.ts
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2304 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2306 | (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,4 +1,4 @@
1
- /*! peach v0.1.2304 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2306 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __typeError = (msg) => {
4
4
  throw TypeError(msg);
@@ -137,7 +137,6 @@ export interface SceneNativeBinding {
137
137
  _peach_scene_paint_extent(slot: number, x: number, y: number, width: number, height: number, skipPortalViews: number, subtree: number): number;
138
138
  _peach_scene_paint_extent_out(): number;
139
139
  _peach_scene_reader_reach(slot: number): number;
140
- peachRasterTransformParameters?: (slot: number, out: number) => number;
141
140
  _peach_scene_raster_candidate(slot: number): void;
142
141
  _peach_style_record(): number;
143
142
  _peach_style_apply(slot: number, structuralFlags: number): number;
@@ -151,7 +150,6 @@ export interface SceneNativeBinding {
151
150
  _peach_classic_layout_clear(slot: number): void;
152
151
  _peach_classic_layout_progress(progress: number): void;
153
152
  _peach_classic_layout_sample(slot: number, timestamp: number): number;
154
- peachExtentParameters?: (slot: number) => void;
155
153
  _peach_scene_set_buffers(integers: number, doubles: number, floats: number, layoutMatrices: number): void;
156
154
  _peach_scene_slots_adopt(next: number, generations: number, parents: number, free: number, freeCount: number): void;
157
155
  _peach_scene_slot_allocate(): number;
@@ -308,8 +306,6 @@ export declare class SceneTable {
308
306
  f64(): Float64Array;
309
307
  f32(): Float32Array;
310
308
  allocate(node: object, tag: number, flags: number): number;
311
- setRasterTransformPublisher(publisher: (node: object, output: () => Float64Array) => number): void;
312
- setExtentPublisher(reader: (node: object) => void): void;
313
309
  setStyleReplayer(replay: (node: object) => void): void;
314
310
  setStickyOffsetReader(reader: (node: object) => number): void;
315
311
  setPaintExtentPublisher(publisher: PaintExtentPublisher): void;
@@ -399,7 +395,6 @@ export declare class SceneTable {
399
395
  writeZoom(slot: number, zoom: number | undefined): void;
400
396
  writeStyle(slot: number, style: SootSimStyle, resolve: (value: unknown) => unknown, owned?: Readonly<Record<string, unknown>> | null): Float64Array | undefined;
401
397
  applyStyleRecord(slot: number, record: Float64Array, style: SootSimStyle, resolve: (value: unknown) => unknown, owned?: Readonly<Record<string, unknown>> | null): void;
402
- writeExtentStyle(slot: number, style: SootSimStyle, resolve: (value: unknown) => unknown): void;
403
398
  writeLayoutMatrix(slot: number, transform: SootSimStyle['transform'], transformOrigin: SootSimStyle['transformOrigin'], resolve: (value: unknown) => unknown): void;
404
399
  writeTransform(slot: number, transform: SootSimStyle['transform'], transformOrigin: SootSimStyle['transformOrigin'], resolve: (value: unknown) => unknown): void;
405
400
  writePaintedBox(slot: number, x: number, y: number, width: number, height: number, animated: boolean, transform: SootSimStyle['transform'], transformOrigin: SootSimStyle['transformOrigin'], resolve: (value: unknown) => unknown): void;
@@ -29,6 +29,7 @@ export type SootSimWebViewHostRequest = {
29
29
  documentData?: PeachWebViewDocumentData;
30
30
  minimumFontSize?: number;
31
31
  elementFullscreenEnabled?: boolean;
32
+ mediaTypesRequiringUserAction?: SootSimWebViewMediaTypes;
32
33
  html?: string;
33
34
  config: string;
34
35
  beforeKey: string;
@@ -209,9 +210,11 @@ export interface SootSimWebViewCookieStore {
209
210
  cookies: string;
210
211
  policy: 0 | 1;
211
212
  }
213
+ export type SootSimWebViewMediaTypes = 'none' | 'audio' | 'video' | 'all';
212
214
  export interface SootSimWebViewSpec extends Partial<NativeSurfacePresentation> {
213
215
  minimumFontSize?: number;
214
216
  elementFullscreenEnabled?: boolean;
217
+ mediaTypesRequiringUserAction?: SootSimWebViewMediaTypes;
215
218
  cookieStore?: SootSimWebViewCookieStore;
216
219
  captureOwner?: {
217
220
  surfaceId: string;
@@ -73,3 +73,6 @@ SUCH DAMAGE.
73
73
 
74
74
  JavaHypot.kt is derived from Bionic/FreeBSD e_hypot.c under the SunSoft notice.
75
75
  https://android.googlesource.com/platform/bionic/+/refs/heads/android17-release/libm/upstream-freebsd/lib/msun/src/e_hypot.c
76
+
77
+ JavaLog1p.kt is derived from Bionic/FreeBSD s_log1p.c under the SunSoft notice.
78
+ https://android.googlesource.com/platform/bionic/+/refs/heads/android17-release/libm/upstream-freebsd/lib/msun/src/s_log1p.c
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.2304",
3
+ "version": "0.1.2306",
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",
@@ -1 +1 @@
1
- {"abi":1,"sha256":"398e7fb3724442c4c182acf71a5188023c983cf7e0438fa4e0d668c039ce3b07","file":"node/cli-398e7fb3724442c4c182acf71a5188023c983cf7e0438fa4e0d668c039ce3b07.cjs"}
1
+ {"abi":1,"sha256":"0fab660670984b60962d163f3e174d3f27f6685e8c3e262164e28d6e6b52ad8d","file":"node/cli-0fab660670984b60962d163f3e174d3f27f6685e8c3e262164e28d6e6b52ad8d.cjs"}
@@ -14,7 +14,7 @@
14
14
 
15
15
  NS_ASSUME_NONNULL_BEGIN
16
16
 
17
- NS_CLASS_AVAILABLE_IOS(4_0) QL_EXPORT PEACH_SWIFT_CLASS(SwiftUI)
17
+ NS_CLASS_AVAILABLE_IOS(4_0) QL_EXPORT
18
18
  @interface QLPreviewController : UIViewController
19
19
 
20
20
  /*!
@@ -8,6 +8,7 @@ import { promisify } from 'node:util'
8
8
  import { detectPackageManager } from '../cli/commands/detect'
9
9
  import { teamMachineInstalled } from './admitted-mac-build'
10
10
  import { workspaceExclusion, type WorkspaceExclusion } from './expo-workspace-exclusion'
11
+ import { withoutGitRepositoryEnv } from './git-repo-env'
11
12
  import { cacheDir } from './home-paths'
12
13
  import { failedOutputLine } from './native-failure-output'
13
14
  import { requireNativeGit } from './native-git'
@@ -34,27 +35,7 @@ const isolatedGitEnv = {
34
35
  }
35
36
 
36
37
  function cleanWorkspaceGitEnv(): NodeJS.ProcessEnv {
37
- const env: NodeJS.ProcessEnv = { ...process.env }
38
- for (const key of [
39
- 'GIT_DIR',
40
- 'GIT_COMMON_DIR',
41
- 'GIT_WORK_TREE',
42
- 'GIT_INDEX_FILE',
43
- 'GIT_OBJECT_DIRECTORY',
44
- 'GIT_ALTERNATE_OBJECT_DIRECTORIES',
45
- 'GIT_PREFIX',
46
- 'GIT_SHALLOW_FILE',
47
- 'GIT_GRAFT_FILE',
48
- 'GIT_NAMESPACE',
49
- 'GIT_IMPLICIT_WORK_TREE',
50
- 'GIT_CONFIG',
51
- 'GIT_CEILING_DIRECTORIES',
52
- 'GIT_DISCOVERY_ACROSS_FILESYSTEM',
53
- 'GIT_SUPER_PREFIX',
54
- ]) {
55
- delete env[key]
56
- }
57
- return { ...env, ...isolatedGitEnv }
38
+ return { ...withoutGitRepositoryEnv(), ...isolatedGitEnv }
58
39
  }
59
40
 
60
41
  // CocoaPods refuses a non UTF-8 locale, so even its version probe names one.
@@ -1215,8 +1196,7 @@ async function runAdmitted(
1215
1196
  {
1216
1197
  cwd,
1217
1198
  env: {
1218
- ...process.env,
1219
- ...isolatedGitEnv,
1199
+ ...cleanWorkspaceGitEnv(),
1220
1200
  EXPO_NO_TELEMETRY: '1',
1221
1201
  LANG: 'en_US.UTF-8',
1222
1202
  LC_ALL: 'en_US.UTF-8',
@@ -0,0 +1,27 @@
1
+ const GIT_REPOSITORY_ENV_KEYS: readonly string[] = [
2
+ 'GIT_DIR',
3
+ 'GIT_COMMON_DIR',
4
+ 'GIT_WORK_TREE',
5
+ 'GIT_INDEX_FILE',
6
+ 'GIT_OBJECT_DIRECTORY',
7
+ 'GIT_ALTERNATE_OBJECT_DIRECTORIES',
8
+ 'GIT_PREFIX',
9
+ 'GIT_SHALLOW_FILE',
10
+ 'GIT_GRAFT_FILE',
11
+ 'GIT_NAMESPACE',
12
+ 'GIT_IMPLICIT_WORK_TREE',
13
+ 'GIT_CONFIG',
14
+ 'GIT_CEILING_DIRECTORIES',
15
+ 'GIT_DISCOVERY_ACROSS_FILESYSTEM',
16
+ 'GIT_SUPER_PREFIX',
17
+ ]
18
+
19
+ export function withoutGitRepositoryEnv(
20
+ source: NodeJS.ProcessEnv = process.env,
21
+ ): NodeJS.ProcessEnv {
22
+ const env: NodeJS.ProcessEnv = { ...source }
23
+ for (const key of GIT_REPOSITORY_ENV_KEYS) {
24
+ delete env[key]
25
+ }
26
+ return env
27
+ }
@@ -55,7 +55,7 @@ export const NATIVE_STATIC_LIBRARY_RECIPES = [
55
55
  nativeSha256: 'b91cd08892ebe0cdd39e1336594bb66cd79fc639a894303805792047d24f468b',
56
56
  upstream: 'ed59cc48e37ac33ac15b252fc5ad7af4b9ecd51d',
57
57
  // updated with the native producer script and port patches.
58
- recipe: 'cea231f8139cf2b44a3f2b309ce8a99b9ee3e3ff52b5120780bc5969a22f8059',
58
+ recipe: '7914af52f8a3694215d7422b01209490237921826e18438d5f1004775769ab63',
59
59
  archive: 'libessentia.a',
60
60
  },
61
61
  {
@@ -15,6 +15,7 @@ import fs from 'node:fs'
15
15
  import path from 'node:path'
16
16
  import { setTimeout as sleep } from 'node:timers/promises'
17
17
  import { promisify } from 'node:util'
18
+ import { withoutGitRepositoryEnv } from './git-repo-env'
18
19
  import { cacheDir } from './home-paths'
19
20
  import { requireNativeGit } from './native-git'
20
21
  import { tryAcquireNumberedLock } from './numbered-lock'
@@ -343,27 +344,10 @@ async function fetchCheckout(
343
344
  if (preparedSwiftPin(checkouts, identity, pin.location, pin.revision)) return
344
345
  requireNativeGit()
345
346
  const key = checkoutKey(dir, pin)
346
- const gitEnv: NodeJS.ProcessEnv = { ...process.env }
347
- for (const name of [
348
- 'GIT_DIR',
349
- 'GIT_COMMON_DIR',
350
- 'GIT_WORK_TREE',
351
- 'GIT_INDEX_FILE',
352
- 'GIT_OBJECT_DIRECTORY',
353
- 'GIT_ALTERNATE_OBJECT_DIRECTORIES',
354
- 'GIT_PREFIX',
355
- 'GIT_SHALLOW_FILE',
356
- 'GIT_GRAFT_FILE',
357
- 'GIT_NAMESPACE',
358
- 'GIT_IMPLICIT_WORK_TREE',
359
- 'GIT_CONFIG',
360
- 'GIT_CEILING_DIRECTORIES',
361
- 'GIT_DISCOVERY_ACROSS_FILESYSTEM',
362
- 'GIT_SUPER_PREFIX',
363
- ]) {
364
- delete gitEnv[name]
347
+ const gitEnv: NodeJS.ProcessEnv = {
348
+ ...withoutGitRepositoryEnv(),
349
+ GIT_TERMINAL_PROMPT: '0',
365
350
  }
366
- gitEnv.GIT_TERMINAL_PROMPT = '0'
367
351
  const git: Git = async (cwd, ...args) =>
368
352
  (
369
353
  await execFileAsync('git', ['-C', cwd, ...args], {
@@ -43,6 +43,7 @@ import {
43
43
  } from './podspec-sources'
44
44
  import { readPackageFile, relativeInside } from './swift-source-file'
45
45
  import { MAX_SWIFT_COMPILE_SOURCE_BYTES } from './swift-submit'
46
+ import { SWIFT_NATIVE_INPUT_ROOT, type SwiftNativeHeaderMap } from './swiftContract'
46
47
  import {
47
48
  installedFabricSources,
48
49
  type FabricPodSources,
@@ -53,7 +54,6 @@ import { installedXcodeWorkspace, readXcodeAppTarget } from './xcode-project'
53
54
  import type { ReactNativeCoreMode } from './react-native-core'
54
55
  import type { SwiftCompileInput } from './swift-compile'
55
56
  import type { SwiftPackageTarget } from './swift-package'
56
- import type { SwiftNativeHeaderMap } from './swiftContract'
57
57
 
58
58
  type TurboPackage = { name: string; version: string; root: string }
59
59
 
@@ -1259,15 +1259,17 @@ export async function collectTurboSources(options: {
1259
1259
  flattensPublicHeaders: false,
1260
1260
  bridgingHeader: null,
1261
1261
  prefixHeader,
1262
- headerSearchPaths: [
1263
- `${targetPath(targetName)}/include`,
1264
- `${targetPath(TURBO_CORE_TARGET)}/include`,
1265
- ],
1262
+ headerSearchPaths: [`${targetPath(targetName)}/include`],
1266
1263
  userHeaderSearchPaths: [],
1267
1264
  frameworkSearchPaths: [],
1268
1265
  headerMaps: [],
1269
1266
  productHeaders: {},
1270
- flags: [],
1267
+ // TurboCore's aliased React headers compile the units but never reach
1268
+ // a Swift importer, whose React module is the app's own
1269
+ flags: [
1270
+ '-I',
1271
+ `${SWIFT_NATIVE_INPUT_ROOT}/${targetPath(TURBO_CORE_TARGET)}/include`,
1272
+ ],
1271
1273
  importerFlags: [],
1272
1274
  cxxFlags: [],
1273
1275
  fileFlags: {},
@@ -2923,7 +2925,8 @@ ${
2923
2925
  @end
2924
2926
 
2925
2927
  // an app's Fabric component views, which its own Fabric host defines
2926
- extern "C" void peachInstallFabricViews(facebook::jsi::Runtime &runtime) __attribute__((weak));
2928
+ void peachInstallFabricViews(facebook::jsi::Runtime &runtime, std::shared_ptr<facebook::react::CallInvoker> invoker) __attribute__((weak));
2929
+ void peachTeardownFabricViews() __attribute__((weak));
2927
2930
 
2928
2931
  // UIKitCore: the key window and root view controller an app delegate makes at launch
2929
2932
  extern "C" void PeachLaunchReactNativeWindow(void);
@@ -2945,6 +2948,7 @@ extern "C" void peachTurboInitialize() {
2945
2948
  auto& runtime = peach::jsi_runtime::create(
2946
2949
  [] { invoker->drain(); },
2947
2950
  [] {
2951
+ if (peachTeardownFabricViews) peachTeardownFabricViews();
2948
2952
  [manager invalidate];
2949
2953
  manager = nil;
2950
2954
  delegate = nil;
@@ -3006,7 +3010,7 @@ ${
3006
3010
  }];
3007
3011
  [decorator.moduleRegistry setTurboModuleRegistry:manager];
3008
3012
  [manager installJSBindings:runtime];
3009
- if (peachInstallFabricViews) peachInstallFabricViews(runtime);
3013
+ if (peachInstallFabricViews) peachInstallFabricViews(runtime, invoker);
3010
3014
  }
3011
3015
 
3012
3016
  // the screenshot the device took, as UIKit posts it to every observer in the
@@ -3057,13 +3061,22 @@ const FABRIC_HOST_INCLUDES = `#import <Foundation/Foundation.h>
3057
3061
  #import <React/RCTComponentViewFactory.h>
3058
3062
  #import <React/RCTComponentViewProtocol.h>
3059
3063
  #import <React/RCTComponentViewRegistry.h>
3064
+ #import <ReactCommon/RCTTurboModule.h>
3065
+ #include <ReactCommon/CallInvoker.h>
3060
3066
  #include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
3067
+ #include <react/renderer/core/EventBeat.h>
3068
+ #include <react/renderer/core/EventDispatcher.h>
3069
+ #include <react/renderer/core/EventQueueProcessor.h>
3070
+ #include <react/renderer/core/InstanceHandle.h>
3061
3071
  #include <react/renderer/core/LayoutMetrics.h>
3062
3072
  #include <react/renderer/core/PropsParserContext.h>
3063
3073
  #include <react/renderer/core/RawProps.h>
3074
+ #include <react/renderer/core/StateUpdate.h>
3075
+ #include <react/renderer/runtimescheduler/RuntimeScheduler.h>
3064
3076
  #include <react/utils/ContextContainer.h>
3065
3077
  #include <cstdio>
3066
3078
  #include <cstdlib>
3079
+ #include <optional>
3067
3080
  #include <unordered_map>
3068
3081
  #include <jsi/jsi.h>
3069
3082
 
@@ -3074,8 +3087,12 @@ using namespace facebook;
3074
3087
  // mounts them (RCTPerformMountInstructions): the component view factory with
3075
3088
  // the app's third-party components, one registry dequeuing and recycling
3076
3089
  // views, and props each component's descriptor clones from the props React
3077
- // passes. the engine lays the view out and paints its style; the view is the
3078
- // content of a root of this process.
3090
+ // passes. each view's family carries the instance handle the engine passes,
3091
+ // so its event emitter dispatches through an EventDispatcher whose pipe calls
3092
+ // the engine as UIManagerBinding::dispatchEventToJS calls React, and its state
3093
+ // updates reach the view as UIManager::updateState's commit would. the engine
3094
+ // lays the view out and paints its style; the view is the content of a root of
3095
+ // this process.
3079
3096
  function fabricHostSource(views: readonly FabricComponent[]): string {
3080
3097
  const entries = views
3081
3098
  .map(
@@ -3098,13 +3115,20 @@ namespace {
3098
3115
  struct PeachFabricView {
3099
3116
  react::ComponentHandle handle;
3100
3117
  const react::ComponentDescriptor *descriptor;
3118
+ react::ShadowNodeFamily::Shared family;
3101
3119
  react::Props::Shared props;
3120
+ react::State::Shared state;
3102
3121
  react::LayoutMetrics layoutMetrics;
3103
3122
  };
3104
3123
  PeachFabricComponents *fabricComponents;
3105
3124
  RCTComponentViewRegistry *fabricRegistry;
3106
- std::shared_ptr<const react::ContextContainer> fabricContext;
3125
+ std::shared_ptr<react::ContextContainer> fabricContext;
3107
3126
  react::ComponentDescriptorRegistry::Shared fabricDescriptors;
3127
+ std::shared_ptr<react::CallInvoker> fabricInvoker;
3128
+ std::shared_ptr<react::RuntimeScheduler> fabricScheduler;
3129
+ std::shared_ptr<const void> fabricOwner;
3130
+ std::shared_ptr<const react::EventDispatcher> fabricDispatcher;
3131
+ std::optional<jsi::Function> fabricEventHandler;
3108
3132
  std::unordered_map<int, PeachFabricView> fabricViews;
3109
3133
  int nextFabricView = 1;
3110
3134
  std::string fabricNames = ${JSON.stringify(views.map(({ name }) => name).join('\n'))};
@@ -3123,32 +3147,112 @@ react::Props::Shared fabricCloneProps(jsi::Runtime &rt, const PeachFabricView &v
3123
3147
  return view.descriptor->cloneProps(context, view.props, react::RawProps(rt, props));
3124
3148
  }
3125
3149
 
3150
+ // the beat React Native's run loop observer gives: queued events flush once
3151
+ // the call that queued them returns
3152
+ class PeachFabricEventBeat final : public react::EventBeat {
3153
+ public:
3154
+ PeachFabricEventBeat(std::shared_ptr<OwnerBox> ownerBox, react::RuntimeScheduler &scheduler)
3155
+ : EventBeat(ownerBox, scheduler), box(std::move(ownerBox)) {}
3156
+ void request() const override {
3157
+ EventBeat::request();
3158
+ std::weak_ptr<const void> owner = box->owner;
3159
+ fabricInvoker->invokeAsync([this, owner](jsi::Runtime &) {
3160
+ if (owner.lock()) induce();
3161
+ });
3162
+ }
3163
+
3164
+ private:
3165
+ std::shared_ptr<OwnerBox> box;
3166
+ };
3167
+
3168
+ // UIManager::updateState reads a state's data as State's friend; a member
3169
+ // pointer named through a derived class reaches the same accessor
3170
+ struct PeachStateData : react::State {
3171
+ static constexpr auto data = &PeachStateData::getDataPointer;
3172
+ };
3173
+
3174
+ // UIManager::dispatchEventToJS: the instance handle the engine gave the view,
3175
+ // the event type and its payload with the target tag and timestamp
3176
+ void fabricDispatchEvent(
3177
+ jsi::Runtime &rt,
3178
+ react::EventTarget *target,
3179
+ const std::string &type,
3180
+ react::ReactEventPriority,
3181
+ const react::EventPayload &eventPayload,
3182
+ react::HighResTimeStamp timestamp) {
3183
+ auto payload = eventPayload.asJSIValue(rt);
3184
+ if (payload.isNull() || !fabricEventHandler || !target) return;
3185
+ auto handle = target->getInstanceHandle(rt);
3186
+ if (handle.isUndefined() || handle.isNull()) return;
3187
+ if (payload.isObject()) {
3188
+ auto object = payload.asObject(rt);
3189
+ object.setProperty(rt, "target", target->getTag());
3190
+ if (!object.hasProperty(rt, "timeStamp"))
3191
+ object.setProperty(rt, "timeStamp", timestamp.toDOMHighResTimeStamp());
3192
+ }
3193
+ fabricEventHandler->call(rt, std::move(handle), jsi::String::createFromUtf8(rt, type), std::move(payload));
3194
+ }
3195
+
3196
+ // UIManager::updateState with the engine's tree in place of the shadow tree:
3197
+ // the view's next state, then the update its commit would mount
3198
+ void fabricUpdateState(const react::StateUpdate &update) {
3199
+ int tag = update.family->getTag();
3200
+ auto found = fabricViews.find(tag);
3201
+ if (found == fabricViews.end() || !found->second.state) return;
3202
+ auto &view = found->second;
3203
+ auto data = update.callback(((*view.state).*PeachStateData::data)());
3204
+ if (!data) return;
3205
+ auto oldState = view.state;
3206
+ view.state = view.descriptor->createState(*view.family, data);
3207
+ UIView<RCTComponentViewProtocol> *componentView = [fabricRegistry componentViewDescriptorWithTag:tag].view;
3208
+ [componentView updateState:view.state oldState:oldState];
3209
+ [componentView finalizeUpdates:RNComponentViewUpdateMaskState];
3210
+ }
3211
+
3126
3212
  } // namespace
3127
3213
 
3128
- extern "C" void peachInstallFabricViews(jsi::Runtime &rt) {
3214
+ void peachInstallFabricViews(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> invoker) {
3215
+ fabricInvoker = std::move(invoker);
3129
3216
  fabricComponents = [PeachFabricComponents new];
3130
3217
  RCTComponentViewFactory *factory = [RCTComponentViewFactory currentComponentViewFactory];
3131
3218
  factory.thirdPartyFabricComponentsProvider = fabricComponents;
3132
3219
  fabricRegistry = [RCTComponentViewRegistry new];
3133
- fabricContext = std::make_shared<const react::ContextContainer>();
3134
- react::ComponentDescriptorParameters parameters{{}, fabricContext, nullptr};
3220
+ fabricContext = std::make_shared<react::ContextContainer>();
3221
+ fabricScheduler = std::make_shared<react::RuntimeScheduler>(
3222
+ [](std::function<void(jsi::Runtime &)> &&work) { fabricInvoker->invokeAsync(std::move(work)); });
3223
+ fabricContext->insert(react::RuntimeSchedulerKey, std::weak_ptr<react::RuntimeScheduler>(fabricScheduler));
3224
+ fabricOwner = std::make_shared<int>(0);
3225
+ auto box = std::make_shared<react::EventBeat::OwnerBox>();
3226
+ box->owner = fabricOwner;
3227
+ auto conclusion = [](jsi::Runtime &rt) { fabricScheduler->callExpiredTasks(rt); };
3228
+ fabricDispatcher = std::make_shared<const react::EventDispatcher>(
3229
+ react::EventQueueProcessor(fabricDispatchEvent, conclusion, fabricUpdateState, std::weak_ptr<react::EventLogger>()),
3230
+ std::make_unique<PeachFabricEventBeat>(box, *fabricScheduler),
3231
+ fabricUpdateState,
3232
+ std::weak_ptr<react::EventLogger>());
3233
+ react::ComponentDescriptorParameters parameters{fabricDispatcher, fabricContext, nullptr};
3135
3234
  fabricDescriptors = [factory createComponentDescriptorRegistryWithParameters:parameters];
3136
3235
  auto views = jsi::Object(rt);
3137
3236
  auto method = [&](const char *name, unsigned count, jsi::HostFunctionType body) {
3138
3237
  views.setProperty(rt, name, jsi::Function::createFromHostFunction(rt, jsi::PropNameID::forAscii(rt, name), count, std::move(body)));
3139
3238
  };
3140
- // Create then Insert: the first props, no event emitter or state, and the
3141
- // layout the view has before the engine measures it
3142
- method("create", 2, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
3239
+ // create(name, instanceHandle, props), Create then Insert: the family the
3240
+ // handle's events resolve through, the first props, the initial state, and
3241
+ // the layout the view has before the engine measures it
3242
+ method("create", 3, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
3143
3243
  const auto &descriptor = fabricDescriptors->at(args[0].asString(rt).utf8(rt));
3144
3244
  int tag = nextFabricView++;
3145
- auto &view = fabricViews.emplace(tag, PeachFabricView{descriptor.getComponentHandle(), &descriptor, nullptr, {}}).first->second;
3146
- view.props = fabricCloneProps(rt, view, args[1]);
3245
+ auto family = descriptor.createFamily(
3246
+ {.tag = tag, .surfaceId = -1, .instanceHandle = std::make_shared<const react::InstanceHandle>(rt, args[1], tag)});
3247
+ auto &view = fabricViews.emplace(tag, PeachFabricView{descriptor.getComponentHandle(), &descriptor, family, nullptr, nullptr, {}}).first->second;
3248
+ view.props = fabricCloneProps(rt, view, args[2]);
3249
+ view.state = descriptor.createInitialState(view.props, family);
3250
+ family->getEventEmitter()->setEnabled(true);
3147
3251
  UIView<RCTComponentViewProtocol> *componentView =
3148
3252
  [fabricRegistry dequeueComponentViewWithComponentHandle:view.handle tag:tag].view;
3149
3253
  [componentView updateProps:view.props oldProps:nullptr];
3150
- [componentView updateEventEmitter:nullptr];
3151
- [componentView updateState:nullptr oldState:nullptr];
3254
+ [componentView updateEventEmitter:family->getEventEmitter()];
3255
+ [componentView updateState:view.state oldState:nullptr];
3152
3256
  [componentView updateLayoutMetrics:view.layoutMetrics oldLayoutMetrics:react::EmptyLayoutMetrics];
3153
3257
  [componentView finalizeUpdates:RNComponentViewUpdateMaskAll];
3154
3258
  return jsi::Value(tag);
@@ -3178,19 +3282,41 @@ extern "C" void peachInstallFabricViews(jsi::Runtime &rt) {
3178
3282
  [componentView finalizeUpdates:RNComponentViewUpdateMaskLayoutMetrics];
3179
3283
  return jsi::Value::undefined();
3180
3284
  });
3181
- // Remove then Delete: the registry recycles the view
3285
+ // Remove then Delete: the family's emitter stops at once, as an unmounted
3286
+ // family's does, and the registry recycles the view
3182
3287
  method("drop", 1, [](jsi::Runtime &, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
3183
3288
  int tag = static_cast<int>(args[0].asNumber());
3184
3289
  auto &view = fabricView(tag);
3290
+ view.family->getEventEmitter()->setEnabled(false);
3185
3291
  RCTComponentViewDescriptor descriptor = [fabricRegistry componentViewDescriptorWithTag:tag];
3186
3292
  [descriptor.view removeFromSuperview];
3187
3293
  [fabricRegistry enqueueComponentViewWithComponentHandle:view.handle tag:tag componentViewDescriptor:descriptor];
3188
3294
  fabricViews.erase(tag);
3189
3295
  return jsi::Value::undefined();
3190
3296
  });
3297
+ // RCTMountingManager::dispatchCommand: the view's handleCommand:args:
3298
+ method("command", 3, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
3299
+ int tag = static_cast<int>(args[0].asNumber());
3300
+ fabricView(tag);
3301
+ NSArray *commandArgs = react::TurboModuleConvertUtils::convertJSIValueToObjCObject(rt, args[2], fabricInvoker);
3302
+ [[fabricRegistry componentViewDescriptorWithTag:tag].view handleCommand:@(args[1].asString(rt).utf8(rt).c_str())
3303
+ args:commandArgs];
3304
+ return jsi::Value::undefined();
3305
+ });
3306
+ // the function React's dispatchEvent stands for: (instanceHandle, type, payload)
3307
+ method("setEventHandler", 1, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
3308
+ fabricEventHandler = args[0].asObject(rt).asFunction(rt);
3309
+ return jsi::Value::undefined();
3310
+ });
3191
3311
  rt.global().setProperty(rt, "peachFabricViews", std::move(views));
3192
3312
  }
3193
3313
 
3314
+ // the runtime's functions go before the runtime does
3315
+ void peachTeardownFabricViews() {
3316
+ fabricOwner.reset();
3317
+ fabricEventHandler.reset();
3318
+ }
3319
+
3194
3320
  extern "C" void *peach_fabric_view_content(int tag) {
3195
3321
  return (__bridge_retained void *)[fabricRegistry componentViewDescriptorWithTag:tag].view;
3196
3322
  }