peachsim 0.1.2277 → 0.1.2296

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.
Files changed (114) hide show
  1. package/cli/commands/platform.ts +28 -8
  2. package/cli/commands/shell-url.ts +13 -4
  3. package/cli/outbound-endpoints.ts +2 -0
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +2552 -2481
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +1 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +1 -1
  27. package/dist-lib/detox/index.cjs +2 -2
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +1953 -1881
  30. package/dist-lib/expo-swift-metadata.cjs +1 -1
  31. package/dist-lib/expo-swift-metadata.mjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +2765 -2694
  34. package/dist-lib/host/fetch-proxy-handler.cjs +16 -6
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +9865 -7701
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +1 -1
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +6699 -4534
  50. package/dist-lib/native-app-identity-project.cjs +12 -4
  51. package/dist-lib/native-app-identity-project.mjs +12 -4
  52. package/dist-lib/native-app-identity.cjs +11 -3
  53. package/dist-lib/native-app-identity.mjs +11 -3
  54. package/dist-lib/native-firebase-metadata.cjs +1 -1
  55. package/dist-lib/native-firebase-metadata.mjs +1 -1
  56. package/dist-lib/pdfium-raster.cjs +1 -1
  57. package/dist-lib/pdfium-raster.mjs +1 -1
  58. package/dist-lib/plist.cjs +1 -1
  59. package/dist-lib/plist.mjs +1 -1
  60. package/dist-lib/profiles.cjs +1 -1
  61. package/dist-lib/public-brand.cjs +1 -1
  62. package/dist-lib/public-origins-lib-esm.json +26 -25
  63. package/dist-lib/public-origins-lib.json +92 -78
  64. package/dist-lib/react-native-host-modules.cjs +1 -1
  65. package/dist-lib/react-native-host-modules.mjs +1 -1
  66. package/dist-lib/reap-browser.cjs +1 -1
  67. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  68. package/dist-lib/sdk.cjs +1 -1
  69. package/dist-lib/sdk.mjs +1 -1
  70. package/dist-lib/skills.cjs +3468 -3364
  71. package/dist-lib/swift-compile.cjs +1 -1
  72. package/dist-lib/swift-compile.mjs +1 -1
  73. package/dist-lib/swift-package.cjs +1 -1
  74. package/dist-lib/swift-package.mjs +1 -1
  75. package/dist-lib/swift-submit.cjs +1 -1
  76. package/dist-lib/swift-submit.mjs +1 -1
  77. package/dist-lib/swift-toolchain.cjs +1 -1
  78. package/dist-lib/swift.cjs +1 -1
  79. package/dist-lib/vite-swift.cjs +465 -446
  80. package/dist-lib/vite.cjs +16 -6
  81. package/dist-lib/worklet-executable.cjs +421 -118
  82. package/dist-lib/worklet-executable.mjs +427 -113
  83. package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +3 -1
  84. package/dist-types/packages/peach-engine/src/engine/node.d.ts +4 -3
  85. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +3 -1
  86. package/dist-types/packages/peach-engine/src/engine/scroll-momentum-math.d.ts +14 -15
  87. package/dist-types/packages/peach-engine/src/engine/scroll-platform.d.ts +17 -21
  88. package/dist-types/packages/peach-engine/src/engine/scroll-velocity.d.ts +0 -1
  89. package/dist-types/packages/peach-engine/src/kernel/kernel.d.ts +69 -0
  90. package/dist-types/packages/peach-engine/src/kernel/worklet-kernel.d.ts +28 -0
  91. package/dist-types/packages/peach-engine/src/platform/personality.d.ts +1 -1
  92. package/dist-types/packages/peach-engine/src/render-worker/app-load.d.ts +4 -0
  93. package/dist-types/packages/peach-engine/src/render-worker/graph-linked-value.d.ts +3 -3
  94. package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +1 -2
  95. package/dist-types/packages/peach-engine/src/render-worker/worklet-serialize.d.ts +5 -0
  96. package/dist-types/packages/peach-engine/src/render-worker/worklet-wire.d.ts +2 -0
  97. package/kotlin/sdk.tar.gz +0 -0
  98. package/package.json +1 -1
  99. package/runtime-companion.json +1 -1
  100. package/src/expo-native-prebuilt.ts +24 -0
  101. package/src/expo-native-workspace.ts +51 -5
  102. package/src/metro-plugin.ts +4 -1
  103. package/src/nitro-adapter.lock.json +265 -265
  104. package/src/nitro-superset.lock.json +4 -4
  105. package/src/swift-compiler-digest.ts +8 -1
  106. package/src/swift-distribution.lock.json +8 -8
  107. package/src/swift-helper.ts +38 -0
  108. package/src/swift-pdf-raster.ts +7 -33
  109. package/src/turbo-compile.ts +12 -1
  110. package/src/turbo-runtime.lock.json +19 -19
  111. package/src/worklet-executable.ts +4 -1
  112. package/src/worklet-kernel.ts +370 -0
  113. package/src/worklets-babel.ts +10 -0
  114. package/src/xcode-target-members.ts +17 -7
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2277 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2296 | (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;
@@ -6,14 +6,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
9
+ for (var name2 in all)
10
+ __defProp(target, name2, { get: all[name2], enumerable: true });
11
11
  };
12
12
  var __copyProps = (to, from, except, desc) => {
13
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 });
14
+ for (let key2 of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key2) && key2 !== except)
16
+ __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
17
17
  }
18
18
  return to;
19
19
  };
@@ -26,58 +26,359 @@ __export(worklet_executable_exports, {
26
26
  workletExecutableBodies: () => workletExecutableBodies
27
27
  });
28
28
  module.exports = __toCommonJS(worklet_executable_exports);
29
+ var import_acorn2 = require("acorn");
30
+
31
+ // src/worklet-kernel.ts
29
32
  var import_acorn = require("acorn");
33
+ var Unsupported = class extends Error {
34
+ };
30
35
  function isNode(value) {
31
36
  return value !== null && typeof value === "object" && typeof Reflect.get(value, "type") === "string";
32
37
  }
38
+ function node(value) {
39
+ if (!isNode(value)) throw new Unsupported();
40
+ return value;
41
+ }
42
+ function nodes(value) {
43
+ if (!Array.isArray(value)) throw new Unsupported();
44
+ return value.map(node);
45
+ }
46
+ function name(value) {
47
+ const n = node(value);
48
+ if (n.type !== "Identifier" || typeof n.name !== "string") throw new Unsupported();
49
+ return n.name;
50
+ }
51
+ function key(owner, value) {
52
+ if (owner.computed === true) throw new Unsupported();
53
+ const n = node(value);
54
+ if (n.type === "Identifier" && typeof n.name === "string") return n.name;
55
+ if (n.type === "Literal" && typeof n.value === "string") return n.value;
56
+ throw new Unsupported();
57
+ }
58
+ var MATH = {
59
+ min: { op: "min", arity: "any" },
60
+ max: { op: "max", arity: "any" },
61
+ abs: { op: "abs", arity: 1 },
62
+ sqrt: { op: "sqrt", arity: 1 },
63
+ exp: { op: "exp", arity: 1 },
64
+ sin: { op: "sin", arity: 1 },
65
+ cos: { op: "cos", arity: 1 },
66
+ pow: { op: "pow", arity: 2 }
67
+ };
68
+ var BINARY = {
69
+ "+": "add",
70
+ "-": "sub",
71
+ "*": "mul",
72
+ "/": "quotient",
73
+ "**": "pow"
74
+ };
75
+ var Recipe = class {
76
+ constructor(closure, event) {
77
+ this.closure = closure;
78
+ this.event = event;
79
+ }
80
+ steps = [];
81
+ #interned = /* @__PURE__ */ new Map();
82
+ locals = /* @__PURE__ */ new Map();
83
+ step(step) {
84
+ const id = JSON.stringify(step);
85
+ const held = this.#interned.get(id);
86
+ if (held !== void 0) return held;
87
+ this.steps.push(step);
88
+ this.#interned.set(id, this.steps.length - 1);
89
+ return this.steps.length - 1;
90
+ }
91
+ slot(identifier) {
92
+ const slot = this.closure.get(name(identifier));
93
+ if (slot === void 0) throw new Unsupported();
94
+ return slot;
95
+ }
96
+ // a comparison as a kernel 1 or 0, for a conditional's test
97
+ test(expression) {
98
+ if (expression.type !== "BinaryExpression") throw new Unsupported();
99
+ const left = this.value(node(expression.left));
100
+ const right = this.value(node(expression.right));
101
+ switch (expression.operator) {
102
+ case ">":
103
+ return this.step(["op", "gt", left, right]);
104
+ case ">=":
105
+ return this.step(["op", "gte", left, right]);
106
+ case "<":
107
+ return this.step(["op", "gt", right, left]);
108
+ case "<=":
109
+ return this.step(["op", "gte", right, left]);
110
+ }
111
+ throw new Unsupported();
112
+ }
113
+ side(expression) {
114
+ if (expression.type === "Literal" && typeof expression.value === "string")
115
+ return expression.value;
116
+ if (expression.type === "MemberExpression")
117
+ return [
118
+ "member",
119
+ this.slot(expression.object),
120
+ key(expression, expression.property)
121
+ ];
122
+ throw new Unsupported();
123
+ }
124
+ extrapolation(argument) {
125
+ if (argument === void 0) return [null, null];
126
+ const expression = node(argument);
127
+ if (expression.type !== "ObjectExpression") {
128
+ const side = this.side(expression);
129
+ return [side, side];
130
+ }
131
+ let left = null;
132
+ let right = null;
133
+ for (const property of nodes(expression.properties)) {
134
+ if (property.type !== "Property" || property.kind !== "init" || property.method === true)
135
+ throw new Unsupported();
136
+ const which = key(property, property.key);
137
+ if (which === "extrapolateLeft") left = this.side(node(property.value));
138
+ else if (which === "extrapolateRight") right = this.side(node(property.value));
139
+ else throw new Unsupported();
140
+ }
141
+ return [left, right];
142
+ }
143
+ list(argument) {
144
+ const array = node(argument);
145
+ if (array.type !== "ArrayExpression") throw new Unsupported();
146
+ return nodes(array.elements).map((element) => this.value(element));
147
+ }
148
+ value(expression) {
149
+ switch (expression.type) {
150
+ case "Literal":
151
+ if (typeof expression.value !== "number") throw new Unsupported();
152
+ return this.step(["number", expression.value]);
153
+ case "Identifier": {
154
+ const local = this.locals.get(name(expression));
155
+ if (local !== void 0) return local;
156
+ return this.step(["closure", this.slot(expression)]);
157
+ }
158
+ case "MemberExpression": {
159
+ const object = node(expression.object);
160
+ const field = key(expression, expression.property);
161
+ if (field === "value" && object.type === "Identifier")
162
+ return this.step(["shared", this.slot(object)]);
163
+ if (this.event !== void 0 && object.type === "MemberExpression" && node(object.object).type === "Identifier" && name(object.object) === this.event && key(object, object.property) === "contentOffset" && (field === "x" || field === "y"))
164
+ return this.step(["event", `contentOffset.${field}`]);
165
+ throw new Unsupported();
166
+ }
167
+ case "UnaryExpression":
168
+ if (expression.operator !== "-") throw new Unsupported();
169
+ return this.step(["op", "neg", this.value(node(expression.argument))]);
170
+ case "BinaryExpression": {
171
+ const op = BINARY[String(expression.operator)];
172
+ if (!op) throw new Unsupported();
173
+ return this.step([
174
+ "op",
175
+ op,
176
+ this.value(node(expression.left)),
177
+ this.value(node(expression.right))
178
+ ]);
179
+ }
180
+ case "ConditionalExpression":
181
+ return this.step([
182
+ "op",
183
+ "select",
184
+ this.test(node(expression.test)),
185
+ this.value(node(expression.consequent)),
186
+ this.value(node(expression.alternate))
187
+ ]);
188
+ case "CallExpression":
189
+ return this.call(expression);
190
+ }
191
+ throw new Unsupported();
192
+ }
193
+ call(expression) {
194
+ if (expression.optional === true) throw new Unsupported();
195
+ const callee = node(expression.callee);
196
+ const args = nodes(expression.arguments);
197
+ if (args.some((argument) => argument.type === "SpreadElement"))
198
+ throw new Unsupported();
199
+ if (callee.type === "MemberExpression" && node(callee.object).type === "Identifier" && name(callee.object) === "Math" && !this.closure.has("Math")) {
200
+ const math = MATH[key(callee, callee.property)];
201
+ if (!math || args.length === 0) throw new Unsupported();
202
+ if (math.arity !== "any" && args.length !== math.arity) throw new Unsupported();
203
+ const values = args.map((argument) => this.value(argument));
204
+ if (math.arity === 1) return this.step(["op", math.op, values[0]]);
205
+ return values.slice(1).reduce((a, b) => this.step(["op", math.op, a, b]), values[0]);
206
+ }
207
+ if (callee.type !== "Identifier") throw new Unsupported();
208
+ const slot = this.slot(callee);
209
+ if (args.length === 3 && args[1].type !== "ArrayExpression")
210
+ return this.step([
211
+ "clamp",
212
+ slot,
213
+ this.value(args[0]),
214
+ this.value(args[1]),
215
+ this.value(args[2])
216
+ ]);
217
+ if (args.length === 3 || args.length === 4) {
218
+ const inputs = this.list(args[1]);
219
+ const outputs = this.list(args[2]);
220
+ if (inputs.length < 2 || inputs.length !== outputs.length) throw new Unsupported();
221
+ return this.step([
222
+ "interpolate",
223
+ slot,
224
+ this.value(args[0]),
225
+ inputs,
226
+ outputs,
227
+ this.extrapolation(args[3])
228
+ ]);
229
+ }
230
+ throw new Unsupported();
231
+ }
232
+ };
233
+ function closureSlots(statement) {
234
+ if (statement.type !== "VariableDeclaration") return void 0;
235
+ const [declarator] = nodes(statement.declarations);
236
+ if (nodes(statement.declarations).length !== 1 || !declarator) return void 0;
237
+ const init = declarator.init === null ? void 0 : node(declarator.init);
238
+ if (!init || init.type !== "MemberExpression" || node(init.object).type !== "ThisExpression" || key(init, init.property) !== "__closure")
239
+ return void 0;
240
+ const pattern = node(declarator.id);
241
+ if (pattern.type !== "ArrayPattern") throw new Unsupported();
242
+ const slots = /* @__PURE__ */ new Map();
243
+ nodes(pattern.elements).forEach((element, index) => slots.set(name(element), index));
244
+ return slots;
245
+ }
246
+ function styleOutputs(recipe, expression, path, outputs) {
247
+ if (expression.type === "ObjectExpression") {
248
+ for (const property of nodes(expression.properties)) {
249
+ if (property.type !== "Property" || property.kind !== "init" || property.method === true)
250
+ throw new Unsupported();
251
+ const field = key(property, property.key);
252
+ styleOutputs(
253
+ recipe,
254
+ node(property.value),
255
+ path ? `${path}.${field}` : field,
256
+ outputs
257
+ );
258
+ }
259
+ return;
260
+ }
261
+ if (expression.type === "ArrayExpression") {
262
+ nodes(expression.elements).forEach(
263
+ (element, index) => styleOutputs(recipe, element, `${path}.${index}`, outputs)
264
+ );
265
+ return;
266
+ }
267
+ outputs.push([path, recipe.value(expression)]);
268
+ }
269
+ function compileWorkletKernel(code) {
270
+ try {
271
+ const program = (0, import_acorn.parse)(`(${code})`, { ecmaVersion: "latest" });
272
+ const [statement] = nodes(program.body);
273
+ if (!statement || statement.type !== "ExpressionStatement") return void 0;
274
+ const fn = node(statement.expression);
275
+ if (fn.type !== "FunctionExpression" || fn.async === true || fn.generator === true)
276
+ return void 0;
277
+ const params = nodes(fn.params);
278
+ const body = nodes(node(fn.body).body);
279
+ const slots = body[0] ? closureSlots(body[0]) : void 0;
280
+ const statements = slots ? body.slice(1) : body;
281
+ if (params.length === 0) {
282
+ const recipe2 = new Recipe(slots ?? /* @__PURE__ */ new Map(), void 0);
283
+ for (const [index, item] of statements.entries()) {
284
+ if (item.type === "ReturnStatement" && index === statements.length - 1) {
285
+ const outputs = [];
286
+ const returned = node(item.argument);
287
+ if (returned.type !== "ObjectExpression") return void 0;
288
+ styleOutputs(recipe2, returned, "", outputs);
289
+ if (outputs.length === 0) return void 0;
290
+ return { kind: "style", steps: recipe2.steps, outputs };
291
+ }
292
+ declareLocals(recipe2, item);
293
+ }
294
+ return void 0;
295
+ }
296
+ if (params.length > 2) return void 0;
297
+ const recipe = new Recipe(slots ?? /* @__PURE__ */ new Map(), name(params[0]));
298
+ const writes = [];
299
+ for (const item of statements) {
300
+ if (item.type === "VariableDeclaration") {
301
+ declareLocals(recipe, item);
302
+ continue;
303
+ }
304
+ if (item.type !== "ExpressionStatement") return void 0;
305
+ const assignment = node(item.expression);
306
+ if (assignment.type !== "AssignmentExpression" || assignment.operator !== "=")
307
+ return void 0;
308
+ const target = node(assignment.left);
309
+ if (target.type !== "MemberExpression" || key(target, target.property) !== "value")
310
+ return void 0;
311
+ writes.push([recipe.slot(target.object), recipe.value(node(assignment.right))]);
312
+ }
313
+ if (writes.length === 0) return void 0;
314
+ return { kind: "handler", steps: recipe.steps, writes };
315
+ } catch (error) {
316
+ if (error instanceof Unsupported) return void 0;
317
+ throw error;
318
+ }
319
+ }
320
+ function declareLocals(recipe, item) {
321
+ if (item.type !== "VariableDeclaration" || item.kind !== "const")
322
+ throw new Unsupported();
323
+ for (const declarator of nodes(item.declarations)) {
324
+ const local = name(declarator.id);
325
+ if (recipe.closure.has(local) || recipe.locals.has(local)) throw new Unsupported();
326
+ recipe.locals.set(local, recipe.value(node(declarator.init)));
327
+ }
328
+ }
329
+
330
+ // src/worklet-executable.ts
331
+ function isNode2(value) {
332
+ return value !== null && typeof value === "object" && typeof Reflect.get(value, "type") === "string";
333
+ }
33
334
  function childNodes(value) {
34
- return Array.isArray(value) ? value.filter(isNode) : [];
35
- }
36
- function identifierName(node) {
37
- if (!isNode(node) || node.type !== "Identifier") return void 0;
38
- const name = Reflect.get(node, "name");
39
- return typeof name === "string" ? name : void 0;
40
- }
41
- function constantString(node) {
42
- if (!isNode(node)) return void 0;
43
- if (node.type === "TemplateLiteral") {
44
- const expressions = Reflect.get(node, "expressions");
45
- const quasis = Reflect.get(node, "quasis");
335
+ return Array.isArray(value) ? value.filter(isNode2) : [];
336
+ }
337
+ function identifierName(node2) {
338
+ if (!isNode2(node2) || node2.type !== "Identifier") return void 0;
339
+ const name2 = Reflect.get(node2, "name");
340
+ return typeof name2 === "string" ? name2 : void 0;
341
+ }
342
+ function constantString(node2) {
343
+ if (!isNode2(node2)) return void 0;
344
+ if (node2.type === "TemplateLiteral") {
345
+ const expressions = Reflect.get(node2, "expressions");
346
+ const quasis = Reflect.get(node2, "quasis");
46
347
  if (!Array.isArray(expressions) || expressions.length > 0) return void 0;
47
- if (!Array.isArray(quasis) || quasis.length !== 1 || !isNode(quasis[0]))
348
+ if (!Array.isArray(quasis) || quasis.length !== 1 || !isNode2(quasis[0]))
48
349
  return void 0;
49
350
  const value2 = Reflect.get(quasis[0], "value");
50
351
  const cooked = value2 && typeof value2 === "object" && Reflect.get(value2, "cooked");
51
352
  return typeof cooked === "string" ? cooked : void 0;
52
353
  }
53
- const value = Reflect.get(node, "value");
354
+ const value = Reflect.get(node2, "value");
54
355
  return typeof value === "string" ? value : void 0;
55
356
  }
56
- function propertyName(node) {
57
- if (!isNode(node)) return void 0;
58
- const name = Reflect.get(node, node.type === "Identifier" ? "name" : "value");
59
- return typeof name === "string" ? name : void 0;
357
+ function propertyName(node2) {
358
+ if (!isNode2(node2)) return void 0;
359
+ const name2 = Reflect.get(node2, node2.type === "Identifier" ? "name" : "value");
360
+ return typeof name2 === "string" ? name2 : void 0;
60
361
  }
61
- function keyName(owner, key) {
62
- if (Reflect.get(owner, "computed") === true && isNode(key) && key.type === "Identifier")
362
+ function keyName(owner, key2) {
363
+ if (Reflect.get(owner, "computed") === true && isNode2(key2) && key2.type === "Identifier")
63
364
  return void 0;
64
- return propertyName(key);
365
+ return propertyName(key2);
65
366
  }
66
- function patternNames(node) {
67
- if (!isNode(node)) return [];
68
- switch (node.type) {
367
+ function patternNames(node2) {
368
+ if (!isNode2(node2)) return [];
369
+ switch (node2.type) {
69
370
  case "Identifier": {
70
- const name = identifierName(node);
71
- return name === void 0 ? [] : [name];
371
+ const name2 = identifierName(node2);
372
+ return name2 === void 0 ? [] : [name2];
72
373
  }
73
374
  case "AssignmentPattern":
74
- return patternNames(Reflect.get(node, "left"));
375
+ return patternNames(Reflect.get(node2, "left"));
75
376
  case "RestElement":
76
- return patternNames(Reflect.get(node, "argument"));
377
+ return patternNames(Reflect.get(node2, "argument"));
77
378
  case "ArrayPattern":
78
- return childNodes(Reflect.get(node, "elements")).flatMap(patternNames);
379
+ return childNodes(Reflect.get(node2, "elements")).flatMap(patternNames);
79
380
  case "ObjectPattern":
80
- return childNodes(Reflect.get(node, "properties")).flatMap(
381
+ return childNodes(Reflect.get(node2, "properties")).flatMap(
81
382
  (property) => patternNames(
82
383
  property.type === "Property" || property.type === "ObjectProperty" ? Reflect.get(property, "value") : property
83
384
  )
@@ -100,46 +401,46 @@ function hoistScope(scope) {
100
401
  while (!current.hoist && current.parent) current = current.parent;
101
402
  return current;
102
403
  }
103
- function declare(scope, name, binding) {
104
- scope.names.set(name, scope.names.has(name) ? { kind: "opaque" } : binding);
404
+ function declare(scope, name2, binding) {
405
+ scope.names.set(name2, scope.names.has(name2) ? { kind: "opaque" } : binding);
105
406
  }
106
407
  function declareOpaque(scope, names) {
107
- for (const name of names) declare(scope, name, { kind: "opaque" });
408
+ for (const name2 of names) declare(scope, name2, { kind: "opaque" });
108
409
  }
109
- function lookup(scope, name) {
410
+ function lookup(scope, name2) {
110
411
  for (let current = scope; current; current = current.parent) {
111
- const binding = current.names.get(name);
412
+ const binding = current.names.get(name2);
112
413
  if (binding) return binding;
113
414
  }
114
415
  return void 0;
115
416
  }
116
417
  function declareParam(inner, fn, index, param) {
117
- const name = identifierName(param);
118
- if (name !== void 0) {
119
- declare(inner, name, { kind: "param", fn, index });
418
+ const name2 = identifierName(param);
419
+ if (name2 !== void 0) {
420
+ declare(inner, name2, { kind: "param", fn, index });
120
421
  return;
121
422
  }
122
- if (isNode(param) && param.type === "ArrayPattern") {
423
+ if (isNode2(param) && param.type === "ArrayPattern") {
123
424
  const elements = Reflect.get(param, "elements");
124
425
  if (!Array.isArray(elements)) return;
125
426
  elements.forEach((element, position) => {
126
- const name2 = identifierName(element);
127
- if (name2 !== void 0)
128
- declare(inner, name2, { kind: "param", fn, index, key: String(position) });
427
+ const name3 = identifierName(element);
428
+ if (name3 !== void 0)
429
+ declare(inner, name3, { kind: "param", fn, index, key: String(position) });
129
430
  else declareOpaque(inner, patternNames(element));
130
431
  });
131
432
  return;
132
433
  }
133
- if (!isNode(param) || param.type !== "ObjectPattern") {
434
+ if (!isNode2(param) || param.type !== "ObjectPattern") {
134
435
  declareOpaque(inner, patternNames(param));
135
436
  return;
136
437
  }
137
438
  for (const property of childNodes(Reflect.get(param, "properties"))) {
138
- const key = keyName(property, Reflect.get(property, "key"));
439
+ const key2 = keyName(property, Reflect.get(property, "key"));
139
440
  const value = Reflect.get(property, "value");
140
441
  const valueName = identifierName(value);
141
- if (key !== void 0 && valueName !== void 0 && ["Property", "ObjectProperty"].includes(property.type))
142
- declare(inner, valueName, { kind: "param", fn, index, key });
442
+ if (key2 !== void 0 && valueName !== void 0 && ["Property", "ObjectProperty"].includes(property.type))
443
+ declare(inner, valueName, { kind: "param", fn, index, key: key2 });
143
444
  else
144
445
  declareOpaque(
145
446
  inner,
@@ -147,19 +448,19 @@ function declareParam(inner, fn, index, param) {
147
448
  );
148
449
  }
149
450
  }
150
- function enter(node, scope) {
151
- switch (node.type) {
451
+ function enter(node2, scope) {
452
+ switch (node2.type) {
152
453
  case "FunctionDeclaration":
153
454
  case "FunctionExpression":
154
455
  case "ArrowFunctionExpression": {
155
456
  const inner = newScope(scope, true);
156
- const params = Reflect.get(node, "params");
457
+ const params = Reflect.get(node2, "params");
157
458
  if (Array.isArray(params)) {
158
- params.forEach((param, index) => declareParam(inner, node, index, param));
459
+ params.forEach((param, index) => declareParam(inner, node2, index, param));
159
460
  }
160
- const id = Reflect.get(node, "id");
161
- if (node.type === "FunctionExpression") declareOpaque(inner, patternNames(id));
162
- if (node.type === "FunctionDeclaration") {
461
+ const id = Reflect.get(node2, "id");
462
+ if (node2.type === "FunctionExpression") declareOpaque(inner, patternNames(id));
463
+ if (node2.type === "FunctionDeclaration") {
163
464
  declareOpaque(scope, patternNames(id));
164
465
  declareOpaque(hoistScope(scope), patternNames(id));
165
466
  }
@@ -174,79 +475,79 @@ function enter(node, scope) {
174
475
  return newScope(scope, false);
175
476
  case "CatchClause": {
176
477
  const inner = newScope(scope, false);
177
- declareOpaque(inner, patternNames(Reflect.get(node, "param")));
478
+ declareOpaque(inner, patternNames(Reflect.get(node2, "param")));
178
479
  return inner;
179
480
  }
180
481
  case "VariableDeclaration": {
181
- const target = Reflect.get(node, "kind") === "var" ? hoistScope(scope) : scope;
182
- for (const declarator of childNodes(Reflect.get(node, "declarations"))) {
482
+ const target = Reflect.get(node2, "kind") === "var" ? hoistScope(scope) : scope;
483
+ for (const declarator of childNodes(Reflect.get(node2, "declarations"))) {
183
484
  const id = Reflect.get(declarator, "id");
184
485
  const init = Reflect.get(declarator, "init");
185
- const name = identifierName(id);
186
- if (name !== void 0 && isNode(init))
187
- declare(target, name, { kind: "value", init, scope });
188
- else if (name !== void 0 && init === null)
189
- declare(target, name, { kind: "uninitialized" });
486
+ const name2 = identifierName(id);
487
+ if (name2 !== void 0 && isNode2(init))
488
+ declare(target, name2, { kind: "value", init, scope });
489
+ else if (name2 !== void 0 && init === null)
490
+ declare(target, name2, { kind: "uninitialized" });
190
491
  else declareOpaque(target, patternNames(id));
191
492
  }
192
493
  return scope;
193
494
  }
194
495
  case "ImportDeclaration":
195
- for (const specifier of childNodes(Reflect.get(node, "specifiers")))
496
+ for (const specifier of childNodes(Reflect.get(node2, "specifiers")))
196
497
  declareOpaque(scope, patternNames(Reflect.get(specifier, "local")));
197
498
  return scope;
198
499
  case "ClassDeclaration":
199
- declareOpaque(scope, patternNames(Reflect.get(node, "id")));
500
+ declareOpaque(scope, patternNames(Reflect.get(node2, "id")));
200
501
  return scope;
201
502
  default:
202
503
  return scope;
203
504
  }
204
505
  }
205
506
  function recordWrites(target, scope, collection, value) {
206
- const name = identifierName(target);
207
- if (name !== void 0 && value) {
208
- collection.writes.push({ name, scope, value });
507
+ const name2 = identifierName(target);
508
+ if (name2 !== void 0 && value) {
509
+ collection.writes.push({ name: name2, scope, value });
209
510
  return;
210
511
  }
211
- for (const name2 of patternNames(target)) collection.writes.push({ name: name2, scope });
512
+ for (const name3 of patternNames(target)) collection.writes.push({ name: name3, scope });
212
513
  }
213
- function record(node, scope, collection) {
214
- switch (node.type) {
514
+ function record(node2, scope, collection) {
515
+ switch (node2.type) {
215
516
  case "AssignmentExpression": {
216
- const left = Reflect.get(node, "left");
217
- const right = Reflect.get(node, "right");
218
- if (isNode(left) && left.type === "MemberExpression" && keyName(left, Reflect.get(left, "property")) === "__initData" && isNode(right))
517
+ const left = Reflect.get(node2, "left");
518
+ const right = Reflect.get(node2, "right");
519
+ if (isNode2(left) && left.type === "MemberExpression" && keyName(left, Reflect.get(left, "property")) === "__initData" && isNode2(right))
219
520
  collection.inits.push({ value: right, scope });
220
521
  recordWrites(
221
522
  left,
222
523
  scope,
223
524
  collection,
224
- Reflect.get(node, "operator") === "=" && isNode(right) ? right : void 0
525
+ Reflect.get(node2, "operator") === "=" && isNode2(right) ? right : void 0
225
526
  );
226
527
  return;
227
528
  }
228
529
  case "UpdateExpression":
229
- recordWrites(Reflect.get(node, "argument"), scope, collection);
530
+ recordWrites(Reflect.get(node2, "argument"), scope, collection);
230
531
  return;
231
532
  case "ForInStatement":
232
533
  case "ForOfStatement":
233
- recordWrites(Reflect.get(node, "left"), scope, collection);
534
+ recordWrites(Reflect.get(node2, "left"), scope, collection);
234
535
  return;
235
536
  case "CallExpression": {
236
- const callee = Reflect.get(node, "callee");
237
- if (isNode(callee) && FUNCTION_TYPES.has(callee.type))
238
- collection.immediate.set(callee, { call: node, scope });
537
+ const callee = Reflect.get(node2, "callee");
538
+ if (isNode2(callee) && FUNCTION_TYPES.has(callee.type))
539
+ collection.immediate.set(callee, { call: node2, scope });
239
540
  return;
240
541
  }
241
542
  default:
242
543
  return;
243
544
  }
244
545
  }
245
- function visit(node, scope, collection) {
246
- record(node, scope, collection);
247
- const inner = enter(node, scope);
248
- for (const value of Object.values(node)) {
249
- if (isNode(value)) visit(value, inner, collection);
546
+ function visit(node2, scope, collection) {
547
+ record(node2, scope, collection);
548
+ const inner = enter(node2, scope);
549
+ for (const value of Object.values(node2)) {
550
+ if (isNode2(value)) visit(value, inner, collection);
250
551
  else for (const child of childNodes(value)) visit(child, inner, collection);
251
552
  }
252
553
  }
@@ -260,8 +561,8 @@ function collectInitData(root) {
260
561
  free: /* @__PURE__ */ new Map()
261
562
  };
262
563
  visit(root, newScope(void 0, true), collection);
263
- for (const { name, scope, value } of collection.writes) {
264
- const binding = lookup(scope, name);
564
+ for (const { name: name2, scope, value } of collection.writes) {
565
+ const binding = lookup(scope, name2);
265
566
  if (binding?.kind === "uninitialized")
266
567
  collection.assigned.set(
267
568
  binding,
@@ -270,8 +571,8 @@ function collectInitData(root) {
270
571
  else if (binding) collection.reassigned.add(binding);
271
572
  else
272
573
  collection.free.set(
273
- name,
274
- collection.free.has(name) || !value ? null : { value, scope }
574
+ name2,
575
+ collection.free.has(name2) || !value ? null : { value, scope }
275
576
  );
276
577
  }
277
578
  return collection;
@@ -281,35 +582,35 @@ function immediateArgument(fn, index, collection) {
281
582
  const args = immediate && Reflect.get(immediate.call, "arguments");
282
583
  if (!immediate || !Array.isArray(args)) return void 0;
283
584
  const preceding = args.slice(0, index + 1);
284
- if (preceding.some((arg) => isNode(arg) && arg.type === "SpreadElement"))
585
+ if (preceding.some((arg) => isNode2(arg) && arg.type === "SpreadElement"))
285
586
  return void 0;
286
587
  return { argument: args[index], scope: immediate.scope };
287
588
  }
288
- function propertyValue(object, name) {
589
+ function propertyValue(object, name2) {
289
590
  if (object.type === "ArrayExpression") {
290
- const index = Number(name);
591
+ const index = Number(name2);
291
592
  const elements = Reflect.get(object, "elements");
292
- if (!Number.isSafeInteger(index) || index < 0 || String(index) !== name)
593
+ if (!Number.isSafeInteger(index) || index < 0 || String(index) !== name2)
293
594
  return void 0;
294
595
  if (!Array.isArray(elements)) return void 0;
295
- if (elements.slice(0, index + 1).some((element) => isNode(element) && element.type === "SpreadElement"))
596
+ if (elements.slice(0, index + 1).some((element) => isNode2(element) && element.type === "SpreadElement"))
296
597
  return void 0;
297
598
  const value2 = elements[index];
298
- return isNode(value2) ? value2 : void 0;
599
+ return isNode2(value2) ? value2 : void 0;
299
600
  }
300
601
  let value;
301
602
  for (const property of childNodes(Reflect.get(object, "properties"))) {
302
603
  if (property.type === "SpreadElement") return void 0;
303
604
  if (!["Property", "ObjectProperty"].includes(property.type)) continue;
304
- if (keyName(property, Reflect.get(property, "key")) !== name) continue;
605
+ if (keyName(property, Reflect.get(property, "key")) !== name2) continue;
305
606
  const next = Reflect.get(property, "value");
306
- value = isNode(next) ? next : void 0;
607
+ value = isNode2(next) ? next : void 0;
307
608
  }
308
609
  return value;
309
610
  }
310
- function resolveProperty(owner, name, collection, depth) {
611
+ function resolveProperty(owner, name2, collection, depth) {
311
612
  if (!owner) return void 0;
312
- const value = propertyValue(owner.object, name);
613
+ const value = propertyValue(owner.object, name2);
313
614
  return value && resolveObject(value, owner.scope, collection, depth + 1);
314
615
  }
315
616
  function resolveObject(expression, scope, collection, depth) {
@@ -321,10 +622,10 @@ function resolveObject(expression, scope, collection, depth) {
321
622
  return last && resolveObject(last, scope, collection, depth + 1);
322
623
  }
323
624
  if (expression.type === "Identifier") {
324
- const name = identifierName(expression);
325
- const binding = name === void 0 ? void 0 : lookup(scope, name);
625
+ const name2 = identifierName(expression);
626
+ const binding = name2 === void 0 ? void 0 : lookup(scope, name2);
326
627
  if (!binding) {
327
- const free = name === void 0 ? void 0 : collection.free.get(name);
628
+ const free = name2 === void 0 ? void 0 : collection.free.get(name2);
328
629
  return free ? resolveObject(free.value, free.scope, collection, depth + 1) : void 0;
329
630
  }
330
631
  if (collection.reassigned.has(binding)) return void 0;
@@ -336,23 +637,23 @@ function resolveObject(expression, scope, collection, depth) {
336
637
  return resolveObject(binding.init, binding.scope, collection, depth + 1);
337
638
  if (binding.kind === "param") {
338
639
  const passed = immediateArgument(binding.fn, binding.index, collection);
339
- if (!passed || !isNode(passed.argument)) return void 0;
640
+ if (!passed || !isNode2(passed.argument)) return void 0;
340
641
  const argument = resolveObject(passed.argument, passed.scope, collection, depth + 1);
341
642
  return binding.key === void 0 ? argument : resolveProperty(argument, binding.key, collection, depth);
342
643
  }
343
644
  return void 0;
344
645
  }
345
646
  if (expression.type === "MemberExpression") {
346
- const name = keyName(expression, Reflect.get(expression, "property"));
647
+ const name2 = keyName(expression, Reflect.get(expression, "property"));
347
648
  const object = Reflect.get(expression, "object");
348
- if (name === void 0 || !isNode(object)) return void 0;
649
+ if (name2 === void 0 || !isNode2(object)) return void 0;
349
650
  const owner = resolveObject(object, scope, collection, depth + 1);
350
- return resolveProperty(owner, name, collection, depth);
651
+ return resolveProperty(owner, name2, collection, depth);
351
652
  }
352
653
  return void 0;
353
654
  }
354
655
  function workletExecutableBodies(syntax, includeCompiled = false) {
355
- if (!isNode(syntax)) throw new Error("peach: expected worklet syntax");
656
+ if (!isNode2(syntax)) throw new Error("peach: expected worklet syntax");
356
657
  const collection = collectInitData(syntax);
357
658
  const objects = /* @__PURE__ */ new Set();
358
659
  for (const { value, scope } of collection.inits) {
@@ -364,13 +665,13 @@ function workletExecutableBodies(syntax, includeCompiled = false) {
364
665
  const properties = Reflect.get(object, "properties");
365
666
  if (!Array.isArray(properties)) continue;
366
667
  if (!includeCompiled && properties.some(
367
- (property2) => isNode(property2) && propertyName(Reflect.get(property2, "key")) === "__peachExecutable"
668
+ (property2) => isNode2(property2) && propertyName(Reflect.get(property2, "key")) === "__peachExecutable"
368
669
  ))
369
670
  continue;
370
671
  const property = properties.find(
371
- (property2) => isNode(property2) && ["Property", "ObjectProperty"].includes(property2.type) && propertyName(Reflect.get(property2, "key")) === "code"
672
+ (property2) => isNode2(property2) && ["Property", "ObjectProperty"].includes(property2.type) && propertyName(Reflect.get(property2, "key")) === "code"
372
673
  );
373
- if (!isNode(property)) continue;
674
+ if (!isNode2(property)) continue;
374
675
  const code = constantString(Reflect.get(property, "value"));
375
676
  if (code === void 0) {
376
677
  throw new Error("peach: worklet init data requires literal code at build time");
@@ -381,17 +682,19 @@ function workletExecutableBodies(syntax, includeCompiled = false) {
381
682
  }
382
683
  function compileWorkletExecutables(source, onInsert) {
383
684
  if (!source.includes("__initData")) return source;
384
- const tree = (0, import_acorn.parse)(source, { ecmaVersion: "latest", sourceType: "module" });
685
+ const tree = (0, import_acorn2.parse)(source, { ecmaVersion: "latest", sourceType: "module" });
385
686
  const edits = workletExecutableBodies(tree).map(({ codeProperty, code }) => {
386
687
  const body = compileWorkletExecutables(code);
387
- const expression = (0, import_acorn.parse)(`(${body})`, { ecmaVersion: "latest" }).body[0];
688
+ const expression = (0, import_acorn2.parse)(`(${body})`, { ecmaVersion: "latest" }).body[0];
388
689
  const fn = expression && Reflect.get(expression, "expression");
389
- if (!isNode(fn) || !["FunctionExpression", "ArrowFunctionExpression"].includes(fn.type)) {
690
+ if (!isNode2(fn) || !["FunctionExpression", "ArrowFunctionExpression"].includes(fn.type)) {
390
691
  throw new Error("peach: worklet code did not compile to a function");
391
692
  }
392
693
  const offset = Reflect.get(codeProperty, "end");
393
694
  if (typeof offset !== "number") throw new Error("peach: worklet code has no offset");
394
- return { offset, text: `, __peachExecutable: (${body})` };
695
+ const kernel = compileWorkletKernel(code);
696
+ const recipe = kernel ? `, __peachKernel: ${JSON.stringify(kernel)}` : "";
697
+ return { offset, text: `, __peachExecutable: (${body})${recipe}` };
395
698
  });
396
699
  const parts = [];
397
700
  let cursor = source.length;