peachsim 0.1.1808 → 0.1.1811
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 +95 -53
- 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 +60 -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 +70 -52
- 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 +42783 -40717
- 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 +15819 -15559
- 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 +20857 -18756
- package/dist-lib/host/fetch-proxy-handler.cjs +10 -10
- 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 +588 -544
- 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 +25 -19
- package/dist-lib/native-app-identity-project.cjs +15 -6
- package/dist-lib/native-app-identity-project.mjs +23 -12
- 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 +30496 -24309
- package/dist-lib/swift-compile.cjs +292 -213
- package/dist-lib/swift-compile.mjs +334 -254
- package/dist-lib/swift-package.cjs +8 -4
- package/dist-lib/swift-package.mjs +8 -4
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +32 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +19172 -18941
- package/dist-lib/vite.cjs +11 -11
- 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/usr/include/dispatch.modulemap +22 -0
- 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 +57 -19
- 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 +278 -278
- 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 +2 -0
- package/src/podspec-sources.ts +1966 -0
- package/src/storageSnapshotContract.ts +40 -0
- package/src/swift-compile.ts +57 -20
- package/src/swift-design-time.ts +18 -1
- package/src/swift-distribution.lock.json +11 -11
- package/src/swift-distribution.ts +9 -6
- package/src/swift-host.ts +1 -2
- package/src/swift-objc-standin.ts +316 -112
- package/src/swift-package-manifest.ts +4 -3
- package/src/swift-package.ts +10 -3
- 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 +42 -0
- package/src/swift-wasm-prune.ts +53 -21
- package/src/turbo-bundle.ts +2 -2
- package/src/turbo-codegen-intake.ts +111 -108
- package/src/turbo-compile.ts +63 -33
- package/src/turbo-runtime.lock.json +21 -21
- package/src/turbo-source.ts +171 -76
- package/src/wasm-optimize.ts +31 -2
- package/src/xcode-project.ts +36 -3
package/cli/commands/control.ts
CHANGED
|
@@ -5,12 +5,14 @@ import https from 'node:https'
|
|
|
5
5
|
import net from 'node:net'
|
|
6
6
|
import os from 'node:os'
|
|
7
7
|
import path from 'node:path'
|
|
8
|
+
import { compareSemver } from '@contrast/runtime-delivery'
|
|
8
9
|
import { WebSocket } from 'ws'
|
|
9
10
|
import { formatLockOwner } from '../../src/agent-identity'
|
|
10
11
|
import { ANDROID_ROOT_MODULE_QUERY_PARAM } from '../../src/androidRootModuleContract'
|
|
11
12
|
import { isAppDeepLinkTarget, openAppUrl } from '../../src/app-url'
|
|
12
13
|
import { isLoopbackHost } from '../../src/backend-origin'
|
|
13
14
|
import { getCliRuntime } from '../../src/cli-runtime.ts'
|
|
15
|
+
import { getCliVersion } from '../../src/cli-version'
|
|
14
16
|
import {
|
|
15
17
|
applyPeachConfigToUrl,
|
|
16
18
|
mergePeachConfig,
|
|
@@ -30,6 +32,7 @@ import { flowTimeoutScale } from '../../src/flow-timeout-scale'
|
|
|
30
32
|
import {
|
|
31
33
|
isDaemonLockfileFresh,
|
|
32
34
|
isDevBridgeLockfileFresh,
|
|
35
|
+
isSootsimDevCheckout,
|
|
33
36
|
PEACH_HOME_ENV,
|
|
34
37
|
readActiveRuntime,
|
|
35
38
|
readDaemonLockfile,
|
|
@@ -90,6 +93,7 @@ import {
|
|
|
90
93
|
type ParsedBridgeCliArgs,
|
|
91
94
|
type WsBridge,
|
|
92
95
|
} from '../ws-bridge'
|
|
96
|
+
import { retireIdleBridge } from './daemon'
|
|
93
97
|
import { inspectDescribe, inspectReadySnapshot, waitReadyReason } from './inspect/core'
|
|
94
98
|
import { waitForSimReady } from './inspect/shared'
|
|
95
99
|
import { runInstallDesktop } from './install-desktop'
|
|
@@ -352,6 +356,7 @@ async function connectBridgeForOpen(
|
|
|
352
356
|
runtimeSource: 'bridge' | 'external',
|
|
353
357
|
): Promise<number> {
|
|
354
358
|
isolateHomeForExplicitPort(preferredPort, explicitPort, readDaemonLockfile())
|
|
359
|
+
await retireOutdatedIdleBridge(readDaemonLockfile())
|
|
355
360
|
const lock = readDaemonLockfile()
|
|
356
361
|
const preferredWorld = worldForBridgePort(preferredPort)
|
|
357
362
|
const handshakeTimeoutMs = LIVE_BRIDGE_HANDSHAKE_TIMEOUT_MS * flowTimeoutScale()
|
|
@@ -474,6 +479,35 @@ async function connectBridgeForOpen(
|
|
|
474
479
|
)
|
|
475
480
|
}
|
|
476
481
|
|
|
482
|
+
// a bridge started by an older cli lacks the routes this cli's sims need, and
|
|
483
|
+
// they sit reconnecting against it. replace it once nothing uses it: no live or
|
|
484
|
+
// retained sim, and not the Mac app's own bridge. a busy or unanswering bridge
|
|
485
|
+
// is left alone, so active sessions are never cut.
|
|
486
|
+
async function retireOutdatedIdleBridge(
|
|
487
|
+
lock: ReturnType<typeof readDaemonLockfile>,
|
|
488
|
+
): Promise<void> {
|
|
489
|
+
if (!lock || !isDaemonLockfileFresh(lock) || lock.bootstrapping) return
|
|
490
|
+
const current = getCliVersion()
|
|
491
|
+
if (isSootsimDevCheckout() || lock.cliVersion === current) return
|
|
492
|
+
if (lock.cliVersion && compareSemver(current, lock.cliVersion) <= 0) return
|
|
493
|
+
const appRecord = path.join(rnxHomeDir(), 'app-runtime.json')
|
|
494
|
+
if (fs.existsSync(appRecord)) return
|
|
495
|
+
const bridge = createBridge(lock.bridgePort, { commandTimeoutMs: 2000 })
|
|
496
|
+
const simCount = await bridge.listSims({ includeRetained: true }).then(
|
|
497
|
+
(sims) => sims.length,
|
|
498
|
+
() => -1,
|
|
499
|
+
)
|
|
500
|
+
bridge.close()
|
|
501
|
+
if (simCount !== 0) return
|
|
502
|
+
console.error(
|
|
503
|
+
` Replacing the idle peach bridge on port ${lock.bridgePort} (${lock.cliVersion ? `v${lock.cliVersion}` : 'older'}) with v${current}.`,
|
|
504
|
+
)
|
|
505
|
+
await retireIdleBridge(lock)
|
|
506
|
+
const deadline = Date.now() + 10_000
|
|
507
|
+
while (isDaemonLockfileFresh(readDaemonLockfile()) && Date.now() < deadline)
|
|
508
|
+
await sleep(100)
|
|
509
|
+
}
|
|
510
|
+
|
|
477
511
|
// one bridge per peach home, so an explicit port the active daemon does not own
|
|
478
512
|
// gets its own home: this command and the bridge it starts both run in it,
|
|
479
513
|
// sharing the daemon's installed runtimes unless this CLI serves its own dev
|
|
@@ -562,7 +596,9 @@ export async function ensureRuntimeForOpen() {
|
|
|
562
596
|
await runRuntime(['install'], {})
|
|
563
597
|
}
|
|
564
598
|
|
|
565
|
-
|
|
599
|
+
// 'foreign' is a server that accepts the websocket but whose /healthz does not
|
|
600
|
+
// identify a peach bridge: another tool holding the port, never adopted.
|
|
601
|
+
type BridgeHandshake = 'open' | 'refused' | 'timeout' | 'foreign'
|
|
566
602
|
|
|
567
603
|
function bridgeHandshake(
|
|
568
604
|
port: number,
|
|
@@ -585,7 +621,21 @@ function bridgeHandshake(
|
|
|
585
621
|
const onAbort = () => finish('timeout')
|
|
586
622
|
if (signal?.aborted) onAbort()
|
|
587
623
|
else signal?.addEventListener('abort', onAbort)
|
|
588
|
-
ws.once('open', () =>
|
|
624
|
+
ws.once('open', () => {
|
|
625
|
+
fetch(`http://127.0.0.1:${port}/healthz`, {
|
|
626
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
627
|
+
})
|
|
628
|
+
.then((res) => res.json())
|
|
629
|
+
.then(
|
|
630
|
+
(health: unknown) =>
|
|
631
|
+
finish(
|
|
632
|
+
health && typeof health === 'object' && Reflect.get(health, 'ok') === true
|
|
633
|
+
? 'open'
|
|
634
|
+
: 'foreign',
|
|
635
|
+
),
|
|
636
|
+
() => finish('foreign'),
|
|
637
|
+
)
|
|
638
|
+
})
|
|
589
639
|
ws.on('error', (err: NodeJS.ErrnoException) => {
|
|
590
640
|
finish(
|
|
591
641
|
err.code === 'ECONNREFUSED' || err.code === 'ENOTFOUND' ? 'refused' : 'timeout',
|
|
@@ -599,6 +649,9 @@ function unreachableBridgeMessage(
|
|
|
599
649
|
handshake: BridgeHandshake,
|
|
600
650
|
timeoutMs: number,
|
|
601
651
|
): string {
|
|
652
|
+
if (handshake === 'foreign') {
|
|
653
|
+
return `peach open: requested bridge port ${port} is held by another program, not a peach bridge. stop it or pass a free port with --port <port>.`
|
|
654
|
+
}
|
|
602
655
|
if (handshake === 'timeout') {
|
|
603
656
|
const cores = Math.max(1, os.cpus().length)
|
|
604
657
|
const load = os.loadavg()[0]
|
|
@@ -1948,7 +2001,11 @@ async function openSim(
|
|
|
1948
2001
|
windowSize,
|
|
1949
2002
|
osVersion: osVersionArg,
|
|
1950
2003
|
theme: themeArg,
|
|
1951
|
-
|
|
2004
|
+
// --target selects the Xcode application target on native opens; honor it
|
|
2005
|
+
// on dev-server opens too, where the multi-target error sends strangers
|
|
2006
|
+
iosTarget:
|
|
2007
|
+
args.find((_, i) => args[i - 1] === '--ios-target') ??
|
|
2008
|
+
args.find((_, i) => args[i - 1] === '--target'),
|
|
1952
2009
|
resolvedBundle,
|
|
1953
2010
|
project,
|
|
1954
2011
|
oneAppSplash,
|
package/cli/commands/coverage.ts
CHANGED
|
@@ -805,13 +805,25 @@ export function isSwiftSourceApp(app: string, sources: readonly string[]): boole
|
|
|
805
805
|
)
|
|
806
806
|
}
|
|
807
807
|
|
|
808
|
-
// printed under compat's Source heading
|
|
808
|
+
// printed under compat's Source heading. by default it prints the scan size and
|
|
809
|
+
// what needs attention; --verbose adds the feature and reference breakdown.
|
|
809
810
|
export function printCoverageReport(report: CoverageReport, verbose: boolean): void {
|
|
810
811
|
const { summary } = report
|
|
811
812
|
const say = (text: string) => console.log(` ${text}`)
|
|
812
813
|
say(
|
|
813
814
|
`Scanned ${report.input.files} source files: ${summary.references} package references (${summary.projectModuleReferences} imports of the app's own modules not counted).`,
|
|
814
815
|
)
|
|
816
|
+
if (!verbose) {
|
|
817
|
+
for (const module of report.localNativeModules)
|
|
818
|
+
say(
|
|
819
|
+
` app-owned native module ${module.module} (${module.path}): ${module.references} references, unknown`,
|
|
820
|
+
)
|
|
821
|
+
for (const issue of report.unknowns) say(` ${issue.path}: ${issue.reason}`)
|
|
822
|
+
say(
|
|
823
|
+
'--verbose adds what works in each package, every feature, every package reference and the scan limits.',
|
|
824
|
+
)
|
|
825
|
+
return
|
|
826
|
+
}
|
|
815
827
|
say(
|
|
816
828
|
` mapped to a feature: ${summary.mappedReferences}; package ships no native code: ${summary.noNativeSurfaceReferences}; version unknown: ${summary.versionUnknownReferences}; other unknown or unmapped: ${Math.max(0, summary.unknownReferences - summary.versionUnknownReferences)}`,
|
|
817
829
|
)
|
|
@@ -822,9 +834,7 @@ export function printCoverageReport(report: CoverageReport, verbose: boolean): v
|
|
|
822
834
|
say(
|
|
823
835
|
`Final graph (${report.graph.platform}): ${report.graph.projectModules} project modules, ${report.graph.packageModules} package modules; complete: ${report.graph.complete ?? 'unknown'}.`,
|
|
824
836
|
)
|
|
825
|
-
|
|
826
|
-
say(` ${report.features.length} features; --verbose lists each`)
|
|
827
|
-
for (const feature of verbose ? report.features : [])
|
|
837
|
+
for (const feature of report.features)
|
|
828
838
|
say(
|
|
829
839
|
` ${feature.id}${feature.graphReach ? ` (${feature.graphReach})` : ''}: verification unknown; unknown axes: ${feature.unknownAxes.join(', ') || 'none'}`,
|
|
830
840
|
)
|
package/cli/commands/daemon.ts
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
readDaemonLockfile,
|
|
38
38
|
shouldSkipPersistentDaemon,
|
|
39
39
|
rnxHomeDir,
|
|
40
|
+
type DaemonLockfile,
|
|
40
41
|
} from '../../src/home-paths'
|
|
41
42
|
import { rnxPublicBrand } from '../../src/public-brand'
|
|
42
43
|
import { printCommandHelp } from '../help'
|
|
@@ -828,6 +829,46 @@ async function daemonStatus() {
|
|
|
828
829
|
peachExit(1)
|
|
829
830
|
}
|
|
830
831
|
|
|
832
|
+
// hands off an idle bridge that an older cli left running, so the next start
|
|
833
|
+
// serves the current cli's routes. a service-managed bridge restarts through
|
|
834
|
+
// its service; a bare bridge gets SIGTERM only when its pid still owns the
|
|
835
|
+
// lockfile's listening port, since a lockfile alone cannot authorize a signal.
|
|
836
|
+
// its sims and files are untouched: the caller proves the bridge idle first.
|
|
837
|
+
export async function retireIdleBridge(lock: DaemonLockfile): Promise<void> {
|
|
838
|
+
if (process.platform === 'darwin') {
|
|
839
|
+
const service = existsSync(macPlistPath())
|
|
840
|
+
? readMacDaemonState(macServiceTarget())
|
|
841
|
+
: null
|
|
842
|
+
if (service?.pid === lock.pid) return daemonRestart()
|
|
843
|
+
if (!macBridgeHasListener(lock.pid, lock.bridgePort)) return
|
|
844
|
+
process.kill(lock.pid, 'SIGTERM')
|
|
845
|
+
return waitForBridgeRelease(macBridgeHasListener, lock)
|
|
846
|
+
}
|
|
847
|
+
if (process.platform === 'linux') {
|
|
848
|
+
const mainPid = spawnSync(
|
|
849
|
+
'systemctl',
|
|
850
|
+
['--user', 'show', SERVICE_NAME_LINUX, '-p', 'MainPID', '--value'],
|
|
851
|
+
{ encoding: 'utf8' },
|
|
852
|
+
).stdout.trim()
|
|
853
|
+
if (mainPid === String(lock.pid)) return daemonRestart()
|
|
854
|
+
if (!linuxBridgeHasListener(lock.pid, lock.bridgePort)) return
|
|
855
|
+
process.kill(lock.pid, 'SIGTERM')
|
|
856
|
+
return waitForBridgeRelease(linuxBridgeHasListener, lock)
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
async function waitForBridgeRelease(
|
|
861
|
+
hasListener: (pid: number, port: number) => boolean,
|
|
862
|
+
lock: DaemonLockfile,
|
|
863
|
+
): Promise<void> {
|
|
864
|
+
const deadline = Date.now() + 4000
|
|
865
|
+
while (Date.now() < deadline) {
|
|
866
|
+
if (!hasListener(lock.pid, lock.bridgePort)) return
|
|
867
|
+
await new Promise((resolve) => setTimeout(resolve, 100))
|
|
868
|
+
}
|
|
869
|
+
throw new Error(`bridge pid ${lock.pid} did not release port ${lock.bridgePort}`)
|
|
870
|
+
}
|
|
871
|
+
|
|
831
872
|
async function daemonRestart() {
|
|
832
873
|
if (process.platform === 'darwin') {
|
|
833
874
|
const path = macPlistPath()
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
// shared hint printed when the CLI has no bridge or no desktop companion.
|
|
2
2
|
|
|
3
|
+
import { desktopHostPlatform } from '../../src/desktop-host-delivery'
|
|
3
4
|
import type { BridgeSimInfo } from '../ws-bridge'
|
|
4
5
|
|
|
5
6
|
export function printMissingCompanionHint(native = false) {
|
|
7
|
+
if (process.platform === 'darwin' && !desktopHostPlatform()) {
|
|
8
|
+
console.error(' the Peach desktop app needs Apple silicon on macOS 26 or later.')
|
|
9
|
+
console.error('')
|
|
10
|
+
console.error(' open the simulator in a browser window instead:')
|
|
11
|
+
console.error(' peach open <target> --driver playwright --headed')
|
|
12
|
+
console.error('')
|
|
13
|
+
return
|
|
14
|
+
}
|
|
6
15
|
console.error(
|
|
7
16
|
native
|
|
8
17
|
? ' no native peach desktop host found.'
|
package/cli/commands/package.ts
CHANGED
|
@@ -20,8 +20,7 @@ import {
|
|
|
20
20
|
import { getCliRuntime, verifyCliCompanion } from '../../src/cli-runtime'
|
|
21
21
|
import { produceConfiguredBundle } from '../../src/configured-bundle-producer'
|
|
22
22
|
import { activeDesktopHostApp } from '../../src/desktop-host-delivery'
|
|
23
|
-
import {
|
|
24
|
-
import { insertExpoSwiftFooter, readExpoSwiftFooter } from '../../src/expoSwiftContract'
|
|
23
|
+
import { readExpoSwiftFooter } from '../../src/expoSwiftContract'
|
|
25
24
|
import { readActiveRuntime } from '../../src/home-paths'
|
|
26
25
|
import {
|
|
27
26
|
captureStagedHostFiles,
|
|
@@ -32,8 +31,12 @@ import { readInstalledNativePackageVersionsAsync } from '../../src/installed-pac
|
|
|
32
31
|
import { isRecord } from '../../src/is-record'
|
|
33
32
|
import { detectBundleModeFromText } from '../../src/metro-production-bundle'
|
|
34
33
|
import { readNativeAppIdentityFromProject } from '../../src/native-app-identity-project'
|
|
34
|
+
import {
|
|
35
|
+
buildNativeBundles,
|
|
36
|
+
insertNativeBundleFooters,
|
|
37
|
+
nativeBundleAssets,
|
|
38
|
+
} from '../../src/native-bundles'
|
|
35
39
|
import { readExpoConfigAsync } from '../../src/native-firebase-config'
|
|
36
|
-
import { insertNitroFooter, insertTurboFooter } from '../../src/nitroContract'
|
|
37
40
|
import {
|
|
38
41
|
insertPackageVersionsFooter,
|
|
39
42
|
readPackageVersions,
|
|
@@ -52,6 +55,7 @@ import {
|
|
|
52
55
|
import { prepareNativeInput, resolveNativeInput } from '../native-input'
|
|
53
56
|
import { packagedAppLauncher } from '../packaged-app-launcher'
|
|
54
57
|
import { IS_STANDALONE } from '../standalone'
|
|
58
|
+
import { CliUsageError } from '../usage-error'
|
|
55
59
|
import {
|
|
56
60
|
buildShellUrl,
|
|
57
61
|
resolveAppProjectForBundleUrl,
|
|
@@ -76,7 +80,7 @@ async function projectIcon(
|
|
|
76
80
|
|
|
77
81
|
export async function runPackage(args: string[]): Promise<void> {
|
|
78
82
|
if (process.platform !== 'darwin')
|
|
79
|
-
throw new
|
|
83
|
+
throw new CliUsageError('peach package currently builds macOS apps')
|
|
80
84
|
const input = [...args]
|
|
81
85
|
const values = new Map<string, string>()
|
|
82
86
|
const settings: string[] = []
|
|
@@ -108,9 +112,10 @@ export async function runPackage(args: string[]): Promise<void> {
|
|
|
108
112
|
'--notarize',
|
|
109
113
|
].includes(flag)
|
|
110
114
|
)
|
|
111
|
-
throw new
|
|
115
|
+
throw new CliUsageError(`unknown peach package option: ${flag}`)
|
|
112
116
|
const value = input[++i]
|
|
113
|
-
if (!value || value.startsWith('--'))
|
|
117
|
+
if (!value || value.startsWith('--'))
|
|
118
|
+
throw new CliUsageError(`${flag} requires a value`)
|
|
114
119
|
if (flag === '--setting') settings.push(value)
|
|
115
120
|
else if (flag === '--launch-env-file') {
|
|
116
121
|
// KEY=PATH: the launching host reads PATH (~/ is the user's home) at each
|
|
@@ -122,13 +127,13 @@ export async function runPackage(args: string[]): Promise<void> {
|
|
|
122
127
|
!/^[A-Za-z_][A-Za-z0-9_]*$/.test(value.slice(0, equals)) ||
|
|
123
128
|
equals === value.length - 1
|
|
124
129
|
)
|
|
125
|
-
throw new
|
|
130
|
+
throw new CliUsageError(`--launch-env-file expects KEY=PATH, got ${value}`)
|
|
126
131
|
launchEnvironmentFiles[value.slice(0, equals)] = value.slice(equals + 1)
|
|
127
132
|
} else values.set(flag, value)
|
|
128
133
|
}
|
|
129
134
|
const target = positionals[0]
|
|
130
135
|
if (!target || positionals.length !== 1)
|
|
131
|
-
throw new
|
|
136
|
+
throw new CliUsageError(
|
|
132
137
|
'usage: peach package <target> --name <name> [--output <app|zip|dmg> --setting key=value --launch-env-file KEY=PATH --sign <identity> --notarize <profile>]',
|
|
133
138
|
)
|
|
134
139
|
const name = values.get('--name') ?? path.basename(target, path.extname(target))
|
|
@@ -140,18 +145,18 @@ export async function runPackage(args: string[]): Promise<void> {
|
|
|
140
145
|
/[/\0]/.test(name) ||
|
|
141
146
|
!/^[A-Za-z0-9]+(?:[.-][A-Za-z0-9-]+)+$/.test(identifier)
|
|
142
147
|
)
|
|
143
|
-
throw new
|
|
148
|
+
throw new CliUsageError('package name or bundle identifier is invalid')
|
|
144
149
|
const output = path.resolve(values.get('--output') ?? `${name}.app`)
|
|
145
150
|
const archive = path.extname(output)
|
|
146
151
|
if (!['.app', '.zip', '.dmg'].includes(archive) || fs.existsSync(output))
|
|
147
|
-
throw new
|
|
152
|
+
throw new CliUsageError('--output must name a new .app, .zip or .dmg')
|
|
148
153
|
// a Developer ID identity signs with the hardened runtime; notarization reads
|
|
149
154
|
// credentials saved by `xcrun notarytool store-credentials <profile>`
|
|
150
155
|
const identity = values.get('--sign')
|
|
151
156
|
const notaryProfile = values.get('--notarize')
|
|
152
157
|
if (identity && !identity.startsWith('Developer ID Application: '))
|
|
153
|
-
throw new
|
|
154
|
-
if (notaryProfile && !identity) throw new
|
|
158
|
+
throw new CliUsageError('--sign needs a Developer ID Application identity')
|
|
159
|
+
if (notaryProfile && !identity) throw new CliUsageError('--notarize needs --sign')
|
|
155
160
|
const defaults = packageSettingDefaults(settings)
|
|
156
161
|
const versionsFile = values.get('--package-versions')
|
|
157
162
|
const versions = versionsFile
|
|
@@ -182,7 +187,7 @@ export async function runPackage(args: string[]): Promise<void> {
|
|
|
182
187
|
const runtime = resolveActiveRuntimeRoot()
|
|
183
188
|
const runtimeVersion = readActiveRuntime()
|
|
184
189
|
if (!host || !runtime || !runtimeVersion)
|
|
185
|
-
throw new
|
|
190
|
+
throw new CliUsageError(
|
|
186
191
|
'install the Peach desktop app and an engine runtime before packaging',
|
|
187
192
|
)
|
|
188
193
|
verifyCliCompanion(runtime)
|
|
@@ -192,7 +197,9 @@ export async function runPackage(args: string[]): Promise<void> {
|
|
|
192
197
|
? process.execPath
|
|
193
198
|
: path.resolve(import.meta.dirname, '../../dist-bin/peach-darwin-arm64'))
|
|
194
199
|
if (!fs.existsSync(cli))
|
|
195
|
-
throw new
|
|
200
|
+
throw new CliUsageError(
|
|
201
|
+
'source packaging needs a built CLI binary; pass --cli <binary>',
|
|
202
|
+
)
|
|
196
203
|
// the app is assembled beside the output, so archives and the final move stay on its volume
|
|
197
204
|
const staging = `${output}.${randomUUID()}`
|
|
198
205
|
const temporary = path.join(staging, `${name}.app`)
|
|
@@ -242,47 +249,15 @@ export async function runPackage(args: string[]): Promise<void> {
|
|
|
242
249
|
source = detachBundleGlobalFooter(source, '__peachExpoKotlin').source
|
|
243
250
|
source = stripBundleMetadataFooter(source, 'nitro')
|
|
244
251
|
source = stripBundleMetadataFooter(source, 'turbo')
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
} else {
|
|
255
|
-
const native = await (
|
|
256
|
-
await import('../../src/expo-swift-bundle')
|
|
257
|
-
).buildExpoSwiftBundle(root)
|
|
258
|
-
if (native) {
|
|
259
|
-
for (const asset of native.assets)
|
|
260
|
-
route('/' + asset.path, asset.bytes, asset.contentType)
|
|
261
|
-
source = insertExpoSwiftFooter(source, native.metadata)
|
|
262
|
-
}
|
|
263
|
-
// a production bundle runs on a Release build, any other on Debug
|
|
264
|
-
const nitro = await (
|
|
265
|
-
await import('../../src/nitro-bundle')
|
|
266
|
-
).buildNitroBundle(
|
|
267
|
-
root,
|
|
268
|
-
(await detectBundleModeFromText(source)) === 'production'
|
|
269
|
-
? 'Release'
|
|
270
|
-
: 'Debug',
|
|
271
|
-
)
|
|
272
|
-
if (nitro) {
|
|
273
|
-
for (const asset of nitro.assets)
|
|
274
|
-
route('/' + asset.path, asset.bytes, asset.contentType)
|
|
275
|
-
source = insertNitroFooter(source, nitro.metadata)
|
|
276
|
-
}
|
|
277
|
-
const turbo = await (
|
|
278
|
-
await import('../../src/turbo-bundle')
|
|
279
|
-
).buildTurboBundle(root)
|
|
280
|
-
if (turbo) {
|
|
281
|
-
for (const asset of turbo.assets)
|
|
282
|
-
route('/' + asset.path, asset.bytes, asset.contentType)
|
|
283
|
-
source = insertTurboFooter(source, turbo.metadata)
|
|
284
|
-
}
|
|
285
|
-
}
|
|
252
|
+
// a production bundle runs on a Release build, any other on Debug
|
|
253
|
+
const natives = await buildNativeBundles(
|
|
254
|
+
root,
|
|
255
|
+
platform === 'android' ? 'android' : 'ios',
|
|
256
|
+
(await detectBundleModeFromText(source)) === 'production' ? 'Release' : 'Debug',
|
|
257
|
+
)
|
|
258
|
+
for (const asset of nativeBundleAssets(natives))
|
|
259
|
+
route('/' + asset.path, asset.bytes, asset.contentType)
|
|
260
|
+
source = insertNativeBundleFooters(source, natives, (file) => '/' + file).source
|
|
286
261
|
return produceConfiguredBundle(
|
|
287
262
|
source,
|
|
288
263
|
config,
|
|
@@ -307,7 +282,7 @@ export async function runPackage(args: string[]): Promise<void> {
|
|
|
307
282
|
? resolveAppProject(values.get('--project-root')!)
|
|
308
283
|
: project
|
|
309
284
|
if (values.has('--project-root') && !configuredProject)
|
|
310
|
-
throw new
|
|
285
|
+
throw new CliUsageError('--project-root must name an app project')
|
|
311
286
|
if (configuredProject)
|
|
312
287
|
configuredVersions = await readInstalledNativePackageVersionsAsync(
|
|
313
288
|
configuredProject.appDir,
|