Skip to content

Commit f750e21

Browse files
authored
Update webdev dwds version (#336)
1 parent 865a98a commit f750e21

File tree

7 files changed

+32
-24
lines changed

7 files changed

+32
-24
lines changed

webdev/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.2
2+
3+
- Support `package:dwds` version `0.3.0`.
4+
15
## 2.0.1
26

37
- Fix launching Chrome on Windows.

webdev/lib/src/daemon/app_domain.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ class AppDomain extends Domain {
6767
_appDebugServices = await devHandler.loadAppServices(
6868
connection.request.appId, connection.request.instanceId);
6969
_appId = connection.request.appId;
70-
unawaited(_appDebugServices
71-
.debugService.chromeProxyService.tabConnection.onClose.first
70+
unawaited(_appDebugServices.chromeProxyService.tabConnection.onClose.first
7271
.then((_) {
7372
sendEvent('app.log', {
7473
'appId': _appId,
@@ -176,8 +175,7 @@ class AppDomain extends Domain {
176175
Future<bool> _stop(Map<String, dynamic> args) async {
177176
var appId = getStringArg(args, 'appId', required: true);
178177
if (_appId != appId) throw ArgumentError.value(appId, 'appId', 'Not found');
179-
await _appDebugServices.debugService.chromeProxyService.tabConnection
180-
.close();
178+
await _appDebugServices.chromeProxyService.tabConnection.close();
181179
return true;
182180
}
183181

webdev/lib/src/serve/debugger/app_debug_services.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
import 'dart:async';
66
import 'package:dwds/service.dart';
7+
// ignore: implementation_imports
8+
import 'package:dwds/src/chrome_proxy_service.dart' show ChromeProxyService;
79

810
import '../../serve/chrome.dart';
911
import '../debugger/webdev_vm_client.dart';
@@ -14,6 +16,9 @@ class AppDebugServices {
1416
final DebugService debugService;
1517
final WebdevVmClient webdevClient;
1618

19+
ChromeProxyService get chromeProxyService =>
20+
debugService.chromeProxyService as ChromeProxyService;
21+
1722
/// The instance ID for the currently connected application, if there is one.
1823
///
1924
/// We only allow a given app to be debugged in a single tab at a time.

webdev/lib/src/serve/debugger/webdev_vm_client.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import 'dart:async';
66
import 'dart:convert';
77

88
import 'package:dwds/service.dart';
9+
// ignore: implementation_imports
10+
import 'package:dwds/src/chrome_proxy_service.dart' show ChromeProxyService;
911
import 'package:pedantic/pedantic.dart';
1012
import 'package:vm_service_lib/vm_service_lib.dart';
1113

@@ -35,13 +37,13 @@ class WebdevVmClient {
3537
responseController.stream.map(jsonEncode),
3638
(request) => requestController.sink
3739
.add(jsonDecode(request) as Map<String, dynamic>));
40+
var chromeProxyService =
41+
debugService.chromeProxyService as ChromeProxyService;
3842
client.registerServiceCallback('hotRestart', (request) async {
39-
debugService.chromeProxyService.destroyIsolate();
40-
var response = await debugService.chromeProxyService.tabConnection.runtime
41-
.sendCommand('Runtime.evaluate', params: {
42-
'expression': r'$dartHotRestart();',
43-
'awaitPromise': true
44-
});
43+
chromeProxyService.destroyIsolate();
44+
var response = await chromeProxyService.tabConnection.runtime.sendCommand(
45+
'Runtime.evaluate',
46+
params: {'expression': r'$dartHotRestart();', 'awaitPromise': true});
4547
var exceptionDetails = response.result['exceptionDetails'];
4648
if (exceptionDetails != null) {
4749
return {
@@ -52,7 +54,7 @@ class WebdevVmClient {
5254
}
5355
};
5456
} else {
55-
unawaited(debugService.chromeProxyService.createIsolate());
57+
unawaited(chromeProxyService.createIsolate());
5658
return {'result': Success().toJson()};
5759
}
5860
});

webdev/lib/src/serve/handlers/dev_handler.dart

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class DevHandler {
139139
// If you load the same app in a different tab then we need to throw
140140
// away our old services and start new ones.
141141
if (!(await _isCorrectTab(message.instanceId,
142-
appServices.debugService.chromeProxyService.tabConnection))) {
142+
appServices.chromeProxyService.tabConnection))) {
143143
unawaited(appServices.close());
144144
unawaited(_servicesByAppId.remove(message.appId));
145145
appServices =
@@ -150,10 +150,9 @@ class DevHandler {
150150
.serialize(DevToolsResponse((b) => b..success = true))));
151151

152152
appServices.connectedInstanceId = message.instanceId;
153-
await appServices.debugService.chromeProxyService.tabConnection.runtime
154-
.evaluate(
155-
'window.open("http://${_devTools.hostname}:${_devTools.port}'
156-
'/?uri=${appServices.debugService.wsUri}", "", "_blank")');
153+
await appServices.chromeProxyService.tabConnection.runtime.evaluate(
154+
'window.open("http://${_devTools.hostname}:${_devTools.port}'
155+
'/?uri=${appServices.debugService.wsUri}", "", "_blank")');
157156
} else if (message is ConnectRequest) {
158157
if (appId != null) {
159158
throw StateError('Duplicate connection request from the same app. '
@@ -168,10 +167,10 @@ class DevHandler {
168167
if (services != null && services.connectedInstanceId == null) {
169168
// Re-connect to the previous instance if its in the same tab,
170169
// otherwise do nothing for now.
171-
if (await _isCorrectTab(message.instanceId,
172-
services.debugService.chromeProxyService.tabConnection)) {
170+
if (await _isCorrectTab(
171+
message.instanceId, services.chromeProxyService.tabConnection)) {
173172
services.connectedInstanceId = message.instanceId;
174-
await services.debugService.chromeProxyService.createIsolate();
173+
await services.chromeProxyService.createIsolate();
175174
}
176175
}
177176

@@ -184,7 +183,7 @@ class DevHandler {
184183
if (appId != null) {
185184
var services = await _servicesByAppId[appId];
186185
services?.connectedInstanceId = null;
187-
services?.debugService?.chromeProxyService?.destroyIsolate();
186+
services?.chromeProxyService?.destroyIsolate();
188187
}
189188
}));
190189
}
@@ -210,7 +209,7 @@ class DevHandler {
210209
var appServices = AppDebugServices(chrome, debugService, webdevClient);
211210

212211
unawaited(
213-
debugService.chromeProxyService.tabConnection.onClose.first.then((_) {
212+
appServices.chromeProxyService.tabConnection.onClose.first.then((_) {
214213
appServices.close();
215214
_servicesByAppId.remove(appId);
216215
logHandler(

webdev/lib/src/version.dart

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webdev/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: webdev
2-
version: 2.0.1
2+
version: 2.0.2
33
author: Dart Team <misc@dartlang.org>
44
homepage: https://github.com/dart-lang/webdev
55
description: >-
@@ -14,7 +14,7 @@ dependencies:
1414
build_daemon: ^0.5.0
1515
built_value: ^6.3.0
1616
crypto: ^2.0.6
17-
dwds: ^0.2.0
17+
dwds: ^0.3.0
1818
devtools: ^0.0.15-dev.1
1919
http: ^0.12.0
2020
io: ^0.3.2+1

0 commit comments

Comments
 (0)