rnix-parser icon indicating copy to clipboard operation
rnix-parser copied to clipboard

Experiment: publish crate to NPM using `wasm-pack`

Open yvan-sraka opened this issue 3 years ago • 2 comments

Summary & Motivation

The main motivation is to be able to use this crate in any JS/TS project, and to package and publish it on NPM. You can find the build artifacts generated into ./pkg folder here!

Backwards-incompatible changes

:warning: For the need of wasm-pack wanted target wasm32-unknow-unkwnon, I quickly change the flake.nix configuration, this shouldn't be merged as is.

Further context

We try to build with @RaitoBezarius some experimental GUI frontend for Nix, using Svelte in a first PoC.

yvan-sraka avatar Jan 27 '22 14:01 yvan-sraka

Please note that I'm not necessarily inclined to maintain such a platform as well. However, if you're still willing to work on this (and help out with maintenance), then I'd be OK with merging it in and advertise the support as "experimental". Please rebase your branch in that case.

Ma27 avatar Jun 26 '22 15:06 Ma27

I'm also not sure if/how this is beneficial (I've wrote nix2js stuff), and I have no idea how this should/could be used by downstream JS or WASM code. I think most stuff that actually wants to use it would currently use an approach like the one used in nix2js (the transpile function is exposed as an API from a wasm-packed rust module, which internally uses rnix-parser); exposing the rnix parser type hierarchy and functions in a way which is actually usable and performant enough sounds hard and cumbersome.

fogti avatar Jul 01 '22 08:07 fogti