build(bazel): entry point file couldn't be resolved [ts-api-guardian] (#25052)

* When using `ts-api-guardian` on Windows, the input file can't be found due to wrong normalized path delimiters.

PR Close #25052
This commit is contained in:
Paul Gschwendtner 2018-07-23 22:36:24 +02:00 committed by Igor Minar
parent bde4402675
commit fa70a2a650
1 changed files with 3 additions and 1 deletions

View File

@ -42,7 +42,9 @@ export function publicApi(fileName: string, options: SerializationOptions = {}):
export function publicApiInternal(
host: ts.CompilerHost, fileName: string, tsOptions: ts.CompilerOptions,
options: SerializationOptions = {}): string {
const entrypoint = path.normalize(fileName);
// Since the entry point will be compared with the source files from the TypeScript program,
// the path needs to be normalized with forward slashes in order to work within Windows.
const entrypoint = path.normalize(fileName).replace(/\\/g, '/');
if (!entrypoint.match(/\.d\.ts$/)) {
throw new Error(`Source file "${fileName}" is not a declaration file`);