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

@babel/helper-replace-supers

Package Overview
Dependencies
Maintainers
4
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-replace-supers - npm Package Compare versions

Comparing version 7.22.20 to 7.24.1

28

lib/index.js

@@ -91,14 +91,8 @@ "use strict";

const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
return callExpression(this.file.addHelper("get"), [thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), thisRefs.this]);
return callExpression(this.file.addHelper("get"), [thisRefs.needAccessFirst ? sequenceExpression([thisRefs.this, proto]) : proto, this.prop(superMember), thisRefs.this]);
},
_getThisRefs() {
if (!this.isDerivedConstructor) {
return {
this: thisExpression()
};
}
const thisRef = this.scope.generateDeclaredUidIdentifier("thisSuper");
return {
memo: assignmentExpression("=", thisRef, thisExpression()),
this: cloneNode(thisRef)
needAccessFirst: this.isDerivedConstructor,
this: thisExpression()
};

@@ -109,3 +103,3 @@ },

const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
return callExpression(this.file.addHelper("set"), [thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), value, thisRefs.this, booleanLiteral(superMember.isInStrictMode())]);
return callExpression(this.file.addHelper("set"), [thisRefs.needAccessFirst ? sequenceExpression([thisRefs.this, proto]) : proto, this.prop(superMember), value, thisRefs.this, booleanLiteral(superMember.isInStrictMode())]);
},

@@ -209,4 +203,7 @@ destructureSet(superMember) {

replace() {
const {
methodPath
} = this;
if (this.opts.refToPreserve) {
this.methodPath.traverse(unshadowSuperBindingVisitor, {
methodPath.traverse(unshadowSuperBindingVisitor, {
refName: this.opts.refToPreserve.name

@@ -216,3 +213,10 @@ });

const handler = this.constantSuper ? looseHandlers : specHandlers;
(0, _helperMemberExpressionToFunctions.default)(this.methodPath, visitor, Object.assign({
visitor.shouldSkip = path => {
if (path.parentPath === methodPath) {
if (path.parentKey === "decorators" || path.parentKey === "key") {
return true;
}
}
};
(0, _helperMemberExpressionToFunctions.default)(methodPath, visitor, Object.assign({
file: this.file,

@@ -219,0 +223,0 @@ scope: this.methodPath.scope,

{
"name": "@babel/helper-replace-supers",
"version": "7.22.20",
"version": "7.24.1",
"description": "Helper function to replace supers",

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

"@babel/helper-environment-visitor": "^7.22.20",
"@babel/helper-member-expression-to-functions": "^7.22.15",
"@babel/helper-member-expression-to-functions": "^7.23.0",
"@babel/helper-optimise-call-expression": "^7.22.5"
},
"devDependencies": {
"@babel/core": "^7.22.20"
"@babel/core": "^7.24.1"
},

@@ -25,0 +25,0 @@ "peerDependencies": {

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