Closed guybedford closed 5 years ago
I'm going to add to this PR to implement no-trailing-slash = exact matching, trailing-slash = prefix matching. For now that seems best to me. But let's keep #73 open and discuss more fully there; we can change after landing this.
This provides a simple implementation of scoped resolution with the various fallback tests.
The gist of the approach is:
resolveImportsMatch
function which is used on scopesBecause of the way scopes are normalized during parsing, we end up needing to check for
parentURL[normalizedScopeURL.length] === '/' || parntURL[normalizedScopeURL.length - 1] === '/'
because scopes may or may not end in '/'. One optimization here might be to normalize scopes to always be with or without the trailing slash (possibly without?), but that seemed to affect quite a few of the parsing tests when I tried it. I could certainly implement that as well though.Any other thoughts re edge cases very welcome, but I think most are already covered by the base import maps themselves.