@@ -281,6 +281,11 @@ func reducePathComponents(components []string) []string {
281281 if len (components ) == 0 {
282282 return []string {}
283283 }
284+ // Deno: Paths like this can represent URIs with exotic schemes. They shouldn't be
285+ // normalized. TODO(nayeemrmn): Upstream this?
286+ if components [0 ] == "^/" {
287+ return components
288+ }
284289 reduced := []string {components [0 ]}
285290 for i := 1 ; i < len (components ); i ++ {
286291 component := components [i ]
@@ -342,6 +347,11 @@ func GetNormalizedAbsolutePathWithoutRoot(fileName string, currentDirectory stri
342347}
343348
344349func GetNormalizedAbsolutePath (fileName string , currentDirectory string ) string {
350+ // Deno: Paths like this can represent URIs with exotic schemes. They shouldn't be
351+ // normalized. TODO(nayeemrmn): Upstream this?
352+ if strings .HasPrefix (fileName , "^/" ) {
353+ return fileName
354+ }
345355 rootLength := GetRootLength (fileName )
346356 if rootLength == 0 && currentDirectory != "" {
347357 fileName = CombinePaths (currentDirectory , fileName )
@@ -549,6 +559,11 @@ func hasRelativePathSegment(p string) bool {
549559
550560func NormalizePath (path string ) string {
551561 path = NormalizeSlashes (path )
562+ // Deno: Paths like this can represent URIs with exotic schemes. They shouldn't be
563+ // normalized. TODO(nayeemrmn): Upstream this?
564+ if strings .HasPrefix (path , "^/" ) {
565+ return path
566+ }
552567 if normalized , ok := simpleNormalizePath (path ); ok {
553568 return normalized
554569 }
0 commit comments