fix(compiler-cli): only pass canonical genfile paths to compiler host (#27062)
In a more specific scenario: Considering people use a custom TypeScript compiler host with `NGC`, they _could_ expect only posix paths in methods like `writeFile`. This at first glance sounds like a trivial issue that should be just fixed by the actual compiler host, but usually TypeScript internal API's just pass around posix normalized paths, and therefore it would be good to follow the same standards when passing JSON genfiles to the `CompilerHost`. For normal TypeScript files (and TS genfiles), this is already consistent because those will be handled by the actual TypeScript `Program` (see `emitCallback`). PR Close #27062
This commit is contained in:

committed by
Andrew Kushnir

parent
6b1780d77e
commit
0ada23a5fb
@ -604,13 +604,13 @@ describe('ng program', () => {
|
||||
it('should work on windows with normalized paths', () => {
|
||||
const mapper =
|
||||
createSrcToOutPathMapper('c:/tmp/out', 'c:/tmp/a/x.ts', 'c:/tmp/out/a/x.js', path.win32);
|
||||
expect(mapper('c:/tmp/b/y.js')).toBe('c:\\tmp\\out\\b\\y.js');
|
||||
expect(mapper('c:/tmp/b/y.js')).toBe('c:/tmp/out/b/y.js');
|
||||
});
|
||||
|
||||
it('should work on windows with non-normalized paths', () => {
|
||||
const mapper = createSrcToOutPathMapper(
|
||||
'c:\\tmp\\out', 'c:\\tmp\\a\\x.ts', 'c:\\tmp\\out\\a\\x.js', path.win32);
|
||||
expect(mapper('c:\\tmp\\b\\y.js')).toBe('c:\\tmp\\out\\b\\y.js');
|
||||
expect(mapper('c:\\tmp\\b\\y.js')).toBe('c:/tmp/out/b/y.js');
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user