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:
parent
bde4402675
commit
fa70a2a650
@ -42,7 +42,9 @@ export function publicApi(fileName: string, options: SerializationOptions = {}):
|
|||||||
export function publicApiInternal(
|
export function publicApiInternal(
|
||||||
host: ts.CompilerHost, fileName: string, tsOptions: ts.CompilerOptions,
|
host: ts.CompilerHost, fileName: string, tsOptions: ts.CompilerOptions,
|
||||||
options: SerializationOptions = {}): string {
|
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$/)) {
|
if (!entrypoint.match(/\.d\.ts$/)) {
|
||||||
throw new Error(`Source file "${fileName}" is not a declaration file`);
|
throw new Error(`Source file "${fileName}" is not a declaration file`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user