feat(compiler-cli): add watch mode to ngc (#18818)

With this change ngc now accepts a `-w` or a `--watch`
command-line option that will automatically perform a
recompile whenever any source files change on disk.

PR Close #18818
This commit is contained in:
Chuck Jazdzewski
2017-08-18 14:03:59 -07:00
committed by Jason Aden
parent 0e64261f26
commit cf7d47dda0
18 changed files with 539 additions and 54 deletions

View File

@ -250,6 +250,24 @@ export class StaticSymbolResolver {
return this.staticSymbolCache.get(declarationFile, name, members);
}
/**
* hasDecorators checks a file's metadata for the presense of decorators without evalutating the
* metada.
*
* @param filePath the absolute path to examine for decorators.
* @returns true if any class in the file has a decorator.
*/
hasDecorators(filePath: string): boolean {
const metadata = this.getModuleMetadata(filePath);
if (metadata['metadata']) {
return Object.keys(metadata['metadata']).some((metadataKey) => {
const entry = metadata['metadata'][metadataKey];
return entry && entry.__symbolic === 'class' && entry.decorators;
});
}
return false;
}
getSymbolsOf(filePath: string): StaticSymbol[] {
// Note: Some users use libraries that were not compiled with ngc, i.e. they don't
// have summaries, only .d.ts files. So we always need to check both, the summary