diff --git a/CHANGELOG.md b/CHANGELOG.md index 87f2466a6..8955a49fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## 1.78.0 +* The `meta.feature-exists` function is now deprecated. This deprecation is + named `feature-exists`. + ### JS API * Fix a bug where accessing `SourceSpan.url` would crash when a relative URL was diff --git a/lib/src/deprecation.dart b/lib/src/deprecation.dart index b71960c47..77891a13f 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: 309e4f1f008f08379b824ab6094e13df2e18e187 + // Checksum: dd5c6aa0f1431fa9fc88bb71a96f832adbc165f5 /// Deprecation for passing a string directly to meta.call(). callString('call-string', @@ -95,6 +95,10 @@ enum Deprecation { deprecatedIn: '1.77.7', description: 'Declarations after or between nested rules.'), + /// Deprecation for meta.feature-exists + featureExists('feature-exists', + deprecatedIn: '1.78.0', description: 'meta.feature-exists'), + /// Deprecation for @import rules. import.future('import', description: '@import rules.'), diff --git a/lib/src/functions/meta.dart b/lib/src/functions/meta.dart index a3b683b9a..f88dce83e 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\n" + "More info: https://sass-lang.com/d/feature-exists", + Deprecation.featureExists); var feature = arguments[0].assertString("feature"); return SassBoolean(_features.contains(feature.text)); }),