diff --git a/CHANGELOG.md b/CHANGELOG.md index 447cb7580..2e3693fdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ -## 1.88.0-dev +## 1.88.0 + +* Allow custom properties with empty values (such as `--var:;`). * Fix a bug when calculating source spans for interpolations. diff --git a/lib/src/parse/stylesheet.dart b/lib/src/parse/stylesheet.dart index ae02a7598..17fdd99e5 100644 --- a/lib/src/parse/stylesheet.dart +++ b/lib/src/parse/stylesheet.dart @@ -412,7 +412,9 @@ abstract class StylesheetParser extends Parser { var name = nameBuffer.interpolation(scanner.spanFrom(start, beforeColon)); if (name.initialPlain.startsWith('--')) { var value = StringExpression( - _interpolatedDeclarationValue(silentComments: false), + atEndOfStatement() + ? Interpolation(const [], const [], scanner.emptySpan) + : _interpolatedDeclarationValue(silentComments: false), ); expectStatementSeparator("custom property"); return Declaration(name, value, scanner.spanFrom(start)); diff --git a/lib/src/visitor/async_evaluate.dart b/lib/src/visitor/async_evaluate.dart index 617ffc712..c1db0e72e 100644 --- a/lib/src/visitor/async_evaluate.dart +++ b/lib/src/visitor/async_evaluate.dart @@ -1381,9 +1381,12 @@ final class _EvaluateVisitor if (node.value case var expression?) { var value = await expression.accept(this); - // If the value is an empty list, preserve it, because converting it to CSS - // will throw an error that we want the user to see. - if (!value.isBlank || _isEmptyList(value)) { + if (!value.isBlank || + // If the value is an empty list, preserve it, because converting it + // to CSS will throw an error that we want the user to see. + _isEmptyList(value) || + // Custom properties are allowed to have empty values, per spec. + name.value.startsWith('--')) { _parent.addChild( ModifiableCssDeclaration( name, @@ -1396,11 +1399,6 @@ final class _EvaluateVisitor _sourceMap ? node.value.andThen(_expressionNode)?.span : null, ), ); - } else if (name.value.startsWith('--')) { - throw _exception( - "Custom property values may not be empty.", - expression.span, - ); } } diff --git a/lib/src/visitor/evaluate.dart b/lib/src/visitor/evaluate.dart index 5e126d91e..5727e56aa 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: 6e5710daa106ed0b9b684af8bc61ce9cc233a10b +// Checksum: a3068d04660dd2bed34b884aa6e1a21d423dc4e5 // // ignore_for_file: unused_import @@ -1389,9 +1389,12 @@ final class _EvaluateVisitor if (node.value case var expression?) { var value = expression.accept(this); - // If the value is an empty list, preserve it, because converting it to CSS - // will throw an error that we want the user to see. - if (!value.isBlank || _isEmptyList(value)) { + if (!value.isBlank || + // If the value is an empty list, preserve it, because converting it + // to CSS will throw an error that we want the user to see. + _isEmptyList(value) || + // Custom properties are allowed to have empty values, per spec. + name.value.startsWith('--')) { _parent.addChild( ModifiableCssDeclaration( name, @@ -1404,11 +1407,6 @@ final class _EvaluateVisitor _sourceMap ? node.value.andThen(_expressionNode)?.span : null, ), ); - } else if (name.value.startsWith('--')) { - throw _exception( - "Custom property values may not be empty.", - expression.span, - ); } } diff --git a/pkg/sass-parser/CHANGELOG.md b/pkg/sass-parser/CHANGELOG.md index f905887e4..ccf8f716c 100644 --- a/pkg/sass-parser/CHANGELOG.md +++ b/pkg/sass-parser/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.4.21-dev +## 0.4.21 * No user-visible changes. diff --git a/pkg/sass-parser/package.json b/pkg/sass-parser/package.json index afd43e47e..c34bb4dba 100644 --- a/pkg/sass-parser/package.json +++ b/pkg/sass-parser/package.json @@ -1,6 +1,6 @@ { "name": "sass-parser", - "version": "0.4.21-dev", + "version": "0.4.21", "description": "A PostCSS-compatible wrapper of the official Sass parser", "repository": "sass/sass", "author": "Google Inc.", diff --git a/pkg/sass_api/CHANGELOG.md b/pkg/sass_api/CHANGELOG.md index 4b7430f33..0c31d4580 100644 --- a/pkg/sass_api/CHANGELOG.md +++ b/pkg/sass_api/CHANGELOG.md @@ -1,4 +1,4 @@ -## 15.5.0-dev +## 15.5.0 * No user-visible changes. diff --git a/pkg/sass_api/pubspec.yaml b/pkg/sass_api/pubspec.yaml index 44cafd4b8..b4689708d 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: 15.5.0-dev +version: 15.5.0 description: Additional APIs for Dart Sass. homepage: https://github.com/sass/dart-sass diff --git a/pubspec.yaml b/pubspec.yaml index e67c1c6b6..1c5f1dd00 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.88.0-dev +version: 1.88.0 description: A Sass implementation in Dart. homepage: https://github.com/sass/dart-sass diff --git a/tool/grind/bump_version.dart b/tool/grind/bump_version.dart index aa6ca82c5..310c25d33 100644 --- a/tool/grind/bump_version.dart +++ b/tool/grind/bump_version.dart @@ -17,6 +17,9 @@ final _pubspecVersionRegExp = RegExp(r'^version: (.*)$', multiLine: true); /// A regular expression that matches a Sass dependency version in a pubspec. final _sassVersionRegExp = RegExp(r'^( +)sass: (\d.*)$', multiLine: true); +/// A regular expression that matches a CHANGELOG header for a dev version +final _changelogDevHeaderRegExp = RegExp(r'^## .*-dev$', multiLine: true); + /// Adds grinder tasks for bumping package versions. void addBumpVersionTasks() { for (var patch in [false, true]) { @@ -65,9 +68,9 @@ void _bumpVersion(bool patch, bool dev) { void addChangelogEntry(String dir, Version version) { var path = p.join(dir, "CHANGELOG.md"); var text = File(path).readAsStringSync(); - if (!dev && text.startsWith("## $version-dev\n")) { + if (!dev && text.startsWith(_changelogDevHeaderRegExp)) { File(path).writeAsStringSync( - text.replaceFirst("## $version-dev\n", "## $version\n"), + text.replaceFirst(_changelogDevHeaderRegExp, "## $version"), ); } else if (text.startsWith("## $version\n")) { return;