@jsenv/node-esm-resolution
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "@jsenv/node-esm-resolution", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -107,3 +107,7 @@ /* | ||
const applyBrowserFieldResolution = ({ conditions, parentUrl, specifier }) => { | ||
const applyBrowserFieldResolution = ({ | ||
conditions, | ||
parentUrl, | ||
packageSpecifier, | ||
}) => { | ||
const browserCondition = conditions.includes("browser") | ||
@@ -129,18 +133,20 @@ if (!browserCondition) { | ||
let url | ||
if (specifier.startsWith(".")) { | ||
const specifierUrl = new URL(specifier, parentUrl).href | ||
const specifierRelativeToPackage = specifierUrl.slice(packageUrl.length) | ||
const specifierRelativeNotation = `./${specifierRelativeToPackage}` | ||
const browserMapping = browser[specifierRelativeNotation] | ||
if (packageSpecifier.startsWith(".")) { | ||
const packageSpecifierUrl = new URL(packageSpecifier, parentUrl).href | ||
const packageSpecifierRelativeUrl = packageSpecifierUrl.slice( | ||
packageUrl.length, | ||
) | ||
const packageSpecifierRelativeNotation = `./${packageSpecifierRelativeUrl}` | ||
const browserMapping = browser[packageSpecifierRelativeNotation] | ||
if (typeof browserMapping === "string") { | ||
url = new URL(browserMapping, packageUrl).href | ||
} else if (browserMapping === false) { | ||
url = `file:///@ignore/${specifierUrl.slice("file:///")}` | ||
url = `file:///@ignore/${packageSpecifierUrl.slice("file:///")}` | ||
} | ||
} else { | ||
const browserMapping = browser[specifier] | ||
const browserMapping = browser[packageSpecifier] | ||
if (typeof browserMapping === "string") { | ||
url = new URL(browserMapping, packageUrl).href | ||
} else if (browserMapping === false) { | ||
url = `file:///@ignore/${specifier}` | ||
url = `file:///@ignore/${packageSpecifier}` | ||
} | ||
@@ -147,0 +153,0 @@ } |
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
30175
1139