File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,12 @@ interface BroccoliTree {
5353 inputTree ?: BroccoliTree ;
5454 inputTrees ?: BroccoliTree [ ] ;
5555
56+ /**
57+ * Trees which implement the rebuild api are wrapped automatically for api compat,
58+ * and `newStyleTree` keeps a reference to the original unwrapped tree.
59+ */
60+ newStyleTree ?: BroccoliTree ;
61+
5662 /**
5763 * Description or name of the plugin used for reporting.
5864 *
Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ class DiffingPluginWrapper implements BroccoliTree {
6262 this . description = this . pluginClass . name ;
6363 }
6464
65-
6665 private calculateDiff ( firstRun : boolean ) : ( DiffResult | DiffResult [ ] ) {
6766 // TODO(caitp): optionally log trees based on environment variable or
6867 // command line option. It may be worth logging for trees where elapsed
@@ -146,6 +145,11 @@ class DiffingPluginWrapper implements BroccoliTree {
146145 // Ignore all DiffingPlugins as they are already stable, for others we don't know for sure
147146 // so we need to stabilize them.
148147 // Since it's not safe to use instanceof operator in node, we are checking the constructor.name.
149- return ( tree . constructor [ 'name' ] === 'DiffingPluginWrapper' ) ? tree : stabilizeTree ( tree ) ;
148+ //
149+ // New-styler/rebuild trees should always be stable.
150+ let isNewStyleTree = ! ! ( tree [ 'newStyleTree' ] || typeof tree . rebuild === 'function' ||
151+ tree [ 'isReadAPICompatTree' ] || tree . constructor [ 'name' ] === 'Funnel' ) ;
152+
153+ return isNewStyleTree ? tree : stabilizeTree ( tree ) ;
150154 }
151155}
You can’t perform that action at this time.
0 commit comments