Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
@babel/helper-create-class-features-plugin
Advanced tools
Compile class public and private fields, private methods and decorators to ES6
Weekly downloads
Package description
The @babel/helper-create-class-features-plugin is a helper package used internally by Babel plugins to handle the transformation of class features. It is not intended to be used directly by end users, but rather as a utility for plugin authors to create transformations for class properties, private methods, and other class-related syntax in a consistent way.
Class Properties
This feature allows the transformation of class properties so that they can be compiled into a format that is compatible with environments that do not support the latest ECMAScript standards. The code sample shows how a class property is transformed into a constructor assignment with a helper function.
"use strict";
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
class Example {
constructor() {
_defineProperty(this, "state", {});
}
}
Private Methods
This feature enables the transformation of private methods in a class. The code sample illustrates how a private method is transformed using WeakSets and helper functions to ensure that the method remains private and is not accessible outside the class.
"use strict";
function _classPrivateMethodInitSpec(obj, privateSet) {
// ...implementation details
}
function _classPrivateMethodGet(receiver, privateSet, fn) {
// ...implementation details
}
class Example {
constructor() {
_classPrivateMethodInitSpec(this, _privateMethod);
}
}
var _privateMethod = new WeakSet();
This package is a Babel plugin that transforms static class properties as well as properties declared with the property initializer syntax. It is similar to @babel/helper-create-class-features-plugin in that it handles class properties, but it is a full plugin that can be added to a Babel configuration, whereas the helper package is used internally by such plugins.
Similar to @babel/helper-create-class-features-plugin, this Babel plugin transforms private methods and accessors in classes. It provides the functionality to use private syntax in class bodies and is intended for direct use in Babel configurations, unlike the helper package which is used under the hood by this and other plugins.
Changelog
v7.20.5 (2022-11-28)
babel-helpers
, babel-plugin-transform-destructuring
, babel-plugin-transform-modules-commonjs
, babel-preset-env
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
, babel-traverse
babel-cli
, babel-helpers
, babel-plugin-proposal-class-properties
, babel-plugin-proposal-class-static-block
, babel-plugin-transform-classes
, babel-plugin-transform-runtime
, babel-preset-env
babel-helper-create-class-features-plugin
, babel-helpers
, babel-plugin-proposal-decorators
, babel-plugin-proposal-private-property-in-object
, babel-preset-env
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
babel-parser
babel-helper-wrap-function
, babel-preset-env
, babel-traverse
noNewArrow
assumption (@liuxingbaoyu)babel-plugin-transform-arrow-functions
, babel-plugin-transform-parameters
, babel-traverse
super()
in arrow functions with default / rest parameters (@SuperSodaSea)babel-helpers
, babel-node
, babel-plugin-proposal-async-generator-functions
, babel-plugin-transform-regenerator
, babel-preset-env
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
regenerator
and add tests (@SuperSodaSea)babel-helper-create-regexp-features-plugin
regjsparser
for @babel/standalone
(@liuxingbaoyu)babel-parser
, babel-types
babel-generator
(``)
(@nicolo-ribaudo)babel-plugin-transform-block-scoping
, babel-traverse
switch
's discriminant
in the outer scope (@nicolo-ribaudo)babel-generator
comments:false
(@liuxingbaoyu)babel-plugin-transform-block-scoping
Readme
Compile class public and private fields, private methods and decorators to ES6
See our website @babel/helper-create-class-features-plugin for more information.
Using npm:
npm install --save @babel/helper-create-class-features-plugin
or using yarn:
yarn add @babel/helper-create-class-features-plugin
FAQs
Compile class public and private fields, private methods and decorators to ES6
The npm package @babel/helper-create-class-features-plugin receives a total of 21,087,756 weekly downloads. As such, @babel/helper-create-class-features-plugin popularity was classified as popular.
We found that @babel/helper-create-class-features-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.