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