1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | /// <amd-module name="@angular/compiler-cli/src/ngtsc/incremental/api" />
|
---|
9 | import * as ts from 'typescript';
|
---|
10 | import { AbsoluteFsPath } from '../file_system';
|
---|
11 | /**
|
---|
12 | * Interface of the incremental build engine.
|
---|
13 | *
|
---|
14 | * `AnalysisT` is a generic type representing a unit of work. This is generic to avoid a cyclic
|
---|
15 | * dependency between the incremental engine API definition and its consumer(s).
|
---|
16 | * `FileTypeCheckDataT` is a generic type representing template type-checking data for a particular
|
---|
17 | * input file, which is generic for the same reason.
|
---|
18 | */
|
---|
19 | export interface IncrementalBuild<AnalysisT, FileTypeCheckDataT> {
|
---|
20 | /**
|
---|
21 | * Retrieve the prior analysis work, if any, done for the given source file.
|
---|
22 | */
|
---|
23 | priorAnalysisFor(sf: ts.SourceFile): AnalysisT[] | null;
|
---|
24 | /**
|
---|
25 | * Retrieve the prior type-checking work, if any, that's been done for the given source file.
|
---|
26 | */
|
---|
27 | priorTypeCheckingResultsFor(fileSf: ts.SourceFile): FileTypeCheckDataT | null;
|
---|
28 | /**
|
---|
29 | * Reports that template type-checking has completed successfully, with a map of type-checking
|
---|
30 | * data for each user file which can be reused in a future incremental iteration.
|
---|
31 | */
|
---|
32 | recordSuccessfulTypeCheck(results: Map<AbsoluteFsPath, FileTypeCheckDataT>): void;
|
---|
33 | }
|
---|
34 | /**
|
---|
35 | * Tracks dependencies between source files or resources in the application.
|
---|
36 | */
|
---|
37 | export interface DependencyTracker<T extends {
|
---|
38 | fileName: string;
|
---|
39 | } = ts.SourceFile> {
|
---|
40 | /**
|
---|
41 | * Record that the file `from` depends on the file `on`.
|
---|
42 | */
|
---|
43 | addDependency(from: T, on: T): void;
|
---|
44 | /**
|
---|
45 | * Record that the file `from` depends on the resource file `on`.
|
---|
46 | */
|
---|
47 | addResourceDependency(from: T, on: AbsoluteFsPath): void;
|
---|
48 | /**
|
---|
49 | * Record that the given file contains unresolvable dependencies.
|
---|
50 | *
|
---|
51 | * In practice, this means that the dependency graph cannot provide insight into the effects of
|
---|
52 | * future changes on that file.
|
---|
53 | */
|
---|
54 | recordDependencyAnalysisFailure(file: T): void;
|
---|
55 | }
|
---|