From e2df53f9b460d6fb5d10b66ee1003241705e32d3 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 6 May 2024 17:10:16 +0200 Subject: [PATCH] Deprecate the `feature-exists` function --- CHANGELOG.md | 5 +++++ lib/src/deprecation.dart | 4 ++++ lib/src/functions/meta.dart | 6 ++++++ pkg/sass_api/pubspec.yaml | 4 ++-- pubspec.yaml | 2 +- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52adaf61a..d7bc356cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.78.0 + +* The `meta.feature-exists` function is now deprecated. This deprecation is + named `feature-exists`. + ## 1.77.0 * *Don't* throw errors for at-rules in keyframe blocks. diff --git a/lib/src/deprecation.dart b/lib/src/deprecation.dart index b13180e10..4b3e884a1 100644 --- a/lib/src/deprecation.dart +++ b/lib/src/deprecation.dart @@ -78,6 +78,10 @@ enum Deprecation { deprecatedIn: '1.76.0', description: 'Function and mixin names beginning with --.'), + featureExists('feature-exists', + deprecatedIn: '1.78.0', + description: 'Using the meta.feature-exists() function.'), + @Deprecated('This deprecation name was never actually used.') calcInterp('calc-interp', deprecatedIn: null), diff --git a/lib/src/functions/meta.dart b/lib/src/functions/meta.dart index a3b683b9a..11cf5650a 100644 --- a/lib/src/functions/meta.dart +++ b/lib/src/functions/meta.dart @@ -8,6 +8,8 @@ import 'package:collection/collection.dart'; import '../ast/sass/statement/mixin_rule.dart'; import '../callable.dart'; +import '../deprecation.dart'; +import '../evaluation_context.dart'; import '../util/map.dart'; import '../value.dart'; @@ -26,6 +28,10 @@ final global = UnmodifiableListView([ // evaluator, because they need access to context that's only available at // runtime. _function("feature-exists", r"$feature", (arguments) { + warnForDeprecation( + "The feature-exists() function is deprecated.\n" + "More info: https://sass-lang.com/d/feature-exists", + Deprecation.featureExists); var feature = arguments[0].assertString("feature"); return SassBoolean(_features.contains(feature.text)); }), diff --git a/pkg/sass_api/pubspec.yaml b/pkg/sass_api/pubspec.yaml index aa5fda388..d7e764667 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.4.0 +version: 10.5.0-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.77.0 + sass: 1.78.0 dev_dependencies: dartdoc: ^6.0.0 diff --git a/pubspec.yaml b/pubspec.yaml index 8bc82a811..b08f2cf3d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.77.0 +version: 1.78.0-dev description: A Sass implementation in Dart. homepage: https://github.com/sass/dart-sass