babel-plugin-namespace-modules
Advanced tools
Comparing version 1.7.0-alpha.43ab330a to 1.7.0-alpha.6d6b0c8b
@@ -39,3 +39,3 @@ 'use strict'; | ||
var namespaces = opts.namespaces, | ||
imports = opts.imports; | ||
unrolledImports = opts.unrolledImports; | ||
@@ -83,3 +83,3 @@ | ||
deps[i].value = addDependencyNamespace(moduleName, namespaces.dependencies, imports); | ||
deps[i].value = addDependencyNamespace(moduleName, namespaces.dependencies, unrolledImports); | ||
@@ -123,3 +123,3 @@ state.depsCount++; | ||
var namespaces = opts.namespaces, | ||
imports = opts.imports; | ||
unrolledImports = opts.unrolledImports; | ||
@@ -152,3 +152,3 @@ | ||
// Namespace require argument | ||
argument.value = addDependencyNamespace(moduleName, namespaces.dependencies, imports); | ||
argument.value = addDependencyNamespace(moduleName, namespaces.dependencies, unrolledImports); | ||
@@ -169,3 +169,5 @@ state.requiresCount++; | ||
rootPkgJson: ownPkgJson, | ||
globalConfig: {} | ||
globalConfig: { | ||
imports: state.opts.imports | ||
} | ||
}; | ||
@@ -186,3 +188,4 @@ }), | ||
dependencies: rootPkgJson | ||
} | ||
}, | ||
unrolledImports: (0, _imports.unrollImportsConfig)(globalConfig.imports) | ||
}, globalConfig, state.opts); | ||
@@ -251,8 +254,6 @@ | ||
* @param {String} namespacePkg package name to use as namespace | ||
* @param {Object} imports imports section of .npmbundlerrc file | ||
* @param {Object} unrolledImports unrolled imports section of .npmbundlerrc file | ||
* @return {String} the namespaced module | ||
*/ | ||
function addDependencyNamespace(moduleName, namespacePkg, imports) { | ||
imports = (0, _imports.unrollImportsConfig)(imports); | ||
function addDependencyNamespace(moduleName, namespacePkg, unrolledImports) { | ||
var _mod$splitModuleName = mod.splitModuleName(moduleName), | ||
@@ -263,3 +264,3 @@ scope = _mod$splitModuleName.scope, | ||
var fullPkgName = mod.joinModuleName(scope, pkgName); | ||
var pkg = imports[fullPkgName] || namespacePkg; | ||
var pkg = unrolledImports[fullPkgName] || namespacePkg; | ||
@@ -266,0 +267,0 @@ return pkg.name === '' ? moduleName : ns.addNamespace(moduleName, pkg); |
{ | ||
"name": "babel-plugin-namespace-modules", | ||
"version": "1.7.0-alpha.43ab330a", | ||
"version": "1.7.0-alpha.6d6b0c8b", | ||
"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": "1.7.0-alpha.43ab330a", | ||
"liferay-npm-build-tools-common": "1.7.0-alpha.6d6b0c8b", | ||
"read-json-sync": "^1.1.1" | ||
} | ||
} |
@@ -41,3 +41,3 @@ import * as babelIpc from 'liferay-npm-build-tools-common/lib/babel-ipc'; | ||
const {opts} = state; | ||
const {namespaces, imports} = opts; | ||
const {namespaces, unrolledImports} = opts; | ||
@@ -91,3 +91,3 @@ if (!t.isCallExpression(expression)) { | ||
namespaces.dependencies, | ||
imports | ||
unrolledImports | ||
); | ||
@@ -131,3 +131,3 @@ | ||
const {opts} = state; | ||
const {namespaces, imports} = opts; | ||
const {namespaces, unrolledImports} = opts; | ||
@@ -165,3 +165,3 @@ if (node.name !== 'require') { | ||
namespaces.dependencies, | ||
imports | ||
unrolledImports | ||
); | ||
@@ -184,3 +184,5 @@ | ||
rootPkgJson: ownPkgJson, | ||
globalConfig: {}, | ||
globalConfig: { | ||
imports: state.opts.imports, | ||
}, | ||
}) | ||
@@ -203,2 +205,5 @@ ); | ||
}, | ||
unrolledImports: unrollImportsConfig( | ||
globalConfig.imports | ||
), | ||
}, | ||
@@ -253,11 +258,9 @@ globalConfig, | ||
* @param {String} namespacePkg package name to use as namespace | ||
* @param {Object} imports imports section of .npmbundlerrc file | ||
* @param {Object} unrolledImports unrolled imports section of .npmbundlerrc file | ||
* @return {String} the namespaced module | ||
*/ | ||
function addDependencyNamespace(moduleName, namespacePkg, imports) { | ||
imports = unrollImportsConfig(imports); | ||
function addDependencyNamespace(moduleName, namespacePkg, unrolledImports) { | ||
const {scope, pkgName} = mod.splitModuleName(moduleName); | ||
const fullPkgName = mod.joinModuleName(scope, pkgName); | ||
const pkg = imports[fullPkgName] || namespacePkg; | ||
const pkg = unrolledImports[fullPkgName] || namespacePkg; | ||
@@ -264,0 +267,0 @@ return pkg.name === '' ? moduleName : ns.addNamespace(moduleName, pkg); |
Sorry, the diff of this file is not supported yet
57337
828
15
+ Addedliferay-npm-build-tools-common@1.7.0-alpha.6d6b0c8b(transitive)
- Removedliferay-npm-build-tools-common@1.7.0-alpha.43ab330a(transitive)