babel-plugin-name-amd-modules
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -96,6 +96,5 @@ 'use strict'; | ||
* @param {object} opts the Babel plugin options | ||
* @return {Array} the normalized srcPrefixes array | ||
* @return {Array} the normalized srcPrefixes array (with native path | ||
* separators) | ||
*/ | ||
// TODO: check that module names work correctly in Windows | ||
function getSrcPrefixes(opts) { | ||
@@ -105,2 +104,4 @@ var srcPrefixes = opts.srcPrefixes || ['src/main/resources/META-INF/resources']; | ||
return srcPrefixes.map(function (srcPrefix) { | ||
return _path2.default.normalize(srcPrefix); | ||
}).map(function (srcPrefix) { | ||
return srcPrefix.endsWith(_path2.default.sep) ? srcPrefix : srcPrefix + _path2.default.sep; | ||
@@ -116,3 +117,3 @@ }); | ||
* compiler | ||
* @return {String} the package name ending with '/' | ||
* @return {String} the package name (in 'pkg@version' format) ending with '/' | ||
*/ | ||
@@ -165,3 +166,3 @@ | ||
for (var i = 0; i < srcPrefixes.length; i++) { | ||
var srcPrefix = srcPrefixes[i]; | ||
var srcPrefix = _path2.default.normalize(srcPrefixes[i]); | ||
@@ -174,4 +175,8 @@ if (moduleName.startsWith(srcPrefix)) { | ||
if (_path2.default.sep == '\\') { | ||
moduleName = moduleName.replace(/\\/g, '/'); | ||
} | ||
return moduleName; | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "babel-plugin-name-amd-modules", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "A Babel plugin to give name to AMD modules based on their path and package.", | ||
@@ -15,5 +15,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"liferay-npm-build-tools-common": "^1.2.0", | ||
"liferay-npm-build-tools-common": "^1.2.1", | ||
"read-json-sync": "^1.1.1" | ||
} | ||
} |
@@ -1,3 +0,1 @@ | ||
// TODO: check that module names work correctly in Windows | ||
import * as pkgs from 'liferay-npm-build-tools-common/lib/packages'; | ||
@@ -95,3 +93,4 @@ import path from 'path'; | ||
* @param {object} opts the Babel plugin options | ||
* @return {Array} the normalized srcPrefixes array | ||
* @return {Array} the normalized srcPrefixes array (with native path | ||
* separators) | ||
*/ | ||
@@ -103,6 +102,8 @@ function getSrcPrefixes(opts) { | ||
return srcPrefixes.map( | ||
srcPrefix => | ||
srcPrefix.endsWith(path.sep) ? srcPrefix : srcPrefix + path.sep, | ||
); | ||
return srcPrefixes | ||
.map(srcPrefix => path.normalize(srcPrefix)) | ||
.map( | ||
srcPrefix => | ||
srcPrefix.endsWith(path.sep) ? srcPrefix : srcPrefix + path.sep, | ||
); | ||
} | ||
@@ -116,3 +117,3 @@ | ||
* compiler | ||
* @return {String} the package name ending with '/' | ||
* @return {String} the package name (in 'pkg@version' format) ending with '/' | ||
*/ | ||
@@ -157,3 +158,3 @@ function getPackageName(packageName, filenameRelative) { | ||
for (let i = 0; i < srcPrefixes.length; i++) { | ||
const srcPrefix = srcPrefixes[i]; | ||
const srcPrefix = path.normalize(srcPrefixes[i]); | ||
@@ -166,3 +167,7 @@ if (moduleName.startsWith(srcPrefix)) { | ||
if (path.sep == '\\') { | ||
moduleName = moduleName.replace(/\\/g, '/'); | ||
} | ||
return moduleName; | ||
} |
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
24486
13
326
1