Socket
Socket
Sign inDemoInstall

@babel/helper-create-class-features-plugin

Package Overview
Dependencies
Maintainers
6
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-create-class-features-plugin - npm Package Compare versions

Comparing version 7.14.5 to 7.14.6

25

lib/fields.js

@@ -644,6 +644,19 @@ "use strict";

function replaceThisContext(path, ref, getSuperRef, file, isStaticBlock, constantSuper) {
const innerReferencesVisitor = {
ReferencedIdentifier(path, state) {
if (path.scope.bindingIdentifierEquals(path.node.name, state.innerBinding)) {
state.needsClassRef = true;
path.node.name = state.classRef.name;
}
}
};
function replaceThisContext(path, ref, getSuperRef, file, isStaticBlock, constantSuper, innerBindingRef) {
var _state$classRef;
const state = {
classRef: ref,
needsClassRef: false
needsClassRef: false,
innerBinding: innerBindingRef
};

@@ -669,6 +682,10 @@ const replacer = new _helperReplaceSupers.default({

if ((_state$classRef = state.classRef) != null && _state$classRef.name && state.classRef.name !== (innerBindingRef == null ? void 0 : innerBindingRef.name)) {
path.traverse(innerReferencesVisitor, state);
}
return state.needsClassRef;
}
function buildFieldsInitNodes(ref, superRef, props, privateNamesMap, state, setPublicClassFields, privateFieldsAsProperties, constantSuper) {
function buildFieldsInitNodes(ref, superRef, props, privateNamesMap, state, setPublicClassFields, privateFieldsAsProperties, constantSuper, innerBindingRef) {
let needsClassRef = false;

@@ -697,3 +714,3 @@ let injectSuperRef;

if (isStatic || isMethod && isPrivate || isStaticBlock) {
const replaced = replaceThisContext(prop, ref, getSuperRef, state, isStaticBlock, constantSuper);
const replaced = replaceThisContext(prop, ref, getSuperRef, state, isStaticBlock, constantSuper, innerBindingRef);
needsClassRef = needsClassRef || replaced;

@@ -700,0 +717,0 @@ }

7

lib/index.js

@@ -40,3 +40,3 @@ "use strict";

const version = "7.14.5".split(".").reduce((v, x) => v * 1e5 + +x, 0);
const version = "7.14.6".split(".").reduce((v, x) => v * 1e5 + +x, 0);
const versionKey = "@babel/plugin-class-features/version";

@@ -150,5 +150,6 @@

if (!props.length && !isDecorated) return;
const innerBinding = path.node.id;
let ref;
if (path.isClassExpression() || !path.node.id) {
if (!innerBinding || path.isClassExpression()) {
(0, _helperFunctionName.default)(path);

@@ -181,3 +182,3 @@ ref = path.scope.generateUidIdentifier("class");

wrapClass
} = (0, _fields.buildFieldsInitNodes)(ref, path.node.superClass, props, privateNamesMap, state, setPublicClassFields != null ? setPublicClassFields : loose, privateFieldsAsProperties != null ? privateFieldsAsProperties : loose, constantSuper != null ? constantSuper : loose));
} = (0, _fields.buildFieldsInitNodes)(ref, path.node.superClass, props, privateNamesMap, state, setPublicClassFields != null ? setPublicClassFields : loose, privateFieldsAsProperties != null ? privateFieldsAsProperties : loose, constantSuper != null ? constantSuper : loose, innerBinding));
}

@@ -184,0 +185,0 @@

{
"name": "@babel/helper-create-class-features-plugin",
"version": "7.14.5",
"version": "7.14.6",
"author": "The Babel Team (https://babel.dev/team)",

@@ -32,3 +32,3 @@ "license": "MIT",

"devDependencies": {
"@babel/core": "7.14.5",
"@babel/core": "7.14.6",
"@babel/helper-plugin-test-runner": "7.14.5",

@@ -35,0 +35,0 @@ "@babel/preset-env": "7.14.5"

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