Support latest pkg:build_web_compilers, lints. Update min SDK (#129)
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 9c89e08..b280465 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml
@@ -47,7 +47,7 @@ matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [2.12.0, dev] + sdk: [2.18.0, dev] steps: - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
diff --git a/CHANGELOG.md b/CHANGELOG.md index b6e91bb..62ef87d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md
@@ -1,3 +1,7 @@ +## 2.1.1-dev + +- Require Dart 2.18 + ## 2.1.0 - Adds `minVersion` to `findPackageConfig` and `findPackageConfigVersion`
diff --git a/lib/src/package_config_impl.dart b/lib/src/package_config_impl.dart index 4c8f234..f832d6a 100644 --- a/lib/src/package_config_impl.dart +++ b/lib/src/package_config_impl.dart
@@ -244,7 +244,7 @@ if (!root.hasScheme) { fatalError = true; } else if (!root.path.endsWith('/')) { - root = root.replace(path: root.path + '/'); + root = root.replace(path: '${root.path}/'); } } if (packageUriRoot == null) {
diff --git a/lib/src/package_config_json.dart b/lib/src/package_config_json.dart index fe185a2..bd22db4 100644 --- a/lib/src/package_config_json.dart +++ b/lib/src/package_config_json.dart
@@ -149,11 +149,11 @@ var parsedRootUri = Uri.parse(rootUri!); var relativeRoot = !hasAbsolutePath(parsedRootUri); var root = baseLocation.resolveUri(parsedRootUri); - if (!root.path.endsWith('/')) root = root.replace(path: root.path + '/'); + if (!root.path.endsWith('/')) root = root.replace(path: '${root.path}/'); var packageRoot = root; if (packageUri != null) packageRoot = root.resolve(packageUri!); if (!packageRoot.path.endsWith('/')) { - packageRoot = packageRoot.replace(path: packageRoot.path + '/'); + packageRoot = packageRoot.replace(path: '${packageRoot.path}/'); } LanguageVersion? version;
diff --git a/lib/src/packages_file.dart b/lib/src/packages_file.dart index 2446633..3fd7db9 100644 --- a/lib/src/packages_file.dart +++ b/lib/src/packages_file.dart
@@ -192,7 +192,7 @@ uri = relativizeUri(uri, baseUri)!; } if (!uri.path.endsWith('/')) { - uri = uri.replace(path: uri.path + '/'); + uri = uri.replace(path: '${uri.path}/'); } output.write(uri); output.writeln();
diff --git a/lib/src/util.dart b/lib/src/util.dart index 61488ac..3bf1bec 100644 --- a/lib/src/util.dart +++ b/lib/src/util.dart
@@ -89,7 +89,7 @@ } assert(badIndex < packageName.length); var badCharCode = packageName.codeUnitAt(badIndex); - var badChar = 'U+' + badCharCode.toRadixString(16).padLeft(4, '0'); + var badChar = 'U+${badCharCode.toRadixString(16).padLeft(4, '0')}'; if (badCharCode >= 0x20 && badCharCode <= 0x7e) { // Printable character. badChar = "'${packageName[badIndex]}' ($badChar)"; @@ -140,7 +140,7 @@ /// Appends a trailing `/` if the path doesn't end with one. String trailingSlash(String path) { if (path.isEmpty || path.endsWith('/')) return path; - return path + '/'; + return '$path/'; } /// Whether a URI should not be considered relative to the base URI.
diff --git a/pubspec.yaml b/pubspec.yaml index 56e30b5..08255ff 100644 --- a/pubspec.yaml +++ b/pubspec.yaml
@@ -1,10 +1,10 @@ name: package_config -version: 2.1.0 +version: 2.1.1-dev description: Support for reading and writing Dart Package Configuration files. repository: https://github.com/dart-lang/package_config environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.18.0 <3.0.0' dependencies: path: ^1.8.0 @@ -12,6 +12,6 @@ dev_dependencies: build_runner: ^2.0.0 build_test: ^2.1.2 - build_web_compilers: ^3.0.0 - lints: ^1.0.0 + build_web_compilers: '>=3.0.0 <5.0.0' + lints: ^2.0.0 test: ^1.16.0
diff --git a/test/parse_test.dart b/test/parse_test.dart index 174a099..94269e2 100644 --- a/test/parse_test.dart +++ b/test/parse_test.dart
@@ -56,7 +56,7 @@ () => packages.parse(utf8.encode(content), baseFile, throwError), throwsA(TypeMatcher<FormatException>())); }); - test(name + ', handle error', () { + test('$name, handle error', () { var hadError = false; packages.parse(utf8.encode(content), baseFile, (error) { hadError = true;