diff --git a/CHANGELOG.md b/CHANGELOG.md index 98816c1aa..aaa714056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.0.0 + +* **Breaking change:** The `@-moz-document` rule no longer has any special + parsing associated with it. It is now parsed like any other unknown plain CSS + at-rule, where Sass features are only allowed within `#{}` interpolation. + ## 1.80.6 ### Command-Line Interface diff --git a/lib/src/deprecation.dart b/lib/src/deprecation.dart index 3281e720d..c8b452576 100644 --- a/lib/src/deprecation.dart +++ b/lib/src/deprecation.dart @@ -15,7 +15,7 @@ enum Deprecation { // DO NOT EDIT. This section was generated from the language repo. // See tool/grind/generate_deprecations.dart for details. // - // Checksum: 47c97f7824eb25d7f1e64e3230938b88330d40b4 + // Checksum: 651decb8bf8d0378b657241a5a0db7272c228fd4 /// Deprecation for passing a string directly to meta.call(). callString('call-string', @@ -27,7 +27,9 @@ enum Deprecation { /// Deprecation for @-moz-document. mozDocument('moz-document', - deprecatedIn: '1.7.2', description: '@-moz-document.'), + deprecatedIn: '1.7.2', + obsoleteIn: '2.0.0', + description: '@-moz-document.'), /// Deprecation for imports using relative canonical URLs. relativeCanonical('relative-canonical', @@ -175,9 +177,10 @@ enum Deprecation { Version? get obsoleteIn => _obsoleteIn?.andThen(Version.parse); /// Constructs a regular deprecation. - const Deprecation(this.id, {required String? deprecatedIn, this.description}) + const Deprecation(this.id, + {required String? deprecatedIn, this.description, String? obsoleteIn}) : _deprecatedIn = deprecatedIn, - _obsoleteIn = null, + _obsoleteIn = obsoleteIn, isFuture = false; /// Constructs a future deprecation. diff --git a/lib/src/js/deprecations.dart b/lib/src/js/deprecations.dart index e26fe9ea3..b88d2472a 100644 --- a/lib/src/js/deprecations.dart +++ b/lib/src/js/deprecations.dart @@ -42,7 +42,7 @@ final Map deprecations = { })(), description: deprecation.description, deprecatedIn: deprecation.deprecatedIn, - obsoleteIn: deprecation.deprecatedIn), + obsoleteIn: deprecation.obsoleteIn), }; /// Parses a list of [deprecations] from JS into an list of Dart [Deprecation] diff --git a/lib/src/parse/css.dart b/lib/src/parse/css.dart index 4fd9ae2df..77bbc4f00 100644 --- a/lib/src/parse/css.dart +++ b/lib/src/parse/css.dart @@ -69,7 +69,6 @@ class CssParser extends ScssParser { _forbiddenAtRule(start), "import" => _cssImportRule(start), "media" => mediaRule(start), - "-moz-document" => mozDocumentRule(start, name), "supports" => supportsRule(start), _ => unknownAtRule(start, name) }; diff --git a/lib/src/parse/stylesheet.dart b/lib/src/parse/stylesheet.dart index 94f551d2d..c2b1c6068 100644 --- a/lib/src/parse/stylesheet.dart +++ b/lib/src/parse/stylesheet.dart @@ -651,8 +651,6 @@ abstract class StylesheetParser extends Parser { return mediaRule(start); case "mixin": return _mixinRule(start); - case "-moz-document": - return mozDocumentRule(start, name); case "return": return _disallowedAtRule(start); case "supports": @@ -1345,91 +1343,6 @@ abstract class StylesheetParser extends Parser { }); } - /// Consumes a `@moz-document` rule. - /// - /// Gecko's `@-moz-document` diverges from [the specification][] allows the - /// `url-prefix` and `domain` functions to omit quotation marks, contrary to - /// the standard. - /// - /// [the specification]: http://www.w3.org/TR/css3-conditional/ - @protected - AtRule mozDocumentRule(LineScannerState start, Interpolation name) { - var valueStart = scanner.state; - var buffer = InterpolationBuffer(); - var needsDeprecationWarning = false; - while (true) { - if (scanner.peekChar() == $hash) { - var (expression, span) = singleInterpolation(); - buffer.add(expression, span); - needsDeprecationWarning = true; - } else { - var identifierStart = scanner.state; - var identifier = this.identifier(); - switch (identifier) { - case "url" || "url-prefix" || "domain": - if (_tryUrlContents(identifierStart, name: identifier) - case var contents?) { - buffer.addInterpolation(contents); - } else { - scanner.expectChar($lparen); - whitespace(); - var argument = interpolatedString(); - scanner.expectChar($rparen); - - buffer - ..write(identifier) - ..writeCharCode($lparen) - ..addInterpolation(argument.asInterpolation()) - ..writeCharCode($rparen); - } - - // A url-prefix with no argument, or with an empty string as an - // argument, is not (yet) deprecated. - var trailing = buffer.trailingString; - if (!trailing.endsWith("url-prefix()") && - !trailing.endsWith("url-prefix('')") && - !trailing.endsWith('url-prefix("")')) { - needsDeprecationWarning = true; - } - - case "regexp": - buffer.write("regexp("); - scanner.expectChar($lparen); - buffer.addInterpolation(interpolatedString().asInterpolation()); - scanner.expectChar($rparen); - buffer.writeCharCode($rparen); - needsDeprecationWarning = true; - - default: - error("Invalid function name.", scanner.spanFrom(identifierStart)); - } - } - - whitespace(); - if (!scanner.scanChar($comma)) break; - - buffer.writeCharCode($comma); - buffer.write(rawText(whitespace)); - } - - var value = buffer.interpolation(scanner.spanFrom(valueStart)); - return _withChildren(_statement, start, (children, span) { - if (needsDeprecationWarning) { - warnings.add(( - deprecation: Deprecation.mozDocument, - message: - "@-moz-document is deprecated and support will be removed in " - "Dart Sass 2.0.0.\n" - "\n" - "For details, see https://sass-lang.com/d/moz-document.", - span: span - )); - } - - return AtRule(name, span, value: value, children: children); - }); - } - /// Consumes a `@return` rule. /// /// [start] should point before the `@`. diff --git a/pkg/sass-parser/CHANGELOG.md b/pkg/sass-parser/CHANGELOG.md index 8af6f962c..9ea24aee2 100644 --- a/pkg/sass-parser/CHANGELOG.md +++ b/pkg/sass-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.0 + +* No user-visible changes. + ## 0.4.3 * Add support for parsing the `@while` rule. diff --git a/pkg/sass-parser/package.json b/pkg/sass-parser/package.json index 9b5fc6fa9..c30adb216 100644 --- a/pkg/sass-parser/package.json +++ b/pkg/sass-parser/package.json @@ -1,6 +1,6 @@ { "name": "sass-parser", - "version": "0.4.3", + "version": "0.5.0-dev", "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 8d2a119ac..4f10ea3c1 100644 --- a/pkg/sass_api/CHANGELOG.md +++ b/pkg/sass_api/CHANGELOG.md @@ -1,3 +1,7 @@ +## 15.0.0 + +* No user-visible changes. + ## 14.1.2 * No user-visible changes. diff --git a/pkg/sass_api/pubspec.yaml b/pkg/sass_api/pubspec.yaml index 8bddb43bf..1fcb5d5ec 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: 14.1.2 +version: 15.0.0-dev description: Additional APIs for Dart Sass. homepage: https://github.com/sass/dart-sass @@ -10,7 +10,7 @@ environment: sdk: ">=3.3.0 <4.0.0" dependencies: - sass: 1.80.6 + sass: 2.0.0 dev_dependencies: dartdoc: ^8.0.14 diff --git a/pubspec.yaml b/pubspec.yaml index 6e148ca9f..924008fcd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.80.6 +version: 2.0.0-dev description: A Sass implementation in Dart. homepage: https://github.com/sass/dart-sass diff --git a/test/deprecations_test.dart b/test/deprecations_test.dart index 5841ea323..820a6b49b 100644 --- a/test/deprecations_test.dart +++ b/test/deprecations_test.dart @@ -20,12 +20,6 @@ void main() { _expectDeprecation("@if false {} @elseif false {}", Deprecation.elseif); }); - // Deprecated in 1.7.2 - test("mozDocument is violated by most @-moz-document rules", () { - _expectDeprecation( - "@-moz-document url-prefix(foo) {}", Deprecation.mozDocument); - }); - // Deprecated in 1.17.2 test("newGlobal is violated by declaring a new variable with !global", () { _expectDeprecation(r"a {$foo: bar !global;}", Deprecation.newGlobal);