@vxrn/compiler 2.7.6 → 2.8.0

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.
@@ -52,7 +52,7 @@ function getConfigFingerprint(userBabelConfigPath) {
52
52
  nativewind: import_configure.configuration.enableNativewind,
53
53
  nativeCSS: import_configure.configuration.enableNativeCSS,
54
54
  babelConfig: getBabelConfigIdentity(userBabelConfigPath),
55
- engine: "oxc-worklets-hermes-async"
55
+ engine: "oxc-worklets-array-closure-hermes-async"
56
56
  })).digest("hex").slice(0, 8);
57
57
  }
58
58
  function getBabelConfigIdentity(configPath) {
@@ -50,7 +50,7 @@ function serializeWorkletForUI(fnNode, code, name, closureVars) {
50
50
  } else {
51
51
  rawBody = `return ${code.slice(fnNode.body.start, fnNode.body.end)};`;
52
52
  }
53
- const unpacker = closureVars.length > 0 ? `const { ${closureVars.join(", ")} } = this.__closure ?? this._closure;
53
+ const unpacker = closureVars.length > 0 ? `const [${closureVars.join(", ")}] = this.__closure;
54
54
  ` : "";
55
55
  const asyncPrefix = fnNode.async ? "async " : "";
56
56
  const genPrefix = fnNode.generator ? "*" : "";
@@ -184,11 +184,11 @@ ${initDataDecl}
184
184
  }
185
185
  const localFnCode = (0, import_serialize.buildLocalFunction)(candidate.fnNode, currentCode, fnName);
186
186
  const localName = fnName || "_worklet";
187
- const closureProps = closureVars.map((v) => `${v}: ${v}`).join(", ");
187
+ const closureValues = closureVars.join(", ");
188
188
  const iife = `(function () {
189
189
  var _e = [new (typeof global !== 'undefined' ? global : globalThis).Error(), 1, -27];
190
190
  var ${localName} = ${localFnCode};
191
- ${localName}.__closure = { ${closureProps} };
191
+ ${localName}.__closure = [${closureValues}];
192
192
  ${localName}.__workletHash = ${workletHash};
193
193
  ${localName}.__pluginVersion = ${JSON.stringify(pluginVersion)};
194
194
  ${localName}.__initData = ${initDataVar};
@@ -24,7 +24,7 @@ function getConfigFingerprint(userBabelConfigPath) {
24
24
  nativewind: configuration.enableNativewind,
25
25
  nativeCSS: configuration.enableNativeCSS,
26
26
  babelConfig: getBabelConfigIdentity(userBabelConfigPath),
27
- engine: "oxc-worklets-hermes-async"
27
+ engine: "oxc-worklets-array-closure-hermes-async"
28
28
  })).digest("hex").slice(0, 8);
29
29
  }
30
30
  function getBabelConfigIdentity(configPath) {
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","names":[],"sources":["esm/cache.js"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync\n} from \"node:fs\";\nimport { join } from \"node:path\";\nimport { configuration, isNativeWorkletsEnabled } from \"./configure\";\nconst stats = {\n hits: 0,\n misses: 0,\n writes: 0,\n errors: 0\n};\nfunction getCacheDir() {\n const cacheDir = join(process.cwd(), \"node_modules\", \".vxrn\", \"compiler-cache\");\n if (!existsSync(cacheDir)) {\n mkdirSync(cacheDir, { recursive: true });\n }\n return cacheDir;\n}\nfunction getConfigFingerprint(userBabelConfigPath) {\n return createHash(\"sha1\").update(\n JSON.stringify({\n compiler: configuration.enableCompiler,\n reanimated: configuration.enableReanimated,\n nativeWorklets: isNativeWorkletsEnabled(),\n nativewind: configuration.enableNativewind,\n nativeCSS: configuration.enableNativeCSS,\n // transform output depends on the user babel config when one applies,\n // so its identity joins the fingerprint. adding, removing, or editing\n // babel.config.* must miss entries written without that change.\n babelConfig: getBabelConfigIdentity(userBabelConfigPath),\n // bump when the transform engine changes, so entries written by a\n // previous engine aren't served for the same source\n engine: \"oxc-worklets-hermes-async\"\n })\n ).digest(\"hex\").slice(0, 8);\n}\nfunction getBabelConfigIdentity(configPath) {\n if (!configPath) return null;\n try {\n const mtime = statSync(configPath).mtimeMs;\n const hash = createHash(\"sha1\").update(readFileSync(configPath)).digest(\"hex\").slice(0, 16);\n return `${configPath}:${mtime}:${hash}`;\n } catch {\n return configPath;\n }\n}\nfunction getCacheKey(filePath, environment, userBabelConfigPath) {\n const hash = createHash(\"sha1\").update(`${environment}:${filePath}:${getConfigFingerprint(userBabelConfigPath)}`).digest(\"hex\");\n return hash;\n}\nfunction getContentHash(code) {\n return createHash(\"sha1\").update(code).digest(\"hex\").slice(0, 16);\n}\nfunction getCachedTransform(filePath, code, environment, userBabelConfigPath) {\n try {\n const cleanPath = filePath.startsWith(\"\\0\") ? filePath.slice(1) : filePath;\n const cacheDir = getCacheDir();\n const cacheKey = getCacheKey(cleanPath, environment, userBabelConfigPath);\n const cachePath = join(cacheDir, `${cacheKey}.json`);\n if (!existsSync(cachePath)) {\n stats.misses++;\n return null;\n }\n const cached = JSON.parse(readFileSync(cachePath, \"utf-8\"));\n const currentMtime = statSync(cleanPath).mtimeMs;\n if (cached.mtime !== currentMtime) {\n stats.misses++;\n return null;\n }\n const currentHash = getContentHash(code);\n if (cached.hash !== currentHash) {\n stats.misses++;\n return null;\n }\n stats.hits++;\n return { code: cached.code, map: cached.map };\n } catch (err) {\n stats.misses++;\n return null;\n }\n}\nfunction setCachedTransform(filePath, code, result, environment, userBabelConfigPath) {\n try {\n const cleanPath = filePath.startsWith(\"\\0\") ? filePath.slice(1) : filePath;\n const cacheDir = getCacheDir();\n const cacheKey = getCacheKey(cleanPath, environment, userBabelConfigPath);\n const cachePath = join(cacheDir, `${cacheKey}.json`);\n const mtime = statSync(cleanPath).mtimeMs;\n const hash = getContentHash(code);\n const entry = {\n mtime,\n hash,\n code: result.code,\n map: result.map\n };\n writeFileSync(cachePath, JSON.stringify(entry), \"utf-8\");\n stats.writes++;\n } catch (err) {\n console.warn(`[cache] Failed to write cache for ${filePath}:`, err);\n }\n}\nfunction clearTransformCache() {\n rmSync(getCacheDir(), { recursive: true, force: true });\n}\nfunction getCacheStats() {\n return { ...stats };\n}\nfunction logCacheStats() {\n if (!process.env.DEBUG_COMPILER_PERF) {\n return;\n }\n const total = stats.hits + stats.misses;\n if (total === 0) return;\n const hitRate = (stats.hits / total * 100).toFixed(1);\n console.info(\n `\n\\u{1F4BE} [Cache Stats] ${stats.hits} hits / ${stats.misses} misses (${hitRate}% hit rate), ${stats.writes} writes`\n );\n}\nexport {\n clearTransformCache,\n getCacheStats,\n getCachedTransform,\n logCacheStats,\n setCachedTransform\n};\n//# sourceMappingURL=cache.js.map\n"],"mappings":";;;;;;AAWA,MAAM,QAAQ;CACZ,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,QAAQ;AACV;AACA,SAAS,cAAc;CACrB,MAAM,WAAW,KAAK,QAAQ,IAAI,GAAG,gBAAgB,SAAS,gBAAgB;CAC9E,IAAI,CAAC,WAAW,QAAQ,GAAG;EACzB,UAAU,UAAU,EAAE,WAAW,KAAK,CAAC;CACzC;CACA,OAAO;AACT;AACA,SAAS,qBAAqB,qBAAqB;CACjD,OAAO,WAAW,MAAM,CAAC,CAAC,OACxB,KAAK,UAAU;EACb,UAAU,cAAc;EACxB,YAAY,cAAc;EAC1B,gBAAgB,wBAAwB;EACxC,YAAY,cAAc;EAC1B,WAAW,cAAc;EAIzB,aAAa,uBAAuB,mBAAmB;EAGvD,QAAQ;CACV,CAAC,CACH,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;AAC5B;AACA,SAAS,uBAAuB,YAAY;CAC1C,IAAI,CAAC,YAAY,OAAO;CACxB,IAAI;EACF,MAAM,QAAQ,SAAS,UAAU,CAAC,CAAC;EACnC,MAAM,OAAO,WAAW,MAAM,CAAC,CAAC,OAAO,aAAa,UAAU,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;EAC1F,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG;CACnC,QAAQ;EACN,OAAO;CACT;AACF;AACA,SAAS,YAAY,UAAU,aAAa,qBAAqB;CAC/D,MAAM,OAAO,WAAW,MAAM,CAAC,CAAC,OAAO,GAAG,YAAY,GAAG,SAAS,GAAG,qBAAqB,mBAAmB,GAAG,CAAC,CAAC,OAAO,KAAK;CAC9H,OAAO;AACT;AACA,SAAS,eAAe,MA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AAS,KAAK;EACZ,QAAQ,KAAK,qCAAqC,SAAS,IAAI,GAAG;CACpE;AACF;AACA,SAAS,sBAAsB;CAC7B,OAAO,YAAY,GAAG;EAAE,WAAW;EAAM,OAAO;CAAK,CAAC;AACxD;AACA,SAAS,gBAAgB;CACvB,OAAO,EAAE,GAAG,MAAM;AACpB;AACA,SAAS,gBAAgB;CACvB,IAAI,CAAC,QAAQ,IAAI,qBAAqB;EACpC;CACF;CACA,MAAM,QAAQ,MAAM,OAAO,MAAM;CACjC,IAAI,UAAU,GAAG;CACjB,MAAM,WAAW,MAAM,OAAO,QAAQ,IAAG,CAAE,QAAQ,CAAC;CACpD,QAAQ,KACN;0BACsB,MAAM,KAAK,UAAU,MAAM,OAAO,WAAW,QAAQ,eAAe,MAAM,OAAO,QACzG;AACF"}
1
+ {"version":3,"file":"cache.js","names":[],"sources":["esm/cache.js"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync\n} from \"node:fs\";\nimport { join } from \"node:path\";\nimport { configuration, isNativeWorkletsEnabled } from \"./configure\";\nconst stats = {\n hits: 0,\n misses: 0,\n writes: 0,\n errors: 0\n};\nfunction getCacheDir() {\n const cacheDir = join(process.cwd(), \"node_modules\", \".vxrn\", \"compiler-cache\");\n if (!existsSync(cacheDir)) {\n mkdirSync(cacheDir, { recursive: true });\n }\n return cacheDir;\n}\nfunction getConfigFingerprint(userBabelConfigPath) {\n return createHash(\"sha1\").update(\n JSON.stringify({\n compiler: configuration.enableCompiler,\n reanimated: configuration.enableReanimated,\n nativeWorklets: isNativeWorkletsEnabled(),\n nativewind: configuration.enableNativewind,\n nativeCSS: configuration.enableNativeCSS,\n // transform output depends on the user babel config when one applies,\n // so its identity joins the fingerprint. adding, removing, or editing\n // babel.config.* must miss entries written without that change.\n babelConfig: getBabelConfigIdentity(userBabelConfigPath),\n // bump when the transform engine changes, so entries written by a\n // previous engine aren't served for the same source\n engine: \"oxc-worklets-array-closure-hermes-async\"\n })\n ).digest(\"hex\").slice(0, 8);\n}\nfunction getBabelConfigIdentity(configPath) {\n if (!configPath) return null;\n try {\n const mtime = statSync(configPath).mtimeMs;\n const hash = createHash(\"sha1\").update(readFileSync(configPath)).digest(\"hex\").slice(0, 16);\n return `${configPath}:${mtime}:${hash}`;\n } catch {\n return configPath;\n }\n}\nfunction getCacheKey(filePath, environment, userBabelConfigPath) {\n const hash = createHash(\"sha1\").update(`${environment}:${filePath}:${getConfigFingerprint(userBabelConfigPath)}`).digest(\"hex\");\n return hash;\n}\nfunction getContentHash(code) {\n return createHash(\"sha1\").update(code).digest(\"hex\").slice(0, 16);\n}\nfunction getCachedTransform(filePath, code, environment, userBabelConfigPath) {\n try {\n const cleanPath = filePath.startsWith(\"\\0\") ? filePath.slice(1) : filePath;\n const cacheDir = getCacheDir();\n const cacheKey = getCacheKey(cleanPath, environment, userBabelConfigPath);\n const cachePath = join(cacheDir, `${cacheKey}.json`);\n if (!existsSync(cachePath)) {\n stats.misses++;\n return null;\n }\n const cached = JSON.parse(readFileSync(cachePath, \"utf-8\"));\n const currentMtime = statSync(cleanPath).mtimeMs;\n if (cached.mtime !== currentMtime) {\n stats.misses++;\n return null;\n }\n const currentHash = getContentHash(code);\n if (cached.hash !== currentHash) {\n stats.misses++;\n return null;\n }\n stats.hits++;\n return { code: cached.code, map: cached.map };\n } catch (err) {\n stats.misses++;\n return null;\n }\n}\nfunction setCachedTransform(filePath, code, result, environment, userBabelConfigPath) {\n try {\n const cleanPath = filePath.startsWith(\"\\0\") ? filePath.slice(1) : filePath;\n const cacheDir = getCacheDir();\n const cacheKey = getCacheKey(cleanPath, environment, userBabelConfigPath);\n const cachePath = join(cacheDir, `${cacheKey}.json`);\n const mtime = statSync(cleanPath).mtimeMs;\n const hash = getContentHash(code);\n const entry = {\n mtime,\n hash,\n code: result.code,\n map: result.map\n };\n writeFileSync(cachePath, JSON.stringify(entry), \"utf-8\");\n stats.writes++;\n } catch (err) {\n console.warn(`[cache] Failed to write cache for ${filePath}:`, err);\n }\n}\nfunction clearTransformCache() {\n rmSync(getCacheDir(), { recursive: true, force: true });\n}\nfunction getCacheStats() {\n return { ...stats };\n}\nfunction logCacheStats() {\n if (!process.env.DEBUG_COMPILER_PERF) {\n return;\n }\n const total = stats.hits + stats.misses;\n if (total === 0) return;\n const hitRate = (stats.hits / total * 100).toFixed(1);\n console.info(\n `\n\\u{1F4BE} [Cache Stats] ${stats.hits} hits / ${stats.misses} misses (${hitRate}% hit rate), ${stats.writes} writes`\n );\n}\nexport {\n clearTransformCache,\n getCacheStats,\n getCachedTransform,\n logCacheStats,\n setCachedTransform\n};\n//# sourceMappingURL=cache.js.map\n"],"mappings":";;;;;;AAWA,MAAM,QAAQ;CACZ,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,QAAQ;AACV;AACA,SAAS,cAAc;CACrB,MAAM,WAAW,KAAK,QAAQ,IAAI,GAAG,gBAAgB,SAAS,gBAAgB;CAC9E,IAAI,CAAC,WAAW,QAAQ,GAAG;EACzB,UAAU,UAAU,EAAE,WAAW,KAAK,CAAC;CACzC;CACA,OAAO;AACT;AACA,SAAS,qBAAqB,qBAAqB;CACjD,OAAO,WAAW,MAAM,CAAC,CAAC,OACxB,KAAK,UAAU;EACb,UAAU,cAAc;EACxB,YAAY,cAAc;EAC1B,gBAAgB,wBAAwB;EACxC,YAAY,cAAc;EAC1B,WAAW,cAAc;EAIzB,aAAa,uBAAuB,mBAAmB;EAGvD,QAAQ;CACV,CAAC,CACH,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;AAC5B;AACA,SAAS,uBAAuB,YAAY;CAC1C,IAAI,CAAC,YAAY,OAAO;CACxB,IAAI;EACF,MAAM,QAAQ,SAAS,UAAU,CAAC,CAAC;EACnC,MAAM,OAAO,WAAW,MAAM,CAAC,CAAC,OAAO,aAAa,UAAU,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAA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AAM,WAAW,YAAY,WAAW,aAAa,mBAAmB;EACxE,MAAM,YAAY,KAAK,UAAU,GAAG,SAAS,MAAM;EACnD,MAAM,QAAQ,SAAS,SAAS,CAAC,CAAC;EAClC,MAAM,OAAO,eAAe,IAAI;EAChC,MAAM,QAAQ;GACZ;GACA;GACA,MAAM,OAAO;GACb,KAAK,OAAO;EACd;EACA,cAAc,WAAW,KAAK,UAAU,KAAK,GAAG,OAAO;EACvD,MAAM;CACR,SAAS,KAAK;EACZ,QAAQ,KAAK,qCAAqC,SAAS,IAAI,GAAG;CACpE;AACF;AACA,SAAS,sBAAsB;CAC7B,OAAO,YAAY,GAAG;EAAE,WAAW;EAAM,OAAO;CAAK,CAAC;AACxD;AACA,SAAS,gBAAgB;CACvB,OAAO,EAAE,GAAG,MAAM;AACpB;AACA,SAAS,gBAAgB;CACvB,IAAI,CAAC,QAAQ,IAAI,qBAAqB;EACpC;CACF;CACA,MAAM,QAAQ,MAAM,OAAO,MAAM;CACjC,IAAI,UAAU,GAAG;CACjB,MAAM,WAAW,MAAM,OAAO,QAAQ,IAAG,CAAE,QAAQ,CAAC;CACpD,QAAQ,KACN;0BACsB,MAAM,KAAK,UAAU,MAAM,OAAO,WAAW,QAAQ,eAAe,MAAM,OAAO,QACzG;AACF"}
@@ -25,7 +25,7 @@ function serializeWorkletForUI(fnNode, code, name, closureVars) {
25
25
  } else {
26
26
  rawBody = `return ${code.slice(fnNode.body.start, fnNode.body.end)};`;
27
27
  }
28
- const unpacker = closureVars.length > 0 ? `const { ${closureVars.join(", ")} } = this.__closure ?? this._closure;
28
+ const unpacker = closureVars.length > 0 ? `const [${closureVars.join(", ")}] = this.__closure;
29
29
  ` : "";
30
30
  const asyncPrefix = fnNode.async ? "async " : "";
31
31
  const genPrefix = fnNode.generator ? "*" : "";
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.js","names":[],"sources":["esm/worklets/serialize.js"],"sourcesContent":["import { transformSync } from \"oxc-transform\";\nimport { bodyStartAfterDirectives } from \"./autoworklet\";\nfunction assertTransformed(transformed, name, what) {\n const error = transformed.errors?.[0];\n if (error) {\n throw new Error(\n `[worklets] failed to build ${what} code for ${name || \"anonymous worklet\"}: ${error.message || error}`\n );\n }\n if (!transformed.code.trim()) {\n throw new Error(\n `[worklets] built empty ${what} code for ${name || \"anonymous worklet\"}`\n );\n }\n}\nfunction serializeWorkletForUI(fnNode, code, name, closureVars) {\n let rawParams = \"\";\n if (fnNode.params && fnNode.params.length > 0) {\n const pStart = fnNode.params[0].start;\n const pEnd = fnNode.params[fnNode.params.length - 1].end;\n rawParams = code.slice(pStart, pEnd);\n }\n let rawBody = \"\";\n if (fnNode.body.type === \"BlockStatement\") {\n const bodyStart = bodyStartAfterDirectives(fnNode, code);\n const bodyEnd = fnNode.body.end - 1;\n rawBody = code.slice(bodyStart, bodyEnd);\n } else {\n rawBody = `return ${code.slice(fnNode.body.start, fnNode.body.end)};`;\n }\n const unpacker = closureVars.length > 0 ? `const { ${closureVars.join(\", \")} } = this.__closure ?? this._closure;\n` : \"\";\n const asyncPrefix = fnNode.async ? \"async \" : \"\";\n const genPrefix = fnNode.generator ? \"*\" : \"\";\n const fnName = name || \"_worklet\";\n const fullFn = `${asyncPrefix}function${genPrefix} ${fnName}(${rawParams}) {\n${unpacker}${rawBody}\n}`;\n const transformed = transformSync(\"worklet.ts\", fullFn);\n assertTransformed(transformed, name, \"serialized\");\n return `(${transformed.code.trim().replace(/;$/, \"\")})`;\n}\nfunction buildLocalFunction(fnNode, code, name) {\n let rawParams = \"\";\n if (fnNode.params && fnNode.params.length > 0) {\n const pStart = fnNode.params[0].start;\n const pEnd = fnNode.params[fnNode.params.length - 1].end;\n rawParams = code.slice(pStart, pEnd);\n }\n let rawBody = \"\";\n if (fnNode.body.type === \"BlockStatement\") {\n const bodyStart = bodyStartAfterDirectives(fnNode, code);\n const bodyEnd = fnNode.body.end - 1;\n rawBody = code.slice(bodyStart, bodyEnd);\n } else {\n rawBody = code.slice(fnNode.body.start, fnNode.body.end);\n }\n let rawFn = \"\";\n const asyncPrefix = fnNode.async ? \"async \" : \"\";\n const genPrefix = fnNode.generator ? \"*\" : \"\";\n if (fnNode.type === \"ArrowFunctionExpression\") {\n if (fnNode.body.type === \"BlockStatement\") {\n rawFn = `${asyncPrefix}(${rawParams}) => {\n${rawBody}\n}`;\n } else {\n rawFn = `${asyncPrefix}(${rawParams}) => (${rawBody})`;\n }\n } else {\n rawFn = `${asyncPrefix}function${genPrefix} ${name || \"_worklet\"}(${rawParams}) {\n${rawBody}\n}`;\n }\n const transformed = transformSync(\"local.ts\", rawFn);\n assertTransformed(transformed, name, \"local\");\n return transformed.code.trim().replace(/;$/, \"\");\n}\nexport {\n buildLocalFunction,\n serializeWorkletForUI\n};\n//# sourceMappingURL=serialize.js.map\n"],"mappings":";;;;AAEA,SAAS,kBAAkB,aAAa,MAAM,MAAM;CAClD,MAAM,QAAQ,YAAY,SAAS;CACnC,IAAI,OAAO;EACT,MAAM,IAAI,MACR,8BAA8B,KAAK,YAAY,QAAQ,oBAAoB,IAAI,MAAM,WAAW,OAClG;CACF;CACA,IAAI,CAAC,YAAY,KAAK,KAAK,GAAG;EAC5B,MAAM,IAAI,MACR,0BAA0B,KAAK,YAAY,QAAQ,qBACrD;CACF;AACF;AACA,SAAS,sBAAsB,QAAQ,MAAM,MAAM,aAAa;CAC9D,IAAI,YAAY;CAChB,IAAI,OAAO,UAAU,OAAO,OAAO,SAAS,GAAG;EAC7C,MAAM,SAAS,OAAO,OAAO,EAAE,CAAC;EAChC,MAAM,OAAO,OAAO,OAAO,OAAO,OAAO,SAAS,EAAE,CAAC;EACrD,YAAY,KAAK,MAAM,QAAQ,IAAI;CACrC;CACA,IAAI,UAAU;CACd,IAAI,OAAO,KAAK,SAAS,kBAAkB;EACzC,MAAM,YAAY,yBAAyB,QAAQ,IAAI;EACvD,MAAM,UAAU,OAAO,KAAK,MAAM;EAClC,UAAU,KAAK,MAAM,WAAW,OAAO;CACzC,OAAO;EACL,UAA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UAAU,QAAQ,QAAQ;EACtD;CACF,OAAO;EACL,QAAQ,GAAG,YAAY,UAAU,UAAU,GAAG,QAAQ,WAAW,GAAG,UAAU;EAChF,QAAQ;;CAER;CACA,MAAM,cAAc,cAAc,YAAY,KAAK;CACnD,kBAAkB,aAAa,MAAM,OAAO;CAC5C,OAAO,YAAY,KAAK,KAAK,CAAC,CAAC,QAAQ,MAAM,EAAE;AACjD"}
1
+ {"version":3,"file":"serialize.js","names":[],"sources":["esm/worklets/serialize.js"],"sourcesContent":["import { transformSync } from \"oxc-transform\";\nimport { bodyStartAfterDirectives } from \"./autoworklet\";\nfunction assertTransformed(transformed, name, what) {\n const error = transformed.errors?.[0];\n if (error) {\n throw new Error(\n `[worklets] failed to build ${what} code for ${name || \"anonymous worklet\"}: ${error.message || error}`\n );\n }\n if (!transformed.code.trim()) {\n throw new Error(\n `[worklets] built empty ${what} code for ${name || \"anonymous worklet\"}`\n );\n }\n}\nfunction serializeWorkletForUI(fnNode, code, name, closureVars) {\n let rawParams = \"\";\n if (fnNode.params && fnNode.params.length > 0) {\n const pStart = fnNode.params[0].start;\n const pEnd = fnNode.params[fnNode.params.length - 1].end;\n rawParams = code.slice(pStart, pEnd);\n }\n let rawBody = \"\";\n if (fnNode.body.type === \"BlockStatement\") {\n const bodyStart = bodyStartAfterDirectives(fnNode, code);\n const bodyEnd = fnNode.body.end - 1;\n rawBody = code.slice(bodyStart, bodyEnd);\n } else {\n rawBody = `return ${code.slice(fnNode.body.start, fnNode.body.end)};`;\n }\n const unpacker = closureVars.length > 0 ? `const [${closureVars.join(\", \")}] = this.__closure;\n` : \"\";\n const asyncPrefix = fnNode.async ? \"async \" : \"\";\n const genPrefix = fnNode.generator ? \"*\" : \"\";\n const fnName = name || \"_worklet\";\n const fullFn = `${asyncPrefix}function${genPrefix} ${fnName}(${rawParams}) {\n${unpacker}${rawBody}\n}`;\n const transformed = transformSync(\"worklet.ts\", fullFn);\n assertTransformed(transformed, name, \"serialized\");\n return `(${transformed.code.trim().replace(/;$/, \"\")})`;\n}\nfunction buildLocalFunction(fnNode, code, name) {\n let rawParams = \"\";\n if (fnNode.params && fnNode.params.length > 0) {\n const pStart = fnNode.params[0].start;\n const pEnd = fnNode.params[fnNode.params.length - 1].end;\n rawParams = code.slice(pStart, pEnd);\n }\n let rawBody = \"\";\n if (fnNode.body.type === \"BlockStatement\") {\n const bodyStart = bodyStartAfterDirectives(fnNode, code);\n const bodyEnd = fnNode.body.end - 1;\n rawBody = code.slice(bodyStart, bodyEnd);\n } else {\n rawBody = code.slice(fnNode.body.start, fnNode.body.end);\n }\n let rawFn = \"\";\n const asyncPrefix = fnNode.async ? \"async \" : \"\";\n const genPrefix = fnNode.generator ? \"*\" : \"\";\n if (fnNode.type === \"ArrowFunctionExpression\") {\n if (fnNode.body.type === \"BlockStatement\") {\n rawFn = `${asyncPrefix}(${rawParams}) => {\n${rawBody}\n}`;\n } else {\n rawFn = `${asyncPrefix}(${rawParams}) => (${rawBody})`;\n }\n } else {\n rawFn = `${asyncPrefix}function${genPrefix} ${name || \"_worklet\"}(${rawParams}) {\n${rawBody}\n}`;\n }\n const transformed = transformSync(\"local.ts\", rawFn);\n assertTransformed(transformed, name, \"local\");\n return transformed.code.trim().replace(/;$/, \"\");\n}\nexport {\n buildLocalFunction,\n serializeWorkletForUI\n};\n//# sourceMappingURL=serialize.js.map\n"],"mappings":";;;;AAEA,SAAS,kBAAkB,aAAa,MAAM,MAAM;CAClD,MAAM,QAAQ,YAAY,SAAS;CACnC,IAAI,OAAO;EACT,MAAM,IAAI,MACR,8BAA8B,KAAK,YAAY,QAAQ,oBAAoB,IAAI,MAAM,WAAW,OAClG;CACF;CACA,IAAI,CAAC,YAAY,KAAK,KAAK,GAAG;EAC5B,MAAM,IAAI,MACR,0BAA0B,KAAK,YAAY,QAAQ,qBACrD;CACF;AACF;AACA,SAAS,sBAAsB,QAAQ,MAAM,MAAM,aAAa;CAC9D,IAAI,YAAY;CAChB,IAAI,OAAO,UAAU,OA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AAM,WAAW,OAAO;CACzC,OAAO;EACL,UAAU,KAAK,MAAM,OAAO,KAAK,OAAO,OAAO,KAAK,GAAG;CACzD;CACA,IAAI,QAAQ;CACZ,MAAM,cAAc,OAAO,QAAQ,WAAW;CAC9C,MAAM,YAAY,OAAO,YAAY,MAAM;CAC3C,IAAI,OAAO,SAAS,2BAA2B;EAC7C,IAAI,OAAO,KAAK,SAAS,kBAAkB;GACzC,QAAQ,GAAG,YAAY,GAAG,UAAU;EACxC,QAAQ;;EAEN,OAAO;GACL,QAAQ,GAAG,YAAY,GAAG,UAAU,QAAQ,QAAQ;EACtD;CACF,OAAO;EACL,QAAQ,GAAG,YAAY,UAAU,UAAU,GAAG,QAAQ,WAAW,GAAG,UAAU;EAChF,QAAQ;;CAER;CACA,MAAM,cAAc,cAAc,YAAY,KAAK;CACnD,kBAAkB,aAAa,MAAM,OAAO;CAC5C,OAAO,YAAY,KAAK,KAAK,CAAC,CAAC,QAAQ,MAAM,EAAE;AACjD"}
@@ -153,11 +153,11 @@ ${initDataDecl}
153
153
  }
154
154
  const localFnCode = buildLocalFunction(candidate.fnNode, currentCode, fnName);
155
155
  const localName = fnName || "_worklet";
156
- const closureProps = closureVars.map((v) => `${v}: ${v}`).join(", ");
156
+ const closureValues = closureVars.join(", ");
157
157
  const iife = `(function () {
158
158
  var _e = [new (typeof global !== 'undefined' ? global : globalThis).Error(), 1, -27];
159
159
  var ${localName} = ${localFnCode};
160
- ${localName}.__closure = { ${closureProps} };
160
+ ${localName}.__closure = [${closureValues}];
161
161
  ${localName}.__workletHash = ${workletHash};
162
162
  ${localName}.__pluginVersion = ${JSON.stringify(pluginVersion)};
163
163
  ${localName}.__initData = ${initDataVar};
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","names":[],"sources":["esm/worklets/transform.js"],"sourcesContent":["import path from \"node:path\";\nimport MagicString from \"magic-string\";\nimport remapping from \"@jridgewell/remapping\";\nimport { parseSync } from \"oxc-parser\";\nimport {\n bodyStartAfterDirectives,\n findWorkletCandidates,\n hasDirective\n} from \"./autoworklet\";\nimport { createGlobalsSet } from \"./globals\";\nimport { calculateWorkletHash } from \"./hash\";\nimport { getClosureVariables } from \"./scope\";\nimport { buildLocalFunction, serializeWorkletForUI } from \"./serialize\";\nconst FUNCTION_TYPES = /* @__PURE__ */ new Set([\n \"FunctionDeclaration\",\n \"FunctionExpression\",\n \"ArrowFunctionExpression\"\n]);\nfunction prepareWorkletsForReactCompiler(id, code, sourceMaps = false) {\n const cleanId = id.split(\"?\")[0];\n const parsed = parseSync(cleanId, code, {\n sourceType: \"module\",\n lang: /\\.[cm]?ts$/.test(cleanId) ? \"ts\" : cleanId.endsWith(\".tsx\") ? \"tsx\" : \"jsx\"\n });\n if (parsed.errors.length) {\n const error = parsed.errors[0];\n throw new Error(\n error.codeframe || error.message || \"Syntax Error while parsing worklet\"\n );\n }\n const candidates = findWorkletCandidates(parsed.program).filter(\n (candidate) => candidate.isAutoWorklet && !hasDirective(candidate.fnNode, \"worklet\")\n );\n if (!candidates.length) return null;\n const output = new MagicString(code);\n for (const { fnNode } of candidates) {\n const body = fnNode.body;\n if (body.type === \"BlockStatement\") {\n output.appendLeft(body.start + 1, \"'worklet';\");\n } else {\n output.appendLeft(body.start, \"{ 'worklet'; return (\");\n output.appendLeft(body.end, \"); }\");\n }\n }\n return {\n code: output.toString(),\n map: sourceMaps ? output.generateMap({ source: cleanId, hires: true, includeContent: true }) : void 0\n };\n}\nfunction findEnclosingFunction(program, node) {\n let best = void 0;\n const walk = (n) => {\n if (!n || typeof n !== \"object\") return;\n if (Array.isArray(n)) {\n for (const c of n) walk(c);\n return;\n }\n if (typeof n.type !== \"string\") return;\n if (typeof n.start === \"number\" && (n.start > node.start || n.end < node.end)) return;\n if (FUNCTION_TYPES.has(n.type) && n !== node && n.body?.type === \"BlockStatement\" && n.body.start < node.start && n.body.end > node.end && (!best || n.body.start > best.body.start)) {\n best = n;\n }\n for (const key in n) {\n if (key === \"parent\") continue;\n walk(n[key]);\n }\n };\n walk(program);\n return best;\n}\nfunction executeWorkletTransform(id, code, sourceMaps = false, options, resolveVersionFn) {\n const cleanId = id.split(\"?\")[0];\n const lang = /\\.[cm]?ts$/.test(cleanId) ? \"ts\" : cleanId.endsWith(\".tsx\") ? \"tsx\" : \"jsx\";\n const initialParse = parseSync(cleanId, code, {\n sourceType: \"module\",\n lang\n });\n if (initialParse.errors && initialParse.errors.length > 0) {\n const err = initialParse.errors[0];\n throw new Error(err.codeframe || err.message || \"Syntax Error while parsing worklet\");\n }\n const initialCandidates = findWorkletCandidates(initialParse.program);\n if (initialCandidates.length === 0) {\n let map2 = void 0;\n if (sourceMaps) {\n const ms = new MagicString(code);\n map2 = ms.generateMap({\n source: cleanId,\n file: cleanId,\n hires: true,\n includeContent: true\n });\n }\n return { code, map: map2 };\n }\n const pluginVersion = options?.pluginVersion || (resolveVersionFn ? resolveVersionFn(options?.projectRoot, cleanId) : \"0.0.0\");\n const globals = createGlobalsSet(options?.globals, options?.strictGlobal);\n let location = cleanId;\n if (options?.relativeSourceLocation && options?.projectRoot) {\n location = path.relative(options.projectRoot, cleanId).replace(/\\\\/g, \"/\");\n }\n let currentCode = code;\n const initDataDefs = /* @__PURE__ */ new Map();\n const passMaps = [];\n let remainingPassBudget = 100;\n while (remainingPassBudget-- > 0) {\n const parseResult = parseSync(cleanId, currentCode, {\n sourceType: \"module\",\n lang\n });\n if (parseResult.errors && parseResult.errors.length > 0) {\n const err = parseResult.errors[0];\n throw new Error(\n err.codeframe || err.message || \"Syntax Error while parsing worklet\"\n );\n }\n const candidates = findWorkletCandidates(parseResult.program);\n if (candidates.length === 0) {\n break;\n }\n const innermostCandidates = candidates.filter((c) => {\n return !candidates.some(\n (other) => other !== c && other.fnNode.start >= c.fnNode.start && other.fnNode.end <= c.fnNode.end\n );\n });\n if (innermostCandidates.length === 0) {\n throw new Error(\n `[worklets] Cyclic or unresolvable worklet nesting detected in ${cleanId}`\n );\n }\n const ms = new MagicString(currentCode);\n const inlinedInitData = /* @__PURE__ */ new Map();\n for (const candidate of innermostCandidates) {\n const closureVars = hasDirective(candidate.fnNode, \"no-worklet-closure\") ? [] : getClosureVariables(candidate.fnNode, globals);\n const fnName = candidate.name;\n const serializedCode = serializeWorkletForUI(\n candidate.fnNode,\n currentCode,\n fnName,\n closureVars\n );\n const workletHash = calculateWorkletHash(serializedCode);\n const initDataVar = `_worklet_${workletHash}_init_data`;\n const initDataDecl = `var ${initDataVar} = {\n code: ${JSON.stringify(serializedCode)},\n location: ${JSON.stringify(location)}\n};`;\n const enclosingFn = hasDirective(candidate.fnNode, \"limit-init-data-hoisting\") ? findEnclosingFunction(parseResult.program, candidate.fnNode) : void 0;\n if (enclosingFn) {\n const insertAt = bodyStartAfterDirectives(enclosingFn, currentCode);\n let declared = inlinedInitData.get(insertAt);\n if (!declared) {\n declared = /* @__PURE__ */ new Set();\n inlinedInitData.set(insertAt, declared);\n }\n if (!declared.has(initDataVar)) {\n declared.add(initDataVar);\n ms.appendLeft(insertAt, `\n${initDataDecl}\n`);\n }\n } else if (!initDataDefs.has(initDataVar)) {\n initDataDefs.set(initDataVar, initDataDecl);\n }\n const localFnCode = buildLocalFunction(candidate.fnNode, currentCode, fnName);\n const localName = fnName || \"_worklet\";\n const closureProps = closureVars.map((v) => `${v}: ${v}`).join(\", \");\n const iife = `(function () {\n var _e = [new (typeof global !== 'undefined' ? global : globalThis).Error(), 1, -27];\n var ${localName} = ${localFnCode};\n ${localName}.__closure = { ${closureProps} };\n ${localName}.__workletHash = ${workletHash};\n ${localName}.__pluginVersion = ${JSON.stringify(pluginVersion)};\n ${localName}.__initData = ${initDataVar};\n ${localName}.__stackDetails = _e;\n return ${localName};\n})()`;\n if (candidate.kind === \"function_declaration\") {\n if (candidate.parent?.type === \"ExportNamedDeclaration\") {\n ms.overwrite(\n candidate.parent.start,\n candidate.parent.end,\n `export var ${candidate.name} = ${iife};`\n );\n } else if (candidate.parent?.type === \"ExportDefaultDeclaration\") {\n ms.overwrite(\n candidate.parent.start,\n candidate.parent.end,\n `var ${candidate.name || \"_defaultWorklet\"} = ${iife};\nexport default ${candidate.name || \"_defaultWorklet\"};`\n );\n } else {\n ms.overwrite(\n candidate.node.start,\n candidate.node.end,\n `var ${candidate.name} = ${iife};`\n );\n }\n } else if (candidate.kind === \"object_method\") {\n ms.overwrite(\n candidate.node.start,\n candidate.node.end,\n `${candidate.name}: ${iife}`\n );\n } else {\n ms.overwrite(candidate.node.start, candidate.node.end, iife);\n }\n }\n if (sourceMaps) {\n passMaps.push(\n ms.generateMap({\n source: cleanId,\n file: cleanId,\n hires: true,\n includeContent: true\n })\n );\n }\n currentCode = ms.toString();\n }\n const finalCheck = parseSync(cleanId, currentCode, { sourceType: \"module\", lang });\n const remaining = findWorkletCandidates(finalCheck.program);\n if (remaining.length > 0) {\n throw new Error(\n `[worklets] Exceeded maximum pass budget while transforming worklets in ${cleanId}. ${remaining.length} worklet(s) remained untransformed.`\n );\n }\n if (initDataDefs.size > 0) {\n const initDataCode = Array.from(initDataDefs.values()).join(\"\\n\") + \"\\n\";\n const msPrepend = new MagicString(currentCode);\n msPrepend.prepend(initDataCode);\n if (sourceMaps) {\n passMaps.push(\n msPrepend.generateMap({\n source: cleanId,\n file: cleanId,\n hires: true,\n includeContent: true\n })\n );\n }\n currentCode = msPrepend.toString();\n }\n let map = void 0;\n if (sourceMaps && passMaps.length > 0) {\n if (passMaps.length === 1) {\n map = passMaps[0];\n } else {\n map = remapping(passMaps.slice().reverse(), () => null);\n }\n if (map) {\n map.sources = [cleanId];\n map.file = cleanId;\n }\n }\n return {\n code: currentCode,\n map\n };\n}\nexport {\n executeWorkletTransform,\n prepareWorkletsForReactCompiler\n};\n//# sourceMappingURL=transform.js.map\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,iCAAiC,IAAI,IAAI;CAC7C;CACA;CACA;AACF,CAAC;AACD,SAAS,gCAAgC,IAAI,MAAM,aAAa,OAAO;CACrE,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,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AU,KAAK,OAAO,UAAU,KAAK,KAAK,IAAI;GAC7D;EACF;EACA,IAAI,YAAY;GACd,SAAS,KACP,GAAG,YAAY;IACb,QAAQ;IACR,MAAM;IACN,OAAO;IACP,gBAAgB;GAClB,CAAC,CACH;EACF;EACA,cAAc,GAAG,SAAS;CAC5B;CACA,MAAM,aAAa,UAAU,SAAS,aAAa;EAAE,YAAY;EAAU;CAAK,CAAC;CACjF,MAAM,YAAY,sBAAsB,WAAW,OAAO;CAC1D,IAAI,UAAU,SAAS,GAAG;EACxB,MAAM,IAAI,MACR,0EAA0E,QAAQ,IAAI,UAAU,OAAO,oCACzG;CACF;CACA,IAAI,aAAa,OAAO,GAAG;EACzB,MAAM,eAAe,MAAM,KAAK,aAAa,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI;EACpE,MAAM,YAAY,IAAI,YAAY,WAAW;EAC7C,UAAU,QAAQ,YAAY;EAC9B,IAAI,YAAY;GACd,SAAS,KACP,UAAU,YAAY;IACpB,QAAQ;IACR,MAAM;IACN,OAAO;IACP,gBAAgB;GAClB,CAAC,CACH;EACF;EACA,cAAc,UAAU,SAAS;CACnC;CACA,IAAI,MAAM,KAAK;CACf,IAAI,cAAc,SAAS,SAAS,GAAG;EACrC,IAAI,SAAS,WAAW,GAAG;GACzB,MAAM,SAAS;EACjB,OAAO;GACL,MAAM,UAAU,SAAS,MAAM,CAAC,CAAC,QAAQ,SAAS,IAAI;EACxD;EACA,IAAI,KAAK;GACP,IAAI,UAAU,CAAC,OAAO;GACtB,IAAI,OAAO;EACb;CACF;CACA,OAAO;EACL,MAAM;EACN;CACF;AACF"}
1
+ {"version":3,"file":"transform.js","names":[],"sources":["esm/worklets/transform.js"],"sourcesContent":["import path from \"node:path\";\nimport MagicString from \"magic-string\";\nimport remapping from \"@jridgewell/remapping\";\nimport { parseSync } from \"oxc-parser\";\nimport {\n bodyStartAfterDirectives,\n findWorkletCandidates,\n hasDirective\n} from \"./autoworklet\";\nimport { createGlobalsSet } from \"./globals\";\nimport { calculateWorkletHash } from \"./hash\";\nimport { getClosureVariables } from \"./scope\";\nimport { buildLocalFunction, serializeWorkletForUI } from \"./serialize\";\nconst FUNCTION_TYPES = /* @__PURE__ */ new Set([\n \"FunctionDeclaration\",\n \"FunctionExpression\",\n \"ArrowFunctionExpression\"\n]);\nfunction prepareWorkletsForReactCompiler(id, code, sourceMaps = false) {\n const cleanId = id.split(\"?\")[0];\n const parsed = parseSync(cleanId, code, {\n sourceType: \"module\",\n lang: /\\.[cm]?ts$/.test(cleanId) ? \"ts\" : cleanId.endsWith(\".tsx\") ? \"tsx\" : \"jsx\"\n });\n if (parsed.errors.length) {\n const error = parsed.errors[0];\n throw new Error(\n error.codeframe || error.message || \"Syntax Error while parsing worklet\"\n );\n }\n const candidates = findWorkletCandidates(parsed.program).filter(\n (candidate) => candidate.isAutoWorklet && !hasDirective(candidate.fnNode, \"worklet\")\n );\n if (!candidates.length) return null;\n const output = new MagicString(code);\n for (const { fnNode } of candidates) {\n const body = fnNode.body;\n if (body.type === \"BlockStatement\") {\n output.appendLeft(body.start + 1, \"'worklet';\");\n } else {\n output.appendLeft(body.start, \"{ 'worklet'; return (\");\n output.appendLeft(body.end, \"); }\");\n }\n }\n return {\n code: output.toString(),\n map: sourceMaps ? output.generateMap({ source: cleanId, hires: true, includeContent: true }) : void 0\n };\n}\nfunction findEnclosingFunction(program, node) {\n let best = void 0;\n const walk = (n) => {\n if (!n || typeof n !== \"object\") return;\n if (Array.isArray(n)) {\n for (const c of n) walk(c);\n return;\n }\n if (typeof n.type !== \"string\") return;\n if (typeof n.start === \"number\" && (n.start > node.start || n.end < node.end)) return;\n if (FUNCTION_TYPES.has(n.type) && n !== node && n.body?.type === \"BlockStatement\" && n.body.start < node.start && n.body.end > node.end && (!best || n.body.start > best.body.start)) {\n best = n;\n }\n for (const key in n) {\n if (key === \"parent\") continue;\n walk(n[key]);\n }\n };\n walk(program);\n return best;\n}\nfunction executeWorkletTransform(id, code, sourceMaps = false, options, resolveVersionFn) {\n const cleanId = id.split(\"?\")[0];\n const lang = /\\.[cm]?ts$/.test(cleanId) ? \"ts\" : cleanId.endsWith(\".tsx\") ? \"tsx\" : \"jsx\";\n const initialParse = parseSync(cleanId, code, {\n sourceType: \"module\",\n lang\n });\n if (initialParse.errors && initialParse.errors.length > 0) {\n const err = initialParse.errors[0];\n throw new Error(err.codeframe || err.message || \"Syntax Error while parsing worklet\");\n }\n const initialCandidates = findWorkletCandidates(initialParse.program);\n if (initialCandidates.length === 0) {\n let map2 = void 0;\n if (sourceMaps) {\n const ms = new MagicString(code);\n map2 = ms.generateMap({\n source: cleanId,\n file: cleanId,\n hires: true,\n includeContent: true\n });\n }\n return { code, map: map2 };\n }\n const pluginVersion = options?.pluginVersion || (resolveVersionFn ? resolveVersionFn(options?.projectRoot, cleanId) : \"0.0.0\");\n const globals = createGlobalsSet(options?.globals, options?.strictGlobal);\n let location = cleanId;\n if (options?.relativeSourceLocation && options?.projectRoot) {\n location = path.relative(options.projectRoot, cleanId).replace(/\\\\/g, \"/\");\n }\n let currentCode = code;\n const initDataDefs = /* @__PURE__ */ new Map();\n const passMaps = [];\n let remainingPassBudget = 100;\n while (remainingPassBudget-- > 0) {\n const parseResult = parseSync(cleanId, currentCode, {\n sourceType: \"module\",\n lang\n });\n if (parseResult.errors && parseResult.errors.length > 0) {\n const err = parseResult.errors[0];\n throw new Error(\n err.codeframe || err.message || \"Syntax Error while parsing worklet\"\n );\n }\n const candidates = findWorkletCandidates(parseResult.program);\n if (candidates.length === 0) {\n break;\n }\n const innermostCandidates = candidates.filter((c) => {\n return !candidates.some(\n (other) => other !== c && other.fnNode.start >= c.fnNode.start && other.fnNode.end <= c.fnNode.end\n );\n });\n if (innermostCandidates.length === 0) {\n throw new Error(\n `[worklets] Cyclic or unresolvable worklet nesting detected in ${cleanId}`\n );\n }\n const ms = new MagicString(currentCode);\n const inlinedInitData = /* @__PURE__ */ new Map();\n for (const candidate of innermostCandidates) {\n const closureVars = hasDirective(candidate.fnNode, \"no-worklet-closure\") ? [] : getClosureVariables(candidate.fnNode, globals);\n const fnName = candidate.name;\n const serializedCode = serializeWorkletForUI(\n candidate.fnNode,\n currentCode,\n fnName,\n closureVars\n );\n const workletHash = calculateWorkletHash(serializedCode);\n const initDataVar = `_worklet_${workletHash}_init_data`;\n const initDataDecl = `var ${initDataVar} = {\n code: ${JSON.stringify(serializedCode)},\n location: ${JSON.stringify(location)}\n};`;\n const enclosingFn = hasDirective(candidate.fnNode, \"limit-init-data-hoisting\") ? findEnclosingFunction(parseResult.program, candidate.fnNode) : void 0;\n if (enclosingFn) {\n const insertAt = bodyStartAfterDirectives(enclosingFn, currentCode);\n let declared = inlinedInitData.get(insertAt);\n if (!declared) {\n declared = /* @__PURE__ */ new Set();\n inlinedInitData.set(insertAt, declared);\n }\n if (!declared.has(initDataVar)) {\n declared.add(initDataVar);\n ms.appendLeft(insertAt, `\n${initDataDecl}\n`);\n }\n } else if (!initDataDefs.has(initDataVar)) {\n initDataDefs.set(initDataVar, initDataDecl);\n }\n const localFnCode = buildLocalFunction(candidate.fnNode, currentCode, fnName);\n const localName = fnName || \"_worklet\";\n const closureValues = closureVars.join(\", \");\n const iife = `(function () {\n var _e = [new (typeof global !== 'undefined' ? global : globalThis).Error(), 1, -27];\n var ${localName} = ${localFnCode};\n ${localName}.__closure = [${closureValues}];\n ${localName}.__workletHash = ${workletHash};\n ${localName}.__pluginVersion = ${JSON.stringify(pluginVersion)};\n ${localName}.__initData = ${initDataVar};\n ${localName}.__stackDetails = _e;\n return ${localName};\n})()`;\n if (candidate.kind === \"function_declaration\") {\n if (candidate.parent?.type === \"ExportNamedDeclaration\") {\n ms.overwrite(\n candidate.parent.start,\n candidate.parent.end,\n `export var ${candidate.name} = ${iife};`\n );\n } else if (candidate.parent?.type === \"ExportDefaultDeclaration\") {\n ms.overwrite(\n candidate.parent.start,\n candidate.parent.end,\n `var ${candidate.name || \"_defaultWorklet\"} = ${iife};\nexport default ${candidate.name || \"_defaultWorklet\"};`\n );\n } else {\n ms.overwrite(\n candidate.node.start,\n candidate.node.end,\n `var ${candidate.name} = ${iife};`\n );\n }\n } else if (candidate.kind === \"object_method\") {\n ms.overwrite(\n candidate.node.start,\n candidate.node.end,\n `${candidate.name}: ${iife}`\n );\n } else {\n ms.overwrite(candidate.node.start, candidate.node.end, iife);\n }\n }\n if (sourceMaps) {\n passMaps.push(\n ms.generateMap({\n source: cleanId,\n file: cleanId,\n hires: true,\n includeContent: true\n })\n );\n }\n currentCode = ms.toString();\n }\n const finalCheck = parseSync(cleanId, currentCode, { sourceType: \"module\", lang });\n const remaining = findWorkletCandidates(finalCheck.program);\n if (remaining.length > 0) {\n throw new Error(\n `[worklets] Exceeded maximum pass budget while transforming worklets in ${cleanId}. ${remaining.length} worklet(s) remained untransformed.`\n );\n }\n if (initDataDefs.size > 0) {\n const initDataCode = Array.from(initDataDefs.values()).join(\"\\n\") + \"\\n\";\n const msPrepend = new MagicString(currentCode);\n msPrepend.prepend(initDataCode);\n if (sourceMaps) {\n passMaps.push(\n msPrepend.generateMap({\n source: cleanId,\n file: cleanId,\n hires: true,\n includeContent: true\n })\n );\n }\n currentCode = msPrepend.toString();\n }\n let map = void 0;\n if (sourceMaps && passMaps.length > 0) {\n if (passMaps.length === 1) {\n map = passMaps[0];\n } else {\n map = remapping(passMaps.slice().reverse(), () => null);\n }\n if (map) {\n map.sources = [cleanId];\n map.file = cleanId;\n }\n }\n return {\n code: currentCode,\n map\n };\n}\nexport {\n executeWorkletTransform,\n prepareWorkletsForReactCompiler\n};\n//# sourceMappingURL=transform.js.map\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,iCAAiC,IAAI,IAAI;CAC7C;CACA;CACA;AACF,CAAC;AACD,SAAS,gCAAgC,IAAI,MAAM,aAAa,OAAO;CACrE,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,CAAC;CAC9B,MAAM,SAAS,UAAU,SAAS,MAAM;EACtC,YAAY;EACZ,MAAM,aAAa,KAA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N,OAAO;IACP,gBAAgB;GAClB,CAAC,CACH;EACF;EACA,cAAc,GAAG,SAAS;CAC5B;CACA,MAAM,aAAa,UAAU,SAAS,aAAa;EAAE,YAAY;EAAU;CAAK,CAAC;CACjF,MAAM,YAAY,sBAAsB,WAAW,OAAO;CAC1D,IAAI,UAAU,SAAS,GAAG;EACxB,MAAM,IAAI,MACR,0EAA0E,QAAQ,IAAI,UAAU,OAAO,oCACzG;CACF;CACA,IAAI,aAAa,OAAO,GAAG;EACzB,MAAM,eAAe,MAAM,KAAK,aAAa,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI;EACpE,MAAM,YAAY,IAAI,YAAY,WAAW;EAC7C,UAAU,QAAQ,YAAY;EAC9B,IAAI,YAAY;GACd,SAAS,KACP,UAAU,YAAY;IACpB,QAAQ;IACR,MAAM;IACN,OAAO;IACP,gBAAgB;GAClB,CAAC,CACH;EACF;EACA,cAAc,UAAU,SAAS;CACnC;CACA,IAAI,MAAM,KAAK;CACf,IAAI,cAAc,SAAS,SAAS,GAAG;EACrC,IAAI,SAAS,WAAW,GAAG;GACzB,MAAM,SAAS;EACjB,OAAO;GACL,MAAM,UAAU,SAAS,MAAM,CAAC,CAAC,QAAQ,SAAS,IAAI;EACxD;EACA,IAAI,KAAK;GACP,IAAI,UAAU,CAAC,OAAO;GACtB,IAAI,OAAO;EACb;CACF;CACA,OAAO;EACL,MAAM;EACN;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vxrn/compiler",
3
- "version": "2.7.6",
3
+ "version": "2.8.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -42,14 +42,14 @@
42
42
  "@babel/plugin-transform-regenerator": "^7.28.4",
43
43
  "@jridgewell/remapping": "^2.3.0",
44
44
  "@swc/core": "1.16.18",
45
- "@vxrn/utils": "2.7.6",
46
- "@vxrn/vite-native-client": "2.7.6",
45
+ "@vxrn/utils": "2.8.0",
46
+ "@vxrn/vite-native-client": "2.8.0",
47
47
  "astring": "1.9.0",
48
48
  "babel-plugin-react-compiler": "^1.0.0",
49
- "babel-plugin-syntax-hermes-parser": "^0.36.1",
49
+ "babel-plugin-syntax-hermes-parser": "^0.37.0",
50
50
  "babel-plugin-transform-flow-enums": "^0.0.2",
51
51
  "esbuild": "^0.25.12",
52
- "hermes-parser": "^0.36.1",
52
+ "hermes-parser": "^0.37.0",
53
53
  "magic-string": "^0.30.21",
54
54
  "oxc-parser": "^0.112.0",
55
55
  "oxc-transform": "^0.148.0",
@@ -58,8 +58,9 @@
58
58
  },
59
59
  "devDependencies": {
60
60
  "@jridgewell/trace-mapping": "^0.3.25",
61
- "@tamagui/build": "3.0.15",
61
+ "@tamagui/build": "3.0.18",
62
62
  "depcheck": "^1.4.7",
63
+ "react-native-worklets": "~0.13.0",
63
64
  "rolldown": "^1.2.8",
64
65
  "vite": "^8.2.2",
65
66
  "vitest": "^4.1.0"
@@ -75,7 +76,7 @@
75
76
  "publishConfig": {
76
77
  "access": "public"
77
78
  },
78
- "releaseSourceCommit": "844022deda905e7838e1a39eea9a847d92a46de9",
79
+ "releaseSourceCommit": "9435b113ae773ceebeef9e0a7144d5401b2c986f",
79
80
  "repository": {
80
81
  "type": "git",
81
82
  "url": "git+https://github.com/onejs/one.git",
package/src/cache.ts CHANGED
@@ -65,7 +65,7 @@ function getConfigFingerprint(userBabelConfigPath?: string | null): string {
65
65
  babelConfig: getBabelConfigIdentity(userBabelConfigPath),
66
66
  // bump when the transform engine changes, so entries written by a
67
67
  // previous engine aren't served for the same source
68
- engine: 'oxc-worklets-hermes-async',
68
+ engine: 'oxc-worklets-array-closure-hermes-async',
69
69
  })
70
70
  )
71
71
  .digest('hex')
@@ -54,6 +54,46 @@ describe('shouldTransformWorklets', () => {
54
54
  })
55
55
 
56
56
  describe('transformWorklets', () => {
57
+ it.each([
58
+ { body: 'value + 1', closure: [], expected: 11 },
59
+ { body: 'value * multiplier + offset', closure: [5, 3], expected: 53 },
60
+ ])(
61
+ 'interoperates with upstream closure serialization for $body',
62
+ async ({ body, closure, expected }) => {
63
+ const code = `
64
+ const multiplier = 5
65
+ const offset = 3
66
+ export function compute(value) {
67
+ 'worklet'
68
+ return ${body}
69
+ }
70
+ `
71
+ const require = createRequire(import.meta.url)
72
+ const upstream = require('@babel/core').transformSync(code, {
73
+ filename: '/app/compute.js',
74
+ babelrc: false,
75
+ configFile: false,
76
+ plugins: [
77
+ [require.resolve('react-native-worklets/plugin'), { disableSourceMaps: true }],
78
+ ],
79
+ })
80
+ const ours = await transformWorklets('/app/compute.js', code)
81
+ const evaluate = (output: string) =>
82
+ new Function('global', `${output.replace(/\bexport /g, '')}; return compute`)(
83
+ globalThis
84
+ )
85
+ const upstreamFn = evaluate(upstream.code)
86
+ const ourFn = evaluate(ours.code)
87
+ expect(ourFn.__closure).toEqual(closure)
88
+ expect(ourFn.__closure).toEqual(upstreamFn.__closure ?? [])
89
+ expect(ourFn(10)).toBe(expected)
90
+ const upstreamUI = eval(upstreamFn.__initData.code)
91
+ const ourUI = eval(ourFn.__initData.code)
92
+ expect(upstreamUI.call({ __closure: ourFn.__closure }, 10)).toBe(expected)
93
+ expect(ourUI.call({ __closure: upstreamFn.__closure }, 10)).toBe(expected)
94
+ }
95
+ )
96
+
57
97
  it('transforms functions with worklet directive', async () => {
58
98
  const code = `
59
99
  export function animate() {
@@ -168,7 +208,7 @@ describe('transformWorklets', () => {
168
208
  `
169
209
  const result = await transformWorklets('/app/setupLoop.ts', code, false)
170
210
 
171
- expect(result.code).toMatch(/setupLoop\.__closure = \{\s*\}/)
211
+ expect(result.code).toMatch(/setupLoop\.__closure = \[\s*\]/)
172
212
  const init = result.code.match(/code: "\(function setupLoop[^"]*"/)
173
213
  expect(init, 'serialized worklet code').toBeTruthy()
174
214
  expect(init![0]).not.toContain('this.__closure')
@@ -198,7 +238,7 @@ describe('transformWorklets', () => {
198
238
  false,
199
239
  { pluginVersion: '3.19.1', strictGlobal: true }
200
240
  )
201
- expect(result.code).toMatch(/__closure = \{\s*_toString/)
241
+ expect(result.code).toMatch(/__closure = \[\s*_toString/)
202
242
  })
203
243
 
204
244
  it('honors no-worklet-closure and limit-init-data-hoisting the way the worklets runtime needs', async () => {
@@ -227,7 +267,7 @@ describe('transformWorklets', () => {
227
267
  expect(outerInit, 'outer worklet serialized code').toBeTruthy()
228
268
  // no unpacker line: nothing is read off `this` on the worklet runtime.
229
269
  expect(outerInit![0]).not.toContain('this.__closure')
230
- expect(result.code).toMatch(/installUnpacker\.__closure = \{\s*\}/)
270
+ expect(result.code).toMatch(/installUnpacker\.__closure = \[\s*\]/)
231
271
  // the directives themselves are not part of the serialized body.
232
272
  expect(outerInit![0]).not.toContain('no-worklet-closure')
233
273
 
@@ -420,7 +460,7 @@ describe('transformWorklets', () => {
420
460
  'react-native-worklets/package.json'
421
461
  ).version
422
462
  expect(scaleFn.__pluginVersion).toBe(installedWorklets)
423
- expect(scaleFn.__closure).toEqual({ multiplier: 5 })
463
+ expect(scaleFn.__closure).toEqual([5])
424
464
  expect(scaleFn.__initData).toBeDefined()
425
465
  expect(scaleFn.__initData.code).toContain('__closure')
426
466
 
@@ -470,7 +510,7 @@ describe('transformWorklets', () => {
470
510
  sandbox.exports.getCardStyle()
471
511
  expect(capturedCallback).toBeDefined()
472
512
  expect(capturedCallback.__workletHash).toBeDefined()
473
- expect(capturedCallback.__closure).toEqual({ baseOpacity: 0.8 })
513
+ expect(capturedCallback.__closure).toEqual([0.8])
474
514
 
475
515
  // UI thread execution of the animated style worklet
476
516
  const reconstructedStyleFn = eval(`(${capturedCallback.__initData.code})`)
@@ -541,8 +581,8 @@ describe('transformWorklets', () => {
541
581
  const result = await transformWorklets('/app/multiple.ts', code, false)
542
582
  expect(result.code).toContain('first')
543
583
  expect(result.code).toContain('second')
544
- expect(result.code).toContain('__closure = { a: a }')
545
- expect(result.code).toContain('__closure = { b: b }')
584
+ expect(result.code).toContain('__closure = [a]')
585
+ expect(result.code).toContain('__closure = [b]')
546
586
  })
547
587
 
548
588
  it('transforms concise arrow functions with useDerivedValue', async () => {
@@ -569,7 +609,7 @@ describe('transformWorklets', () => {
569
609
  `
570
610
  const result = await transformWorklets('/app/handler.ts', code, false)
571
611
  expect(result.code).toContain('onScroll:')
572
- expect(result.code).toContain('__closure = { offset: offset }')
612
+ expect(result.code).toContain('__closure = [offset]')
573
613
  })
574
614
 
575
615
  it('correctly handles default and destructuring parameters in closure capture', async () => {
@@ -581,7 +621,7 @@ describe('transformWorklets', () => {
581
621
  }
582
622
  `
583
623
  const result = await transformWorklets('/app/destructure.ts', code, false)
584
- expect(result.code).toContain('__closure = { factor: factor }')
624
+ expect(result.code).toContain('__closure = [factor]')
585
625
 
586
626
  const sandbox = { global: globalThis, exports: {} as any }
587
627
  const runner = new Function(
@@ -634,7 +674,7 @@ describe('transformWorklets', () => {
634
674
  }
635
675
  `
636
676
  const result = await transformWorklets('/app/scope-shadow.ts', code, false)
637
- expect(result.code).toContain('__closure = { x: x }')
677
+ expect(result.code).toContain('__closure = [x]')
638
678
 
639
679
  const sandbox = { global: globalThis, exports: {} as any }
640
680
  const runner = new Function(
@@ -680,7 +720,7 @@ describe('transformWorklets', () => {
680
720
  const { proxy } = sandbox.exports
681
721
 
682
722
  for (const worklet of [proxy.updateConfig, proxy.flush]) {
683
- expect(worklet.__closure.updateConfig).not.toBe(worklet)
723
+ expect(worklet.__closure[0]).not.toBe(worklet)
684
724
  const reconstructed = eval(`(${worklet.__initData.code})`)
685
725
  expect(reconstructed.call({ __closure: worklet.__closure }, 3)).toBe(worklet(3))
686
726
  }
@@ -25,9 +25,9 @@ function assertTransformed(
25
25
  }
26
26
 
27
27
  /**
28
- * Serializes a worklet function into a string for the Hermes UI thread (__initData.code).
29
- * Includes injected unpacker: `const { var1, var2 } = this.__closure ?? this._closure;`
30
- * Strips TypeScript types and formats via oxc-transform.
28
+ * serializes a worklet function into a string for the hermes ui thread (__initData.code).
29
+ * includes injected unpacker: `const [var1, var2] = this.__closure;`
30
+ * strips typescript types and formats via oxc-transform.
31
31
  */
32
32
  export function serializeWorkletForUI(
33
33
  fnNode: any,
@@ -52,9 +52,7 @@ export function serializeWorkletForUI(
52
52
  }
53
53
 
54
54
  const unpacker =
55
- closureVars.length > 0
56
- ? `const { ${closureVars.join(', ')} } = this.__closure ?? this._closure;\n`
57
- : ''
55
+ closureVars.length > 0 ? `const [${closureVars.join(', ')}] = this.__closure;\n` : ''
58
56
 
59
57
  const asyncPrefix = fnNode.async ? 'async ' : ''
60
58
  const genPrefix = fnNode.generator ? '*' : ''
@@ -241,12 +241,13 @@ export function executeWorkletTransform(
241
241
 
242
242
  const localFnCode = buildLocalFunction(candidate.fnNode, currentCode, fnName)
243
243
  const localName = fnName || '_worklet'
244
- const closureProps = closureVars.map((v) => `${v}: ${v}`).join(', ')
244
+ // worklets 0.13 captures values in the same order the ui function unpacks them.
245
+ const closureValues = closureVars.join(', ')
245
246
 
246
247
  const iife = `(function () {
247
248
  var _e = [new (typeof global !== 'undefined' ? global : globalThis).Error(), 1, -27];
248
249
  var ${localName} = ${localFnCode};
249
- ${localName}.__closure = { ${closureProps} };
250
+ ${localName}.__closure = [${closureValues}];
250
251
  ${localName}.__workletHash = ${workletHash};
251
252
  ${localName}.__pluginVersion = ${JSON.stringify(pluginVersion)};
252
253
  ${localName}.__initData = ${initDataVar};
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Serializes a worklet function into a string for the Hermes UI thread (__initData.code).
3
- * Includes injected unpacker: `const { var1, var2 } = this.__closure ?? this._closure;`
4
- * Strips TypeScript types and formats via oxc-transform.
2
+ * serializes a worklet function into a string for the hermes ui thread (__initData.code).
3
+ * includes injected unpacker: `const [var1, var2] = this.__closure;`
4
+ * strips typescript types and formats via oxc-transform.
5
5
  */
6
6
  export declare function serializeWorkletForUI(fnNode: any, code: string, name: string | undefined, closureVars: string[]): string;
7
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/worklets/serialize.ts"],"names":[],"mappings":"AA0BA;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,WAAW,EAAE,MAAM,EAAE,GACpB,MAAM,CA+BR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,MAAM,CAqCR"}
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/worklets/serialize.ts"],"names":[],"mappings":"AA0BA;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,WAAW,EAAE,MAAM,EAAE,GACpB,MAAM,CA6BR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,MAAM,CAqCR"}
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/worklets/transform.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAQvD,wBAAgB,+BAA+B,CAC7C,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,UAAU,UAAQ,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,IAAI,CAiCpC;AAsCD,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,UAAU,UAAQ,EAClB,OAAO,CAAC,EAAE,wBAAwB,EAClC,gBAAgB,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GACrE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,CAmP7B"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/worklets/transform.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAQvD,wBAAgB,+BAA+B,CAC7C,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,UAAU,UAAQ,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,IAAI,CAiCpC;AAsCD,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,UAAU,UAAQ,EAClB,OAAO,CAAC,EAAE,wBAAwB,EAClC,gBAAgB,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GACrE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,CAoP7B"}