extensionless
Advanced tools
Comparing version 1.8.1 to 1.8.2
{ | ||
"name": "extensionless", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "exports": { |
@@ -17,3 +17,3 @@ import {extname} from 'path' | ||
candidates = indexFiles.map(i => i.map(f => extname(f)).concat(i.map(f => `/${f}`))) | ||
aliases = Object.entries(imports).map(([k, v]) => [k.split('*'), (v.node ?? v.default ?? v).split('*')]) | ||
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) | ||
} | ||
@@ -26,4 +26,4 @@ | ||
export async function resolve(specifier, context, nextResolve) { | ||
let alias = specifier.startsWith('#') && aliases.find(a => a[0][1] !== undefined ? specifier.length > a[0][0].length + a[0][1].length && specifier.startsWith(a[0][0]) && specifier.endsWith(a[0][1]) : specifier === a[0][0]) | ||
let spec = alias ? alias[1][0] + (alias[1][1] !== undefined && alias[0][1] !== undefined ? specifier.substring(alias[0][0].length, specifier.length - alias[0][1].length) + alias[1][1] : '') : specifier | ||
let alias = specifier[0] === '#' && specifier[1] !== '/' && 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 prefix = winAbsPath.test(spec) ? 'file://' : '' | ||
@@ -30,0 +30,0 @@ |
7150