Skip to content

Commit

Permalink
set packageConfigPath and update DWDS version to 24.3.5 (#2589)
Browse files Browse the repository at this point in the history
  • Loading branch information
jyameo authored Feb 11, 2025
1 parent 4246bbc commit 718c39c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
4 changes: 3 additions & 1 deletion webdev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## 3.7.1-wip
## 3.7.1
- Update `dwds` constraint to `24.3.5`.
- Added a utility method to locate `package_config.json` and set it in the `loadStrategy`.

## 3.7.0

Expand Down
23 changes: 23 additions & 0 deletions webdev/lib/src/serve/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,26 @@ Future<void> _removeDeleted(String from, String to) async {
}
}
}

/// Returns the absolute file path of the `package_config.json` file in the `.dart_tool`
/// directory, searching recursively from the current directory hierarchy.
String? findPackageConfigFilePath() {
var candidateDir = Directory(p.current).absolute;

while (true) {
final candidatePackageConfigFile =
File(p.join(candidateDir.path, '.dart_tool', 'package_config.json'));

if (candidatePackageConfigFile.existsSync()) {
return candidatePackageConfigFile.path;
}

final parentDir = candidateDir.parent;
if (parentDir.path == candidateDir.path) {
// We've reached the root directory
return null;
}

candidateDir = parentDir;
}
}
2 changes: 2 additions & 0 deletions webdev/lib/src/serve/webdev_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import '../command/configuration.dart';
import '../util.dart';
import 'chrome.dart';
import 'handlers/favicon_handler.dart';
import 'utils.dart' show findPackageConfigFilePath;

Logger _logger = Logger('WebDevServer');

Expand Down Expand Up @@ -141,6 +142,7 @@ class WebDevServer {
options.configuration.reload,
assetReader,
buildSettings,
packageConfigPath: findPackageConfigFilePath(),
).strategy;

if (options.configuration.enableExpressionEvaluation) {
Expand Down
2 changes: 1 addition & 1 deletion webdev/lib/src/version.dart

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

4 changes: 2 additions & 2 deletions webdev/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: webdev
# Every time this changes you need to run `dart run build_runner build`.
version: 3.7.1-wip
version: 3.7.1
# We should not depend on a dev SDK before publishing.
# publish_to: none
description: >-
Expand All @@ -19,7 +19,7 @@ dependencies:
crypto: ^3.0.2
dds: ^4.1.0
# Pin DWDS to avoid dependency conflicts with vm_service:
dwds: 24.2.0
dwds: 24.3.5
http: ^1.0.0
http_multi_server: ^3.2.0
io: ^1.0.3
Expand Down

0 comments on commit 718c39c

Please sign in to comment.