@jsenv/import-map
Advanced tools
Comparing version 6.2.0 to 6.3.0
@@ -120,4 +120,10 @@ 'use strict'; | ||
const baseOrigin = hrefToOrigin(baseUrl); | ||
const basePathname = hrefToPathname(baseUrl); // pathname relative inside | ||
const basePathname = hrefToPathname(baseUrl); | ||
if (specifier === ".") { | ||
const baseDirname = pathnameToDirname(basePathname); | ||
return `${baseOrigin}${baseDirname}/`; | ||
} // pathname relative inside | ||
if (specifier.slice(0, 2) === "./") { | ||
@@ -135,9 +141,8 @@ const baseDirname = pathnameToDirname(basePathname); | ||
while (unresolvedPathname.slice(0, 3) === "../") { | ||
// when there is no folder left to resolved | ||
unresolvedPathname = unresolvedPathname.slice(3); // when there is no folder left to resolved | ||
// we just ignore '../' | ||
if (importerFolders.length) { | ||
importerFolders.pop(); | ||
} | ||
unresolvedPathname = unresolvedPathname.slice(3); | ||
} | ||
@@ -569,2 +574,10 @@ | ||
}) => { | ||
if (hrefToPathname(url) === "/") { | ||
return url; | ||
} | ||
if (url.endsWith("/")) { | ||
return url; | ||
} | ||
if (typeof defaultExtension === "string") { | ||
@@ -571,0 +584,0 @@ const extension = pathnameToExtension(url); |
{ | ||
"name": "@jsenv/import-map", | ||
"description": "Helpers to implement importMap", | ||
"version": "6.2.0", | ||
"version": "6.3.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -21,2 +21,10 @@ // directly target the files because this code | ||
const applyDefaultExtension = ({ url, importer, defaultExtension }) => { | ||
if (hrefToPathname(url) === "/") { | ||
return url | ||
} | ||
if (url.endsWith("/")) { | ||
return url | ||
} | ||
if (typeof defaultExtension === "string") { | ||
@@ -23,0 +31,0 @@ const extension = pathnameToExtension(url) |
@@ -40,2 +40,7 @@ // could be useful: https://url.spec.whatwg.org/#url-miscellaneous | ||
if (specifier === ".") { | ||
const baseDirname = pathnameToDirname(basePathname) | ||
return `${baseOrigin}${baseDirname}/` | ||
} | ||
// pathname relative inside | ||
@@ -54,2 +59,3 @@ if (specifier.slice(0, 2) === "./") { | ||
while (unresolvedPathname.slice(0, 3) === "../") { | ||
unresolvedPathname = unresolvedPathname.slice(3) | ||
// when there is no folder left to resolved | ||
@@ -60,3 +66,2 @@ // we just ignore '../' | ||
} | ||
unresolvedPathname = unresolvedPathname.slice(3) | ||
} | ||
@@ -63,0 +68,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
104743
1481
0