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.21.4-esm.2 to 7.21.4-esm.3

52

lib/index.js

@@ -1,7 +0,25 @@

import environmentVisitor from "@babel/helper-environment-visitor";
import memberExpressionToFunctions from "@babel/helper-member-expression-to-functions";
import optimiseCall from "@babel/helper-optimise-call-expression";
import template from "@babel/template";
import traverse from "@babel/traverse";
import * as _t from "@babel/types";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
Object.defineProperty(exports, "environmentVisitor", {
enumerable: true,
get: function () {
return _helperEnvironmentVisitor.default;
}
});
Object.defineProperty(exports, "skipAllButComputedKey", {
enumerable: true,
get: function () {
return _helperEnvironmentVisitor.skipAllButComputedKey;
}
});
var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor");
var _helperMemberExpressionToFunctions = require("@babel/helper-member-expression-to-functions");
var _helperOptimiseCallExpression = require("@babel/helper-optimise-call-expression");
var _template = require("@babel/template");
var _traverse = require("@babel/traverse");
var _t = require("@babel/types");
const {

@@ -18,3 +36,2 @@ assignmentExpression,

} = _t;
export { default as environmentVisitor, skipAllButComputedKey } from "@babel/helper-environment-visitor";
function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) {

@@ -25,3 +42,3 @@ objectRef = cloneNode(objectRef);

}
const visitor = traverse.visitors.merge([environmentVisitor, {
const visitor = _traverse.default.visitors.merge([_helperEnvironmentVisitor.default, {
Super(path, state) {

@@ -38,3 +55,3 @@ const {

}]);
const unshadowSuperBindingVisitor = traverse.visitors.merge([environmentVisitor, {
const unshadowSuperBindingVisitor = _traverse.default.visitors.merge([_helperEnvironmentVisitor.default, {
Scopable(path, {

@@ -110,15 +127,15 @@ refName

const thisRefs = this._getThisRefs();
return optimiseCall(this._get(superMember, thisRefs), cloneNode(thisRefs.this), args, false);
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), cloneNode(thisRefs.this), args, false);
},
optionalCall(superMember, args) {
const thisRefs = this._getThisRefs();
return optimiseCall(this._get(superMember, thisRefs), cloneNode(thisRefs.this), args, true);
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), cloneNode(thisRefs.this), args, true);
},
delete(superMember) {
if (superMember.node.computed) {
return sequenceExpression([callExpression(this.file.addHelper("toPropertyKey"), [cloneNode(superMember.node.property)]), template.expression.ast`
return sequenceExpression([callExpression(this.file.addHelper("toPropertyKey"), [cloneNode(superMember.node.property)]), _template.default.expression.ast`
function () { throw new ReferenceError("'delete super[expr]' is invalid"); }()
`]);
} else {
return template.expression.ast`
return _template.default.expression.ast`
function () { throw new ReferenceError("'delete super.prop' is invalid"); }()

@@ -173,9 +190,9 @@ `;

call(superMember, args) {
return optimiseCall(this.get(superMember), thisExpression(), args, false);
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), thisExpression(), args, false);
},
optionalCall(superMember, args) {
return optimiseCall(this.get(superMember), thisExpression(), args, true);
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), thisExpression(), args, true);
}
});
export default class ReplaceSupers {
class ReplaceSupers {
constructor(opts) {

@@ -210,3 +227,3 @@ var _opts$constantSuper;

const handler = this.constantSuper ? looseHandlers : specHandlers;
memberExpressionToFunctions(this.methodPath, visitor, Object.assign({
(0, _helperMemberExpressionToFunctions.default)(this.methodPath, visitor, Object.assign({
file: this.file,

@@ -223,3 +240,4 @@ scope: this.methodPath.scope,

}
exports.default = ReplaceSupers;
//# sourceMappingURL=index.js.map
{
"name": "@babel/helper-replace-supers",
"version": "7.21.4-esm.2",
"version": "7.21.4-esm.3",
"description": "Helper function to replace supers",

@@ -17,8 +17,8 @@ "repository": {

"dependencies": {
"@babel/helper-environment-visitor": "7.21.4-esm.2",
"@babel/helper-member-expression-to-functions": "7.21.4-esm.2",
"@babel/helper-optimise-call-expression": "7.21.4-esm.2",
"@babel/template": "7.21.4-esm.2",
"@babel/traverse": "7.21.4-esm.2",
"@babel/types": "7.21.4-esm.2"
"@babel/helper-environment-visitor": "7.21.4-esm.3",
"@babel/helper-member-expression-to-functions": "7.21.4-esm.3",
"@babel/helper-optimise-call-expression": "7.21.4-esm.3",
"@babel/template": "7.21.4-esm.3",
"@babel/traverse": "7.21.4-esm.3",
"@babel/types": "7.21.4-esm.3"
},

@@ -25,0 +25,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