peachsim 0.1.1728 → 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/cli/commands/control.ts +1 -0
- package/cli/commands/coverage-swift.ts +112 -4
- package/cli/commands/package.ts +11 -1
- package/cli/commands/shell-url.ts +4 -0
- package/cli/scene-video.ts +24 -7
- package/detox/index.ts +9 -1
- 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 +3592 -1918
- 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 +13 -5
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +1329 -1022
- package/dist-lib/expo-swift-metadata.cjs +2 -2
- package/dist-lib/expo-swift-metadata.mjs +2 -2
- package/dist-lib/home-paths.cjs +7 -2
- package/dist-lib/host/bridge-host.cjs +3773 -2149
- package/dist-lib/host/fetch-proxy-handler.cjs +16 -5
- 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 +97 -68
- 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 +209 -32
- package/dist-lib/menu.cjs +7 -1
- package/dist-lib/menu.mjs +7 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +93 -65
- package/dist-lib/native-app-identity-project.cjs +37 -31
- package/dist-lib/native-app-identity-project.mjs +37 -31
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/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 +23 -23
- package/dist-lib/public-origins-lib.json +79 -53
- package/dist-lib/react-native-host-modules.cjs +5 -2
- package/dist-lib/react-native-host-modules.mjs +5 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +4486 -2789
- package/dist-lib/swift-compile.cjs +53 -60
- package/dist-lib/swift-compile.mjs +52 -60
- 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 +17 -17
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +1056 -870
- package/dist-lib/vite.cjs +20 -8
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- 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 +2 -1
- 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 +8 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +4 -1
- 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/native-preview-bundle.d.ts +2 -0
- 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 +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +13 -1
- 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/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/CoreGraphics.framework/Headers/CoreGraphics.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +58 -3
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +636 -37
- package/sdk/ios/usr/include/os/signpost.h +414 -0
- package/sdk/ios/usr/include/os.modulemap +5 -0
- package/sdk/ios/wasm/include/errno.h +4 -20
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/setjmp.h +57 -0
- package/sdk/ios/wasm/include/sys/resource.h +2 -2
- package/sdk/native-hashes.json +3 -3
- 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 +0 -1
- package/skills/peach-visual/SKILL.md +0 -1
- package/src/android-autolinking.ts +1 -0
- package/src/android-bridge-packages.ts +279 -0
- package/src/appPackageContract.ts +2 -0
- package/src/bundle-channel.mjs +20 -2
- package/src/cli-runtime.ts +9 -5
- package/src/expo-discovery-cache.ts +7 -3
- package/src/expo-kotlin-host.ts +97 -26
- package/src/expo-native-workspace.ts +135 -40
- package/src/expo-swift-host.ts +93 -20
- package/src/expo-swift-ready.ts +5 -1
- package/src/expoKotlinContract.ts +12 -2
- package/src/expoSwiftContract.ts +9 -2
- package/src/generated/swift-c-predefines.json +1 -1
- package/src/home-paths.ts +6 -1
- package/src/host/bridge-host.ts +5 -0
- package/src/host/fetch-proxy-handler.ts +10 -0
- package/src/kotlin-host.ts +204 -30
- package/src/kotlinSdkContract.ts +2 -1
- package/src/menu.ts +7 -0
- package/src/native-prebuilt.ts +154 -0
- package/src/nitro-adapter.lock.json +251 -251
- package/src/nitro-adapter.ts +56 -50
- package/src/nitro-bundle.ts +84 -74
- package/src/nitro-compile.ts +10 -5
- package/src/nitro-dependencies.ts +43 -28
- package/src/nitro-source.ts +60 -26
- package/src/nitroAdapterContract.ts +146 -98
- package/src/nitroContract.ts +64 -21
- package/src/react-native-bridge-modules.ts +2 -0
- package/src/react-native-host-modules.ts +4 -1
- package/src/settingsContract.ts +11 -0
- package/src/storageSnapshotContract.ts +29 -81
- package/src/swift-compile.ts +49 -50
- package/src/swift-coverage/indexdump.ts +22 -6
- package/src/swift-coverage/indexing.ts +4 -4
- package/src/swift-coverage/sdk.ts +104 -20
- package/src/swift-coverage/types.ts +34 -0
- package/src/swift-coverage/xcode.ts +9 -1
- package/src/swift-distribution.lock.json +15 -12
- package/src/swift-host.ts +3 -0
- package/src/swift-standin-emit.ts +6 -1
- package/src/swift-standins.ts +172 -10
- package/src/swift-submit.ts +5 -1
- package/src/swift-toolchain.ts +16 -16
- package/src/turbo-bundle.ts +81 -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 +4 -3
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
|
});
|
|
@@ -56,6 +57,51 @@ 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
|
+
|
|
59
105
|
// src/kotlin-instance-source.ts
|
|
60
106
|
var import_acorn = require("acorn");
|
|
61
107
|
function bindingNames(pattern) {
|
|
@@ -180,10 +226,13 @@ var import_node_util = require("node:util");
|
|
|
180
226
|
var import_node_os = require("node:os");
|
|
181
227
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
182
228
|
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
229
|
+
function ambientHomeDir() {
|
|
230
|
+
return import_node_path.default.join((0, import_node_os.homedir)(), ".peach");
|
|
231
|
+
}
|
|
183
232
|
function rnxHomeDir() {
|
|
184
233
|
const override = process.env[PEACH_HOME_ENV];
|
|
185
234
|
if (override && override.length > 0) return import_node_path.default.resolve(override);
|
|
186
|
-
return
|
|
235
|
+
return ambientHomeDir();
|
|
187
236
|
}
|
|
188
237
|
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
189
238
|
|
|
@@ -310,13 +359,14 @@ var KOTLIN_SDK_PROFILES = {
|
|
|
310
359
|
},
|
|
311
360
|
expo: {
|
|
312
361
|
compose: false,
|
|
313
|
-
directories: [...platform, "ExpoSources", "AndroidViewSources"]
|
|
362
|
+
directories: [...platform, "ExpoSources", "BridgeSources", "AndroidViewSources"]
|
|
314
363
|
},
|
|
315
364
|
expoCompose: {
|
|
316
365
|
compose: true,
|
|
317
366
|
directories: [
|
|
318
367
|
...platform,
|
|
319
368
|
"ExpoSources",
|
|
369
|
+
"BridgeSources",
|
|
320
370
|
"AndroidViewSources",
|
|
321
371
|
"ComposeSources",
|
|
322
372
|
"ExpoComposeSources"
|
|
@@ -413,7 +463,7 @@ var VIEW_MODEL = "androidx.lifecycle.ViewModel";
|
|
|
413
463
|
var ANDROID_VIEW_MODEL = "androidx.lifecycle.AndroidViewModel";
|
|
414
464
|
var APPLICATION = "android.app.Application";
|
|
415
465
|
var HANDLE = "androidx.lifecycle.SavedStateHandle";
|
|
416
|
-
function
|
|
466
|
+
function strings2(value) {
|
|
417
467
|
if (!Array.isArray(value) || !value.every((item) => typeof item === "string"))
|
|
418
468
|
throw new Error("abi-classes printed an invalid list");
|
|
419
469
|
return value;
|
|
@@ -429,12 +479,12 @@ function readAbiClasses(output) {
|
|
|
429
479
|
modality: row.modality,
|
|
430
480
|
inner: row.inner,
|
|
431
481
|
generic: row.generic,
|
|
432
|
-
supers:
|
|
482
|
+
supers: strings2(row.supers),
|
|
433
483
|
constructors: row.constructors.map((constructor) => {
|
|
434
484
|
if (!isRecord(constructor) || typeof constructor.defaulted !== "boolean")
|
|
435
485
|
throw new Error(`abi-classes printed an invalid constructor: ${line}`);
|
|
436
486
|
return {
|
|
437
|
-
parameters:
|
|
487
|
+
parameters: strings2(constructor.parameters),
|
|
438
488
|
defaulted: constructor.defaulted
|
|
439
489
|
};
|
|
440
490
|
})
|
|
@@ -665,7 +715,7 @@ async function kotlinArtifact(root, moduleRoot, origin, target = "app") {
|
|
|
665
715
|
);
|
|
666
716
|
}
|
|
667
717
|
function readExpoField(value) {
|
|
668
|
-
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")
|
|
669
719
|
throw new Error("expo-types printed an invalid field");
|
|
670
720
|
const range = value.initializer;
|
|
671
721
|
if (range !== null && (!Array.isArray(range) || range.length !== 2 || typeof range[0] !== "number" || typeof range[1] !== "number"))
|
|
@@ -676,6 +726,7 @@ function readExpoField(value) {
|
|
|
676
726
|
required: value.required,
|
|
677
727
|
mutable: value.mutable,
|
|
678
728
|
hidden: value.hidden,
|
|
729
|
+
parameter: value.parameter,
|
|
679
730
|
initializer: range === null ? null : [range[0], range[1]]
|
|
680
731
|
};
|
|
681
732
|
}
|
|
@@ -725,49 +776,165 @@ function readExpoTypes(output) {
|
|
|
725
776
|
};
|
|
726
777
|
});
|
|
727
778
|
}
|
|
728
|
-
var
|
|
729
|
-
async function
|
|
730
|
-
const candidates = sources.filter(
|
|
731
|
-
(file) => /\bRecord\b|\benum\s+class\b|\bExpoComposeView\b|\bExpoView\b|\bComposeProps\b|:\s*(?:[A-Za-z0-9_.]+\.)?(?:View|FrameLayout|LinearLayout|ViewGroup)\b/.test(
|
|
732
|
-
import_node_fs4.default.readFileSync(file, "utf8")
|
|
733
|
-
)
|
|
734
|
-
);
|
|
735
|
-
if (candidates.length === 0) return Promise.resolve([]);
|
|
779
|
+
var toolScans = /* @__PURE__ */ new Map();
|
|
780
|
+
async function scanSources(tool, parse3, toolchain, moduleRoot, files) {
|
|
736
781
|
const digest = (0, import_node_crypto4.createHash)("sha256").update(JSON.stringify(toolchain.compiler));
|
|
737
782
|
const sdk = await loadKotlinSdk(moduleRoot, toolchain);
|
|
738
|
-
|
|
739
|
-
digest.update(
|
|
740
|
-
for (const file of
|
|
741
|
-
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`);
|
|
742
786
|
const key = digest.digest("hex");
|
|
743
|
-
let scan =
|
|
787
|
+
let scan = toolScans.get(key);
|
|
744
788
|
if (!scan) {
|
|
745
789
|
scan = (async () => {
|
|
746
|
-
const
|
|
747
|
-
ensureToolchain(toolchain),
|
|
748
|
-
Promise.resolve(sdk)
|
|
749
|
-
]);
|
|
790
|
+
const { kotlinc } = await ensureToolchain(toolchain);
|
|
750
791
|
const { stdout } = await run3(
|
|
751
792
|
import_node_path5.default.join(import_node_path5.default.dirname(kotlinc), "kotlin"),
|
|
752
793
|
[
|
|
753
794
|
"-cp",
|
|
754
795
|
[
|
|
755
796
|
import_node_path5.default.resolve(import_node_path5.default.dirname(kotlinc), "../lib/kotlin-compiler.jar"),
|
|
756
|
-
import_node_path5.default.join(
|
|
797
|
+
import_node_path5.default.join(sdk.root, "tools.jar")
|
|
757
798
|
].join(import_node_path5.default.delimiter),
|
|
758
|
-
|
|
759
|
-
...
|
|
799
|
+
tool,
|
|
800
|
+
...files
|
|
760
801
|
],
|
|
761
802
|
{ maxBuffer: 16 * 1024 * 1024 }
|
|
762
803
|
);
|
|
763
|
-
return
|
|
804
|
+
return stdout;
|
|
764
805
|
})().catch((error) => {
|
|
765
|
-
|
|
806
|
+
toolScans.delete(key);
|
|
766
807
|
throw error;
|
|
767
808
|
});
|
|
768
|
-
|
|
809
|
+
toolScans.set(key, scan);
|
|
769
810
|
}
|
|
770
|
-
return scan;
|
|
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}`;
|
|
893
|
+
}
|
|
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
|
+
];
|
|
771
938
|
}
|
|
772
939
|
function expoTypeSources(files) {
|
|
773
940
|
const generated = {};
|
|
@@ -778,9 +945,14 @@ function expoTypeSources(files) {
|
|
|
778
945
|
const calls = [];
|
|
779
946
|
for (const record of file.records) {
|
|
780
947
|
const fields = [];
|
|
948
|
+
const parameters = [];
|
|
781
949
|
for (const field of record.fields) {
|
|
782
950
|
if (field.initializer)
|
|
783
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
|
+
);
|
|
784
956
|
if (field.hidden) {
|
|
785
957
|
if (!field.initializer)
|
|
786
958
|
throw new Error(
|
|
@@ -798,7 +970,7 @@ function expoTypeSources(files) {
|
|
|
798
970
|
if (record.hidden) continue;
|
|
799
971
|
calls.push(
|
|
800
972
|
[
|
|
801
|
-
` 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(`,
|
|
802
974
|
...fields,
|
|
803
975
|
" ))"
|
|
804
976
|
].join("\n")
|
|
@@ -880,6 +1052,7 @@ async function expoKotlinArtifact(root, moduleRoot, origin, modules) {
|
|
|
880
1052
|
"",
|
|
881
1053
|
"private val registered by lazy {",
|
|
882
1054
|
...types.registrations.map((call) => ` ${call}`),
|
|
1055
|
+
...modules.bridge ? bridgeSource(modules.bridge) : [],
|
|
883
1056
|
" PeachExpoRuntime.register(listOf(",
|
|
884
1057
|
...modules.modules.map(
|
|
885
1058
|
({ classifier, name }) => ` { ${classifier}() } to ${name === null ? "null" : JSON.stringify(name)},`
|
|
@@ -887,6 +1060,9 @@ async function expoKotlinArtifact(root, moduleRoot, origin, modules) {
|
|
|
887
1060
|
" ))",
|
|
888
1061
|
"}",
|
|
889
1062
|
"",
|
|
1063
|
+
"@JsExport fun peachSetAndroidBuildInfo(model: String, release: String) =",
|
|
1064
|
+
" android.os.Build.setDevice(model, release)",
|
|
1065
|
+
"",
|
|
890
1066
|
"@JsExport fun peachExpoListen(notify: () -> Unit) {",
|
|
891
1067
|
" registered",
|
|
892
1068
|
" PeachExpoRuntime.listen(notify)",
|
|
@@ -1569,6 +1745,7 @@ async function serveKotlinRequest(pathname, res, app) {
|
|
|
1569
1745
|
kotlinArtifactFiles,
|
|
1570
1746
|
kotlinSources,
|
|
1571
1747
|
peachKotlinModuleRoot,
|
|
1748
|
+
scanBridgeFiles,
|
|
1572
1749
|
serveKotlinArtifact,
|
|
1573
1750
|
serveKotlinRequest
|
|
1574
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
|
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
|
|
@@ -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() {
|