Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate function and mixin names beginning with -- #2230

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## 1.75.1
## 1.76.0

* Throw errors for misplaced statements in keyframe blocks.

* Mixins and functions whose names begin with `--` are now deprecated for
forwards-compatibility with the in-progress CSS functions and mixins spec.
This deprecation is named `css-function-mixin`.

## 1.75.0

* Fix a bug in which stylesheet canonicalization could be cached incorrectly
Expand Down
4 changes: 4 additions & 0 deletions lib/src/deprecation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ enum Deprecation {
description:
'Using the current working directory as an implicit load path.'),

cssFunctionMixin('css-function-mixin',
deprecatedIn: '1.76.0',
description: 'Function and mixin names beginning with --.'),

@Deprecated('This deprecation name was never actually used.')
calcInterp('calc-interp', deprecatedIn: null),

Expand Down
24 changes: 24 additions & 0 deletions lib/src/parse/stylesheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,19 @@ abstract class StylesheetParser extends Parser {
FunctionRule _functionRule(LineScannerState start) {
var precedingComment = lastSilentComment;
lastSilentComment = null;
var beforeName = scanner.state;
var name = identifier(normalize: true);

if (name.startsWith('--')) {
logger.warnForDeprecation(
Deprecation.cssFunctionMixin,
'Sass @function names beginning with -- are deprecated for forward-'
'compatibility with plain CSS mixins.\n'
'\n'
'For details, see https://sass-lang.com/d/css-function-mixin',
span: scanner.spanFrom(beforeName));
}

whitespace();
var arguments = _argumentDeclaration();

Expand Down Expand Up @@ -1261,7 +1273,19 @@ abstract class StylesheetParser extends Parser {
MixinRule _mixinRule(LineScannerState start) {
var precedingComment = lastSilentComment;
lastSilentComment = null;
var beforeName = scanner.state;
var name = identifier(normalize: true);

if (name.startsWith('--')) {
logger.warnForDeprecation(
Deprecation.cssFunctionMixin,
'Sass @mixin names beginning with -- are deprecated for forward-'
'compatibility with plain CSS mixins.\n'
'\n'
'For details, see https://sass-lang.com/d/css-function-mixin',
span: scanner.spanFrom(beforeName));
}

whitespace();
var arguments = scanner.peekChar() == $lparen
? _argumentDeclaration()
Expand Down
4 changes: 4 additions & 0 deletions pkg/sass_api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 10.3.0

* No user-visible changes.

## 10.2.1

* No user-visible changes.
Expand Down
4 changes: 2 additions & 2 deletions pkg/sass_api/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ 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.1-dev
version: 10.3.0
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass

environment:
sdk: ">=3.0.0 <4.0.0"

dependencies:
sass: 1.75.1
sass: 1.76.0

dev_dependencies:
dartdoc: ^6.0.0
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sass
version: 1.75.1-dev
version: 1.76.0
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down
Loading