extensionless
Advanced tools
Comparing version 1.3.1 to 1.3.2
{ | ||
"name": "extensionless", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -32,6 +32,6 @@ import {access, existsSync, readFileSync} from 'fs' | ||
export async function resolve(specifier, {importAssertions, parentURL}, nextResolve) { | ||
let isRelSpec = relSpecs.includes(specifier) | ||
let isAbs = isAbsolute(specifier), isRelSpec = relSpecs.includes(specifier) | ||
let isRelative = isRelSpec || relPrefixes.some(p => specifier.startsWith(p)) | ||
if (isRelative || isAbsolute(specifier) || specifier.startsWith('file://')) { | ||
if (specifier.startsWith('file://') || isAbs || isRelative) { | ||
let postfixes = isRelSpec ? relatives | ||
@@ -42,6 +42,6 @@ : separators.some(s => specifier.endsWith(s)) ? indexFiles | ||
for (let postfix of postfixes[+(importAssertions?.type === 'json')]) { | ||
let fileUrl = new URL(specifier + postfix, parentURL) | ||
let fileURL = new URL((isAbs ? 'file://' : '') + specifier + postfix, parentURL) | ||
if (!postfix || await new Promise(r => access(fileUrl, e => r(!e)))) { | ||
return await nextResolve(fileUrl.href) | ||
if (!postfix || await new Promise(r => access(fileURL, e => r(!e)))) { | ||
return await nextResolve(fileURL.href) | ||
} | ||
@@ -48,0 +48,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
5708