extensionless
Advanced tools
Comparing version 1.9.1 to 1.9.2
{ | ||
"name": "extensionless", | ||
"version": "1.9.1", | ||
"version": "1.9.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "exports": { |
@@ -15,4 +15,3 @@ import {extname} from 'path' | ||
indexFiles = [lookFor.map(e => `index.${e}`), ['index.json']] | ||
candidates = indexFiles.map(i => i.map(f => extname(f)).concat(i.map(f => `/${f}`))) | ||
indexFiles = [lookFor.map(e => `index.${e}`), ['index.json']], candidates = indexFiles.map(i => i.map(f => extname(f)).concat(i.map(f => `/${f}`))) | ||
pkgJsonURL = 'file://' + jsonPath, aliases = Object.entries(imports ?? {}).map(([k, v]) => [k.split('*'), (v.node ?? v.default ?? v).split('*')]).filter(([k, v]) => k.length < 3 && k.length === v.length) | ||
@@ -27,10 +26,10 @@ } | ||
let alias = specifier.startsWith('#') && (await initPromise, aliases.find(([k]) => k[1] !== undefined ? specifier.length > k[0].length + k[1].length && specifier.startsWith(k[0]) && specifier.endsWith(k[1]) : specifier === k[0])) | ||
let spec = alias ? alias[1][0] + (alias[0][1] !== undefined ? specifier.substring(alias[0][0].length, specifier.length - alias[0][1].length) + alias[1][1] : '') : specifier | ||
let error, prefix = winAbsPath.test(spec) ? 'file://' : '' | ||
let orgSpec = alias ? alias[1][0] + (alias[0][1] !== undefined ? specifier.substring(alias[0][0].length, specifier.length - alias[0][1].length) + alias[1][1] : '') : specifier | ||
let error, prefix = winAbsPath.test(orgSpec) ? 'file://' : '' | ||
if (!prefix && !relSpecs.includes(spec) && !specStarts.some(s => spec.startsWith(s))) { | ||
try {return await nextResolve(spec)} catch (e) {error = e} | ||
if (!prefix && !relSpecs.includes(orgSpec) && !specStarts.some(s => orgSpec.startsWith(s))) { | ||
try {return await nextResolve(orgSpec)} catch (e) {error = e} | ||
} | ||
let trySpec = error ? spec : new URL(prefix + spec, alias ? pkgJsonURL : context.parentURL).href | ||
let trySpec = error ? orgSpec : new URL(prefix + orgSpec, alias ? pkgJsonURL : context.parentURL).href | ||
let {type} = context.importAttributes ?? context.importAssertions | ||
@@ -37,0 +36,0 @@ let postfixes = (await initPromise, trySpec.endsWith('/') ? indexFiles : knownExts.includes(extname(trySpec)) ? empty : candidates) |
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
7414
63