@xuda.io/xuda-worker-bundle-min 1.3.896 → 1.3.897
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +29 -20
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9792,28 +9792,37 @@ func.expression.secure_eval = async function (
|
|
|
9792
9792
|
}
|
|
9793
9793
|
} else {
|
|
9794
9794
|
try {
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9795
|
+
try {
|
|
9796
|
+
let vm = new VM.VM({
|
|
9797
|
+
sandbox: {
|
|
9798
|
+
xu,
|
|
9799
|
+
func,
|
|
9800
|
+
SESSION_ID,
|
|
9801
|
+
SESSION_OBJ: { [`${SESSION_ID}`]: SESSION_OBJ[SESSION_ID] },
|
|
9802
|
+
callback: js_script_callback,
|
|
9803
|
+
job_id,
|
|
9804
|
+
},
|
|
9805
|
+
timeout: 1000,
|
|
9806
|
+
allowAsync: false,
|
|
9807
|
+
});
|
|
9808
|
+
let ret = val;
|
|
9809
|
+
if (typeof val === "string") {
|
|
9810
|
+
ret = await vm.run(val);
|
|
9811
|
+
}
|
|
9812
|
+
return ret;
|
|
9813
|
+
// return vm.run(val);
|
|
9814
|
+
} catch (err) {
|
|
9815
|
+
// console.warn("Failed to execute VM script:", val, err);
|
|
9816
|
+
// return val;
|
|
9817
|
+
throw "";
|
|
9810
9818
|
}
|
|
9811
|
-
return ret;
|
|
9812
|
-
// return vm.run(val);
|
|
9813
9819
|
} catch (err) {
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9820
|
+
try {
|
|
9821
|
+
return JSON5.parse(val);
|
|
9822
|
+
} catch (err) {
|
|
9823
|
+
// console.error(err);
|
|
9824
|
+
return val;
|
|
9825
|
+
}
|
|
9817
9826
|
}
|
|
9818
9827
|
}
|
|
9819
9828
|
};
|