webview / webview_deno

🌐 Deno bindings for webview, a tiny library for creating web-based desktop GUIs
https://deno.land/x/webview
MIT License
1.45k stars 75 forks source link

Deno.openPlugin is not a function #96

Closed justinmchase closed 2 years ago

justinmchase commented 3 years ago

With the default example code and the latest version of Deno I get:

error: Uncaught (in promise) TypeError: Deno.openPlugin is not a function return Deno.openPlugin(file.path);

brandonros commented 3 years ago

looks like this package is using https://github.com/denosaurs/plug but v0.2.9 but that package is up to v0.4.1

justinmchase commented 3 years ago

So I took a crack at updating the dependency, the rust components build locally just fine but the problem is that the deno api isn't just a little different but drastically different.

It appears fairly straight forward, especially if you already know how this library is working, but it was a little bigger of a change than I was able to make on a weekend project.

But here is the summary of my discoveries in case anyone else is gonna take this on:

Relevent Docs

  1. Probably dump the plug library entirely
  2. Use Deno.dlopen to load the binary
  3. Modify all of the rust apis to use the #[deno_bindgen] probably
  4. Modify the wrapper functions to pass the right inputs based on the new FFI api

The bindgen repo has examples for strings and structs, etc. I think its the way to go but would require some hefty refactoring it seems.

brandonros commented 3 years ago

I tried the same thing and got stuck that the "new" Deno FFI API only allows Buffers and u8/u16/u32 basically...

I tried to set up the symbols (which the Plug package wants) given the function names and all that but I agree with you, I think deno_bindgen will be needed because... oddly... by design Deno FFI doesn't support structs yet?

justinmchase commented 3 years ago

yeah and the numbers are easy to convert but the strings require some wrapper to convert to buffers and likely something on the native side to make sure its converting the buffer to a string properly.

eliassjogreen commented 3 years ago

Im working on deno#12828 which should enable everything that is required for webview_deno to work once again, plug is updated and should work so now its just a matter of finishing my pr.

brandonros commented 3 years ago

@eliassjogreen Happy to hear it. Thank you very much for what you are doing.

Will it look somewhat like this: https://github.com/node-ffi-napi/ref-struct-di ?

brandonros commented 2 years ago

https://github.com/denoland/deno/pull/12828/files landed. Sounds like we need to wait for v1.17.0 to come out of Deno, then for Elias to update https://github.com/denosaurs/plug and then pull those changes into this repo, then also update this repo for the new FFI format.

zoeleu commented 2 years ago

Still blocked?

eliassjogreen commented 2 years ago

99 Yep, kind of

justinmchase commented 2 years ago

YESS YESSS