babel-plugin-minify-replace
Advanced tools
Comparing version 0.3.0-alpha.0f04ec28 to 0.3.0-alpha.169f8743
"use strict"; | ||
module.exports = function (_ref) { | ||
var t = _ref.types; | ||
module.exports = ({ types: t }) => { | ||
const NO_MEMBER = Symbol("no member"); | ||
var NO_MEMBER = Symbol("no member"); | ||
var replaceVisitor = { | ||
const replaceVisitor = { | ||
ReferencedIdentifier(path) { | ||
var _path = path, | ||
node = _path.node; | ||
var _path = path; | ||
const node = _path.node; | ||
var optionsMap = this.replacements[node.name]; | ||
const optionsMap = this.replacements[node.name]; | ||
if (!optionsMap) { | ||
@@ -18,7 +16,7 @@ return; | ||
var options = void 0; | ||
let options; | ||
if (path.parentPath.isMemberExpression({ object: node })) { | ||
var property = path.parent.property; | ||
const property = path.parent.property; | ||
var key = t.isIdentifier(property) && property.name; | ||
const key = t.isIdentifier(property) && property.name; | ||
if (typeof key === "string") { | ||
@@ -63,8 +61,4 @@ options = optionsMap[key]; | ||
var map = Object.create(null); | ||
this.opts.replacements.forEach(function (_ref2) { | ||
var identifierName = _ref2.identifierName, | ||
replacement = _ref2.replacement, | ||
member = _ref2.member; | ||
const map = Object.create(null); | ||
this.opts.replacements.forEach(({ identifierName, replacement, member }) => { | ||
if (path.scope.globals[identifierName]) { | ||
@@ -76,4 +70,4 @@ // Convert to a node, we only allow identifiers and literals as replacements | ||
var node = t[replacement.type](replacement.value); | ||
var options = { | ||
const node = t[replacement.type](replacement.value); | ||
const options = { | ||
identifierName, | ||
@@ -80,0 +74,0 @@ node, |
{ | ||
"name": "babel-plugin-minify-replace", | ||
"version": "0.3.0-alpha.0f04ec28", | ||
"version": "0.3.0-alpha.169f8743", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
3896
74