@jsenv/import-map
Advanced tools
Comparing version 6.8.0 to 6.8.1
@@ -388,18 +388,37 @@ var nativeTypeOf = function nativeTypeOf(obj) { | ||
assertImportMap(rightImportMap); | ||
return { | ||
imports: composeTwoImports(leftImportMap.imports, rightImportMap.imports), | ||
scopes: composeTwoScopes(leftImportMap.scopes, rightImportMap.scopes) | ||
}; | ||
var importMap = {}; | ||
var leftImports = leftImportMap.imports; | ||
var rightImports = rightImportMap.imports; | ||
var leftHasImports = Boolean(leftImports); | ||
var rightHasImports = Boolean(rightImports); | ||
if (leftHasImports && rightHasImports) { | ||
importMap.imports = composeTwoImports(leftImports, rightImports); | ||
} else if (leftHasImports) { | ||
importMap.imports = _objectSpread({}, leftImports); | ||
} else if (rightHasImports) { | ||
importMap.imports = _objectSpread({}, rightImports); | ||
} | ||
var leftScopes = leftImportMap.scopes; | ||
var rightScopes = rightImportMap.scopes; | ||
var leftHasScopes = Boolean(leftScopes); | ||
var rightHasScopes = Boolean(rightScopes); | ||
if (leftHasScopes && rightHasScopes) { | ||
importMap.scopes = composeTwoScopes(leftScopes, rightScopes); | ||
} else if (leftHasScopes) { | ||
importMap.scopes = _objectSpread({}, leftScopes); | ||
} else if (rightHasScopes) { | ||
importMap.scopes = _objectSpread({}, rightScopes); | ||
} | ||
return importMap; | ||
}; | ||
var composeTwoImports = function composeTwoImports() { | ||
var leftImports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var rightImports = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var composeTwoImports = function composeTwoImports(leftImports, rightImports) { | ||
return _objectSpread(_objectSpread({}, leftImports), rightImports); | ||
}; | ||
var composeTwoScopes = function composeTwoScopes() { | ||
var leftScopes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var rightScopes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var composeTwoScopes = function composeTwoScopes(leftScopes, rightScopes) { | ||
var scopes = _objectSpread({}, leftScopes); | ||
@@ -406,0 +425,0 @@ |
{ | ||
"name": "@jsenv/import-map", | ||
"version": "6.8.0", | ||
"version": "6.8.1", | ||
"description": "Helpers to implement importmaps.", | ||
@@ -14,3 +14,4 @@ "license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org" | ||
}, | ||
@@ -17,0 +18,0 @@ "type": "module", |
@@ -8,9 +8,32 @@ // https://github.com/systemjs/systemjs/blob/89391f92dfeac33919b0223bbf834a1f4eea5750/src/common.js#L136 | ||
return { | ||
imports: composeTwoImports(leftImportMap.imports, rightImportMap.imports), | ||
scopes: composeTwoScopes(leftImportMap.scopes, rightImportMap.scopes), | ||
const importMap = {} | ||
const leftImports = leftImportMap.imports | ||
const rightImports = rightImportMap.imports | ||
const leftHasImports = Boolean(leftImports) | ||
const rightHasImports = Boolean(rightImports) | ||
if (leftHasImports && rightHasImports) { | ||
importMap.imports = composeTwoImports(leftImports, rightImports) | ||
} else if (leftHasImports) { | ||
importMap.imports = { ...leftImports } | ||
} else if (rightHasImports) { | ||
importMap.imports = { ...rightImports } | ||
} | ||
const leftScopes = leftImportMap.scopes | ||
const rightScopes = rightImportMap.scopes | ||
const leftHasScopes = Boolean(leftScopes) | ||
const rightHasScopes = Boolean(rightScopes) | ||
if (leftHasScopes && rightHasScopes) { | ||
importMap.scopes = composeTwoScopes(leftScopes, rightScopes) | ||
} else if (leftHasScopes) { | ||
importMap.scopes = { ...leftScopes } | ||
} else if (rightHasScopes) { | ||
importMap.scopes = { ...rightScopes } | ||
} | ||
return importMap | ||
} | ||
const composeTwoImports = (leftImports = {}, rightImports = {}) => { | ||
const composeTwoImports = (leftImports, rightImports) => { | ||
return { | ||
@@ -22,3 +45,3 @@ ...leftImports, | ||
const composeTwoScopes = (leftScopes = {}, rightScopes = {}) => { | ||
const composeTwoScopes = (leftScopes, rightScopes) => { | ||
const scopes = { | ||
@@ -25,0 +48,0 @@ ...leftScopes, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113541
1817