@@ -7,10 +7,10 @@ import 'dart:io';
7
7
import 'dart:isolate' ;
8
8
import 'dart:typed_data' ;
9
9
10
- import 'package:collection/collection.dart' ;
11
10
import 'package:native_synchronization/mailbox.dart' ;
12
11
import 'package:path/path.dart' as p;
13
12
import 'package:protobuf/protobuf.dart' ;
13
+ import 'package:pub_semver/pub_semver.dart' ;
14
14
import 'package:sass/sass.dart' as sass;
15
15
import 'package:sass/src/importer/node_package.dart' as npi;
16
16
@@ -125,20 +125,34 @@ final class CompilationDispatcher {
125
125
: EmbeddedLogger (this ,
126
126
color: request.alertColor, ascii: request.alertAscii);
127
127
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
+ }();
134
149
}
135
150
136
- var fatalDeprecations =
137
- request.fatalDeprecation. map (deprecationOrWarn). whereNotNull ( );
151
+ var fatalDeprecations = parseDeprecationsOrWarn (request.fatalDeprecation,
152
+ supportVersions : true );
138
153
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);
142
156
143
157
try {
144
158
var importers = request.importers.map ((importer) =>
0 commit comments