Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/helper-transform-fixture-test-runner

Package Overview
Dependencies
Maintainers
6
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-transform-fixture-test-runner - npm Package Compare versions

Comparing version 7.0.0-beta.38 to 7.0.0-beta.39

112

lib/index.js

@@ -130,2 +130,112 @@ "use strict";

function checkDuplicatedNodes(ast) {
var nodes = new WeakSet();
var parents = new WeakMap();
var setParent = function setParent(child, parent) {
if (typeof child === "object" && child !== null) {
var p = parents.get(child);
if (!p) {
p = [];
parents.set(child, p);
}
p.unshift(parent);
}
};
var registerChildren = function registerChildren(node) {
for (var key in node) {
if (Array.isArray(node[key])) {
node[key].forEach(function (child) {
return setParent(child, node);
});
} else {
setParent(node[key], node);
}
}
};
var parentIs = function parentIs(node, test) {
return (parents.get(node) || []).some(function (parent) {
return test(parent);
});
};
var isByRegenerator = function isByRegenerator(node) {
if (!node) {
return false;
} else if (node.type === "Identifier") {
if (/^_(?:context|value|callee|marked)\d*$/.test(node.name)) {
return true;
} else if (/^t\d+$/.test(node.name) && parentIs(node, function (parent) {
return parent.type === "MemberExpression" && isByRegenerator(parent.object);
})) {
return true;
} else if (parentIs(node, function (parent) {
return parent.type === "VariableDeclarator" && parentIs(parent, function (parent) {
return parent.type === "VariableDeclaration" && parentIs(parent, function (parent) {
return parent.type === "BlockStatement" && parentIs(parent, function (parent) {
return parent.type === "FunctionExpression" && isByRegenerator(parent.id);
});
});
});
})) {
return true;
} else if (parentIs(node, function (parent) {
return parent.type === "VariableDeclarator" && parentIs(parent, function (parent) {
return parent.type === "VariableDeclaration" && parentIs(parent, function (parent) {
return parent.type === "BlockStatement" && parent.body.length === 2 && parent.body[1].type === "ReturnStatement" && parent.body[1].argument.type === "CallExpression" && parent.body[1].argument.callee.type === "MemberExpression" && parent.body[1].argument.callee.property.type === "Identifier" && parent.body[1].argument.callee.property.name === "wrap";
});
});
})) {
return true;
} else if (parentIs(node, function (parent) {
return parent.type === "CallExpression" && parent.arguments.length === 3 && parent.arguments[1] === node && parent.callee.type === "MemberExpression" && parent.callee.property.type === "Identifier" && parent.callee.property.name === "wrap";
})) {
return true;
} else if (parentIs(node, function (parent) {
return parent.type === "CallExpression" && parent.callee.type === "MemberExpression" && parent.callee.property.type === "Identifier" && parent.callee.property.name === "mark";
})) {
return true;
}
} else if (node.type === "MemberExpression") {
return isByRegenerator(node.object);
} else if (node.type === "CallExpression") {
return isByRegenerator(node.callee);
} else if (node.type === "AssignmentExpression") {
return isByRegenerator(node.left);
} else if (node.type === "NumericLiteral") {
if (parentIs(node, function (parent) {
return parent.type === "AssignmentExpression" && isByRegenerator(parent.left);
})) {
return true;
} else if (parentIs(node, function (parent) {
return parent.type === "CallExpression" && parent.callee.type === "MemberExpression" && isByRegenerator(parent.callee.object);
})) {
return true;
}
}
return false;
};
var hidePrivateProperties = function hidePrivateProperties(key, val) {
if (key[0] === "_") return "[Private]";
return val;
};
babel.types.traverseFast(ast, function (node) {
registerChildren(node);
if (isByRegenerator(node)) return;
if (nodes.has(node)) {
throw new Error("Do not reuse nodes. Use `t.cloneNode` to copy them.\n" + JSON.stringify(node, hidePrivateProperties, 2) + "\nParent:\n" + JSON.stringify(parents.get(node), hidePrivateProperties, 2));
}
nodes.add(node);
});
}
function run(task) {

@@ -160,2 +270,3 @@ var actual = task.actual;

result = babel.transform(execCode, execOpts);
checkDuplicatedNodes(result.ast);
execCode = result.code;

@@ -176,2 +287,3 @@

result = babel.transform(actualCode, getOpts(actual));
checkDuplicatedNodes(result.ast);

@@ -178,0 +290,0 @@ if (!expect.code && result.code && !opts.throws && _fs.default.statSync(_path.default.dirname(expect.loc)).isDirectory() && !process.env.CI) {

10

package.json
{
"name": "@babel/helper-transform-fixture-test-runner",
"version": "7.0.0-beta.38",
"version": "7.0.0-beta.39",
"description": "Transform test runner for @babel/helper-fixtures module",

@@ -11,6 +11,6 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"dependencies": {
"@babel/code-frame": "7.0.0-beta.38",
"@babel/core": "7.0.0-beta.38",
"@babel/helper-fixtures": "7.0.0-beta.38",
"@babel/polyfill": "7.0.0-beta.38",
"@babel/code-frame": "7.0.0-beta.39",
"@babel/core": "7.0.0-beta.39",
"@babel/helper-fixtures": "7.0.0-beta.39",
"@babel/polyfill": "7.0.0-beta.39",
"chai": "^4.1.0",

@@ -17,0 +17,0 @@ "lodash": "^4.2.0",

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