rnix-parser
rnix-parser copied to clipboard
Experiment: publish crate to NPM using `wasm-pack`
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.
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.
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.