Skip to content

Commit 1e74aca

Browse files
authored
Treat CLI args as paths, not URLs (#239)
Fixes #237.
1 parent 437242e commit 1e74aca

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.7.3
2+
3+
* Fixes a bug where path arguments on the command line were incorrectly treated
4+
as URLs, resulting in errors finding paths containing certain special
5+
characters.
6+
17
## 1.7.2
28

39
### Module Migrator

lib/src/migrator.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ abstract class Migrator extends Command<Map<Uri, String>> {
8888
];
8989
for (var entrypoint in entrypoints) {
9090
var tuple =
91-
importCache.import(Uri.parse(entrypoint), baseImporter: importer);
91+
importCache.import(p.toUri(entrypoint), baseImporter: importer);
9292
if (tuple == null) {
9393
throw MigrationException("Could not find Sass file at '$entrypoint'.");
9494
}

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass_migrator
2-
version: 1.7.2
2+
version: 1.7.3
33
description: A tool for running migrations on Sass files
44
homepage: https://github.com/sass/migrator
55

test/cli_dart_test.dart

+8
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ void main() {
5858
]).validate();
5959
});
6060

61+
test("treats file arguments as paths, not urls", () async {
62+
await d.file("#file.scss", "a {b: (1 / 2)}").create();
63+
64+
await (await runMigrator(["division", "#file.scss"])).shouldExit(0);
65+
66+
await d.file("#file.scss", 'a {b: (1 * 0.5)}').validate();
67+
});
68+
6169
test("allows non-glob file arguments containing glob syntax", () async {
6270
await d.dir('[dir]', [d.file("test.scss", "a {b: (1 / 2)}")]).create();
6371

0 commit comments

Comments
 (0)