peachsim 0.1.801 → 0.1.810
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/outbound-endpoints.ts +4 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +11 -4
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +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/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +11 -4
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +131 -102
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- 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 +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- 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 +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.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 +137 -108
- package/dist-lib/swift-compile.cjs +11 -4
- package/dist-lib/swift-compile.mjs +11 -4
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +11 -4
- package/dist-lib/vite.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +119 -0
- package/dist-lib/worklet-executable.mjs +93 -0
- package/package.json +9 -1
- package/src/swift-compile.ts +11 -2
- package/src/vite-plugin.ts +5 -2
- package/src/worklet-executable.ts +125 -0
- package/src/worklets-babel.ts +47 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.810 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -650,7 +650,7 @@ var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
|
|
|
650
650
|
var MULTI_MANIFEST_VERSION = 12;
|
|
651
651
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
652
652
|
const hash = (0, import_node_crypto2.createHash)("sha256");
|
|
653
|
-
hash.update(`swift-compile/
|
|
653
|
+
hash.update(`swift-compile/v20
|
|
654
654
|
${release}
|
|
655
655
|
`);
|
|
656
656
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -1283,7 +1283,9 @@ function lowerTableProtocolMethods(source, conformances) {
|
|
|
1283
1283
|
numberOfRowsInSection: "tableView:numberOfRowsInSection:",
|
|
1284
1284
|
cellForRowAt: "tableView:cellForRowAtIndexPath:",
|
|
1285
1285
|
titleForHeaderInSection: "tableView:titleForHeaderInSection:",
|
|
1286
|
-
titleForFooterInSection: "tableView:titleForFooterInSection:"
|
|
1286
|
+
titleForFooterInSection: "tableView:titleForFooterInSection:",
|
|
1287
|
+
canEditRowAt: "tableView:canEditRowAtIndexPath:",
|
|
1288
|
+
commit: "tableView:commitEditingStyle:forRowAtIndexPath:"
|
|
1287
1289
|
};
|
|
1288
1290
|
const delegate = {
|
|
1289
1291
|
willDisplay: "tableView:willDisplayCell:forRowAtIndexPath:",
|
|
@@ -1307,7 +1309,12 @@ function lowerTableProtocolMethods(source, conformances) {
|
|
|
1307
1309
|
willDeselectRowAt: "tableView:willDeselectRowAtIndexPath:",
|
|
1308
1310
|
didSelectRowAt: "tableView:didSelectRowAtIndexPath:",
|
|
1309
1311
|
didDeselectRowAt: "tableView:didDeselectRowAtIndexPath:",
|
|
1310
|
-
accessoryButtonTappedForRowWith: "tableView:accessoryButtonTappedForRowWithIndexPath:"
|
|
1312
|
+
accessoryButtonTappedForRowWith: "tableView:accessoryButtonTappedForRowWithIndexPath:",
|
|
1313
|
+
editingStyleForRowAt: "tableView:editingStyleForRowAtIndexPath:",
|
|
1314
|
+
leadingSwipeActionsConfigurationForRowAt: "tableView:leadingSwipeActionsConfigurationForRowAtIndexPath:",
|
|
1315
|
+
trailingSwipeActionsConfigurationForRowAt: "tableView:trailingSwipeActionsConfigurationForRowAtIndexPath:",
|
|
1316
|
+
willBeginEditingRowAt: "tableView:willBeginEditingRowAtIndexPath:",
|
|
1317
|
+
didEndEditingRowAt: "tableView:didEndEditingRowAtIndexPath:"
|
|
1311
1318
|
};
|
|
1312
1319
|
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
1313
1320
|
const edits = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.810 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/swift-compile.ts
|
|
4
4
|
import { execFile as execFile2, execFileSync } from "node:child_process";
|
|
@@ -596,7 +596,7 @@ var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
|
|
|
596
596
|
var MULTI_MANIFEST_VERSION = 12;
|
|
597
597
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
598
598
|
const hash = createHash2("sha256");
|
|
599
|
-
hash.update(`swift-compile/
|
|
599
|
+
hash.update(`swift-compile/v20
|
|
600
600
|
${release}
|
|
601
601
|
`);
|
|
602
602
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -1229,7 +1229,9 @@ function lowerTableProtocolMethods(source, conformances) {
|
|
|
1229
1229
|
numberOfRowsInSection: "tableView:numberOfRowsInSection:",
|
|
1230
1230
|
cellForRowAt: "tableView:cellForRowAtIndexPath:",
|
|
1231
1231
|
titleForHeaderInSection: "tableView:titleForHeaderInSection:",
|
|
1232
|
-
titleForFooterInSection: "tableView:titleForFooterInSection:"
|
|
1232
|
+
titleForFooterInSection: "tableView:titleForFooterInSection:",
|
|
1233
|
+
canEditRowAt: "tableView:canEditRowAtIndexPath:",
|
|
1234
|
+
commit: "tableView:commitEditingStyle:forRowAtIndexPath:"
|
|
1233
1235
|
};
|
|
1234
1236
|
const delegate = {
|
|
1235
1237
|
willDisplay: "tableView:willDisplayCell:forRowAtIndexPath:",
|
|
@@ -1253,7 +1255,12 @@ function lowerTableProtocolMethods(source, conformances) {
|
|
|
1253
1255
|
willDeselectRowAt: "tableView:willDeselectRowAtIndexPath:",
|
|
1254
1256
|
didSelectRowAt: "tableView:didSelectRowAtIndexPath:",
|
|
1255
1257
|
didDeselectRowAt: "tableView:didDeselectRowAtIndexPath:",
|
|
1256
|
-
accessoryButtonTappedForRowWith: "tableView:accessoryButtonTappedForRowWithIndexPath:"
|
|
1258
|
+
accessoryButtonTappedForRowWith: "tableView:accessoryButtonTappedForRowWithIndexPath:",
|
|
1259
|
+
editingStyleForRowAt: "tableView:editingStyleForRowAtIndexPath:",
|
|
1260
|
+
leadingSwipeActionsConfigurationForRowAt: "tableView:leadingSwipeActionsConfigurationForRowAtIndexPath:",
|
|
1261
|
+
trailingSwipeActionsConfigurationForRowAt: "tableView:trailingSwipeActionsConfigurationForRowAtIndexPath:",
|
|
1262
|
+
willBeginEditingRowAt: "tableView:willBeginEditingRowAtIndexPath:",
|
|
1263
|
+
didEndEditingRowAt: "tableView:didEndEditingRowAtIndexPath:"
|
|
1257
1264
|
};
|
|
1258
1265
|
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
1259
1266
|
const edits = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.810 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.810 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.810 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
package/dist-lib/swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.810 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.810 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -2042,7 +2042,7 @@ var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
|
|
|
2042
2042
|
var MULTI_MANIFEST_VERSION = 12;
|
|
2043
2043
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
2044
2044
|
const hash = (0, import_node_crypto2.createHash)("sha256");
|
|
2045
|
-
hash.update(`swift-compile/
|
|
2045
|
+
hash.update(`swift-compile/v20
|
|
2046
2046
|
${release}
|
|
2047
2047
|
`);
|
|
2048
2048
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -2675,7 +2675,9 @@ function lowerTableProtocolMethods(source, conformances) {
|
|
|
2675
2675
|
numberOfRowsInSection: "tableView:numberOfRowsInSection:",
|
|
2676
2676
|
cellForRowAt: "tableView:cellForRowAtIndexPath:",
|
|
2677
2677
|
titleForHeaderInSection: "tableView:titleForHeaderInSection:",
|
|
2678
|
-
titleForFooterInSection: "tableView:titleForFooterInSection:"
|
|
2678
|
+
titleForFooterInSection: "tableView:titleForFooterInSection:",
|
|
2679
|
+
canEditRowAt: "tableView:canEditRowAtIndexPath:",
|
|
2680
|
+
commit: "tableView:commitEditingStyle:forRowAtIndexPath:"
|
|
2679
2681
|
};
|
|
2680
2682
|
const delegate = {
|
|
2681
2683
|
willDisplay: "tableView:willDisplayCell:forRowAtIndexPath:",
|
|
@@ -2699,7 +2701,12 @@ function lowerTableProtocolMethods(source, conformances) {
|
|
|
2699
2701
|
willDeselectRowAt: "tableView:willDeselectRowAtIndexPath:",
|
|
2700
2702
|
didSelectRowAt: "tableView:didSelectRowAtIndexPath:",
|
|
2701
2703
|
didDeselectRowAt: "tableView:didDeselectRowAtIndexPath:",
|
|
2702
|
-
accessoryButtonTappedForRowWith: "tableView:accessoryButtonTappedForRowWithIndexPath:"
|
|
2704
|
+
accessoryButtonTappedForRowWith: "tableView:accessoryButtonTappedForRowWithIndexPath:",
|
|
2705
|
+
editingStyleForRowAt: "tableView:editingStyleForRowAtIndexPath:",
|
|
2706
|
+
leadingSwipeActionsConfigurationForRowAt: "tableView:leadingSwipeActionsConfigurationForRowAtIndexPath:",
|
|
2707
|
+
trailingSwipeActionsConfigurationForRowAt: "tableView:trailingSwipeActionsConfigurationForRowAtIndexPath:",
|
|
2708
|
+
willBeginEditingRowAt: "tableView:willBeginEditingRowAtIndexPath:",
|
|
2709
|
+
didEndEditingRowAt: "tableView:didEndEditingRowAtIndexPath:"
|
|
2703
2710
|
};
|
|
2704
2711
|
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
2705
2712
|
const edits = [];
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.810 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/*! rnx v0.1.810 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
|
+
"use strict";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/worklet-executable.ts
|
|
23
|
+
var worklet_executable_exports = {};
|
|
24
|
+
__export(worklet_executable_exports, {
|
|
25
|
+
compileWorkletExecutables: () => compileWorkletExecutables,
|
|
26
|
+
workletExecutableBodies: () => workletExecutableBodies
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(worklet_executable_exports);
|
|
29
|
+
var import_acorn = require("acorn");
|
|
30
|
+
function isNode(value) {
|
|
31
|
+
return value !== null && typeof value === "object" && typeof Reflect.get(value, "type") === "string";
|
|
32
|
+
}
|
|
33
|
+
function walk(node, visit) {
|
|
34
|
+
visit(node);
|
|
35
|
+
for (const value of Object.values(node)) {
|
|
36
|
+
if (isNode(value)) walk(value, visit);
|
|
37
|
+
else if (Array.isArray(value)) {
|
|
38
|
+
for (const child of value) if (isNode(child)) walk(child, visit);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function propertyName(node) {
|
|
43
|
+
if (!isNode(node)) return void 0;
|
|
44
|
+
const name = Reflect.get(node, node.type === "Identifier" ? "name" : "value");
|
|
45
|
+
return typeof name === "string" ? name : void 0;
|
|
46
|
+
}
|
|
47
|
+
function workletExecutableBodies(syntax) {
|
|
48
|
+
if (!isNode(syntax)) throw new Error("peach: expected worklet syntax");
|
|
49
|
+
const tree = syntax;
|
|
50
|
+
const initNames = /* @__PURE__ */ new Set();
|
|
51
|
+
const objects = /* @__PURE__ */ new Set();
|
|
52
|
+
walk(tree, (node) => {
|
|
53
|
+
if (node.type !== "AssignmentExpression") return;
|
|
54
|
+
const left = Reflect.get(node, "left");
|
|
55
|
+
if (!isNode(left) || left.type !== "MemberExpression" || propertyName(Reflect.get(left, "property")) !== "__initData")
|
|
56
|
+
return;
|
|
57
|
+
const right = Reflect.get(node, "right");
|
|
58
|
+
if (!isNode(right)) return;
|
|
59
|
+
if (right.type === "ObjectExpression") objects.add(right);
|
|
60
|
+
else if (right.type === "Identifier") {
|
|
61
|
+
const name = propertyName(right);
|
|
62
|
+
if (name) initNames.add(name);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
walk(tree, (node) => {
|
|
66
|
+
if (node.type !== "VariableDeclarator") return;
|
|
67
|
+
const name = propertyName(Reflect.get(node, "id"));
|
|
68
|
+
const init = Reflect.get(node, "init");
|
|
69
|
+
if (name && initNames.has(name) && isNode(init) && init.type === "ObjectExpression") {
|
|
70
|
+
objects.add(init);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const bodies = [];
|
|
74
|
+
for (const object of objects) {
|
|
75
|
+
const properties = Reflect.get(object, "properties");
|
|
76
|
+
if (!Array.isArray(properties)) continue;
|
|
77
|
+
if (properties.some(
|
|
78
|
+
(property2) => isNode(property2) && propertyName(Reflect.get(property2, "key")) === "__peachExecutable"
|
|
79
|
+
))
|
|
80
|
+
continue;
|
|
81
|
+
const property = properties.find(
|
|
82
|
+
(property2) => isNode(property2) && ["Property", "ObjectProperty"].includes(property2.type) && propertyName(Reflect.get(property2, "key")) === "code"
|
|
83
|
+
);
|
|
84
|
+
if (!isNode(property)) continue;
|
|
85
|
+
const literal = Reflect.get(property, "value");
|
|
86
|
+
const code = isNode(literal) && Reflect.get(literal, "value");
|
|
87
|
+
if (typeof code !== "string") {
|
|
88
|
+
throw new Error("peach: worklet init data requires literal code at build time");
|
|
89
|
+
}
|
|
90
|
+
bodies.push({ initData: object, codeProperty: property, code });
|
|
91
|
+
}
|
|
92
|
+
return bodies;
|
|
93
|
+
}
|
|
94
|
+
function compileWorkletExecutables(source, onInsert) {
|
|
95
|
+
if (!source.includes("__initData")) return source;
|
|
96
|
+
const tree = (0, import_acorn.parse)(source, { ecmaVersion: "latest", sourceType: "module" });
|
|
97
|
+
const edits = workletExecutableBodies(tree).map(({ codeProperty, code }) => {
|
|
98
|
+
const body = compileWorkletExecutables(code);
|
|
99
|
+
const expression = (0, import_acorn.parse)(`(${body})`, { ecmaVersion: "latest" }).body[0];
|
|
100
|
+
const fn = expression && Reflect.get(expression, "expression");
|
|
101
|
+
if (!isNode(fn) || !["FunctionExpression", "ArrowFunctionExpression"].includes(fn.type)) {
|
|
102
|
+
throw new Error("peach: worklet code did not compile to a function");
|
|
103
|
+
}
|
|
104
|
+
const offset = Reflect.get(codeProperty, "end");
|
|
105
|
+
if (typeof offset !== "number") throw new Error("peach: worklet code has no offset");
|
|
106
|
+
return { offset, text: `, __peachExecutable: (${body})` };
|
|
107
|
+
});
|
|
108
|
+
let compiled = source;
|
|
109
|
+
for (const edit of edits.sort((a, b) => b.offset - a.offset)) {
|
|
110
|
+
onInsert?.(edit.offset, edit.text);
|
|
111
|
+
compiled = compiled.slice(0, edit.offset) + edit.text + compiled.slice(edit.offset);
|
|
112
|
+
}
|
|
113
|
+
return compiled;
|
|
114
|
+
}
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
compileWorkletExecutables,
|
|
118
|
+
workletExecutableBodies
|
|
119
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*! rnx v0.1.810 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
|
|
3
|
+
// src/worklet-executable.ts
|
|
4
|
+
import { parse } from "acorn";
|
|
5
|
+
function isNode(value) {
|
|
6
|
+
return value !== null && typeof value === "object" && typeof Reflect.get(value, "type") === "string";
|
|
7
|
+
}
|
|
8
|
+
function walk(node, visit) {
|
|
9
|
+
visit(node);
|
|
10
|
+
for (const value of Object.values(node)) {
|
|
11
|
+
if (isNode(value)) walk(value, visit);
|
|
12
|
+
else if (Array.isArray(value)) {
|
|
13
|
+
for (const child of value) if (isNode(child)) walk(child, visit);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function propertyName(node) {
|
|
18
|
+
if (!isNode(node)) return void 0;
|
|
19
|
+
const name = Reflect.get(node, node.type === "Identifier" ? "name" : "value");
|
|
20
|
+
return typeof name === "string" ? name : void 0;
|
|
21
|
+
}
|
|
22
|
+
function workletExecutableBodies(syntax) {
|
|
23
|
+
if (!isNode(syntax)) throw new Error("peach: expected worklet syntax");
|
|
24
|
+
const tree = syntax;
|
|
25
|
+
const initNames = /* @__PURE__ */ new Set();
|
|
26
|
+
const objects = /* @__PURE__ */ new Set();
|
|
27
|
+
walk(tree, (node) => {
|
|
28
|
+
if (node.type !== "AssignmentExpression") return;
|
|
29
|
+
const left = Reflect.get(node, "left");
|
|
30
|
+
if (!isNode(left) || left.type !== "MemberExpression" || propertyName(Reflect.get(left, "property")) !== "__initData")
|
|
31
|
+
return;
|
|
32
|
+
const right = Reflect.get(node, "right");
|
|
33
|
+
if (!isNode(right)) return;
|
|
34
|
+
if (right.type === "ObjectExpression") objects.add(right);
|
|
35
|
+
else if (right.type === "Identifier") {
|
|
36
|
+
const name = propertyName(right);
|
|
37
|
+
if (name) initNames.add(name);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
walk(tree, (node) => {
|
|
41
|
+
if (node.type !== "VariableDeclarator") return;
|
|
42
|
+
const name = propertyName(Reflect.get(node, "id"));
|
|
43
|
+
const init = Reflect.get(node, "init");
|
|
44
|
+
if (name && initNames.has(name) && isNode(init) && init.type === "ObjectExpression") {
|
|
45
|
+
objects.add(init);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const bodies = [];
|
|
49
|
+
for (const object of objects) {
|
|
50
|
+
const properties = Reflect.get(object, "properties");
|
|
51
|
+
if (!Array.isArray(properties)) continue;
|
|
52
|
+
if (properties.some(
|
|
53
|
+
(property2) => isNode(property2) && propertyName(Reflect.get(property2, "key")) === "__peachExecutable"
|
|
54
|
+
))
|
|
55
|
+
continue;
|
|
56
|
+
const property = properties.find(
|
|
57
|
+
(property2) => isNode(property2) && ["Property", "ObjectProperty"].includes(property2.type) && propertyName(Reflect.get(property2, "key")) === "code"
|
|
58
|
+
);
|
|
59
|
+
if (!isNode(property)) continue;
|
|
60
|
+
const literal = Reflect.get(property, "value");
|
|
61
|
+
const code = isNode(literal) && Reflect.get(literal, "value");
|
|
62
|
+
if (typeof code !== "string") {
|
|
63
|
+
throw new Error("peach: worklet init data requires literal code at build time");
|
|
64
|
+
}
|
|
65
|
+
bodies.push({ initData: object, codeProperty: property, code });
|
|
66
|
+
}
|
|
67
|
+
return bodies;
|
|
68
|
+
}
|
|
69
|
+
function compileWorkletExecutables(source, onInsert) {
|
|
70
|
+
if (!source.includes("__initData")) return source;
|
|
71
|
+
const tree = parse(source, { ecmaVersion: "latest", sourceType: "module" });
|
|
72
|
+
const edits = workletExecutableBodies(tree).map(({ codeProperty, code }) => {
|
|
73
|
+
const body = compileWorkletExecutables(code);
|
|
74
|
+
const expression = parse(`(${body})`, { ecmaVersion: "latest" }).body[0];
|
|
75
|
+
const fn = expression && Reflect.get(expression, "expression");
|
|
76
|
+
if (!isNode(fn) || !["FunctionExpression", "ArrowFunctionExpression"].includes(fn.type)) {
|
|
77
|
+
throw new Error("peach: worklet code did not compile to a function");
|
|
78
|
+
}
|
|
79
|
+
const offset = Reflect.get(codeProperty, "end");
|
|
80
|
+
if (typeof offset !== "number") throw new Error("peach: worklet code has no offset");
|
|
81
|
+
return { offset, text: `, __peachExecutable: (${body})` };
|
|
82
|
+
});
|
|
83
|
+
let compiled = source;
|
|
84
|
+
for (const edit of edits.sort((a, b) => b.offset - a.offset)) {
|
|
85
|
+
onInsert?.(edit.offset, edit.text);
|
|
86
|
+
compiled = compiled.slice(0, edit.offset) + edit.text + compiled.slice(edit.offset);
|
|
87
|
+
}
|
|
88
|
+
return compiled;
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
compileWorkletExecutables,
|
|
92
|
+
workletExecutableBodies
|
|
93
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "peachsim",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.810",
|
|
4
4
|
"description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
|
|
5
5
|
"author": "Tamagui LLC",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -102,6 +102,13 @@
|
|
|
102
102
|
"import": "./dist-lib/metro-production-bundle.mjs",
|
|
103
103
|
"default": "./dist-lib/metro-production-bundle.cjs"
|
|
104
104
|
},
|
|
105
|
+
"./worklet-executable": {
|
|
106
|
+
"types": "./src/worklet-executable.ts",
|
|
107
|
+
"source": "./src/worklet-executable.ts",
|
|
108
|
+
"bun": "./src/worklet-executable.ts",
|
|
109
|
+
"import": "./dist-lib/worklet-executable.mjs",
|
|
110
|
+
"default": "./dist-lib/worklet-executable.cjs"
|
|
111
|
+
},
|
|
105
112
|
"./plist": {
|
|
106
113
|
"types": "./src/plist.ts",
|
|
107
114
|
"source": "./src/plist.ts",
|
|
@@ -337,6 +344,7 @@
|
|
|
337
344
|
},
|
|
338
345
|
"dependencies": {
|
|
339
346
|
"@peculiar/x509": "1.14.3",
|
|
347
|
+
"acorn": "^8.16.0",
|
|
340
348
|
"@sucrase/jest-plugin": "3.0.0",
|
|
341
349
|
"jiti": "2.7.0",
|
|
342
350
|
"magic-string": "^0.30.21",
|
package/src/swift-compile.ts
CHANGED
|
@@ -582,7 +582,7 @@ export function swiftArtifactHash(
|
|
|
582
582
|
moduleRoot: string,
|
|
583
583
|
): string {
|
|
584
584
|
const hash = createHash('sha256')
|
|
585
|
-
//
|
|
585
|
+
// v20: supplied table editing and swipe methods preserve objective-c selectors
|
|
586
586
|
// v18: NSValue(time:) constructs NSStructBox through NSValue.boxedTime
|
|
587
587
|
// v17: AVAsset(url:) constructs AVURLAsset for the class cluster
|
|
588
588
|
// v16: overrides of @objc extension members rename to __peach_ovr_
|
|
@@ -598,7 +598,7 @@ export function swiftArtifactHash(
|
|
|
598
598
|
// v6: app and scene delegate classes compile final
|
|
599
599
|
// (v5: a target declaring resources gets SwiftPM's Bundle.module accessor;
|
|
600
600
|
// v4: sources compile through swiftSourceAsIOS)
|
|
601
|
-
hash.update(`swift-compile/
|
|
601
|
+
hash.update(`swift-compile/v20\n${release}\n`)
|
|
602
602
|
if (input.oneModule) hash.update('one-module\n')
|
|
603
603
|
hash.update(swiftModuleDigest(moduleRoot))
|
|
604
604
|
for (const file of Object.keys(input.files).sort()) {
|
|
@@ -1462,6 +1462,8 @@ function lowerTableProtocolMethods(
|
|
|
1462
1462
|
cellForRowAt: 'tableView:cellForRowAtIndexPath:',
|
|
1463
1463
|
titleForHeaderInSection: 'tableView:titleForHeaderInSection:',
|
|
1464
1464
|
titleForFooterInSection: 'tableView:titleForFooterInSection:',
|
|
1465
|
+
canEditRowAt: 'tableView:canEditRowAtIndexPath:',
|
|
1466
|
+
commit: 'tableView:commitEditingStyle:forRowAtIndexPath:',
|
|
1465
1467
|
}
|
|
1466
1468
|
const delegate: Record<string, string> = {
|
|
1467
1469
|
willDisplay: 'tableView:willDisplayCell:forRowAtIndexPath:',
|
|
@@ -1487,6 +1489,13 @@ function lowerTableProtocolMethods(
|
|
|
1487
1489
|
didDeselectRowAt: 'tableView:didDeselectRowAtIndexPath:',
|
|
1488
1490
|
accessoryButtonTappedForRowWith:
|
|
1489
1491
|
'tableView:accessoryButtonTappedForRowWithIndexPath:',
|
|
1492
|
+
editingStyleForRowAt: 'tableView:editingStyleForRowAtIndexPath:',
|
|
1493
|
+
leadingSwipeActionsConfigurationForRowAt:
|
|
1494
|
+
'tableView:leadingSwipeActionsConfigurationForRowAtIndexPath:',
|
|
1495
|
+
trailingSwipeActionsConfigurationForRowAt:
|
|
1496
|
+
'tableView:trailingSwipeActionsConfigurationForRowAtIndexPath:',
|
|
1497
|
+
willBeginEditingRowAt: 'tableView:willBeginEditingRowAtIndexPath:',
|
|
1498
|
+
didEndEditingRowAt: 'tableView:didEndEditingRowAtIndexPath:',
|
|
1490
1499
|
}
|
|
1491
1500
|
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index)
|
|
1492
1501
|
const edits: [number, string][] = []
|
package/src/vite-plugin.ts
CHANGED
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
REANIMATED_WORKLETIZATION_REGEX,
|
|
47
47
|
shouldApplyWorkletsPlugin,
|
|
48
48
|
transformWorkletsCode,
|
|
49
|
+
type WorkletBodyMode,
|
|
49
50
|
} from './worklets-babel.ts'
|
|
50
51
|
|
|
51
52
|
const sootsimPluginRequire = createRequire(import.meta.url)
|
|
@@ -461,7 +462,8 @@ export function engineShellWorkerPlugins(): Plugin[] {
|
|
|
461
462
|
gestureHandlerReanimatedRequire(),
|
|
462
463
|
manifestNativeSeamRedirect(),
|
|
463
464
|
keyboardControllerBindingsRedirect(),
|
|
464
|
-
|
|
465
|
+
// the shell runs received UI source; native clones belong to tenants.
|
|
466
|
+
workletsBabelTransform(() => true, 'transport'),
|
|
465
467
|
workerBootChunkPlugin(ENGINE_WORKER_BOOT_CLOSURES),
|
|
466
468
|
]
|
|
467
469
|
}
|
|
@@ -1774,6 +1776,7 @@ export function workletsBabelTransform(
|
|
|
1774
1776
|
// accepted for future per-target overrides; matching is content-driven
|
|
1775
1777
|
// today so we don't actually consult it. kept for plugin-list parity.
|
|
1776
1778
|
_isAppSource: (p: string) => boolean = () => false,
|
|
1779
|
+
bodyMode: WorkletBodyMode = 'executable',
|
|
1777
1780
|
): Plugin {
|
|
1778
1781
|
return {
|
|
1779
1782
|
name: 'sootsim-worklets-babel-transform',
|
|
@@ -1792,7 +1795,7 @@ export function workletsBabelTransform(
|
|
|
1792
1795
|
if (process.env.SOOTSIM_WORKLETS_BABEL_DEBUG) {
|
|
1793
1796
|
console.log('[worklets-babel] transforming', id.slice(-80))
|
|
1794
1797
|
}
|
|
1795
|
-
return await transformWorkletsCode(code, id, true)
|
|
1798
|
+
return await transformWorkletsCode(code, id, true, bodyMode)
|
|
1796
1799
|
} catch (err) {
|
|
1797
1800
|
// surface but don't kill the build — fall back to raw code so the
|
|
1798
1801
|
// rest of the pipeline can run. these failures are loud in the
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { parse } from 'acorn'
|
|
2
|
+
|
|
3
|
+
interface SyntaxNode {
|
|
4
|
+
type: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function isNode(value: unknown): value is SyntaxNode {
|
|
8
|
+
return (
|
|
9
|
+
value !== null &&
|
|
10
|
+
typeof value === 'object' &&
|
|
11
|
+
typeof Reflect.get(value, 'type') === 'string'
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function walk(node: SyntaxNode, visit: (node: SyntaxNode) => void): void {
|
|
16
|
+
visit(node)
|
|
17
|
+
for (const value of Object.values(node)) {
|
|
18
|
+
if (isNode(value)) walk(value, visit)
|
|
19
|
+
else if (Array.isArray(value)) {
|
|
20
|
+
for (const child of value) if (isNode(child)) walk(child, visit)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function propertyName(node: unknown): string | undefined {
|
|
26
|
+
if (!isNode(node)) return undefined
|
|
27
|
+
const name = Reflect.get(node, node.type === 'Identifier' ? 'name' : 'value')
|
|
28
|
+
return typeof name === 'string' ? name : undefined
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// collect upstream init records by their actual __initData assignments, including
|
|
32
|
+
// minified identifiers and inline records. babel and acorn share these node shapes.
|
|
33
|
+
export function workletExecutableBodies(syntax: unknown): Array<{
|
|
34
|
+
initData: SyntaxNode
|
|
35
|
+
codeProperty: SyntaxNode
|
|
36
|
+
code: string
|
|
37
|
+
}> {
|
|
38
|
+
if (!isNode(syntax)) throw new Error('peach: expected worklet syntax')
|
|
39
|
+
const tree = syntax
|
|
40
|
+
const initNames = new Set<string>()
|
|
41
|
+
const objects = new Set<SyntaxNode>()
|
|
42
|
+
walk(tree, (node) => {
|
|
43
|
+
if (node.type !== 'AssignmentExpression') return
|
|
44
|
+
const left = Reflect.get(node, 'left')
|
|
45
|
+
if (
|
|
46
|
+
!isNode(left) ||
|
|
47
|
+
left.type !== 'MemberExpression' ||
|
|
48
|
+
propertyName(Reflect.get(left, 'property')) !== '__initData'
|
|
49
|
+
)
|
|
50
|
+
return
|
|
51
|
+
const right = Reflect.get(node, 'right')
|
|
52
|
+
if (!isNode(right)) return
|
|
53
|
+
if (right.type === 'ObjectExpression') objects.add(right)
|
|
54
|
+
else if (right.type === 'Identifier') {
|
|
55
|
+
const name = propertyName(right)
|
|
56
|
+
if (name) initNames.add(name)
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
walk(tree, (node) => {
|
|
60
|
+
if (node.type !== 'VariableDeclarator') return
|
|
61
|
+
const name = propertyName(Reflect.get(node, 'id'))
|
|
62
|
+
const init = Reflect.get(node, 'init')
|
|
63
|
+
if (name && initNames.has(name) && isNode(init) && init.type === 'ObjectExpression') {
|
|
64
|
+
objects.add(init)
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
const bodies: Array<{ initData: SyntaxNode; codeProperty: SyntaxNode; code: string }> =
|
|
68
|
+
[]
|
|
69
|
+
for (const object of objects) {
|
|
70
|
+
const properties = Reflect.get(object, 'properties')
|
|
71
|
+
if (!Array.isArray(properties)) continue
|
|
72
|
+
if (
|
|
73
|
+
properties.some(
|
|
74
|
+
(property) =>
|
|
75
|
+
isNode(property) &&
|
|
76
|
+
propertyName(Reflect.get(property, 'key')) === '__peachExecutable',
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
continue
|
|
80
|
+
const property = properties.find(
|
|
81
|
+
(property) =>
|
|
82
|
+
isNode(property) &&
|
|
83
|
+
['Property', 'ObjectProperty'].includes(property.type) &&
|
|
84
|
+
propertyName(Reflect.get(property, 'key')) === 'code',
|
|
85
|
+
)
|
|
86
|
+
if (!isNode(property)) continue
|
|
87
|
+
const literal = Reflect.get(property, 'value')
|
|
88
|
+
const code = isNode(literal) && Reflect.get(literal, 'value')
|
|
89
|
+
if (typeof code !== 'string') {
|
|
90
|
+
throw new Error('peach: worklet init data requires literal code at build time')
|
|
91
|
+
}
|
|
92
|
+
bodies.push({ initData: object, codeProperty: property, code })
|
|
93
|
+
}
|
|
94
|
+
return bodies
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// retain source metadata for browser peer transport. local native clones execute
|
|
98
|
+
// the same body as compiled javascript, including worklets nested in that body.
|
|
99
|
+
export function compileWorkletExecutables(
|
|
100
|
+
source: string,
|
|
101
|
+
onInsert?: (offset: number, text: string) => void,
|
|
102
|
+
): string {
|
|
103
|
+
if (!source.includes('__initData')) return source
|
|
104
|
+
const tree = parse(source, { ecmaVersion: 'latest', sourceType: 'module' })
|
|
105
|
+
const edits = workletExecutableBodies(tree).map(({ codeProperty, code }) => {
|
|
106
|
+
const body = compileWorkletExecutables(code)
|
|
107
|
+
const expression = parse(`(${body})`, { ecmaVersion: 'latest' }).body[0]
|
|
108
|
+
const fn = expression && Reflect.get(expression, 'expression')
|
|
109
|
+
if (
|
|
110
|
+
!isNode(fn) ||
|
|
111
|
+
!['FunctionExpression', 'ArrowFunctionExpression'].includes(fn.type)
|
|
112
|
+
) {
|
|
113
|
+
throw new Error('peach: worklet code did not compile to a function')
|
|
114
|
+
}
|
|
115
|
+
const offset = Reflect.get(codeProperty, 'end')
|
|
116
|
+
if (typeof offset !== 'number') throw new Error('peach: worklet code has no offset')
|
|
117
|
+
return { offset, text: `, __peachExecutable: (${body})` }
|
|
118
|
+
})
|
|
119
|
+
let compiled = source
|
|
120
|
+
for (const edit of edits.sort((a, b) => b.offset - a.offset)) {
|
|
121
|
+
onInsert?.(edit.offset, edit.text)
|
|
122
|
+
compiled = compiled.slice(0, edit.offset) + edit.text + compiled.slice(edit.offset)
|
|
123
|
+
}
|
|
124
|
+
return compiled
|
|
125
|
+
}
|