2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
- // @dart = 2.9
6
-
7
5
import 'dart:async' ;
8
6
9
7
import 'package:logging/logging.dart' ;
10
- import 'package:meta/meta.dart' ;
11
8
import 'package:shelf/shelf.dart' ;
12
9
import 'package:sse/server/sse_handler.dart' ;
13
10
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' ;
@@ -33,7 +30,7 @@ class Dwds {
33
30
static final _logger = Logger ('DWDS' );
34
31
final Middleware middleware;
35
32
final Handler handler;
36
- final DevTools _devTools;
33
+ final DevTools ? _devTools;
37
34
final DevHandler _devHandler;
38
35
final AssetReader _assetReader;
39
36
final bool _enableDebugging;
@@ -67,53 +64,42 @@ class Dwds {
67
64
}
68
65
69
66
static Future <Dwds > start ({
70
- @ required AssetReader assetReader,
71
- @ required Stream <BuildResult > buildResults,
72
- @ required ConnectionProvider chromeConnection,
73
- @ required LoadStrategy loadStrategy,
74
- @ required bool enableDebugging,
67
+ required AssetReader assetReader,
68
+ required Stream <BuildResult > buildResults,
69
+ required ConnectionProvider chromeConnection,
70
+ required LoadStrategy loadStrategy,
71
+ required bool enableDebugging,
75
72
// TODO(annagrin): make expressionCompiler argument required
76
73
// [issue 881](https://github.com/dart-lang/webdev/issues/881)
77
- ExpressionCompiler expressionCompiler,
78
- bool enableDebugExtension,
79
- String hostname,
80
- bool useSseForDebugProxy,
81
- bool useSseForDebugBackend,
82
- bool useSseForInjectedClient,
83
- UrlEncoder urlEncoder,
84
- bool spawnDds,
74
+ ExpressionCompiler ? expressionCompiler,
75
+ bool enableDebugExtension = false ,
76
+ String hostname = 'localhost' ,
77
+ bool useSseForDebugProxy = true ,
78
+ bool useSseForDebugBackend = true ,
79
+ bool useSseForInjectedClient = true ,
80
+ UrlEncoder ? urlEncoder,
81
+ bool spawnDds = true ,
85
82
// TODO(elliette): DevTools is inconsistently capitalized throughout this
86
- // file. Change all occurances of devtools/Devtools to devTools/DevTools.
87
- bool enableDevtoolsLaunch,
88
- DevtoolsLauncher devtoolsLauncher,
89
- bool launchDevToolsInNewWindow,
90
- SdkConfigurationProvider sdkConfigurationProvider,
91
- bool emitDebugEvents,
83
+ // file. Change all occurrences of devtools/Devtools to devTools/DevTools.
84
+ bool enableDevtoolsLaunch = true ,
85
+ DevtoolsLauncher ? devtoolsLauncher,
86
+ bool launchDevToolsInNewWindow = true ,
87
+ SdkConfigurationProvider ? sdkConfigurationProvider,
88
+ bool emitDebugEvents = true ,
92
89
}) async {
93
- hostname ?? = 'localhost' ;
94
- enableDebugging ?? = true ;
95
- enableDebugExtension ?? = false ;
96
- useSseForDebugProxy ?? = true ;
97
- useSseForDebugBackend ?? = true ;
98
- useSseForInjectedClient ?? = true ;
99
- enableDevtoolsLaunch ?? = true ;
100
- launchDevToolsInNewWindow ?? = true ;
101
- spawnDds ?? = true ;
102
90
globalLoadStrategy = loadStrategy;
103
- emitDebugEvents ?? = true ;
104
-
105
91
sdkConfigurationProvider ?? = DefaultSdkConfigurationProvider ();
106
92
107
- DevTools devTools;
108
- Future <String > extensionUri;
109
- ExtensionBackend extensionBackend;
93
+ DevTools ? devTools;
94
+ Future <String >? extensionUri;
95
+ ExtensionBackend ? extensionBackend;
110
96
if (enableDebugExtension) {
111
97
final handler = useSseForDebugBackend
112
98
? SseSocketHandler (SseHandler (Uri .parse ('/\$ debug' ),
113
99
// Proxy servers may actively kill long standing connections.
114
100
// Allow for clients to reconnect in a short window. Making the
115
101
// window too long may cause issues if the user closes a debug
116
- // session and initites a new one during the keepAlive window.
102
+ // session and initiates a new one during the keepAlive window.
117
103
keepAlive: const Duration (seconds: 5 )))
118
104
: WebSocketSocketHandler ();
119
105
@@ -154,7 +140,6 @@ class Dwds {
154
140
urlEncoder,
155
141
useSseForDebugProxy,
156
142
useSseForInjectedClient,
157
- serveDevTools,
158
143
expressionCompiler,
159
144
injected,
160
145
spawnDds,
0 commit comments