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.
- package/README.md +4 -2
- package/cli/app-bundle-resources.ts +15 -2
- package/cli/cloud-box-artifact.ts +115 -0
- package/cli/cloud-client.ts +148 -76
- package/cli/cloud-dispatch.ts +4 -4
- package/cli/cloud-session.ts +60 -22
- package/cli/commands/box.ts +8 -2
- package/cli/commands/compat.ts +7 -4
- package/cli/commands/control.ts +69 -3
- package/cli/commands/coverage.ts +14 -4
- package/cli/commands/daemon.ts +41 -0
- package/cli/commands/no-bridge-hint.ts +9 -0
- package/cli/commands/package.ts +31 -56
- package/cli/commands/platform.ts +71 -60
- package/cli/commands/preview.ts +73 -24
- package/cli/commands/record.ts +10 -2
- package/cli/commands/screenshot.ts +17 -60
- package/cli/commands/setup.ts +3 -1
- package/cli/commands/three-mode.ts +22 -12
- package/cli/commands/upload.ts +2 -1
- package/cli/desktop-companion.ts +6 -1
- package/cli/drivers/desktop.ts +4 -1
- package/cli/main.ts +12 -2
- package/cli/metro-bundle-assets.ts +14 -4
- package/cli/outbound-endpoints.ts +7 -3
- package/cli/output-redaction.ts +38 -0
- package/cli/privacy.ts +2 -2
- package/cli/recording-access.ts +5 -0
- package/cli/remote-project-bundle.ts +83 -0
- package/cli/shell-init.ts +7 -11
- package/cli/telemetry.ts +41 -4
- package/cli/usage-error.ts +3 -0
- package/cli/ws-bridge.ts +42 -6
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +42897 -40755
- package/dist-lib/capture-contract.cjs +7 -8
- package/dist-lib/capture-contract.mjs +7 -8
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +13 -7
- package/dist-lib/dev-bundle-resolution.cjs +10 -4
- package/dist-lib/expo-swift-bundle.cjs +15889 -15553
- package/dist-lib/expo-swift-metadata.cjs +2 -1
- package/dist-lib/expo-swift-metadata.mjs +2 -1
- package/dist-lib/home-paths.cjs +2 -33
- package/dist-lib/host/bridge-host.cjs +20891 -18714
- package/dist-lib/host/fetch-proxy-handler.cjs +10 -11
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +620 -553
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +57 -28
- package/dist-lib/native-app-identity-project.cjs +47 -14
- package/dist-lib/native-app-identity-project.mjs +55 -20
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +27 -26
- package/dist-lib/public-origins-lib.json +104 -81
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +30700 -24410
- package/dist-lib/swift-compile.cjs +336 -222
- package/dist-lib/swift-compile.mjs +378 -263
- package/dist-lib/swift-package.cjs +19 -7
- package/dist-lib/swift-package.mjs +16 -6
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +49 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +19213 -18937
- package/dist-lib/vite.cjs +11 -12
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/animated.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/expo-manifest.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +8 -1
- package/dist-types/packages/peach-globals/src/electronBridgeContract.d.ts +2 -1
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCall.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCallCenter.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCarrier.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriber.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriberInfo.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSDictionary.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSExtensionItem.h +1 -1
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/AVFoundation+MPNowPlayingInfoLanguageOptionAdditions.h +39 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/AVPlayerItem+MediaPlayerAdditions.h +26 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPContentItem.h +67 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPError.h +33 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaEntity.h +53 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItem.h +346 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItemCollection.h +42 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaLibrary.h +76 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPickerController.h +64 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPlayback.h +47 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPlaylist.h +82 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaQuery.h +120 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaQuerySection.h +26 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMoviePlayerController.h +444 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMoviePlayerViewController.h +43 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerApplicationController.h +47 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerController.h +147 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerQueueDescriptor.h +75 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingInfoCenter.h +197 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingInfoLanguageOption.h +107 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingSession.h +89 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentDataSource.h +59 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentDelegate.h +64 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentManager.h +46 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentManagerContext.h +32 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommand.h +143 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommandCenter.h +66 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommandEvent.h +128 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteControlTypes.h +27 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPVolumeSettings.h +20 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPVolumeView.h +82 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.apinotes +74 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.h +40 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayerDefines.h +84 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/NSUserActivity+MediaPlayerAdditions.h +20 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityCustomRotor.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBackgroundConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIButtonConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIContextMenuConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIContextMenuInteraction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDeferredMenuElement.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenu.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPointerStyle.h +5 -5
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISlider.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISplitViewController.h +12 -50
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISplitViewControllerLayoutEnvironment.h +2 -8
- package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +62 -0
- package/sdk/ios/usr/include/dispatch.modulemap +22 -0
- package/sdk/ios/usr/include/module.modulemap +8 -3
- package/sdk/ios/usr/include/net/if.h +24 -0
- package/sdk/ios/usr/include/sys/time.h +1 -1
- package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +265 -0
- package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2 -0
- package/sdk/ios/wasm/include/fcntl.h +2 -0
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/stdlib.h +2 -0
- package/sdk/ios/wasm/include/unistd.h +2 -2
- package/skills/contrast/SKILL.md +2 -2
- package/src/bundle-channel.mjs +9 -72
- package/src/capture-contract.ts +12 -9
- package/src/desktop-host-delivery.ts +16 -2
- package/src/dev-bundle-resolution.ts +12 -3
- package/src/expo-native-workspace.ts +113 -46
- package/src/expo-swift-host.ts +17 -12
- package/src/expo-swift-ready.ts +4 -1
- package/src/expoSwiftContract.ts +1 -0
- package/src/home-paths.ts +4 -48
- package/src/host/bridge-host.ts +1 -0
- package/src/installed-native-libraries.ts +2 -8
- package/src/metro-project-root.ts +2 -1
- package/src/native-bundles.ts +122 -0
- package/src/native-static-libraries.ts +65 -8
- package/src/nitro-adapter.lock.json +272 -272
- package/src/nitro-bundle.ts +2 -2
- package/src/nitro-compile.ts +68 -28
- package/src/nitro-source.ts +24 -6
- package/src/nitro-superset.lock.json +94 -34
- package/src/nitroContract.ts +3 -0
- package/src/podspec-sources.ts +1966 -0
- package/src/storageSnapshotContract.ts +40 -0
- package/src/swift-compile.ts +77 -26
- package/src/swift-design-time.ts +18 -1
- package/src/swift-distribution.lock.json +12 -12
- package/src/swift-distribution.ts +9 -6
- package/src/swift-host.ts +1 -2
- package/src/swift-link-roots.ts +13 -2
- package/src/swift-objc-compile.ts +12 -0
- package/src/swift-objc-standin.ts +321 -114
- package/src/swift-package-manifest.ts +4 -3
- package/src/swift-package.ts +31 -4
- package/src/swift-root-lock.ts +11 -0
- package/src/swift-shared-sdk.ts +10 -9
- package/src/swift-source-pods.ts +2 -2
- package/src/swift-standins.ts +40 -143
- package/src/swift-toolchain.ts +59 -0
- package/src/swift-wasm-prune.ts +53 -21
- package/src/turbo-bundle.ts +4 -5
- package/src/turbo-codegen-intake.ts +111 -108
- package/src/turbo-compile.ts +63 -33
- package/src/turbo-runtime.lock.json +22 -22
- package/src/turbo-source.ts +171 -76
- package/src/wasm-optimize.ts +31 -2
- 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 {
|
|
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
|
|
71
|
-
// and the discovery cache keys the live native inventory separately.
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
711
|
-
|
|
712
|
-
|
|
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
|
|
package/src/expo-swift-host.ts
CHANGED
|
@@ -20,10 +20,13 @@ import {
|
|
|
20
20
|
readExpoDiscovery,
|
|
21
21
|
writeExpoDiscovery,
|
|
22
22
|
} from './expo-discovery-cache'
|
|
23
|
-
import {
|
|
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
|
|
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(
|
|
2178
|
-
|
|
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
|
package/src/expo-swift-ready.ts
CHANGED
|
@@ -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(
|
|
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()
|
package/src/expoSwiftContract.ts
CHANGED
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')))
|
package/src/host/bridge-host.ts
CHANGED
|
@@ -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,
|
|
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
|
|
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
|
|
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
|
+
}
|