peachsim 0.1.1716 → 0.1.1728
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 +21 -3
- package/cli/app-bundle-resources.ts +2 -1
- package/cli/app-fonts.ts +4 -4
- package/cli/app-splash.ts +4 -4
- package/cli/app-stubs.ts +17 -0
- package/cli/command-registry.ts +1 -0
- package/cli/commands/control.ts +82 -822
- package/cli/commands/daemon.ts +8 -0
- package/cli/commands/detox.ts +3 -0
- package/cli/commands/doctor.ts +19 -2
- package/cli/commands/inspect/actions.ts +74 -14
- package/cli/commands/inspect/core.ts +5 -1
- package/cli/commands/inspect/settling.ts +5 -2
- package/cli/commands/inspect/wait-ready.ts +6 -0
- package/cli/commands/inspect.ts +48 -45
- package/cli/commands/kotlin.ts +12 -2
- package/cli/commands/package.ts +750 -0
- package/cli/commands/serve.ts +6 -0
- package/cli/commands/shell-url.ts +834 -0
- package/cli/commands/swift.ts +42 -102
- package/cli/commands/test.ts +20 -0
- package/cli/commands/upload.ts +1 -1
- package/cli/device-option.ts +1 -1
- package/cli/main.ts +13 -1
- package/cli/native-input.ts +199 -0
- package/cli/outbound-endpoints.ts +26 -1
- package/cli/packaged-app-launcher.ts +95 -0
- package/cli/scene-video.ts +13 -6
- package/detox/index.ts +187 -23
- 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 +38000 -31658
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- 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 +184 -60
- package/dist-lib/dev-bundle-resolution.cjs +14 -13
- package/dist-lib/expo-swift-bundle.cjs +18199 -11834
- package/dist-lib/expo-swift-metadata.cjs +4 -1
- package/dist-lib/expo-swift-metadata.mjs +3 -1
- package/dist-lib/home-paths.cjs +21 -2
- package/dist-lib/host/bridge-host.cjs +26509 -23850
- package/dist-lib/host/fetch-proxy-handler.cjs +221 -222
- 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 +876 -389
- 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 +127 -16
- package/dist-lib/menu.cjs +7 -1
- package/dist-lib/menu.mjs +7 -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 +883 -404
- package/dist-lib/native-app-identity-project.cjs +694 -280
- package/dist-lib/native-app-identity-project.mjs +490 -83
- package/dist-lib/native-app-identity.cjs +13 -2
- package/dist-lib/native-app-identity.mjs +13 -2
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.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 +28 -23
- package/dist-lib/public-origins-lib.json +392 -224
- package/dist-lib/react-native-host-modules.cjs +32 -2
- package/dist-lib/react-native-host-modules.mjs +32 -2
- package/dist-lib/reap-browser.cjs +12 -4
- package/dist-lib/scripts/dev-server-scanner.cjs +15 -8
- package/dist-lib/sdk.cjs +17 -7
- package/dist-lib/sdk.mjs +16 -7
- package/dist-lib/skills.cjs +61838 -47851
- package/dist-lib/swift-compile.cjs +583 -360
- package/dist-lib/swift-compile.mjs +496 -275
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +105 -17
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +4453 -2231
- package/dist-lib/vite.cjs +230 -228
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +17 -8
- package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +7 -5
- package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -11
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +9 -0
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-commandContract.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +23 -1
- package/dist-types/packages/peach-engine/src/shell-events.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +5 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +9 -2
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +12 -25
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASFoundation.h +52 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +128 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSessionCallback.h +35 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/AuthenticationServices.h +3 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFHTTPMessage.h +724 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +4 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkDefs.h +27 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h +1301 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +21 -50
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +6 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +75 -9
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInterface.h +23 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +7 -9
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIOrientation.h +14 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIStringDrawing.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +14 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewAnimating.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h +16 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIWindow.h +2 -0
- package/sdk/ios/usr/include/ConditionalMacros.h +619 -0
- package/sdk/ios/usr/include/module.modulemap +1 -0
- package/sdk/ios/usr/include/objc/objc-sync.h +59 -0
- package/sdk/ios/usr/include/os.modulemap +5 -0
- package/sdk/ios/usr/include/sys/cdefs.h +5 -0
- package/sdk/ios/usr/include/sys/ioccom.h +99 -0
- package/sdk/ios/usr/include/sys/syslog.h +236 -0
- package/sdk/ios/usr/include/syslog.h +24 -0
- package/sdk/ios/wasm/include/fcntl.h +4 -2
- package/sdk/ios/wasm/include/stdio.h +24 -0
- package/sdk/ios/wasm/include/stdlib.h +32 -7
- package/sdk/ios/wasm/include/sys/file.h +7 -0
- package/sdk/ios/wasm/include/sys/ioctl.h +6 -0
- package/sdk/ios/wasm/include/sys/syscall.h +9 -0
- package/sdk/ios/wasm/include/sys/time.h +10 -0
- package/sdk/ios/wasm/include/unistd.h +12 -3
- package/sdk/native-hashes.json +1 -0
- package/skills/contrast/SKILL.md +2 -1
- package/skills/peach-test/SKILL.md +7 -3
- package/src/admitted-mac-build.ts +3 -0
- package/src/android-app-identity.ts +18 -0
- package/src/android-root-module.ts +9 -9
- package/src/appPackageContract.ts +81 -0
- package/src/bridge-contract.ts +50 -0
- package/src/bundle-channel.mjs +21 -4
- package/src/dev-bundle-resolution.ts +7 -27
- package/src/dom-source-reference.ts +15 -0
- package/src/expo-discovery-cache.ts +127 -23
- package/src/expo-manifest-body.ts +33 -0
- package/src/expo-native-workspace.ts +38 -13
- package/src/expo-swift-host.ts +264 -62
- package/src/expoSwiftContract.ts +3 -0
- package/src/generated/swift-c-predefines.json +1 -1
- package/src/home-paths.ts +35 -1
- package/src/host/app-package-handler.ts +47 -0
- package/src/host/bridge-host.ts +3 -0
- package/src/host/staged-host-files.ts +18 -0
- package/src/index.ts +3 -0
- package/src/kotlin-host.ts +21 -18
- package/src/kotlin-instance-source.ts +126 -0
- package/src/menu.ts +7 -0
- package/src/native-app-identity-project.ts +7 -2
- package/src/native-app-identity.ts +11 -0
- package/src/native-firebase-config.ts +24 -1
- package/src/nitro-adapter.lock.json +268 -268
- package/src/nitro-bundle.ts +8 -0
- package/src/nitro-compile.ts +35 -9
- package/src/nitro-dependencies.ts +21 -19
- package/src/nitro-source.ts +4 -0
- package/src/nitroContract.ts +7 -0
- package/src/react-native-bridge-modules.ts +68 -42
- package/src/react-native-host-modules.ts +31 -1
- package/src/reactNativeConfigurationContract.ts +14 -0
- package/src/reap-browser.ts +15 -3
- package/src/sdk.ts +5 -0
- package/src/settingsContract.ts +27 -1
- package/src/sim-client.ts +4 -1
- package/src/storageSnapshotContract.ts +3 -0
- package/src/swift-compile.ts +221 -41
- package/src/swift-coverage/provenance.ts +1 -0
- package/src/swift-coverage/xcode-asset-symbols.ts +922 -0
- package/src/swift-coverage/xcode-assets.ts +89 -131
- package/src/swift-coverage/xcode.ts +1 -1
- package/src/swift-cxx-reachable.ts +2 -1
- package/src/swift-distribution.lock.json +14 -13
- package/src/swift-host.ts +95 -22
- package/src/swift-icu.ts +1 -1
- package/src/swift-link-roots.ts +118 -0
- package/src/swift-objc-compile.ts +144 -22
- package/src/swift-objc-import.ts +6 -0
- package/src/swift-objc-standin.ts +2 -14
- package/src/swift-package-manifest.ts +14 -6
- package/src/swift-packages.ts +75 -11
- package/src/swift-pdf-raster.ts +1 -0
- package/src/swift-root-lock.ts +17 -1
- package/src/swift-source-pods.ts +2 -10
- package/src/swift-standin-emit.ts +592 -57
- package/src/swift-standins.ts +430 -49
- package/src/swift-submit.ts +3 -1
- package/src/swift-toolchain.ts +140 -17
- package/src/turbo-codegen-intake.ts +91 -0
- package/src/vite-plugin-one.ts +13 -9
- package/src/vite-plugin.ts +28 -15
- package/src/xcode-project.ts +223 -22
|
@@ -75,16 +75,17 @@ function readModuleNamespace(
|
|
|
75
75
|
return undefined
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
// null: the module declares no launcher. undefined: it declares one this reader cannot resolve.
|
|
79
|
+
function readModuleRootModuleName(moduleRoot: string): string | null | undefined {
|
|
79
80
|
const sourceSets = path.join(moduleRoot, 'src')
|
|
80
81
|
const manifestFile = path.join(sourceSets, 'main/AndroidManifest.xml')
|
|
81
|
-
if (!fs.existsSync(manifestFile)) return
|
|
82
|
+
if (!fs.existsSync(manifestFile)) return null
|
|
82
83
|
const document = parseXml(fs.readFileSync(manifestFile, 'utf8'), manifestFile)
|
|
83
84
|
const manifest = document.children[0]
|
|
84
85
|
const application = manifest?.children.find((child) => child.name === 'application')
|
|
85
|
-
if (manifest?.name !== 'manifest' || !application) return
|
|
86
|
+
if (manifest?.name !== 'manifest' || !application) return null
|
|
86
87
|
const launchers = launcherActivities(application)
|
|
87
|
-
if (launchers.length === 0) return
|
|
88
|
+
if (launchers.length === 0) return null
|
|
88
89
|
// a variant or flavor manifest that declares activities can change the
|
|
89
90
|
// launcher the merger selects; only a completed merger output can say how.
|
|
90
91
|
for (const set of fs.readdirSync(sourceSets, { withFileTypes: true })) {
|
|
@@ -128,7 +129,8 @@ function readModuleRootModuleName(moduleRoot: string): string | undefined {
|
|
|
128
129
|
)
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
// every application module is read; exactly one may carry a launcher
|
|
132
|
+
// every application module is read; exactly one may carry a launcher, and an
|
|
133
|
+
// unresolvable launcher counts as one so it cannot make another module unique.
|
|
132
134
|
export function readAndroidLauncherRootModuleName(
|
|
133
135
|
projectRoot: string,
|
|
134
136
|
): string | undefined {
|
|
@@ -137,9 +139,7 @@ export function readAndroidLauncherRootModuleName(
|
|
|
137
139
|
const names = fs
|
|
138
140
|
.readdirSync(androidRoot, { withFileTypes: true })
|
|
139
141
|
.filter((entry) => entry.isDirectory())
|
|
140
|
-
.
|
|
141
|
-
|
|
142
|
-
return name === undefined ? [] : [name]
|
|
143
|
-
})
|
|
142
|
+
.map((entry) => readModuleRootModuleName(path.join(androidRoot, entry.name)))
|
|
143
|
+
.filter((name) => name !== null)
|
|
144
144
|
return names.length === 1 ? names[0] : undefined
|
|
145
145
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isSettingKey,
|
|
3
|
+
isValidSettingValue,
|
|
4
|
+
settingsSchema,
|
|
5
|
+
type SettingsValues,
|
|
6
|
+
} from './settingsContract'
|
|
7
|
+
|
|
8
|
+
// replaced with the package's private daemon origin at launch, including in
|
|
9
|
+
// staged metadata. no port or absolute path from the build machine survives.
|
|
10
|
+
export const APP_PACKAGE_ORIGIN = 'http://127.0.0.1:65534'
|
|
11
|
+
// metadata can nest encoded URLs, but the numeric port survives every layer.
|
|
12
|
+
export const APP_PACKAGE_ADDRESS_PATTERN = String.raw`127\.0\.0\.1(?::|%(?:25)*3a)65534`
|
|
13
|
+
export const APP_PACKAGE_VERSION = 1
|
|
14
|
+
|
|
15
|
+
export interface AppPackageManifest {
|
|
16
|
+
schemaVersion: typeof APP_PACKAGE_VERSION
|
|
17
|
+
buildId: string
|
|
18
|
+
identifier: string
|
|
19
|
+
name: string
|
|
20
|
+
origin: string
|
|
21
|
+
hostExecutable: string
|
|
22
|
+
hostArguments: string[]
|
|
23
|
+
runtimeVersion: string
|
|
24
|
+
launchUrl: string
|
|
25
|
+
// seed a new app's config once; never override the user's later choices.
|
|
26
|
+
defaults: Partial<SettingsValues>
|
|
27
|
+
// staged file names whose text contains the build-time placeholder origin.
|
|
28
|
+
relocatableFiles: string[]
|
|
29
|
+
requiresServer: boolean
|
|
30
|
+
routes: Record<string, { file: string; contentType: string }>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function packageSettingDefaults(
|
|
34
|
+
assignments: readonly string[],
|
|
35
|
+
): Partial<SettingsValues> {
|
|
36
|
+
const defaults: Partial<SettingsValues> = {
|
|
37
|
+
...Object.fromEntries(
|
|
38
|
+
Object.entries(settingsSchema).map(([key, definition]) => [
|
|
39
|
+
key,
|
|
40
|
+
definition.default,
|
|
41
|
+
]),
|
|
42
|
+
),
|
|
43
|
+
// a packaged app is a desktop app: it keeps the computer pointer and
|
|
44
|
+
// shows only the app, without the device frame or simulator rail.
|
|
45
|
+
systemCursor: true,
|
|
46
|
+
showFrame: false,
|
|
47
|
+
showRail: false,
|
|
48
|
+
}
|
|
49
|
+
for (const assignment of assignments) {
|
|
50
|
+
const equals = assignment.indexOf('=')
|
|
51
|
+
const key = assignment.slice(0, equals)
|
|
52
|
+
if (equals < 1 || !isSettingKey(key))
|
|
53
|
+
throw new Error(`unknown package setting: ${assignment}`)
|
|
54
|
+
const raw = assignment.slice(equals + 1)
|
|
55
|
+
const definition = settingsSchema[key]
|
|
56
|
+
const value: unknown =
|
|
57
|
+
definition.type === 'boolean'
|
|
58
|
+
? raw === 'true'
|
|
59
|
+
? true
|
|
60
|
+
: raw === 'false'
|
|
61
|
+
? false
|
|
62
|
+
: raw
|
|
63
|
+
: definition.type === 'number'
|
|
64
|
+
? raw.trim() === ''
|
|
65
|
+
? NaN
|
|
66
|
+
: Number(raw)
|
|
67
|
+
: definition.type === 'string-array'
|
|
68
|
+
? JSON.parse(raw)
|
|
69
|
+
: raw
|
|
70
|
+
if (
|
|
71
|
+
(typeof value === 'number' && !Number.isFinite(value)) ||
|
|
72
|
+
!isValidSettingValue(key, value)
|
|
73
|
+
)
|
|
74
|
+
throw new Error(
|
|
75
|
+
`invalid package setting ${assignment}${definition.options ? `; expected ${definition.options.join(', ')}` : ''}`,
|
|
76
|
+
)
|
|
77
|
+
Object.assign(defaults, { [key]: value })
|
|
78
|
+
}
|
|
79
|
+
// overrides cross the owning registry's validation; defaults come from it.
|
|
80
|
+
return defaults
|
|
81
|
+
}
|
package/src/bridge-contract.ts
CHANGED
|
@@ -13,7 +13,10 @@ import type {
|
|
|
13
13
|
SootSimAgentActionDetail,
|
|
14
14
|
SootSimCaptureFilter,
|
|
15
15
|
SootSimExternalAppLifecycleOptions,
|
|
16
|
+
SootSimReplayTarget,
|
|
16
17
|
SootSimStorageResetStrategy,
|
|
18
|
+
SootSimTapRefusal,
|
|
19
|
+
SootSimTapResult,
|
|
17
20
|
TextInputEditCommand,
|
|
18
21
|
} from '@peach/globals'
|
|
19
22
|
|
|
@@ -127,6 +130,53 @@ export interface WsCommand {
|
|
|
127
130
|
storageSnapshotOptions?: { includeCredentials?: boolean }
|
|
128
131
|
}
|
|
129
132
|
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
// tap — result
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
|
|
137
|
+
// every reason a tap reply states for not landing. the headless cloud runtime
|
|
138
|
+
// reports its own selector and hit-test misfires alongside the two targeted
|
|
139
|
+
// refusals the browser engine's interact bridge uses; the last two are the
|
|
140
|
+
// sdk's own retry observations, decided before a press is dispatched.
|
|
141
|
+
export type SimTapResultReason =
|
|
142
|
+
| SootSimTapRefusal['reason']
|
|
143
|
+
| 'selector_no_raw_node'
|
|
144
|
+
| 'selector_node_without_layout'
|
|
145
|
+
| 'selector_node_not_visible'
|
|
146
|
+
| 'selector_no_tap_target'
|
|
147
|
+
| 'hit_test_miss'
|
|
148
|
+
| 'no_responder'
|
|
149
|
+
| 'offscreen'
|
|
150
|
+
| 'screen-not-laid-out'
|
|
151
|
+
| 'target-moved'
|
|
152
|
+
|
|
153
|
+
// bounded evidence the headless runtime attaches to a tap it did not handle.
|
|
154
|
+
export interface SimTapDiagnostics {
|
|
155
|
+
nodeId: number | null
|
|
156
|
+
frame: { x: number; y: number; width: number; height: number } | null
|
|
157
|
+
inspectable: boolean | null
|
|
158
|
+
point: { x: number; y: number } | null
|
|
159
|
+
screen: { width: number; height: number }
|
|
160
|
+
commitRevision: number
|
|
161
|
+
layoutRevision: number
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// one tap reply as the sdk observes it. the browser engine's interact bridge
|
|
165
|
+
// fills SootSimTapResult's hit verification; a headless cloud runtime answers
|
|
166
|
+
// `handled` and, when the press did not land, a reason with diagnostics; the
|
|
167
|
+
// sdk's retry loop adds refusals it decides before dispatch. every reply states
|
|
168
|
+
// its outcome in one of those two fields, so a reply carrying neither is not a
|
|
169
|
+
// tap the sdk can read as landed.
|
|
170
|
+
export type SimTapResult = Partial<Omit<SootSimTapResult, 'reason' | 'hit'>> & {
|
|
171
|
+
ok?: boolean
|
|
172
|
+
reason?: SimTapResultReason
|
|
173
|
+
diagnostics?: SimTapDiagnostics
|
|
174
|
+
// the sdk's pre-dispatch refusals carry the point and screen they checked.
|
|
175
|
+
x?: number
|
|
176
|
+
y?: number
|
|
177
|
+
screen?: { width: number; height: number }
|
|
178
|
+
} & ({ hit: boolean; handled?: boolean } | { handled: boolean; hit?: boolean })
|
|
179
|
+
|
|
130
180
|
// ---------------------------------------------------------------------------
|
|
131
181
|
// perform — batched input
|
|
132
182
|
// ---------------------------------------------------------------------------
|
package/src/bundle-channel.mjs
CHANGED
|
@@ -4,7 +4,9 @@ import { Script } from 'node:vm'
|
|
|
4
4
|
import { isLoopbackHost } from './backend-origin'
|
|
5
5
|
import { insertExpoKotlinFooter } from './expoKotlinContract'
|
|
6
6
|
import { insertExpoSwiftFooter } from './expoSwiftContract'
|
|
7
|
+
import { readInstalledNativePackageVersionsAsync } from './installed-package-versions'
|
|
7
8
|
import { insertNitroFooter } from './nitroContract'
|
|
9
|
+
import { insertPackageVersionsFooter } from './packageVersionsContract'
|
|
8
10
|
import { terminateProcessGroup } from './process-group'
|
|
9
11
|
|
|
10
12
|
const digest = (bytes) => createHash('sha256').update(bytes).digest('hex')
|
|
@@ -295,6 +297,10 @@ export async function snapshotDevServerBundles(
|
|
|
295
297
|
) {
|
|
296
298
|
const { readFileSync } = await import('node:fs')
|
|
297
299
|
const { basename } = await import('node:path')
|
|
300
|
+
const { resolveRNXAppConfig } = await import('../cli/app-config')
|
|
301
|
+
const { produceConfiguredBundle } = await import('./configured-bundle-producer')
|
|
302
|
+
const { config } = await resolveRNXAppConfig(projectRoot)
|
|
303
|
+
const versions = await readInstalledNativePackageVersionsAsync(projectRoot)
|
|
298
304
|
const snapshots = []
|
|
299
305
|
for (const platform of platforms) {
|
|
300
306
|
const url = `${origin}/index.bundle?platform=${platform}&dev=true&minify=false`
|
|
@@ -337,7 +343,13 @@ export async function snapshotDevServerBundles(
|
|
|
337
343
|
}
|
|
338
344
|
snapshots.push({
|
|
339
345
|
platform,
|
|
340
|
-
bundle
|
|
346
|
+
bundle: Buffer.from(
|
|
347
|
+
await produceConfiguredBundle(
|
|
348
|
+
insertPackageVersionsFooter(bundle.toString('utf8'), versions),
|
|
349
|
+
config,
|
|
350
|
+
new Set(Object.keys(versions)),
|
|
351
|
+
),
|
|
352
|
+
),
|
|
341
353
|
assets: [...assets].map(([path, bytes]) => ({ path, bytes })),
|
|
342
354
|
...(platform === 'ios'
|
|
343
355
|
? {
|
|
@@ -357,7 +369,11 @@ export async function snapshotDevServerBundles(
|
|
|
357
369
|
}
|
|
358
370
|
|
|
359
371
|
// a One app's bundles, from a private dev server
|
|
360
|
-
export async function snapshotOneDevBundle(
|
|
372
|
+
export async function snapshotOneDevBundle(
|
|
373
|
+
projectRoot,
|
|
374
|
+
env = {},
|
|
375
|
+
{ runtimeExecutable = process.execPath, platforms = ['ios', 'android'] } = {},
|
|
376
|
+
) {
|
|
361
377
|
const { spawn } = await import('node:child_process')
|
|
362
378
|
const { readFileSync } = await import('node:fs')
|
|
363
379
|
const { createServer } = await import('node:net')
|
|
@@ -378,14 +394,15 @@ export async function snapshotOneDevBundle(projectRoot, env = {}) {
|
|
|
378
394
|
})
|
|
379
395
|
.on('error', reject)
|
|
380
396
|
})
|
|
381
|
-
const child = spawn(
|
|
397
|
+
const child = spawn(runtimeExecutable, [oneBin, 'dev', '--port', String(port)], {
|
|
382
398
|
cwd: projectRoot,
|
|
383
|
-
env: { ...process.env, ...env },
|
|
399
|
+
env: { ...process.env, ...env, CI: '1', PEACH_NO_OPEN: '1' },
|
|
384
400
|
stdio: ['ignore', 'inherit', 'inherit'],
|
|
385
401
|
detached: true,
|
|
386
402
|
})
|
|
387
403
|
try {
|
|
388
404
|
return await snapshotDevServerBundles(`http://127.0.0.1:${port}`, projectRoot, {
|
|
405
|
+
platforms,
|
|
389
406
|
assertRunning: () => {
|
|
390
407
|
if (child.exitCode !== null)
|
|
391
408
|
throw new Error(`one dev exited with ${child.exitCode}`)
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isLoopbackHost,
|
|
4
4
|
LOOPBACK_PROBE_HOSTNAMES,
|
|
5
5
|
} from './backend-origin'
|
|
6
|
-
import { parseExpoManifestBody } from './expo-manifest-body'
|
|
6
|
+
import { parseExpoManifestBody, readExpoManifestFields } from './expo-manifest-body'
|
|
7
7
|
import {
|
|
8
8
|
alignLoopbackBundleUrlWithProbe,
|
|
9
9
|
METRO_BUNDLE_PATH,
|
|
@@ -308,34 +308,17 @@ async function probeExpoManifest(
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
if (!manifest || typeof manifest !== 'object') return { state: 'no-manifest' }
|
|
311
|
-
const
|
|
312
|
-
const expoClient =
|
|
313
|
-
extra && typeof extra === 'object' && 'expoClient' in extra ? extra.expoClient : extra
|
|
314
|
-
const client = expoClient && typeof expoClient === 'object' ? expoClient : {}
|
|
315
|
-
const launchAsset = 'launchAsset' in manifest ? manifest.launchAsset : undefined
|
|
316
|
-
const rawLaunchUrl =
|
|
317
|
-
launchAsset &&
|
|
318
|
-
typeof launchAsset === 'object' &&
|
|
319
|
-
'url' in launchAsset &&
|
|
320
|
-
typeof launchAsset.url === 'string'
|
|
321
|
-
? launchAsset.url
|
|
322
|
-
: undefined
|
|
311
|
+
const { launchUrl: rawLaunchUrl, client } = readExpoManifestFields(manifest)
|
|
323
312
|
const launchUrl = rawLaunchUrl
|
|
324
313
|
? alignLoopbackBundleUrlWithProbe(rawLaunchUrl, normalizedBaseUrl)
|
|
325
314
|
: undefined
|
|
326
|
-
const name =
|
|
327
|
-
'name' in client && typeof client.name === 'string' ? client.name : undefined
|
|
315
|
+
const name = typeof client.name === 'string' ? client.name : undefined
|
|
328
316
|
if (!launchUrl && !name) return { state: 'no-manifest' }
|
|
329
317
|
|
|
330
|
-
const internal =
|
|
331
|
-
'_internal' in client && client._internal && typeof client._internal === 'object'
|
|
332
|
-
? client._internal
|
|
333
|
-
: {}
|
|
334
318
|
const manifestProjectRoot =
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
? internal.projectRoot
|
|
319
|
+
typeof client._internal?.projectRoot === 'string' &&
|
|
320
|
+
client._internal.projectRoot.length > 0
|
|
321
|
+
? client._internal.projectRoot
|
|
339
322
|
: null
|
|
340
323
|
|
|
341
324
|
return {
|
|
@@ -346,10 +329,7 @@ async function probeExpoManifest(
|
|
|
346
329
|
launchUrl || `${normalizedBaseUrl}${METRO_BUNDLE_PATH}`,
|
|
347
330
|
),
|
|
348
331
|
port,
|
|
349
|
-
framework: inferManifestFramework(
|
|
350
|
-
launchUrl,
|
|
351
|
-
'sdkVersion' in client ? client.sdkVersion : undefined,
|
|
352
|
-
),
|
|
332
|
+
framework: inferManifestFramework(launchUrl, client.sdkVersion),
|
|
353
333
|
projectName: name,
|
|
354
334
|
},
|
|
355
335
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
import { basename, dirname, join, relative, sep } from 'node:path'
|
|
3
|
+
|
|
4
|
+
export const DOM_SOURCE_ROOT = '/__peach_dom__'
|
|
5
|
+
|
|
6
|
+
// babel's filename is also expo's executable DOM identity. keep the basename
|
|
7
|
+
// for its route checks, but identify its directory without a builder path.
|
|
8
|
+
export function domSourceFilename(projectRoot: string, sourcePath: string): string {
|
|
9
|
+
const directory = relative(projectRoot, dirname(sourcePath)).split(sep).join('/')
|
|
10
|
+
return join(
|
|
11
|
+
DOM_SOURCE_ROOT,
|
|
12
|
+
createHash('sha256').update(directory).digest('hex'),
|
|
13
|
+
basename(sourcePath),
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
// isolated homes instead of redoing the prepare and the workspace read.
|
|
5
5
|
// entries address content only; a store that cannot prove its paths refuses
|
|
6
6
|
// rather than serve bytes another home cannot trust.
|
|
7
|
+
// every unit carries the same headers, so each distinct body is stored once
|
|
8
|
+
// under its digest and units hold references; without that a large discovery
|
|
9
|
+
// exceeds the longest string the runtime can build and no repeat ever hits.
|
|
7
10
|
import { createHash, randomUUID } from 'node:crypto'
|
|
8
11
|
import fs from 'node:fs'
|
|
9
12
|
import { homedir } from 'node:os'
|
|
@@ -14,7 +17,7 @@ import { hashExpoWorkspace } from './expo-native-workspace'
|
|
|
14
17
|
import { isRecord } from './is-record'
|
|
15
18
|
import type { ExpoSwiftSourceUnit } from './expoSwiftContract'
|
|
16
19
|
|
|
17
|
-
const FORMAT = 'expo-discovery-
|
|
20
|
+
const FORMAT = 'expo-discovery-v2'
|
|
18
21
|
|
|
19
22
|
// pipeline files whose bytes change discovery output. resolved beside this
|
|
20
23
|
// module in source (.ts) and in a built cli (.js); a missing file pins as
|
|
@@ -64,12 +67,14 @@ export function expoDiscoveryKey(options: {
|
|
|
64
67
|
appRoot: string
|
|
65
68
|
searchText: string
|
|
66
69
|
resolveText: string
|
|
70
|
+
configuration?: unknown
|
|
67
71
|
signal?: AbortSignal
|
|
68
72
|
}): { key: string; root: string } {
|
|
69
73
|
const { root, hash } = hashExpoWorkspace(options.appRoot, options.signal)
|
|
70
74
|
const key = createHash('sha256')
|
|
71
75
|
.update(`${peachPin()}\0${hash}\0`)
|
|
72
76
|
.update(`${stable(JSON.parse(options.searchText))}\0`)
|
|
77
|
+
.update(`${stable(options.configuration)}\0`)
|
|
73
78
|
.update(stable(JSON.parse(options.resolveText)))
|
|
74
79
|
.digest('hex')
|
|
75
80
|
return { key, root }
|
|
@@ -103,6 +108,31 @@ function isExpoSwiftSourceUnit(value: unknown): value is ExpoSwiftSourceUnit {
|
|
|
103
108
|
)
|
|
104
109
|
}
|
|
105
110
|
|
|
111
|
+
// a stored unit holds blob digests where a live unit holds bodies.
|
|
112
|
+
type StoredExpoSwiftSourceUnit = Omit<ExpoSwiftSourceUnit, 'files' | 'nativeFiles'> & {
|
|
113
|
+
files: Record<string, string>
|
|
114
|
+
nativeFiles?: Record<string, string>
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const digestRecord = (value: unknown): value is Record<string, string> =>
|
|
118
|
+
stringRecord(value) && Object.values(value).every((item) => /^[0-9a-f]{64}$/.test(item))
|
|
119
|
+
|
|
120
|
+
function isStoredUnit(value: unknown): value is StoredExpoSwiftSourceUnit {
|
|
121
|
+
return (
|
|
122
|
+
isRecord(value) &&
|
|
123
|
+
typeof value.namespace === 'string' &&
|
|
124
|
+
typeof value.moduleId === 'string' &&
|
|
125
|
+
strings(value.classes) &&
|
|
126
|
+
strings(value.bridgeModules) &&
|
|
127
|
+
digestRecord(value.files) &&
|
|
128
|
+
strings(value.frameworks) &&
|
|
129
|
+
(value.nativeTargets === undefined ||
|
|
130
|
+
(Array.isArray(value.nativeTargets) && value.nativeTargets.every(isRecord))) &&
|
|
131
|
+
(value.nativeFiles === undefined || digestRecord(value.nativeFiles)) &&
|
|
132
|
+
(value.swiftLanguageMode === undefined || typeof value.swiftLanguageMode === 'number')
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
106
136
|
// a hit returns cached units (or a cached empty); anything unreadable or
|
|
107
137
|
// misshapen misses, never throws: the cache must not break discovery.
|
|
108
138
|
export function readExpoDiscovery(key: string): ExpoSwiftSourceUnit[] | null | undefined {
|
|
@@ -115,9 +145,38 @@ export function readExpoDiscovery(key: string): ExpoSwiftSourceUnit[] | null | u
|
|
|
115
145
|
if (!isRecord(parsed) || parsed.format !== FORMAT || parsed.key !== key)
|
|
116
146
|
return undefined
|
|
117
147
|
if (parsed.units === null) return null
|
|
118
|
-
if (
|
|
148
|
+
if (
|
|
149
|
+
!Array.isArray(parsed.units) ||
|
|
150
|
+
!parsed.units.every(isStoredUnit) ||
|
|
151
|
+
!stringRecord(parsed.blobs)
|
|
152
|
+
)
|
|
119
153
|
return undefined
|
|
120
|
-
|
|
154
|
+
const blobs = parsed.blobs
|
|
155
|
+
const resolve = (refs: Record<string, string>): Record<string, string> | undefined => {
|
|
156
|
+
const bodies: Record<string, string> = {}
|
|
157
|
+
for (const [name, digest] of Object.entries(refs)) {
|
|
158
|
+
const body = blobs[digest]
|
|
159
|
+
if (body === undefined) return undefined
|
|
160
|
+
bodies[name] = body
|
|
161
|
+
}
|
|
162
|
+
return bodies
|
|
163
|
+
}
|
|
164
|
+
const units: ExpoSwiftSourceUnit[] = []
|
|
165
|
+
for (const stored of parsed.units) {
|
|
166
|
+
const files = resolve(stored.files)
|
|
167
|
+
if (files === undefined) return undefined
|
|
168
|
+
const nativeFiles =
|
|
169
|
+
stored.nativeFiles === undefined ? undefined : resolve(stored.nativeFiles)
|
|
170
|
+
if (stored.nativeFiles !== undefined && nativeFiles === undefined) return undefined
|
|
171
|
+
const unit: ExpoSwiftSourceUnit = {
|
|
172
|
+
...stored,
|
|
173
|
+
files,
|
|
174
|
+
...(nativeFiles === undefined ? {} : { nativeFiles }),
|
|
175
|
+
}
|
|
176
|
+
if (!isExpoSwiftSourceUnit(unit)) return undefined
|
|
177
|
+
units.push(unit)
|
|
178
|
+
}
|
|
179
|
+
return units
|
|
121
180
|
}
|
|
122
181
|
|
|
123
182
|
const sourceLocationLine = /^#sourceLocation\(file: "(.*)", line: 1\)$/
|
|
@@ -230,41 +289,86 @@ function rewritePreparedPaths(options: {
|
|
|
230
289
|
}
|
|
231
290
|
rewritten.push({ ...unit, files, frameworks })
|
|
232
291
|
}
|
|
233
|
-
if (JSON.stringify(rewritten).includes(preparedRoot))
|
|
234
|
-
return { refuse: 'a prepared path survives the rewrite' }
|
|
235
292
|
return { units: rewritten }
|
|
236
293
|
}
|
|
237
294
|
|
|
238
295
|
// stores discovery units (or a cached empty) under their key, addressed by
|
|
239
|
-
// content and written atomically. returns
|
|
240
|
-
//
|
|
296
|
+
// content and written atomically. returns the units exactly as a later read
|
|
297
|
+
// returns them, so a cold discovery keys the same build as a warm one; else the
|
|
298
|
+
// reason the entry was refused. cache failures never throw.
|
|
241
299
|
export function writeExpoDiscovery(options: {
|
|
242
300
|
key: string
|
|
243
301
|
units: ExpoSwiftSourceUnit[] | null
|
|
244
302
|
sourceRoot: string
|
|
245
303
|
preparedRoot: string
|
|
246
304
|
signal?: AbortSignal
|
|
247
|
-
}):
|
|
305
|
+
}): ExpoSwiftSourceUnit[] | null | string {
|
|
248
306
|
try {
|
|
249
|
-
let units: ExpoSwiftSourceUnit[] | null
|
|
250
|
-
if (options.units === null) {
|
|
251
|
-
units = null
|
|
252
|
-
} else {
|
|
253
|
-
const rewritten = rewritePreparedPaths({
|
|
254
|
-
units: options.units,
|
|
255
|
-
sourceRoot: options.sourceRoot,
|
|
256
|
-
preparedRoot: options.preparedRoot,
|
|
257
|
-
signal: options.signal,
|
|
258
|
-
})
|
|
259
|
-
if ('refuse' in rewritten) return rewritten.refuse
|
|
260
|
-
units = rewritten.units
|
|
261
|
-
}
|
|
262
307
|
const dir = sharedDir()
|
|
263
308
|
fs.mkdirSync(dir, { recursive: true })
|
|
264
309
|
const tmp = path.join(dir, `.${options.key}.${process.pid}.${randomUUID()}.tmp`)
|
|
265
|
-
|
|
310
|
+
if (options.units === null) {
|
|
311
|
+
fs.writeFileSync(
|
|
312
|
+
tmp,
|
|
313
|
+
JSON.stringify({ format: FORMAT, key: options.key, units: null, blobs: {} }),
|
|
314
|
+
)
|
|
315
|
+
fs.renameSync(tmp, path.join(dir, `${options.key}.json`))
|
|
316
|
+
return null
|
|
317
|
+
}
|
|
318
|
+
const rewritten = rewritePreparedPaths({
|
|
319
|
+
units: options.units,
|
|
320
|
+
sourceRoot: options.sourceRoot,
|
|
321
|
+
preparedRoot: options.preparedRoot,
|
|
322
|
+
signal: options.signal,
|
|
323
|
+
})
|
|
324
|
+
if ('refuse' in rewritten) return rewritten.refuse
|
|
325
|
+
// one blob per distinct body; units keep digests. repeated bodies hash
|
|
326
|
+
// once: string hashes memoize, so a shared body is a cheap map hit.
|
|
327
|
+
const blobs = new Map<string, string>()
|
|
328
|
+
const seen = new Map<string, string>()
|
|
329
|
+
const digestFor = (body: string): string => {
|
|
330
|
+
const known = seen.get(body)
|
|
331
|
+
if (known !== undefined) return known
|
|
332
|
+
const digest = createHash('sha256').update(body).digest('hex')
|
|
333
|
+
seen.set(body, digest)
|
|
334
|
+
blobs.set(digest, body)
|
|
335
|
+
return digest
|
|
336
|
+
}
|
|
337
|
+
const reference = (bodies: Record<string, string>) =>
|
|
338
|
+
Object.fromEntries(
|
|
339
|
+
Object.entries(bodies).map(([name, body]) => [name, digestFor(body)]),
|
|
340
|
+
)
|
|
341
|
+
const stored: StoredExpoSwiftSourceUnit[] = rewritten.units.map((unit) => {
|
|
342
|
+
options.signal?.throwIfAborted()
|
|
343
|
+
return {
|
|
344
|
+
...unit,
|
|
345
|
+
files: reference(unit.files),
|
|
346
|
+
...(unit.nativeFiles === undefined
|
|
347
|
+
? {}
|
|
348
|
+
: { nativeFiles: reference(unit.nativeFiles) }),
|
|
349
|
+
}
|
|
350
|
+
})
|
|
351
|
+
// the surviving-path scan stays on bounded strings: the small reference
|
|
352
|
+
// maps, then each body alone. stringifying whole units here is what used
|
|
353
|
+
// to exceed the longest buildable string on large discoveries.
|
|
354
|
+
if (JSON.stringify(stored).includes(options.preparedRoot))
|
|
355
|
+
return 'a prepared path survives the rewrite'
|
|
356
|
+
for (const body of blobs.values()) {
|
|
357
|
+
options.signal?.throwIfAborted()
|
|
358
|
+
if (body.includes(options.preparedRoot))
|
|
359
|
+
return 'a prepared path survives the rewrite'
|
|
360
|
+
}
|
|
361
|
+
fs.writeFileSync(
|
|
362
|
+
tmp,
|
|
363
|
+
JSON.stringify({
|
|
364
|
+
format: FORMAT,
|
|
365
|
+
key: options.key,
|
|
366
|
+
units: stored,
|
|
367
|
+
blobs: Object.fromEntries(blobs),
|
|
368
|
+
}),
|
|
369
|
+
)
|
|
266
370
|
fs.renameSync(tmp, path.join(dir, `${options.key}.json`))
|
|
267
|
-
return
|
|
371
|
+
return rewritten.units
|
|
268
372
|
} catch (error) {
|
|
269
373
|
if (options.signal?.aborted) throw error
|
|
270
374
|
return error instanceof Error ? error.message : String(error)
|
|
@@ -11,3 +11,36 @@ export function parseExpoManifestBody(body: string) {
|
|
|
11
11
|
}
|
|
12
12
|
throw new Error('Expo manifest response has no manifest part')
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
// the app config fields dev-server discovery reads from a manifest.
|
|
16
|
+
export interface ExpoManifestClient {
|
|
17
|
+
name?: string
|
|
18
|
+
primaryColor?: unknown
|
|
19
|
+
sdkVersion?: unknown
|
|
20
|
+
icon?: unknown
|
|
21
|
+
iconUrl?: unknown
|
|
22
|
+
ios?: { bundleIdentifier?: string; icon?: unknown; iconUrl?: unknown }
|
|
23
|
+
_internal?: { projectRoot?: unknown }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ExpoManifestFields {
|
|
27
|
+
// the url the dev server advertises for its entry bundle.
|
|
28
|
+
launchUrl: string | undefined
|
|
29
|
+
client: ExpoManifestClient
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// two manifest shapes name the entry bundle. SDK 48+ wraps the app config in
|
|
33
|
+
// `extra.expoClient` and names the bundle at `launchAsset.url`. the legacy
|
|
34
|
+
// shape (SDK 47 and older) is the app config itself, with `bundleUrl` at the
|
|
35
|
+
// root; its `extra` is the app's own user config.
|
|
36
|
+
export function readExpoManifestFields(
|
|
37
|
+
manifest: ReturnType<typeof parseExpoManifestBody>,
|
|
38
|
+
): ExpoManifestFields {
|
|
39
|
+
if (typeof manifest?.bundleUrl === 'string')
|
|
40
|
+
return { launchUrl: manifest.bundleUrl, client: manifest }
|
|
41
|
+
const launchUrl = manifest?.launchAsset?.url
|
|
42
|
+
return {
|
|
43
|
+
launchUrl: typeof launchUrl === 'string' ? launchUrl : undefined,
|
|
44
|
+
client: manifest?.extra?.expoClient || manifest?.extra || {},
|
|
45
|
+
}
|
|
46
|
+
}
|