![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
babel-plugin-transform-private
Advanced tools
This is a plugin provide private fields in ES6+ class. It's not like [ECMAScript Private Fields](https://github.com/tc39/proposal-private-fields) proposal but auto transform any field start with '_' into private in a class.
This is a plugin provide private fields in ES6+ class. It's not like ECMAScript Private Fields proposal but auto transform any field start with '_' into private in a class.
npm i babel-plugin-transform-private --save-dev
Config .babelrc
or package.json
{
"plugins": [
["../src/transform-private.js", {
"pattern": "^_"
}],
]
}
input:
export default class Point2D{
constructor(x, y){
this._x = x;
this._y = y;
}
get XY(){
return [this._x, this._y];
}
get length(){
return Math.sqrt(this._x * this._x + this._y * this._y);
}
}
output:
const Point2D = function () {
const [$_x$, $_y$] = [Symbol("$_x$"), Symbol("$_y$")];
class Point2D {
constructor(x, y) {
this[$_x$] = x;
this[$_y$] = y;
}
get XY() {
return [this[$_x$], this[$_y$]];
}
get length() {
return Math.sqrt(this[$_x$] * this[$_x$] + this[$_y$] * this[$_y$]);
}
}
return Point2D;
}();
export default Point2D;
input:
export default class Outer {
constructor(){
this._inner = class Inner{
constructor(x){
this._x = x;
}
get X(){
return this._x;
}
}
}
get innerCls(){
return this._inner;
}
}
output:
const Outer = function () {
const [$_inner$] = [Symbol("$_inner$")];
class Outer {
constructor() {
this[$_inner$] = function () {
const [$_x$] = [Symbol("$_x$")];
return class Inner {
constructor(x) {
this[$_x$] = x;
}
get X() {
return this[$_x$];
}
};
}();
}
get innerCls() {
return this[$_inner$];
}
}
return Outer;
}();
export default Outer;
input:
export const Foo = class {
constructor(x, y){
this._x = x;
this._y = y;
this._zz = x + y;
}
//protected filed
get _z(){
return this._zz;
}
}
export const Bar = class extends Foo{
constructor(x, y){
super(x * 2, y * 3);
}
get z(){
return super._z; //get x*2+y*3
}
get z2(){
return super._zz; //undefined
}
}
output:
export const Foo = function () {
const [$_x$, $_y$, $_zz$, $_z$] = [Symbol("$_x$"), Symbol("$_y$"), Symbol("$_zz$"), Symbol("$_z$")];
return class {
constructor(x, y) {
this[$_x$] = x;
this[$_y$] = y;
this[$_zz$] = x + y;
}
get [$_z$]() {
return this[$_zz$];
}
};
}();
export const Bar = class extends Foo {
constructor(x, y) {
super(x * 2, y * 3);
}
get z() {
return super[Object.getOwnPropertySymbols(this.__proto__.__proto__).filter(s => String(s) === "Symbol($_z$)")[0]];
}
get z2() {
return super[Object.getOwnPropertySymbols(this.__proto__.__proto__).filter(s => String(s) === "Symbol($_zz$)")[0]];
}
};
FAQs
This is a plugin provide private fields in ES6+ class. It's not like [ECMAScript Private Fields](https://github.com/tc39/proposal-private-fields) proposal but automatically transform any field which starts with '_' into a private field.
The npm package babel-plugin-transform-private receives a total of 0 weekly downloads. As such, babel-plugin-transform-private popularity was classified as not popular.
We found that babel-plugin-transform-private demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.