Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
then(function(script) {
script = 'var module={};' + script + '(function(){var f=[];for(var i in module.exports){if(typeof(module.exports[i])===\'function\')f.push(i);} return f;})()';
// jsh.log('running script', script);
functions = vm.runInNewContext(script, undefined, serviceFile); // no async API for this?
jsh.log('GOT FUNCTIONS', functions);
return writeFile(manifestFile, functions.join(' '));
}).
then(function(err) {
function exe(js, context) {
try {
return vm.runInNewContext(js, context);
} catch(e) {
throw 'JS error\n' + js;
}
}
function evaluate(js, ctx) {
if (!ctx) ctx = { window: {}, document: {} };
js = convert.removeComments(js);
vm.runInNewContext('main =' + js + '(1)', ctx, 'main.vm');
vm.runInNewContext('require =' + js + '', ctx, 'require.vm');
return ctx;
}
var runnable = function(path, context) {
var data = fs.readFileSync(path);
if (!context)context ={};
context.console=console;
vm.runInNewContext(data, context, path);
}
var _getFilePackageByPath = function(path,filename){
const make_template = (str) => {
try {
const sandbox = Object.assign({}, env);
return vm.runInNewContext(str, sandbox);
} catch (err) {
throw remakeError(err);
}
};