diff --git a/CHANGELOG.md b/CHANGELOG.md index ae92aca14..f908395f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.75.1 + +* Throw errors for misplaced statements in keyframe blocks. + ## 1.75.0 * Fix a bug in which stylesheet canonicalization could be cached incorrectly diff --git a/lib/src/visitor/async_evaluate.dart b/lib/src/visitor/async_evaluate.dart index ce4105bda..8343a9131 100644 --- a/lib/src/visitor/async_evaluate.dart +++ b/lib/src/visitor/async_evaluate.dart @@ -1324,6 +1324,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "At-rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "At-rules may not be used within keyframe blocks.", node.span); } var name = await _interpolationToValue(node.name); @@ -1895,6 +1898,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "Media rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "At-rules may not be used within keyframe blocks.", node.span); } var queries = await _visitMediaQueries(node.query); @@ -1985,6 +1991,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "Style rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "Style rules may not be used within keyframe blocks.", node.span); } var (selectorText, selectorMap) = @@ -2112,6 +2121,9 @@ final class _EvaluateVisitor throw _exception( "Supports rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "At-rules may not be used within keyframe blocks.", node.span); } var condition = CssValue( @@ -3270,6 +3282,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "At-rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "At-rules may not be used within keyframe blocks.", node.span); } if (node.isChildless) { @@ -3353,6 +3368,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "Media rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "At-rules may not be used within keyframe blocks.", node.span); } var mergedQueries = _mediaQueries.andThen( @@ -3401,6 +3419,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "Style rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "Style rules may not be used within keyframe blocks.", node.span); } var styleRule = _styleRule; diff --git a/lib/src/visitor/evaluate.dart b/lib/src/visitor/evaluate.dart index 32c4e2764..bbf334ad1 100644 --- a/lib/src/visitor/evaluate.dart +++ b/lib/src/visitor/evaluate.dart @@ -5,7 +5,7 @@ // DO NOT EDIT. This file was generated from async_evaluate.dart. // See tool/grind/synchronize.dart for details. // -// Checksum: 05cb957cd0c7698d8ad648f31d862dc91f0daa7b +// Checksum: 135bf44f65efcbebb4a55b38ada86c754fcdb86b // // ignore_for_file: unused_import @@ -1321,6 +1321,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "At-rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "At-rules may not be used within keyframe blocks.", node.span); } var name = _interpolationToValue(node.name); @@ -1887,6 +1890,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "Media rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "At-rules may not be used within keyframe blocks.", node.span); } var queries = _visitMediaQueries(node.query); @@ -1975,6 +1981,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "Style rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "Style rules may not be used within keyframe blocks.", node.span); } var (selectorText, selectorMap) = @@ -2102,6 +2111,9 @@ final class _EvaluateVisitor throw _exception( "Supports rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "At-rules may not be used within keyframe blocks.", node.span); } var condition = @@ -3240,6 +3252,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "At-rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "At-rules may not be used within keyframe blocks.", node.span); } if (node.isChildless) { @@ -3323,6 +3338,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "Media rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "At-rules may not be used within keyframe blocks.", node.span); } var mergedQueries = _mediaQueries.andThen( @@ -3369,6 +3387,9 @@ final class _EvaluateVisitor if (_declarationName != null) { throw _exception( "Style rules may not be used within nested declarations.", node.span); + } else if (_inKeyframes && _parent is CssKeyframeBlock) { + throw _exception( + "Style rules may not be used within keyframe blocks.", node.span); } var styleRule = _styleRule; diff --git a/pkg/sass_api/CHANGELOG.md b/pkg/sass_api/CHANGELOG.md index 77d3aaa74..028cd0796 100644 --- a/pkg/sass_api/CHANGELOG.md +++ b/pkg/sass_api/CHANGELOG.md @@ -1,3 +1,7 @@ +## 10.2.1 + +* No user-visible changes. + ## 10.2.0 * No user-visible changes. diff --git a/pkg/sass_api/pubspec.yaml b/pkg/sass_api/pubspec.yaml index ff9a9b383..5f7a9be18 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: 10.2.0 +version: 10.2.1-dev description: Additional APIs for Dart Sass. homepage: https://github.com/sass/dart-sass @@ -10,7 +10,7 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - sass: 1.75.0 + sass: 1.75.1 dev_dependencies: dartdoc: ^6.0.0 diff --git a/pubspec.yaml b/pubspec.yaml index 54602aa9a..c0f363e2b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.75.0 +version: 1.75.1-dev description: A Sass implementation in Dart. homepage: https://github.com/sass/dart-sass