Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 2.6.2 to 2.7.0

6

lib/__tests__/__fixtures__/dir/index.js

@@ -8,2 +8,8 @@ 'use strict';

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* index function

@@ -10,0 +16,0 @@ * @return {void}

@@ -8,2 +8,8 @@ 'use strict';

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* test2 function

@@ -10,0 +16,0 @@ * @return {void}

@@ -8,2 +8,8 @@ 'use strict';

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* testBrowser2 function

@@ -10,0 +16,0 @@ * @return {void}

@@ -8,2 +8,8 @@ 'use strict';

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* testBrowser function

@@ -10,0 +16,0 @@ * @return {void}

@@ -8,2 +8,8 @@ 'use strict';

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* testMain function

@@ -10,0 +16,0 @@ * @return {void}

@@ -8,2 +8,8 @@ 'use strict';

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* test function

@@ -10,0 +16,0 @@ * @return {void}

8

lib/__tests__/index.test.js

@@ -24,2 +24,8 @@ 'use strict';

// Package descriptor used in tests
/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
var pkg = {

@@ -117,3 +123,3 @@ id: 'package@1.0.0',

browser: {
'dir': 'test-main.js',
dir: 'test-main.js',
'test-browser.js': 'test.js',

@@ -120,0 +126,0 @@ 'test-browser-2.js': 'test-2.js'

22

lib/index.js

@@ -8,4 +8,4 @@ 'use strict';

exports.default = function (_ref, _ref2) {
var pkg = _ref.pkg,
log = _ref.log;
var log = _ref.log,
pkg = _ref.pkg;
var pkgJson = _ref2.pkgJson;

@@ -15,8 +15,6 @@

if (browser) {
if (typeof browser === 'string') {
replaceMainModule(pkg.dir, browser, pkgJson, log);
} else {
replaceModules(pkg.dir, browser, pkgJson, log);
}
if (typeof browser === 'string') {
replaceMainModule(pkg.dir, browser, pkgJson, log);
} else if (browser) {
replaceModules(pkg.dir, browser, pkgJson, log);
} else {

@@ -51,2 +49,8 @@ log.info('replace-browser-modules', 'No browser modules found');

*/
/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
function replaceMainModule(pkgDir, browser, pkgJson, log) {

@@ -65,3 +69,3 @@ var pkgId = pkgJson.name + '@' + pkgJson.version;

* @param {String} pkgDir directory where package is placed
* @param {String} browser the value of the "browser"/"module" field
* @param {Object} browser the value of the "browser"/"module" field
* @param {Object} pkgJson package.json contents

@@ -68,0 +72,0 @@ * @param {PluginLogger} log a logger

{
"name": "liferay-npm-bundler-plugin-replace-browser-modules",
"version": "2.6.2",
"version": "2.7.0",
"description": "A liferay-npm-bundler plugin to replace files listed under the browser/module entry of package.json files.",

@@ -17,4 +17,4 @@ "main": "lib/index.js",

"fs-extra": "^7.0.1",
"liferay-npm-build-tools-common": "2.6.2"
"liferay-npm-build-tools-common": "2.7.0"
}
}
/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* index function

@@ -3,0 +9,0 @@ * @return {void}

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* test2 function

@@ -3,0 +9,0 @@ * @return {void}

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* testBrowser2 function

@@ -3,0 +9,0 @@ * @return {void}

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* testBrowser function

@@ -3,0 +9,0 @@ * @return {void}

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* testMain function

@@ -3,0 +9,0 @@ * @return {void}

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* test function

@@ -3,0 +9,0 @@ * @return {void}

@@ -0,1 +1,7 @@

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import * as fs from 'fs-extra';

@@ -107,3 +113,3 @@ import PluginLogger from 'liferay-npm-build-tools-common/lib/plugin-logger';

browser: {
'dir': 'test-main.js',
dir: 'test-main.js',
'test-browser.js': 'test.js',

@@ -110,0 +116,0 @@ 'test-browser-2.js': 'test-2.js',

@@ -0,1 +1,7 @@

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import fs from 'fs-extra';

@@ -8,11 +14,9 @@ import * as pkgs from 'liferay-npm-build-tools-common/lib/packages';

*/
export default function({pkg, log}, {pkgJson}) {
export default function({log, pkg}, {pkgJson}) {
const browser = pkgJson.browser || pkgJson.unpkg || pkgJson.jsdelivr;
if (browser) {
if (typeof browser === 'string') {
replaceMainModule(pkg.dir, browser, pkgJson, log);
} else {
replaceModules(pkg.dir, browser, pkgJson, log);
}
if (typeof browser === 'string') {
replaceMainModule(pkg.dir, browser, pkgJson, log);
} else if (browser) {
replaceModules(pkg.dir, browser, pkgJson, log);
} else {

@@ -44,3 +48,3 @@ log.info('replace-browser-modules', 'No browser modules found');

* @param {String} pkgDir directory where package is placed
* @param {String} browser the value of the "browser"/"module" field
* @param {Object} browser the value of the "browser"/"module" field
* @param {Object} pkgJson package.json contents

@@ -47,0 +51,0 @@ * @param {PluginLogger} log a logger

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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