slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.86k stars 559 forks source link

update the JS node bindings #961

Closed ogoffart closed 9 months ago

ogoffart commented 2 years ago

Right now the node bindings are using an outdated version of neon (0.8) but these don't work with the newer node ( it is sticked at node 16) One problem is that the type that we can wrap needs to be Send, which is not the case for the type used by the slint-interpreter because we use Rc all over the place.

Since the API changed a lot, we should consider if we should switch from neon to something like https://napi.rs/

Hopefully both crates now allow to hold "persistent" handle so we can get rid of our Persistent context hack.

tronical commented 2 years ago

Newer Windows images in GitHub also come with a newer version of Visual Studio (2022), which in turn breaks the neon build, because via its package-lock.json it pins a version of neon-gyp that doesn't know that VS 2022 exists (yet). For now I'll disable the node bindings build on Windows in #1446, but this is yet another argument in favor of upgrading.

jackiealex commented 1 year ago

not work, when executing npm install slint-ui

error are:

npm ERR! code 1 npm ERR! path /Users/alex/workspace/rust.com/share-rust-all/slint-ui-demo/node_modules/slint-ui npm ERR! command failed npm ERR! command sh -c neon build --release && tsc npm ERR! neon info forcing rebuild for new build settings npm ERR! neon info running cargo npm ERR! Updating sjtu index

env info: node -v v16.0.0 cargo -V cargo 1.69.0 (6e9a83356 2023-04-12) macOS rustc -V rustc 1.69.0 (84c898d65 2023-04-16)

tronical commented 9 months ago

Closing this as we released 1.3.0 with it.