diff --git a/CHANGELOG.md b/CHANGELOG.md index 863a1bcd..9e5571ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.37.6 + +* Don't crash when a Windows path is returned by a custom Node importer at the + same time as file contents. + ## 1.37.5 * No user-visible changes. diff --git a/lib/src/importer/node/implementation.dart b/lib/src/importer/node/implementation.dart index 47c0b202..fec91600 100644 --- a/lib/src/importer/node/implementation.dart +++ b/lib/src/importer/node/implementation.dart @@ -186,7 +186,7 @@ class NodeImporter { if (file == null) { return Tuple2(contents ?? '', url); } else if (contents != null) { - return Tuple2(contents, file); + return Tuple2(contents, p.toUri(file).toString()); } else { var resolved = loadRelative(p.toUri(file).toString(), previous, forImport) ?? diff --git a/pubspec.yaml b/pubspec.yaml index e82435cf..7653ca23 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.37.5 +version: 1.37.6-dev description: A Sass implementation in Dart. homepage: https://github.com/sass/dart-sass diff --git a/test/node_api/importer_test.dart b/test/node_api/importer_test.dart index 03c14ac0..50f5787f 100644 --- a/test/node_api/importer_test.dart +++ b/test/node_api/importer_test.dart @@ -141,6 +141,16 @@ void main() { })))); expect(result.stats.includedFiles, equals(['bar'])); }); + + // Regression test for sass/dart-sass#1410. + test("passes through an absolute file path", () { + var result = sass.renderSync(RenderOptions( + data: "@import 'foo'", + importer: allowInterop(expectAsync2((void _, void __) { + return NodeImporterResult(contents: '', file: p.absolute('bar')); + })))); + expect(result.stats.includedFiles, equals([p.absolute('bar')])); + }); }); group("with a file redirect", () {