UNPKG

vigil

Version:

Simple, efficient file watching.

74 lines (69 loc) 2.24 kB
// Generated by CoffeeScript 1.11.1 var nodeVersion, vm; vm = require('vm'); nodeVersion = function() { return parseInt(process.version.substring(1).split('.')[0], 10); }; module.exports = function(found) { var createScript, runInContext, runInNewContext, runInThisContext; createScript = vm.createScript; runInContext = vm.runInContext; runInNewContext = vm.runInNewContext; runInThisContext = vm.runInThisContext; if (nodeVersion() >= 7) { vm.createScript = function(code, options) { var filename; if ((filename = options.filename, options) != null) { found(filename); } return createScript(code, options); }; vm.runInContext = function(code, contextifiedSandbox, options) { var filename; if ((filename = options.filename, options) != null) { found(filename); } return runInContext(code, contextifiedSandbox, options); }; vm.runInNewContext = function(code, sandbox, options) { var filename; if ((filename = options.filename, options) != null) { found(filename); } return runInNewContext(code, sandbox, options); }; return vm.runInThisContext = function(code, options) { var filename; if ((filename = options.filename, options) != null) { found(filename); } return runInThisContext(code, options); }; } else { vm.createScript = function(code, filename, disp) { if (filename != null) { found(filename); } return createScript(code, filename, disp); }; vm.runInContext = function(code, sandbox, filename, timeout, disp) { if (filename != null) { found(filename); } return runInContext(code, sandbox, filename, timeout, disp); }; vm.runInNewContext = function(code, sandbox, filename, timeout, disp) { if (filename != null) { found(filename); } return runInNewContext(code, sandbox, filename, timeout, disp); }; return vm.runInThisContext = function(code, filename, timeout, disp) { if (filename != null) { found(filename); } return runInThisContext(code, filename, timeout, disp); }; } }; //# sourceMappingURL=patch.js.map