Skip to content

Versioned dependencies (via --dep) are not found #136

Open

Description

@itowlson

I have the following WAC document:

package root:component-val@0.0.1 targets fermyon:spin/http-trigger@2.0.0;

let c = new root:component { ... };

export c...;

I resolve it like so:

wac resolve aaugh.wac --registry wa.dev --dep "root:component=./target/wasm32-wasi/release/calculator_spin.wasm"

And life is good. But if I change root:component to have a version:

package root:component-val@0.0.1 targets fermyon:spin/http-trigger@2.0.0;

let c = new root:component@0.0.1 { ... };

export c...;

and invoke with the version:

wac resolve aaugh.wac --registry wa.dev --dep "root:component@0.0.1=./target/wasm32-wasi/release/calculator_spin.wasm"

I get:

error: failed to resolve document

  × package `root:component` does not exist in the registry
   ╭─[aaugh.wac:3:13]
 2 │ 
 3 │ let c = new root:component@0.0.1 { ... };
   ·             ──────────┬─────────
   ·                       ╰── package `root:component` does not exist
 4 │ 
   ╰────

(If I revert the command line to the unversioned, uh, version, same error.)

Is this behaviour intentional? If so, could the error indicate more specifically what the user should do to fix it?

Activity

  1. calvinrp commented on Jul 30, 2024

    @calvinrp
    Collaborator

    This might be the relevant line that needs to be revised: https://github.com/bytecodealliance/wac/blob/main/crates/wac-resolver/src/fs.rs#L37

    Some(path) if key.version.is_none() => { might need to drop the conditional requirement that version not being specified in order to use the overrides file path.

    @itowlson let me know if that fixes

  2. itowlson commented on Jul 30, 2024

    @itowlson
    ContributorAuthor

    @calvinrp Thanks for looking into that. The fix you suggest worked for me (in my one test case!). I haven't explored if it impacts anything else though - @peterhuene do you recall why you specified that condition?

  3. calvinrp commented on Jul 30, 2024

    @calvinrp
    Collaborator

    A PR could add additional test cases and document the expected usage patterns. Seems safe to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions