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
fix(ivy): ngtsc is unable to detect flat module entry-point on windows #29453
Conversation
devversion
commented
Mar 21, 2019
- See individual commits
dbc3613
to
837064a
Compare
837064a
to
5a21d0b
Compare
Currently when building an Angular project with `ngtsc` and `flatModuleOutFile` enabled, the Ngtsc build will fail if there are multiple source files as root file names. Ngtsc and NGC currently determine the entry-point for multiple root file names by looking for files ending with `/index.ts`. This functionality is technically deprecated, but still supported and currently breaks on Windows as the root file names are not guaranteed to be normalized POSIX-like paths. In order to make this logic more reliable in the future, this commit also switches the shim generators and entry-point logic to the branded path types. This ensures that we don't break this in the future.
5a21d0b
to
475f08e
Compare
Caretaker note: Please merge assistance because |
#29453) Currently when building an Angular project with `ngtsc` and `flatModuleOutFile` enabled, the Ngtsc build will fail if there are multiple source files as root file names. Ngtsc and NGC currently determine the entry-point for multiple root file names by looking for files ending with `/index.ts`. This functionality is technically deprecated, but still supported and currently breaks on Windows as the root file names are not guaranteed to be normalized POSIX-like paths. In order to make this logic more reliable in the future, this commit also switches the shim generators and entry-point logic to the branded path types. This ensures that we don't break this in the future. PR Close #29453
angular#29453) Currently when building an Angular project with `ngtsc` and `flatModuleOutFile` enabled, the Ngtsc build will fail if there are multiple source files as root file names. Ngtsc and NGC currently determine the entry-point for multiple root file names by looking for files ending with `/index.ts`. This functionality is technically deprecated, but still supported and currently breaks on Windows as the root file names are not guaranteed to be normalized POSIX-like paths. In order to make this logic more reliable in the future, this commit also switches the shim generators and entry-point logic to the branded path types. This ensures that we don't break this in the future. PR Close angular#29453
@@ -60,14 +61,16 @@ export class GeneratedShimsHostWrapper implements ts.CompilerHost { | |||
shouldCreateNewSourceFile?: boolean|undefined): ts.SourceFile|undefined { | |||
for (let i = 0; i < this.shimGenerators.length; i++) { | |||
const generator = this.shimGenerators[i]; | |||
if (generator.recognize(fileName)) { | |||
// TypeScript internal paths are guaranteed to be POSIX-like absolute file paths. | |||
const absoluteFsPath = AbsoluteFsPath.fromUnchecked(fileName); |
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.
It turns out (at least in tests) that it is not true that fileName
is always absolute. Changing this to AbsoluteFsPath.from()
causes lots of test failures such as:
193) compiler compliance: listen() should create declare inputs/outputs
Message:
Error: Internal Error: AbsoluteFsPath.from(lib.d.ts): path is not absolute
Stack:
Error: Internal Error: AbsoluteFsPath.from(lib.d.ts): path is not absolute
at Object.from (packages/compiler-cli/src/ngtsc/path/src/types.ts:59:13)
at GeneratedShimsHostWrapper.getSourceFile (packages/compiler-cli/src/ngtsc/shims/src/host.ts:76:45)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |