mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-30 04:39:03 +01:00
Add current stylesheet to loadedUrls when throwing parsing error (#1991)
Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
This commit is contained in:
parent
645e48fd5d
commit
760fa2ead1
@ -1,3 +1,10 @@
|
||||
## 1.63.4
|
||||
|
||||
### Embedded Sass
|
||||
|
||||
* Properly include the root stylesheet's URL in the set of loaded URLs when it
|
||||
fails to parse.
|
||||
|
||||
## 1.63.3
|
||||
|
||||
### JavaScript API
|
||||
|
@ -76,15 +76,22 @@ class Stylesheet extends ParentStatement<List<Statement>> {
|
||||
/// Throws a [SassFormatException] if parsing fails.
|
||||
factory Stylesheet.parse(String contents, Syntax syntax,
|
||||
{Object? url, Logger? logger}) {
|
||||
switch (syntax) {
|
||||
case Syntax.sass:
|
||||
return Stylesheet.parseSass(contents, url: url, logger: logger);
|
||||
case Syntax.scss:
|
||||
return Stylesheet.parseScss(contents, url: url, logger: logger);
|
||||
case Syntax.css:
|
||||
return Stylesheet.parseCss(contents, url: url, logger: logger);
|
||||
default:
|
||||
throw ArgumentError("Unknown syntax $syntax.");
|
||||
try {
|
||||
switch (syntax) {
|
||||
case Syntax.sass:
|
||||
return Stylesheet.parseSass(contents, url: url, logger: logger);
|
||||
case Syntax.scss:
|
||||
return Stylesheet.parseScss(contents, url: url, logger: logger);
|
||||
case Syntax.css:
|
||||
return Stylesheet.parseCss(contents, url: url, logger: logger);
|
||||
default:
|
||||
throw ArgumentError("Unknown syntax $syntax.");
|
||||
}
|
||||
} on SassException catch (error) {
|
||||
var url = error.span.sourceUrl;
|
||||
if (url == null || url.toString() == 'stdin') rethrow;
|
||||
|
||||
throw error.withLoadedUrls(Set.unmodifiable({url}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: sass
|
||||
version: 1.63.3
|
||||
version: 1.63.4-dev
|
||||
description: A Sass implementation in Dart.
|
||||
homepage: https://github.com/sass/dart-sass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user