Migrated to Dart 3
This commit is contained in:
parent
5ad3ab195d
commit
1dce9a75c3
20 changed files with 63 additions and 36 deletions
|
@ -1,5 +1,9 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 5.0.0-beta.1
|
||||||
|
|
||||||
|
* Require Dart >= 3.0
|
||||||
|
|
||||||
## 4.0.0
|
## 4.0.0
|
||||||
|
|
||||||
* Require Dart >= 2.17
|
* Require Dart >= 2.17
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
name: belatuk_merge_map
|
name: belatuk_merge_map
|
||||||
version: 4.0.0
|
version: 5.0.0-beta.1
|
||||||
description: Combine multiple Maps into one. Equivalent to Object.assign in JS.
|
description: Combine multiple Maps into one. Equivalent to Object.assign in JS.
|
||||||
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/merge_map
|
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/merge_map
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.17.0 <3.0.0'
|
sdk: '>=3.0.0-290.3.beta <4.0.0'
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
test: ^1.17.4
|
test: ^1.17.4
|
||||||
lints: ^2.0.0
|
lints: ^2.0.0
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 6.0.0-beta.1
|
||||||
|
|
||||||
|
* Require Dart >= 3.0
|
||||||
|
|
||||||
## 5.0.0
|
## 5.0.0
|
||||||
|
|
||||||
* Require Dart >= 2.17
|
* Require Dart >= 2.17
|
||||||
|
|
|
@ -15,7 +15,7 @@ In your `pubspec.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
belatuk_pretty_logging: ^5.0.0
|
belatuk_pretty_logging: ^6.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
name: belatuk_pretty_logging
|
name: belatuk_pretty_logging
|
||||||
version: 5.0.0
|
version: 6.0.0-beta.1
|
||||||
description: Standalone helper for colorful logging output, using pkg:io AnsiCode.
|
description: Standalone helper for colorful logging output, using pkg:io AnsiCode.
|
||||||
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/pretty_logging
|
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/pretty_logging
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.17.0 <3.0.0'
|
sdk: '>=3.0.0-290.3.beta <4.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
io: ^1.0.0
|
io: ^1.0.0
|
||||||
logging: ^1.0.1
|
logging: ^1.0.1
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 6.0.0-beta.1
|
||||||
|
|
||||||
|
* Require Dart >= 3.0
|
||||||
|
|
||||||
## 5.0.0
|
## 5.0.0
|
||||||
|
|
||||||
* Require Dart >= 2.17
|
* Require Dart >= 2.17
|
||||||
|
|
|
@ -14,7 +14,7 @@ Add `belatuk_pub_sub` as a dependency in your `pubspec.yaml` file:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
belatuk_pub_sub: ^5.0.0
|
belatuk_pub_sub: ^6.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, be sure to run `pub get` in your terminal.
|
Then, be sure to run `pub get` in your terminal.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
name: belatuk_pub_sub
|
name: belatuk_pub_sub
|
||||||
version: 5.0.0
|
version: 6.0.0-beta.1
|
||||||
description: Keep application instances in sync with a simple pub/sub API.
|
description: Keep application instances in sync with a simple pub/sub API.
|
||||||
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/pub_sub
|
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/pub_sub
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.17.0 <3.0.0'
|
sdk: '>=3.0.0-290.3.beta <4.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
json_rpc_2: ^3.0.0
|
json_rpc_2: ^3.0.0
|
||||||
stream_channel: ^2.1.0
|
stream_channel: ^2.1.0
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 6.0.0-beta.1
|
||||||
|
|
||||||
|
* Require Dart >= 3.0
|
||||||
|
|
||||||
## 5.0.0
|
## 5.0.0
|
||||||
|
|
||||||
* Require Dart >= 2.17
|
* Require Dart >= 2.17
|
||||||
|
|
|
@ -14,7 +14,7 @@ In your `pubspec.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
belatuk_range_header: ^5.0.0
|
belatuk_range_header: ^6.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
|
@ -15,7 +15,9 @@ void handleRequest(HttpRequest request) async {
|
||||||
// Get info
|
// Get info
|
||||||
header.items;
|
header.items;
|
||||||
header.rangeUnit;
|
header.rangeUnit;
|
||||||
header.items.forEach((item) => item.toContentRange(400));
|
for (var item in header.items) {
|
||||||
|
item.toContentRange(400);
|
||||||
|
}
|
||||||
|
|
||||||
// Serve the file
|
// Serve the file
|
||||||
var transformer =
|
var transformer =
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io' show BytesBuilder;
|
//import 'dart:io' hide BytesBuilder;
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'package:async/async.dart';
|
import 'package:async/async.dart';
|
||||||
import 'package:charcode/ascii.dart';
|
import 'package:charcode/ascii.dart';
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class RangeHeaderParseException extends FormatException {
|
class RangeHeaderParseException extends FormatException {
|
||||||
@override
|
//@override
|
||||||
final String message;
|
//final String message;
|
||||||
|
|
||||||
RangeHeaderParseException(this.message);
|
RangeHeaderParseException(super.message);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'Range header parse exception: $message';
|
String toString() => 'Range header parse exception: $message';
|
||||||
|
|
|
@ -9,7 +9,7 @@ import 'range_header_item.dart';
|
||||||
final RegExp _rgxInt = RegExp(r'[0-9]+');
|
final RegExp _rgxInt = RegExp(r'[0-9]+');
|
||||||
final RegExp _rgxWs = RegExp(r'[ \n\r\t]');
|
final RegExp _rgxWs = RegExp(r'[ \n\r\t]');
|
||||||
|
|
||||||
enum TokenType { RANGE_UNIT, COMMA, INT, DASH, EQUALS }
|
enum TokenType { rangeUnit, comma, int, dash, equals }
|
||||||
|
|
||||||
class Token {
|
class Token {
|
||||||
final TokenType type;
|
final TokenType type;
|
||||||
|
@ -27,19 +27,19 @@ List<Token> scan(String text, List<String> allowedRangeUnits) {
|
||||||
scanner.scan(_rgxWs);
|
scanner.scan(_rgxWs);
|
||||||
|
|
||||||
if (scanner.scanChar($comma)) {
|
if (scanner.scanChar($comma)) {
|
||||||
tokens.add(Token(TokenType.COMMA, scanner.lastSpan));
|
tokens.add(Token(TokenType.comma, scanner.lastSpan));
|
||||||
} else if (scanner.scanChar($dash)) {
|
} else if (scanner.scanChar($dash)) {
|
||||||
tokens.add(Token(TokenType.DASH, scanner.lastSpan));
|
tokens.add(Token(TokenType.dash, scanner.lastSpan));
|
||||||
} else if (scanner.scan(_rgxInt)) {
|
} else if (scanner.scan(_rgxInt)) {
|
||||||
tokens.add(Token(TokenType.INT, scanner.lastSpan));
|
tokens.add(Token(TokenType.int, scanner.lastSpan));
|
||||||
} else if (scanner.scanChar($equal)) {
|
} else if (scanner.scanChar($equal)) {
|
||||||
tokens.add(Token(TokenType.EQUALS, scanner.lastSpan));
|
tokens.add(Token(TokenType.equals, scanner.lastSpan));
|
||||||
} else {
|
} else {
|
||||||
var matched = false;
|
var matched = false;
|
||||||
|
|
||||||
for (var unit in allowedRangeUnits) {
|
for (var unit in allowedRangeUnits) {
|
||||||
if (scanner.scan(unit)) {
|
if (scanner.scan(unit)) {
|
||||||
tokens.add(Token(TokenType.RANGE_UNIT, scanner.lastSpan));
|
tokens.add(Token(TokenType.rangeUnit, scanner.lastSpan));
|
||||||
matched = true;
|
matched = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -98,9 +98,9 @@ class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
RangeHeader? parseRangeHeader() {
|
RangeHeader? parseRangeHeader() {
|
||||||
if (next(TokenType.RANGE_UNIT)) {
|
if (next(TokenType.rangeUnit)) {
|
||||||
var unit = current!.span!.text;
|
var unit = current!.span!.text;
|
||||||
next(TokenType.EQUALS); // Consume =, if any.
|
next(TokenType.equals); // Consume =, if any.
|
||||||
|
|
||||||
var items = <RangeHeaderItem>[];
|
var items = <RangeHeaderItem>[];
|
||||||
var item = parseHeaderItem();
|
var item = parseHeaderItem();
|
||||||
|
@ -108,7 +108,7 @@ class Parser {
|
||||||
while (item != null) {
|
while (item != null) {
|
||||||
items.add(item);
|
items.add(item);
|
||||||
// Parse comma
|
// Parse comma
|
||||||
if (next(TokenType.COMMA)) {
|
if (next(TokenType.comma)) {
|
||||||
item = parseHeaderItem();
|
item = parseHeaderItem();
|
||||||
} else {
|
} else {
|
||||||
item = null;
|
item = null;
|
||||||
|
@ -126,11 +126,11 @@ class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
RangeHeaderItem? parseHeaderItem() {
|
RangeHeaderItem? parseHeaderItem() {
|
||||||
if (next(TokenType.INT)) {
|
if (next(TokenType.int)) {
|
||||||
// i.e 500-544, or 600-
|
// i.e 500-544, or 600-
|
||||||
var start = int.parse(current!.span!.text);
|
var start = int.parse(current!.span!.text);
|
||||||
if (next(TokenType.DASH)) {
|
if (next(TokenType.dash)) {
|
||||||
if (next(TokenType.INT)) {
|
if (next(TokenType.int)) {
|
||||||
return RangeHeaderItem(start, int.parse(current!.span!.text));
|
return RangeHeaderItem(start, int.parse(current!.span!.text));
|
||||||
} else {
|
} else {
|
||||||
return RangeHeaderItem(start);
|
return RangeHeaderItem(start);
|
||||||
|
@ -138,9 +138,9 @@ class Parser {
|
||||||
} else {
|
} else {
|
||||||
throw _expected('"-"');
|
throw _expected('"-"');
|
||||||
}
|
}
|
||||||
} else if (next(TokenType.DASH)) {
|
} else if (next(TokenType.dash)) {
|
||||||
// i.e. -599
|
// i.e. -599
|
||||||
if (next(TokenType.INT)) {
|
if (next(TokenType.int)) {
|
||||||
return RangeHeaderItem(-1, int.parse(current!.span!.text));
|
return RangeHeaderItem(-1, int.parse(current!.span!.text));
|
||||||
} else {
|
} else {
|
||||||
throw _expected('integer');
|
throw _expected('integer');
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
name: belatuk_range_header
|
name: belatuk_range_header
|
||||||
version: 5.0.0
|
version: 6.0.0-beta.1
|
||||||
description: Range header parser for Dart. Beyond parsing, a stream transformer is included.
|
description: Range header parser for Dart. Beyond parsing, a stream transformer is included.
|
||||||
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/range_header
|
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/range_header
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.17.0 <3.0.0'
|
sdk: '>=3.0.0-290.3.beta <4.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
async: ^2.6.0
|
async: ^2.6.0
|
||||||
charcode: ^1.2.0
|
charcode: ^1.2.0
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 5.0.0-beta.1
|
||||||
|
|
||||||
|
* Require Dart >= 3.0
|
||||||
|
|
||||||
## 4.0.0
|
## 4.0.0
|
||||||
|
|
||||||
* Require Dart >= 2.17
|
* Require Dart >= 2.17
|
||||||
|
|
|
@ -12,8 +12,7 @@ and utilize basic memoization to speed up repeated lookups.
|
||||||
|
|
||||||
## Variables
|
## Variables
|
||||||
|
|
||||||
To represent a symbol, use `Variable`. I opted for the name
|
To represent a symbol, use `Variable`. I opted for the name `Variable` to avoid conflict with the Dart primitive `Symbol`.
|
||||||
`Variable` to avoid conflict with the Dart primitive `Symbol`.
|
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
var foo = Variable<String>('foo');
|
var foo = Variable<String>('foo');
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
name: belatuk_symbol_table
|
name: belatuk_symbol_table
|
||||||
version: 4.0.0
|
version: 5.0.0-beta.1
|
||||||
description: A generic symbol table implementation in Dart, with support for scopes and constants.
|
description: A generic symbol table implementation in Dart, with support for scopes and constants.
|
||||||
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/symbol_table
|
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/symbol_table
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.17.0 <3.0.0'
|
sdk: '>=3.0.0-290.3.beta <4.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
collection: ^1.15.0
|
collection: ^1.15.0
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 5.0.0-beta.1
|
||||||
|
|
||||||
|
* Require Dart >= 3.0
|
||||||
|
|
||||||
## 4.0.0
|
## 4.0.0
|
||||||
|
|
||||||
* Require Dart >= 2.17
|
* Require Dart >= 2.17
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
name: user_agent_analyzer
|
name: user_agent_analyzer
|
||||||
version: 4.0.0
|
version: 5.0.0-beta.1
|
||||||
description: A library to identify the type of devices and web browsers based on User-Agent string.
|
description: A library to identify the type of devices and web browsers based on User-Agent string.
|
||||||
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/user_agent
|
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/user_agent
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.17.0 <3.0.0'
|
sdk: '>=3.0.0-290.3.beta <4.0.0'
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
test: ^1.17.8
|
test: ^1.17.8
|
||||||
lints: ^2.0.0
|
lints: ^2.0.0
|
||||||
|
|
Loading…
Reference in a new issue