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
|
## 1.63.3
|
||||||
|
|
||||||
### JavaScript API
|
### JavaScript API
|
||||||
|
@ -76,15 +76,22 @@ class Stylesheet extends ParentStatement<List<Statement>> {
|
|||||||
/// Throws a [SassFormatException] if parsing fails.
|
/// Throws a [SassFormatException] if parsing fails.
|
||||||
factory Stylesheet.parse(String contents, Syntax syntax,
|
factory Stylesheet.parse(String contents, Syntax syntax,
|
||||||
{Object? url, Logger? logger}) {
|
{Object? url, Logger? logger}) {
|
||||||
switch (syntax) {
|
try {
|
||||||
case Syntax.sass:
|
switch (syntax) {
|
||||||
return Stylesheet.parseSass(contents, url: url, logger: logger);
|
case Syntax.sass:
|
||||||
case Syntax.scss:
|
return Stylesheet.parseSass(contents, url: url, logger: logger);
|
||||||
return Stylesheet.parseScss(contents, url: url, logger: logger);
|
case Syntax.scss:
|
||||||
case Syntax.css:
|
return Stylesheet.parseScss(contents, url: url, logger: logger);
|
||||||
return Stylesheet.parseCss(contents, url: url, logger: logger);
|
case Syntax.css:
|
||||||
default:
|
return Stylesheet.parseCss(contents, url: url, logger: logger);
|
||||||
throw ArgumentError("Unknown syntax $syntax.");
|
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
|
name: sass
|
||||||
version: 1.63.3
|
version: 1.63.4-dev
|
||||||
description: A Sass implementation in Dart.
|
description: A Sass implementation in Dart.
|
||||||
homepage: https://github.com/sass/dart-sass
|
homepage: https://github.com/sass/dart-sass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user