mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-27 04:34:59 +01:00
Don't do a bunch of useless initial recanonicalization
This commit is contained in:
parent
a333059e71
commit
116165f76e
@ -43,7 +43,8 @@ Future<void> watch(ExecutableOptions options, StylesheetGraph graph) async {
|
|||||||
for (var source in options.sourcesToDestinations.keys) {
|
for (var source in options.sourcesToDestinations.keys) {
|
||||||
var destination = options.sourcesToDestinations[source];
|
var destination = options.sourcesToDestinations[source];
|
||||||
graph.addCanonical(FilesystemImporter('.'), p.toUri(p.canonicalize(source)),
|
graph.addCanonical(FilesystemImporter('.'), p.toUri(p.canonicalize(source)),
|
||||||
p.toUri(source));
|
p.toUri(source),
|
||||||
|
recanonicalize: false);
|
||||||
var success = await watcher.compile(source, destination, ifModified: true);
|
var success = await watcher.compile(source, destination, ifModified: true);
|
||||||
if (!success && options.stopOnError) {
|
if (!success && options.stopOnError) {
|
||||||
dirWatcher.events.listen(null).cancel();
|
dirWatcher.events.listen(null).cancel();
|
||||||
|
@ -86,8 +86,14 @@ class StylesheetGraph {
|
|||||||
/// Returns the set of nodes that need to be recompiled because their imports
|
/// Returns the set of nodes that need to be recompiled because their imports
|
||||||
/// changed as a result of this stylesheet being added. This does not include
|
/// changed as a result of this stylesheet being added. This does not include
|
||||||
/// the new stylesheet, which can be accessed via `nodes[canonicalUrl]`.
|
/// the new stylesheet, which can be accessed via `nodes[canonicalUrl]`.
|
||||||
|
///
|
||||||
|
/// If [recanonicalize] is `false`, this instead avoids checking downstream
|
||||||
|
/// nodes' imports and always returns an empty set. It should only be set to
|
||||||
|
/// `false` when initially adding stylesheets, not when handling future
|
||||||
|
/// updates.
|
||||||
Set<StylesheetNode> addCanonical(
|
Set<StylesheetNode> addCanonical(
|
||||||
Importer importer, Uri canonicalUrl, Uri originalUrl) {
|
Importer importer, Uri canonicalUrl, Uri originalUrl,
|
||||||
|
{bool recanonicalize = true}) {
|
||||||
var node = _nodes[canonicalUrl];
|
var node = _nodes[canonicalUrl];
|
||||||
if (node != null) return const {};
|
if (node != null) return const {};
|
||||||
|
|
||||||
@ -99,7 +105,9 @@ class StylesheetGraph {
|
|||||||
_upstreamNodes(stylesheet, importer, canonicalUrl));
|
_upstreamNodes(stylesheet, importer, canonicalUrl));
|
||||||
_nodes[canonicalUrl] = node;
|
_nodes[canonicalUrl] = node;
|
||||||
|
|
||||||
return _recanonicalizeImports(importer, canonicalUrl);
|
return recanonicalize
|
||||||
|
? _recanonicalizeImports(importer, canonicalUrl)
|
||||||
|
: const {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns two maps from non-canonicalized imported URLs in [stylesheet] to
|
/// Returns two maps from non-canonicalized imported URLs in [stylesheet] to
|
||||||
|
Loading…
Reference in New Issue
Block a user