npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wurbo

v0.5.3

Published

A tiny front-end framework for webassembly components

Downloads

13

Readme

Wurbo

Because your user interface should be trustless, too.

Experimental Proof of concept web framework using wasm components. All input and UI generation is done in Wasm, so there cannot be "call home" vulnerabilities over your data inputs. This means you can use guest Apps (wasm components) in a trustless fashion in your host app.

Wurbo? Like Turbo, but using Wasm Components. Kind of like Elm too? Render HTML from wasm ui components.

Short Video Hype

Wurbo Demo

Examples

To run the examples locally in the browser, you can use the following commands:

# build-component:
  cargo component build --workspace

# prev: build-component
  npm run build && npm run preview -- --open

or using just: just prev

Demo

The example is demonstrated at https://douganderson444.github.io/wurbo

Use Steps

  1. In your WIT file:
  • declare interface named reactivity with functions render and activate
  • a separate interface (named anything you like, such as imports) with function addeventlistener
  1. In the Rust:
  • create your new Wasm Component using cargo component new --reactor <name>
  • ensure you add render crate to your Cargo.toml dependencies
  • use the wurbo crate's macro to implement the reactivity interface for reactivity::Guest.
  • build your own Page parent component and Input / Output components as you like for your user interface.
  1. In JavaScript:
  • load the wasm bytes + importables into an ES module (called it mod) using rollup-plugin-wit-component
  • mod.reactivity.render(args) uses that module to load the initial data.
  • wurbo.listen(mod) listens for events from the component
  • call mod.reactivity.activate() once the DOM has loaded, to start listening for change events.

Table Summary:

| Step | WIT | Rust | JavaScript | | --- | --- | --- | --- | | 1 | declare interface imports | pass imports to wurbo macro | implement imports as JS code then pass stringified code to rollup-plugin-wit-component fn load via importables | | 2 | declare interface reactivity | implement interface reactvity using the macro and your render crate Components | load reactivity ES module using rollup-plugin-wit-component | | 3 | Ready. | call cargo component build --release | call mod.reactivity.render(args) to get rendered HTML | | 4 | Ready. | Ready. | call wurbo.listen(mod) to set up listeners | | 5 | Ready. | Ready. | When DOM has loaded the rendered HTML, then call mod.reactivity.activate() to actually listen |

Developing

Once you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:

Compile the wasm component, see README.md for more details.

npm run build

# or start the server and open the app in a new browser tab
npm run preview -- --open

Building

To build the code (dev mode does not work due to how Vite handles wasm):

cargo component build --workspace --release
npm run build

You can preview the production build with npm run preview.

To deploy your app, you may need to install an adapter for your target environment.

Publishing

To publish to npm:

just publish

or, manually:

npm run package
npm publish

To publish to crates.io:

cargo publish -p wurbo