babel-plugin-globals
Advanced tools
Comparing version 1.1.0 to 1.1.1
11
index.js
@@ -40,2 +40,5 @@ 'use strict'; | ||
createGlobal(id.name, nodes); | ||
if (!t.isExpression(expression)) { | ||
expression = t.toExpression(expression); | ||
} | ||
nodes.push(t.expressionStatement(t.assignmentExpression('=', id, expression))); | ||
@@ -189,3 +192,9 @@ } | ||
var id = getGlobalIdentifier(state, getFilenameNoExt(state.file.opts.filename)); | ||
assignToGlobal(id, replacements, nodePath.node.declaration); | ||
var expression = nodePath.node.declaration; | ||
if (expression.id && | ||
(t.isFunctionDeclaration(expression) || t.isClassDeclaration(expression))) { | ||
replacements.push(expression); | ||
expression = expression.id; | ||
} | ||
assignToGlobal(id, replacements, expression); | ||
nodePath.replaceWithMultiple(replacements); | ||
@@ -192,0 +201,0 @@ }, |
{ | ||
"name": "babel-plugin-globals", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A babel plugin that exposes ES6 modules to global variables.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
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
10741
213