Skip to content

Commit

Permalink
Fix quiet deps when loaded through an @import of a file without @use (#…
Browse files Browse the repository at this point in the history
…1362)

Closes #1360
  • Loading branch information
nex3 committed Jun 15, 2021
1 parent 7e37166 commit 0f68d7a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
## 1.35.1

* Fix a bug where the quiet dependency flag didn't silence warnings in some
stylesheets loaded using `@import`.

## 1.35.0

* Fix a couple bugs that could prevent some members from being found in certain
Expand Down
3 changes: 3 additions & 0 deletions lib/src/visitor/async_evaluate.dart
Expand Up @@ -1480,11 +1480,14 @@ class _EvaluateVisitor
if (stylesheet.uses.isEmpty && stylesheet.forwards.isEmpty) {
var oldImporter = _importer;
var oldStylesheet = _stylesheet;
var oldInDependency = _inDependency;
_importer = result.importer;
_stylesheet = stylesheet;
_inDependency = result.isDependency;
await visitStylesheet(stylesheet);
_importer = oldImporter;
_stylesheet = oldStylesheet;
_inDependency = oldInDependency;
_activeModules.remove(url);
return;
}
Expand Down
5 changes: 4 additions & 1 deletion lib/src/visitor/evaluate.dart
Expand Up @@ -5,7 +5,7 @@
// DO NOT EDIT. This file was generated from async_evaluate.dart.
// See tool/grind/synchronize.dart for details.
//
// Checksum: 203ba98fd9ca92ccc0b6465fd0d617e88c8dd37e
// Checksum: 1249b1184a46950409776772cb1c6003b80ebb31
//
// ignore_for_file: unused_import

Expand Down Expand Up @@ -1479,11 +1479,14 @@ class _EvaluateVisitor
if (stylesheet.uses.isEmpty && stylesheet.forwards.isEmpty) {
var oldImporter = _importer;
var oldStylesheet = _stylesheet;
var oldInDependency = _inDependency;
_importer = result.importer;
_stylesheet = stylesheet;
_inDependency = result.isDependency;
visitStylesheet(stylesheet);
_importer = oldImporter;
_stylesheet = oldStylesheet;
_inDependency = oldInDependency;
_activeModules.remove(url);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,5 +1,5 @@
name: sass
version: 1.35.0
version: 1.35.1
description: A Sass implementation in Dart.
author: Sass Team
homepage: https://github.com/sass/dart-sass
Expand Down
25 changes: 25 additions & 0 deletions test/cli/shared.dart
Expand Up @@ -481,6 +481,31 @@ void sharedTests(
await sass.shouldExit(0);
});
});

group("silences warnings through @import", () {
test("of a file without @use", () async {
await d.file("test.scss", "@import 'other'").create();
await d.dir("dir", [d.file("_other.scss", "#{blue} {x: y}")]).create();

var sass = await runSass(["--quiet-deps", "-I", "dir", "test.scss"]);
expect(sass.stderr, emitsDone);
await sass.shouldExit(0);
});

test("of a file with @use", () async {
await d.file("test.scss", "@import 'other'").create();
await d.dir("dir", [
d.file("_other.scss", """
@use 'sass:color';
#{blue} {x: y}
""")
]).create();

var sass = await runSass(["--quiet-deps", "-I", "dir", "test.scss"]);
expect(sass.stderr, emitsDone);
await sass.shouldExit(0);
});
});
});

group("with a bunch of deprecation warnings", () {
Expand Down

0 comments on commit 0f68d7a

Please sign in to comment.