Socket
Socket
Sign inDemoInstall

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

Package Overview
Dependencies
57
Maintainers
4
Versions
95
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Compile class public and private fields, private methods and decorators to ES6


Version published
Maintainers
4
Weekly downloads
25,669,627
decreased by-8.02%

Weekly downloads

Package description

What is @babel/helper-create-class-features-plugin?

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.

What are @babel/helper-create-class-features-plugin's main functionalities?

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();

Other packages similar to @babel/helper-create-class-features-plugin

Changelog

Source

v7.20.5 (2022-11-28)

:eyeglasses: Spec Compliance
  • babel-helpers, babel-plugin-transform-destructuring, babel-plugin-transform-modules-commonjs, babel-preset-env, babel-runtime-corejs2, babel-runtime-corejs3, babel-runtime, babel-traverse
    • #15183 Improve array destructuring spec compliance (@SuperSodaSea)
  • 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
    • #15182 fix: apply toPropertyKey when defining class members (@JLHwung)
  • 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
:bug: Bug Fix
  • babel-parser
  • babel-helper-wrap-function, babel-preset-env, babel-traverse
  • babel-plugin-transform-arrow-functions, babel-plugin-transform-parameters, babel-traverse
    • #15163 fix: Throw error when compiling 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
  • babel-helper-create-regexp-features-plugin
  • babel-parser, babel-types
  • babel-generator
  • babel-plugin-transform-block-scoping, babel-traverse
:nail_care: Polish
  • babel-generator
  • babel-plugin-transform-block-scoping
:house: Internal

Readme

Source

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

Compile class public and private fields, private methods and decorators to ES6

See our website @babel/helper-create-class-features-plugin for more information.

Install

Using npm:

npm install --save @babel/helper-create-class-features-plugin

or using yarn:

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

Keywords

FAQs

Last updated on 28 Nov 2022

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.

Install

Related posts

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