Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 379d60c

Browse files
authored
Require Dart 3.3 (#88)
update lints, test on wasm
1 parent ef5f065 commit 379d60c

9 files changed

+40
-26
lines changed

.github/workflows/test-package.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
matrix:
5050
# Add macos-latest and/or windows-latest if relevant for this package.
5151
os: [ubuntu-latest]
52-
sdk: [2.18.0, dev]
52+
sdk: [3.3, dev]
5353
steps:
5454
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
5555
- uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
@@ -67,3 +67,6 @@ jobs:
6767
- name: Run Node tests
6868
run: dart test --platform node
6969
if: always() && steps.install.outcome == 'success'
70+
- name: Run Chrome tests - wasm
71+
run: dart test --platform chrome --compiler dart2wasm
72+
if: always() && steps.install.outcome == 'success' && matrix.sdk == 'dev'

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.3-wip
2+
3+
- Require Dart 3.3.
4+
15
## 2.1.2
26

37
- Allow `file` version `7.x`.

analysis_options.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,3 @@ linter:
99
- avoid_unused_constructor_parameters
1010
- cancel_subscriptions
1111
- package_api_docs
12-
- test_types_in_equals
13-
- use_super_parameters

lib/glob.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class Glob implements Pattern {
4848
/// The parsed AST of the glob.
4949
final AstNode _ast;
5050

51-
/// The underlying object used to implement [list] and [listSync].
51+
/// The underlying object used to implement [listFileSystem] and
52+
/// [listFileSystemSync].
5253
///
5354
/// This should not be read directly outside of [_listTreeForFileSystem].
5455
ListTree? _listTree;

lib/list_local_fs.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
import 'package:file/file.dart';
66
import 'package:file/local.dart';
7-
import 'package:glob/glob.dart';
7+
8+
import 'glob.dart';
89

910
/// Platform specific extensions for where `dart:io` exists, which use the
1011
/// local file system.

lib/src/ast.dart

+11-8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class AstNode {
3434
/// In particular, this returns a glob AST with two guarantees:
3535
///
3636
/// 1. There are no [OptionsNode]s other than the one at the top level.
37-
/// 2. It matches the same set of paths as [this].
37+
/// 2. It matches the same set of paths as `this`.
3838
///
3939
/// For example, given the glob `{foo,bar}/{click/clack}`, this would return
4040
/// `{foo/click,foo/clack,bar/click,bar/clack}`.
@@ -189,10 +189,10 @@ class SequenceNode extends AstNode {
189189
@override
190190
bool operator ==(Object other) =>
191191
other is SequenceNode &&
192-
const IterableEquality().equals(nodes, other.nodes);
192+
const IterableEquality<AstNode>().equals(nodes, other.nodes);
193193

194194
@override
195-
int get hashCode => const IterableEquality().hash(nodes);
195+
int get hashCode => const IterableEquality<AstNode>().hash(nodes);
196196

197197
@override
198198
String toString() => nodes.join();
@@ -343,10 +343,11 @@ class RangeNode extends AstNode {
343343
bool operator ==(Object other) =>
344344
other is RangeNode &&
345345
other.negated == negated &&
346-
SetEquality().equals(ranges, other.ranges);
346+
const SetEquality<Range>().equals(ranges, other.ranges);
347347

348348
@override
349-
int get hashCode => (negated ? 1 : 3) * const SetEquality().hash(ranges);
349+
int get hashCode =>
350+
(negated ? 1 : 3) * const SetEquality<Range>().hash(ranges);
350351

351352
@override
352353
String toString() {
@@ -389,10 +390,12 @@ class OptionsNode extends AstNode {
389390
@override
390391
bool operator ==(Object other) =>
391392
other is OptionsNode &&
392-
const UnorderedIterableEquality().equals(options, other.options);
393+
const UnorderedIterableEquality<SequenceNode>()
394+
.equals(options, other.options);
393395

394396
@override
395-
int get hashCode => const UnorderedIterableEquality().hash(options);
397+
int get hashCode =>
398+
const UnorderedIterableEquality<SequenceNode>().hash(options);
396399

397400
@override
398401
String toString() => '{${options.join(',')}}';
@@ -412,7 +415,7 @@ class LiteralNode extends AstNode {
412415
bool get canMatchAbsolute {
413416
var nativeText =
414417
_context!.style == p.Style.windows ? text.replaceAll('/', '\\') : text;
415-
return _context!.isAbsolute(nativeText);
418+
return _context.isAbsolute(nativeText);
416419
}
417420

418421
@override

lib/src/utils.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Range {
2020
/// Returns a range that covers only [value].
2121
Range.singleton(int value) : this(value, value);
2222

23-
/// Whether [this] contains [value].
23+
/// Whether `this` contains [value].
2424
bool contains(int value) => value >= min && value <= max;
2525

2626
@override
@@ -31,7 +31,7 @@ class Range {
3131
int get hashCode => 3 * min + 7 * max;
3232
}
3333

34-
/// An implementation of [Match] constructed by [Glob]s.
34+
/// An implementation of [Match] constructed by `Glob`s.
3535
class GlobMatch implements Match {
3636
@override
3737
final String input;

pubspec.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: glob
2-
version: 2.1.2
2+
version: 2.1.3-wip
33
description: A library to perform Bash-style file and directory globbing.
44
repository: https://github.com/dart-lang/glob
55

66
environment:
7-
sdk: '>=2.19.0 <4.0.0'
7+
sdk: ^3.3.0
88

99
dependencies:
1010
async: ^2.5.0
@@ -14,6 +14,6 @@ dependencies:
1414
string_scanner: ^1.1.0
1515

1616
dev_dependencies:
17-
dart_flutter_team_lints: ^1.0.0
17+
dart_flutter_team_lints: ^2.0.0
1818
test: ^1.17.0
1919
test_descriptor: ^2.0.0

test/list_test.dart

+12-8
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ void main() {
3131
test('returns empty list for non-existent case-sensitive directories',
3232
() async {
3333
expect(await Glob('non/existent/**', caseSensitive: true).list().toList(),
34-
[]);
34+
<Never>[]);
3535
});
3636

3737
test('returns empty list for non-existent case-insensitive directories',
3838
() async {
3939
expect(
4040
await Glob('non/existent/**', caseSensitive: false).list().toList(),
41-
[]);
41+
<Never>[]);
4242
});
4343
});
4444

@@ -48,26 +48,30 @@ void main() {
4848
});
4949

5050
test('returns empty list for non-existent case-sensitive directories', () {
51-
expect(Glob('non/existent/**', caseSensitive: true).listSync(), []);
51+
expect(
52+
Glob('non/existent/**', caseSensitive: true).listSync(), <Never>[]);
5253
});
5354

5455
test('returns empty list for non-existent case-insensitive directories',
5556
() {
56-
expect(Glob('non/existent/**', caseSensitive: false).listSync(), []);
57+
expect(
58+
Glob('non/existent/**', caseSensitive: false).listSync(), <Never>[]);
5759
});
5860
});
5961

6062
group('when case-sensitive', () {
6163
test('lists literals case-sensitively', () {
62-
expect(Glob('foo/BAZ/qux', caseSensitive: true).listSync(), []);
64+
expect(Glob('foo/BAZ/qux', caseSensitive: true).listSync(), <Never>[]);
6365
});
6466

6567
test('lists ranges case-sensitively', () {
66-
expect(Glob('foo/[BX][A-Z]z/qux', caseSensitive: true).listSync(), []);
68+
expect(Glob('foo/[BX][A-Z]z/qux', caseSensitive: true).listSync(),
69+
<Never>[]);
6770
});
6871

6972
test('options preserve case-sensitivity', () {
70-
expect(Glob('foo/{BAZ,ZAP}/qux', caseSensitive: true).listSync(), []);
73+
expect(
74+
Glob('foo/{BAZ,ZAP}/qux', caseSensitive: true).listSync(), <Never>[]);
7175
});
7276
});
7377

@@ -317,7 +321,7 @@ typedef ListFn = FutureOr<List<String>> Function(String glob,
317321
{bool recursive, bool followLinks, bool? caseSensitive});
318322

319323
/// Runs [callback] in two groups with two values of [listFn]: one that uses
320-
/// [Glob.list], one that uses [Glob.listSync].
324+
/// `Glob.list`, one that uses `Glob.listSync`.
321325
void syncAndAsync(FutureOr Function(ListFn) callback) {
322326
group('async', () {
323327
callback((pattern, {recursive = false, followLinks = true, caseSensitive}) {

0 commit comments

Comments
 (0)