Conversation
🦋 Changeset detectedLatest commit: 4c9e4af The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis pull request implements pattern specificity ordering for package exports resolution. It introduces a multi-stage resolution algorithm that evaluates exact matches first, then collects and sorts pattern keys by specificity (prioritising longer prefixes and suffixes) before attempting pattern matching. A new helper function compares pattern keys to determine resolution order. The resolver now treats null targets as NotFound. Changes include modifications to the resolution logic, a new test function with comprehensive assertions, and a corresponding changeset entry addressing issue Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan for PR comments
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
crates/biome_resolver/tests/spec_tests.rs (1)
750-813: Please add a trailer tie-break case.This locks in the longer-prefix branch, but the new comparator in
crates/biome_resolver/src/lib.rs(Lines 410-416) also prefers the longer suffix when prefixes tie. One extra case like./features/*.jsonover./features/*would pin that branch down too.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_resolver/tests/spec_tests.rs` around lines 750 - 813, Add a trailer tie-break assertion to test_resolve_exports_pattern_specificity: after the existing checks call resolve(...) with the module spec that includes the .json trailer (e.g., "@kcconfigs/biome/features/svelte.json") and assert it resolves to "{base_dir}/node_modules/@kcconfigs/biome/src/features/svelte.json" using the same ResolveOptions and OsFileSystem setup; this pins the comparator branch that prefers longer suffixes (ensure you use the same resolve(...) invocation and Utf8PathBuf format as the other assertions)..changeset/fix-resolver-exports-pattern-specificity.md (1)
5-5: Please make this changeset user-facing.This currently reads more like resolver pseudocode than a release note. Please describe the user impact instead, e.g. that nested shared-config package paths resolve correctly again. As per coding guidelines, "Changeset descriptions must be written for end users (explain impact and what changed), not developers (avoid implementation details) in 1-3 sentences".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.changeset/fix-resolver-exports-pattern-specificity.md at line 5, Update the changeset text for "Fixed [`#9370`]" to be user-facing: replace the technical description with 1–3 sentences describing the impact (e.g., packages with nested or overlapping export subpaths like "./features/*" now resolve correctly so nested shared-config package paths no longer fail to import), and note that this fixes resolution errors caused by less-specific patterns like "./*" matching prematurely; keep wording concise and avoid implementation details.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.changeset/fix-resolver-exports-pattern-specificity.md:
- Line 5: Update the changeset text for "Fixed [`#9370`]" to be user-facing:
replace the technical description with 1–3 sentences describing the impact
(e.g., packages with nested or overlapping export subpaths like "./features/*"
now resolve correctly so nested shared-config package paths no longer fail to
import), and note that this fixes resolution errors caused by less-specific
patterns like "./*" matching prematurely; keep wording concise and avoid
implementation details.
In `@crates/biome_resolver/tests/spec_tests.rs`:
- Around line 750-813: Add a trailer tie-break assertion to
test_resolve_exports_pattern_specificity: after the existing checks call
resolve(...) with the module spec that includes the .json trailer (e.g.,
"@kcconfigs/biome/features/svelte.json") and assert it resolves to
"{base_dir}/node_modules/@kcconfigs/biome/src/features/svelte.json" using the
same ResolveOptions and OsFileSystem setup; this pins the comparator branch that
prefers longer suffixes (ensure you use the same resolve(...) invocation and
Utf8PathBuf format as the other assertions).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 987d5003-292b-4714-91a9-b72a42c72125
⛔ Files ignored due to path filters (4)
crates/biome_resolver/tests/fixtures/resolver_cases_8/node_modules/@kcconfigs/biome/package.jsonis excluded by!**/node_modules/**and included by**crates/biome_resolver/tests/fixtures/resolver_cases_8/node_modules/@kcconfigs/biome/src/features/private-internal/secret.jsonis excluded by!**/node_modules/**and included by**crates/biome_resolver/tests/fixtures/resolver_cases_8/node_modules/@kcconfigs/biome/src/features/svelte.jsonis excluded by!**/node_modules/**and included by**crates/biome_resolver/tests/fixtures/resolver_cases_8/node_modules/@kcconfigs/biome/src/presets/default.jsonis excluded by!**/node_modules/**and included by**
📒 Files selected for processing (4)
.changeset/fix-resolver-exports-pattern-specificity.mdcrates/biome_resolver/src/lib.rscrates/biome_resolver/tests/fixtures/resolver_cases_8/package.jsoncrates/biome_resolver/tests/spec_tests.rs
Summary
Closes #9370
This PR has been vibe-coded with Claude.
Test Plan
Added new tests
Docs
N/A