replace vm.createScript in favor of vm.Script

This commit is contained in:
Patrick Wozniak
2024-01-21 01:13:00 +01:00
parent a587655a5a
commit ec062d008f

View File

@@ -22,12 +22,6 @@ module.exports = function(RED) {
var acorn = require("acorn");
var acornWalk = require("acorn-walk");
if (vm.createScript == null) {
vm.createScript = (code, scriptName) => {
return new vm.Script(code, { filename: scriptName });
}
}
function sendResults(node,send,_msgid,msgs,cloneFirstMessage) {
if (msgs == null) {
return;
@@ -380,7 +374,7 @@ module.exports = function(RED) {
iniOpt.breakOnSigint = true;
}
}
node.script = vm.createScript(functionText, createVMOpt(node, ""));
node.script = vm.Script(functionText, {filename: createVMOpt(node, "")});
if (node.fin && (node.fin !== "")) {
var finText = `(function () {
var node = {