Skip to content

Commit 777708c

Browse files
authored
Include deprecation IDs in deprecation messages (#2475)
1 parent f5c385d commit 777708c

File tree

8 files changed

+29
-9
lines changed

8 files changed

+29
-9
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.83.1-dev
2+
3+
* Include deprecation IDs in deprecation warnings to make it easier to determine
4+
what to pass to `--silence-deprecation` or `--fatal-deprecation`.
5+
16
## 1.83.0
27

38
* Allow trailing commas in *all* argument and parameter lists.

lib/src/logger.dart

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ abstract class Logger {
4949
/// [warn].
5050
@internal
5151
abstract class LoggerWithDeprecationType implements Logger {
52+
const LoggerWithDeprecationType();
53+
5254
/// This forwards all calls to [internalWarn].
5355
///
5456
/// For non-user deprecation warnings, the [warnForDeprecation] extension

lib/src/logger/stderr.dart

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,33 @@ import 'package:path/path.dart' as p;
66
import 'package:source_span/source_span.dart';
77
import 'package:stack_trace/stack_trace.dart';
88

9+
import '../deprecation.dart';
910
import '../io.dart';
1011
import '../logger.dart';
1112
import '../utils.dart';
1213

1314
/// A logger that prints warnings to standard error or browser console.
14-
final class StderrLogger implements Logger {
15+
final class StderrLogger extends LoggerWithDeprecationType {
1516
/// Whether to use terminal colors in messages.
1617
final bool color;
1718

1819
const StderrLogger({this.color = false});
1920

20-
void warn(String message,
21-
{FileSpan? span, Trace? trace, bool deprecation = false}) {
21+
void internalWarn(String message,
22+
{FileSpan? span, Trace? trace, Deprecation? deprecation}) {
2223
var result = StringBuffer();
2324
if (color) {
2425
// Bold yellow.
2526
result.write('\u001b[33m\u001b[1m');
26-
if (deprecation) result.write('Deprecation ');
27+
if (deprecation != null) result.write('Deprecation ');
2728
result.write('Warning\u001b[0m');
29+
if (deprecation != null) {
30+
result.write(' [\u001b[34m$deprecation\u001b[0m]');
31+
}
2832
} else {
29-
if (deprecation) result.write('DEPRECATION ');
33+
if (deprecation != null) result.write('DEPRECATION ');
3034
result.write('WARNING');
35+
if (deprecation != null) result.write(' [$deprecation]');
3136
}
3237

3338
if (span == null) {

pkg/sass-parser/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.9-dev
2+
3+
* No user-visible changes.
4+
15
## 0.4.8
26

37
Add support for parsing the `@include` rule.

pkg/sass-parser/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sass-parser",
3-
"version": "0.4.8",
3+
"version": "0.4.9-dev",
44
"description": "A PostCSS-compatible wrapper of the official Sass parser",
55
"repository": "sass/sass",
66
"author": "Google Inc.",

pkg/sass_api/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 15.0.1-dev
2+
3+
* No user-visible changes.
4+
15
## 15.0.0
26

37
* Rename `ArgumentInvocation` to `ArgumentList`, `ArgumentDeclaration` to

pkg/sass_api/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 15.0.0
5+
version: 15.0.1-dev
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: ">=3.3.0 <4.0.0"
1111

1212
dependencies:
13-
sass: 1.83.0
13+
sass: 1.83.1
1414

1515
dev_dependencies:
1616
dartdoc: ^8.0.14

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.83.0
2+
version: 1.83.1-dev
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

0 commit comments

Comments
 (0)