babel-plugin-minify-replace
Advanced tools
Comparing version 0.5.0-alpha.7b176463 to 0.5.0-alpha.b4285271
"use strict"; | ||
module.exports = function (_ref) { | ||
var t = _ref.types; | ||
var NO_MEMBER = Symbol("no member"); | ||
var replaceVisitor = { | ||
module.exports = ({ | ||
types: t | ||
}) => { | ||
const NO_MEMBER = Symbol("no member"); | ||
const replaceVisitor = { | ||
ReferencedIdentifier(path) { | ||
var _path = path, | ||
node = _path.node; | ||
var optionsMap = this.replacements[node.name]; | ||
const _path = path, | ||
node = _path.node; | ||
const optionsMap = this.replacements[node.name]; | ||
@@ -16,3 +17,3 @@ if (!optionsMap) { | ||
var options; | ||
let options; | ||
@@ -22,4 +23,4 @@ if (path.parentPath.isMemberExpression({ | ||
})) { | ||
var property = path.parent.property; | ||
var key = t.isIdentifier(property) && property.name; | ||
const property = path.parent.property; | ||
const key = t.isIdentifier(property) && property.name; | ||
@@ -64,8 +65,8 @@ if (typeof key === "string") { | ||
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]) { | ||
@@ -77,4 +78,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, | ||
@@ -81,0 +82,0 @@ node, |
{ | ||
"name": "babel-plugin-minify-replace", | ||
"version": "0.5.0-alpha.7b176463", | ||
"version": "0.5.0-alpha.b4285271", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
84
3971