Skip to content

Commit af4f628

Browse files
committed
Merge package:stream_channel into the tools monorepo
2 parents faf2b86 + 7808a88 commit af4f628

34 files changed

+3281
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Dependabot configuration file.
2+
# See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates
3+
version: 2
4+
5+
updates:
6+
- package-ecosystem: github-actions
7+
directory: /
8+
schedule:
9+
interval: monthly
10+
labels:
11+
- autosubmit
12+
groups:
13+
github-actions:
14+
patterns:
15+
- "*"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# A workflow to close issues where the author hasn't responded to a request for
2+
# more information; see https://github.com/actions/stale.
3+
4+
name: No Response
5+
6+
# Run as a daily cron.
7+
on:
8+
schedule:
9+
# Every day at 8am
10+
- cron: '0 8 * * *'
11+
12+
# All permissions not specified are set to 'none'.
13+
permissions:
14+
issues: write
15+
pull-requests: write
16+
17+
jobs:
18+
no-response:
19+
runs-on: ubuntu-latest
20+
if: ${{ github.repository_owner == 'dart-lang' }}
21+
steps:
22+
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e
23+
with:
24+
# Don't automatically mark inactive issues+PRs as stale.
25+
days-before-stale: -1
26+
# Close needs-info issues and PRs after 14 days of inactivity.
27+
days-before-close: 14
28+
stale-issue-label: "needs-info"
29+
close-issue-message: >
30+
Without additional information we're not able to resolve this issue.
31+
Feel free to add more info or respond to any questions above and we
32+
can reopen the case. Thanks for your contribution!
33+
stale-pr-label: "needs-info"
34+
close-pr-message: >
35+
Without additional information we're not able to resolve this PR.
36+
Feel free to add more info or respond to any questions above.
37+
Thanks for your contribution!
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# A CI configuration to auto-publish pub packages.
2+
3+
name: Publish
4+
5+
on:
6+
pull_request:
7+
branches: [ master ]
8+
push:
9+
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
10+
11+
jobs:
12+
publish:
13+
if: ${{ github.repository_owner == 'dart-lang' }}
14+
uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main
15+
permissions:
16+
id-token: write # Required for authentication using OIDC
17+
pull-requests: write # Required for writing the pull request note
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Dart CI
2+
3+
on:
4+
# Run on PRs and pushes to the default branch.
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
9+
schedule:
10+
- cron: "0 0 * * 0"
11+
12+
env:
13+
PUB_ENVIRONMENT: bot.github
14+
15+
jobs:
16+
# Check code formatting and static analysis on a single OS (linux)
17+
# against Dart dev.
18+
analyze:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
sdk: [dev]
24+
steps:
25+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
26+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
27+
with:
28+
sdk: ${{ matrix.sdk }}
29+
- id: install
30+
name: Install dependencies
31+
run: dart pub get
32+
- name: Check formatting
33+
run: dart format --output=none --set-exit-if-changed .
34+
if: always() && steps.install.outcome == 'success'
35+
- name: Analyze code
36+
run: dart analyze --fatal-infos
37+
if: always() && steps.install.outcome == 'success'
38+
39+
# Run tests on a matrix consisting of two dimensions:
40+
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
41+
# 2. release channel: dev
42+
test:
43+
needs: analyze
44+
runs-on: ${{ matrix.os }}
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
# Add macos-latest and/or windows-latest if relevant for this package.
49+
os: [ubuntu-latest]
50+
sdk: [3.3, dev]
51+
steps:
52+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
53+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
54+
with:
55+
sdk: ${{ matrix.sdk }}
56+
- id: install
57+
name: Install dependencies
58+
run: dart pub get
59+
- name: Run VM tests
60+
run: dart test --platform vm
61+
if: always() && steps.install.outcome == 'success'
62+
- name: Run Chrome tests
63+
run: dart test --platform chrome
64+
if: always() && steps.install.outcome == 'success'

pkgs/stream_channel/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.buildlog
2+
.dart_tool/
3+
.DS_Store
4+
.idea
5+
.pub/
6+
.settings/
7+
build/
8+
packages
9+
.packages
10+
pubspec.lock

pkgs/stream_channel/AUTHORS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Below is a list of people and organizations that have contributed
2+
# to the project. Names should be added to the list like so:
3+
#
4+
# Name/Organization <email address>
5+
6+
Google Inc.

pkgs/stream_channel/CHANGELOG.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
## 2.1.3-wip
2+
3+
* Require Dart 3.3
4+
5+
## 2.1.2
6+
7+
* Require Dart 2.19
8+
* Add an example.
9+
* Fix a race condition in `IsolateChannel.connectReceive()` where the channel
10+
could hang forever if its sink was closed before the connection was established.
11+
12+
## 2.1.1
13+
14+
* Require Dart 2.14
15+
* Populate the pubspec `repository` field.
16+
* Handle multichannel messages where the ID element is a `double` at runtime
17+
instead of an `int`. When reading an array with `dart2wasm` numbers within the
18+
array are parsed as `double`.
19+
20+
## 2.1.0
21+
22+
* Stable release for null safety.
23+
24+
## 2.0.0
25+
26+
**Breaking changes**
27+
28+
* `IsolateChannel` requires a separate import
29+
`package:stram_channel/isolate_channel.dart`.
30+
`package:stream_channel/stream_channel.dart` will now not trigger any platform
31+
concerns due to importing `dart:isolate`.
32+
* Remove `JsonDocumentTransformer` class. The `jsonDocument` top level is still
33+
available.
34+
* Remove `StreamChannelTransformer.typed`. Use `.cast` on the transformed
35+
channel instead.
36+
* Change `Future<dynamic>` returns to `Future<void>`.
37+
38+
## 1.7.0
39+
40+
* Make `IsolateChannel` available through
41+
`package:stream_channel/isolate_channel.dart`. This will be the required
42+
import in the next release.
43+
* Require `2.0.0` or newer SDK.
44+
* Internal style changes.
45+
46+
## 1.6.8
47+
48+
* Set max SDK version to `<3.0.0`, and adjust other dependencies.
49+
50+
## 1.6.7+1
51+
52+
* Fix Dart 2 runtime types in `IsolateChannel`.
53+
54+
## 1.6.7
55+
56+
* Update SDK version to 2.0.0-dev.17.0.
57+
* Add a type argument to `MultiChannel`.
58+
59+
## 1.6.6
60+
61+
* Fix a Dart 2 issue with inner stream transformation in `GuaranteeChannel`.
62+
63+
* Fix a Dart 2 issue with `StreamChannelTransformer.fromCodec()`.
64+
65+
## 1.6.5
66+
67+
* Fix an issue with `JsonDocumentTransformer.bind` where it created an internal
68+
stream channel which didn't get a properly inferred type for its `sink`.
69+
70+
## 1.6.4
71+
72+
* Fix a race condition in `MultiChannel` where messages from a remote virtual
73+
channel could get dropped if the corresponding local channel wasn't registered
74+
quickly enough.
75+
76+
## 1.6.3
77+
78+
* Use `pumpEventQueue()` from test.
79+
80+
## 1.6.2
81+
82+
* Declare support for `async` 2.0.0.
83+
84+
## 1.6.1
85+
86+
* Fix the type of `StreamChannel.transform()`. This previously inverted the
87+
generic parameters, so it only really worked with transformers where both
88+
generic types were identical.
89+
90+
## 1.6.0
91+
92+
* `Disconnector.disconnect()` now returns a future that completes when all the
93+
inner `StreamSink.close()` futures have completed.
94+
95+
## 1.5.0
96+
97+
* Add `new StreamChannel.withCloseGuarantee()` to provide the specific guarantee
98+
that closing the sink causes the stream to close before it emits any more
99+
events. This is the only guarantee that isn't automatically preserved when
100+
transforming a channel.
101+
102+
* `StreamChannelTransformer`s provided by the `stream_channel` package now
103+
properly provide the guarantee that closing the sink causes the stream to
104+
close before it emits any more events
105+
106+
## 1.4.0
107+
108+
* Add `StreamChannel.cast()`, which soundly coerces the generic type of a
109+
channel.
110+
111+
* Add `StreamChannelTransformer.typed()`, which soundly coerces the generic type
112+
of a transformer.
113+
114+
## 1.3.2
115+
116+
* Fix all strong-mode errors and warnings.
117+
118+
## 1.3.1
119+
120+
* Make `IsolateChannel` slightly more efficient.
121+
122+
* Make `MultiChannel` follow the stream channel rules.
123+
124+
## 1.3.0
125+
126+
* Add `Disconnector`, a transformer that allows the caller to disconnect the
127+
transformed channel.
128+
129+
## 1.2.0
130+
131+
* Add `new StreamChannel.withGuarantees()`, which creates a channel with extra
132+
wrapping to ensure that it obeys the stream channel guarantees.
133+
134+
* Add `StreamChannelController`, which can be used to create custom
135+
`StreamChannel` objects.
136+
137+
## 1.1.1
138+
139+
* Fix the type annotation for `StreamChannel.transform()`'s parameter.
140+
141+
## 1.1.0
142+
143+
* Add `StreamChannel.transformStream()`, `StreamChannel.transformSink()`,
144+
`StreamChannel.changeStream()`, and `StreamChannel.changeSink()` to support
145+
changing only the stream or only the sink of a channel.
146+
147+
* Be more explicit about `JsonDocumentTransformer`'s error-handling behavior.
148+
149+
## 1.0.1
150+
151+
* Fix `MultiChannel`'s constructor to take a `StreamChannel`. This is
152+
technically a breaking change, but since 1.0.0 was only released an hour ago,
153+
we're treating it as a bug fix.
154+
155+
## 1.0.0
156+
157+
* Initial version

pkgs/stream_channel/CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Want to contribute? Great! First, read this page (including the small print at
2+
the end).
3+
4+
### Before you contribute
5+
Before we can use your code, you must sign the
6+
[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual)
7+
(CLA), which you can do online. The CLA is necessary mainly because you own the
8+
copyright to your changes, even after your contribution becomes part of our
9+
codebase, so we need your permission to use and distribute your code. We also
10+
need to be sure of various other things—for instance that you'll tell us if you
11+
know that your code infringes on other people's patents. You don't have to sign
12+
the CLA until after you've submitted your code for review and a member has
13+
approved it, but you must do it before we can put your code into our codebase.
14+
15+
Before you start working on a larger contribution, you should get in touch with
16+
us first through the issue tracker with your idea so that we can help out and
17+
possibly guide you. Coordinating up front makes it much easier to avoid
18+
frustration later on.
19+
20+
### Code reviews
21+
All submissions, including submissions by project members, require review.
22+
23+
### File headers
24+
All files in the project must start with the following header.
25+
26+
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
27+
// for details. All rights reserved. Use of this source code is governed by a
28+
// BSD-style license that can be found in the LICENSE file.
29+
30+
### The small print
31+
Contributions made by corporations are covered by a different agreement than the
32+
one above, the
33+
[Software Grant and Corporate Contributor License Agreement](https://developers.google.com/open-source/cla/corporate).

pkgs/stream_channel/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2015, the Dart project authors.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following
11+
disclaimer in the documentation and/or other materials provided
12+
with the distribution.
13+
* Neither the name of Google LLC nor the names of its
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pkgs/stream_channel/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[![Dart CI](https://github.com/dart-lang/stream_channel/actions/workflows/test-package.yml/badge.svg)](https://github.com/dart-lang/stream_channel/actions/workflows/test-package.yml)
2+
[![pub package](https://img.shields.io/pub/v/stream_channel.svg)](https://pub.dev/packages/stream_channel)
3+
[![package publisher](https://img.shields.io/pub/publisher/stream_channel.svg)](https://pub.dev/packages/stream_channel/publisher)
4+
5+
This package exposes the `StreamChannel` interface, which represents a two-way
6+
communication channel. Each `StreamChannel` exposes a `Stream` for receiving
7+
data and a `StreamSink` for sending it.
8+
9+
`StreamChannel` helps abstract communication logic away from the underlying
10+
protocol. For example, the [`test`][test] package re-uses its test suite
11+
communication protocol for both WebSocket connections to browser suites and
12+
Isolate connections to VM tests.
13+
14+
[test]: https://pub.dev/packages/test
15+
16+
This package also contains utilities for dealing with `StreamChannel`s and with
17+
two-way communications in general. For documentation of these utilities, see
18+
[the API docs][api].
19+
20+
[api]: https://pub.dev/documentation/stream_channel/latest/

0 commit comments

Comments
 (0)