Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quiet deps when loaded through an @import of a file without @use #1362

Merged
merged 1 commit into from Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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