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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1738 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1738 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
package/dist-lib/kotlin-host.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1738 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -39,6 +39,7 @@ __export(kotlin_host_exports, {
|
|
|
39
39
|
kotlinArtifactFiles: () => kotlinArtifactFiles,
|
|
40
40
|
kotlinSources: () => kotlinSources,
|
|
41
41
|
peachKotlinModuleRoot: () => peachKotlinModuleRoot,
|
|
42
|
+
scanBridgeFiles: () => scanBridgeFiles,
|
|
42
43
|
serveKotlinArtifact: () => serveKotlinArtifact,
|
|
43
44
|
serveKotlinRequest: () => serveKotlinRequest
|
|
44
45
|
});
|
|
@@ -49,13 +50,164 @@ var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
|
49
50
|
var import_node_module = require("node:module");
|
|
50
51
|
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
51
52
|
var import_node_util3 = require("node:util");
|
|
52
|
-
var
|
|
53
|
+
var import_acorn2 = require("acorn");
|
|
53
54
|
|
|
54
55
|
// src/is-record.ts
|
|
55
56
|
function isRecord(value) {
|
|
56
57
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
// src/android-bridge-packages.ts
|
|
61
|
+
function readMethod(value) {
|
|
62
|
+
if (!isRecord(value) || typeof value.name !== "string" || typeof value.blocking !== "boolean" || value.returns !== null && typeof value.returns !== "string" || !Array.isArray(value.params))
|
|
63
|
+
throw new Error("bridge-modules printed an invalid method");
|
|
64
|
+
return {
|
|
65
|
+
name: value.name,
|
|
66
|
+
blocking: value.blocking,
|
|
67
|
+
returns: value.returns,
|
|
68
|
+
params: value.params.map((param) => {
|
|
69
|
+
if (!isRecord(param) || typeof param.name !== "string" || typeof param.type !== "string")
|
|
70
|
+
throw new Error("bridge-modules printed an invalid parameter");
|
|
71
|
+
return { name: param.name, type: param.type };
|
|
72
|
+
})
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function strings(value) {
|
|
76
|
+
if (!Array.isArray(value) || !value.every((item) => typeof item === "string"))
|
|
77
|
+
throw new Error("bridge-modules printed an invalid list");
|
|
78
|
+
return value.map(String);
|
|
79
|
+
}
|
|
80
|
+
function readBridgeFiles(output) {
|
|
81
|
+
return output.split("\n").filter((line) => line.startsWith("{")).map((line) => {
|
|
82
|
+
const row = JSON.parse(line);
|
|
83
|
+
if (!isRecord(row) || typeof row.file !== "string" || typeof row.package !== "string" || !Array.isArray(row.packages) || !Array.isArray(row.modules))
|
|
84
|
+
throw new Error("bridge-modules printed an invalid file");
|
|
85
|
+
return {
|
|
86
|
+
file: row.file,
|
|
87
|
+
package: row.package,
|
|
88
|
+
imports: strings(row.imports),
|
|
89
|
+
declared: strings(row.declared),
|
|
90
|
+
references: strings(row.references),
|
|
91
|
+
packages: row.packages.map((entry) => {
|
|
92
|
+
if (!isRecord(entry) || typeof entry.name !== "string" || typeof entry.noArg !== "boolean")
|
|
93
|
+
throw new Error("bridge-modules printed an invalid package");
|
|
94
|
+
return { name: entry.name, noArg: entry.noArg };
|
|
95
|
+
}),
|
|
96
|
+
modules: row.modules.map((entry) => {
|
|
97
|
+
if (!isRecord(entry) || typeof entry.name !== "string" || !Array.isArray(entry.methods))
|
|
98
|
+
throw new Error("bridge-modules printed an invalid module");
|
|
99
|
+
return { name: entry.name, methods: entry.methods.map(readMethod) };
|
|
100
|
+
})
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/kotlin-instance-source.ts
|
|
106
|
+
var import_acorn = require("acorn");
|
|
107
|
+
function bindingNames(pattern) {
|
|
108
|
+
if (pattern.type === "Identifier") return [pattern.name];
|
|
109
|
+
if (pattern.type === "ObjectPattern")
|
|
110
|
+
return pattern.properties.flatMap(
|
|
111
|
+
(property) => bindingNames(property.type === "RestElement" ? property.argument : property.value)
|
|
112
|
+
);
|
|
113
|
+
if (pattern.type === "ArrayPattern")
|
|
114
|
+
return pattern.elements.flatMap((element) => element ? bindingNames(element) : []);
|
|
115
|
+
if (pattern.type === "AssignmentPattern") return bindingNames(pattern.left);
|
|
116
|
+
if (pattern.type === "RestElement") return bindingNames(pattern.argument);
|
|
117
|
+
throw new Error(`unsupported Kotlin export binding ${pattern.type}`);
|
|
118
|
+
}
|
|
119
|
+
function kotlinInstanceSource(source, factory, instanceImports = /* @__PURE__ */ new Map()) {
|
|
120
|
+
const program = (0, import_acorn.parse)(source, { ecmaVersion: "latest", sourceType: "module" });
|
|
121
|
+
const imports = [];
|
|
122
|
+
const body = [];
|
|
123
|
+
let dependencies = 0;
|
|
124
|
+
const exports2 = [];
|
|
125
|
+
for (const statement of program.body) {
|
|
126
|
+
if (statement.type === "ImportDeclaration") {
|
|
127
|
+
const importedFactory = typeof statement.source.value === "string" ? instanceImports.get(statement.source.value) : void 0;
|
|
128
|
+
if (!importedFactory) {
|
|
129
|
+
imports.push(source.slice(statement.start, statement.end));
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
imports.push(
|
|
133
|
+
`import { ${importedFactory} } from ${JSON.stringify(statement.source.value)};`
|
|
134
|
+
);
|
|
135
|
+
const names = statement.specifiers.map((specifier) => {
|
|
136
|
+
if (specifier.type !== "ImportSpecifier" || specifier.imported.type !== "Identifier")
|
|
137
|
+
throw new Error("unsupported Kotlin instance import");
|
|
138
|
+
return `${specifier.imported.name}: ${specifier.local.name}`;
|
|
139
|
+
});
|
|
140
|
+
const dependency = `__peachDependency${dependencies++}`;
|
|
141
|
+
body.push(
|
|
142
|
+
`const ${dependency} = ${importedFactory}();`,
|
|
143
|
+
`__peachDisposers.push(${dependency}.peachDisposeInstance);`,
|
|
144
|
+
`const { ${names.join(", ")} } = ${dependency};`
|
|
145
|
+
);
|
|
146
|
+
} else if (statement.type === "ExportNamedDeclaration") {
|
|
147
|
+
const declaration = statement.declaration;
|
|
148
|
+
if (declaration) {
|
|
149
|
+
body.push(source.slice(declaration.start, declaration.end));
|
|
150
|
+
const names = declaration.type === "VariableDeclaration" ? declaration.declarations.flatMap((item) => bindingNames(item.id)) : declaration.id ? [declaration.id.name] : [];
|
|
151
|
+
exports2.push(...names.map((name) => ({ local: name, exported: name })));
|
|
152
|
+
} else {
|
|
153
|
+
if (statement.source) throw new Error("unsupported Kotlin instance re-export");
|
|
154
|
+
for (const specifier of statement.specifiers) {
|
|
155
|
+
if (specifier.local.type !== "Identifier" || specifier.exported.type !== "Identifier")
|
|
156
|
+
throw new Error("unsupported Kotlin export name");
|
|
157
|
+
exports2.push({ local: specifier.local.name, exported: specifier.exported.name });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} else if (statement.type === "ExportDefaultDeclaration") {
|
|
161
|
+
body.push(
|
|
162
|
+
`const __defaultExport = (${source.slice(statement.declaration.start, statement.declaration.end)});`
|
|
163
|
+
);
|
|
164
|
+
exports2.push({ local: "__defaultExport", exported: "default" });
|
|
165
|
+
} else if (statement.type === "ExportAllDeclaration") {
|
|
166
|
+
throw new Error("unsupported Kotlin instance re-export");
|
|
167
|
+
} else {
|
|
168
|
+
body.push(source.slice(statement.start, statement.end));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
source: `${imports.join("\n")}
|
|
173
|
+
export ${instanceImports.size ? "async " : ""}function ${factory}() {
|
|
174
|
+
const __peachTimers = new Set();
|
|
175
|
+
const __peachDisposers = [];
|
|
176
|
+
let __peachClosed = false;
|
|
177
|
+
function peachDisposeInstance() {
|
|
178
|
+
if (__peachClosed) return;
|
|
179
|
+
__peachClosed = true;
|
|
180
|
+
for (const timer of __peachTimers) globalThis.clearTimeout(timer);
|
|
181
|
+
__peachTimers.clear();
|
|
182
|
+
for (const dispose of __peachDisposers) dispose();
|
|
183
|
+
__peachDisposers.length = 0;
|
|
184
|
+
}
|
|
185
|
+
const setTimeout = (callback, delay, ...args) => {
|
|
186
|
+
if (__peachClosed) return 0;
|
|
187
|
+
const timer = globalThis.setTimeout(() => {
|
|
188
|
+
__peachTimers.delete(timer);
|
|
189
|
+
if (!__peachClosed) callback(...args);
|
|
190
|
+
}, delay);
|
|
191
|
+
__peachTimers.add(timer);
|
|
192
|
+
return timer;
|
|
193
|
+
};
|
|
194
|
+
const clearTimeout = timer => {
|
|
195
|
+
__peachTimers.delete(timer);
|
|
196
|
+
globalThis.clearTimeout(timer);
|
|
197
|
+
};
|
|
198
|
+
try {
|
|
199
|
+
${body.join("\n")}
|
|
200
|
+
return { peachDisposeInstance, ${exports2.map((item) => `${JSON.stringify(item.exported)}: ${item.local}`).join(", ")} };
|
|
201
|
+
} catch (error) {
|
|
202
|
+
peachDisposeInstance();
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
`,
|
|
207
|
+
exports: exports2
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
59
211
|
// src/kotlin-sdk.ts
|
|
60
212
|
var import_node_child_process2 = require("node:child_process");
|
|
61
213
|
var import_node_crypto2 = require("node:crypto");
|
|
@@ -74,10 +226,13 @@ var import_node_util = require("node:util");
|
|
|
74
226
|
var import_node_os = require("node:os");
|
|
75
227
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
76
228
|
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
229
|
+
function ambientHomeDir() {
|
|
230
|
+
return import_node_path.default.join((0, import_node_os.homedir)(), ".peach");
|
|
231
|
+
}
|
|
77
232
|
function rnxHomeDir() {
|
|
78
233
|
const override = process.env[PEACH_HOME_ENV];
|
|
79
234
|
if (override && override.length > 0) return import_node_path.default.resolve(override);
|
|
80
|
-
return
|
|
235
|
+
return ambientHomeDir();
|
|
81
236
|
}
|
|
82
237
|
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
83
238
|
|
|
@@ -204,13 +359,14 @@ var KOTLIN_SDK_PROFILES = {
|
|
|
204
359
|
},
|
|
205
360
|
expo: {
|
|
206
361
|
compose: false,
|
|
207
|
-
directories: [...platform, "ExpoSources", "AndroidViewSources"]
|
|
362
|
+
directories: [...platform, "ExpoSources", "BridgeSources", "AndroidViewSources"]
|
|
208
363
|
},
|
|
209
364
|
expoCompose: {
|
|
210
365
|
compose: true,
|
|
211
366
|
directories: [
|
|
212
367
|
...platform,
|
|
213
368
|
"ExpoSources",
|
|
369
|
+
"BridgeSources",
|
|
214
370
|
"AndroidViewSources",
|
|
215
371
|
"ComposeSources",
|
|
216
372
|
"ExpoComposeSources"
|
|
@@ -307,7 +463,7 @@ var VIEW_MODEL = "androidx.lifecycle.ViewModel";
|
|
|
307
463
|
var ANDROID_VIEW_MODEL = "androidx.lifecycle.AndroidViewModel";
|
|
308
464
|
var APPLICATION = "android.app.Application";
|
|
309
465
|
var HANDLE = "androidx.lifecycle.SavedStateHandle";
|
|
310
|
-
function
|
|
466
|
+
function strings2(value) {
|
|
311
467
|
if (!Array.isArray(value) || !value.every((item) => typeof item === "string"))
|
|
312
468
|
throw new Error("abi-classes printed an invalid list");
|
|
313
469
|
return value;
|
|
@@ -323,12 +479,12 @@ function readAbiClasses(output) {
|
|
|
323
479
|
modality: row.modality,
|
|
324
480
|
inner: row.inner,
|
|
325
481
|
generic: row.generic,
|
|
326
|
-
supers:
|
|
482
|
+
supers: strings2(row.supers),
|
|
327
483
|
constructors: row.constructors.map((constructor) => {
|
|
328
484
|
if (!isRecord(constructor) || typeof constructor.defaulted !== "boolean")
|
|
329
485
|
throw new Error(`abi-classes printed an invalid constructor: ${line}`);
|
|
330
486
|
return {
|
|
331
|
-
parameters:
|
|
487
|
+
parameters: strings2(constructor.parameters),
|
|
332
488
|
defaulted: constructor.defaulted
|
|
333
489
|
};
|
|
334
490
|
})
|
|
@@ -516,7 +672,7 @@ function entrySource(ids) {
|
|
|
516
672
|
""
|
|
517
673
|
].join("\n");
|
|
518
674
|
}
|
|
519
|
-
var BUILD_FORMAT =
|
|
675
|
+
var BUILD_FORMAT = 19;
|
|
520
676
|
var builds = /* @__PURE__ */ new Map();
|
|
521
677
|
function buildsDir() {
|
|
522
678
|
return import_node_path5.default.join(kotlinHome(), "builds");
|
|
@@ -559,7 +715,7 @@ async function kotlinArtifact(root, moduleRoot, origin, target = "app") {
|
|
|
559
715
|
);
|
|
560
716
|
}
|
|
561
717
|
function readExpoField(value) {
|
|
562
|
-
if (!isRecord(value) || typeof value.name !== "string" || typeof value.key !== "string" || typeof value.required !== "boolean" || typeof value.mutable !== "boolean" || typeof value.hidden !== "boolean")
|
|
718
|
+
if (!isRecord(value) || typeof value.name !== "string" || typeof value.key !== "string" || typeof value.required !== "boolean" || typeof value.mutable !== "boolean" || typeof value.hidden !== "boolean" || typeof value.parameter !== "boolean")
|
|
563
719
|
throw new Error("expo-types printed an invalid field");
|
|
564
720
|
const range = value.initializer;
|
|
565
721
|
if (range !== null && (!Array.isArray(range) || range.length !== 2 || typeof range[0] !== "number" || typeof range[1] !== "number"))
|
|
@@ -570,6 +726,7 @@ function readExpoField(value) {
|
|
|
570
726
|
required: value.required,
|
|
571
727
|
mutable: value.mutable,
|
|
572
728
|
hidden: value.hidden,
|
|
729
|
+
parameter: value.parameter,
|
|
573
730
|
initializer: range === null ? null : [range[0], range[1]]
|
|
574
731
|
};
|
|
575
732
|
}
|
|
@@ -619,49 +776,165 @@ function readExpoTypes(output) {
|
|
|
619
776
|
};
|
|
620
777
|
});
|
|
621
778
|
}
|
|
622
|
-
var
|
|
623
|
-
async function
|
|
624
|
-
const candidates = sources.filter(
|
|
625
|
-
(file) => /\bRecord\b|\benum\s+class\b|\bExpoComposeView\b|\bExpoView\b|\bComposeProps\b|:\s*(?:[A-Za-z0-9_.]+\.)?(?:View|FrameLayout|LinearLayout|ViewGroup)\b/.test(
|
|
626
|
-
import_node_fs4.default.readFileSync(file, "utf8")
|
|
627
|
-
)
|
|
628
|
-
);
|
|
629
|
-
if (candidates.length === 0) return Promise.resolve([]);
|
|
779
|
+
var toolScans = /* @__PURE__ */ new Map();
|
|
780
|
+
async function scanSources(tool, parse3, toolchain, moduleRoot, files) {
|
|
630
781
|
const digest = (0, import_node_crypto4.createHash)("sha256").update(JSON.stringify(toolchain.compiler));
|
|
631
782
|
const sdk = await loadKotlinSdk(moduleRoot, toolchain);
|
|
632
|
-
|
|
633
|
-
digest.update(
|
|
634
|
-
for (const file of
|
|
635
|
-
digest.update(`${file}\0${import_node_fs4.default.readFileSync(file, "utf8")}\0`);
|
|
783
|
+
digest.update(import_node_fs4.default.readFileSync(import_node_path5.default.join(moduleRoot, "sdk.tar.gz")));
|
|
784
|
+
digest.update(tool);
|
|
785
|
+
for (const file of files) digest.update(`${file}\0${import_node_fs4.default.readFileSync(file, "utf8")}\0`);
|
|
636
786
|
const key = digest.digest("hex");
|
|
637
|
-
let scan =
|
|
787
|
+
let scan = toolScans.get(key);
|
|
638
788
|
if (!scan) {
|
|
639
789
|
scan = (async () => {
|
|
640
|
-
const
|
|
641
|
-
ensureToolchain(toolchain),
|
|
642
|
-
Promise.resolve(sdk)
|
|
643
|
-
]);
|
|
790
|
+
const { kotlinc } = await ensureToolchain(toolchain);
|
|
644
791
|
const { stdout } = await run3(
|
|
645
792
|
import_node_path5.default.join(import_node_path5.default.dirname(kotlinc), "kotlin"),
|
|
646
793
|
[
|
|
647
794
|
"-cp",
|
|
648
795
|
[
|
|
649
796
|
import_node_path5.default.resolve(import_node_path5.default.dirname(kotlinc), "../lib/kotlin-compiler.jar"),
|
|
650
|
-
import_node_path5.default.join(
|
|
797
|
+
import_node_path5.default.join(sdk.root, "tools.jar")
|
|
651
798
|
].join(import_node_path5.default.delimiter),
|
|
652
|
-
|
|
653
|
-
...
|
|
799
|
+
tool,
|
|
800
|
+
...files
|
|
654
801
|
],
|
|
655
802
|
{ maxBuffer: 16 * 1024 * 1024 }
|
|
656
803
|
);
|
|
657
|
-
return
|
|
804
|
+
return stdout;
|
|
658
805
|
})().catch((error) => {
|
|
659
|
-
|
|
806
|
+
toolScans.delete(key);
|
|
660
807
|
throw error;
|
|
661
808
|
});
|
|
662
|
-
|
|
809
|
+
toolScans.set(key, scan);
|
|
810
|
+
}
|
|
811
|
+
return parse3(await scan);
|
|
812
|
+
}
|
|
813
|
+
async function scanExpoTypes(toolchain, moduleRoot, sources) {
|
|
814
|
+
const candidates = sources.filter(
|
|
815
|
+
(file) => /\bRecord\b|\benum\s+class\b|\bExpoComposeView\b|\bExpoView\b|\bComposeProps\b|:\s*(?:[A-Za-z0-9_.]+\.)?(?:View|FrameLayout|LinearLayout|ViewGroup)\b/.test(
|
|
816
|
+
import_node_fs4.default.readFileSync(file, "utf8")
|
|
817
|
+
)
|
|
818
|
+
);
|
|
819
|
+
if (candidates.length === 0) return [];
|
|
820
|
+
return scanSources(
|
|
821
|
+
"dev.peach.tools.expo.ExpoTypesKt",
|
|
822
|
+
readExpoTypes,
|
|
823
|
+
toolchain,
|
|
824
|
+
moduleRoot,
|
|
825
|
+
candidates
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
async function scanBridgeFiles(moduleRoot, sources) {
|
|
829
|
+
if (sources.length === 0) return [];
|
|
830
|
+
return scanSources(
|
|
831
|
+
"dev.peach.tools.bridge.BridgeModulesKt",
|
|
832
|
+
readBridgeFiles,
|
|
833
|
+
readToolchain(moduleRoot),
|
|
834
|
+
moduleRoot,
|
|
835
|
+
sources
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
var BRIDGE_PARAMETERS = {
|
|
839
|
+
Boolean: "boolean",
|
|
840
|
+
Int: "int",
|
|
841
|
+
Double: "double",
|
|
842
|
+
Float: "float",
|
|
843
|
+
String: "string",
|
|
844
|
+
Callback: "callback",
|
|
845
|
+
Promise: "promise",
|
|
846
|
+
ReadableMap: "map",
|
|
847
|
+
ReadableArray: "array",
|
|
848
|
+
Dynamic: "dynamic"
|
|
849
|
+
};
|
|
850
|
+
var BRIDGE_CASTS = {
|
|
851
|
+
boolean: "Boolean",
|
|
852
|
+
int: "Int",
|
|
853
|
+
double: "Double",
|
|
854
|
+
float: "Float",
|
|
855
|
+
string: "String",
|
|
856
|
+
callback: "com.facebook.react.bridge.Callback",
|
|
857
|
+
promise: "com.facebook.react.bridge.Promise",
|
|
858
|
+
map: "com.facebook.react.bridge.ReadableNativeMap",
|
|
859
|
+
array: "com.facebook.react.bridge.ReadableNativeArray",
|
|
860
|
+
dynamic: "com.facebook.react.bridge.Dynamic"
|
|
861
|
+
};
|
|
862
|
+
var BRIDGE_RETURNS = /* @__PURE__ */ new Set([
|
|
863
|
+
"Boolean",
|
|
864
|
+
"Int",
|
|
865
|
+
"Double",
|
|
866
|
+
"Float",
|
|
867
|
+
"String",
|
|
868
|
+
"WritableMap",
|
|
869
|
+
"WritableArray",
|
|
870
|
+
"Map",
|
|
871
|
+
"MutableMap"
|
|
872
|
+
]);
|
|
873
|
+
var bridgeType = (text) => ({
|
|
874
|
+
nullable: text.trim().endsWith("?"),
|
|
875
|
+
base: text.replace(/\?$/, "").trim().split("<")[0].split(".").pop()
|
|
876
|
+
});
|
|
877
|
+
var JAVA_CLASSES = {
|
|
878
|
+
Long: "long",
|
|
879
|
+
Short: "short",
|
|
880
|
+
Byte: "byte",
|
|
881
|
+
Char: "char"
|
|
882
|
+
};
|
|
883
|
+
function bridgeUnsupported(method) {
|
|
884
|
+
const promise = method.params.findIndex(
|
|
885
|
+
(param) => bridgeType(param.type).base === "Promise"
|
|
886
|
+
);
|
|
887
|
+
if (promise !== -1 && promise !== method.params.length - 1)
|
|
888
|
+
return "Unable to parse JavaScript arg count. Promises must be used as last parameter only.";
|
|
889
|
+
for (const param of method.params) {
|
|
890
|
+
const { base } = bridgeType(param.type);
|
|
891
|
+
if (!BRIDGE_PARAMETERS[base])
|
|
892
|
+
return `Unable to parse JNI signature. Detected unsupported parameter class: ${JAVA_CLASSES[base] ?? base}`;
|
|
663
893
|
}
|
|
664
|
-
|
|
894
|
+
const returns = method.returns === null ? "Unit" : bridgeType(method.returns).base;
|
|
895
|
+
if (method.blocking === (returns === "Unit"))
|
|
896
|
+
return "TurboModule system assumes returnType == void iff the method is synchronous.";
|
|
897
|
+
if (returns !== "Unit" && !BRIDGE_RETURNS.has(returns))
|
|
898
|
+
return `Unable to parse JNI signature. Detected unsupported return class: ${JAVA_CLASSES[returns] ?? returns}`;
|
|
899
|
+
return null;
|
|
900
|
+
}
|
|
901
|
+
function bridgeMethodSource(module2, method) {
|
|
902
|
+
const unsupported = bridgeUnsupported(method);
|
|
903
|
+
const kinds = method.params.map((param) => {
|
|
904
|
+
const { base, nullable } = bridgeType(param.type);
|
|
905
|
+
return `dev.peach.expo.PeachBridgeParam(${JSON.stringify(BRIDGE_PARAMETERS[base] ?? "unsupported")}, ${nullable})`;
|
|
906
|
+
});
|
|
907
|
+
const returnsValue = method.blocking;
|
|
908
|
+
const head = `dev.peach.expo.PeachBridgeMethod(${JSON.stringify(method.name)}, ${method.blocking}, ${returnsValue}, listOf(${kinds.join(", ")}), ${unsupported === null ? "null" : JSON.stringify(unsupported)})`;
|
|
909
|
+
if (unsupported !== null)
|
|
910
|
+
return `${head} { throw UnsupportedOperationException(${JSON.stringify(unsupported)}) }`;
|
|
911
|
+
const args = method.params.map((param, index) => {
|
|
912
|
+
const { base, nullable } = bridgeType(param.type);
|
|
913
|
+
const kind = BRIDGE_PARAMETERS[base];
|
|
914
|
+
const cast = BRIDGE_CASTS[kind];
|
|
915
|
+
const read = `a[${index}] as ${cast}`;
|
|
916
|
+
return nullable || !["string", "map", "array"].includes(kind) ? `${read}${nullable ? "?" : ""}` : `(${read}?) ?: throw NullPointerException(${JSON.stringify(`Parameter specified as non-null is null: method ${module2.className}.${method.name}, parameter ${param.name}`)})`;
|
|
917
|
+
});
|
|
918
|
+
const call = `m.${method.name}(${args.join(", ")})`;
|
|
919
|
+
return `${head} { a -> ${returnsValue ? call : `${call}; null`} }`;
|
|
920
|
+
}
|
|
921
|
+
function bridgeSource(bridge) {
|
|
922
|
+
const modules = bridge.packages.flatMap((hosted) => hosted.modules);
|
|
923
|
+
return [
|
|
924
|
+
" dev.peach.expo.PeachBridgeRuntime.register(",
|
|
925
|
+
` ${JSON.stringify(bridge.applicationId)},`,
|
|
926
|
+
" listOf<() -> com.facebook.react.ReactPackage>(",
|
|
927
|
+
...bridge.packages.map((hosted) => ` { ${hosted.className}() },`),
|
|
928
|
+
" ),",
|
|
929
|
+
" listOf<(com.facebook.react.bridge.NativeModule) -> Map<String, dev.peach.expo.PeachBridgeMethod>?>(",
|
|
930
|
+
...modules.map(
|
|
931
|
+
(module2) => ` { m -> if (m is ${module2.className}) mapOf(${module2.methods.map(
|
|
932
|
+
(method) => `${JSON.stringify(method.name)} to ${bridgeMethodSource(module2, method)}`
|
|
933
|
+
).join(", ")}) else null },`
|
|
934
|
+
),
|
|
935
|
+
" ),",
|
|
936
|
+
" )"
|
|
937
|
+
];
|
|
665
938
|
}
|
|
666
939
|
function expoTypeSources(files) {
|
|
667
940
|
const generated = {};
|
|
@@ -672,9 +945,14 @@ function expoTypeSources(files) {
|
|
|
672
945
|
const calls = [];
|
|
673
946
|
for (const record of file.records) {
|
|
674
947
|
const fields = [];
|
|
948
|
+
const parameters = [];
|
|
675
949
|
for (const field of record.fields) {
|
|
676
950
|
if (field.initializer)
|
|
677
951
|
edits.push({ range: field.initializer, owner: record.name, field });
|
|
952
|
+
else if (field.parameter)
|
|
953
|
+
parameters.push(
|
|
954
|
+
`${field.name} = dev.peach.expo.PeachExpoTypes.initial(${record.name}::class, ${literal(field.key)}, ${field.required}) { dev.peach.expo.PeachExpoTypes.unset() }`
|
|
955
|
+
);
|
|
678
956
|
if (field.hidden) {
|
|
679
957
|
if (!field.initializer)
|
|
680
958
|
throw new Error(
|
|
@@ -692,7 +970,7 @@ function expoTypeSources(files) {
|
|
|
692
970
|
if (record.hidden) continue;
|
|
693
971
|
calls.push(
|
|
694
972
|
[
|
|
695
|
-
` dev.peach.expo.PeachExpoTypes.record(${record.name}::class, ${literal(file.package ? `${file.package}.${record.name}` : record.name)}, { ${record.name}() }, listOf(`,
|
|
973
|
+
` dev.peach.expo.PeachExpoTypes.record(${record.name}::class, ${literal(file.package ? `${file.package}.${record.name}` : record.name)}, { ${record.name}(${parameters.join(", ")}) }, listOf(`,
|
|
696
974
|
...fields,
|
|
697
975
|
" ))"
|
|
698
976
|
].join("\n")
|
|
@@ -774,6 +1052,7 @@ async function expoKotlinArtifact(root, moduleRoot, origin, modules) {
|
|
|
774
1052
|
"",
|
|
775
1053
|
"private val registered by lazy {",
|
|
776
1054
|
...types.registrations.map((call) => ` ${call}`),
|
|
1055
|
+
...modules.bridge ? bridgeSource(modules.bridge) : [],
|
|
777
1056
|
" PeachExpoRuntime.register(listOf(",
|
|
778
1057
|
...modules.modules.map(
|
|
779
1058
|
({ classifier, name }) => ` { ${classifier}() } to ${name === null ? "null" : JSON.stringify(name)},`
|
|
@@ -781,6 +1060,9 @@ async function expoKotlinArtifact(root, moduleRoot, origin, modules) {
|
|
|
781
1060
|
" ))",
|
|
782
1061
|
"}",
|
|
783
1062
|
"",
|
|
1063
|
+
"@JsExport fun peachSetAndroidBuildInfo(model: String, release: String) =",
|
|
1064
|
+
" android.os.Build.setDevice(model, release)",
|
|
1065
|
+
"",
|
|
784
1066
|
"@JsExport fun peachExpoListen(notify: () -> Unit) {",
|
|
785
1067
|
" registered",
|
|
786
1068
|
" PeachExpoRuntime.listen(notify)",
|
|
@@ -1266,7 +1548,7 @@ async function compileKotlin(input, origin) {
|
|
|
1266
1548
|
import_node_path5.default.join(work, "js")
|
|
1267
1549
|
]);
|
|
1268
1550
|
const skikoPath = import_node_path5.default.join(work, "js", "skiko.mjs");
|
|
1269
|
-
const upstream = (0,
|
|
1551
|
+
const upstream = (0, import_acorn2.parse)(import_node_fs4.default.readFileSync(skikoPath, "utf8"), {
|
|
1270
1552
|
ecmaVersion: "latest",
|
|
1271
1553
|
sourceType: "module"
|
|
1272
1554
|
});
|
|
@@ -1371,22 +1653,27 @@ ${output.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
1371
1653
|
}
|
|
1372
1654
|
const entry = import_node_path5.default.join(work, "js/app.mjs");
|
|
1373
1655
|
const entrySource2 = import_node_fs4.default.readFileSync(entry, "utf8");
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
(statement) => statement.type === "ExportDefaultDeclaration" || statement.type === "ExportNamedDeclaration" && statement.specifiers.some(
|
|
1379
|
-
(specifier) => specifier.exported.type === "Identifier" && specifier.exported.name === "default"
|
|
1380
|
-
)
|
|
1656
|
+
const importsPath = import_node_path5.default.join(work, "js/app.import-object.mjs");
|
|
1657
|
+
const importsFactory = kotlinInstanceSource(
|
|
1658
|
+
import_node_fs4.default.readFileSync(importsPath, "utf8"),
|
|
1659
|
+
"createKotlinImportObject"
|
|
1381
1660
|
);
|
|
1382
|
-
|
|
1661
|
+
const runtimeFactory = kotlinInstanceSource(
|
|
1662
|
+
entrySource2,
|
|
1663
|
+
"createKotlinInstance",
|
|
1664
|
+
/* @__PURE__ */ new Map([["./app.import-object.mjs", "createKotlinImportObject"]])
|
|
1665
|
+
);
|
|
1666
|
+
import_node_fs4.default.writeFileSync(importsPath, importsFactory.source);
|
|
1667
|
+
import_node_fs4.default.writeFileSync(import_node_path5.default.join(work, "js/app-runtime.mjs"), runtimeFactory.source);
|
|
1383
1668
|
import_node_fs4.default.writeFileSync(
|
|
1384
1669
|
entry,
|
|
1385
1670
|
[
|
|
1386
|
-
"
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1671
|
+
"import { createKotlinInstance } from './app-runtime.mjs';",
|
|
1672
|
+
"const instance = await createKotlinInstance();",
|
|
1673
|
+
...runtimeFactory.exports.map(
|
|
1674
|
+
({ exported }) => exported === "default" ? "export default instance.default;" : `export const ${exported} = instance[${JSON.stringify(exported)}];`
|
|
1675
|
+
),
|
|
1676
|
+
"instance.peachInitializeModuleBindings();",
|
|
1390
1677
|
""
|
|
1391
1678
|
].join("\n")
|
|
1392
1679
|
);
|
|
@@ -1458,6 +1745,7 @@ async function serveKotlinRequest(pathname, res, app) {
|
|
|
1458
1745
|
kotlinArtifactFiles,
|
|
1459
1746
|
kotlinSources,
|
|
1460
1747
|
peachKotlinModuleRoot,
|
|
1748
|
+
scanBridgeFiles,
|
|
1461
1749
|
serveKotlinArtifact,
|
|
1462
1750
|
serveKotlinRequest
|
|
1463
1751
|
});
|
package/dist-lib/menu.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1738 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -283,6 +283,12 @@ function deviceMenu(state, deviceChoices) {
|
|
|
283
283
|
},
|
|
284
284
|
{ type: "separator" },
|
|
285
285
|
{ label: "Trigger Screenshot", action: "screenshot" },
|
|
286
|
+
{
|
|
287
|
+
label: "Connect Hardware Keyboard",
|
|
288
|
+
type: "checkbox",
|
|
289
|
+
checked: state.hardwareKeyboard,
|
|
290
|
+
action: "toggle-hardware-keyboard"
|
|
291
|
+
},
|
|
286
292
|
// pose controls for the current device: open/close, book and laptop on
|
|
287
293
|
// foldables, rotate left/right wherever a turn changes geometry, the way
|
|
288
294
|
// ios simulator holds them (rotate left is cmd+left, rotate right
|
|
@@ -458,6 +464,12 @@ function windowMenu(state) {
|
|
|
458
464
|
checked: state.showTouches,
|
|
459
465
|
action: "toggle-touches"
|
|
460
466
|
},
|
|
467
|
+
{
|
|
468
|
+
label: "Use System Cursor",
|
|
469
|
+
type: "checkbox",
|
|
470
|
+
checked: state.systemCursor,
|
|
471
|
+
action: "toggle-system-cursor"
|
|
472
|
+
},
|
|
461
473
|
{
|
|
462
474
|
label: "Show Menu Bar",
|
|
463
475
|
type: "checkbox",
|
package/dist-lib/menu.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1738 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/public-brand.ts
|
|
4
4
|
var name = "Peach";
|
|
@@ -235,6 +235,12 @@ function deviceMenu(state, deviceChoices) {
|
|
|
235
235
|
},
|
|
236
236
|
{ type: "separator" },
|
|
237
237
|
{ label: "Trigger Screenshot", action: "screenshot" },
|
|
238
|
+
{
|
|
239
|
+
label: "Connect Hardware Keyboard",
|
|
240
|
+
type: "checkbox",
|
|
241
|
+
checked: state.hardwareKeyboard,
|
|
242
|
+
action: "toggle-hardware-keyboard"
|
|
243
|
+
},
|
|
238
244
|
// pose controls for the current device: open/close, book and laptop on
|
|
239
245
|
// foldables, rotate left/right wherever a turn changes geometry, the way
|
|
240
246
|
// ios simulator holds them (rotate left is cmd+left, rotate right
|
|
@@ -410,6 +416,12 @@ function windowMenu(state) {
|
|
|
410
416
|
checked: state.showTouches,
|
|
411
417
|
action: "toggle-touches"
|
|
412
418
|
},
|
|
419
|
+
{
|
|
420
|
+
label: "Use System Cursor",
|
|
421
|
+
type: "checkbox",
|
|
422
|
+
checked: state.systemCursor,
|
|
423
|
+
action: "toggle-system-cursor"
|
|
424
|
+
},
|
|
413
425
|
{
|
|
414
426
|
label: "Show Menu Bar",
|
|
415
427
|
type: "checkbox",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1738 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1738 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1738 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __esm = (fn, res) => function __init() {
|