Socket
Socket
Sign inDemoInstall

@babel/helper-simple-access

Package Overview
Dependencies
Maintainers
4
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-simple-access - npm Package Compare versions

Comparing version 7.22.5 to 8.0.0-alpha.0

44

lib/index.js

@@ -1,8 +0,3 @@

"use strict";
import * as _t from '@babel/types';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = simplifyAccess;
var _t = require("@babel/types");
const {

@@ -47,42 +42,8 @@ LOGICAL_OPERATORS,

};
{
simpleAssignmentVisitor.UpdateExpression = {
exit(path) {
if (!this.includeUpdateExpression) return;
const {
scope,
bindingNames
} = this;
const arg = path.get("argument");
if (!arg.isIdentifier()) return;
const localName = arg.node.name;
if (!bindingNames.has(localName)) return;
if (scope.getBinding(localName) !== path.scope.getBinding(localName)) {
return;
}
if (path.parentPath.isExpressionStatement() && !path.isCompletionRecord()) {
const operator = path.node.operator == "++" ? "+=" : "-=";
path.replaceWith(assignmentExpression(operator, arg.node, numericLiteral(1)));
} else if (path.node.prefix) {
path.replaceWith(assignmentExpression("=", identifier(localName), binaryExpression(path.node.operator[0], unaryExpression("+", arg.node), numericLiteral(1))));
} else {
const old = path.scope.generateUidIdentifierBasedOnNode(arg.node, "old");
const varName = old.name;
path.scope.push({
id: old
});
const binary = binaryExpression(path.node.operator[0], identifier(varName), numericLiteral(1));
path.replaceWith(sequenceExpression([assignmentExpression("=", identifier(varName), unaryExpression("+", arg.node)), assignmentExpression("=", cloneNode(arg.node), binary), identifier(varName)]));
}
}
};
}
function simplifyAccess(path, bindingNames) {
{
var _arguments$;
path.traverse(simpleAssignmentVisitor, {
scope: path.scope,
bindingNames,
seen: new WeakSet(),
includeUpdateExpression: (_arguments$ = arguments[2]) != null ? _arguments$ : true
seen: new WeakSet()
});

@@ -92,2 +53,3 @@ }

export { simplifyAccess as default };
//# sourceMappingURL=index.js.map

16

package.json
{
"name": "@babel/helper-simple-access",
"version": "7.22.5",
"version": "8.0.0-alpha.0",
"description": "Babel helper for ensuring that access to a given value is performed through simple accesses",

@@ -18,12 +18,16 @@ "author": "The Babel Team (https://babel.dev/team)",

"dependencies": {
"@babel/types": "^7.22.5"
"@babel/types": "^8.0.0-alpha.0"
},
"devDependencies": {
"@babel/core": "^7.22.5",
"@babel/traverse": "^7.22.5"
"@babel/core": "^8.0.0-alpha.0",
"@babel/traverse": "^8.0.0-alpha.0"
},
"engines": {
"node": ">=6.9.0"
"node": "^16.20.0 || ^18.16.0 || >=20.0.0"
},
"type": "commonjs"
"exports": {
".": "./lib/index.js",
"./package.json": "./package.json"
},
"type": "module"
}

@@ -5,3 +5,3 @@ # @babel/helper-simple-access

See our website [@babel/helper-simple-access](https://babeljs.io/docs/en/babel-helper-simple-access) for more information.
See our website [@babel/helper-simple-access](https://babeljs.io/docs/babel-helper-simple-access) 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