From a0fa90f425dda9c1a746db7a313dc79a3293e5ed Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 4 Jan 2022 14:32:53 -0800 Subject: [PATCH] Pass undefined span instead of null to Logger.warn() in JS --- CHANGELOG.md | 7 +++++++ lib/src/logger/node_to_dart.dart | 5 ++++- pkg/sass_api/CHANGELOG.md | 4 ++++ pkg/sass_api/pubspec.yaml | 4 ++-- pubspec.yaml | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dd056929..7ab247d4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.45.3 + +### JS API + +* **Potentially breaking bug fix:** Match the specification of the new JS API by + passing `undefined` rather than `null` to `Logger.warn()` for an unset `span`. + ## 1.45.2 ### JS API diff --git a/lib/src/logger/node_to_dart.dart b/lib/src/logger/node_to_dart.dart index 93a0a4b3e..bb16798fc 100644 --- a/lib/src/logger/node_to_dart.dart +++ b/lib/src/logger/node_to_dart.dart @@ -2,6 +2,7 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. +import 'package:node_interop/js.dart'; import 'package:source_span/source_span.dart'; import 'package:stack_trace/stack_trace.dart'; import 'package:term_glyph/term_glyph.dart' as glyph; @@ -38,7 +39,9 @@ class NodeToDartLogger implements Logger { warn( message, WarnOptions( - span: span, stack: trace.toString(), deprecation: deprecation)); + span: span ?? (undefined as SourceSpan?), + stack: trace.toString(), + deprecation: deprecation)); } } diff --git a/pkg/sass_api/CHANGELOG.md b/pkg/sass_api/CHANGELOG.md index 99f1c8924..5db1595ac 100644 --- a/pkg/sass_api/CHANGELOG.md +++ b/pkg/sass_api/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.0-beta.26 + +* No user-visible changes. + ## 1.0.0-beta.25 * No user-visible changes. diff --git a/pkg/sass_api/pubspec.yaml b/pkg/sass_api/pubspec.yaml index 698bc2c0e..fc49ecb1f 100644 --- a/pkg/sass_api/pubspec.yaml +++ b/pkg/sass_api/pubspec.yaml @@ -2,7 +2,7 @@ name: sass_api # Note: Every time we add a new Sass AST node, we need to bump the *major* # version because it's a breaking change for anyone who's implementing the # visitor interface(s). -version: 1.0.0-beta.25 +version: 1.0.0-beta.26 description: Additional APIs for Dart Sass. homepage: https://github.com/sass/dart-sass @@ -10,7 +10,7 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: - sass: 1.45.2 + sass: 1.45.3 dependency_overrides: sass: {path: ../..} diff --git a/pubspec.yaml b/pubspec.yaml index 2bd409d5d..96a16cc63 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.45.2 +version: 1.45.3 description: A Sass implementation in Dart. homepage: https://github.com/sass/dart-sass