Skip to content

fix: apply Dart dependency_overrides from pubspec.yaml - #680

Open
vibgrate-team wants to merge 1 commit into
mainfrom
cursor/pubspec-dependency-overrides-1ff0
Open

vibgrate-team wants to merge 1 commit into
mainfrom
cursor/pubspec-dependency-overrides-1ff0

Conversation

@vibgrate-team

Copy link
Copy Markdown
Contributor

Applies dependency_overrides from pubspec.yaml when scanning Dart projects.

What changed

  • parsePubspecYaml previously treated any top-level key other than dependencies / dev_dependencies as the end of a section, so overrides were dropped.
  • Overrides now support the same forms as other sections (one-line version, { version: … }, nested version:, path:, git:) and are applied after both dependency sections are read.
  • A declared package keeps its production/development flag and takes the override spec; an override-only package is reported as a production row.
  • SDK overrides are skipped and don't replace a declared spec; a sdk: line inside a dependency section is no longer stored as the Dart SDK version.
  • pubspec.lock parsing is unchanged: when present, its version is still the resolved version and still drives drift.

Tests

test/dart-pubspec-map.test.ts covers the issue example, an overridden dev dependency, an override-only package, SDK overrides, map/path/git forms, a pubspec without overrides, and a lockfile whose resolved version stays locked.

pnpm test, pnpm lint and pnpm typecheck pass.

Closes #678

dependency_overrides was ignored because any top-level key other than
dependencies and dev_dependencies reset the parser section. Overrides
now use the same entry forms, replace a declared spec while keeping
its production or development flag, and add override-only packages as
production rows. A present pubspec.lock still supplies the resolved
version.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: ABIZ - Agentic Business Record Standard <ops@to.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: apply pubspec.yaml dependency_overrides in Dart scans

2 participants