peachsim 0.1.1716 → 0.1.1738
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 +83 -822
- package/cli/commands/coverage-swift.ts +112 -4
- 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 +760 -0
- package/cli/commands/serve.ts +6 -0
- package/cli/commands/shell-url.ts +838 -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 +36 -12
- package/detox/index.ts +196 -24
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +5 -2
- package/dist-lib/auth/shared-session.cjs +5 -2
- 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 +39889 -31873
- 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 +195 -63
- package/dist-lib/dev-bundle-resolution.cjs +14 -13
- package/dist-lib/expo-swift-bundle.cjs +18507 -11835
- package/dist-lib/expo-swift-metadata.cjs +4 -1
- package/dist-lib/expo-swift-metadata.mjs +3 -1
- package/dist-lib/home-paths.cjs +27 -3
- package/dist-lib/host/bridge-host.cjs +28373 -24090
- package/dist-lib/host/fetch-proxy-handler.cjs +235 -225
- 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 +915 -399
- 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 +335 -47
- package/dist-lib/menu.cjs +13 -1
- package/dist-lib/menu.mjs +13 -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 +918 -411
- package/dist-lib/native-app-identity-project.cjs +703 -283
- package/dist-lib/native-app-identity-project.mjs +500 -87
- 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 +5 -2
- 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 +418 -224
- package/dist-lib/react-native-host-modules.cjs +35 -2
- package/dist-lib/react-native-host-modules.mjs +35 -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 +44825 -29141
- package/dist-lib/swift-compile.cjs +616 -400
- package/dist-lib/swift-compile.mjs +528 -315
- 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 +4660 -2252
- package/dist-lib/vite.cjs +248 -234
- 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/font-config.d.ts +7 -4
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +9 -6
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +0 -5
- package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +11 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +5 -12
- package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/engine/text-paragraph.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +2 -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/protocol.d.ts +7 -2
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -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 +36 -2
- 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/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/kotlin/README.md +3 -0
- package/kotlin/sdk.tar.gz +0 -0
- 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/Accounts.framework/Headers/ACAccount.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +35 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +53 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACError.h +37 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/Accounts.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/AccountsDefines.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Modules/module.modulemap +5 -0
- 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 +3 -1
- 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.apinotes +58 -3
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +711 -46
- 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/signpost.h +414 -0
- package/sdk/ios/usr/include/os.modulemap +10 -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/errno.h +4 -20
- package/sdk/ios/wasm/include/fcntl.h +4 -2
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/setjmp.h +57 -0
- 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/resource.h +2 -2
- 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 +4 -3
- package/skills/contrast/SKILL.md +2 -1
- package/skills/peach-debug/SKILL.md +0 -1
- package/skills/peach-perf/SKILL.md +0 -1
- package/skills/peach-setup/SKILL.md +0 -1
- package/skills/peach-test/SKILL.md +7 -4
- package/skills/peach-visual/SKILL.md +0 -1
- package/src/admitted-mac-build.ts +3 -0
- package/src/android-app-identity.ts +18 -0
- package/src/android-autolinking.ts +1 -0
- package/src/android-bridge-packages.ts +279 -0
- package/src/android-root-module.ts +9 -9
- package/src/appPackageContract.ts +83 -0
- package/src/bridge-contract.ts +50 -0
- package/src/bundle-channel.mjs +41 -6
- package/src/cli-runtime.ts +9 -5
- package/src/dev-bundle-resolution.ts +7 -27
- package/src/dom-source-reference.ts +15 -0
- package/src/expo-discovery-cache.ts +134 -26
- package/src/expo-kotlin-host.ts +97 -26
- package/src/expo-manifest-body.ts +33 -0
- package/src/expo-native-workspace.ts +158 -38
- package/src/expo-swift-host.ts +350 -75
- package/src/expo-swift-ready.ts +5 -1
- package/src/expoKotlinContract.ts +12 -2
- package/src/expoSwiftContract.ts +10 -0
- package/src/generated/swift-c-predefines.json +1 -1
- package/src/home-paths.ts +41 -2
- package/src/host/app-package-handler.ts +47 -0
- package/src/host/bridge-host.ts +8 -0
- package/src/host/fetch-proxy-handler.ts +10 -0
- package/src/host/staged-host-files.ts +18 -0
- package/src/index.ts +3 -0
- package/src/kotlin-host.ts +225 -48
- package/src/kotlin-instance-source.ts +126 -0
- package/src/kotlinSdkContract.ts +2 -1
- package/src/menu.ts +14 -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/native-prebuilt.ts +154 -0
- package/src/nitro-adapter.lock.json +270 -270
- package/src/nitro-adapter.ts +56 -50
- package/src/nitro-bundle.ts +92 -74
- package/src/nitro-compile.ts +45 -14
- package/src/nitro-dependencies.ts +63 -46
- package/src/nitro-source.ts +64 -26
- package/src/nitroAdapterContract.ts +146 -98
- package/src/nitroContract.ts +71 -21
- package/src/react-native-bridge-modules.ts +70 -42
- package/src/react-native-host-modules.ts +34 -1
- package/src/reactNativeConfigurationContract.ts +14 -0
- package/src/reap-browser.ts +15 -3
- package/src/sdk.ts +5 -0
- package/src/settingsContract.ts +38 -1
- package/src/sim-client.ts +4 -1
- package/src/storageSnapshotContract.ts +32 -81
- package/src/swift-compile.ts +268 -89
- package/src/swift-coverage/indexdump.ts +22 -6
- package/src/swift-coverage/indexing.ts +4 -4
- package/src/swift-coverage/provenance.ts +1 -0
- package/src/swift-coverage/sdk.ts +104 -20
- package/src/swift-coverage/types.ts +34 -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 +10 -2
- package/src/swift-cxx-reachable.ts +2 -1
- package/src/swift-distribution.lock.json +20 -16
- package/src/swift-host.ts +98 -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 +597 -57
- package/src/swift-standins.ts +599 -56
- package/src/swift-submit.ts +7 -1
- package/src/swift-toolchain.ts +140 -17
- package/src/turbo-bundle.ts +81 -0
- package/src/turbo-codegen-intake.ts +91 -0
- package/src/turbo-compile.ts +120 -0
- package/src/turbo-runtime.lock.json +69 -0
- package/src/turbo-source.ts +754 -0
- package/src/vite-plugin-one.ts +17 -12
- package/src/vite-plugin.ts +28 -15
- package/src/xcode-project.ts +223 -22
package/src/nitroContract.ts
CHANGED
|
@@ -8,47 +8,83 @@ import { isSwiftResourcePath, type SwiftEntryOptions } from './swiftContract'
|
|
|
8
8
|
/** the guest platform every Nitro compile targets. */
|
|
9
9
|
export const NITRO_GUEST_PLATFORM = 'ios'
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** installed Nitro providers whose original native source Peach compiles in
|
|
12
|
+
* place of any hand-written answer. */
|
|
13
|
+
export const COMPILED_NITRO_NATIVE_PACKAGES: readonly string[] = [
|
|
14
|
+
'react-native-nitro-base64',
|
|
15
|
+
'react-native-nitro-buffer',
|
|
16
|
+
'react-native-nitro-geocoder',
|
|
17
|
+
'react-native-nitro-haptics',
|
|
18
|
+
'react-native-nitro-sound',
|
|
19
|
+
'react-native-nitro-cookies',
|
|
20
|
+
'react-native-nitro-geolocation',
|
|
21
|
+
'react-native-nitro-markdown',
|
|
22
|
+
'react-native-nitro-network-info',
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
/** installed C++ TurboModule providers whose original native source Peach
|
|
26
|
+
* compiles in place of any hand-written answer. */
|
|
27
|
+
export const COMPILED_TURBO_NATIVE_PACKAGES: readonly string[] = []
|
|
28
|
+
|
|
29
|
+
interface CompiledModule<Package> {
|
|
12
30
|
platform: typeof NITRO_GUEST_PLATFORM
|
|
13
|
-
/** the original providers this one executable registers, by package name
|
|
14
|
-
|
|
15
|
-
* is in no provider's list. */
|
|
16
|
-
packages: { name: string; version: string; hybridObjects: string[] }[]
|
|
31
|
+
/** the original providers this one executable registers, by package name. */
|
|
32
|
+
packages: Package[]
|
|
17
33
|
url: string
|
|
18
34
|
hash: string
|
|
19
35
|
icuUrl: string
|
|
20
36
|
bundleFiles: NonNullable<SwiftEntryOptions['bundleFiles']>
|
|
21
37
|
}
|
|
22
38
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
type CompiledPackage = { name: string; version: string }
|
|
40
|
+
|
|
41
|
+
/** an app's compiled Nitro providers, each with the HybridObject names it
|
|
42
|
+
* registers. a name the app answers is in no provider's list. */
|
|
43
|
+
export type NitroCompiledModule = CompiledModule<
|
|
44
|
+
CompiledPackage & { hybridObjects: string[] }
|
|
45
|
+
>
|
|
46
|
+
/** an app's compiled C++ TurboModule providers. the module names they
|
|
47
|
+
* register are read from the executable, as React Native reads its map. */
|
|
48
|
+
export type TurboCompiledModule = CompiledModule<CompiledPackage>
|
|
49
|
+
|
|
50
|
+
function readCompiledPackage(value: unknown): CompiledPackage | null {
|
|
26
51
|
if (typeof value !== 'object' || value === null) return null
|
|
27
52
|
const name = Reflect.get(value, 'name')
|
|
28
53
|
const version = Reflect.get(value, 'version')
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
54
|
+
return typeof name === 'string' && name && typeof version === 'string' && version
|
|
55
|
+
? { name, version }
|
|
56
|
+
: null
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function readNitroPackage(
|
|
60
|
+
value: unknown,
|
|
61
|
+
): NitroCompiledModule['packages'][number] | null {
|
|
62
|
+
const read = readCompiledPackage(value)
|
|
63
|
+
const names = read && Reflect.get(Object(value), 'hybridObjects')
|
|
64
|
+
return read &&
|
|
34
65
|
Array.isArray(names) &&
|
|
35
66
|
names.length > 0 &&
|
|
36
67
|
names.every((entry): entry is string => typeof entry === 'string' && entry !== '') &&
|
|
37
68
|
new Set(names).size === names.length
|
|
38
|
-
? {
|
|
69
|
+
? { ...read, hybridObjects: names }
|
|
39
70
|
: null
|
|
40
71
|
}
|
|
41
72
|
|
|
42
|
-
|
|
73
|
+
function readCompiledMetadata<Package extends CompiledPackage>(
|
|
74
|
+
label: string,
|
|
75
|
+
value: unknown,
|
|
76
|
+
readPackage: (value: unknown) => Package | null,
|
|
77
|
+
names: (entry: Package) => string[],
|
|
78
|
+
): CompiledModule<Package> | null {
|
|
43
79
|
if (value === null || value === undefined) return null
|
|
44
80
|
if (
|
|
45
81
|
typeof value !== 'object' ||
|
|
46
82
|
Array.isArray(value) ||
|
|
47
83
|
Reflect.get(value, 'platform') !== NITRO_GUEST_PLATFORM
|
|
48
84
|
)
|
|
49
|
-
throw new Error(
|
|
85
|
+
throw new Error(`invalid ${label} compilation metadata`)
|
|
50
86
|
const listed = Reflect.get(value, 'packages')
|
|
51
|
-
const packages = Array.isArray(listed) ? listed.map(
|
|
87
|
+
const packages = Array.isArray(listed) ? listed.map(readPackage) : []
|
|
52
88
|
const url = Reflect.get(value, 'url')
|
|
53
89
|
const hash = Reflect.get(value, 'hash')
|
|
54
90
|
const icuUrl = Reflect.get(value, 'icuUrl')
|
|
@@ -57,8 +93,8 @@ export function readNitroMetadata(value: unknown): NitroCompiledModule | null {
|
|
|
57
93
|
packages.length === 0 ||
|
|
58
94
|
!packages.every((entry) => entry !== null) ||
|
|
59
95
|
new Set(packages.map(({ name }) => name)).size !== packages.length ||
|
|
60
|
-
new Set(packages.flatMap(
|
|
61
|
-
packages.reduce((total, entry) => total + entry.
|
|
96
|
+
new Set(packages.flatMap(names)).size !==
|
|
97
|
+
packages.reduce((total, entry) => total + names(entry).length, 0) ||
|
|
62
98
|
typeof url !== 'string' ||
|
|
63
99
|
!url ||
|
|
64
100
|
typeof hash !== 'string' ||
|
|
@@ -67,7 +103,7 @@ export function readNitroMetadata(value: unknown): NitroCompiledModule | null {
|
|
|
67
103
|
!icuUrl ||
|
|
68
104
|
!isRecord(packed)
|
|
69
105
|
)
|
|
70
|
-
throw new Error(
|
|
106
|
+
throw new Error(`invalid ${label} compilation metadata`)
|
|
71
107
|
const bundleFiles = Object.fromEntries(
|
|
72
108
|
Object.entries(packed).map(([name, bytes]) => {
|
|
73
109
|
if (
|
|
@@ -75,13 +111,18 @@ export function readNitroMetadata(value: unknown): NitroCompiledModule | null {
|
|
|
75
111
|
typeof bytes !== 'string' ||
|
|
76
112
|
!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(bytes)
|
|
77
113
|
)
|
|
78
|
-
throw new Error(
|
|
114
|
+
throw new Error(`invalid ${label} bundle file`)
|
|
79
115
|
return [name, bytes] satisfies [string, string]
|
|
80
116
|
}),
|
|
81
117
|
)
|
|
82
118
|
return { platform: 'ios', packages, url, hash, icuUrl, bundleFiles }
|
|
83
119
|
}
|
|
84
120
|
|
|
121
|
+
export const readNitroMetadata = (value: unknown): NitroCompiledModule | null =>
|
|
122
|
+
readCompiledMetadata('Nitro', value, readNitroPackage, (entry) => entry.hybridObjects)
|
|
123
|
+
export const readTurboMetadata = (value: unknown): TurboCompiledModule | null =>
|
|
124
|
+
readCompiledMetadata('TurboModule', value, readCompiledPackage, () => [])
|
|
125
|
+
|
|
85
126
|
export function readNitroFooter(source: string): NitroCompiledModule | null {
|
|
86
127
|
return readNitroMetadata(readBundleMetadataFooter(source, 'nitro'))
|
|
87
128
|
}
|
|
@@ -90,3 +131,12 @@ export function insertNitroFooter(source: string, metadata: NitroCompiledModule)
|
|
|
90
131
|
readNitroMetadata(metadata)
|
|
91
132
|
return insertBundleMetadataFooter(source, 'nitro', metadata)
|
|
92
133
|
}
|
|
134
|
+
|
|
135
|
+
export function readTurboFooter(source: string): TurboCompiledModule | null {
|
|
136
|
+
return readTurboMetadata(readBundleMetadataFooter(source, 'turbo'))
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function insertTurboFooter(source: string, metadata: TurboCompiledModule): string {
|
|
140
|
+
readTurboMetadata(metadata)
|
|
141
|
+
return insertBundleMetadataFooter(source, 'turbo', metadata)
|
|
142
|
+
}
|
|
@@ -340,64 +340,87 @@ export function collectBridgeModuleSources(
|
|
|
340
340
|
const app = readXcodeAppTarget(project, targets[0]!, 'Release', {
|
|
341
341
|
requireSources: false,
|
|
342
342
|
})
|
|
343
|
-
const own = (file: string) => {
|
|
344
|
-
const resolved = fs.realpathSync(file)
|
|
345
|
-
if (
|
|
346
|
-
[file, resolved].some((name) =>
|
|
347
|
-
name.split(path.sep).some((part) => part === 'Pods' || part === 'node_modules'),
|
|
348
|
-
)
|
|
349
|
-
)
|
|
350
|
-
return false
|
|
351
|
-
const relative = path.relative(projectRoot, resolved)
|
|
352
|
-
if (
|
|
353
|
-
relative === '..' ||
|
|
354
|
-
relative.startsWith(`..${path.sep}`) ||
|
|
355
|
-
path.isAbsolute(relative)
|
|
356
|
-
)
|
|
357
|
-
throw new Error(`${file}: app native source outside ${projectRoot}`)
|
|
358
|
-
return true
|
|
359
|
-
}
|
|
360
343
|
const units: ExpoSwiftSourceUnit[] = []
|
|
361
344
|
const failures: { namespace: string; diagnostic: string }[] = []
|
|
362
345
|
// the reader owns dependency order and visits a shared framework only once.
|
|
363
346
|
// each target keeps its own Swift module identity and compilation settings.
|
|
364
347
|
for (const target of [...app.frameworks, app]) {
|
|
365
348
|
signal?.throwIfAborted()
|
|
349
|
+
const namespace = target.moduleName.replace(/[^A-Za-z0-9_]/g, '_')
|
|
350
|
+
const outside: string[] = []
|
|
351
|
+
// a source outside the app root is never read or compiled. it may register
|
|
352
|
+
// modules into the app binary, so the target is unavailable rather than a
|
|
353
|
+
// silently reduced copy of what native builds.
|
|
354
|
+
const own = (file: string) => {
|
|
355
|
+
const resolved = fs.realpathSync(file)
|
|
356
|
+
if (
|
|
357
|
+
[file, resolved].some((name) =>
|
|
358
|
+
name.split(path.sep).some((part) => part === 'Pods' || part === 'node_modules'),
|
|
359
|
+
)
|
|
360
|
+
)
|
|
361
|
+
return false
|
|
362
|
+
const relative = path.relative(projectRoot, resolved)
|
|
363
|
+
if (
|
|
364
|
+
relative === '..' ||
|
|
365
|
+
relative.startsWith(`..${path.sep}`) ||
|
|
366
|
+
path.isAbsolute(relative)
|
|
367
|
+
) {
|
|
368
|
+
outside.push(file)
|
|
369
|
+
return false
|
|
370
|
+
}
|
|
371
|
+
return true
|
|
372
|
+
}
|
|
373
|
+
const accepted = target.allSources.filter(own)
|
|
366
374
|
const objc = [
|
|
367
375
|
...new Set(
|
|
368
|
-
|
|
369
|
-
.filter((file) => /\.mm?$/.test(file)
|
|
376
|
+
accepted
|
|
377
|
+
.filter((file) => /\.mm?$/.test(file))
|
|
370
378
|
.map((file) => fs.realpathSync(file)),
|
|
371
379
|
),
|
|
372
380
|
]
|
|
373
|
-
if (objc.length === 0) continue
|
|
374
381
|
// headers declare the superclasses; they sit beside the sources that import them
|
|
375
|
-
const headers =
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
.
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
const headers =
|
|
383
|
+
objc.length === 0
|
|
384
|
+
? []
|
|
385
|
+
: [...new Set(objc.map((file) => path.dirname(file)))].flatMap((dir) =>
|
|
386
|
+
fs
|
|
387
|
+
.readdirSync(dir)
|
|
388
|
+
.filter((name) => name.endsWith('.h'))
|
|
389
|
+
.sort()
|
|
390
|
+
.map((name) => path.join(dir, name))
|
|
391
|
+
.filter(own),
|
|
392
|
+
)
|
|
393
|
+
if (outside.length > 0) {
|
|
394
|
+
failures.push({
|
|
395
|
+
namespace,
|
|
396
|
+
diagnostic: `${outside[0]}: app native source outside ${projectRoot}${outside.length > 1 ? ` (and ${outside.length - 1} more)` : ''}. Peach reads and compiles only app-owned source inside the app root, so target ${target.name} is unavailable.`,
|
|
397
|
+
})
|
|
398
|
+
continue
|
|
399
|
+
}
|
|
400
|
+
if (objc.length === 0) continue
|
|
383
401
|
const declarations = parseObjectiveCModules(
|
|
384
402
|
[...objc, ...headers].map((file) => ({
|
|
385
403
|
file,
|
|
386
404
|
text: fs.readFileSync(file, 'utf8'),
|
|
387
405
|
})),
|
|
388
406
|
)
|
|
389
|
-
|
|
390
|
-
//
|
|
391
|
-
//
|
|
392
|
-
//
|
|
393
|
-
//
|
|
394
|
-
//
|
|
395
|
-
//
|
|
396
|
-
|
|
407
|
+
// an @implementation defining getTurboModule: is a React Native TurboModule.
|
|
408
|
+
// with no RCT_EXPORT_MODULE/RCT_EXTERN_MODULE macro it is a codegen module
|
|
409
|
+
// the macro scan above registers nothing for; with the macro but no
|
|
410
|
+
// exported method or constants its whole surface is the C++ object
|
|
411
|
+
// getTurboModule: returns, and registering the class would present an
|
|
412
|
+
// empty module that native does not have. name either instead of staying
|
|
413
|
+
// silent: the guest would otherwise boot with no native module, or an
|
|
414
|
+
// empty one, and fail with no cause.
|
|
415
|
+
const registered = new Set(declarations.modules.map((module) => module.className))
|
|
416
|
+
const cxxTurboModules = new Set<string>()
|
|
397
417
|
for (const [className, selectors] of declarations.implementations) {
|
|
398
418
|
signal?.throwIfAborted()
|
|
399
|
-
if (declared.has(className)) continue
|
|
400
419
|
if (!selectors.has('getTurboModule:')) continue
|
|
420
|
+
const exported =
|
|
421
|
+
(declarations.methods.get(className)?.length ?? 0) > 0 ||
|
|
422
|
+
selectors.has('constantsToExport')
|
|
423
|
+
if (registered.has(className) && exported) continue
|
|
401
424
|
const file =
|
|
402
425
|
objc.find((candidate) =>
|
|
403
426
|
new RegExp(`@implementation\\s+${className}\\b`).test(
|
|
@@ -406,13 +429,16 @@ export function collectBridgeModuleSources(
|
|
|
406
429
|
) ?? objc[0]!
|
|
407
430
|
failures.push({
|
|
408
431
|
namespace: `${namespace}.${className}`,
|
|
409
|
-
diagnostic:
|
|
432
|
+
diagnostic: registered.has(className)
|
|
433
|
+
? `${file}: ${className} implements getTurboModule: and exports no methods or constants, so its surface is the C++ TurboModule it returns. Peach compiles legacy bridge modules registered with RCT_EXPORT_MODULE/RCT_EXTERN_MODULE and Expo Swift modules; it does not compile C++ or codegen TurboModule bodies.`
|
|
434
|
+
: `${file}: ${className} implements getTurboModule: with no RCT_EXPORT_MODULE or RCT_EXTERN_MODULE registration, so it is a React Native codegen TurboModule. Peach compiles legacy bridge modules registered with RCT_EXPORT_MODULE/RCT_EXTERN_MODULE and Expo Swift modules; it does not compile codegen TurboModule bodies.`,
|
|
410
435
|
})
|
|
411
|
-
|
|
436
|
+
cxxTurboModules.add(className)
|
|
412
437
|
}
|
|
413
|
-
if (declarations.modules.
|
|
438
|
+
if (declarations.modules.every((module) => cxxTurboModules.has(module.className)))
|
|
439
|
+
continue
|
|
414
440
|
const swiftFiles: Record<string, string> = {}
|
|
415
|
-
for (const file of target.sources
|
|
441
|
+
for (const file of target.sources) {
|
|
416
442
|
const relative = path.relative(projectRoot, fs.realpathSync(file))
|
|
417
443
|
swiftFiles[`Sources/${namespace}/${relative.split(path.sep).join('/')}`] =
|
|
418
444
|
`#sourceLocation(file: ${JSON.stringify(file)}, line: 1)\n${fs.readFileSync(file, 'utf8')}`
|
|
@@ -420,7 +446,7 @@ export function collectBridgeModuleSources(
|
|
|
420
446
|
const seen = new Set<string>()
|
|
421
447
|
for (const module of declarations.modules) {
|
|
422
448
|
signal?.throwIfAborted()
|
|
423
|
-
if (seen.has(module.className)) continue
|
|
449
|
+
if (cxxTurboModules.has(module.className) || seen.has(module.className)) continue
|
|
424
450
|
seen.add(module.className)
|
|
425
451
|
const moduleId = `${namespace}.${module.className}`
|
|
426
452
|
const methods = declarations.methods.get(module.className) ?? []
|
|
@@ -432,6 +458,8 @@ export function collectBridgeModuleSources(
|
|
|
432
458
|
moduleId,
|
|
433
459
|
classes: [],
|
|
434
460
|
bridgeModules: [],
|
|
461
|
+
appDelegateSubscribers: [],
|
|
462
|
+
reactDelegateHandlers: [],
|
|
435
463
|
files: {},
|
|
436
464
|
frameworks: [],
|
|
437
465
|
swiftLanguageMode: target.languageMode,
|
|
@@ -9,6 +9,17 @@ export const REACT_NATIVE_PASSTHROUGH_SPECIFIERS: readonly string[] = [
|
|
|
9
9
|
// one's native bootstrap runs the upstream environment entry.
|
|
10
10
|
'react-native/setup-env',
|
|
11
11
|
'react-native/src/setup-env',
|
|
12
|
+
// upstream initialization owns the native DOM constructors for its version.
|
|
13
|
+
'react-native/Libraries/Core/InitializeCore',
|
|
14
|
+
'react-native/Libraries/Core/setUpRegeneratorRuntime',
|
|
15
|
+
'react-native/src/private/setup/setUpDefaultReactNativeEnvironment',
|
|
16
|
+
'react-native/src/private/setup/setUpDefaltReactNativeEnvironment',
|
|
17
|
+
'react-native/src/private/setup/setUpDOM',
|
|
18
|
+
'react-native/src/private/core/setUpDOM',
|
|
19
|
+
'react-native/Libraries/Utilities/PolyfillFunctions',
|
|
20
|
+
'react-native/Libraries/Utilities/GlobalPerformanceLogger',
|
|
21
|
+
'react-native/Libraries/Utilities/createPerformanceLogger',
|
|
22
|
+
'react-native/Libraries/Utilities/infoLog',
|
|
12
23
|
// sdk 58 reads these upstream getters and wraps the original metro logger.
|
|
13
24
|
'react-native/unstable-internals-do-not-use',
|
|
14
25
|
'react-native/src/unstable-internals-do-not-use',
|
|
@@ -31,12 +42,17 @@ export const REACT_NATIVE_PASSTHROUGH_SPECIFIERS: readonly string[] = [
|
|
|
31
42
|
'react-native/Libraries/NativeModules/specs/NativeDevSettings',
|
|
32
43
|
'react-native/Libraries/NativeModules/specs/NativeLogBox',
|
|
33
44
|
'react-native/Libraries/NativeModules/specs/NativeRedBox',
|
|
45
|
+
'react-native/src/private/debugging/FuseboxSessionObserver',
|
|
34
46
|
'react-native/src/private/devsupport/rndevtools/FuseboxSessionObserver',
|
|
47
|
+
'react-native/src/private/fusebox/FuseboxSessionObserver',
|
|
35
48
|
'react-native/src/private/devsupport/rndevtools/GlobalStateObserver',
|
|
36
49
|
'react-native/src/private/devsupport/rndevtools/TracingStateObserver',
|
|
37
50
|
'react-native/src/private/specs_DEPRECATED/modules/NativeDevSettings',
|
|
38
51
|
'react-native/src/private/specs_DEPRECATED/modules/NativeLogBox',
|
|
39
52
|
'react-native/src/private/specs_DEPRECATED/modules/NativeRedBox',
|
|
53
|
+
'react-native/src/private/specs/modules/NativeDevSettings',
|
|
54
|
+
'react-native/src/private/specs/modules/NativeLogBox',
|
|
55
|
+
'react-native/src/private/specs/modules/NativeRedBox',
|
|
40
56
|
'react-native/src/private/utilities/toError',
|
|
41
57
|
'react-native/src/private/utilities/toExtendedError',
|
|
42
58
|
// already-passthrough modules import these at evaluation.
|
|
@@ -60,10 +76,21 @@ export const REACT_NATIVE_PASSTHROUGH_SPECIFIERS: readonly string[] = [
|
|
|
60
76
|
'react-native/Libraries/Blob/BlobRegistry',
|
|
61
77
|
'react-native/Libraries/Blob/NativeBlobModule',
|
|
62
78
|
'react-native/Libraries/Utilities/binaryToBase64',
|
|
79
|
+
'react-native/src/private/specs/modules/NativeWebSocketModule',
|
|
80
|
+
'react-native/src/private/specs/modules/NativeBlobModule',
|
|
63
81
|
'react-native/src/private/specs_DEPRECATED/modules/NativeWebSocketModule',
|
|
64
82
|
'react-native/src/private/specs_DEPRECATED/modules/NativeBlobModule',
|
|
65
83
|
'react-native/Libraries/vendor/emitter',
|
|
66
84
|
'react-native/Libraries/Components/View/ReactNativeStyleAttributes',
|
|
85
|
+
// view's javascript prop mapping runs over the registered RCTView native seam.
|
|
86
|
+
'react-native/Libraries/Components/View/View.js',
|
|
87
|
+
// text and press-target debugging retain their upstream javascript wrappers.
|
|
88
|
+
'react-native/Libraries/Text/Text.js',
|
|
89
|
+
'react-native/Libraries/Pressability/PressabilityDebug.js',
|
|
90
|
+
// pressable's upstream wrapper runs over the stubbed Pressability
|
|
91
|
+
// implementation and the passthrough View, like Text.js above.
|
|
92
|
+
'react-native/Libraries/Components/Pressable/Pressable.js',
|
|
93
|
+
'react-native/Libraries/Components/Pressable/useAndroidRippleForView.js',
|
|
67
94
|
'react-native/Libraries/StyleSheet',
|
|
68
95
|
'react-native/Libraries/Utilities/differ',
|
|
69
96
|
'react-native/Libraries/Utilities/stringifySafe',
|
|
@@ -72,10 +99,11 @@ export const REACT_NATIVE_PASSTHROUGH_SPECIFIERS: readonly string[] = [
|
|
|
72
99
|
'react-native/Libraries/TurboModule/TurboModuleRegistry',
|
|
73
100
|
'react-native/Libraries/Utilities/Platform',
|
|
74
101
|
'react-native/Libraries/Utilities/NativePlatformConstants',
|
|
102
|
+
'react-native/src/private/specs/modules/NativePlatformConstants',
|
|
75
103
|
'react-native/src/private/specs_DEPRECATED/modules/NativePlatformConstants',
|
|
76
104
|
// pure javascript in Libraries/Core and Libraries/Utilities, from the
|
|
77
105
|
// eval-time graph of InitializeCore, ExceptionsManager, HMRClient, and
|
|
78
|
-
// LogBox.
|
|
106
|
+
// LogBox. host-owned installers stay overrides. Dimensions, DevLoadingView,
|
|
79
107
|
// NativeExceptionsManager, JSTimers, and BackHandler.android.js evaluate an
|
|
80
108
|
// unregistered native spec, so they stay on the explicit error. the
|
|
81
109
|
// BackHandler names include the extension so the android file stays out.
|
|
@@ -89,6 +117,11 @@ export const REACT_NATIVE_PASSTHROUGH_SPECIFIERS: readonly string[] = [
|
|
|
89
117
|
'react-native/Libraries/Core/Timers/queueMicrotask',
|
|
90
118
|
'react-native/Libraries/Core/Devtools/openFileInEditor',
|
|
91
119
|
'react-native/Libraries/Utilities/Appearance',
|
|
120
|
+
// Appearance reads its spec through TurboModuleRegistry.get('Appearance'),
|
|
121
|
+
// which the engine registers.
|
|
122
|
+
'react-native/Libraries/Utilities/NativeAppearance',
|
|
123
|
+
'react-native/src/private/specs/modules/NativeAppearance',
|
|
124
|
+
'react-native/src/private/specs_DEPRECATED/modules/NativeAppearance',
|
|
92
125
|
'react-native/Libraries/Utilities/useColorScheme',
|
|
93
126
|
'react-native/Libraries/Utilities/FeatureDetection',
|
|
94
127
|
'react-native/Libraries/Utilities/HMRClientProdShim',
|
|
@@ -7,6 +7,7 @@ export const DEFAULT_REACT_NATIVE_CONFIGURATION = {
|
|
|
7
7
|
// scheme reaches workers through Appearance
|
|
8
8
|
colorScheme: 'auto',
|
|
9
9
|
language: 'en',
|
|
10
|
+
preferredLanguages: Array<string>(),
|
|
10
11
|
region: 'US',
|
|
11
12
|
fontSize: 1,
|
|
12
13
|
boldText: false,
|
|
@@ -34,3 +35,16 @@ export const REACT_NATIVE_CONFIGURATION_KEYS = Object.keys(
|
|
|
34
35
|
).filter(
|
|
35
36
|
(key): key is ReactNativeConfigurationKey => key in DEFAULT_REACT_NATIVE_CONFIGURATION,
|
|
36
37
|
)
|
|
38
|
+
|
|
39
|
+
export function configurationValuesEqual(
|
|
40
|
+
left: ReactNativeConfigurationSnapshot[ReactNativeConfigurationKey],
|
|
41
|
+
right: ReactNativeConfigurationSnapshot[ReactNativeConfigurationKey],
|
|
42
|
+
): boolean {
|
|
43
|
+
return (
|
|
44
|
+
left === right ||
|
|
45
|
+
(Array.isArray(left) &&
|
|
46
|
+
Array.isArray(right) &&
|
|
47
|
+
left.length === right.length &&
|
|
48
|
+
left.every((value, index) => value === right[index]))
|
|
49
|
+
)
|
|
50
|
+
}
|
package/src/reap-browser.ts
CHANGED
|
@@ -64,6 +64,10 @@ export type BrowserLaunchPolicy = {
|
|
|
64
64
|
processCommand?: (pid: number) => string
|
|
65
65
|
processIdentity?: (pid: number) => string | null
|
|
66
66
|
admission?: ChromiumLaunchAdmission
|
|
67
|
+
// a published simulator on a user's machine renders the way its sim host
|
|
68
|
+
// does: GPU-less Linux and Windows servers use the bundled browser in
|
|
69
|
+
// software, a Mac requires its GPU. unset keeps softwareChromeAllowed.
|
|
70
|
+
software?: boolean
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
export type ChromiumLaunchAdmission = {
|
|
@@ -847,8 +851,11 @@ function platformChromeLaunch<B>(
|
|
|
847
851
|
): () => Promise<B> {
|
|
848
852
|
return async () => {
|
|
849
853
|
const runtime = policy.runtime ?? currentRuntime()
|
|
850
|
-
if (softwareChromeAllowed(runtime)) {
|
|
851
|
-
return launchWithPauseAwareDeadline(
|
|
854
|
+
if (policy.software ?? softwareChromeAllowed(runtime)) {
|
|
855
|
+
return launchWithPauseAwareDeadline(
|
|
856
|
+
launch,
|
|
857
|
+
softwareChromeLaunchOptions(opts, runtime),
|
|
858
|
+
)
|
|
852
859
|
}
|
|
853
860
|
const gpuOptions = chromeLaunchOptions(opts, runtime)
|
|
854
861
|
let browser: B
|
|
@@ -970,7 +977,12 @@ export function chromeLaunchOptions(
|
|
|
970
977
|
): Record<string, unknown> {
|
|
971
978
|
if (signalShutdownClaimed) {
|
|
972
979
|
// the owner needs the browser alive until its asynchronous cleanup finishes.
|
|
973
|
-
opts = {
|
|
980
|
+
opts = {
|
|
981
|
+
...opts,
|
|
982
|
+
handleSIGINT: false,
|
|
983
|
+
handleSIGTERM: false,
|
|
984
|
+
handleSIGHUP: false,
|
|
985
|
+
}
|
|
974
986
|
}
|
|
975
987
|
return softwareChromeAllowed(runtime)
|
|
976
988
|
? softwareChromeLaunchOptions(opts, runtime)
|
package/src/sdk.ts
CHANGED
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
export * from './sim-client'
|
|
9
9
|
export * from '../cli/commands/inspect/core'
|
|
10
10
|
export * from '../cli/commands/inspect/actions'
|
|
11
|
+
export type {
|
|
12
|
+
SimTapDiagnostics,
|
|
13
|
+
SimTapResult,
|
|
14
|
+
SimTapResultReason,
|
|
15
|
+
} from './bridge-contract'
|
|
11
16
|
export {
|
|
12
17
|
IdleObservationError,
|
|
13
18
|
RuntimeReadinessUnsupportedError,
|
package/src/settingsContract.ts
CHANGED
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
type TextPresetName,
|
|
30
30
|
} from './screenshots/preset-names.ts'
|
|
31
31
|
|
|
32
|
-
export type SettingType = 'string' | 'number' | 'boolean' | 'enum'
|
|
32
|
+
export type SettingType = 'string' | 'number' | 'boolean' | 'enum' | 'string-array'
|
|
33
33
|
|
|
34
34
|
export interface SettingDef<T = any> {
|
|
35
35
|
type: SettingType
|
|
@@ -81,6 +81,10 @@ export interface SettingsValues {
|
|
|
81
81
|
// settings > general > keyboard > predictive text (TIPreferences
|
|
82
82
|
// KeyboardPrediction); off hides the QuickType lane above the keys
|
|
83
83
|
predictiveText: boolean
|
|
84
|
+
// simulator > connect hardware keyboard: typing comes from the host
|
|
85
|
+
// keyboard and no software keyboard presents, as on a device with a
|
|
86
|
+
// keyboard attached. packaged apps turn it on.
|
|
87
|
+
hardwareKeyboard: boolean
|
|
84
88
|
// appearance
|
|
85
89
|
colorScheme: ColorScheme
|
|
86
90
|
reduceMotion: boolean
|
|
@@ -107,6 +111,7 @@ export interface SettingsValues {
|
|
|
107
111
|
glassTintAmount: number
|
|
108
112
|
// locale
|
|
109
113
|
language: string
|
|
114
|
+
preferredLanguages: string[]
|
|
110
115
|
region: string
|
|
111
116
|
// simulator
|
|
112
117
|
renderDensity: number
|
|
@@ -115,6 +120,7 @@ export interface SettingsValues {
|
|
|
115
120
|
// the Performance pane's chosen recording categories, comma separated
|
|
116
121
|
profilerCategories: string
|
|
117
122
|
showTouches: boolean
|
|
123
|
+
systemCursor: boolean
|
|
118
124
|
showFrame: boolean
|
|
119
125
|
showMenuBar: boolean
|
|
120
126
|
showRail: boolean
|
|
@@ -213,6 +219,13 @@ export const settingsSchema: Record<SettingKey, SettingDef> = {
|
|
|
213
219
|
group: 'device',
|
|
214
220
|
},
|
|
215
221
|
|
|
222
|
+
hardwareKeyboard: {
|
|
223
|
+
type: 'boolean',
|
|
224
|
+
default: false,
|
|
225
|
+
description: 'connect the host keyboard: typing needs no on-screen keyboard',
|
|
226
|
+
group: 'device',
|
|
227
|
+
},
|
|
228
|
+
|
|
216
229
|
// appearance
|
|
217
230
|
colorScheme: {
|
|
218
231
|
type: 'enum',
|
|
@@ -307,6 +320,23 @@ export const settingsSchema: Record<SettingKey, SettingDef> = {
|
|
|
307
320
|
description: 'language code (ISO 639-1)',
|
|
308
321
|
group: 'locale',
|
|
309
322
|
},
|
|
323
|
+
preferredLanguages: {
|
|
324
|
+
type: 'string-array',
|
|
325
|
+
default: DEFAULT_REACT_NATIVE_CONFIGURATION.preferredLanguages,
|
|
326
|
+
description: 'ordered preferred language tags; empty follows language and region',
|
|
327
|
+
group: 'locale',
|
|
328
|
+
validate: (value: unknown) => {
|
|
329
|
+
if (!Array.isArray(value)) return false
|
|
330
|
+
return value.every((tag: unknown) => {
|
|
331
|
+
if (typeof tag !== 'string' || !tag) return false
|
|
332
|
+
try {
|
|
333
|
+
return Intl.getCanonicalLocales(tag).length === 1
|
|
334
|
+
} catch {
|
|
335
|
+
return false
|
|
336
|
+
}
|
|
337
|
+
})
|
|
338
|
+
},
|
|
339
|
+
},
|
|
310
340
|
region: {
|
|
311
341
|
type: 'string',
|
|
312
342
|
default: DEFAULT_REACT_NATIVE_CONFIGURATION.region,
|
|
@@ -349,6 +379,12 @@ export const settingsSchema: Record<SettingKey, SettingDef> = {
|
|
|
349
379
|
description: 'show touch indicators',
|
|
350
380
|
group: 'simulator',
|
|
351
381
|
},
|
|
382
|
+
systemCursor: {
|
|
383
|
+
type: 'boolean',
|
|
384
|
+
default: false,
|
|
385
|
+
description: 'keep the computer pointer instead of a touch cursor',
|
|
386
|
+
group: 'simulator',
|
|
387
|
+
},
|
|
352
388
|
showFrame: {
|
|
353
389
|
type: 'boolean',
|
|
354
390
|
default: true,
|
|
@@ -538,6 +574,7 @@ const SETTING_VALUE_TYPES = {
|
|
|
538
574
|
enum: 'string',
|
|
539
575
|
number: 'number',
|
|
540
576
|
boolean: 'boolean',
|
|
577
|
+
'string-array': 'object',
|
|
541
578
|
} as const satisfies Record<SettingType, string>
|
|
542
579
|
|
|
543
580
|
// the one gate for every write and load: a value of the wrong type (an object
|
package/src/sim-client.ts
CHANGED
|
@@ -621,7 +621,10 @@ export class SimClient implements WsBridge, InspectBridge {
|
|
|
621
621
|
: outcome.failure === 'missed'
|
|
622
622
|
? (outcome.result?.reason ?? 'press missed')
|
|
623
623
|
: outcome.payload?.ambiguous
|
|
624
|
-
?
|
|
624
|
+
? (outcome.payload.error ??
|
|
625
|
+
(outcome.payload.total === undefined
|
|
626
|
+
? 'ambiguous target'
|
|
627
|
+
: `ambiguous: ${outcome.payload.total} matches`))
|
|
625
628
|
: (outcome.result?.reason ?? outcome.payload?.error ?? 'tap failed')
|
|
626
629
|
throw new SimTapError(`tap ${JSON.stringify(label)} failed: ${reason}`, outcome)
|
|
627
630
|
}
|