diff --git a/node_modules/react-native-worklets-core/cpp/WKTJsiWorklet.h b/node_modules/react-native-worklets-core/cpp/WKTJsiWorklet.h index 6820bd1..2c643b3 100644 --- a/node_modules/react-native-worklets-core/cpp/WKTJsiWorklet.h +++ b/node_modules/react-native-worklets-core/cpp/WKTJsiWorklet.h @@ -25,7 +25,7 @@ static const char *PropNameWorkletInitDataSourceMap = "__sourceMap"; static const char *PropNameWorkletLocation = "__location"; static const char *PropNameWorkletAsString = "asString"; -static const char *PropNameWorkletClosure = "_closure"; +static const char *PropNameWorkletClosure = "__closure"; static const char *PropFunctionName = "name"; namespace jsi = facebook::jsi; diff --git a/node_modules/react-native-worklets-core/lib/commonjs/plugin/index.js b/node_modules/react-native-worklets-core/lib/commonjs/plugin/index.js index ce17ad3..817713a 100644 --- a/node_modules/react-native-worklets-core/lib/commonjs/plugin/index.js +++ b/node_modules/react-native-worklets-core/lib/commonjs/plugin/index.js @@ -106,7 +106,7 @@ function shouldGenerateSourceMap() { } function buildWorkletString(t, fun, closureVariables, name, inputMap) { function prependClosureVariablesIfNecessary() { - const closureDeclaration = t.variableDeclaration("const", [t.variableDeclarator(t.objectPattern(closureVariables.map(variable => t.objectProperty(t.identifier(variable.name), t.identifier(variable.name), false, true))), t.memberExpression(t.thisExpression(), t.identifier("_closure")))]); + const closureDeclaration = t.variableDeclaration("const", [t.variableDeclarator(t.objectPattern(closureVariables.map(variable => t.objectProperty(t.identifier(variable.name), t.identifier(variable.name), false, true))), t.memberExpression(t.thisExpression(), t.identifier("__closure")))]); function prependClosure(path) { if (closureVariables.length === 0 || path.parent.type !== "Program") { return; @@ -285,7 +285,7 @@ function makeWorklet(t, fun, state) { initDataObjectExpression.properties.push(t.objectProperty(t.identifier("__sourceMap"), t.stringLiteral(sourceMapString))); } pathForStringDefinitions.insertBefore(t.variableDeclaration("const", [t.variableDeclarator(initDataId, initDataObjectExpression)])); - const statements = [t.variableDeclaration("const", [t.variableDeclarator(privateFunctionId, funExpression)]), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("_closure"), false), closureGenerator.generate(t, variables, closure.keys()))), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("__initData"), false), initDataId)), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("__workletHash"), false), t.numericLiteral(workletHash)))]; + const statements = [t.variableDeclaration("const", [t.variableDeclarator(privateFunctionId, funExpression)]), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("__closure"), false), closureGenerator.generate(t, variables, closure.keys()))), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("__initData"), false), initDataId)), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("__workletHash"), false), t.numericLiteral(workletHash)))]; if (!isRelease()) { statements.unshift(t.variableDeclaration("const", [t.variableDeclarator(t.identifier("_e"), t.arrayExpression([t.newExpression(t.identifier("Error"), []), t.numericLiteral(lineOffset), t.numericLiteral(-20) // the placement of opening bracket after Exception in line that defined '_e' variable ]))])); diff --git a/node_modules/react-native-worklets-core/lib/module/plugin/index.js b/node_modules/react-native-worklets-core/lib/module/plugin/index.js index ce17ad3..817713a 100644 --- a/node_modules/react-native-worklets-core/lib/module/plugin/index.js +++ b/node_modules/react-native-worklets-core/lib/module/plugin/index.js @@ -106,7 +106,7 @@ function shouldGenerateSourceMap() { } function buildWorkletString(t, fun, closureVariables, name, inputMap) { function prependClosureVariablesIfNecessary() { - const closureDeclaration = t.variableDeclaration("const", [t.variableDeclarator(t.objectPattern(closureVariables.map(variable => t.objectProperty(t.identifier(variable.name), t.identifier(variable.name), false, true))), t.memberExpression(t.thisExpression(), t.identifier("_closure")))]); + const closureDeclaration = t.variableDeclaration("const", [t.variableDeclarator(t.objectPattern(closureVariables.map(variable => t.objectProperty(t.identifier(variable.name), t.identifier(variable.name), false, true))), t.memberExpression(t.thisExpression(), t.identifier("__closure")))]); function prependClosure(path) { if (closureVariables.length === 0 || path.parent.type !== "Program") { return; @@ -285,7 +285,7 @@ function makeWorklet(t, fun, state) { initDataObjectExpression.properties.push(t.objectProperty(t.identifier("__sourceMap"), t.stringLiteral(sourceMapString))); } pathForStringDefinitions.insertBefore(t.variableDeclaration("const", [t.variableDeclarator(initDataId, initDataObjectExpression)])); - const statements = [t.variableDeclaration("const", [t.variableDeclarator(privateFunctionId, funExpression)]), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("_closure"), false), closureGenerator.generate(t, variables, closure.keys()))), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("__initData"), false), initDataId)), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("__workletHash"), false), t.numericLiteral(workletHash)))]; + const statements = [t.variableDeclaration("const", [t.variableDeclarator(privateFunctionId, funExpression)]), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("__closure"), false), closureGenerator.generate(t, variables, closure.keys()))), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("__initData"), false), initDataId)), t.expressionStatement(t.assignmentExpression("=", t.memberExpression(privateFunctionId, t.identifier("__workletHash"), false), t.numericLiteral(workletHash)))]; if (!isRelease()) { statements.unshift(t.variableDeclaration("const", [t.variableDeclarator(t.identifier("_e"), t.arrayExpression([t.newExpression(t.identifier("Error"), []), t.numericLiteral(lineOffset), t.numericLiteral(-20) // the placement of opening bracket after Exception in line that defined '_e' variable ]))])); diff --git a/node_modules/react-native-worklets-core/src/plugin/index.js b/node_modules/react-native-worklets-core/src/plugin/index.js index 200f6d2..11a4695 100644 --- a/node_modules/react-native-worklets-core/src/plugin/index.js +++ b/node_modules/react-native-worklets-core/src/plugin/index.js @@ -270,7 +270,7 @@ function buildWorkletString(t, fun, closureVariables, name, inputMap) { ) ) ), - t.memberExpression(t.thisExpression(), t.identifier("_closure")) + t.memberExpression(t.thisExpression(), t.identifier("__closure")) ), ]); @@ -533,7 +533,7 @@ function makeWorklet(t, fun, state) { t.expressionStatement( t.assignmentExpression( "=", - t.memberExpression(privateFunctionId, t.identifier("_closure"), false), + t.memberExpression(privateFunctionId, t.identifier("__closure"), false), closureGenerator.generate(t, variables, closure.keys()) ) ),