babel-plugin-debug-macros
Advanced tools
Comparing version 0.2.0-beta.6 to 0.2.0
@@ -15,3 +15,3 @@ { | ||
"name": "babel-plugin-debug-macros", | ||
"version": "0.2.0-beta.6", | ||
"version": "0.2.0", | ||
"description": "Debug macros and feature flag stripping", | ||
@@ -18,0 +18,0 @@ "main": "src/index.js", |
@@ -9,3 +9,2 @@ 'use strict'; | ||
let t = babel.types; | ||
let options; | ||
@@ -31,5 +30,5 @@ function buildIdentifier(value, name) { | ||
visitor: { | ||
ImportSpecifier(path) { | ||
ImportSpecifier(path, state) { | ||
let importPath = path.parent.source.value; | ||
let flagsForImport = options.flags[importPath]; | ||
let flagsForImport = state.opts.flags[importPath]; | ||
@@ -63,5 +62,5 @@ if (flagsForImport) { | ||
ImportDeclaration: { | ||
exit(path) { | ||
exit(path, state) { | ||
let importPath = path.node.source.value; | ||
let flagsForImport = options.flags[importPath]; | ||
let flagsForImport = state.opts.flags[importPath]; | ||
@@ -77,4 +76,4 @@ // remove flag source imports when no specifiers are left | ||
enter(path, state) { | ||
options = normalizeOptions(state.opts); | ||
this.macroBuilder = new Macros(babel, options); | ||
state.opts = normalizeOptions(state.opts); | ||
this.macroBuilder = new Macros(babel, state.opts); | ||
@@ -87,6 +86,10 @@ let body = path.get('body'); | ||
let debugToolsImport = options.debugTools.debugToolsImport; | ||
let debugToolsImport = state.opts.debugTools.debugToolsImport; | ||
if (debugToolsImport && debugToolsImport === importPath) { | ||
this.macroBuilder.collectDebugToolsSpecifiers(item.get('specifiers')); | ||
if (!item.node.specifiers.length) { | ||
item.remove(); | ||
} else { | ||
this.macroBuilder.collectDebugToolsSpecifiers(item.get('specifiers')); | ||
} | ||
} | ||
@@ -93,0 +96,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
19054
6
448
1