Skip to content

Commit ef02c63

Browse files
authored
Fix crash on Node (#185)
1 parent b4fc3d4 commit ef02c63

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ jobs:
7373
with: {node-version: "${{ matrix.node_version }}"}
7474
- run: npm install
7575
- run: dart pub run grinder pkg-npm-dev
76+
- name: Run tests
77+
run: dart pub run test -t node -r expanded
7678

7779
static_analysis:
7880
name: Static analysis

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.3.9
2+
3+
* Fix crash when running on Node.
4+
15
## 1.3.8
26

37
* No user-visible changes.

lib/src/io/node.dart

+4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
// license that can be found in the LICENSE file or at
55
// https://opensource.org/licenses/MIT.
66

7+
import 'package:file/file.dart';
78
import 'package:js/js.dart';
89
import 'package:node_interop/node.dart';
10+
import 'package:node_io/node_io.dart';
911

1012
// Node seems to support ANSI escapes on all terminals.
1113
//
@@ -15,3 +17,5 @@ import 'package:node_interop/node.dart';
1517
external bool get supportsAnsiEscapes;
1618

1719
void printStderr(Object message) => process.stderr.write("$message\n");
20+
21+
FileSystem get fileSystem => nodeFileSystem;

lib/src/io/vm.dart

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
import 'dart:io';
88

9+
import 'package:file/file.dart';
10+
import 'package:file/local.dart';
11+
912
/// Whether this process is connected to a terminal that supports ANSI escape
1013
/// sequences.
1114
bool get supportsAnsiEscapes {
@@ -19,3 +22,6 @@ bool get supportsAnsiEscapes {
1922

2023
/// Prints [message] to standard error, followed by a newline.
2124
void printStderr(Object message) => stderr.writeln(message);
25+
26+
/// The local filesystem.
27+
FileSystem get fileSystem => const LocalFileSystem();

lib/src/migrator.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import 'package:sass/src/import_cache.dart';
1414

1515
import 'package:args/command_runner.dart';
1616
import 'package:glob/glob.dart';
17-
import 'package:glob/list_local_fs.dart';
1817
import 'package:meta/meta.dart';
1918
import 'package:path/path.dart' as p;
2019
import 'package:sass_migrator/src/util/node_modules_importer.dart';
@@ -82,7 +81,7 @@ abstract class Migrator extends Command<Map<Uri, String>> {
8281

8382
var entrypoints = [
8483
for (var argument in argResults!.rest)
85-
for (var entry in Glob(argument).listSync())
84+
for (var entry in Glob(argument).listFileSystemSync(fileSystem))
8685
if (entry is File) entry.path
8786
];
8887
for (var entrypoint in entrypoints) {

pubspec.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass_migrator
2-
version: 1.3.8
2+
version: 1.3.9
33
description: A tool for running migrations on Sass files
44
author: Jennifer Thakar <[email protected]>
55
homepage: https://github.com/sass/migrator
@@ -11,6 +11,7 @@ dependencies:
1111
args: ^2.1.0
1212
charcode: ^1.2.0
1313
collection: ^1.15.0
14+
file: ^6.1.0
1415
glob: ^2.0.1
1516
js: ^0.6.3
1617
meta: ^1.3.0

0 commit comments

Comments
 (0)