@@ -7,10 +7,10 @@ import 'dart:io';
77import 'dart:isolate' ;
88import 'dart:typed_data' ;
99
10- import 'package:collection/collection.dart' ;
1110import 'package:native_synchronization/mailbox.dart' ;
1211import 'package:path/path.dart' as p;
1312import 'package:protobuf/protobuf.dart' ;
13+ import 'package:pub_semver/pub_semver.dart' ;
1414import 'package:sass/sass.dart' as sass;
1515import 'package:sass/src/importer/node_package.dart' as npi;
1616
@@ -125,20 +125,34 @@ final class CompilationDispatcher {
125125 : EmbeddedLogger (this ,
126126 color: request.alertColor, ascii: request.alertAscii);
127127
128- sass.Deprecation ? deprecationOrWarn (String id) {
129- var deprecation = sass.Deprecation .fromId (id);
130- if (deprecation == null ) {
131- logger.warn ('Invalid deprecation "$id ".' );
132- }
133- return deprecation;
128+ Iterable <sass.Deprecation >? parseDeprecationsOrWarn (
129+ Iterable <String > deprecations,
130+ {bool supportVersions = false }) {
131+ return () sync * {
132+ for (var item in deprecations) {
133+ var deprecation = sass.Deprecation .fromId (item);
134+ if (deprecation == null ) {
135+ if (supportVersions) {
136+ try {
137+ yield * sass.Deprecation .forVersion (Version .parse (item));
138+ } on FormatException {
139+ logger.warn ('Invalid deprecation id or version "$item ".' );
140+ }
141+ } else {
142+ logger.warn ('Invalid deprecation id "$item ".' );
143+ }
144+ } else {
145+ yield deprecation;
146+ }
147+ }
148+ }();
134149 }
135150
136- var fatalDeprecations =
137- request.fatalDeprecation. map (deprecationOrWarn). whereNotNull ( );
151+ var fatalDeprecations = parseDeprecationsOrWarn (request.fatalDeprecation,
152+ supportVersions : true );
138153 var silenceDeprecations =
139- request.silenceDeprecation.map (deprecationOrWarn).whereNotNull ();
140- var futureDeprecations =
141- request.futureDeprecation.map (deprecationOrWarn).whereNotNull ();
154+ parseDeprecationsOrWarn (request.silenceDeprecation);
155+ var futureDeprecations = parseDeprecationsOrWarn (request.futureDeprecation);
142156
143157 try {
144158 var importers = request.importers.map ((importer) =>
0 commit comments