regenerator-runtime
Advanced tools
Comparing version 0.12.1 to 0.13.0
@@ -5,4 +5,4 @@ { | ||
"description": "Runtime for Regenerator-compiled generator and async functions.", | ||
"version": "0.12.1", | ||
"main": "runtime-module.js", | ||
"version": "0.13.0", | ||
"main": "runtime.js", | ||
"keywords": [ | ||
@@ -9,0 +9,0 @@ "regenerator", |
@@ -8,3 +8,3 @@ /** | ||
!(function(global) { | ||
var regeneratorRuntime = (function (exports) { | ||
"use strict"; | ||
@@ -20,19 +20,2 @@ | ||
var inModule = typeof module === "object"; | ||
var runtime = global.regeneratorRuntime; | ||
if (runtime) { | ||
if (inModule) { | ||
// If regeneratorRuntime is defined globally and we're in a module, | ||
// make the exports object identical to regeneratorRuntime. | ||
module.exports = runtime; | ||
} | ||
// Don't bother evaluating the rest of this file if the runtime was | ||
// already defined globally. | ||
return; | ||
} | ||
// Define the runtime globally (as expected by generated code) as either | ||
// module.exports (if we're in a module) or a new, empty object. | ||
runtime = global.regeneratorRuntime = inModule ? module.exports : {}; | ||
function wrap(innerFn, outerFn, self, tryLocsList) { | ||
@@ -50,3 +33,3 @@ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. | ||
} | ||
runtime.wrap = wrap; | ||
exports.wrap = wrap; | ||
@@ -122,3 +105,3 @@ // Try/catch helper to minimize deoptimizations. Returns a completion | ||
runtime.isGeneratorFunction = function(genFun) { | ||
exports.isGeneratorFunction = function(genFun) { | ||
var ctor = typeof genFun === "function" && genFun.constructor; | ||
@@ -133,3 +116,3 @@ return ctor | ||
runtime.mark = function(genFun) { | ||
exports.mark = function(genFun) { | ||
if (Object.setPrototypeOf) { | ||
@@ -151,3 +134,3 @@ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); | ||
// meant to be awaited. | ||
runtime.awrap = function(arg) { | ||
exports.awrap = function(arg) { | ||
return { __await: arg }; | ||
@@ -227,3 +210,3 @@ }; | ||
}; | ||
runtime.AsyncIterator = AsyncIterator; | ||
exports.AsyncIterator = AsyncIterator; | ||
@@ -233,3 +216,3 @@ // Note that simple async functions are implemented on top of | ||
// the final result produced by the iterator. | ||
runtime.async = function(innerFn, outerFn, self, tryLocsList) { | ||
exports.async = function(innerFn, outerFn, self, tryLocsList) { | ||
var iter = new AsyncIterator( | ||
@@ -239,3 +222,3 @@ wrap(innerFn, outerFn, self, tryLocsList) | ||
return runtime.isGeneratorFunction(outerFn) | ||
return exports.isGeneratorFunction(outerFn) | ||
? iter // If outerFn is a generator, return the full iterator. | ||
@@ -457,3 +440,3 @@ : iter.next().then(function(result) { | ||
runtime.keys = function(object) { | ||
exports.keys = function(object) { | ||
var keys = []; | ||
@@ -519,3 +502,3 @@ for (var key in object) { | ||
} | ||
runtime.values = values; | ||
exports.values = values; | ||
@@ -725,9 +708,15 @@ function doneResult() { | ||
}; | ||
})( | ||
// In sloppy mode, unbound `this` refers to the global object, fallback to | ||
// Function constructor if we're in global strict mode. That is sadly a form | ||
// of indirect eval which violates Content Security Policy. | ||
(function() { | ||
return this || (typeof self === "object" && self); | ||
})() || Function("return this")() | ||
); | ||
// Regardless of whether this script is executing as a CommonJS module | ||
// or not, return the runtime object so that we can declare the variable | ||
// regeneratorRuntime in the outer scope, which allows this module to be | ||
// injected easily by `bin/regenerator --include-runtime script.js`. | ||
return exports; | ||
}( | ||
// If this script is executing as a CommonJS module, use module.exports | ||
// as the regeneratorRuntime namespace. Otherwise create a new empty | ||
// object. Either way, the resulting object will be used to initialize | ||
// the regeneratorRuntime variable at the top of this file. | ||
typeof module === "object" ? module.exports : {} | ||
)); |
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
0
24690
4
610