mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-20 21:42:38 +08:00
refactor(@ngtools/webpack): expose TS TypeChecker from NG compiler plugin
Expose the TypeScript Program created by the plugin, so that it can be used in custom platform transformers.
This commit is contained in:
parent
f3e389bd8c
commit
311723d369
@ -174,6 +174,12 @@ export class AngularCompilerPlugin {
|
||||
return { path, className };
|
||||
}
|
||||
|
||||
get typeChecker(): ts.TypeChecker | null {
|
||||
const tsProgram = this._getTsProgram();
|
||||
|
||||
return tsProgram ? tsProgram.getTypeChecker() : null;
|
||||
}
|
||||
|
||||
static isSupported() {
|
||||
return VERSION && parseInt(VERSION.major) >= 5;
|
||||
}
|
||||
@ -351,7 +357,7 @@ export class AngularCompilerPlugin {
|
||||
this._updateForkedTypeChecker(this._rootNames, this._getChangedCompilationFiles());
|
||||
}
|
||||
|
||||
// Use an identity function as all our paths are absolute already.
|
||||
// Use an identity function as all our paths are absolute already.
|
||||
this._moduleResolutionCache = ts.createModuleResolutionCache(this._basePath, x => x);
|
||||
|
||||
if (this._JitMode) {
|
||||
@ -1020,7 +1026,7 @@ export class AngularCompilerPlugin {
|
||||
.map((resourcePath) => resolve(dirname(resolvedFileName), normalize(resourcePath)));
|
||||
|
||||
// These paths are meant to be used by the loader so we must denormalize them.
|
||||
const uniqueDependencies = new Set([
|
||||
const uniqueDependencies = new Set([
|
||||
...esImports,
|
||||
...resourceImports,
|
||||
...this.getResourceDependencies(this._compilerHost.denormalizePath(resolvedFileName)),
|
||||
|
Loading…
x
Reference in New Issue
Block a user