peachsim 0.1.1808 → 0.1.1812

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 (236) hide show
  1. package/README.md +4 -2
  2. package/cli/app-bundle-resources.ts +15 -2
  3. package/cli/cloud-box-artifact.ts +115 -0
  4. package/cli/cloud-client.ts +148 -76
  5. package/cli/cloud-dispatch.ts +4 -4
  6. package/cli/cloud-session.ts +60 -22
  7. package/cli/commands/box.ts +8 -2
  8. package/cli/commands/compat.ts +7 -4
  9. package/cli/commands/control.ts +69 -3
  10. package/cli/commands/coverage.ts +14 -4
  11. package/cli/commands/daemon.ts +41 -0
  12. package/cli/commands/no-bridge-hint.ts +9 -0
  13. package/cli/commands/package.ts +31 -56
  14. package/cli/commands/platform.ts +71 -60
  15. package/cli/commands/preview.ts +73 -24
  16. package/cli/commands/record.ts +10 -2
  17. package/cli/commands/screenshot.ts +17 -60
  18. package/cli/commands/setup.ts +3 -1
  19. package/cli/commands/three-mode.ts +22 -12
  20. package/cli/commands/upload.ts +2 -1
  21. package/cli/desktop-companion.ts +6 -1
  22. package/cli/drivers/desktop.ts +4 -1
  23. package/cli/main.ts +12 -2
  24. package/cli/metro-bundle-assets.ts +14 -4
  25. package/cli/outbound-endpoints.ts +7 -3
  26. package/cli/output-redaction.ts +38 -0
  27. package/cli/privacy.ts +2 -2
  28. package/cli/recording-access.ts +5 -0
  29. package/cli/remote-project-bundle.ts +83 -0
  30. package/cli/shell-init.ts +7 -11
  31. package/cli/telemetry.ts +41 -4
  32. package/cli/usage-error.ts +3 -0
  33. package/cli/ws-bridge.ts +42 -6
  34. package/dist-lib/agent-daemon-client.cjs +1 -1
  35. package/dist-lib/agent-events.cjs +1 -1
  36. package/dist-lib/attached-projects.cjs +1 -1
  37. package/dist-lib/auth/shared-session.cjs +1 -1
  38. package/dist-lib/backend-origin.cjs +1 -1
  39. package/dist-lib/beta.cjs +1 -1
  40. package/dist-lib/beta.mjs +1 -1
  41. package/dist-lib/bridge-constants.cjs +1 -1
  42. package/dist-lib/bridge-contract-input.cjs +1 -1
  43. package/dist-lib/bridge-contract-input.mjs +1 -1
  44. package/dist-lib/bridge-contract.cjs +1 -1
  45. package/dist-lib/bridge-contract.mjs +1 -1
  46. package/dist-lib/bundle-channel.cjs +42897 -40755
  47. package/dist-lib/capture-contract.cjs +7 -8
  48. package/dist-lib/capture-contract.mjs +7 -8
  49. package/dist-lib/cloud-contract.cjs +1 -1
  50. package/dist-lib/cloud-contract.mjs +1 -1
  51. package/dist-lib/cloud-test-args.cjs +1 -1
  52. package/dist-lib/cloud-test-args.mjs +1 -1
  53. package/dist-lib/cloud.cjs +1 -1
  54. package/dist-lib/cloud.mjs +1 -1
  55. package/dist-lib/config.cjs +1 -1
  56. package/dist-lib/config.mjs +1 -1
  57. package/dist-lib/detox/index.cjs +13 -7
  58. package/dist-lib/dev-bundle-resolution.cjs +10 -4
  59. package/dist-lib/expo-swift-bundle.cjs +15889 -15553
  60. package/dist-lib/expo-swift-metadata.cjs +2 -1
  61. package/dist-lib/expo-swift-metadata.mjs +2 -1
  62. package/dist-lib/home-paths.cjs +2 -33
  63. package/dist-lib/host/bridge-host.cjs +20891 -18714
  64. package/dist-lib/host/fetch-proxy-handler.cjs +10 -11
  65. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  66. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  67. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  68. package/dist-lib/host/websocket-proxy.cjs +1 -1
  69. package/dist-lib/index.cjs +620 -553
  70. package/dist-lib/jump-to-source-babel.cjs +1 -1
  71. package/dist-lib/jump-to-source-native.cjs +1 -1
  72. package/dist-lib/kotlin-host.cjs +1 -1
  73. package/dist-lib/menu.cjs +1 -1
  74. package/dist-lib/menu.mjs +1 -1
  75. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  76. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  77. package/dist-lib/metro-production-bundle.cjs +1 -1
  78. package/dist-lib/metro-production-bundle.mjs +1 -1
  79. package/dist-lib/metro.cjs +57 -28
  80. package/dist-lib/native-app-identity-project.cjs +47 -14
  81. package/dist-lib/native-app-identity-project.mjs +55 -20
  82. package/dist-lib/native-app-identity.cjs +1 -1
  83. package/dist-lib/native-app-identity.mjs +1 -1
  84. package/dist-lib/native-firebase-metadata.cjs +1 -1
  85. package/dist-lib/native-firebase-metadata.mjs +1 -1
  86. package/dist-lib/pdfium-raster.cjs +1 -1
  87. package/dist-lib/pdfium-raster.mjs +1 -1
  88. package/dist-lib/plist.cjs +1 -1
  89. package/dist-lib/plist.mjs +1 -1
  90. package/dist-lib/profiles.cjs +1 -1
  91. package/dist-lib/public-brand.cjs +1 -1
  92. package/dist-lib/public-origins-lib-esm.json +27 -26
  93. package/dist-lib/public-origins-lib.json +104 -81
  94. package/dist-lib/react-native-host-modules.cjs +1 -1
  95. package/dist-lib/react-native-host-modules.mjs +1 -1
  96. package/dist-lib/reap-browser.cjs +1 -1
  97. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  98. package/dist-lib/sdk.cjs +1 -1
  99. package/dist-lib/sdk.mjs +1 -1
  100. package/dist-lib/skills.cjs +30700 -24410
  101. package/dist-lib/swift-compile.cjs +336 -222
  102. package/dist-lib/swift-compile.mjs +378 -263
  103. package/dist-lib/swift-package.cjs +19 -7
  104. package/dist-lib/swift-package.mjs +16 -6
  105. package/dist-lib/swift-submit.cjs +1 -1
  106. package/dist-lib/swift-submit.mjs +1 -1
  107. package/dist-lib/swift-toolchain.cjs +49 -1
  108. package/dist-lib/swift.cjs +1 -1
  109. package/dist-lib/vite-swift.cjs +19213 -18937
  110. package/dist-lib/vite.cjs +11 -12
  111. package/dist-lib/worklet-executable.cjs +1 -1
  112. package/dist-lib/worklet-executable.mjs +1 -1
  113. package/dist-types/packages/peach-engine/src/engine/animated.d.ts +4 -0
  114. package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +1 -0
  115. package/dist-types/packages/peach-engine/src/engine/expo-manifest.d.ts +1 -0
  116. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +1 -1
  117. package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +1 -0
  118. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +8 -1
  119. package/dist-types/packages/peach-globals/src/electronBridgeContract.d.ts +2 -1
  120. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  121. package/kotlin/sdk.tar.gz +0 -0
  122. package/package.json +1 -1
  123. package/runtime-companion.json +1 -1
  124. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCall.h +1 -1
  125. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCallCenter.h +1 -1
  126. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCarrier.h +1 -1
  127. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriber.h +1 -1
  128. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriberInfo.h +1 -1
  129. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h +1 -1
  130. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSDictionary.h +1 -1
  131. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSExtensionItem.h +1 -1
  132. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/AVFoundation+MPNowPlayingInfoLanguageOptionAdditions.h +39 -0
  133. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/AVPlayerItem+MediaPlayerAdditions.h +26 -0
  134. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPContentItem.h +67 -0
  135. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPError.h +33 -0
  136. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaEntity.h +53 -0
  137. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItem.h +346 -0
  138. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItemCollection.h +42 -0
  139. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaLibrary.h +76 -0
  140. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPickerController.h +64 -0
  141. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPlayback.h +47 -0
  142. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPlaylist.h +82 -0
  143. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaQuery.h +120 -0
  144. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaQuerySection.h +26 -0
  145. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMoviePlayerController.h +444 -0
  146. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMoviePlayerViewController.h +43 -0
  147. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerApplicationController.h +47 -0
  148. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerController.h +147 -0
  149. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerQueueDescriptor.h +75 -0
  150. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingInfoCenter.h +197 -0
  151. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingInfoLanguageOption.h +107 -0
  152. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingSession.h +89 -0
  153. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentDataSource.h +59 -0
  154. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentDelegate.h +64 -0
  155. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentManager.h +46 -0
  156. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentManagerContext.h +32 -0
  157. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommand.h +143 -0
  158. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommandCenter.h +66 -0
  159. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommandEvent.h +128 -0
  160. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteControlTypes.h +27 -0
  161. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPVolumeSettings.h +20 -0
  162. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPVolumeView.h +82 -0
  163. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.apinotes +74 -0
  164. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.h +40 -0
  165. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayerDefines.h +84 -0
  166. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/NSUserActivity+MediaPlayerAdditions.h +20 -0
  167. package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Modules/module.modulemap +5 -0
  168. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityCustomRotor.h +2 -2
  169. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAction.h +1 -1
  170. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBackgroundConfiguration.h +1 -1
  171. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIButtonConfiguration.h +1 -1
  172. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIContextMenuConfiguration.h +1 -1
  173. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIContextMenuInteraction.h +1 -1
  174. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDeferredMenuElement.h +1 -1
  175. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenu.h +1 -1
  176. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPointerStyle.h +5 -5
  177. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISlider.h +1 -1
  178. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISplitViewController.h +12 -50
  179. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISplitViewControllerLayoutEnvironment.h +2 -8
  180. package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +62 -0
  181. package/sdk/ios/usr/include/dispatch.modulemap +22 -0
  182. package/sdk/ios/usr/include/module.modulemap +8 -3
  183. package/sdk/ios/usr/include/net/if.h +24 -0
  184. package/sdk/ios/usr/include/sys/time.h +1 -1
  185. package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +265 -0
  186. package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2 -0
  187. package/sdk/ios/wasm/include/fcntl.h +2 -0
  188. package/sdk/ios/wasm/include/pthread.h +3 -0
  189. package/sdk/ios/wasm/include/stdlib.h +2 -0
  190. package/sdk/ios/wasm/include/unistd.h +2 -2
  191. package/skills/contrast/SKILL.md +2 -2
  192. package/src/bundle-channel.mjs +9 -72
  193. package/src/capture-contract.ts +12 -9
  194. package/src/desktop-host-delivery.ts +16 -2
  195. package/src/dev-bundle-resolution.ts +12 -3
  196. package/src/expo-native-workspace.ts +113 -46
  197. package/src/expo-swift-host.ts +17 -12
  198. package/src/expo-swift-ready.ts +4 -1
  199. package/src/expoSwiftContract.ts +1 -0
  200. package/src/home-paths.ts +4 -48
  201. package/src/host/bridge-host.ts +1 -0
  202. package/src/installed-native-libraries.ts +2 -8
  203. package/src/metro-project-root.ts +2 -1
  204. package/src/native-bundles.ts +122 -0
  205. package/src/native-static-libraries.ts +65 -8
  206. package/src/nitro-adapter.lock.json +272 -272
  207. package/src/nitro-bundle.ts +2 -2
  208. package/src/nitro-compile.ts +68 -28
  209. package/src/nitro-source.ts +24 -6
  210. package/src/nitro-superset.lock.json +94 -34
  211. package/src/nitroContract.ts +3 -0
  212. package/src/podspec-sources.ts +1966 -0
  213. package/src/storageSnapshotContract.ts +40 -0
  214. package/src/swift-compile.ts +77 -26
  215. package/src/swift-design-time.ts +18 -1
  216. package/src/swift-distribution.lock.json +12 -12
  217. package/src/swift-distribution.ts +9 -6
  218. package/src/swift-host.ts +1 -2
  219. package/src/swift-link-roots.ts +13 -2
  220. package/src/swift-objc-compile.ts +12 -0
  221. package/src/swift-objc-standin.ts +321 -114
  222. package/src/swift-package-manifest.ts +4 -3
  223. package/src/swift-package.ts +31 -4
  224. package/src/swift-root-lock.ts +11 -0
  225. package/src/swift-shared-sdk.ts +10 -9
  226. package/src/swift-source-pods.ts +2 -2
  227. package/src/swift-standins.ts +40 -143
  228. package/src/swift-toolchain.ts +59 -0
  229. package/src/swift-wasm-prune.ts +53 -21
  230. package/src/turbo-bundle.ts +4 -5
  231. package/src/turbo-codegen-intake.ts +111 -108
  232. package/src/turbo-compile.ts +63 -33
  233. package/src/turbo-runtime.lock.json +22 -22
  234. package/src/turbo-source.ts +171 -76
  235. package/src/wasm-optimize.ts +31 -2
  236. package/src/xcode-project.ts +65 -15
@@ -1,9 +1,10 @@
1
1
  // prepare Expo's own CocoaPods workspace in a private cache on the Mac.
2
- import { execFileSync, spawnSync } from 'node:child_process'
2
+ import { execFile, execFileSync, spawnSync } from 'node:child_process'
3
3
  import { createHash } from 'node:crypto'
4
4
  import fs from 'node:fs'
5
5
  import { createRequire } from 'node:module'
6
6
  import path from 'node:path'
7
+ import { promisify } from 'node:util'
7
8
  import { detectPackageManager } from '../cli/commands/detect'
8
9
  import { teamMachineInstalled } from './admitted-mac-build'
9
10
  import { workspaceExclusion } from './expo-workspace-exclusion'
@@ -13,7 +14,11 @@ import {
13
14
  reapRetiredCacheDirectory,
14
15
  removeRetiredDirectory,
15
16
  } from './retired-cache-directory'
16
- import { withSwiftRootLock, type SwiftRootLease } from './swift-root-lock'
17
+ import {
18
+ withCocoaPodsCacheLock,
19
+ withSwiftRootLock,
20
+ type SwiftRootLease,
21
+ } from './swift-root-lock'
17
22
  import { findWorkspaceRoot } from './workspace-root'
18
23
  import { resolveXcodeSwiftPackages, selectXcodeWorkspace } from './xcode-project'
19
24
 
@@ -67,9 +72,9 @@ const NATIVE_CONFIG_FILE =
67
72
  const NATIVE_SOURCE_FILE = /\.(swift|mm?|hpp?|c|cc|cpp|kt|java)$/
68
73
 
69
74
  // every file the native prepare can read, plus the toolchain that reads it.
70
- // node_modules stays out: the js install rebuilds it from the hashed lockfiles,
71
- // and the discovery cache keys the live native inventory separately. the walk
72
- // yields so the bridge that runs it keeps answering its other requests.
75
+ // node_modules stays out: the js install reconciles it with the hashed
76
+ // lockfiles, and the discovery cache keys the live native inventory separately.
77
+ // the walk yields so the bridge that runs it keeps answering its other requests.
73
78
  export async function hashExpoWorkspace(app: string, signal?: AbortSignal) {
74
79
  if (process.platform !== 'darwin') {
75
80
  const source = await hashExpoSourceWorkspace(app, signal)
@@ -191,23 +196,35 @@ async function hashWorkspaceInputs(
191
196
  excluded,
192
197
  }
193
198
  }
194
- let podVersion: string
195
- try {
196
- // runner-toolchain-platform: darwin
197
- podVersion = execFileSync('pod', ['--version'], { encoding: 'utf8', env: utf8Env })
198
- } catch (cause) {
199
- throw new Error('CocoaPods is required to install source dependencies', { cause })
200
- }
199
+ // cocoapods and xcode exist only on a Mac; elsewhere only the prebuild stage runs
200
+ const mac =
201
+ process.platform === 'darwin'
202
+ ? {
203
+ podVersion: (() => {
204
+ try {
205
+ // runner-toolchain-platform: darwin
206
+ return execFileSync('pod', ['--version'], {
207
+ encoding: 'utf8',
208
+ env: utf8Env,
209
+ })
210
+ } catch (cause) {
211
+ throw new Error('CocoaPods is required to install source dependencies', {
212
+ cause,
213
+ })
214
+ }
215
+ })(),
216
+ // runner-toolchain-platform: darwin
217
+ xcode: execFileSync('xcodebuild', ['-version'], {
218
+ encoding: 'utf8',
219
+ env: utf8Env,
220
+ }),
221
+ }
222
+ : {}
201
223
  const toolchain = JSON.stringify({
202
224
  preparation: 6,
203
225
  appRelative,
204
- podVersion,
226
+ ...mac,
205
227
  node: process.version,
206
- // runner-toolchain-platform: darwin
207
- xcode: execFileSync('xcodebuild', ['-version'], {
208
- encoding: 'utf8',
209
- env: utf8Env,
210
- }),
211
228
  packageManager: workspacePackageManager(root, manifest.packageManager, excluded),
212
229
  podsEnvironment,
213
230
  })
@@ -380,6 +397,26 @@ export async function prepareExpoNativeWorkspace(app: string, signal?: AbortSign
380
397
  return { ...prepared, workspace }
381
398
  }
382
399
 
400
+ // cocoapods runs only on a Mac. elsewhere the real pod graph exists only when a
401
+ // prepared workspace is supplied; without one, installed modules compile from
402
+ // their own sources as app-local modules do.
403
+ export function nativeWorkspaceAvailable(): boolean {
404
+ return (
405
+ process.platform === 'darwin' || Boolean(process.env.PEACH_PREPARED_NATIVE_WORKSPACES)
406
+ )
407
+ }
408
+
409
+ /** the app root whose ios directory the native compilers read: with the
410
+ * installed CocoaPods workspace where one can exist, otherwise the prebuilt
411
+ * Xcode project alone, which still declares the app's deployment target. */
412
+ export async function prepareNativeAppRoot(app: string, signal?: AbortSignal) {
413
+ return (
414
+ nativeWorkspaceAvailable()
415
+ ? await prepareExpoNativeWorkspace(app, signal)
416
+ : await prepareExpoNativeProject(app, signal)
417
+ ).app
418
+ }
419
+
383
420
  // resource target membership is generated by prebuild, before CocoaPods runs.
384
421
  export function prepareExpoNativeProject(app: string, signal?: AbortSignal) {
385
422
  return prepare(app, 'project', signal)
@@ -422,6 +459,53 @@ function prepare(app: string, stage: 'project' | 'workspace', signal?: AbortSign
422
459
  })
423
460
  }
424
461
 
462
+ // a workspace starts from the app's own installed dependencies, which the js
463
+ // install then reconciles with the lockfile: an installed tree that matches
464
+ // takes it under a second, where a fresh install fetches, links and runs every
465
+ // lifecycle script again. cp clones the trees eight packages at a time; a
466
+ // per-file copy from node takes several times as long, one cp per tree twice.
467
+ async function copyInstalledWorkspace(
468
+ root: string,
469
+ destination: string,
470
+ excluded: (relative: string) => boolean,
471
+ ) {
472
+ const installed: string[] = []
473
+ await fs.promises.cp(root, destination, {
474
+ recursive: true,
475
+ mode: fs.constants.COPYFILE_FICLONE,
476
+ preserveTimestamps: true,
477
+ verbatimSymlinks: true,
478
+ filter: (source) => {
479
+ const relative = path.relative(root, source)
480
+ if (path.basename(source) === 'node_modules') installed.push(relative)
481
+ return !excluded(relative)
482
+ },
483
+ })
484
+ const entries = installed.flatMap((relative) => {
485
+ const source = path.join(root, relative)
486
+ if (fs.lstatSync(source).isSymbolicLink()) {
487
+ fs.symlinkSync(fs.readlinkSync(source), path.join(destination, relative))
488
+ return []
489
+ }
490
+ fs.mkdirSync(path.join(destination, relative))
491
+ return fs.readdirSync(source).map((name) => path.join(relative, name))
492
+ })
493
+ const clone = async (): Promise<void> => {
494
+ const relative = entries.pop()
495
+ if (relative === undefined) return
496
+ await promisify(execFile)('cp', [
497
+ // -c clones on a Mac, as gnu cp already does where the filesystem can
498
+ ...(process.platform === 'darwin' ? ['-c'] : []),
499
+ '-R',
500
+ '-p',
501
+ path.join(root, relative),
502
+ path.join(destination, relative),
503
+ ])
504
+ return clone()
505
+ }
506
+ await Promise.all(Array.from({ length: 8 }, clone))
507
+ }
508
+
425
509
  // release producers prepare the already installed app. this preserves the
426
510
  // exact dependency tree selected by a replay, including a staged package.
427
511
  export async function prepareInstalledExpoWorkspace(app: string, work: string) {
@@ -434,18 +518,7 @@ export async function prepareInstalledExpoWorkspace(app: string, work: string) {
434
518
  throw new Error(`prepared Expo workspace already exists: ${work}`)
435
519
  fs.mkdirSync(path.dirname(work), { recursive: true })
436
520
  return withSwiftRootLock(work, async (lease) => {
437
- fs.cpSync(root, work, {
438
- recursive: true,
439
- mode: fs.constants.COPYFILE_FICLONE,
440
- preserveTimestamps: true,
441
- verbatimSymlinks: true,
442
- filter: (source) => {
443
- const relative = path.relative(root, source)
444
- const parts = relative.split(path.sep)
445
- if (parts.includes('.git')) return false
446
- return parts.includes('node_modules') || !excluded(relative)
447
- },
448
- })
521
+ await copyInstalledWorkspace(root, work, excluded)
449
522
  initializeWorkspaceGit(work)
450
523
  const preparedApp = path.join(work, appRelative)
451
524
  const manifest = JSON.parse(
@@ -500,7 +573,7 @@ async function prepareWorkspace(
500
573
  key: string,
501
574
  podsEnvironment: ReturnType<typeof reactNativePodsEnvironment>,
502
575
  ) {
503
- if (process.platform !== 'darwin') {
576
+ if (process.platform !== 'darwin' && stage === 'workspace') {
504
577
  const source = await hashExpoSourceWorkspace(app)
505
578
  return portableExpoWorkspace(app, source.hash)
506
579
  }
@@ -537,13 +610,7 @@ async function prepareWorkspace(
537
610
  await fs.promises.rm(partial, { recursive: true, force: true })
538
611
  await fs.promises.rm(work, { recursive: true, force: true })
539
612
  fs.mkdirSync(path.dirname(work), { recursive: true })
540
- await fs.promises.cp(root, partial, {
541
- recursive: true,
542
- mode: fs.constants.COPYFILE_FICLONE,
543
- preserveTimestamps: true,
544
- verbatimSymlinks: true,
545
- filter: (source) => !excluded(path.relative(root, source)),
546
- })
613
+ await copyInstalledWorkspace(root, partial, excluded)
547
614
  fs.renameSync(partial, work)
548
615
  // a lifecycle script that installs git hooks needs a repository, and the copy gets its own.
549
616
  // an app config may read HEAD, so the repository carries one empty commit
@@ -618,10 +685,8 @@ async function prepareWorkspace(
618
685
  'install',
619
686
  '--frozen-lockfile',
620
687
  ]
621
- : [
622
- 'npm',
623
- fs.existsSync(path.join(work, 'package-lock.json')) ? 'ci' : 'install',
624
- ]
688
+ : // npm ci would delete the cloned tree before installing it again
689
+ ['npm', 'install', '--no-audit', '--no-fund']
625
690
  // dependencies such as react-native-skia fetch their native binaries in a lifecycle
626
691
  // script, so a host-wide ignore-scripts must not reach the workspace install
627
692
  const installEnv = { npm_config_ignore_scripts: 'false', YARN_ENABLE_SCRIPTS: 'true' }
@@ -707,10 +772,12 @@ async function prepareNativeProject(
707
772
  if (stage === 'project') return
708
773
  // react-native-skia leaves Dawn to react-native-webgpu whenever that package
709
774
  // is installed, but autolinking links it only into apps that declare it.
710
- await run('pod', ['install'], path.join(app, 'ios'), {
711
- ...sourcePodEnv,
712
- ...(declares('react-native-webgpu') ? {} : { RNSKIA_VENDOR_DAWN: '1' }),
713
- })
775
+ await withCocoaPodsCacheLock(() =>
776
+ run('pod', ['install'], path.join(app, 'ios'), {
777
+ ...sourcePodEnv,
778
+ ...(declares('react-native-webgpu') ? {} : { RNSKIA_VENDOR_DAWN: '1' }),
779
+ }),
780
+ )
714
781
  report('pod install done')
715
782
  }
716
783
 
@@ -20,10 +20,13 @@ import {
20
20
  readExpoDiscovery,
21
21
  writeExpoDiscovery,
22
22
  } from './expo-discovery-cache'
23
- import { prepareExpoNativeWorkspace } from './expo-native-workspace'
23
+ import {
24
+ nativeWorkspaceAvailable,
25
+ prepareExpoNativeWorkspace,
26
+ } from './expo-native-workspace'
24
27
  import { COMPILED_EXPO_NATIVE_PACKAGES } from './expoSwiftContract'
25
28
  import { PEACH_FORKED_SCRIPT_ENV } from './forked-script-contract'
26
- import { cacheDir, swiftCacheDir } from './home-paths'
29
+ import { cacheDir } from './home-paths'
27
30
  import { isRecord } from './is-record'
28
31
  import { readExpoConfigAsync } from './native-firebase-config'
29
32
  import { NativePreparationReceipts } from './native-preparation'
@@ -77,6 +80,7 @@ import {
77
80
  SWIFT_STANDINS_DIR,
78
81
  } from './swift-standins'
79
82
  import { MAX_SWIFT_COMPILE_FILES, MAX_SWIFT_COMPILE_SOURCE_BYTES } from './swift-submit'
83
+ import { swiftCacheDir } from './swift-toolchain'
80
84
  import type { PeachConfig } from './config'
81
85
  import type {
82
86
  ExpoSwiftSourceUnit,
@@ -90,14 +94,6 @@ import type { SwiftNativeTarget } from './swiftContract'
90
94
  import type { IncomingMessage, ServerResponse } from 'node:http'
91
95
 
92
96
  const run = promisify(execFile)
93
- // cocoapods runs only on a Mac. elsewhere the real pod graph exists only when a
94
- // prepared workspace is supplied; without one, installed modules compile from
95
- // their own sources as app-local modules do.
96
- function nativeWorkspaceAvailable(): boolean {
97
- return (
98
- process.platform === 'darwin' || Boolean(process.env.PEACH_PREPARED_NATIVE_WORKSPACES)
99
- )
100
- }
101
97
  // the compiled CLI's execPath is peach itself, which runs a forked `.js` as a
102
98
  // script only with this set; node and bun ignore it.
103
99
  const scriptEnv = { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: '1' }
@@ -2173,9 +2169,18 @@ async function compileExpoSwiftModulesTraced(
2173
2169
  // names failing namespaces by build copy or app source: link the rest
2174
2170
  // once and isolate only those, or every namespace when that link fails.
2175
2171
  const errorFiles = combined.match(/^.+?(?=:\d+(?::\d+)?: error:)/gm) ?? []
2172
+ // a native unit compiles from its group copy, which the error or the
2173
+ // include chain above it names; the unit holds it as Sources/<target>/<path>.
2174
+ const nativeCopies = [
2175
+ ...combined.matchAll(
2176
+ /PeachNativeSources\/([^/]+?)(?:Native|Swift)Implementation_[0-9a-f]+\/([^:\s]+)/g,
2177
+ ),
2178
+ ].map(([, target, file]) => `Sources/${target}/${file}`)
2176
2179
  const named = candidates.filter((unit) =>
2177
- [...Object.keys(unit.files), ...expoUnitAppPaths(unit)].some((name) =>
2178
- errorFiles.some((file) => file === name || file.endsWith(`/${name}`)),
2180
+ [...Object.keys(unit.files), ...expoUnitAppPaths(unit)].some(
2181
+ (name) =>
2182
+ nativeCopies.includes(name) ||
2183
+ errorFiles.some((file) => file === name || file.endsWith(`/${name}`)),
2179
2184
  ),
2180
2185
  )
2181
2186
  let checked = candidates
@@ -43,7 +43,10 @@ export async function awaitExpoSwiftReady(
43
43
  res = await nodeHttpFetch(endpointUrl, { signal: options.signal })
44
44
  } catch (error) {
45
45
  if (options.signal?.aborted) throw error
46
- throw new Error(`could not reach ${endpointUrl}`, { cause: error })
46
+ throw new Error(
47
+ `could not reach ${endpointUrl}: ${error instanceof Error ? error.message : String(error)}`,
48
+ { cause: error },
49
+ )
47
50
  }
48
51
  if (!res.ok) {
49
52
  const text = (await res.text()).trim()
@@ -22,6 +22,7 @@ export const COMPILED_EXPO_NATIVE_PACKAGES: Readonly<
22
22
  'expo-hinge',
23
23
  'expo-location',
24
24
  'expo-store-review',
25
+ 'expo-updates',
25
26
  'expo-web-browser',
26
27
  ],
27
28
  android: [],
package/src/home-paths.ts CHANGED
@@ -189,54 +189,6 @@ export function cacheDir(): string {
189
189
  return path.join(rnxHomeDir(), 'cache')
190
190
  }
191
191
 
192
- export const BUILDERS_ROOT_ENV = 'CONTRAST_BUILDERS_ROOT'
193
-
194
- // builder sessions export the resolved native build root (`<heavy>/builders`
195
- // when machine policy configures heavy storage, else `~/builders`).
196
- // remote.sh refuses before source transfer when a configured root is
197
- // unavailable, so a set value is always usable and nothing here falls back to
198
- // the internal disk: a missing directory fails at first write like the other
199
- // heavy-root consumers.
200
- function buildersRootEnv(): string | null {
201
- const root = process.env[BUILDERS_ROOT_ENV]?.trim()
202
- return root ? root : null
203
- }
204
-
205
- // machine-wide swift scratch and package caches, shared across lanes. on a
206
- // builder this is the resolved heavy volume; everywhere else it stays
207
- // ~/.peach/cache, so dev machines, containers and CI keep their layout.
208
- export function swiftCacheDir(): string {
209
- const root = buildersRootEnv()
210
- return root ? path.join(root, 'peach-cache') : cacheDir()
211
- }
212
-
213
- // per-build-key swift project roots. on a builder every lane shares one
214
- // machine-wide directory on the heavy volume (the key is content-derived, so
215
- // lanes agree, and the root lock serializes concurrent builders); elsewhere
216
- // roots stay in the checkout so two checkouts never build each other's
217
- // sources. kept apart from the shared verified artifacts below: the builder
218
- // script prunes idle keys here and must never sweep that cache.
219
- export function swiftProjectBuildsDir(checkoutRoot: string): string {
220
- const root = buildersRootEnv()
221
- return root
222
- ? path.join(swiftCacheDir(), 'swift-project-builds')
223
- : path.join(checkoutRoot, 'scripts', 'tmp', 'swift-projects')
224
- }
225
-
226
- // swiftpm otherwise uses shared caches and configuration outside PEACH_HOME.
227
- // its keychain credential lookup blocks forever in a session that cannot
228
- // answer a keychain prompt, holding the artifact lock; netrc stays available.
229
- export function swiftPackageCacheOptions(): string[] {
230
- const root = path.join(swiftCacheDir(), 'swiftpm')
231
- return [
232
- ...['cache', 'config', 'security'].flatMap((name) => [
233
- `--${name}-path`,
234
- path.join(root, name),
235
- ]),
236
- '--disable-keychain',
237
- ]
238
- }
239
-
240
192
  export function daemonLockfilePath(): string {
241
193
  return path.join(rnxHomeDir(), DAEMON_LOCKFILE)
242
194
  }
@@ -526,6 +478,9 @@ export interface DaemonLockfile {
526
478
  /** epoch-ms of last heartbeat. daemons update this every ~5s; readers
527
479
  * treat the lockfile as stale if now - heartbeatAt > DAEMON_HEARTBEAT_STALE_MS. */
528
480
  heartbeatAt: number
481
+ /** cli version the daemon process runs. absent on daemons older than this
482
+ * field, which a newer cli replaces once the daemon is idle. */
483
+ cliVersion?: string
529
484
  /** true while the daemon has no usable runtime and is fetching one on first
530
485
  * boot. an installed runtime serves while an update downloads. */
531
486
  bootstrapping?: boolean
@@ -578,6 +533,7 @@ export function readDaemonLockfile(): DaemonLockfile | null {
578
533
  typeof parsed.runtimePort === 'number' &&
579
534
  typeof parsed.startedAt === 'number' &&
580
535
  typeof parsed.heartbeatAt === 'number' &&
536
+ (parsed.cliVersion === undefined || typeof parsed.cliVersion === 'string') &&
581
537
  (parsed.servedRuntimes === undefined ||
582
538
  (Array.isArray(parsed.servedRuntimes) &&
583
539
  parsed.servedRuntimes.every((version) => typeof version === 'string')))
@@ -1257,6 +1257,7 @@ export class SootSimBridgeHost {
1257
1257
  servedRuntimes: this.connectedRuntimeVersions(),
1258
1258
  startedAt: this.startedAt,
1259
1259
  heartbeatAt: Date.now(),
1260
+ cliVersion: getCliVersion(),
1260
1261
  bootstrapping: this.bootstrapping,
1261
1262
  }
1262
1263
  }
@@ -11,7 +11,7 @@ import {
11
11
  } from './native-static-libraries'
12
12
  import { readPackageFile, relativeInside } from './swift-source-file'
13
13
  import { simulatorStaticArchive } from './swift-xcframework'
14
- import { readXcodeAppTarget, selectXcodeWorkspace } from './xcode-project'
14
+ import { readXcodeAppTarget, requireInstalledXcodeWorkspace } from './xcode-project'
15
15
  import type { TurboInstalledPod, TurboProvider } from './turbo-source'
16
16
 
17
17
  export function installedNativeLibraries(
@@ -22,13 +22,7 @@ export function installedNativeLibraries(
22
22
  frameworkLinkOwner: 'workspace' | 'provider' = 'workspace',
23
23
  ): Map<string, TurboInstalledPod> {
24
24
  if (providers.length === 0) return new Map()
25
- const ios = path.join(projectRoot, 'ios')
26
- const workspace = selectXcodeWorkspace(
27
- ios,
28
- fs.readdirSync(ios).filter((name) => name.endsWith('.xcworkspace')),
29
- )
30
- if (!workspace)
31
- throw new Error(`${ios}: native providers require the installed CocoaPods workspace`)
25
+ const workspace = requireInstalledXcodeWorkspace(projectRoot, 'native providers')
32
26
  const app = readXcodeAppTarget(workspace, iosTarget, 'Release', {
33
27
  installedPods: true,
34
28
  prepareGeneratedSources: false,
@@ -3,6 +3,7 @@ import { loopbackOriginOf } from './backend-origin'
3
3
  import {
4
4
  fetchDevManifest,
5
5
  MANIFEST_PROBE_TIMEOUT_MS,
6
+ metroRequestFailure,
6
7
  type ManifestWaitOptions,
7
8
  } from './dev-bundle-resolution'
8
9
  import { parseExpoManifestBody } from './expo-manifest-body'
@@ -61,7 +62,7 @@ export async function resolveMetroProjectRoot(
61
62
  }
62
63
  if (typeof root === 'string' && root.length > 0) return root
63
64
  } else if (res.status !== 404 && res.status !== 405) {
64
- throw new Error(`Metro project root request failed: HTTP ${res.status} at ${origin}/`)
65
+ throw await metroRequestFailure('project root', origin, res)
65
66
  }
66
67
 
67
68
  // a server that answered with a manifest has already told us everything it
@@ -0,0 +1,122 @@
1
+ // an app's compiled native modules for one platform, and the bundle footers
2
+ // that attach them. every producer that ships a bundle without the app's dev
3
+ // server (release channels, `peach package`, remote simulators) compiles here
4
+ // and differs only in where each module's files are served from.
5
+ import {
6
+ insertExpoKotlinFooter,
7
+ type ExpoKotlinCompilationResult,
8
+ } from './expoKotlinContract'
9
+ import {
10
+ insertExpoSwiftFooter,
11
+ type ExpoSwiftCompilationResult,
12
+ } from './expoSwiftContract'
13
+ import {
14
+ insertNitroFooter,
15
+ insertTurboFooter,
16
+ type NitroCompiledModule,
17
+ type TurboCompiledModule,
18
+ } from './nitroContract'
19
+ import { getRuntimePlatformAdapter } from './runtimePlatformContract'
20
+ import type { ExpoKotlinBundle } from './expo-kotlin-bundle'
21
+ import type { ExpoSwiftBundle } from './expo-swift-bundle'
22
+ import type { CompiledModuleAsset, NitroBundle } from './nitro-bundle'
23
+
24
+ export interface NativeBundles {
25
+ expoSwift: ExpoSwiftBundle | null
26
+ nitro: NitroBundle | null
27
+ turbo: { metadata: TurboCompiledModule; assets: CompiledModuleAsset[] } | null
28
+ expoKotlin: ExpoKotlinBundle | null
29
+ }
30
+
31
+ export interface NativeBundleMetadata {
32
+ expoSwift?: ExpoSwiftCompilationResult
33
+ expoKotlin?: ExpoKotlinCompilationResult
34
+ nitro?: NitroCompiledModule
35
+ turbo?: TurboCompiledModule
36
+ }
37
+
38
+ // the app's local Expo modules for the platform and, on ios, one executable of
39
+ // its installed Nitro providers, compiled in the Xcode configuration that runs
40
+ // the bundle's mode, and one of its C++ TurboModule providers.
41
+ export async function buildNativeBundles(
42
+ projectRoot: string,
43
+ platform: 'ios' | 'android',
44
+ configuration: 'Debug' | 'Release',
45
+ ): Promise<NativeBundles> {
46
+ return getRuntimePlatformAdapter(platform).select<() => Promise<NativeBundles>>({
47
+ ios: async () => ({
48
+ expoSwift: await (
49
+ await import('./expo-swift-bundle')
50
+ ).buildExpoSwiftBundle(projectRoot),
51
+ nitro: await (
52
+ await import('./nitro-bundle')
53
+ ).buildNitroBundle(projectRoot, configuration),
54
+ turbo: await (await import('./turbo-bundle')).buildTurboBundle(projectRoot),
55
+ expoKotlin: null,
56
+ }),
57
+ android: async () => ({
58
+ expoSwift: null,
59
+ nitro: null,
60
+ turbo: null,
61
+ expoKotlin: await (
62
+ await import('./expo-kotlin-bundle')
63
+ ).buildExpoKotlinBundle(projectRoot),
64
+ }),
65
+ })()
66
+ }
67
+
68
+ // every served file of the compiled modules, once per path
69
+ export function nativeBundleAssets(natives: NativeBundles): CompiledModuleAsset[] {
70
+ const assets = new Map<string, CompiledModuleAsset>()
71
+ for (const native of [
72
+ natives.expoSwift,
73
+ natives.nitro,
74
+ natives.turbo,
75
+ natives.expoKotlin,
76
+ ])
77
+ for (const asset of native?.assets ?? []) assets.set(asset.path, asset)
78
+ return [...assets.values()]
79
+ }
80
+
81
+ // compilers address each file relative to the bundle, as `/__peach/...`;
82
+ // `locate` gives the url a file is served at, from its path without the
83
+ // leading slash. an ICU url that is already absolute is shared and stays.
84
+ export function insertNativeBundleFooters(
85
+ source: string,
86
+ natives: NativeBundles,
87
+ locate: (path: string) => string,
88
+ ): { source: string; metadata: NativeBundleMetadata | null } {
89
+ const served = (url: string) => locate(url.replace(/^\//, ''))
90
+ const icu = (url: string) => (url.startsWith('/') ? served(url) : url)
91
+ const metadata: NativeBundleMetadata = {}
92
+ if (natives.expoSwift) {
93
+ metadata.expoSwift = {
94
+ ...natives.expoSwift.metadata,
95
+ modules: natives.expoSwift.metadata.modules.map((artifact) => ({
96
+ ...artifact,
97
+ url: served(artifact.url),
98
+ icuUrl: icu(artifact.icuUrl),
99
+ })),
100
+ }
101
+ source = insertExpoSwiftFooter(source, metadata.expoSwift)
102
+ }
103
+ if (natives.expoKotlin) {
104
+ const { module } = natives.expoKotlin.metadata
105
+ metadata.expoKotlin = {
106
+ ...natives.expoKotlin.metadata,
107
+ module: module && { ...module, url: served(module.url) },
108
+ }
109
+ source = insertExpoKotlinFooter(source, metadata.expoKotlin)
110
+ }
111
+ if (natives.nitro) {
112
+ const nitro = natives.nitro.metadata
113
+ metadata.nitro = { ...nitro, url: served(nitro.url), icuUrl: icu(nitro.icuUrl) }
114
+ source = insertNitroFooter(source, metadata.nitro)
115
+ }
116
+ if (natives.turbo) {
117
+ const turbo = natives.turbo.metadata
118
+ metadata.turbo = { ...turbo, url: served(turbo.url), icuUrl: icu(turbo.icuUrl) }
119
+ source = insertTurboFooter(source, metadata.turbo)
120
+ }
121
+ return { source, metadata: Object.keys(metadata).length ? metadata : null }
122
+ }