Skip to content

Commit c3f8ff0

Browse files
authored
Always convert printed objects to strings in JS (#2741)
This makes browsers match the behavior in Dart and Node, and specifically fixes a bug where warnings were emitted as `StringBuffer` objects rather than console messages.
1 parent 7c4f384 commit c3f8ff0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
* Fix a crash when manually constructing a `SassCalculation` for `'calc'` with
66
an argument that can't be simplified.
77

8+
* Properly emit deprecation warnings as text rather than `StringBuffer` objects
9+
when running in a browser.
10+
811
## 1.97.3
912

1013
* Fix a bug where nesting an at-rule within multiple style rules in plain CSS

lib/src/io/js.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ void safePrint(Object? message) {
3939
if (_process case var process?) {
4040
process.stdout.write("${message ?? ''}\n");
4141
} else {
42-
console.log(message ?? '');
42+
console.log(message?.toString() ?? '');
4343
}
4444
}
4545

4646
void printError(Object? message) {
4747
if (_process case var process?) {
4848
process.stderr.write("${message ?? ''}\n");
4949
} else {
50-
console.error(message ?? '');
50+
console.error(message?.toString() ?? '');
5151
}
5252
}
5353

0 commit comments

Comments
 (0)