peachsim 0.1.2299 → 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 (109) hide show
  1. package/cli/commands/control.ts +1 -0
  2. package/cli/commands/serve.ts +12 -3
  3. package/cli/commands/shell-url.ts +5 -0
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +413 -100
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +1 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +1 -1
  27. package/dist-lib/detox/index.cjs +3 -2
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +385 -93
  30. package/dist-lib/expo-swift-metadata.cjs +1 -1
  31. package/dist-lib/expo-swift-metadata.mjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +2608 -102
  34. package/dist-lib/host/fetch-proxy-handler.cjs +6 -10
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +68 -33
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +1 -1
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +66 -32
  50. package/dist-lib/native-app-identity-project.cjs +49 -24
  51. package/dist-lib/native-app-identity-project.mjs +49 -24
  52. package/dist-lib/native-app-identity.cjs +1 -1
  53. package/dist-lib/native-app-identity.mjs +1 -1
  54. package/dist-lib/native-firebase-metadata.cjs +1 -1
  55. package/dist-lib/native-firebase-metadata.mjs +1 -1
  56. package/dist-lib/pdfium-raster.cjs +1 -1
  57. package/dist-lib/pdfium-raster.mjs +1 -1
  58. package/dist-lib/plist.cjs +1 -1
  59. package/dist-lib/plist.mjs +1 -1
  60. package/dist-lib/profiles.cjs +1 -1
  61. package/dist-lib/public-brand.cjs +1 -1
  62. package/dist-lib/public-origins-lib-esm.json +24 -24
  63. package/dist-lib/public-origins-lib.json +56 -53
  64. package/dist-lib/react-native-host-modules.cjs +1 -1
  65. package/dist-lib/react-native-host-modules.mjs +1 -1
  66. package/dist-lib/reap-browser.cjs +1 -1
  67. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  68. package/dist-lib/sdk.cjs +2 -1
  69. package/dist-lib/sdk.mjs +2 -1
  70. package/dist-lib/skills.cjs +481 -125
  71. package/dist-lib/swift-compile.cjs +40 -8
  72. package/dist-lib/swift-compile.mjs +40 -8
  73. package/dist-lib/swift-package.cjs +1 -1
  74. package/dist-lib/swift-package.mjs +1 -1
  75. package/dist-lib/swift-submit.cjs +1 -1
  76. package/dist-lib/swift-submit.mjs +1 -1
  77. package/dist-lib/swift-toolchain.cjs +1 -1
  78. package/dist-lib/swift.cjs +1 -1
  79. package/dist-lib/vite-swift.cjs +94 -37
  80. package/dist-lib/vite.cjs +12 -11
  81. package/dist-lib/worklet-executable.cjs +1 -1
  82. package/dist-lib/worklet-executable.mjs +1 -1
  83. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +3 -0
  84. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -0
  85. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +2 -0
  86. package/dist-types/packages/peach-engine/src/render-worker/activitykit-activityContract.d.ts +17 -0
  87. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +1 -0
  88. package/dist-types/packages/peach-engine/src/render-worker/gesture-arbitration-native.d.ts +124 -0
  89. package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +4 -0
  90. package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +3 -1
  91. package/dist-types/packages/peach-kit/src/transitions/screen-transition-math.d.ts +2 -2
  92. package/package.json +1 -1
  93. package/runtime-companion.json +1 -1
  94. package/src/bundle-channel.mjs +4 -3
  95. package/src/cli-runtime.ts +6 -0
  96. package/src/expo-discovery-cache.ts +6 -6
  97. package/src/expo-swift-host.ts +19 -4
  98. package/src/host/bridge-host.ts +9 -0
  99. package/src/launchMetadataContract.ts +1 -0
  100. package/src/native-firebase-config.ts +14 -0
  101. package/src/swift-compile.ts +28 -1
  102. package/src/swift-guest-compile.ts +19 -3
  103. package/src/swift-guest-source-plan.ts +7 -2
  104. package/src/swiftContract.ts +3 -0
  105. package/src/turbo-compile.ts +60 -4
  106. package/src/turbo-source.ts +239 -35
  107. package/src/vite-plugin-one.ts +3 -3
  108. package/src/widget-extension-bundle.ts +48 -0
  109. package/src/xcode-project.ts +67 -25
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2299 | (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 __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2299 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __typeError = (msg) => {
4
4
  throw TypeError(msg);
@@ -1,3 +1,4 @@
1
+ import type { GestureArbitrator } from '../../../../peach-engine/src/render-worker/gesture-arbitration-native.d.ts';
1
2
  declare const State: {
2
3
  readonly UNDETERMINED: 0;
3
4
  readonly FAILED: 1;
@@ -37,6 +38,7 @@ type LastPointer = {
37
38
  interface HandlerEntry {
38
39
  tag: number;
39
40
  name: string;
41
+ core: boolean;
40
42
  config: Record<string, unknown>;
41
43
  viewTag: number | null;
42
44
  viewIsUIControl: boolean;
@@ -108,6 +110,7 @@ export declare function estimatePanVelocity(samples: PanRecognizerState['velocit
108
110
  x: number;
109
111
  y: number;
110
112
  };
113
+ export declare function setGestureRecognizerCore(core: GestureArbitrator | null): void;
111
114
  declare const RNGestureHandlerModule: {
112
115
  handleSetJSResponder: (_tag: number, _blockNativeResponder: boolean) => void;
113
116
  handleClearJSResponder: () => void;
@@ -99,6 +99,7 @@ export declare function canonicalRegisteredFamily(family: string): string;
99
99
  export declare function markSystemCompanionFontFamily(family: string): void;
100
100
  export declare function getFontRegistrationGeneration(): number;
101
101
  export declare function noteTextSymbolRegistered(): void;
102
+ export declare function getFontCollectionGeneration(): number;
102
103
  export declare function registerEngineFontFamily(family: string): void;
103
104
  export declare function markSystemNamedFaceFamily(face: SystemNamedFace): void;
104
105
  export declare function registerLazySystemFontFamily(family: string): void;
@@ -136,6 +136,7 @@ export interface SceneNativeBinding {
136
136
  peachPaintExtentParameters?: (slot: number, x: number, y: number, width: number, height: number, subtree: number, out: number) => number;
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
+ _peach_scene_reader_reach(slot: number): number;
139
140
  peachRasterTransformParameters?: (slot: number, out: number) => number;
140
141
  _peach_scene_raster_candidate(slot: number): void;
141
142
  _peach_style_record(): number;
@@ -314,6 +315,7 @@ export declare class SceneTable {
314
315
  setPaintExtentPublisher(publisher: PaintExtentPublisher): void;
315
316
  setLayerBackdropReader(reader: (node: object) => boolean): void;
316
317
  paintExtent(slot: number, x: number, y: number, width: number, height: number, skipPortalViews: boolean, subtree: boolean): Float64Array | null;
318
+ readerReach(slot: number): number | null;
317
319
  node(slot: number): object | undefined;
318
320
  writeSharedNode(slot: number, update: {
319
321
  boundary?: number;
@@ -0,0 +1,17 @@
1
+ import type { ShellNativeEvaluationOwner } from '../guest/native-evaluation-lease.d.ts';
2
+ import type { NativeSwiftWidgetMount } from './native-widgetContract.d.ts';
3
+ export type ActivityKitExtension = NativeSwiftWidgetMount['entry'];
4
+ export type ActivityKitActivityState = 'pending' | 'active' | 'stale' | 'ended';
5
+ export interface ActivityKitActivity {
6
+ readonly id: string;
7
+ readonly attributes: string;
8
+ readonly state: string;
9
+ readonly staleDate: number | null;
10
+ readonly activityState: ActivityKitActivityState;
11
+ }
12
+ export interface ActivityKitPublication {
13
+ readonly owner: ShellNativeEvaluationOwner;
14
+ readonly extension: ActivityKitExtension | null;
15
+ readonly activities: readonly ActivityKitActivity[];
16
+ }
17
+ export declare function readActivityKitActivities(value: unknown): ActivityKitActivity[];
@@ -2121,6 +2121,7 @@ export type CompositorToShellMessage = {
2121
2121
  type: 'chromeLuminance';
2122
2122
  surfaceId: AuxAppSurfaceId;
2123
2123
  statusBarDark?: boolean;
2124
+ statusBarSettled?: boolean;
2124
2125
  homeIndicatorDark?: boolean;
2125
2126
  } | {
2126
2127
  type: 'snapshot';
@@ -0,0 +1,124 @@
1
+ import type { GestureArbitrationGraph, GestureSeamNativeRecognitionEvent } from './gesture-seam-protocol.d.ts';
2
+ type RecognitionEvent = GestureSeamNativeRecognitionEvent;
3
+ type Emit = (event: RecognitionEvent) => void;
4
+ type CancelNative = (event: RecognitionEvent, visible: boolean) => void;
5
+ export type GestureRecognizerLocation = {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ hitSlop: readonly number[] | null;
11
+ };
12
+ export type GestureRecognizerEvent = {
13
+ recognizer: number;
14
+ state: number;
15
+ oldState: number;
16
+ pointers: number;
17
+ x: number;
18
+ y: number;
19
+ absoluteX: number;
20
+ absoluteY: number;
21
+ duration: number;
22
+ };
23
+ export interface GestureRecognizerHost {
24
+ locate(tag: number, x: number, y: number): GestureRecognizerLocation | null;
25
+ publish(event: GestureRecognizerEvent): void;
26
+ emit: Emit;
27
+ cancelNative: CancelNative;
28
+ }
29
+ export type GestureRecognizerPointer = {
30
+ x: number;
31
+ y: number;
32
+ touches: ReadonlyArray<{
33
+ pageX: number;
34
+ pageY: number;
35
+ identifier: number;
36
+ }>;
37
+ };
38
+ declare const RECOGNIZER_PHASE: {
39
+ readonly down: 0;
40
+ readonly move: 1;
41
+ readonly up: 2;
42
+ };
43
+ interface GestureArbitrationNative {
44
+ readonly HEAPU8: Uint8Array;
45
+ peachArbitration?: (kind: number, id: number, tag: number, oldState: number, visible: number) => void;
46
+ peachGestureLocate?: (index: number, tag: number, x: number, y: number) => number;
47
+ peachGestureEvent?: (index: number) => void;
48
+ _peach_arbitration_buffer(size: number): number;
49
+ _peach_gesture_locate_buffer(): number;
50
+ _peach_gesture_event_buffer(): number;
51
+ _peach_gesture_add(index: number, tag: number, length: number): void;
52
+ _peach_gesture_update(index: number, tag: number, length: number): void;
53
+ _peach_gesture_remove(index: number, tag: number): void;
54
+ _peach_gesture_set_android(index: number, android: number): void;
55
+ _peach_gesture_feed(index: number, tag: number, phase: number, time: number, length: number): void;
56
+ _peach_gesture_advance(index: number, now: number): void;
57
+ _peach_gesture_next_deadline(index: number): number;
58
+ _peach_gesture_state(index: number, tag: number): number;
59
+ _peach_gesture_activations(index: number, tag: number): number;
60
+ _peach_gesture_set_state(index: number, tag: number, state: number, manualPointers: number): void;
61
+ _peach_gesture_cancel(index: number, tag: number): void;
62
+ _peach_gesture_reset_for_pointer(index: number, tag: number): void;
63
+ _peach_arbitration_create(): number;
64
+ _peach_arbitration_upsert(index: number, length: number): number;
65
+ _peach_arbitration_drop(index: number, tag: number): void;
66
+ _peach_arbitration_clear(index: number): void;
67
+ _peach_arbitration_clear_owner(index: number, peerEpoch: number, surface: number, generation: number): void;
68
+ _peach_arbitration_handle(index: number, id: number, tag: number, state: number, oldState: number): void;
69
+ _peach_arbitration_should_emit_update(index: number, tag: number): number;
70
+ _peach_arbitration_set_tracked_pointers(index: number, tag: number, count: number): void;
71
+ _peach_arbitration_tracked_pointers(index: number, tag: number): number;
72
+ _peach_arbitration_configure(index: number, tag: number, flags: number): void;
73
+ _peach_arbitration_allows_simultaneous(index: number, a: number, b: number): number;
74
+ _peach_arbitration_has_blocking_relation(index: number, a: number, b: number): number;
75
+ _peach_arbitration_set_coexists(index: number, tag: number, value: number): void;
76
+ _peach_arbitration_sizes(index: number): void;
77
+ _peach_arbitration_live_events(index: number): number;
78
+ }
79
+ export declare function isGestureArbitrationGraph(value: unknown): value is GestureArbitrationGraph;
80
+ export declare class GestureArbitrator {
81
+ private readonly events;
82
+ private nextEventId;
83
+ private depth;
84
+ private bound;
85
+ recognizerHost: GestureRecognizerHost | null;
86
+ private timer;
87
+ private timerAt;
88
+ get native(): GestureArbitrationNative;
89
+ private get index();
90
+ private core;
91
+ event(id: number): RecognitionEvent | undefined;
92
+ private call;
93
+ private armTimer;
94
+ private recognize;
95
+ setRecognizerHost(host: GestureRecognizerHost | null): void;
96
+ addRecognizer(tag: number, config: readonly number[]): void;
97
+ updateRecognizer(tag: number, config: readonly number[]): void;
98
+ removeRecognizer(tag: number): void;
99
+ feedRecognizer(tag: number, phase: keyof typeof RECOGNIZER_PHASE, event: GestureRecognizerPointer, time: number, android: boolean): void;
100
+ setRecognizerState(tag: number, state: number, manualPointers: number | null, android: boolean): void;
101
+ cancelRecognizer(tag: number): void;
102
+ resetRecognizerForPointer(tag: number): void;
103
+ recognizerState(tag: number): number;
104
+ recognizerActivations(tag: number): number;
105
+ private releaseEvents;
106
+ upsert(graph: GestureArbitrationGraph, cancelNative: CancelNative, emit: Emit): boolean;
107
+ drop(handlerTag: number, cancelNative: CancelNative, emit: Emit): void;
108
+ handle(event: RecognitionEvent, emit: Emit, cancelNative: CancelNative): void;
109
+ getDebugSizes(): {
110
+ graphs: number;
111
+ latestGenerations: number;
112
+ tags: number;
113
+ };
114
+ clear(): void;
115
+ clearOwner(peerEpoch: number, surfaceId: string, generation: number): void;
116
+ shouldEmitUpdate(handlerTag: number): boolean;
117
+ setTrackedPointers(handlerTag: number, pointerIds: readonly number[]): void;
118
+ getTrackedPointers(handlerTag: number): readonly number[];
119
+ configureHandler(handlerTag: number, handlerName: string, config: Record<string, unknown>): void;
120
+ allowsSimultaneous(a: number, b: number): boolean;
121
+ hasBlockingRelation(a: number, b: number): boolean;
122
+ setCoexistsWithNativeViews(handlerTag: number, value: boolean): void;
123
+ }
124
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { type NativeUICommand } from './native-ui-commandContract.d.ts';
2
2
  import type { NativePhotoLibraryRequest, NativePhotoLibraryChange, NativePhotoLibraryResult } from '../ios/photoLibraryContract.d.ts';
3
3
  import type { AppPreferenceValue, AppSettingsSnapshot, SystemPermissionApp, SystemPermissionMutation, SystemPermissionRequestContext } from '../permissions/system-permission-types.d.ts';
4
+ import type { ActivityKitPublication } from './activitykit-activityContract.d.ts';
4
5
  import type { AuxAppSurfaceId } from './aux-surface-types.d.ts';
5
6
  import type { ExpoWidgetsActivityPublication } from './expo-widgets-activityContract.d.ts';
6
7
  import type { OneNativeContentPublication } from './one-native-contentContract.d.ts';
@@ -661,6 +662,9 @@ type NativeUIRequestBody = import('../capture/nativeScreenCaptureContract.d.ts')
661
662
  } | {
662
663
  kind: 'expoWidgets.activities';
663
664
  publication: ExpoWidgetsActivityPublication;
665
+ } | {
666
+ kind: 'activityKit.activities';
667
+ publication: ActivityKitPublication;
664
668
  } | {
665
669
  kind: 'authSession.show';
666
670
  ownerId: string;
@@ -18,10 +18,12 @@ export type NativeWidgetContent = {
18
18
  presentation: NativeActivityPresentation;
19
19
  attributes: string;
20
20
  state: string;
21
+ id: string;
22
+ stale: boolean;
21
23
  };
22
24
  export interface NativeSwiftWidgetMount extends NativeWidgetIdentity {
23
25
  entry: SwiftEntryOptions;
24
- widget: OneWidgetMetadata;
26
+ widget: OneWidgetMetadata | null;
25
27
  content: NativeWidgetContent;
26
28
  }
27
29
  export interface NativeExpoWidgetMount extends NativeWidgetIdentity {
@@ -261,7 +261,7 @@ export declare function zoomFollowRelease(follow: ZoomFollow, gesture: ZoomFinge
261
261
  x: number;
262
262
  y: number;
263
263
  }): ZoomRelease;
264
- export declare const ZOOM_RELEASE_COMMIT_MS = 700;
264
+ export declare const ZOOM_RELEASE_COMMIT_MS = 1130;
265
265
  export declare const ZOOM_PULL_COMMIT_SCALE_SPRING: {
266
266
  omega: number;
267
267
  zeta: number;
@@ -270,7 +270,7 @@ export declare const ZOOM_EDGE_COMMIT_SCALE_SPRING: {
270
270
  omega: number;
271
271
  zeta: number;
272
272
  };
273
- export declare const ZOOM_RELEASE_CANCEL_MS = 450;
273
+ export declare const ZOOM_RELEASE_CANCEL_MS = 610;
274
274
  export declare const ZOOM_RELEASE_PRESENTATION_LEAD_MS: number;
275
275
  export declare function zoomReleasePose(release: ZoomRelease, source: ZoomSourceRect, target: ZoomTargetRect, elapsedMs: number): ZoomInteraction;
276
276
  export declare function zoomReleasePoseState<T>(math: TransitionScalarMath<T>, release: ZoomRelease, source: ZoomSourceRect, target: ZoomTargetRect, elapsedMs: T): ZoomInteraction<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.2299",
3
+ "version": "0.1.2301",
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":"2d222761043905cd744125bbf673c568fc842d35d058bf6975d86a828f7090e6","file":"node/cli-2d222761043905cd744125bbf673c568fc842d35d058bf6975d86a828f7090e6.cjs"}
1
+ {"abi":1,"sha256":"60900a3af6e6213c855e6682baa0ebdb6a6865510e4e3a51a24d4c584b3fdec2","file":"node/cli-60900a3af6e6213c855e6682baa0ebdb6a6865510e4e3a51a24d4c584b3fdec2.cjs"}
@@ -7,7 +7,7 @@ import { brotliCompressSync, constants as zlibConstants } from 'node:zlib'
7
7
  import { isLoopbackHost } from './backend-origin'
8
8
  import { resolveConnectionInput } from './dev-bundle-resolution'
9
9
  import { cacheDir } from './home-paths'
10
- import { getCliRuntime } from './cli-runtime'
10
+ import { getCliRuntime, loadCliRuntime } from './cli-runtime'
11
11
  import { readInstalledNativePackageVersionsAsync } from './installed-package-versions'
12
12
  import { buildNativeBundles, insertNativeBundleFooters } from './native-bundles'
13
13
  import { nodeHttpFetch } from './node-http-fetch'
@@ -174,8 +174,9 @@ async function prepareChannel({
174
174
  [...files.keys()].map((path) => path.slice(0, path.lastIndexOf('/'))),
175
175
  )
176
176
  let locations = 0
177
- const { stripRolldownBundleInventoryFooter, attachRolldownBundleInventory } =
178
- getCliRuntime().rolldown_bundle_inventory
177
+ const { stripRolldownBundleInventoryFooter, attachRolldownBundleInventory } = (
178
+ await loadCliRuntime()
179
+ ).rolldown_bundle_inventory
179
180
  const detached = detachPackageVersionsFooter(
180
181
  stripRolldownBundleInventoryFooter(
181
182
  new TextDecoder('utf-8', { fatal: true }).decode(bundle),
@@ -66,6 +66,12 @@ export async function ensureCliCompanion(root: string): Promise<void> {
66
66
 
67
67
  let loaded: { root: string; runtime: typeof CliRuntime } | undefined
68
68
 
69
+ // build plugins run on machines whose installed runtime may predate this package
70
+ export async function loadCliRuntime(): Promise<typeof CliRuntime> {
71
+ if (!loaded) await ensureCliCompanion(peachRuntimeRoot())
72
+ return getCliRuntime()
73
+ }
74
+
69
75
  // select once per runtime, verify before evaluation, and retain the real functions
70
76
  // so host serializers receive their implementation rather than a forwarding closure.
71
77
  export function getCliRuntime(): typeof CliRuntime {
@@ -103,7 +103,7 @@ export async function expoDiscoveryKey(options: {
103
103
  // shared across PEACH_HOME overrides: entries are content-addressed by every
104
104
  // input, the way the CocoaPods and pnpm machine caches are. a builders root
105
105
  // moves it off the internal disk with the other swift caches.
106
- function sharedDir(): string {
106
+ export function expoDiscoveryCacheDir(): string {
107
107
  return path.join(sharedCacheDir(path.join(ambientHomeDir(), 'cache')), 'expo-discovery')
108
108
  }
109
109
 
@@ -215,7 +215,7 @@ function isStoredUnit(value: unknown): value is StoredExpoSwiftSourceUnit {
215
215
  // misshapen misses, never throws: the cache must not break discovery.
216
216
  export function readExpoDiscovery(key: string): ExpoSwiftSourceUnit[] | null | undefined {
217
217
  let parsed: unknown
218
- const record = path.join(sharedDir(), `${key}.json`)
218
+ const record = path.join(expoDiscoveryCacheDir(), `${key}.json`)
219
219
  try {
220
220
  parsed = JSON.parse(fs.readFileSync(record, 'utf8'))
221
221
  } catch {
@@ -244,7 +244,7 @@ export function readExpoDiscovery(key: string): ExpoSwiftSourceUnit[] | null | u
244
244
  const read = (digest: string): string => {
245
245
  const known = blobs.get(digest)
246
246
  if (known !== undefined) return known
247
- const blob = path.join(sharedDir(), 'blobs', digest)
247
+ const blob = path.join(expoDiscoveryCacheDir(), 'blobs', digest)
248
248
  const body = fs.readFileSync(blob, 'utf8')
249
249
  if (createHash('sha256').update(body).digest('hex') !== digest)
250
250
  throw new Error('discovery blob differs from its digest')
@@ -299,7 +299,7 @@ let fileHashesLoaded = false
299
299
  let fileHashesChanged = false
300
300
 
301
301
  function fileHashesPath(): string {
302
- return path.join(sharedDir(), 'framework-file-hashes.json')
302
+ return path.join(expoDiscoveryCacheDir(), 'framework-file-hashes.json')
303
303
  }
304
304
 
305
305
  function stampedFileHash(file: string): string {
@@ -525,7 +525,7 @@ function rewritePreparedPaths(options: {
525
525
  frameworkDependencies[sourceDir] = sourceDigest
526
526
  let portableDir = sourceDir
527
527
  if (preparedDigest !== sourceDigest) {
528
- const parent = path.join(sharedDir(), 'frameworks', preparedDigest)
528
+ const parent = path.join(expoDiscoveryCacheDir(), 'frameworks', preparedDigest)
529
529
  portableDir = path.join(parent, path.basename(dir))
530
530
  if (!fs.existsSync(portableDir)) {
531
531
  fs.mkdirSync(parent, { recursive: true })
@@ -567,7 +567,7 @@ export function writeExpoDiscovery(options: {
567
567
  signal?: AbortSignal
568
568
  }): ExpoSwiftSourceUnit[] | null | string {
569
569
  try {
570
- const dir = sharedDir()
570
+ const dir = expoDiscoveryCacheDir()
571
571
  fs.mkdirSync(dir, { recursive: true })
572
572
  const tmp = path.join(dir, `.${options.key}.${process.pid}.${randomUUID()}.tmp`)
573
573
  if (options.units === null) {
@@ -16,12 +16,14 @@ import { loadRNXAppConfig } from './app-config'
16
16
  import { isLoopbackHost } from './backend-origin'
17
17
  import { autolinkerAppleFlags } from './expo-autolinking'
18
18
  import {
19
+ expoDiscoveryCacheDir,
19
20
  expoDiscoveryKey,
20
21
  readExpoDiscovery,
21
22
  writeExpoDiscovery,
22
23
  } from './expo-discovery-cache'
23
24
  import { prebuiltExpoNative, prebuiltExpoSwiftResult } from './expo-native-prebuilt'
24
25
  import {
26
+ hashExpoWorkspace,
25
27
  nativeWorkspaceAvailable,
26
28
  prepareExpoNativeWorkspace,
27
29
  } from './expo-native-workspace'
@@ -322,6 +324,8 @@ function installSwiftInputTrace(): void {
322
324
  path.join(swiftCacheDir(), 'swift-sdk-views'),
323
325
  swiftRootLocksDir(),
324
326
  path.join(cacheDir(), 'swift-tmp'),
327
+ // content-addressed records whose reads renew their timestamps for expiry.
328
+ expoDiscoveryCacheDir(),
325
329
  ].filter((prefix, index, all) => all.indexOf(prefix) === index)
326
330
  ignoredRoots = prefixes.flatMap((root) => {
327
331
  try {
@@ -437,7 +441,9 @@ async function witnessMatches(witness: Witness): Promise<boolean> {
437
441
 
438
442
  // the evaluated Expo config is a key input: a child process evaluates it from
439
443
  // app config, plugins and env files the witness cannot see, and its result file
440
- // is new on every run, so it is read untraced and compared here instead.
444
+ // is new on every run, so it is read untraced and compared here instead. a
445
+ // prepared workspace is a key input the same way: a discovery record served
446
+ // for its hash reads none of the inputs that hash covers.
441
447
  async function discoveryKey(
442
448
  root: string,
443
449
  installedWorkspace: string | undefined,
@@ -445,11 +451,14 @@ async function discoveryKey(
445
451
  iosTarget: string | undefined,
446
452
  moduleRoot?: string,
447
453
  ): Promise<string> {
448
- const [config, expoConfig] = await Promise.all([
454
+ const preparesWorkspace =
455
+ prepareNative && !installedWorkspace && nativeWorkspaceAvailable()
456
+ const [config, expoConfig, workspace] = await Promise.all([
449
457
  loadRNXAppConfig(resolveAppProject(root)),
450
458
  readExpoConfigAsync(root),
459
+ preparesWorkspace ? traceStore.exit(() => hashExpoWorkspace(root)) : null,
451
460
  ])
452
- return `${fs.realpathSync(root)}\0${installedWorkspace ?? ''}\0${iosTarget ?? ''}\0${moduleRoot ?? ''}\0${prepareNative ? '1' : '0'}\0${JSON.stringify(config)}\0${JSON.stringify(expoConfig)}`
461
+ return `${fs.realpathSync(root)}\0${installedWorkspace ?? ''}\0${iosTarget ?? ''}\0${moduleRoot ?? ''}\0${prepareNative ? '1' : '0'}\0${JSON.stringify(config)}\0${JSON.stringify(expoConfig)}\0${workspace?.hash ?? ''}`
453
462
  }
454
463
 
455
464
  function cloneNativeTarget(target: SwiftNativeTarget): SwiftNativeTarget {
@@ -2114,7 +2123,13 @@ export function expoEntry(units: ExpoSwiftSourceUnit[], oneSDK = false): string
2114
2123
  Object.keys(unit.files).some((file) => file.startsWith(`Sources/${namespace}/`)),
2115
2124
  ),
2116
2125
  )
2117
- const bridgeModules = units.flatMap((unit) => unit.bridgeModules)
2126
+ const bridgeModules = units.flatMap((unit) =>
2127
+ unit.bridgeModules.map((registration) =>
2128
+ registration === `${unit.namespace}.__peachReactModule_${unit.namespace}()`
2129
+ ? registration.slice(unit.namespace.length + 1)
2130
+ : registration,
2131
+ ),
2132
+ )
2118
2133
  const subscribers = units.flatMap((unit) => unit.appDelegateSubscribers)
2119
2134
  const handlers = units.flatMap((unit) => unit.reactDelegateHandlers)
2120
2135
  const delegates =
@@ -57,6 +57,10 @@ import {
57
57
  import { rnxRuntime } from '../runtime-delivery.ts'
58
58
  import { ensureRuntimePackFor } from '../runtime-packs.ts'
59
59
  import { handleTurboRequest, TURBO_ROUTE } from '../turbo-bundle.ts'
60
+ import {
61
+ handleWidgetExtensionRequest,
62
+ WIDGET_EXTENSION_ROUTE,
63
+ } from '../widget-extension-bundle'
60
64
  import { AgentHost, type AgentHostOptions } from './agent-host.ts'
61
65
  import { serveAppPackageResource } from './app-package-handler'
62
66
  import {
@@ -1566,6 +1570,7 @@ export class SootSimBridgeHost {
1566
1570
  const route = req.url?.split('?')[0] ?? ''
1567
1571
  if (
1568
1572
  route === EXPO_WIDGETS_ROUTE ||
1573
+ route === WIDGET_EXTENSION_ROUTE ||
1569
1574
  route === NITRO_ROUTE ||
1570
1575
  route === ONE_SDK_ROUTE ||
1571
1576
  route === TURBO_ROUTE ||
@@ -1584,6 +1589,10 @@ export class SootSimBridgeHost {
1584
1589
  void handleExpoWidgetsRequest(req, res)
1585
1590
  return
1586
1591
  }
1592
+ if (route === WIDGET_EXTENSION_ROUTE) {
1593
+ void handleWidgetExtensionRequest(req, res)
1594
+ return
1595
+ }
1587
1596
  if (route === ONE_SDK_ROUTE) {
1588
1597
  void handleOneSDKRequest(req, res)
1589
1598
  return
@@ -14,6 +14,7 @@ export const LAUNCH_METADATA_KEYS: readonly string[] = [
14
14
  'expoKotlin',
15
15
  'nitro',
16
16
  'turbo',
17
+ 'widgetExtension',
17
18
  'appManifest',
18
19
  'packageVersions',
19
20
  'dotEnv',
@@ -43,6 +43,20 @@ export function resolveExpoConfigModule(appDir: string) {
43
43
  }
44
44
 
45
45
  function hasExpoConfig(projectRoot: string) {
46
+ const packagePath = path.join(projectRoot, 'package.json')
47
+ const manifest: unknown = fs.existsSync(packagePath)
48
+ ? JSON.parse(fs.readFileSync(packagePath, 'utf8'))
49
+ : null
50
+ if (isRecord(manifest)) {
51
+ const dependencies = [manifest.dependencies, manifest.devDependencies].filter(
52
+ isRecord,
53
+ )
54
+ if (
55
+ dependencies.some((deps) => 'one' in deps) &&
56
+ !dependencies.some((deps) => 'expo' in deps)
57
+ )
58
+ return false
59
+ }
46
60
  const appJsonPath = path.join(projectRoot, 'app.json')
47
61
  const appJson: unknown = fs.existsSync(appJsonPath)
48
62
  ? JSON.parse(fs.readFileSync(appJsonPath, 'utf8'))
@@ -7548,6 +7548,29 @@ function compileSwiftProjectOnce(
7548
7548
  string,
7549
7549
  { file: string; header: string; module: boolean } | null
7550
7550
  >()
7551
+ const nativeDeclarations = new Map<string, Set<string>>()
7552
+ for (const [file, contents] of Object.entries(input.files)) {
7553
+ if (!file.endsWith('.modulemap')) continue
7554
+ const name = moduleMapName(contents)
7555
+ const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents)?.[1]
7556
+ if (!name || !umbrella) continue
7557
+ const header =
7558
+ input.files[path.posix.join(path.posix.dirname(file), umbrella)]
7559
+ if (header === undefined) continue
7560
+ const included = new Set(
7561
+ [
7562
+ ...header.matchAll(/^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm),
7563
+ ].map((match) => path.posix.basename(match[1]!)),
7564
+ )
7565
+ const declarations = nativeDeclarations.get(name) ?? new Set<string>()
7566
+ for (const declaration of swiftInterfaceDeclarations(header))
7567
+ declarations.add(declaration)
7568
+ for (const [candidate, source] of Object.entries(input.files))
7569
+ if (included.has(path.posix.basename(candidate)))
7570
+ for (const declaration of swiftInterfaceDeclarations(source))
7571
+ declarations.add(declaration)
7572
+ nativeDeclarations.set(name, declarations)
7573
+ }
7551
7574
  const frameworkInterface = (
7552
7575
  name: string,
7553
7576
  ): { file: string; header: string; module: boolean } | null => {
@@ -7578,10 +7601,14 @@ function compileSwiftProjectOnce(
7578
7601
  readFileSync(path.join(headers, file), 'utf8'),
7579
7602
  ))
7580
7603
  declared.add(name)
7604
+ for (const declaration of nativeDeclarations.get(name) ?? [])
7605
+ declared.add(declaration)
7581
7606
  const own = withoutSwiftDeclarations(
7582
7607
  clangInterfaceHeader(readFileSync(source, 'utf8')),
7583
7608
  declared,
7584
- `#import <${name}/${name}.h>`,
7609
+ nativeDeclarations.has(name)
7610
+ ? `@import ${name};`
7611
+ : `#import <${name}/${name}.h>`,
7585
7612
  )
7586
7613
  // the swift module also implements classes another framework's headers
7587
7614
  // already define; clang takes those from the owning framework
@@ -74,6 +74,12 @@ export async function compileGuestLink(options: {
74
74
  target.productName.endsWith('.framework') ? [target.productName.slice(0, -10)] : [],
75
75
  ),
76
76
  )
77
+ const sourceLibraries = new Set(
78
+ options.graph.targets.flatMap((target) => {
79
+ const library = /^lib(.+)\.(?:a|dylib)$/.exec(target.productName)
80
+ return library ? [library[1]!] : []
81
+ }),
82
+ )
77
83
  const entry = targets.get(options.graph.entry)
78
84
  if (!entry) throw new Error('guest source graph has no entry')
79
85
  const imageBuildVersion = (value: typeof entry.buildVersion) => {
@@ -269,14 +275,24 @@ export async function compileGuestLink(options: {
269
275
  objects: selectedSource
270
276
  .filter((artifact) => artifact.image === image.id)
271
277
  .map((artifact) => artifact.path),
272
- // a `-framework Name` for a framework the source graph builds links
273
- // that framework's own image, which the plan already depends on
278
+ // a `-framework Name` or `-lname` for a product the source graph
279
+ // builds links that product's own target, which the plan already holds
274
280
  linkerFlags: image.members
275
281
  .flatMap((id) => targets.get(id)!.linkerFlags)
276
282
  .filter(
277
283
  (flag, index, flags) =>
278
284
  !sourceFrameworks.has(flags[index - 1] === '-framework' ? flag : '') &&
279
- !(flag === '-framework' && sourceFrameworks.has(flags[index + 1] ?? '')),
285
+ !(
286
+ flag === '-framework' && sourceFrameworks.has(flags[index + 1] ?? '')
287
+ ) &&
288
+ !sourceLibraries.has(
289
+ flag.startsWith('-l') && flag.length > 2
290
+ ? flag.slice(2)
291
+ : flags[index - 1] === '-l'
292
+ ? flag
293
+ : '',
294
+ ) &&
295
+ !(flag === '-l' && sourceLibraries.has(flags[index + 1] ?? '')),
280
296
  ),
281
297
  clangLinkOptions: selectedSource
282
298
  .filter((artifact) => artifact.image === image.id)
@@ -38,8 +38,13 @@ function swiftPackageLinkage(
38
38
  export function guestSourceImages(graph: SwiftSourceLinkGraph): GuestSourceImage[] {
39
39
  const targets = new Map(graph.targets.map((target) => [target.id, target]))
40
40
  const entry = targets.get(graph.entry)
41
- if (!entry || entry.productType !== 'com.apple.product-type.application')
42
- throw new Error('source graph has no application entry')
41
+ // an app extension runs as its own executable, as the application does
42
+ if (
43
+ !entry ||
44
+ (entry.productType !== 'com.apple.product-type.application' &&
45
+ entry.productType !== 'com.apple.product-type.app-extension')
46
+ )
47
+ throw new Error('source graph has no application or app extension entry')
43
48
  const images: { id: number; owner: string; members: string[] }[] = [
44
49
  { id: 0, owner: entry.id, members: [] },
45
50
  ]
@@ -568,6 +568,9 @@ export interface SwiftEntryOptions extends SwiftModuleOptions {
568
568
  contractHash?: string
569
569
  // the package/source path keeps a root's identity across module reloads.
570
570
  rootId?: string
571
+ // the JSI globals the process's native runtime defines for its own evaluation
572
+ // only: Nitro's by default, React Native's TurboModule binding for a turbo app.
573
+ privateGlobals?: readonly string[]
571
574
  }
572
575
 
573
576
  export interface SwiftRuntimeHost {