@@ -86,8 +86,14 @@ class StylesheetGraph {
8686 /// Returns the set of nodes that need to be recompiled because their imports
8787 /// changed as a result of this stylesheet being added. This does not include
8888 /// the new stylesheet, which can be accessed via `nodes[canonicalUrl]` .
89+ ///
90+ /// If [recanonicalize] is `false` , this instead avoids checking downstream
91+ /// nodes' imports and always returns an empty set. It should only be set to
92+ /// `false` when initially adding stylesheets, not when handling future
93+ /// updates.
8994 Set <StylesheetNode > addCanonical (
90- Importer importer, Uri canonicalUrl, Uri originalUrl) {
95+ Importer importer, Uri canonicalUrl, Uri originalUrl,
96+ {bool recanonicalize = true }) {
9197 var node = _nodes[canonicalUrl];
9298 if (node != null ) return const {};
9399
@@ -99,7 +105,9 @@ class StylesheetGraph {
99105 _upstreamNodes (stylesheet, importer, canonicalUrl));
100106 _nodes[canonicalUrl] = node;
101107
102- return _recanonicalizeImports (importer, canonicalUrl);
108+ return recanonicalize
109+ ? _recanonicalizeImports (importer, canonicalUrl)
110+ : const {};
103111 }
104112
105113 /// Returns two maps from non-canonicalized imported URLs in [stylesheet] to
0 commit comments