Repository navigation
[flutter_tools] Anchor package version extraction regex in Wasm dry-run - #190691
Conversation
Anchor the Wasm dry-run package version regex to `hosted/pub.dev/<package_name>-` so that version-like numbers in ancestor directories (e.g. Flutter SDK version paths like `/flutter/3.22.0/`) are not matched as the package version. Fixes flutter#190644
There was a problem hiding this comment.
Code Review
This pull request updates the regular expression in Dart2WasmTarget to correctly extract package versions when ancestor directories contain numbers, and adds a corresponding test case. Feedback suggests making the domain matching more robust to support pub mirrors and private repositories instead of hardcoding hosted/pub.dev.
…extraction Refactor package version extraction to use Dart 3 list pattern matching on `package.root.pathSegments` (`[..., 'hosted', _, final packageFolder]`), supporting any hosted pub mirror domain without regex parsing. Add test coverage for custom pub mirrors and multi-host environments.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the package version extraction logic in Dart2WasmTarget to use pattern matching on path segments instead of a regular expression on the full URI string. This change allows extracting package versions from custom pub mirrors and prevents issues when ancestor directories contain numbers. Additionally, three new unit tests are added to verify this behavior under various directory structures and hosted domains. I have no feedback to provide.
Anchor the Wasm dry-run package version regex to
hosted/pub.dev/<package_name>-so that version-like numbers in ancestor directories (e.g. Flutter SDK version paths like/flutter/3.22.0/) are not matched as the package version.Fixes #190644