Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-classes

Package Overview
Dependencies
58
Maintainers
4
Versions
95
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.23.5 to 7.23.8

lib/inline-callSuper-helpers.js

27

lib/transformClass.js

@@ -10,6 +10,5 @@ "use strict";

var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor");
var _helperOptimiseCallExpression = require("@babel/helper-optimise-call-expression");
var _core = require("@babel/core");
var _helperAnnotateAsPure = require("@babel/helper-annotate-as-pure");
var _inlineCreateSuperHelpers = require("./inline-createSuper-helpers.js");
var _inlineCallSuperHelpers = require("./inline-callSuper-helpers.js");
function buildConstructor(classRef, constructorBody, node) {

@@ -29,3 +28,2 @@ const func = _core.types.functionDeclaration(_core.types.cloneNode(classRef), [], constructorBody);

classRef: undefined,
superFnId: undefined,
superName: null,

@@ -195,3 +193,15 @@ superReturns: [],

} else {
call = (0, _helperOptimiseCallExpression.default)(_core.types.cloneNode(classState.superFnId), _core.types.thisExpression(), bareSuperNode.arguments, false);
var _bareSuperNode$argume;
const args = [_core.types.thisExpression(), _core.types.cloneNode(classState.classRef)];
if ((_bareSuperNode$argume = bareSuperNode.arguments) != null && _bareSuperNode$argume.length) {
const bareSuperNodeArguments = bareSuperNode.arguments;
if (bareSuperNodeArguments.length === 1 && _core.types.isSpreadElement(bareSuperNodeArguments[0]) && _core.types.isIdentifier(bareSuperNodeArguments[0].argument, {
name: "arguments"
})) {
args.push(bareSuperNodeArguments[0].argument);
} else {
args.push(_core.types.arrayExpression(bareSuperNodeArguments));
}
}
call = _core.types.callExpression((0, _inlineCallSuperHelpers.default)(classState.file), args);
}

@@ -390,10 +400,3 @@ if (bareSuper.parentPath.isExpressionStatement() && bareSuper.parentPath.container === body.node.body && body.node.body.length - 1 === bareSuper.parentPath.key) {

if (!classState.isDerived || classState.pushedInherits) return;
const superFnId = path.scope.generateUidIdentifier("super");
setState({
pushedInherits: true,
superFnId
});
if (!assumptions.superIsCallableConstructor) {
classState.body.unshift(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(superFnId, _core.types.callExpression((0, _inlineCreateSuperHelpers.default)(classState.file), [_core.types.cloneNode(classState.classRef)]))]));
}
classState.pushedInherits = true;
classState.body.unshift(_core.types.expressionStatement(_core.types.callExpression(classState.file.addHelper(classState.isLoose ? "inheritsLoose" : "inherits"), [_core.types.cloneNode(classState.classRef), _core.types.cloneNode(classState.superName)])));

@@ -400,0 +403,0 @@ }

{
"name": "@babel/plugin-transform-classes",
"version": "7.23.5",
"version": "7.23.8",
"description": "Compile ES2015 classes to ES5",

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

"@babel/helper-annotate-as-pure": "^7.22.5",
"@babel/helper-compilation-targets": "^7.22.15",
"@babel/helper-compilation-targets": "^7.23.6",
"@babel/helper-environment-visitor": "^7.22.20",
"@babel/helper-function-name": "^7.23.0",
"@babel/helper-optimise-call-expression": "^7.22.5",
"@babel/helper-plugin-utils": "^7.22.5",

@@ -35,5 +34,5 @@ "@babel/helper-replace-supers": "^7.22.20",

"devDependencies": {
"@babel/core": "^7.23.5",
"@babel/core": "^7.23.7",
"@babel/helper-plugin-test-runner": "^7.22.5",
"@babel/traverse": "^7.23.5"
"@babel/traverse": "^7.23.7"
},

@@ -40,0 +39,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc