Skip to content

Commit 1c37128

Browse files
authored
Require Dart 2.19, latest lints, support latest pkg:http (#360)
1 parent e7bab95 commit 1c37128

34 files changed

+232
-126
lines changed

.github/workflows/dart.yml

Lines changed: 53 additions & 53 deletions
Large diffs are not rendered by default.

pkgs/shelf/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.4.2-dev
2+
3+
* Require Dart >= 2.19
4+
15
## 1.4.1
26

37
* Added package topics to the pubspec file.

pkgs/shelf/lib/shelf_io.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
/// (the default), streamed responses will be buffered to improve performance.
2020
/// If `false`, all chunks will be pushed over the wire as they're received.
2121
/// See [HttpResponse.bufferOutput] for more information.
22+
library;
23+
2224
import 'dart:async';
2325
import 'dart:io';
2426

pkgs/shelf/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: shelf
2-
version: 1.4.1
2+
version: 1.4.2-dev
33
description: >
44
A model for web server middleware that encourages composition and easy reuse.
55
repository: https://github.com/dart-lang/shelf/tree/master/pkgs/shelf
@@ -9,7 +9,7 @@ topics:
99
- shelf
1010

1111
environment:
12-
sdk: '>=2.17.0 <3.0.0'
12+
sdk: '>=2.19.0 <3.0.0'
1313

1414
dependencies:
1515
async: ^2.5.0
@@ -20,6 +20,6 @@ dependencies:
2020
stream_channel: ^2.1.0
2121

2222
dev_dependencies:
23-
dart_flutter_team_lints: ^0.1.0
24-
http: ^0.13.0
23+
dart_flutter_team_lints: ^1.0.0
24+
http: '>=0.13.0 <2.0.0'
2525
test: ^1.16.0

pkgs/shelf/test/io_server_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
@TestOn('vm')
6+
library;
7+
68
import 'dart:async';
79
import 'dart:io';
810

pkgs/shelf/test/shelf_io_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
@TestOn('vm')
6+
library;
7+
68
import 'dart:async';
79
import 'dart:convert';
810
import 'dart:io';

pkgs/shelf_packages_handler/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.0.3-dev
2+
3+
* Require Dart `2.19`.
4+
15
## 3.0.2
26

37
* Added package topics to the pubspec file.

pkgs/shelf_packages_handler/lib/shelf_packages_handler.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library shelf_packages_handler;
6-
75
import 'package:shelf/shelf.dart';
86

97
import 'src/dir_handler.dart';
@@ -31,4 +29,4 @@ Handler packagesHandler({Map<String, Uri>? packageMap}) =>
3129
/// This is useful for ensuring that `package:` imports work for all entrypoints
3230
/// in Dartium.
3331
Handler packagesDirHandler({Map<String, Uri>? packageMap}) =>
34-
DirHandler('packages', packagesHandler(packageMap: packageMap));
32+
DirHandler('packages', packagesHandler(packageMap: packageMap)).call;

pkgs/shelf_packages_handler/lib/src/dir_handler.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library shelf_packages_handler.dir_handler;
6-
75
import 'dart:async';
86

97
import 'package:path/path.dart' as p;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: shelf_packages_handler
2-
version: 3.0.2
2+
version: 3.0.3-dev
33
description: A shelf handler for serving a `packages/` directory.
44
repository: https://github.com/dart-lang/shelf/tree/master/pkgs/shelf_packages_handler
55

@@ -8,13 +8,13 @@ topics:
88
- shelf
99

1010
environment:
11-
sdk: '>=2.17.0 <3.0.0'
11+
sdk: '>=2.19.0 <3.0.0'
1212

1313
dependencies:
1414
path: ^1.8.0
1515
shelf: ^1.0.0
1616
shelf_static: ^1.0.0
1717

1818
dev_dependencies:
19-
dart_flutter_team_lints: ^0.1.0
19+
dart_flutter_team_lints: ^1.0.0
2020
test: ^1.16.0

pkgs/shelf_proxy/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.0.4
2+
3+
* Require Dart `2.19`.
4+
* Allow `package:http` v1.0.0
5+
16
## 1.0.3
27

38
* Added package topics to the pubspec file.

pkgs/shelf_proxy/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: shelf_proxy
2-
version: 1.0.3
2+
version: 1.0.4
33
description: A shelf handler for proxying HTTP requests to another server.
44
repository: https://github.com/dart-lang/shelf/tree/master/pkgs/shelf_proxy
55

@@ -8,13 +8,13 @@ topics:
88
- shelf
99

1010
environment:
11-
sdk: '>=2.17.0 <3.0.0'
11+
sdk: '>=2.19.0 <3.0.0'
1212

1313
dependencies:
14-
http: ^0.13.0
14+
http: '>=0.13.0 <2.0.0'
1515
path: ^1.8.0
1616
shelf: ^1.0.0
1717

1818
dev_dependencies:
19-
dart_flutter_team_lints: ^0.1.0
19+
dart_flutter_team_lints: ^1.0.0
2020
test: ^1.6.0

pkgs/shelf_router/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.1.5-dev
2+
3+
* Require Dart `2.19`.
4+
15
## 1.1.4
26

37
* Fixed a spelling issue in the pubspec file.

pkgs/shelf_router/example/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ class Service {
4545
});
4646

4747
// Other routers can be mounted...
48-
router.mount('/api/', Api().router);
48+
router.mount('/api/', Api().router.call);
4949

5050
// You can catch all verbs and use a URL-parameter with a regular expression
5151
// that matches everything to catch app.
5252
router.all('/<ignored|.*>', (Request request) {
5353
return Response.notFound('Page not found');
5454
});
5555

56-
return router;
56+
return router.call;
5757
}
5858
}
5959

pkgs/shelf_router/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: shelf_router
2-
version: 1.1.4
2+
version: 1.1.5-dev
33
description: >
44
A convenient request router for the shelf web-framework, with support for
55
URL-parameters, nested routers and routers generated from source annotations.
@@ -10,14 +10,14 @@ topics:
1010
- shelf
1111

1212
environment:
13-
sdk: '>=2.17.0 <3.0.0'
13+
sdk: '>=2.19.0 <3.0.0'
1414

1515
dependencies:
1616
http_methods: ^1.1.0
1717
meta: ^1.3.0
1818
shelf: ^1.0.0
1919

2020
dev_dependencies:
21-
dart_flutter_team_lints: ^0.1.0
22-
http: ^0.13.0
21+
dart_flutter_team_lints: ^1.0.0
22+
http: '>=0.13.0 <2.0.0'
2323
test: ^1.16.0

pkgs/shelf_router/test/router_test.dart

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
// limitations under the License.
1414

1515
@TestOn('vm')
16+
library;
17+
1618
import 'dart:async';
1719
import 'dart:io';
1820

@@ -59,7 +61,7 @@ void main() {
5961
return Response.ok('not-found');
6062
});
6163

62-
server.mount(app);
64+
server.mount(app.call);
6365

6466
expect(await get('/sync-hello'), 'hello-world');
6567
expect(await get('/async-hello'), 'hello-world');
@@ -79,7 +81,7 @@ void main() {
7981
return Response.ok('$user / $group');
8082
});
8183

82-
server.mount(app);
84+
server.mount(app.call);
8385

8486
expect(await get('/user/jonasfj/groups/42'), 'jonasfj / 42');
8587
});
@@ -92,7 +94,7 @@ void main() {
9294
return Response.ok('$user / $group');
9395
});
9496

95-
server.mount(app);
97+
server.mount(app.call);
9698

9799
expect(await get('/user/jonasfj/groups/42'), 'jonasfj / 42');
98100
});
@@ -108,13 +110,13 @@ void main() {
108110
return Response.ok('hello-world');
109111
});
110112

111-
app.mount('/api/', api);
113+
app.mount('/api/', api.call);
112114

113115
app.all('/<_|[^]*>', (Request request) {
114116
return Response.ok('catch-all-handler');
115117
});
116118

117-
server.mount(app);
119+
server.mount(app.call);
118120

119121
expect(await get('/hello'), 'hello-world');
120122
expect(await get('/api/user/jonasfj/info'), 'Hello jonasfj');
@@ -139,10 +141,10 @@ void main() {
139141
var app = Router();
140142
app.mount(
141143
'/api/',
142-
Pipeline().addMiddleware(middleware).addHandler(api),
144+
Pipeline().addMiddleware(middleware).addHandler(api.call),
143145
);
144146

145-
server.mount(app);
147+
server.mount(app.call);
146148

147149
expect(await get('/api/hello'), 'Hello');
148150
expect(await get('/api/hello?ok'), 'middleware');
@@ -163,13 +165,13 @@ void main() {
163165
return Response.ok('hello-world');
164166
});
165167

166-
app.mount('/api', api);
168+
app.mount('/api', api.call);
167169

168170
app.all('/<_|[^]*>', (Request request) {
169171
return Response.ok('catch-all-handler');
170172
});
171173

172-
server.mount(app);
174+
server.mount(app.call);
173175

174176
expect(await get('/hello'), 'hello-world');
175177
expect(await get('/api'), 'Hello World!');
@@ -180,7 +182,7 @@ void main() {
180182

181183
test('responds with 404 if no handler matches', () {
182184
var api = Router()..get('/hello', (request) => Response.ok('Hello'));
183-
server.mount(api);
185+
server.mount(api.call);
184186

185187
expect(
186188
get('/hi'),
@@ -191,7 +193,7 @@ void main() {
191193
test('can invoke custom handler if no route matches', () {
192194
var api = Router(notFoundHandler: (req) => Response.ok('Not found, but ok'))
193195
..get('/hello', (request) => Response.ok('Hello'));
194-
server.mount(api);
196+
server.mount(api.call);
195197

196198
expect(get('/hi'), completion('Not found, but ok'));
197199
});

pkgs/shelf_router_generator/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.7-dev
2+
3+
* Require `sdk: '>=2.19.0 <3.0.0'`
4+
15
## 1.0.6
26

37
* Added package topics to the pubspec file.

pkgs/shelf_router_generator/example/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Service {
5353

5454
// The generated function _$ServiceRouter can be used to get a [Handler]
5555
// for this object. This can be used with [shelf_io.serve].
56-
Handler get handler => _$ServiceRouter(this);
56+
Handler get handler => _$ServiceRouter(this).call;
5757
}
5858

5959
class Api {

pkgs/shelf_router_generator/example/main.g.dart

Lines changed: 37 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkgs/shelf_router_generator/lib/src/shelf_router_generator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ code.Code _buildAddHandlerCode({
9090
case r'$mount':
9191
return router.property('mount').call([
9292
code.literalString(handler.route, raw: true),
93-
service.property(handler.element.name),
93+
service.property(handler.element.name).property('call'),
9494
]).statement;
9595
case r'$all':
9696
return router.property('all').call([

0 commit comments

Comments
 (0)