-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicitly avoid canonicalizing paths during configuration handling #18316
Explicitly avoid canonicalizing paths during configuration handling #18316
Conversation
@Andy-MS Would you take a look at this? |
src/compiler/core.ts
Outdated
@@ -1228,6 +1228,9 @@ namespace ts { | |||
/** Does nothing. */ | |||
export function noop(): void {} | |||
|
|||
/** Passes thru argument. */ | |||
export function identity<T>(x: T) { return x; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also replace identityMapper
in checker.ts
.
src/compiler/commandLineParser.ts
Outdated
@@ -1577,7 +1577,7 @@ namespace ts { | |||
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string")); | |||
} | |||
else { | |||
const newBase = configFileName ? getDirectoryPath(toPath(configFileName, basePath, getCanonicalFileName)) : basePath; | |||
const newBase = configFileName ? getDirectoryPath(toPath(configFileName, basePath, identity)) : basePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to create a local toPath
function delegating to ts.toPath
that explains why we use identity
here.
src/compiler/core.ts
Outdated
@@ -1228,6 +1228,9 @@ namespace ts { | |||
/** Does nothing. */ | |||
export function noop(): void {} | |||
|
|||
/** Passes thru argument. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
through
; or just Returns its argument
.
…use identity in checker
According to this comment,
forceConsistentCasingInFileNames
relies on paths not being canonicalized until later in the process; so this replaces new usages ofgetCanonicalFileName
in the configuration parser with anidentity
function, so as to avoid canonicalizing the path when it is not needed.