@jsenv/import-map
Advanced tools
Comparing version 6.13.0 to 6.13.1
@@ -711,4 +711,4 @@ var createDetailedMessage = function createDetailedMessage(message) { | ||
if (typeof baseUrl !== "string") { | ||
throw new TypeError(formulateBaseUrlMustBeAString({ | ||
if (isStringOrUrl(baseUrl)) { | ||
throw new TypeError(formulateBaseUrlMustBeStringOrUrl({ | ||
baseUrl: baseUrl | ||
@@ -726,2 +726,14 @@ })); | ||
var isStringOrUrl = function isStringOrUrl(value) { | ||
if (typeof value === "string") { | ||
return true; | ||
} | ||
if (typeof URL === "function" && value instanceof URL) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
var normalizeMappings = function normalizeMappings(mappings, baseUrl) { | ||
@@ -786,5 +798,5 @@ var mappingsNormalized = {}; | ||
var formulateBaseUrlMustBeAString = function formulateBaseUrlMustBeAString(_ref) { | ||
var formulateBaseUrlMustBeStringOrUrl = function formulateBaseUrlMustBeStringOrUrl(_ref) { | ||
var baseUrl = _ref.baseUrl; | ||
return "baseUrl must be a string.\n--- base url ---\n".concat(baseUrl); | ||
return "baseUrl must be a string or an url.\n--- base url ---\n".concat(baseUrl); | ||
}; | ||
@@ -791,0 +803,0 @@ |
{ | ||
"name": "@jsenv/import-map", | ||
"version": "6.13.0", | ||
"version": "6.13.1", | ||
"description": "Helpers to implement importmaps.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -8,4 +8,5 @@ import { assertImportMap } from "./internal/assertImportMap.js" | ||
assertImportMap(importMap) | ||
if (typeof baseUrl !== "string") { | ||
throw new TypeError(formulateBaseUrlMustBeAString({ baseUrl })) | ||
if (isStringOrUrl(baseUrl)) { | ||
throw new TypeError(formulateBaseUrlMustBeStringOrUrl({ baseUrl })) | ||
} | ||
@@ -21,2 +22,14 @@ | ||
const isStringOrUrl = (value) => { | ||
if (typeof value === "string") { | ||
return true | ||
} | ||
if (typeof URL === "function" && value instanceof URL) { | ||
return true | ||
} | ||
return false | ||
} | ||
const normalizeMappings = (mappings, baseUrl) => { | ||
@@ -90,3 +103,3 @@ const mappingsNormalized = {} | ||
const formulateBaseUrlMustBeAString = ({ baseUrl }) => `baseUrl must be a string. | ||
const formulateBaseUrlMustBeStringOrUrl = ({ baseUrl }) => `baseUrl must be a string or an url. | ||
--- base url --- | ||
@@ -93,0 +106,0 @@ ${baseUrl}` |
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
195106
2252