liferay-npm-bundler-plugin-replace-browser-modules
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -29,2 +29,8 @@ 'use strict'; | ||
/** | ||
* Copy "browser" module file on top of "main" module file. | ||
* @param {String} pkgDir directory where package is placed | ||
* @param {Object} pkgJson package.json contents | ||
* @return {void} | ||
*/ | ||
function replaceMainModule(pkgDir, pkgJson) { | ||
@@ -41,2 +47,13 @@ var pkgId = pkgJson.name + '@' + pkgJson.version; | ||
/** | ||
* Copy "browser" module files on top of their server versions. | ||
* @param {String} pkgDir directory where package is placed | ||
* @param {Object} pkgJson package.json contents | ||
* @return {void} | ||
*/ | ||
/** | ||
* @return {void} | ||
*/ | ||
function replaceModules(pkgDir, pkgJson) { | ||
@@ -48,14 +65,23 @@ var pkgId = pkgJson.name + '@' + pkgJson.version; | ||
var to = browser[from]; | ||
var dest = pkgDir + '/' + from; | ||
if (to == false) { | ||
return; | ||
ignoreFile(dest); | ||
} else { | ||
var src = pkgDir + '/' + to; | ||
replaceFile(pkgId, src, to, dest, from); | ||
} | ||
var src = pkgDir + '/' + to; | ||
var dest = pkgDir + '/' + from; | ||
replaceFile(pkgId, src, to, dest, from); | ||
}); | ||
} | ||
/** | ||
* Replace one package file with another. | ||
* @param {String} pkgId package id (name@version) | ||
* @param {String} src path to source file | ||
* @param {String} srcName the name of the source file | ||
* @param {String} dest path to destination file | ||
* @param {String} destName the name of the destination file | ||
* @return {void} | ||
*/ | ||
function replaceFile(pkgId, src, srcName, dest, destName) { | ||
@@ -76,2 +102,11 @@ var srcModuleName = srcName.replace('.js', ''); | ||
} | ||
/** | ||
* Ignores one package | ||
* @param {String} file path to file to be ignored | ||
* @return {void} | ||
*/ | ||
function ignoreFile(file) { | ||
_fs2.default.writeFileSync(file, '/* Module ignored by ' + 'liferay-npm-bundler-plugin-replace-browser-modules */\n'); | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "liferay-npm-bundler-plugin-replace-browser-modules", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "A liferay-npm-bundler plugin to replace files listed under the browser entry of package.json files.", | ||
@@ -8,8 +8,9 @@ "main": "lib/index.js", | ||
"build": "babel --source-maps -D -d lib src", | ||
"prepublish": "babel --source-maps -D -d lib src" | ||
"prepublish": "npm run build" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-preset-es2015": "^6.24.1" | ||
"babel-preset-es2015": "^6.24.1", | ||
"cp-file": "^4.2.0" | ||
} | ||
} |
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
84574
22
2470
0
34
3
5
1