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

@babel/helper-member-expression-to-functions

Package Overview
Dependencies
Maintainers
4
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-member-expression-to-functions - npm Package Compare versions

Comparing version 7.20.7 to 7.21.0

62

lib/index.js

@@ -129,3 +129,2 @@ 'use strict';

}
function isInDetachedTree(path) {

@@ -141,4 +140,3 @@ while (path) {

if (listKey) {
if (container !==
parentNode[listKey]) {
if (container !== parentNode[listKey]) {
return true;

@@ -154,5 +152,3 @@ }

const handle = {
memoise() {
},
memoise() {},
handle(member, noDocumentAll) {

@@ -167,3 +163,2 @@ const {

if (isInDetachedTree(member)) return;
const endPath = member.find(({

@@ -177,12 +172,8 @@ node,

if (isOptionalCallExpression(parent)) {
return (
node !== member.node && parent.optional || parent.callee !== node
);
return node !== member.node && parent.optional || parent.callee !== node;
}
return true;
});
if (scope.path.isPattern()) {
endPath.replaceWith(
callExpression(arrowFunctionExpression([], endPath.node), []));
endPath.replaceWith(callExpression(arrowFunctionExpression([], endPath.node), []));
return;

@@ -205,3 +196,2 @@ }

}
let startingOptional = member;

@@ -220,9 +210,5 @@ for (;;) {

}
const startingNode = startingOptional.isOptionalMemberExpression() ?
startingOptional.node.object :
startingOptional.node.callee;
const startingNode = startingOptional.isOptionalMemberExpression() ? startingOptional.node.object : startingOptional.node.callee;
const baseNeedsMemoised = scope.maybeGenerateMemoised(startingNode);
const baseRef = baseNeedsMemoised != null ? baseNeedsMemoised : startingNode;
const parentIsOptionalCall = parentPath.isOptionalCallExpression({

@@ -272,4 +258,3 @@ callee: node

if (context) {
regular.object = assignmentExpression("=", context,
object);
regular.object = assignmentExpression("=", context, object);
}

@@ -282,4 +267,3 @@ }

}
const baseMemoised = baseNeedsMemoised ? assignmentExpression("=",
cloneNode(baseRef), cloneNode(startingNode)) : cloneNode(baseRef);
const baseMemoised = baseNeedsMemoised ? assignmentExpression("=", cloneNode(baseRef), cloneNode(startingNode)) : cloneNode(baseRef);
if (willEndPathCastToBoolean) {

@@ -302,3 +286,2 @@ let nonNullishCheck;

}
if (context) {

@@ -310,3 +293,2 @@ const endParent = endParentPath.node;

}
if (isUpdateExpression(parent, {

@@ -323,3 +305,2 @@ argument: node

} = parent;
this.memoise(member, 2);

@@ -330,7 +311,5 @@ const ref = scope.generateUidIdentifierBasedOnNode(node);

});
const seq = [
assignmentExpression("=", cloneNode(ref), this.get(member))];
const seq = [assignmentExpression("=", cloneNode(ref), this.get(member))];
if (prefix) {
seq.push(updateExpression(operator, cloneNode(ref), prefix));
const value = sequenceExpression(seq);

@@ -345,3 +324,2 @@ parentPath.replaceWith(this.set(member, value));

seq.push(assignmentExpression("=", cloneNode(ref2), updateExpression(operator, cloneNode(ref), prefix)), cloneNode(ref));
const value = sequenceExpression(seq);

@@ -352,3 +330,2 @@ parentPath.replaceWith(sequenceExpression([this.set(member, value), cloneNode(ref2)]));

}
if (parentPath.isAssignmentExpression({

@@ -379,3 +356,2 @@ left: node

}
if (parentPath.isCallExpression({

@@ -387,3 +363,2 @@ callee: node

}
if (parentPath.isOptionalCallExpression({

@@ -393,4 +368,3 @@ callee: node

if (scope.path.isPattern()) {
parentPath.replaceWith(
callExpression(arrowFunctionExpression([], parentPath.node), []));
parentPath.replaceWith(callExpression(arrowFunctionExpression([], parentPath.node), []));
return;

@@ -401,3 +375,2 @@ }

}
if (this.delete && parentPath.isUnaryExpression({

@@ -409,20 +382,13 @@ operator: "delete"

}
if (
parentPath.isForXStatement({
if (parentPath.isForXStatement({
left: node
}) ||
parentPath.isObjectProperty({
}) || parentPath.isObjectProperty({
value: node
}) && parentPath.parentPath.isObjectPattern() ||
parentPath.isAssignmentPattern({
}) && parentPath.parentPath.isObjectPattern() || parentPath.isAssignmentPattern({
left: node
}) && parentPath.parentPath.isObjectProperty({
value: parent
}) && parentPath.parentPath.parentPath.isObjectPattern() ||
parentPath.isArrayPattern() ||
parentPath.isAssignmentPattern({
}) && parentPath.parentPath.parentPath.isObjectPattern() || parentPath.isArrayPattern() || parentPath.isAssignmentPattern({
left: node
}) && parentPath.parentPath.isArrayPattern() ||
parentPath.isRestElement()) {
}) && parentPath.parentPath.isArrayPattern() || parentPath.isRestElement()) {
member.replaceWith(this.destructureSet(member));

@@ -429,0 +395,0 @@ return;

{
"name": "@babel/helper-member-expression-to-functions",
"version": "7.20.7",
"version": "7.21.0",
"description": "Helper function to replace certain member expressions with function calls",

@@ -18,6 +18,6 @@ "repository": {

"dependencies": {
"@babel/types": "^7.20.7"
"@babel/types": "^7.21.0"
},
"devDependencies": {
"@babel/traverse": "^7.20.7"
"@babel/traverse": "^7.21.0"
},

@@ -24,0 +24,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

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