Dart Parser: Intentional Differences and Improvements
July 18, 2026 · View on GitHub
Summary
The Dart parser in Provenant preserves pubspec and pubspec.lock metadata more accurately than the Python reference implementation in several concrete ways:
- dependency scope is mapped explicitly (
dependencies,dev_dependencies,dependency_overrides,environment) - YAML trailing newlines in descriptions are preserved
- lockfile entries distinguish
direct main,direct dev, and graph-derived transitive runtime vs dev-only dependencies - manifest and lockfile dependency source descriptors are preserved for hosted / git / path / sdk forms
publish_to: none, legacy top-level lockfilesdk:, and additional pubspec metadata fields are surfaced explicitly
Improvements
1. Dependency scope correction
Rust preserves explicit dependency scopes from pubspec.yaml instead of leaving them null. Runtime dependencies stay under dependencies; development-only ones stay under dev_dependencies; environment constraints stay under environment.
2. YAML description fidelity
Rust preserves trailing newlines from folded/literal YAML description blocks, which keeps the original semantic formatting intact.
3. Lockfile direct/dev/transitive semantics
Rust now keeps pub lockfile intent more truthfully instead of flattening every entry into a direct runtime dependency:
direct main→is_direct=true,is_runtime=truedirect dev→is_direct=true,is_runtime=false,is_optional=truetransitivepackages are classified by graph reachability from direct main vs direct dev roots- legacy top-level
sdk:is accepted alongside modernsdks:
This means dev-only transitives are no longer overstated as runtime dependencies just because they appear in the lockfile.
4. Dependency source descriptor preservation
Rust now keeps richer dependency-source detail for pubspec manifests and lockfiles:
- manifest dependency maps preserve hosted / git / path / sdk descriptors in dependency
extra_data - lockfile package entries preserve
source,description, and dependency-kind metadata in both dependency and resolved-packageextra_data - path lockfile entries such as
{ path: "../pkg", relative: true }no longer disappear into a generic version-only view
5. Pub metadata parity
Rust now also surfaces several package-level pubspec metadata fields more truthfully:
publish_to: nonemarks the package as privatearchive_urlis honored asdownload_urlplatforms,funding,topics,screenshots,false_secrets, andignored_advisoriesare preserved inextra_datatopicsalso populatekeywords
6. Pub workspace topology
- Root
pubspec.yamlworkspace:member paths are preserved inextra_data.workspace_members. - Assembly claims those member directories for Dart workspace topology, keeps each member as its own package, and attributes a shared root
pubspec.lockhonestly to members that declare matching direct deps (otherwise hoisted).
Coverage
Coverage includes:
- explicit dependency scope extraction
- YAML newline preservation
- lockfile direct/dev/transitive classification
- hosted / git / path / sdk descriptor preservation
- legacy
sdk:lockfile compatibility publish_to: noneandarchive_urlbehavior- pub workspace member extraction and topology assembly
- parser-only goldens for publish metadata, dict-style dependency descriptors, and path lockfiles