Skip to content

Commit 264b2d5

Browse files
authored
Deprecate function and mixin names beginning with -- (#2230)
See #2197
1 parent f145e1c commit 264b2d5

File tree

6 files changed

+40
-4
lines changed

6 files changed

+40
-4
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
## 1.75.1
1+
## 1.76.0
22

33
* Throw errors for misplaced statements in keyframe blocks.
44

5+
* Mixins and functions whose names begin with `--` are now deprecated for
6+
forwards-compatibility with the in-progress CSS functions and mixins spec.
7+
This deprecation is named `css-function-mixin`.
8+
59
## 1.75.0
610

711
* Fix a bug in which stylesheet canonicalization could be cached incorrectly

lib/src/deprecation.dart

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ enum Deprecation {
7474
description:
7575
'Using the current working directory as an implicit load path.'),
7676

77+
cssFunctionMixin('css-function-mixin',
78+
deprecatedIn: '1.76.0',
79+
description: 'Function and mixin names beginning with --.'),
80+
7781
@Deprecated('This deprecation name was never actually used.')
7882
calcInterp('calc-interp', deprecatedIn: null),
7983

lib/src/parse/stylesheet.dart

+24
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,19 @@ abstract class StylesheetParser extends Parser {
846846
FunctionRule _functionRule(LineScannerState start) {
847847
var precedingComment = lastSilentComment;
848848
lastSilentComment = null;
849+
var beforeName = scanner.state;
849850
var name = identifier(normalize: true);
851+
852+
if (name.startsWith('--')) {
853+
logger.warnForDeprecation(
854+
Deprecation.cssFunctionMixin,
855+
'Sass @function names beginning with -- are deprecated for forward-'
856+
'compatibility with plain CSS mixins.\n'
857+
'\n'
858+
'For details, see https://sass-lang.com/d/css-function-mixin',
859+
span: scanner.spanFrom(beforeName));
860+
}
861+
850862
whitespace();
851863
var arguments = _argumentDeclaration();
852864

@@ -1261,7 +1273,19 @@ abstract class StylesheetParser extends Parser {
12611273
MixinRule _mixinRule(LineScannerState start) {
12621274
var precedingComment = lastSilentComment;
12631275
lastSilentComment = null;
1276+
var beforeName = scanner.state;
12641277
var name = identifier(normalize: true);
1278+
1279+
if (name.startsWith('--')) {
1280+
logger.warnForDeprecation(
1281+
Deprecation.cssFunctionMixin,
1282+
'Sass @mixin names beginning with -- are deprecated for forward-'
1283+
'compatibility with plain CSS mixins.\n'
1284+
'\n'
1285+
'For details, see https://sass-lang.com/d/css-function-mixin',
1286+
span: scanner.spanFrom(beforeName));
1287+
}
1288+
12651289
whitespace();
12661290
var arguments = scanner.peekChar() == $lparen
12671291
? _argumentDeclaration()

pkg/sass_api/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 10.3.0
2+
3+
* No user-visible changes.
4+
15
## 10.2.1
26

37
* No user-visible changes.

pkg/sass_api/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 10.2.1-dev
5+
version: 10.3.0
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: ">=3.0.0 <4.0.0"
1111

1212
dependencies:
13-
sass: 1.75.1
13+
sass: 1.76.0
1414

1515
dev_dependencies:
1616
dartdoc: ^6.0.0

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.75.1-dev
2+
version: 1.76.0
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

0 commit comments

Comments
 (0)