File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 10
10
11
11
* Deprecate passing non-` deg ` units to ` color.hwb() ` 's ` $hue ` argument.
12
12
13
+ ### Dart API
14
+
15
+ * Add a top-level ` fakeFromImport() ` function for testing custom importers
16
+ that use ` AsyncImporter.fromImport ` .
17
+
13
18
### JS API
14
19
15
20
* Add a ` charset ` option that controls whether or not Sass emits a
16
21
` @charset ` /BOM for non-ASCII stylesheets.
22
+
17
23
* Fix Sass npm package types for TS 4.7+ Node16 and NodeNext module resolution.
18
24
19
25
## 1.53.0
Original file line number Diff line number Diff line change 5
5
/// We strongly recommend importing this library with the prefix `sass` .
6
6
library sass;
7
7
8
+ import 'package:meta/meta.dart' ;
8
9
import 'package:package_config/package_config_types.dart' ;
9
10
import 'package:source_maps/source_maps.dart' ;
10
11
@@ -15,6 +16,7 @@ import 'src/compile_result.dart';
15
16
import 'src/exception.dart' ;
16
17
import 'src/import_cache.dart' ;
17
18
import 'src/importer.dart' ;
19
+ import 'src/importer/utils.dart' ;
18
20
import 'src/logger.dart' ;
19
21
import 'src/syntax.dart' ;
20
22
import 'src/util/nullable.dart' ;
@@ -474,3 +476,10 @@ Future<String> compileStringAsync(
474
476
result.sourceMap.andThen (sourceMap);
475
477
return result.css;
476
478
}
479
+
480
+ /// Runs [callback] in a context where [AsyncImporter.fromImport] returns
481
+ /// `true` .
482
+ ///
483
+ /// This is only intended for use when testing custom importers.
484
+ @visibleForTesting
485
+ T fakeFromImport <T >(T callback ()) => inImportRule (callback);
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import '../io.dart';
17
17
/// removed, at which point we can delete this and have one consistent behavior.
18
18
bool get fromImport => Zone .current[#_inImportRule] as bool ? ?? false ;
19
19
20
- /// Runs [callback] in a context where [inImportRule ] returns `true` and
20
+ /// Runs [callback] in a context where [fromImport ] returns `true` and
21
21
/// [resolveImportPath] uses `@import` semantics rather than `@use` semantics.
22
22
T inImportRule <T >(T callback ()) =>
23
23
runZoned (callback, zoneValues: {#_inImportRule: true });
You can’t perform that action at this time.
0 commit comments