Skip to content

Commit 280f95c

Browse files
stofnex3
andauthored
Deprecate the feature-exists function (#2235)
Co-authored-by: Natalie Weizenbaum <[email protected]>
1 parent 72ef6a2 commit 280f95c

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## 1.78.0
22

3+
* The `meta.feature-exists` function is now deprecated. This deprecation is
4+
named `feature-exists`.
5+
36
* Fix a crash when using `@at-root` without any queries or children in the
47
indented syntax.
58

lib/src/deprecation.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enum Deprecation {
1515
// DO NOT EDIT. This section was generated from the language repo.
1616
// See tool/grind/generate_deprecations.dart for details.
1717
//
18-
// Checksum: 309e4f1f008f08379b824ab6094e13df2e18e187
18+
// Checksum: dd5c6aa0f1431fa9fc88bb71a96f832adbc165f5
1919

2020
/// Deprecation for passing a string directly to meta.call().
2121
callString('call-string',
@@ -95,6 +95,10 @@ enum Deprecation {
9595
deprecatedIn: '1.77.7',
9696
description: 'Declarations after or between nested rules.'),
9797

98+
/// Deprecation for meta.feature-exists
99+
featureExists('feature-exists',
100+
deprecatedIn: '1.78.0', description: 'meta.feature-exists'),
101+
98102
/// Deprecation for @import rules.
99103
import.future('import', description: '@import rules.'),
100104

lib/src/functions/meta.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import 'package:collection/collection.dart';
88

99
import '../ast/sass/statement/mixin_rule.dart';
1010
import '../callable.dart';
11+
import '../deprecation.dart';
12+
import '../evaluation_context.dart';
1113
import '../util/map.dart';
1214
import '../value.dart';
1315

@@ -26,6 +28,10 @@ final global = UnmodifiableListView([
2628
// evaluator, because they need access to context that's only available at
2729
// runtime.
2830
_function("feature-exists", r"$feature", (arguments) {
31+
warnForDeprecation(
32+
"The feature-exists() function is deprecated.\n\n"
33+
"More info: https://sass-lang.com/d/feature-exists",
34+
Deprecation.featureExists);
2935
var feature = arguments[0].assertString("feature");
3036
return SassBoolean(_features.contains(feature.text));
3137
}),

0 commit comments

Comments
 (0)