Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support latest pkg:shelf_web_socket #3837

Merged
merged 1 commit into from
Feb 10, 2025
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
4 changes: 4 additions & 0 deletions build_daemon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.0.4

- Support the latest `package:shelf_web_socket`.

## 4.0.3

- Bump the min sdk to 3.6.0.
Expand Down
6 changes: 3 additions & 3 deletions build_daemon/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build_daemon
version: 4.0.3
version: 4.0.4
description: A daemon for running Dart builds.
repository: https://github.com/dart-lang/build/tree/master/build_daemon
resolution: workspace
Expand All @@ -16,10 +16,10 @@ dependencies:
path: ^1.8.0
pool: ^1.5.0
shelf: ^1.0.0
shelf_web_socket: ">=1.0.0 <3.0.0"
shelf_web_socket: ">=1.0.0 <4.0.0"
stream_transform: ^2.0.0
watcher: ^1.0.0
web_socket_channel: ">=2.0.0 <4.0.0"
web_socket_channel: ">=2.3.0 <4.0.0"

dev_dependencies:
analyzer: '>=3.4.0 <8.0.0'
Expand Down
3 changes: 2 additions & 1 deletion build_runner/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.4.15-wip
## 2.4.15

- Update to package:web and dart:js_interop.
- Support the latest `package:shelf_web_socket`.

## 2.4.14

Expand Down
10 changes: 6 additions & 4 deletions build_runner/lib/src/server/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,10 @@ class ServeHandler implements BuildState {
/// build updates
class BuildUpdatesWebSocketHandler {
final connectionsByRootDir = <String, List<WebSocketChannel>>{};
final shelf.Handler Function(Function, {Iterable<String> protocols})
_handlerFactory;
final shelf.Handler Function(
void Function(WebSocketChannel webSocket, String? subprotocol), {
Iterable<String> protocols,
}) _handlerFactory;
final _internalHandlers = <String, shelf.Handler>{};
final WatchImpl _state;

Expand All @@ -208,7 +210,7 @@ class BuildUpdatesWebSocketHandler {

shelf.Handler createHandlerByRootDir(String rootDir) {
if (!_internalHandlers.containsKey(rootDir)) {
void closureForRootDir(WebSocketChannel webSocket, String protocol) =>
void closureForRootDir(WebSocketChannel webSocket, String? protocol) =>
_handleConnection(webSocket, protocol, rootDir);
_internalHandlers[rootDir] = _handlerFactory(closureForRootDir,
protocols: [_buildUpdatesProtocol]);
Expand Down Expand Up @@ -239,7 +241,7 @@ class BuildUpdatesWebSocketHandler {
}

void _handleConnection(
WebSocketChannel webSocket, String protocol, String rootDir) async {
WebSocketChannel webSocket, String? protocol, String rootDir) async {
var connections = connectionsByRootDir.putIfAbsent(rootDir, () => [])
..add(webSocket);
await webSocket.stream.drain<void>();
Expand Down
6 changes: 3 additions & 3 deletions build_runner/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build_runner
version: 2.4.15-wip
version: 2.4.15
description: A build system for Dart code generation and modular compilation.
repository: https://github.com/dart-lang/build/tree/master/build_runner
resolution: workspace
Expand Down Expand Up @@ -41,13 +41,13 @@ dependencies:
pub_semver: ^2.0.0
pubspec_parse: ^1.0.0
shelf: ^1.0.0
shelf_web_socket: ">=1.0.0 <3.0.0"
shelf_web_socket: ">=1.0.0 <4.0.0"
stack_trace: ^1.10.0
stream_transform: ^2.0.0
timing: ^1.0.0
watcher: ^1.0.0
web: ^1.1.0
web_socket_channel: ">=2.0.0 <4.0.0"
web_socket_channel: ">=2.3.0 <4.0.0"
yaml: ^3.0.0

dev_dependencies:
Expand Down