Socket
Socket
Sign inDemoInstall

liferay-npm-bundler-plugin-replace-browser-modules

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liferay-npm-bundler-plugin-replace-browser-modules - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

lib/__tests__/__snapshots__/index.test.js.snap

47

lib/index.js

@@ -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

7

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc