From 6d42435d45e35e82657b5e711e1b6d3168a07e90 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 5 Dec 2023 14:45:49 -0800 Subject: [PATCH] Make LazyFileSpans work in JavaScript Closes #1952 --- CHANGELOG.md | 7 +++++++ lib/src/js/source_span.dart | 4 +++- pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ff3e06fb..77f7bf3ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.69.6 + +### JS API + +* Fix a bug where certain exceptions could produce `SourceSpan`s that didn't + follow the documented `SourceSpan` API. + ## 1.69.5 ### JS API diff --git a/lib/src/js/source_span.dart b/lib/src/js/source_span.dart index 998db03ad..057aec500 100644 --- a/lib/src/js/source_span.dart +++ b/lib/src/js/source_span.dart @@ -4,6 +4,7 @@ import 'package:source_span/source_span.dart'; +import '../util/lazy_file_span.dart'; import '../util/multi_span.dart'; import '../util/nullable.dart'; import 'reflection.dart'; @@ -14,8 +15,9 @@ import 'utils.dart'; void updateSourceSpanPrototype() { var span = SourceFile.fromString('').span(0); var multiSpan = MultiSpan(span, '', {}); + var lazySpan = LazyFileSpan(() => span); - for (var item in [span, multiSpan]) { + for (var item in [span, multiSpan, lazySpan]) { getJSClass(item).defineGetters({ 'start': (FileSpan span) => span.start, 'end': (FileSpan span) => span.end, diff --git a/pubspec.yaml b/pubspec.yaml index 9e28af5df..6f666281e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.69.5 +version: 1.69.6-dev description: A Sass implementation in Dart. homepage: https://github.com/sass/dart-sass