babel-plugin-normalize-requires
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -25,3 +25,3 @@ 'use strict'; | ||
if (typeof moduleName === 'string') { | ||
if (typeof moduleName === 'string' && !isPackageName(moduleName)) { | ||
if (moduleName.endsWith('.js')) { | ||
@@ -45,2 +45,25 @@ moduleName = moduleName.substring(0, moduleName.length - 3); | ||
}; | ||
/** | ||
* Check whether a module name refers to a package entry point. | ||
* @param {String} moduleName the name of a JS module | ||
* @return {boolean} true if moduleName is a package name | ||
*/ | ||
function isPackageName(moduleName) { | ||
var firstSlashIndex = moduleName.indexOf('/'); | ||
if (firstSlashIndex == -1) { | ||
return true; | ||
} | ||
var restOfModuleName = moduleName.substring(firstSlashIndex + 1); | ||
if (moduleName.startsWith('@') && restOfModuleName.indexOf('/') == -1) { | ||
return true; | ||
} | ||
return false; | ||
} /** | ||
* @return {object} a babel visitor | ||
*/ | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "babel-plugin-normalize-requires", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "A Babel plugin that rewrites require() calls to normalize them (removing extensions and trailing slashes, for example).", | ||
@@ -8,3 +8,3 @@ "main": "lib/index.js", | ||
"build": "babel --source-maps -D -d lib src", | ||
"prepublish": "babel --source-maps -D -d lib src" | ||
"prepublish": "npm run build" | ||
}, | ||
@@ -14,6 +14,3 @@ "devDependencies": { | ||
"babel-preset-es2015": "^6.24.1" | ||
}, | ||
"dependencies": { | ||
"read-json-sync": "^1.1.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
79819
0
12
2400
0
41
1
- Removedread-json-sync@^1.1.1
- Removedgraceful-fs@4.2.11(transitive)
- Removedread-json-sync@1.1.1(transitive)