Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for top-level WIT resources #508

Open
ctaggart opened this issue Oct 14, 2024 · 2 comments
Open

support for top-level WIT resources #508

ctaggart opened this issue Oct 14, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@ctaggart
Copy link

I would really love to see support for WIT resources https://component-model.bytecodealliance.org/design/wit.html#resources . I tried to use them and received the "not yet implemented" error. My cowsay.wit just added a resource:

package local:cowsay;
world cowsay {
  export test: func() -> string;
  export ts-version: func() -> string;
  resource compiler-options {
    constructor();
  }
}

The error looks to be raised from this todo:

TypeDefKind::Resource => todo!(),
TypeDefKind::Handle(_) => todo!(),

$ bunx jco transpile cowsay.wasm -o dist
thread '<unnamed>' panicked at crates/js-component-bindgen/src/ts_bindgen.rs:159:50:
not yet implemented
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
(jco transpile) RuntimeError: unreachable
    at js_component_bindgen_component.wasm.__rust_start_panic (wasm://wasm/js_component_bindgen_component.wasm-19499d82:wasm-function[43527]:0x10844a8)
    at js_component_bindgen_component.wasm.rust_panic (wasm://wasm/js_component_bindgen_component.wasm-19499d82:wasm-function[43520]:0x108403a)
    at js_component_bindgen_component.wasm._ZN3std9panicking20rust_panic_with_hook17h002a9d757cec9266E (wasm://wasm/js_component_bindgen_component.wasm-19499d82:wasm-function[43518]:0x1083ea0)
    at js_component_bindgen_component.wasm._ZN3std9panicking19begin_panic_handler28_$u7b$$u7b$closure$u7d$$u7d$17h5e11e16f0cbe0dd6E (wasm://wasm/js_component_bindgen_component.wasm-19499d82:wasm-function[43503]:0x1083101)
    at js_component_bindgen_component.wasm._ZN3std3sys9backtrace26__rust_end_short_backtrace17h34d7c06dcd4fe40dE (wasm://wasm/js_component_bindgen_component.wasm-19499d82:wasm-function[43502]:0x1083040)
    at js_component_bindgen_component.wasm.rust_begin_unwind (wasm://wasm/js_component_bindgen_component.wasm-19499d82:wasm-function[43510]:0x10837f0)
    at js_component_bindgen_component.wasm._ZN4core9panicking9panic_fmt17h7e49d43cccf0228eE (wasm://wasm/js_component_bindgen_component.wasm-19499d82:wasm-function[43665]:0x1092409)
    at js_component_bindgen_component.wasm._ZN4core9panicking5panic17h5b9417a441e14606E (wasm://wasm/js_component_bindgen_component.wasm-19499d82:wasm-function[43677]:0x1093c1f)
    at js_component_bindgen_component.wasm._ZN20js_component_bindgen10ts_bindgen10ts_bindgen17hab2dd0c35ae02bc7E (wasm://wasm/js_component_bindgen_component.wasm-19499d82:wasm-function[4482]:0x234b85)
    at js_component_bindgen_component.wasm._ZN20js_component_bindgen9transpile17h41ffb8ce162c7f32E (wasm://wasm/js_component_bindgen_component.wasm-19499d82:wasm-function[4516]:0x245b3b)
error: script "transpile" exited with code 1
error: script "build" exited with code 1
@guybedford
Copy link
Collaborator

Resources are only supported nested inside of interfaces currently - this new feature supporting top-level resource world items would be great to support.

@guybedford guybedford added the enhancement New feature or request label Oct 15, 2024
@cataggar
Copy link

I did not realize they should work inside of interfaces. Thank you. Will try.

@ctaggart ctaggart changed the title support for WIT resources support for top-level WIT resources Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants