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 bug in JS MultiSpan #1801

Merged
merged 2 commits into from Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,10 @@
## 1.55.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.55.0 hasn't been released yet

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I release this as 1.55.0 then, or should I make it a -dev version while we wait for more changes?


### JS API

* Fix a bug in which certain warning spans would not have their properties
accessible by the JS API.

## 1.55.0

### Dart API
Expand Down
18 changes: 11 additions & 7 deletions lib/src/node/source_span.dart
Expand Up @@ -4,6 +4,7 @@

import 'package:source_span/source_span.dart';

import '../util/multi_span.dart';
import '../util/nullable.dart';
import 'reflection.dart';
import 'utils.dart';
Expand All @@ -12,14 +13,17 @@ import 'utils.dart';
/// that they match the JS API.
void updateSourceSpanPrototype() {
var span = SourceFile.fromString('').span(0);
var multiSpan = MultiSpan(span, '', {});

getJSClass(span).defineGetters({
'start': (FileSpan span) => span.start,
'end': (FileSpan span) => span.end,
'url': (FileSpan span) => span.sourceUrl.andThen(dartToJSUrl),
'text': (FileSpan span) => span.text,
'context': (FileSpan span) => span.context,
});
for (var item in [span, multiSpan]) {
getJSClass(item).defineGetters({
'start': (FileSpan span) => span.start,
'end': (FileSpan span) => span.end,
'url': (FileSpan span) => span.sourceUrl.andThen(dartToJSUrl),
'text': (FileSpan span) => span.text,
'context': (FileSpan span) => span.context,
});
}

// Offset is already accessible from JS because it's defined as a field rather
// than a getter.
Expand Down
4 changes: 4 additions & 0 deletions pkg/sass_api/CHANGELOG.md
@@ -1,3 +1,7 @@
## 3.1.1

* No user-visible changes.

## 3.1.0

### Dart API
Expand Down
4 changes: 2 additions & 2 deletions pkg/sass_api/pubspec.yaml
Expand Up @@ -2,15 +2,15 @@ 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: 3.1.0
version: 3.1.1
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass

environment:
sdk: ">=2.17.0 <3.0.0"

dependencies:
sass: 1.55.0
sass: 1.55.1

dev_dependencies:
dartdoc: ^5.0.0
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,5 +1,5 @@
name: sass
version: 1.55.0
version: 1.55.1
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down