From ae4f8623c42d649452c2beda3c83b7e98accf92c Mon Sep 17 00:00:00 2001 From: Jessy Yameogo Date: Wed, 19 Mar 2025 13:36:11 -0400 Subject: [PATCH 1/8] updated Dwds with bool that only enableDebuggingSupport when set to true --- dwds/lib/dart_web_debug_service.dart | 6 +++++- dwds/lib/src/handlers/injector.dart | 26 ++++++++++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/dwds/lib/dart_web_debug_service.dart b/dwds/lib/dart_web_debug_service.dart index c3b63d9bb..9c219f830 100644 --- a/dwds/lib/dart_web_debug_service.dart +++ b/dwds/lib/dart_web_debug_service.dart @@ -66,6 +66,7 @@ class Dwds { required Stream buildResults, required ConnectionProvider chromeConnection, required ToolConfiguration toolConfiguration, + bool enableDebuggingSupport = true, }) async { globalToolConfiguration = toolConfiguration; final debugSettings = toolConfiguration.debugSettings; @@ -117,7 +118,10 @@ class Dwds { _logger.info('Serving DevTools at $uri\n'); } - final injected = DwdsInjector(extensionUri: extensionUri); + final injected = DwdsInjector( + extensionUri: extensionUri, + enableDebuggingSupport: enableDebuggingSupport, + ); final devHandler = DevHandler( chromeConnection, diff --git a/dwds/lib/src/handlers/injector.dart b/dwds/lib/src/handlers/injector.dart index f8dc8aaf6..91253ce7e 100644 --- a/dwds/lib/src/handlers/injector.dart +++ b/dwds/lib/src/handlers/injector.dart @@ -32,8 +32,14 @@ class DwdsInjector { final Future? _extensionUri; final _devHandlerPaths = StreamController(); final _logger = Logger('DwdsInjector'); + final bool _enableDebuggingSupport; - DwdsInjector({Future? extensionUri}) : _extensionUri = extensionUri; + DwdsInjector({ + Future? extensionUri, + bool enableDebuggingSupport = true, + }) + : _extensionUri = extensionUri, + _enableDebuggingSupport = enableDebuggingSupport; /// Returns the embedded dev handler paths. /// @@ -95,13 +101,17 @@ class DwdsInjector { await globalToolConfiguration.loadStrategy.trackEntrypoint( entrypoint, ); - body = await _injectClientAndHoistMain( - body, - appId, - devHandlerPath, - entrypoint, - await _extensionUri, - ); + // If true, inject the debugging client and hoist the main function + // to enable debugging support. + if (_enableDebuggingSupport) { + body = await _injectClientAndHoistMain( + body, + appId, + devHandlerPath, + entrypoint, + await _extensionUri, + ); + } body += await globalToolConfiguration.loadStrategy.bootstrapFor( entrypoint, ); From a7df7640c56248904b4af23d5ae0f34167c6fb03 Mon Sep 17 00:00:00 2001 From: Jessy Yameogo Date: Wed, 19 Mar 2025 13:46:07 -0400 Subject: [PATCH 2/8] updated Changelog --- dwds/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index 7ff5a0d6c..56d4e2fa6 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -1,3 +1,7 @@ +## 24.3.8 + +- Updated DWDS to include a boolean flag that enables debugging support only when set to true. [#60289](https://github.com/dart-lang/sdk/issues/60289) + ## 24.3.7 - The registered extension `reassemble` is now no longer called when calling From 1ae7037fddb8ac0e26efdceb967a6f1d32cb9ec9 Mon Sep 17 00:00:00 2001 From: Jessy Yameogo Date: Wed, 19 Mar 2025 13:56:08 -0400 Subject: [PATCH 3/8] formatted file --- dwds/lib/src/handlers/injector.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dwds/lib/src/handlers/injector.dart b/dwds/lib/src/handlers/injector.dart index 91253ce7e..9f58dfb1b 100644 --- a/dwds/lib/src/handlers/injector.dart +++ b/dwds/lib/src/handlers/injector.dart @@ -37,8 +37,7 @@ class DwdsInjector { DwdsInjector({ Future? extensionUri, bool enableDebuggingSupport = true, - }) - : _extensionUri = extensionUri, + }) : _extensionUri = extensionUri, _enableDebuggingSupport = enableDebuggingSupport; /// Returns the embedded dev handler paths. From 7f3cb9099dc6c12999e9cadcc368cbb54ed25c7a Mon Sep 17 00:00:00 2001 From: Jessy Yameogo Date: Wed, 19 Mar 2025 13:59:54 -0400 Subject: [PATCH 4/8] updated dwds version in pubspec to 24.3.8 --- dwds/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml index 25af1f2b1..6836050e1 100644 --- a/dwds/pubspec.yaml +++ b/dwds/pubspec.yaml @@ -1,6 +1,6 @@ name: dwds # Every time this changes you need to run `dart run build_runner build`. -version: 24.3.7 +version: 24.3.8 description: >- A service that proxies between the Chrome debug protocol and the Dart VM service protocol. From d3df3f6b3f2daea12f75e65c863dc38dbcf46149 Mon Sep 17 00:00:00 2001 From: Jessy Yameogo Date: Wed, 19 Mar 2025 14:02:47 -0400 Subject: [PATCH 5/8] updated version.dart to 24.3.8 --- dwds/lib/src/version.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwds/lib/src/version.dart b/dwds/lib/src/version.dart index f47c50438..b4e574a30 100644 --- a/dwds/lib/src/version.dart +++ b/dwds/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '24.3.7'; +const packageVersion = '24.3.8'; From 0c109895ef6a7a7f0116b4c787ed1bbae85bdec5 Mon Sep 17 00:00:00 2001 From: Jessy Yameogo Date: Thu, 20 Mar 2025 12:45:36 -0400 Subject: [PATCH 6/8] updated docstring for DWDSInjector class --- dwds/lib/src/handlers/injector.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dwds/lib/src/handlers/injector.dart b/dwds/lib/src/handlers/injector.dart index 9f58dfb1b..ca9030553 100644 --- a/dwds/lib/src/handlers/injector.dart +++ b/dwds/lib/src/handlers/injector.dart @@ -26,8 +26,17 @@ const mainExtensionMarker = '/* MAIN_EXTENSION_MARKER */'; const _clientScript = 'dwds/src/injected/client'; -/// Handles injecting the DWDS client and embedding debugging related -/// information. +/// Handles injecting the DWDS client and embedding debugging-related information. +/// +/// This class is responsible for modifying the served JavaScript files +/// to include the injected DWDS client, enabling debugging capabilities +/// and source mapping when running in a browser environment. +/// +/// The `_enableDebuggingSupport` flag determines whether debugging-related +/// functionality should be included: +/// - When `true`, the DWDS client is injected, enabling debugging features. +/// - When `false`, debugging support is disabled, meaning the application will +/// run without debugging. class DwdsInjector { final Future? _extensionUri; final _devHandlerPaths = StreamController(); From 5b2fd2f4b9ee5d276705fb419b2c9daac7f3d6b5 Mon Sep 17 00:00:00 2001 From: Jessy Yameogo Date: Thu, 20 Mar 2025 12:47:23 -0400 Subject: [PATCH 7/8] updated docstring for DWDSInjector class --- dwds/lib/src/handlers/injector.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dwds/lib/src/handlers/injector.dart b/dwds/lib/src/handlers/injector.dart index ca9030553..1b998e2d6 100644 --- a/dwds/lib/src/handlers/injector.dart +++ b/dwds/lib/src/handlers/injector.dart @@ -37,6 +37,9 @@ const _clientScript = 'dwds/src/injected/client'; /// - When `true`, the DWDS client is injected, enabling debugging features. /// - When `false`, debugging support is disabled, meaning the application will /// run without debugging. +/// +/// This separation allows for scenarios where debugging is not needed or +/// should be explicitly avoided. class DwdsInjector { final Future? _extensionUri; final _devHandlerPaths = StreamController(); From b64229237cbfb74740beb55c1a554426e7189de3 Mon Sep 17 00:00:00 2001 From: Jessy Yameogo Date: Thu, 20 Mar 2025 12:50:06 -0400 Subject: [PATCH 8/8] modified docstring --- dwds/lib/src/handlers/injector.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/dwds/lib/src/handlers/injector.dart b/dwds/lib/src/handlers/injector.dart index 1b998e2d6..3686c4f60 100644 --- a/dwds/lib/src/handlers/injector.dart +++ b/dwds/lib/src/handlers/injector.dart @@ -26,8 +26,6 @@ const mainExtensionMarker = '/* MAIN_EXTENSION_MARKER */'; const _clientScript = 'dwds/src/injected/client'; -/// Handles injecting the DWDS client and embedding debugging-related information. -/// /// This class is responsible for modifying the served JavaScript files /// to include the injected DWDS client, enabling debugging capabilities /// and source mapping when running in a browser environment.