extensionless
Advanced tools
Comparing version 1.0.5 to 1.1.0
{ | ||
"name": "extensionless", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
import {access, existsSync, readFileSync} from 'fs' | ||
import {basename, dirname, extname, join, sep, isAbsolute} from 'path' | ||
import {dirname, extname, isAbsolute, join, normalize, sep} from 'path' | ||
import {cwd} from 'process' | ||
@@ -10,5 +10,3 @@ import {fileURLToPath} from 'url' | ||
do { | ||
curDir = upDir | ||
let filePath = join(curDir, 'package.json') | ||
let filePath = join(curDir = upDir, 'package.json') | ||
if (existsSync(filePath)) { | ||
@@ -45,3 +43,3 @@ pkgJson = JSON.parse(readFileSync(filePath, 'utf8')) | ||
let relPrefixes = [`.${sep}`, `..${sep}`] | ||
let relPrefixes = [...new Set(['./', '../', `.${sep}`, `..${sep}`])] | ||
export async function resolve(specifier, context, nextResolve) { | ||
@@ -51,6 +49,5 @@ let spec = specifier.startsWith('file://') ? fileURLToPath(specifier) : specifier | ||
let postfix = (isAbsolute(spec) || relPrefixes.some(p => spec.startsWith(p))) | ||
&& !extname(basename(spec)) | ||
&& await findPostfix(spec, context) || '' | ||
&& !extname(spec) && await findPostfix(normalize(spec), context) | ||
return await nextResolve(specifier + postfix) | ||
return await nextResolve(specifier + (postfix || '')) | ||
} |
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
4047
40