feat(compiler): read and write .ngsummary.json files

When compiling libraries, this feature extracts the minimal information
from the directives/pipes/modules of the library into `.ngsummary.json` files,
so that applications that use this library only need to be recompiled
if one of the summary files change, but not on every change
of the libraries (e.g. one of the templates).

Only works if individual codegen for libraries is enabled,
see the `generateCodeForLibraries: false` option.

Closes #12787
This commit is contained in:
Tobias Bosch
2016-11-29 15:36:33 -08:00
committed by Alex Rickabaugh
parent 9ab401f4d3
commit 614a35d539
23 changed files with 500 additions and 126 deletions

View File

@ -123,6 +123,8 @@ export interface CompileSummary {
isSummary: boolean /* TODO: `true` when we drop TS 1.8 support */;
}
export interface CompileTypeSummary extends CompileSummary { type: CompileTypeMetadata; }
export interface CompileDiDependencyMetadata {
isAttribute?: boolean;
isSelf?: boolean;
@ -262,7 +264,7 @@ export class CompileTemplateMetadata {
// Note: This should only use interfaces as nested data types
// as we need to be able to serialize this from/to JSON!
export interface CompileDirectiveSummary extends CompileSummary {
export interface CompileDirectiveSummary extends CompileTypeSummary {
isSummary: boolean /* TODO: `true` when we drop TS 1.8 support */;
type: CompileTypeMetadata;
isComponent: boolean;
@ -470,7 +472,7 @@ export function createHostComponentMeta(
});
}
export interface CompilePipeSummary extends CompileSummary {
export interface CompilePipeSummary extends CompileTypeSummary {
isSummary: boolean /* TODO: `true` when we drop TS 1.8 support */;
type: CompileTypeMetadata;
name: string;
@ -499,7 +501,7 @@ export class CompilePipeMetadata {
// Note: This should only use interfaces as nested data types
// as we need to be able to serialize this from/to JSON!
export interface CompileNgModuleSummary {
export interface CompileNgModuleSummary extends CompileTypeSummary {
isSummary: boolean /* TODO: `true` when we drop TS 1.8 support */;
type: CompileTypeMetadata;
@ -510,9 +512,9 @@ export interface CompileNgModuleSummary {
// Note: This is transitive.
entryComponents: CompileIdentifierMetadata[];
// Note: This is transitive.
providers: {provider: CompileProviderMetadata, module: CompileIdentifierMetadata}[],
// Note: This is transitive.
modules: CompileTypeMetadata[];
providers: {provider: CompileProviderMetadata, module: CompileIdentifierMetadata}[];
// Note: This is transitive.
modules: CompileTypeMetadata[];
}
/**