-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathbroccoli.d.ts
173 lines (135 loc) · 4.25 KB
/
broccoli.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/// <reference path="../../.d.ts" />
interface BroccoliTree {
/**
* Contains the fs path for the input tree when the plugin takes only one input tree.
*
* For plugins that take multiple trees see the `inputPaths` property.
*
* This property is set just before the first rebuild and doesn't change afterwards.
*/
inputPath: string;
/**
* Contains the array of fs paths for input trees.
*
* For plugins that take only one input tree, it might be more convenient to use the `inputPath`
*property instead.
*
* This property is set just before the first rebuild and doesn't change afterwards.
*
* If the inputPath is outside of broccoli's temp directory, then it's lifetime is not managed by
*the builder.
* If the inputPath is within broccoli's temp directory it is an outputPath (and output directory)
*of another plugin.
* This means that while the `outputPath` doesn't change, the underlying directory is frequently
*recreated.
*/
inputPaths?: string[];
/**
* Contains the fs paths for the output trees.
*
* This property is set just before the first rebuild and doesn't change afterwards.
*
* The underlying directory is also created by the builder just before the first rebuild.
* This directory is destroyed and recreated upon each rebuild.
*/
outputPath?: string;
/**
* Contains the fs paths for a cache directory available to the plugin.
*
* This property is set just before the first rebuild and doesn't change afterwards.
*
* The underlying directory is also created by the builder just before the first rebuild.
* The lifetime of the directory is associated with the lifetime of the plugin.
*/
cachePath?: string;
inputTree?: BroccoliTree;
inputTrees?: BroccoliTree[];
/**
* Description or name of the plugin used for reporting.
*
* If missing `tree.constructor.name` is usually used instead.
*/
description?: string;
rebuild(): any;
cleanup(): void;
}
interface OldBroccoliTree {
read?(readTree: (tree: BroccoliTree) => any): any;
}
interface BroccoliBuilder {
/**
* Triggers a build and returns a promise for the build result
*/
build(): IFuture<BuildResult>;
/**
* Cleans up the whole build tree by calling `.cleanup()` method on all trees that are part of the
* pipeline.
*/
cleanup(): IFuture<any>;
}
interface BuildResult {
/**
* Directory that contains result of the build.
*
* This directory will contains symlinks, so it is not safe to just use it as is.
*
* Use `copy-dereference` npm package to create a safe-to-use replica of the build artifacts.
*/
directory: string;
/**
* The DAG (graph) of all trees in the build pipeline.
*/
graph: BroccoliNode;
/**
* Total time it took to make the build.
*/
totalTime: number;
}
interface BroccoliNode {
///**
// * Id of the current node
// */
// id: number; //only in master
/**
* Time spent processing the current node during a single rebuild.
*/
selfTime: number;
/**
* Time spent processing the current node and its subtrees during a single rebuild.
*/
totalTime: number;
/**
* Tree associated with the current node.
*/
tree: BroccoliTree;
/**
* Child nodes with references to trees that are input for the tree of the current node.
*/
subtrees: BroccoliNode[];
/**
* Parent nodes with references to trees that are consume the output of processing the current
* tree.
*/
parents: BroccoliNode[];
/**
* Path to the directory containing the output of processing the current tree.
*/
directory: string;
}
interface IBroccoliBuilder {
getChangedNodeModules(outputPath: string, platform: string, lastModifiedTime?: Date): IFuture<any>;
prepareNodeModules(outputPath: string, platform: string, lastModifiedTime?: Date): IFuture<void>;
cleanNodeModules(outputPath: string, platform: string): void;
}
interface IDiffResult {
changedDirectories: string[];
removedDirectories: string[];
}
interface IBroccoliPlugin {
rebuild(diff: IDiffResult): any;
rebuildChangedDirectories?(changedDirectories: string[], platform: string): void;
cleanup? () : void;
}
interface INodeModulesTree {
makeNodeModulesTree(absoluteOutputPath: string, projectDir: string): any;
}