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

@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly

Package Overview
Dependencies
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly - npm Package Compare versions

Comparing version 7.23.3 to 8.0.0-alpha.5

41

lib/index.js

@@ -1,14 +0,10 @@

'use strict';
import { types } from '@babel/core';
import { declare } from '@babel/helper-plugin-utils';
import { requeueComputedKeyAndDecorators } from '@babel/helper-environment-visitor';
Object.defineProperty(exports, '__esModule', { value: true });
var core = require('@babel/core');
var helperPluginUtils = require('@babel/helper-plugin-utils');
var helperEnvironmentVisitor = require('@babel/helper-environment-visitor');
function isNameOrLength(key) {
if (core.types.isIdentifier(key)) {
if (types.isIdentifier(key)) {
return key.name === "name" || key.name === "length";
}
if (core.types.isStringLiteral(key)) {
if (types.isStringLiteral(key)) {
return key.value === "name" || key.value === "length";

@@ -19,3 +15,3 @@ }

function isStaticFieldWithValue(node) {
return (core.types.isClassProperty(node) || core.types.isClassPrivateProperty(node)) && node.static && !!node.value;
return (types.isClassProperty(node) || types.isClassPrivateProperty(node)) && node.static && !!node.value;
}

@@ -38,3 +34,3 @@ const hasReferenceVisitor = {

function isReferenceOrThis(node, name) {
return core.types.isThisExpression(node) || name && core.types.isIdentifier(node, {
return types.isThisExpression(node) || name && types.isIdentifier(node, {
name

@@ -57,3 +53,3 @@ });

if (path.isMethod()) {
helperEnvironmentVisitor.requeueComputedKeyAndDecorators(path);
requeueComputedKeyAndDecorators(path);
}

@@ -63,6 +59,5 @@ }

function getPotentiallyBuggyFieldsIndexes(path) {
var _path$node$id;
const buggyPublicStaticFieldsIndexes = [];
let classReferenced = false;
const className = (_path$node$id = path.node.id) == null ? void 0 : _path$node$id.name;
const className = path.node.id?.name;
const hasReferenceState = {

@@ -87,3 +82,3 @@ name: className,

if (!nextPotentiallyBuggy) {
if (core.types.isStaticBlock(node)) {
if (types.isStaticBlock(node)) {
classReferenced = true;

@@ -104,3 +99,3 @@ nextPotentiallyBuggy = true;

}
if (core.types.isClassProperty(node, {
if (types.isClassProperty(node, {
static: true

@@ -120,3 +115,3 @@ }) && (nextPotentiallyBuggy || node.computed || isNameOrLength(node.key))) {

const node = body[i];
if (core.types.isClassProperty(node, {
if (types.isClassProperty(node, {
static: true,

@@ -152,9 +147,9 @@ computed: false

function buildFieldsReplacement(fields, scope, file) {
return core.types.staticBlock(fields.map(field => {
const key = field.computed || !core.types.isIdentifier(field.key) ? field.key : core.types.stringLiteral(field.key.name);
return core.types.expressionStatement(core.types.callExpression(file.addHelper("defineProperty"), [core.types.thisExpression(), key, field.value || scope.buildUndefinedNode()]));
return types.staticBlock(fields.map(field => {
const key = field.computed || !types.isIdentifier(field.key) ? field.key : types.stringLiteral(field.key.name);
return types.expressionStatement(types.callExpression(file.addHelper("defineProperty"), [types.thisExpression(), key, field.value || scope.buildUndefinedNode()]));
}));
}
var index = helperPluginUtils.declare(api => {
api.assertVersion(7);
var index = declare(api => {
api.assertVersion("8.0.0-alpha.5");
const setPublicClassFields = api.assumption("setPublicClassFields");

@@ -179,3 +174,3 @@ return {

exports.default = index;
export { index as default };
//# sourceMappingURL=index.js.map
{
"name": "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly",
"version": "7.23.3",
"version": "8.0.0-alpha.5",
"description": "Transform static class fields assignments that are affected by https://crbug.com/v8/12421",

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

"dependencies": {
"@babel/helper-environment-visitor": "^7.22.20",
"@babel/helper-plugin-utils": "^7.22.5"
"@babel/helper-environment-visitor": "^8.0.0-alpha.5",
"@babel/helper-plugin-utils": "^8.0.0-alpha.5"
},
"peerDependencies": {
"@babel/core": "^7.0.0"
"@babel/core": "^8.0.0-alpha.5"
},
"devDependencies": {
"@babel/core": "^7.23.3",
"@babel/helper-plugin-test-runner": "^7.22.5",
"@babel/traverse": "^7.23.3"
"@babel/core": "^8.0.0-alpha.5",
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.5",
"@babel/traverse": "^8.0.0-alpha.5"
},
"engines": {
"node": ">=6.9.0"
"node": "^16.20.0 || ^18.16.0 || >=20.0.0"
},
"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
"type": "module"
}

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