Socket
Socket
Sign inDemoInstall

babel-plugin-namespace-modules

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-namespace-modules - npm Package Compare versions

Comparing version 2.6.2 to 2.7.0

11

lib/__tests__/index.test.js

@@ -27,8 +27,13 @@ 'use strict';

var filenameRelative = _path2.default.join(__dirname, '__fixtures__', 'source.js');
var filenameRelative = _path2.default.join(__dirname, '__fixtures__', 'source.js'); /**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
var imports = {
'provider': {
provider: {
'imp-module': '^1.0.0'
},
'shims': {
shims: {
fs: '^1.0.0'

@@ -35,0 +40,0 @@ },

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

var _getDefineIndices = getDefineIndices(t, args),
nameIndex = _getDefineIndices.name,
depsIndex = _getDefineIndices.dependencies;
depsIndex = _getDefineIndices.dependencies,
nameIndex = _getDefineIndices.name;

@@ -171,4 +171,4 @@ // Namespace module name

}),
rootPkgJson = _babelIpc$get.rootPkgJson,
globalConfig = _babelIpc$get.globalConfig;
globalConfig = _babelIpc$get.globalConfig,
rootPkgJson = _babelIpc$get.rootPkgJson;

@@ -253,6 +253,12 @@ // Check if we need to namespace module name

*/
/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
function addDependencyNamespace(moduleName, namespacePkg, unrolledImports) {
var _mod$splitModuleName = mod.splitModuleName(moduleName),
scope = _mod$splitModuleName.scope,
pkgName = _mod$splitModuleName.pkgName;
pkgName = _mod$splitModuleName.pkgName,
scope = _mod$splitModuleName.scope;

@@ -313,2 +319,5 @@ var fullPkgName = mod.joinModuleName(scope, pkgName);

break;
default:
throw new Error('Unexpected argument count of ' + args.length);
}

@@ -315,0 +324,0 @@

{
"name": "babel-plugin-namespace-modules",
"version": "2.6.2",
"version": "2.7.0",
"description": "A Babel plugin to namespace AMD module names based on root's project name.",

@@ -15,5 +15,5 @@ "main": "lib/index.js",

"dependencies": {
"liferay-npm-build-tools-common": "2.6.2",
"liferay-npm-build-tools-common": "2.7.0",
"read-json-sync": "^1.1.1"
}
}

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

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

@@ -9,6 +15,6 @@ import * as babelIpc from 'liferay-npm-build-tools-common/lib/babel-ipc';

const imports = {
'provider': {
provider: {
'imp-module': '^1.0.0',
},
'shims': {
shims: {
fs: '^1.0.0',

@@ -15,0 +21,0 @@ },

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

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import * as babelIpc from 'liferay-npm-build-tools-common/lib/babel-ipc';

@@ -39,3 +45,5 @@ import {unrollImportsConfig} from 'liferay-npm-build-tools-common/lib/imports';

ExpressionStatement(path, state) {
const {node: {expression}} = path;
const {
node: {expression},
} = path;
const {opts} = state;

@@ -56,3 +64,3 @@ const {namespaces, unrolledImports} = opts;

let {name: nameIndex, dependencies: depsIndex} = getDefineIndices(
const {dependencies: depsIndex, name: nameIndex} = getDefineIndices(
t,

@@ -177,3 +185,3 @@ args

const {rootPkgJson, globalConfig} = babelIpc.get(
const {globalConfig, rootPkgJson} = babelIpc.get(
state,

@@ -258,3 +266,3 @@ () => ({

function addDependencyNamespace(moduleName, namespacePkg, unrolledImports) {
const {scope, pkgName} = mod.splitModuleName(moduleName);
const {pkgName, scope} = mod.splitModuleName(moduleName);
const fullPkgName = mod.joinModuleName(scope, pkgName);

@@ -272,3 +280,7 @@ const pkg = unrolledImports[fullPkgName] || namespacePkg;

function getOwnPkgJson(state) {
const {file: {opts: {filenameRelative}}} = state;
const {
file: {
opts: {filenameRelative},
},
} = state;

@@ -291,20 +303,23 @@ return readJsonSync(getPackageJsonPath(filenameRelative));

switch (args.length) {
case 1:
factoryIndex = 0;
break;
case 1:
factoryIndex = 0;
break;
case 2:
if (t.isStringLiteral(args[0])) {
case 2:
if (t.isStringLiteral(args[0])) {
nameIndex = 0;
} else if (t.isArrayExpression(args[0])) {
depsIndex = 0;
}
factoryIndex = 1;
break;
case 3:
nameIndex = 0;
} else if (t.isArrayExpression(args[0])) {
depsIndex = 0;
}
factoryIndex = 1;
break;
depsIndex = 1;
factoryIndex = 2;
break;
case 3:
nameIndex = 0;
depsIndex = 1;
factoryIndex = 2;
break;
default:
throw new Error(`Unexpected argument count of ${args.length}`);
}

@@ -311,0 +326,0 @@

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