mgechev / ngast

Parser for Angular projects.

Home Page:https://mgechev.github.io/ngast/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Modules are not detected when using tsconfig#files with main.ts

alexrashed opened this issue · comments

With Angular 9 the default method of including files in the tsconfig.json is to define the entrypoints using the files section (angular/angular-cli#15030).
Therefore angular-cli now creates a main.ts and references it in tsconfig#files.
The main.ts does not directly declare the AppModule but only references it.

ngast however expects the module to be in the Typescript program's root filenames:

this.program.getRootFileNames() as string[],

It should use the Typescript program's source files, as it's used in the Angular project itself:
https://github.com/angular/angular/blob/e9de28111dbdede31181547c8686683203030ca0/packages/language-service/src/typescript_host.ts#L163

Therefore ngast does not detect any modules anymore for a project created with angular-cli.

Hey @alexrashed, thanks for the issue and the PR! Unfortunately, with v9 I'll deprecate this library because it is using legacy compiler APIs that will no longer be available in the future.

I'll merge your change and release later today.

That's a pity, sorry to hear that.
Out of curiosity (and in order to plan the replacement of this library), what legacy compiler APIs that are used in ngast are no longer going to be available? If I'm correct, there's no single internal import (ɵ.*) nor is there any import of deprecated classes or functions.

@angular/compiler is an experimental package in general. All the View Engine APIs used from there will be no longer available.