fix(ivy): correct ngtsc path handling in Windows (#26703)
As it turns out, the usage of path.posix does not unify path handling across operating systems. Instead, canonical-path is used to ensure path handling is consistent, avoiding incorrect paths in Windows. See https://github.com/angular/angular/pull/25862#discussion_r216157914 PR Close #26703
This commit is contained in:
@ -5,13 +5,13 @@ load("//tools:defaults.bzl", "ts_library")
|
||||
ts_library(
|
||||
name = "util",
|
||||
srcs = glob([
|
||||
"index.ts",
|
||||
"src/**/*.ts",
|
||||
]),
|
||||
module_name = "@angular/compiler-cli/src/ngtsc/util",
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"@ngdeps//@types/node",
|
||||
"@ngdeps//canonical-path",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -8,12 +8,12 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as path from 'path';
|
||||
import * as path from 'canonical-path';
|
||||
|
||||
const TS_DTS_EXTENSION = /(\.d)?\.ts$/;
|
||||
|
||||
export function relativePathBetween(from: string, to: string): string|null {
|
||||
let relative = path.posix.relative(path.dirname(from), to).replace(TS_DTS_EXTENSION, '');
|
||||
let relative = path.relative(path.dirname(from), to).replace(TS_DTS_EXTENSION, '');
|
||||
|
||||
if (relative === '') {
|
||||
return null;
|
||||
@ -25,4 +25,4 @@ export function relativePathBetween(from: string, to: string): string|null {
|
||||
}
|
||||
|
||||
return relative;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user