Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-private-property-in-object

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-private-property-in-object - npm Package Compare versions

Comparing version 7.22.5 to 8.0.0-alpha.0

36

lib/index.js

@@ -1,12 +0,7 @@

"use strict";
import { declare } from '@babel/helper-plugin-utils';
import syntaxPlugin from '@babel/plugin-syntax-private-property-in-object';
import { enableFeature, FEATURES, buildCheckInRHS, injectInitialization } from '@babel/helper-create-class-features-plugin';
import annotateAsPure from '@babel/helper-annotate-as-pure';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _pluginSyntaxPrivatePropertyInObject = require("@babel/plugin-syntax-private-property-in-object");
var _helperCreateClassFeaturesPlugin = require("@babel/helper-create-class-features-plugin");
var _helperAnnotateAsPure = require("@babel/helper-annotate-as-pure");
var _default = (0, _helperPluginUtils.declare)((api, opt) => {
var index = declare((api, opt) => {
api.assertVersion(7);

@@ -40,3 +35,3 @@ const {

}
function injectInitialization(classPath, init) {
function injectInitialization$1(classPath, init) {
let firstFieldPath;

@@ -58,3 +53,3 @@ let constructorPath;

} else {
(0, _helperCreateClassFeaturesPlugin.injectInitialization)(classPath, constructorPath, [t.expressionStatement(init)]);
injectInitialization(classPath, constructorPath, [t.expressionStatement(init)]);
}

@@ -69,3 +64,3 @@ }

const newExpr = t.newExpression(t.identifier("WeakSet"), []);
(0, _helperAnnotateAsPure.default)(newExpr);
annotateAsPure(newExpr);
outerClass.insertBefore(template.ast`var ${id} = ${newExpr}`);

@@ -77,5 +72,5 @@ }

name: "transform-private-property-in-object",
inherits: _pluginSyntaxPrivatePropertyInObject.default,
inherits: syntaxPlugin.default,
pre() {
(0, _helperCreateClassFeaturesPlugin.enableFeature)(this.file, _helperCreateClassFeaturesPlugin.FEATURES.privateIn, loose);
enableFeature(this.file, FEATURES.privateIn, loose);
},

@@ -115,12 +110,11 @@ visitor: {

path.replaceWith(template.expression.ast`
${t.cloneNode(outerClass.node.id)} === ${(0, _helperCreateClassFeaturesPlugin.buildCheckInRHS)(node.right, file)}
${t.cloneNode(outerClass.node.id)} === ${buildCheckInRHS(node.right, file)}
`);
} else {
var _outerClass$node$id;
const id = getWeakSetId(classWeakSets, outerClass, outerClass, (_outerClass$node$id = outerClass.node.id) == null ? void 0 : _outerClass$node$id.name, injectInitialization);
path.replaceWith(template.expression.ast`${id}.has(${(0, _helperCreateClassFeaturesPlugin.buildCheckInRHS)(node.right, file)})`);
const id = getWeakSetId(classWeakSets, outerClass, outerClass, outerClass.node.id?.name, injectInitialization$1);
path.replaceWith(template.expression.ast`${id}.has(${buildCheckInRHS(node.right, file)})`);
}
} else {
const id = getWeakSetId(fieldsWeakSets, outerClass, privateElement, privateElement.node.key.id.name, injectToFieldInit);
path.replaceWith(template.expression.ast`${id}.has(${(0, _helperCreateClassFeaturesPlugin.buildCheckInRHS)(node.right, file)})`);
path.replaceWith(template.expression.ast`${id}.has(${buildCheckInRHS(node.right, file)})`);
}

@@ -131,4 +125,4 @@ }

});
exports.default = _default;
export { index as default };
//# sourceMappingURL=index.js.map
{
"name": "@babel/plugin-transform-private-property-in-object",
"version": "7.22.5",
"version": "8.0.0-alpha.0",
"description": "This plugin transforms checks for a private property in an object",

@@ -20,19 +20,23 @@ "repository": {

"dependencies": {
"@babel/helper-annotate-as-pure": "^7.22.5",
"@babel/helper-create-class-features-plugin": "^7.22.5",
"@babel/helper-plugin-utils": "^7.22.5",
"@babel/helper-annotate-as-pure": "^8.0.0-alpha.0",
"@babel/helper-create-class-features-plugin": "^8.0.0-alpha.0",
"@babel/helper-plugin-utils": "^8.0.0-alpha.0",
"@babel/plugin-syntax-private-property-in-object": "^7.14.5"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
"@babel/core": "^8.0.0-alpha.0"
},
"devDependencies": {
"@babel/core": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.22.5"
"@babel/core": "^8.0.0-alpha.0",
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.0"
},
"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"
"exports": {
".": "./lib/index.js",
"./package.json": "./package.json"
},
"type": "module"
}

@@ -5,3 +5,3 @@ # @babel/plugin-transform-private-property-in-object

See our website [@babel/plugin-transform-private-property-in-object](https://babeljs.io/docs/en/babel-plugin-transform-private-property-in-object) for more information.
See our website [@babel/plugin-transform-private-property-in-object](https://babeljs.io/docs/babel-plugin-transform-private-property-in-object) for more information.

@@ -8,0 +8,0 @@ ## Install

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