Skip to content

fix(core): don't resolve nested packages as dependencies - #264

Open
ashitikov wants to merge 1 commit into
bytecodealliance:mainfrom
ashitikov:fix/nested-packages
Open

ashitikov wants to merge 1 commit into
bytecodealliance:mainfrom
ashitikov:fix/nested-packages

Conversation

@ashitikov

Copy link
Copy Markdown

Packages defined with nested package ... { ... } blocks are provided inline (WIT.md: "so that they don't have to be otherwise resolved via the filesystem or a registry"), so wkg should neither resolve them nor write them into deps/. Two changes in crates/wasm-pkg-core/src/wit.rs:

  • get_packages leaves out the packages its group defines: the main package and the nested ones. This fixes fetch, build, publish and a workspace fetch; fetch also works now when a path-overridden dependency defines nested packages.
  • For WIT output, populate_dependencies no longer writes the root's nested packages into deps/, where the next parse would find them defined twice. It parses the root again to learn them, so that the public generate_resolve keeps its signature.

Tests: test_inline_packages (WIT and wasm output) and test_build_inline_packages, on a new inline-packages fixture whose nested package depends on a path-overridden one. All three fail without the change.

  • cargo test --workspace --exclude wasm-pkg-client --exclude wkg
  • cargo clippy --workspace --no-default-features, cargo clippy --workspace --all-features, cargo clippy -p wasm-pkg-core --all-targets
  • cargo fmt --all -- --check

Closes #263

Packages a root defines with nested `package ... { ... }` blocks are
provided inline, so they are no longer resolved from a registry or
written into deps/.
@ashitikov
ashitikov requested a review from mkatychev as a code owner November 20, 2026 21:18
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.

Nested package ... { ... } blocks are resolved from a registry

1 participant