diff --git a/webdev/CHANGELOG.md b/webdev/CHANGELOG.md index 153fdcd71..c5325c274 100644 --- a/webdev/CHANGELOG.md +++ b/webdev/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.2 + +- Support `package:dwds` version `0.3.0`. + ## 2.0.1 - Fix launching Chrome on Windows. diff --git a/webdev/lib/src/daemon/app_domain.dart b/webdev/lib/src/daemon/app_domain.dart index 670aaf444..397e2ea8e 100644 --- a/webdev/lib/src/daemon/app_domain.dart +++ b/webdev/lib/src/daemon/app_domain.dart @@ -67,8 +67,7 @@ class AppDomain extends Domain { _appDebugServices = await devHandler.loadAppServices( connection.request.appId, connection.request.instanceId); _appId = connection.request.appId; - unawaited(_appDebugServices - .debugService.chromeProxyService.tabConnection.onClose.first + unawaited(_appDebugServices.chromeProxyService.tabConnection.onClose.first .then((_) { sendEvent('app.log', { 'appId': _appId, @@ -176,8 +175,7 @@ class AppDomain extends Domain { Future _stop(Map args) async { var appId = getStringArg(args, 'appId', required: true); if (_appId != appId) throw ArgumentError.value(appId, 'appId', 'Not found'); - await _appDebugServices.debugService.chromeProxyService.tabConnection - .close(); + await _appDebugServices.chromeProxyService.tabConnection.close(); return true; } diff --git a/webdev/lib/src/serve/debugger/app_debug_services.dart b/webdev/lib/src/serve/debugger/app_debug_services.dart index 59fb90261..b60f34d70 100644 --- a/webdev/lib/src/serve/debugger/app_debug_services.dart +++ b/webdev/lib/src/serve/debugger/app_debug_services.dart @@ -4,6 +4,8 @@ import 'dart:async'; import 'package:dwds/service.dart'; +// ignore: implementation_imports +import 'package:dwds/src/chrome_proxy_service.dart' show ChromeProxyService; import '../../serve/chrome.dart'; import '../debugger/webdev_vm_client.dart'; @@ -14,6 +16,9 @@ class AppDebugServices { final DebugService debugService; final WebdevVmClient webdevClient; + ChromeProxyService get chromeProxyService => + debugService.chromeProxyService as ChromeProxyService; + /// The instance ID for the currently connected application, if there is one. /// /// We only allow a given app to be debugged in a single tab at a time. diff --git a/webdev/lib/src/serve/debugger/webdev_vm_client.dart b/webdev/lib/src/serve/debugger/webdev_vm_client.dart index 4e1377da7..105832355 100644 --- a/webdev/lib/src/serve/debugger/webdev_vm_client.dart +++ b/webdev/lib/src/serve/debugger/webdev_vm_client.dart @@ -6,6 +6,8 @@ import 'dart:async'; import 'dart:convert'; import 'package:dwds/service.dart'; +// ignore: implementation_imports +import 'package:dwds/src/chrome_proxy_service.dart' show ChromeProxyService; import 'package:pedantic/pedantic.dart'; import 'package:vm_service_lib/vm_service_lib.dart'; @@ -35,13 +37,13 @@ class WebdevVmClient { responseController.stream.map(jsonEncode), (request) => requestController.sink .add(jsonDecode(request) as Map)); + var chromeProxyService = + debugService.chromeProxyService as ChromeProxyService; client.registerServiceCallback('hotRestart', (request) async { - debugService.chromeProxyService.destroyIsolate(); - var response = await debugService.chromeProxyService.tabConnection.runtime - .sendCommand('Runtime.evaluate', params: { - 'expression': r'$dartHotRestart();', - 'awaitPromise': true - }); + chromeProxyService.destroyIsolate(); + var response = await chromeProxyService.tabConnection.runtime.sendCommand( + 'Runtime.evaluate', + params: {'expression': r'$dartHotRestart();', 'awaitPromise': true}); var exceptionDetails = response.result['exceptionDetails']; if (exceptionDetails != null) { return { @@ -52,7 +54,7 @@ class WebdevVmClient { } }; } else { - unawaited(debugService.chromeProxyService.createIsolate()); + unawaited(chromeProxyService.createIsolate()); return {'result': Success().toJson()}; } }); diff --git a/webdev/lib/src/serve/handlers/dev_handler.dart b/webdev/lib/src/serve/handlers/dev_handler.dart index 0fa4cc77d..faf69dd0b 100644 --- a/webdev/lib/src/serve/handlers/dev_handler.dart +++ b/webdev/lib/src/serve/handlers/dev_handler.dart @@ -139,7 +139,7 @@ class DevHandler { // If you load the same app in a different tab then we need to throw // away our old services and start new ones. if (!(await _isCorrectTab(message.instanceId, - appServices.debugService.chromeProxyService.tabConnection))) { + appServices.chromeProxyService.tabConnection))) { unawaited(appServices.close()); unawaited(_servicesByAppId.remove(message.appId)); appServices = @@ -150,10 +150,9 @@ class DevHandler { .serialize(DevToolsResponse((b) => b..success = true)))); appServices.connectedInstanceId = message.instanceId; - await appServices.debugService.chromeProxyService.tabConnection.runtime - .evaluate( - 'window.open("http://${_devTools.hostname}:${_devTools.port}' - '/?uri=${appServices.debugService.wsUri}", "", "_blank")'); + await appServices.chromeProxyService.tabConnection.runtime.evaluate( + 'window.open("http://${_devTools.hostname}:${_devTools.port}' + '/?uri=${appServices.debugService.wsUri}", "", "_blank")'); } else if (message is ConnectRequest) { if (appId != null) { throw StateError('Duplicate connection request from the same app. ' @@ -168,10 +167,10 @@ class DevHandler { if (services != null && services.connectedInstanceId == null) { // Re-connect to the previous instance if its in the same tab, // otherwise do nothing for now. - if (await _isCorrectTab(message.instanceId, - services.debugService.chromeProxyService.tabConnection)) { + if (await _isCorrectTab( + message.instanceId, services.chromeProxyService.tabConnection)) { services.connectedInstanceId = message.instanceId; - await services.debugService.chromeProxyService.createIsolate(); + await services.chromeProxyService.createIsolate(); } } @@ -184,7 +183,7 @@ class DevHandler { if (appId != null) { var services = await _servicesByAppId[appId]; services?.connectedInstanceId = null; - services?.debugService?.chromeProxyService?.destroyIsolate(); + services?.chromeProxyService?.destroyIsolate(); } })); } @@ -210,7 +209,7 @@ class DevHandler { var appServices = AppDebugServices(chrome, debugService, webdevClient); unawaited( - debugService.chromeProxyService.tabConnection.onClose.first.then((_) { + appServices.chromeProxyService.tabConnection.onClose.first.then((_) { appServices.close(); _servicesByAppId.remove(appId); logHandler( diff --git a/webdev/lib/src/version.dart b/webdev/lib/src/version.dart index 6884ff883..57ef5ad5d 100644 --- a/webdev/lib/src/version.dart +++ b/webdev/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '2.0.1'; +const packageVersion = '2.0.2'; diff --git a/webdev/pubspec.yaml b/webdev/pubspec.yaml index 243d08b6f..76268b141 100644 --- a/webdev/pubspec.yaml +++ b/webdev/pubspec.yaml @@ -1,5 +1,5 @@ name: webdev -version: 2.0.1 +version: 2.0.2 author: Dart Team homepage: https://github.com/dart-lang/webdev description: >- @@ -14,7 +14,7 @@ dependencies: build_daemon: ^0.5.0 built_value: ^6.3.0 crypto: ^2.0.6 - dwds: ^0.2.0 + dwds: ^0.3.0 devtools: ^0.0.15-dev.1 http: ^0.12.0 io: ^0.3.2+1