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

babel-plugin-hylid-bridge

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-hylid-bridge - npm Package Compare versions

Comparing version 2.4.0-alpha.0 to 2.4.0-alpha.1

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [2.4.0-alpha.1](https://code.alipay.com/ant-ife/hylid-bridge/compare/v2.4.0-alpha.0...v2.4.0-alpha.1) (2022-08-15)
### Features
* 不修改全局的 my, 新建本地变量
## [2.4.0-alpha.0](https://code.alipay.com/ant-ife/hylid-bridge/compare/v2.1.0...v2.4.0-alpha.0) (2022-08-12)

@@ -8,0 +16,0 @@

20

lib/index.js

@@ -98,2 +98,4 @@ "use strict";

var myLocalName = "".concat(identifierPrefix, "my__");
var _default = function _default(_, opts) {

@@ -115,3 +117,7 @@ var targets = getTargets(opts === null || opts === void 0 ? void 0 : opts.targets);

var newNode = babelTypes.cloneNode(path.node, true, true);
newNode.object = babelTypes.identifier(myLocalName);
if (state.usedJSAPIList === 'all') {
path.replaceWith(newNode);
return;

@@ -142,2 +148,4 @@ }

}
path.replaceWith(newNode);
},

@@ -185,10 +193,10 @@ Program: {

var targetSplit = splitTarget(target);
return babelTypes.ifStatement(babelTypes.identifier("".concat(appEnvLocalName, ".").concat(_lodash.default.camelCase("is_".concat(targetSplit[0], "_").concat(targetSplit[1])))), babelTypes.blockStatement([babelTypes.expressionStatement(babelTypes.assignmentExpression('=', babelTypes.identifier('my'), babelTypes.identifier("".concat(identifierPrefix).concat(targetSplit[0], "_").concat(targetSplit[1], "_my__"))))]), buildElseIf(targetList.slice(1)));
return babelTypes.ifStatement(babelTypes.identifier("".concat(appEnvLocalName, ".").concat(_lodash.default.camelCase("is_".concat(targetSplit[0], "_").concat(targetSplit[1])))), babelTypes.blockStatement([babelTypes.expressionStatement(babelTypes.assignmentExpression('=', babelTypes.identifier(myLocalName), babelTypes.identifier("".concat(identifierPrefix).concat(targetSplit[0], "_").concat(targetSplit[1], "_my__"))))]), buildElseIf(targetList.slice(1)));
};
nodes.push(babelTypes.variableDeclaration('var', [babelTypes.variableDeclarator(babelTypes.identifier('my'))])); // Do not generate the `if statement` when there is just one target.
nodes.push(babelTypes.variableDeclaration('var', [babelTypes.variableDeclarator(babelTypes.identifier(myLocalName))])); // Do not generate the `if statement` when there is just one target.
if (targets.length === 1) {
var targetSplit = splitTarget(targets[0]);
nodes.push(babelTypes.expressionStatement(babelTypes.assignmentExpression('=', babelTypes.identifier('my'), babelTypes.identifier("".concat(identifierPrefix).concat(targetSplit[0], "_").concat(targetSplit[1], "_my__")))));
nodes.push(babelTypes.expressionStatement(babelTypes.assignmentExpression('=', babelTypes.identifier(myLocalName), babelTypes.identifier("".concat(identifierPrefix).concat(targetSplit[0], "_").concat(targetSplit[1], "_my__")))));
} else {

@@ -220,6 +228,6 @@ var elseIfNode = buildElseIf(targets);

});
return babelTypes.ifStatement(babelTypes.identifier("".concat(appEnvLocalName, ".").concat(_lodash.default.camelCase("is_".concat(targetSplit[0], "_").concat(targetSplit[1])))), babelTypes.blockStatement([babelTypes.expressionStatement(babelTypes.assignmentExpression('=', babelTypes.identifier('my'), babelTypes.objectExpression(propertyList)))]), _buildElseIf(targetList.slice(1)));
return babelTypes.ifStatement(babelTypes.identifier("".concat(appEnvLocalName, ".").concat(_lodash.default.camelCase("is_".concat(targetSplit[0], "_").concat(targetSplit[1])))), babelTypes.blockStatement([babelTypes.expressionStatement(babelTypes.assignmentExpression('=', babelTypes.identifier(myLocalName), babelTypes.objectExpression(propertyList)))]), _buildElseIf(targetList.slice(1)));
};
nodes.push(babelTypes.variableDeclaration('var', [babelTypes.variableDeclarator(babelTypes.identifier('my'))])); // Do not generate the `if statement` when there is just one target.
nodes.push(babelTypes.variableDeclaration('var', [babelTypes.variableDeclarator(babelTypes.identifier(myLocalName))])); // Do not generate the `if statement` when there is just one target.

@@ -232,3 +240,3 @@ if (targets.length === 1) {

});
nodes.push(babelTypes.expressionStatement(babelTypes.assignmentExpression('=', babelTypes.identifier('my'), babelTypes.objectExpression(propertyList))));
nodes.push(babelTypes.expressionStatement(babelTypes.assignmentExpression('=', babelTypes.identifier(myLocalName), babelTypes.objectExpression(propertyList))));
} else {

@@ -235,0 +243,0 @@ var _elseIfNode = _buildElseIf(targets);

{
"name": "babel-plugin-hylid-bridge",
"version": "2.4.0-alpha.0",
"version": "2.4.0-alpha.1",
"description": "babel-plugin-hylid-bridge",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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