Skip to content

Commit

Permalink
Require Dart 2.19, latest lints, support latest pkg:http (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo authored May 23, 2023
1 parent e7bab95 commit 1c37128
Show file tree
Hide file tree
Showing 34 changed files with 232 additions and 126 deletions.
106 changes: 53 additions & 53 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pkgs/shelf/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.4.2-dev

* Require Dart >= 2.19

## 1.4.1

* Added package topics to the pubspec file.
Expand Down
2 changes: 2 additions & 0 deletions pkgs/shelf/lib/shelf_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
/// (the default), streamed responses will be buffered to improve performance.
/// If `false`, all chunks will be pushed over the wire as they're received.
/// See [HttpResponse.bufferOutput] for more information.
library;

import 'dart:async';
import 'dart:io';

Expand Down
8 changes: 4 additions & 4 deletions pkgs/shelf/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: shelf
version: 1.4.1
version: 1.4.2-dev
description: >
A model for web server middleware that encourages composition and easy reuse.
repository: https://github.com/dart-lang/shelf/tree/master/pkgs/shelf
Expand All @@ -9,7 +9,7 @@ topics:
- shelf

environment:
sdk: '>=2.17.0 <3.0.0'
sdk: '>=2.19.0 <3.0.0'

dependencies:
async: ^2.5.0
Expand All @@ -20,6 +20,6 @@ dependencies:
stream_channel: ^2.1.0

dev_dependencies:
dart_flutter_team_lints: ^0.1.0
http: ^0.13.0
dart_flutter_team_lints: ^1.0.0
http: '>=0.13.0 <2.0.0'
test: ^1.16.0
2 changes: 2 additions & 0 deletions pkgs/shelf/test/io_server_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// BSD-style license that can be found in the LICENSE file.

@TestOn('vm')
library;

import 'dart:async';
import 'dart:io';

Expand Down
2 changes: 2 additions & 0 deletions pkgs/shelf/test/shelf_io_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// BSD-style license that can be found in the LICENSE file.

@TestOn('vm')
library;

import 'dart:async';
import 'dart:convert';
import 'dart:io';
Expand Down
4 changes: 4 additions & 0 deletions pkgs/shelf_packages_handler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.3-dev

* Require Dart `2.19`.

## 3.0.2

* Added package topics to the pubspec file.
Expand Down
4 changes: 1 addition & 3 deletions pkgs/shelf_packages_handler/lib/shelf_packages_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library shelf_packages_handler;

import 'package:shelf/shelf.dart';

import 'src/dir_handler.dart';
Expand Down Expand Up @@ -31,4 +29,4 @@ Handler packagesHandler({Map<String, Uri>? packageMap}) =>
/// This is useful for ensuring that `package:` imports work for all entrypoints
/// in Dartium.
Handler packagesDirHandler({Map<String, Uri>? packageMap}) =>
DirHandler('packages', packagesHandler(packageMap: packageMap));
DirHandler('packages', packagesHandler(packageMap: packageMap)).call;
2 changes: 0 additions & 2 deletions pkgs/shelf_packages_handler/lib/src/dir_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library shelf_packages_handler.dir_handler;

import 'dart:async';

import 'package:path/path.dart' as p;
Expand Down
6 changes: 3 additions & 3 deletions pkgs/shelf_packages_handler/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: shelf_packages_handler
version: 3.0.2
version: 3.0.3-dev
description: A shelf handler for serving a `packages/` directory.
repository: https://github.com/dart-lang/shelf/tree/master/pkgs/shelf_packages_handler

Expand All @@ -8,13 +8,13 @@ topics:
- shelf

environment:
sdk: '>=2.17.0 <3.0.0'
sdk: '>=2.19.0 <3.0.0'

dependencies:
path: ^1.8.0
shelf: ^1.0.0
shelf_static: ^1.0.0

dev_dependencies:
dart_flutter_team_lints: ^0.1.0
dart_flutter_team_lints: ^1.0.0
test: ^1.16.0
5 changes: 5 additions & 0 deletions pkgs/shelf_proxy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.0.4

* Require Dart `2.19`.
* Allow `package:http` v1.0.0

## 1.0.3

* Added package topics to the pubspec file.
Expand Down
8 changes: 4 additions & 4 deletions pkgs/shelf_proxy/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: shelf_proxy
version: 1.0.3
version: 1.0.4
description: A shelf handler for proxying HTTP requests to another server.
repository: https://github.com/dart-lang/shelf/tree/master/pkgs/shelf_proxy

Expand All @@ -8,13 +8,13 @@ topics:
- shelf

environment:
sdk: '>=2.17.0 <3.0.0'
sdk: '>=2.19.0 <3.0.0'

dependencies:
http: ^0.13.0
http: '>=0.13.0 <2.0.0'
path: ^1.8.0
shelf: ^1.0.0

dev_dependencies:
dart_flutter_team_lints: ^0.1.0
dart_flutter_team_lints: ^1.0.0
test: ^1.6.0
4 changes: 4 additions & 0 deletions pkgs/shelf_router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.5-dev

* Require Dart `2.19`.

## 1.1.4

* Fixed a spelling issue in the pubspec file.
Expand Down
4 changes: 2 additions & 2 deletions pkgs/shelf_router/example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ class Service {
});

// Other routers can be mounted...
router.mount('/api/', Api().router);
router.mount('/api/', Api().router.call);

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

return router;
return router.call;
}
}

Expand Down
8 changes: 4 additions & 4 deletions pkgs/shelf_router/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: shelf_router
version: 1.1.4
version: 1.1.5-dev
description: >
A convenient request router for the shelf web-framework, with support for
URL-parameters, nested routers and routers generated from source annotations.
Expand All @@ -10,14 +10,14 @@ topics:
- shelf

environment:
sdk: '>=2.17.0 <3.0.0'
sdk: '>=2.19.0 <3.0.0'

dependencies:
http_methods: ^1.1.0
meta: ^1.3.0
shelf: ^1.0.0

dev_dependencies:
dart_flutter_team_lints: ^0.1.0
http: ^0.13.0
dart_flutter_team_lints: ^1.0.0
http: '>=0.13.0 <2.0.0'
test: ^1.16.0
24 changes: 13 additions & 11 deletions pkgs/shelf_router/test/router_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.

@TestOn('vm')
library;

import 'dart:async';
import 'dart:io';

Expand Down Expand Up @@ -59,7 +61,7 @@ void main() {
return Response.ok('not-found');
});

server.mount(app);
server.mount(app.call);

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

server.mount(app);
server.mount(app.call);

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

server.mount(app);
server.mount(app.call);

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

app.mount('/api/', api);
app.mount('/api/', api.call);

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

server.mount(app);
server.mount(app.call);

expect(await get('/hello'), 'hello-world');
expect(await get('/api/user/jonasfj/info'), 'Hello jonasfj');
Expand All @@ -139,10 +141,10 @@ void main() {
var app = Router();
app.mount(
'/api/',
Pipeline().addMiddleware(middleware).addHandler(api),
Pipeline().addMiddleware(middleware).addHandler(api.call),
);

server.mount(app);
server.mount(app.call);

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

app.mount('/api', api);
app.mount('/api', api.call);

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

server.mount(app);
server.mount(app.call);

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

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

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

expect(get('/hi'), completion('Not found, but ok'));
});
Expand Down
4 changes: 4 additions & 0 deletions pkgs/shelf_router_generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.7-dev

* Require `sdk: '>=2.19.0 <3.0.0'`

## 1.0.6

* Added package topics to the pubspec file.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/shelf_router_generator/example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Service {

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

class Api {
Expand Down
45 changes: 37 additions & 8 deletions pkgs/shelf_router_generator/example/main.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ code.Code _buildAddHandlerCode({
case r'$mount':
return router.property('mount').call([
code.literalString(handler.route, raw: true),
service.property(handler.element.name),
service.property(handler.element.name).property('call'),
]).statement;
case r'$all':
return router.property('all').call([
Expand Down
Loading

0 comments on commit 1c37128

Please sign in to comment.