Socket
Socket
Sign inDemoInstall

babel-plugin-debug-macros

Package Overview
Dependencies
1
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.10 to 0.1.11

22

dist/lib/utils/macros.js

@@ -26,3 +26,2 @@ 'use strict';

this.localDebugBindings = [];
this.isImportRemovable = false;
this.envFlagBindings = [];

@@ -84,8 +83,8 @@ this.hasEnvFlags = false;

Object.keys(featuresMap[source]).forEach(function (flag) {
var flagValue = featuresMap[source][flag];
var binding = path.scope.getBinding(flag);
if (binding && featuresMap[source][flag] !== null) {
binding.referencePaths.forEach(function (p) {
if (p.parentPath.isIfStatement() || p.parentPath.isLogicalExpression() && p.parentPath.parentPath && p.parentPath.parentPath.isIfStatement()) {
p.replaceWith(builder.t.booleanLiteral(featuresMap[source][flag]));
}
if (binding && flagValue !== null) {
binding.referencePaths.forEach(function (referencePath) {
referencePath.replaceWith(builder.t.booleanLiteral(flagValue));
});

@@ -165,5 +164,2 @@

this._collectImportBindings(specifiers, this.localDebugBindings);
if (specifiers.length === this.localDebugBindings.length) {
this.isImportRemovable = true;
}
}

@@ -253,3 +249,9 @@ }, {

if (this.localDebugBindings.length > 0) {
if (this.isImportRemovable) {
this.localDebugBindings[0].parentPath.parentPath;
var importPath = this.localDebugBindings[0].findParent(function (p) {
return p.isImportDeclaration();
});
var specifiers = importPath.get('specifiers');
if (specifiers.length === this.localDebugBindings.length) {
this.localDebugBindings[0].parentPath.parentPath.remove();

@@ -256,0 +258,0 @@ } else {

@@ -13,3 +13,3 @@ {

"name": "babel-plugin-debug-macros",
"version": "0.1.10",
"version": "0.1.11",
"description": "Debug macros and feature flag stripping",

@@ -16,0 +16,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc