This commit is contained in:
Tobe O 2018-06-08 13:45:01 -04:00
parent 0c3936d602
commit 7d2ad74c27
3 changed files with 22 additions and 20 deletions

View file

@ -1,3 +1,6 @@
# 1.1.1+1
* Fix a bug that threw when `--observe` was not present.
# 1.1.1
* Disable the observatory from pausing the isolate
on exceptions, because Angel already handles

View file

@ -140,37 +140,36 @@ class HotReloader {
/// Starts listening to requests and filesystem events.
Future<HttpServer> startServer([address, int port]) async {
_server = await _generateServer();
if (_paths?.isNotEmpty != true)
print(
'WARNING: You have instantiated a HotReloader without providing any filesystem paths to watch.');
_client = await vm.vmServiceConnect(
vmServiceHost ?? 'localhost', vmServicePort ?? 8181);
_vmachine ??= await _client.getVM();
_mainIsolate ??= _vmachine.isolates.first;
await _client.setExceptionPauseMode(_mainIsolate.id, 'None');
if (!Platform.executableArguments.contains('--observe') &&
!Platform.executableArguments.contains('--enable-vm-service')) {
stderr.writeln(
'WARNING: You have instantiated a HotReloader without passing `--enable-vm-service` or `--observe` to the Dart VM. Hot reloading will be disabled.');
} else {
_client = await vm.vmServiceConnect(
vmServiceHost ?? 'localhost', vmServicePort ?? 8181);
_vmachine ??= await _client.getVM();
_mainIsolate ??= _vmachine.isolates.first;
await _client.setExceptionPauseMode(_mainIsolate.id, 'None');
_onChange.stream
.transform(new _Debounce(new Duration(seconds: 1)))
.listen(_handleWatchEvent);
await _listenToFilesystem();
}
_server = await _generateServer();
while (!_requestQueue.isEmpty) await _handle(_requestQueue.removeFirst());
_onChange.stream
.transform(new _Debounce(new Duration(seconds: 1)))
.listen(_handleWatchEvent);
await _listenToFilesystem();
var server = await HttpServer.bind(address ?? '127.0.0.1', port ?? 0);
server.listen(handleRequest);
return server;
}
_listenToFilesystem() async {
if (!Platform.executableArguments.contains('--observe') &&
!Platform.executableArguments.contains('--enable-vm-service')) {
stderr.writeln(
'WARNING: You have instantiated a HotReloader without passing `--enable-vm-service` or `--observe` to the Dart VM. Hot reloading will be disabled.');
return;
}
for (var path in _paths) {
if (path is String) {
await _listenToStat(path);

View file

@ -1,6 +1,6 @@
name: angel_hot
description: Supports hot reloading of Angel servers on file changes.
version: 1.1.1
version: 1.1.1+1
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/hot
environment: