Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions dwds/lib/dwds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'src/handlers/asset_handler.dart';
import 'src/handlers/dev_handler.dart';
import 'src/handlers/injected_handler.dart';
import 'src/servers/devtools.dart';
import 'src/servers/extension_backend.dart';

export 'src/connections/app_connection.dart' show AppConnection;
export 'src/connections/debug_connection.dart' show DebugConnection;
Expand Down Expand Up @@ -56,7 +57,11 @@ class Dwds {
@required bool serveDevTools,
@required LogWriter logWriter,
@required bool verbose,
@optional bool enableDebugExtension,
}) async {
String extensionHostname;
int extensionPort;
enableDebugExtension ??= false;
var assetHandler = AssetHandler(
assetServerPort,
applicationTarget,
Expand All @@ -66,8 +71,14 @@ class Dwds {
var cascade = Cascade();
var pipeline = const Pipeline();

pipeline =
pipeline.addMiddleware(createInjectedHandler(reloadConfiguration));
if (enableDebugExtension) {
var extensionBackend = await ExtensionBackend.start();
extensionHostname = extensionBackend.hostname;
extensionPort = extensionBackend.port;
}

pipeline = pipeline.addMiddleware(createInjectedHandler(reloadConfiguration,
extensionHostname: extensionHostname, extensionPort: extensionPort));

DevTools devTools;
if (serveDevTools) {
Expand Down
5 changes: 2 additions & 3 deletions webdev/lib/src/serve/webdev_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ class WebDevServer {
}

static Future<WebDevServer> start(
ServerOptions options,
Stream<BuildResults> buildResults,
) async {
ServerOptions options, Stream<BuildResults> buildResults) async {
var pipeline = const Pipeline();

if (options.configuration.logRequests) {
Expand All @@ -87,6 +85,7 @@ class WebDevServer {
reloadConfiguration: options.configuration.reload,
serveDevTools: options.configuration.debug,
verbose: options.configuration.verbose,
enableDebugExtension: options.configuration.debugExtension,
);

var hostname = options.configuration.hostname;
Expand Down