fix(graph): make plugin-alias gate segment-aware so bare "@" alias no longer swallows @scope/* deps#850
Open
BartWaardenburg wants to merge 1 commit into
Open
fix(graph): make plugin-alias gate segment-aware so bare "@" alias no longer swallows @scope/* deps#850BartWaardenburg wants to merge 1 commit into
BartWaardenburg wants to merge 1 commit into
Conversation
… longer swallows @scope/* deps Fixes #838
8ac311d to
2c7ed93
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
crates/graph/src/resolve/specifier.rs, thematches_plugin_aliaspredicate usedspecifier.starts_with(prefix), which caused a bare"@"alias to match every@scope/pkgspecifier. A new helperspecifier_matches_alias_prefixadds segment-aware logic mirroringfallbacks.rs::alias_match_remainder: the match is accepted only when the remainder after stripping the prefix is empty, the prefix already ends with/, or the remainder starts with/. This meansprefix = "@"only matches the exact string"@"or"@/...", never"@radix-ui/react-checkbox". The helper is used at both call sites ofmatches_plugin_aliasinspecifier.rs.Review
Verdict: SHIP
fallbacks.rs::alias_match_remainder(Option<&str>) and the newspecifier.rs::specifier_matches_alias_prefix(bool). They could drift; rule-of-three not yet met so acceptable, but a shared helper is worth considering if a third call site appears.crates/extract/src/visitor/helpers.rsandcrates/extract/src/tests/js_ts/classes.rs(class-memberprop.declarehandling). These were introduced by parallel-agent activity, are NOT in the Bare "@" alias key flags every @scope/* dependency as unused + unresolved #838 patch, and must not be co-committed with this fix. Commit scope is limited tocrates/graph/src/resolve/{specifier.rs,tests.rs}.Closes #838