Fix StateError during AOT execution by statically compiling injected client payload (#2804)

This PR resolves an issue where `webdev serve` crashes with a `StateError` when attempting to load `client.js` in AOT-compiled environments. 

**Root Cause:**
Previously, `DwdsInjector` relied on `Isolate.resolvePackageUri` to dynamically locate the `dwds` package on the file system at runtime. This fails within AOT snapshots because the injected client could not be resolved.

**Changes:**
- Bypassed the need for dynamic runtime file resolution by generating a statically compiled asset.
- Updated `tool/build.dart` to automatically bundle the transpiled `client.js` into a new `lib/src/handlers/injected_client_js.dart` file. The Javascript payload is encoded line-by-line using `jsonEncode` to preserve code readability.
- Refactored the `DwdsInjector` middleware to serve the statically guaranteed memory string.
- Added verification tests to enforce strict checksum equivalency between `client.js` file and generated `injected_client_js.dart`.

Related to https://github.com/dart-lang/webdev/issues/2761
11 files changed
tree: c147c075373e115f4b149383b56aa9efc945abd2
  1. .github/
  2. _analysis_config/
  3. debug_extension/
  4. dwds/
  5. dwds_test_common/
  6. example/
  7. frontend_server_client/
  8. tool/
  9. webdev/
  10. .gitattributes
  11. .gitignore
  12. AUTHORS
  13. CONTRIBUTING.md
  14. mono_repo.yaml
  15. README.md
README.md

Dart

Packages

PackageDescriptionVersion
dwdsA service that proxies between the Chrome debug protocol and the Dart VM service protocol.pub package
frontend_server_clientClient code to start and interact with the frontend_server compiler from the Dart SDK.pub package
webdevA CLI for Dart web development. Provides an easy and consistent set of features for users and tools to build and deploy web applications with Dart.pub package

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.