If you import from "." inside a containing directory "/foo", the result of `tspath.NormalizePath` would be "/foo", but this loses the information that `foo` is a directory and we intended to look inside of it. The Node CommonJS resolution algorithm doesn't call this out (https://nodejs.org/api/modul
(containingDirectory string, moduleName string)
| 2046 | // (https://nodejs.org/api/modules.html#all-together), but it seems that module paths ending |
| 2047 | // in `.` are actually normalized to `./` before proceeding with the resolution algorithm. |
| 2048 | func normalizePathForCJSResolution(containingDirectory string, moduleName string) string { |
| 2049 | combined := tspath.CombinePaths(containingDirectory, moduleName) |
| 2050 | parts := tspath.GetPathComponents(combined, "") |
| 2051 | lastPart := parts[len(parts)-1] |
| 2052 | if lastPart == "." || lastPart == ".." { |
| 2053 | return tspath.EnsureTrailingDirectorySeparator(tspath.NormalizePath(combined)) |
| 2054 | } |
| 2055 | return tspath.NormalizePath(combined) |
| 2056 | } |
| 2057 | |
| 2058 | func matchesPatternWithTrailer(target string, name string) bool { |
| 2059 | if strings.HasSuffix(target, "*") { |
no test coverage detected