New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

regenerator

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regenerator - npm Package Compare versions

Comparing version 0.5.0 to 0.5.3

bundle.master.js

10

lib/emit.js

@@ -18,2 +18,4 @@ /**

var meta = require("./meta");
var runtimeProperty = require("./util").runtimeProperty;
var runtimeKeysMethod = runtimeProperty("keys");
var hasOwn = Object.prototype.hasOwnProperty;

@@ -321,3 +323,3 @@

if (this.tryEntries.length === 0) {
// To avoid adding a needless [] to the majority of wrapGenerator
// To avoid adding a needless [] to the majority of runtime.wrap
// argument lists, force the caller to handle this case specially.

@@ -530,7 +532,3 @@ return null;

b.callExpression(
b.memberExpression(
b.identifier("wrapGenerator"),
b.identifier("keys"),
false
),
runtimeKeysMethod,
[self.explodeExpression(path.get("right"))]

@@ -537,0 +535,0 @@ )

@@ -11,2 +11,3 @@ /**

var b = require("recast").types.builders;
var hasOwn = Object.prototype.hasOwnProperty;

@@ -30,1 +31,9 @@

};
exports.runtimeProperty = function(name) {
return b.memberExpression(
b.identifier("regeneratorRuntime"),
b.identifier(name),
false
);
};

38

lib/visit.js

@@ -20,2 +20,6 @@ /**

var Emitter = require("./emit").Emitter;
var runtimeProperty = require("./util").runtimeProperty;
var runtimeWrapMethod = runtimeProperty("wrap");
var runtimeMarkMethod = runtimeProperty("mark");
var runtimeValuesMethod = runtimeProperty("values");

@@ -53,3 +57,2 @@ exports.transform = function(node) {

var argsId = path.scope.declareTemporary("args$");
var wrapGeneratorId = b.identifier("wrapGenerator");
var shouldAliasArguments = renameArguments(path, argsId);

@@ -74,3 +77,3 @@ var vars = hoist(path);

var wrapGenArgs = [
var wrapArgs = [
emitter.getContextFunction(innerFnId),

@@ -83,7 +86,7 @@ outerFnId,

if (tryEntryList) {
wrapGenArgs.push(tryEntryList);
wrapArgs.push(tryEntryList);
}
outerBody.push(b.returnStatement(
b.callExpression(wrapGeneratorId, wrapGenArgs)
b.callExpression(runtimeWrapMethod, wrapArgs)
));

@@ -93,8 +96,2 @@

var markMethod = b.memberExpression(
wrapGeneratorId,
b.identifier("mark"),
false
);
if (n.FunctionDeclaration.check(node)) {

@@ -144,3 +141,3 @@ var pp = path.parent;

//
// var gen = wrapGenerator.mark(function *gen() {
// var gen = runtime.mark(function *gen() {
// return gen;

@@ -154,3 +151,3 @@ // });

// Remove the FunctionDeclaration so that we can add it back as a
// FunctionExpression passed to wrapGenerator.mark.
// FunctionExpression passed to runtime.mark.
path.replace();

@@ -165,3 +162,3 @@

node.id,
b.callExpression(markMethod, [node])
b.callExpression(runtimeMarkMethod, [node])
)

@@ -192,3 +189,3 @@ ]);

n.FunctionExpression.assert(node);
return b.callExpression(markMethod, [node]);
return b.callExpression(runtimeMarkMethod, [node]);
}

@@ -205,7 +202,3 @@ },

b.callExpression(
b.memberExpression(
b.identifier("wrapGenerator"),
b.identifier("values"),
false
),
runtimeValuesMethod,
[node.right]

@@ -296,7 +289,4 @@ )

if (n.CallExpression.check(decl.init) &&
n.MemberExpression.check(decl.init.callee) &&
n.Identifier.check(decl.init.callee.object) &&
n.Identifier.check(decl.init.callee.property) &&
decl.init.callee.object.name === "wrapGenerator" &&
decl.init.callee.property.name === "mark") {
types.astNodesAreEquivalent(decl.init.callee,
runtimeMarkMethod)) {
return true;

@@ -303,0 +293,0 @@ }

@@ -14,2 +14,3 @@ /**

var fs = require("fs");
var through = require("through");
var transform = require("./lib/visit").transform;

@@ -22,5 +23,14 @@ var utils = require("./lib/util");

require("./runtime/dev");
function regenerator(source, options) {
options = normalizeOptions(options);
if (isFileName(source)) {
// If source is a file name, assume we were invoked as a browserify
// transform, and return a stream.
// TODO Move the normal behavior into regenerator.compile in v0.6.
return createStream(options);
}
var runtime = options.includeRuntime ? fs.readFileSync(

@@ -51,2 +61,20 @@ regenerator.runtime.dev, "utf-8"

function isFileName(str) {
return /\.js$/.test(str) && fs.existsSync(str);
}
function createStream(options) {
var data = [];
return through(write, end);
function write(buf) {
data.push(buf);
}
function end() {
this.queue(regenerator(data.join(""), options));
this.queue(null);
}
}
function normalizeOptions(options) {

@@ -53,0 +81,0 @@ options = utils.defaults(options || {}, {

@@ -19,3 +19,3 @@ {

],
"version": "0.5.0",
"version": "0.5.3",
"homepage": "http://github.com/facebook/regenerator",

@@ -36,2 +36,3 @@ "repository": {

"private": "~0.1.5",
"through": "~2.3.4",
"defs": "~0.6.2"

@@ -38,0 +39,0 @@ },

@@ -17,22 +17,19 @@ /**

// functions that return Generator objects.
GeneratorFunction,
// Undefined value, more compressible than void 0.
undefined
GeneratorFunction
) {
var hasOwn = Object.prototype.hasOwnProperty;
var undefined; // More compressible than void 0.
if (global.wrapGenerator) {
if (global.regeneratorRuntime) {
return;
}
function wrapGenerator(innerFn, outerFn, self, tryList) {
var runtime = global.regeneratorRuntime =
typeof exports === "undefined" ? {} : exports;
function wrap(innerFn, outerFn, self, tryList) {
return new Generator(innerFn, outerFn, self || null, tryList || []);
}
runtime.wrap = wrap;
global.wrapGenerator = wrapGenerator;
if (typeof exports !== "undefined") {
exports.wrapGenerator = wrapGenerator;
}
var GenStateSuspendedStart = "suspendedStart";

@@ -53,3 +50,3 @@ var GenStateSuspendedYield = "suspendedYield";

wrapGenerator.mark = function(genFun) {
runtime.mark = function(genFun) {
genFun.__proto__ = GFp;

@@ -65,3 +62,3 @@ genFun.prototype = Object.create(Gp);

wrapGenerator.isGeneratorFunction = function(genFun) {
runtime.isGeneratorFunction = function(genFun) {
var ctor = genFun && genFun.constructor;

@@ -236,3 +233,3 @@ return ctor ? GeneratorFunction.name === ctor.name : false;

wrapGenerator.keys = function(object) {
runtime.keys = function(object) {
var keys = [];

@@ -286,3 +283,3 @@ for (var key in object) {

}
wrapGenerator.values = values;
runtime.values = values;

@@ -289,0 +286,0 @@ Context.prototype = {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc