babel-plugin-globals
Advanced tools
Comparing version 0.1.2 to 0.1.3
24
index.js
@@ -75,9 +75,3 @@ 'use strict'; | ||
assertFilenameRequired(filename); | ||
var extension = '.js'; | ||
filenameNoExtCache = filename; | ||
do { | ||
filenameNoExtCache = path.basename(filenameNoExtCache, extension); | ||
extension = path.extname(filenameNoExtCache); | ||
} while (extension !== ''); | ||
filenameNoExtCache = removeExtensions(filename); | ||
} | ||
@@ -112,2 +106,16 @@ return filenameNoExtCache; | ||
/** | ||
* Removes all extensions from the given filename. | ||
* @param {string} filename | ||
* @return {string} | ||
*/ | ||
function removeExtensions(filename) { | ||
var extension = path.extname(filename); | ||
while (extension !== '') { | ||
filename = path.basename(filename, extension); | ||
extension = path.extname(filename); | ||
} | ||
return filename; | ||
} | ||
return new babel.Transformer('globals', { | ||
@@ -144,3 +152,3 @@ /** | ||
self.state.opts, | ||
node.source.value, | ||
removeExtensions(node.source.value), | ||
specifier.imported ? specifier.imported.name : null, | ||
@@ -147,0 +155,0 @@ t.isImportNamespaceSpecifier(specifier) |
{ | ||
"name": "babel-plugin-globals", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"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
9390
189
42