dart-sass/test/ensure_npm_package.dart

30 lines
901 B
Dart
Raw Normal View History

// Copyright 2017 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
import 'dart:async';
2017-07-07 02:36:15 +02:00
import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';
import 'package:sass/src/io.dart';
import 'io.dart';
2019-05-31 17:01:49 +02:00
void hybridMain(StreamChannel<Object> channel) async {
ensureUpToDate("build/npm/sass.dart.js", "pub run grinder npm-package");
channel.sink.close();
}
/// Ensures that the NPM package is compiled and up-to-date.
///
2017-10-21 01:56:54 +02:00
/// This is safe to call even outside the Dart VM.
2019-05-31 17:01:49 +02:00
Future<void> ensureNpmPackage() async {
// spawnHybridUri() doesn't currently work on Windows and Node due to busted
// path handling in the SDK.
if (isNode && isWindows) return;
2017-10-21 01:56:54 +02:00
var channel = spawnHybridUri("/test/ensure_npm_package.dart");
await channel.stream.toList();
}