@@ -969,14 +969,6 @@ func loaderFromFileExtension(extensionToLoader map[string]config.Loader, base st
969
969
return config .LoaderNone
970
970
}
971
971
972
- // Identify the path by its lowercase absolute path name with Windows-specific
973
- // slashes substituted for standard slashes. This should hopefully avoid path
974
- // issues on Windows where multiple different paths can refer to the same
975
- // underlying file.
976
- func canonicalFileSystemPathForWindows (absPath string ) string {
977
- return strings .ReplaceAll (strings .ToLower (absPath ), "\\ " , "/" )
978
- }
979
-
980
972
func hashForFileName (hashBytes []byte ) string {
981
973
return base32 .StdEncoding .EncodeToString (hashBytes )[:8 ]
982
974
}
@@ -1160,7 +1152,7 @@ func (s *scanner) maybeParseFile(
1160
1152
path := resolveResult .PathPair .Primary
1161
1153
visitedKey := path
1162
1154
if visitedKey .Namespace == "file" {
1163
- visitedKey .Text = canonicalFileSystemPathForWindows (visitedKey .Text )
1155
+ visitedKey .Text = logger . CanonicalFileSystemPathForWindows (visitedKey .Text )
1164
1156
}
1165
1157
1166
1158
// Only parse a given file path once
@@ -1382,7 +1374,7 @@ func (s *scanner) preprocessInjectedFiles() {
1382
1374
j := 0
1383
1375
for _ , absPath := range s .options .InjectAbsPaths {
1384
1376
prettyPath := s .res .PrettyPath (logger.Path {Text : absPath , Namespace : "file" })
1385
- absPathKey := canonicalFileSystemPathForWindows (absPath )
1377
+ absPathKey := logger . CanonicalFileSystemPathForWindows (absPath )
1386
1378
1387
1379
if duplicateInjectedFiles [absPathKey ] {
1388
1380
s .log .Add (logger .Error , nil , logger.Range {}, fmt .Sprintf ("Duplicate injected file %q" , prettyPath ))
@@ -1782,7 +1774,7 @@ func (s *scanner) processScannedFiles() []scannerFile {
1782
1774
if resolveResult .PathPair .HasSecondary () {
1783
1775
secondaryKey := resolveResult .PathPair .Secondary
1784
1776
if secondaryKey .Namespace == "file" {
1785
- secondaryKey .Text = canonicalFileSystemPathForWindows (secondaryKey .Text )
1777
+ secondaryKey .Text = logger . CanonicalFileSystemPathForWindows (secondaryKey .Text )
1786
1778
}
1787
1779
if secondaryVisited , ok := s .visited [secondaryKey ]; ok {
1788
1780
record .SourceIndex = ast .MakeIndex32 (secondaryVisited .sourceIndex )
@@ -1842,7 +1834,7 @@ func (s *scanner) processScannedFiles() []scannerFile {
1842
1834
} else if ! css .JSSourceIndex .IsValid () {
1843
1835
stubKey := otherFile .inputFile .Source .KeyPath
1844
1836
if stubKey .Namespace == "file" {
1845
- stubKey .Text = canonicalFileSystemPathForWindows (stubKey .Text )
1837
+ stubKey .Text = logger . CanonicalFileSystemPathForWindows (stubKey .Text )
1846
1838
}
1847
1839
sourceIndex := s .allocateSourceIndex (stubKey , cache .SourceIndexJSStubForCSS )
1848
1840
source := logger.Source {
@@ -2222,12 +2214,12 @@ func (b *Bundle) Compile(log logger.Log, options config.Options, timer *helpers.
2222
2214
for _ , sourceIndex := range allReachableFiles {
2223
2215
keyPath := b .files [sourceIndex ].inputFile .Source .KeyPath
2224
2216
if keyPath .Namespace == "file" {
2225
- absPathKey := canonicalFileSystemPathForWindows (keyPath .Text )
2217
+ absPathKey := logger . CanonicalFileSystemPathForWindows (keyPath .Text )
2226
2218
sourceAbsPaths [absPathKey ] = sourceIndex
2227
2219
}
2228
2220
}
2229
2221
for _ , outputFile := range outputFiles {
2230
- absPathKey := canonicalFileSystemPathForWindows (outputFile .AbsPath )
2222
+ absPathKey := logger . CanonicalFileSystemPathForWindows (outputFile .AbsPath )
2231
2223
if sourceIndex , ok := sourceAbsPaths [absPathKey ]; ok {
2232
2224
hint := ""
2233
2225
switch logger .API {
@@ -2254,7 +2246,7 @@ func (b *Bundle) Compile(log logger.Log, options config.Options, timer *helpers.
2254
2246
outputFileMap := make (map [string ][]byte )
2255
2247
end := 0
2256
2248
for _ , outputFile := range outputFiles {
2257
- absPathKey := canonicalFileSystemPathForWindows (outputFile .AbsPath )
2249
+ absPathKey := logger . CanonicalFileSystemPathForWindows (outputFile .AbsPath )
2258
2250
contents , ok := outputFileMap [absPathKey ]
2259
2251
2260
2252
// If this isn't a duplicate, keep the output file
0 commit comments