Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-aexpr-source-transformation

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-aexpr-source-transformation - npm Package Compare versions

Comparing version 2.1.3 to 2.2.0

test/expected/operators.js

24

dist/index.js

@@ -154,3 +154,9 @@ "use strict";

path.replaceWith(t.callExpression(addCustomTemplate(state.file, SET_MEMBER), [path.node.left.object, getPropertyFromMemberExpression(path.node.left), t.stringLiteral(path.node.operator), path.node.right]));
if (!SET_MEMBER_BY_OPERATORS[path.node.operator]) {
return;
}
path.replaceWith(t.callExpression(addCustomTemplate(state.file, SET_MEMBER_BY_OPERATORS[path.node.operator]), [path.node.left.object, getPropertyFromMemberExpression(path.node.left),
//t.stringLiteral(path.node.operator),
path.node.right]));
},

@@ -308,2 +314,18 @@ MemberExpression: function MemberExpression(path) {

var SET_MEMBER_BY_OPERATORS = {
'=': 'setMember',
'+=': 'setMemberAddition',
'-=': 'setMemberSubtraction',
'*=': 'setMemberMultiplication',
'/=': 'setMemberDivision',
'%=': 'setMemberRemainder',
//'**=': 'setMemberExponentiation',
'<<=': 'setMemberLeftShift',
'>>=': 'setMemberRightShift',
'>>>=': 'setMemberUnsignedRightShift',
'&=': 'setMemberBitwiseAND',
'^=': 'setMemberBitwiseXOR',
'|=': 'setMemberBitwiseOR'
};
// const SET_LOCAL = "setLocal";

@@ -310,0 +332,0 @@ // const GET_LOCAL = "getLocal";

@@ -10,2 +10,18 @@ const AEXPR_IDENTIFIER_NAME = "aexpr";

const SET_MEMBER_BY_OPERATORS = {
'=': 'setMember',
'+=': 'setMemberAddition',
'-=': 'setMemberSubtraction',
'*=': 'setMemberMultiplication',
'/=': 'setMemberDivision',
'%=': 'setMemberRemainder',
//'**=': 'setMemberExponentiation',
'<<=': 'setMemberLeftShift',
'>>=': 'setMemberRightShift',
'>>>=': 'setMemberUnsignedRightShift',
'&=': 'setMemberBitwiseAND',
'^=': 'setMemberBitwiseXOR',
'|=': 'setMemberBitwiseOR'
};
// const SET_LOCAL = "setLocal";

@@ -175,9 +191,11 @@ // const GET_LOCAL = "getLocal";

if(!SET_MEMBER_BY_OPERATORS[path.node.operator]) { return; }
path.replaceWith(
t.callExpression(
addCustomTemplate(state.file, SET_MEMBER),
addCustomTemplate(state.file, SET_MEMBER_BY_OPERATORS[path.node.operator]),
[
path.node.left.object,
getPropertyFromMemberExpression(path.node.left),
t.stringLiteral(path.node.operator),
//t.stringLiteral(path.node.operator),
path.node.right

@@ -184,0 +202,0 @@ ]

3

package.json
{
"name": "babel-plugin-aexpr-source-transformation",
"version": "2.1.3",
"version": "2.2.0",
"description": "3rd implementation strategy of active expressions, via a babel transformation",

@@ -26,2 +26,3 @@ "main": "dist/index.js",

"expression",
"expressions",
"active-expression"

@@ -28,0 +29,0 @@ ],

@@ -10,2 +10,2 @@ import { getMember as _getMember } from "aexpr-source-transformation-propagation";

// Mixin everything together
_setMember(_getAndCallMember(a, "fn", []), _getMember(c, "d"), "=", 1);
_setMember(_getAndCallMember(a, "fn", []), _getMember(c, "d"), 1);

@@ -5,6 +5,6 @@ import { getMember as _getMember } from "aexpr-source-transformation-propagation";

constructor(x, y, width, height) {
_setMember(this, "x", "=", x);
_setMember(this, "y", "=", y);
_setMember(this, "width", "=", width);
_setMember(this, "height", "=", height);
_setMember(this, "x", x);
_setMember(this, "y", y);
_setMember(this, "width", width);
_setMember(this, "height", height);
}

@@ -11,0 +11,0 @@

import { getMember as _getMember } from "aexpr-source-transformation-propagation";
import { setMember as _setMember } from "aexpr-source-transformation-propagation";
// nested left side of assignment
_setMember(_getMember(a, "b"), "c", "=", _getMember(y, "z"));
_setMember(_getMember(a, "b"), "c", _getMember(y, "z"));

@@ -17,3 +17,4 @@ "use strict";

{file: 'class_example'},
{file: 'with_aexpr'}
{file: 'with_aexpr'},
{file: 'operators'}
];

@@ -20,0 +21,0 @@

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