wasmerio / wapm-cli

📦 WebAssembly Package Manager (CLI)
https://wapm.io/
MIT License
373 stars 26 forks source link

Package data files #195

Open whitequark opened 4 years ago

whitequark commented 4 years ago

Motivation

I've published many of the FOSS FPGA tools as WebAssembly-based PyPI packages in the YoWASP project. All of these tools require data files located in the filesystem, and it is impractical to adjust their code to read file data embedded directly in the binary. Because of this, they are currently distributed together with a small Python stub that sets up the preopens.

I'd like to distribute these tools via WAPM too.

Proposed solution

It would be great if WAPM made it possible to provide data files as a part of the package. These files would be mounted in a location accessible only to the package itself, preopened automatically.

Alternatives

Some kind of WASI interposer that allows embedding data files in the WASM file without requiring any changes to the source would also work.

proohit commented 3 years ago

I have a similar use-case where I want to publish a WASI/WASM alongside it's glue code as some kind of WASM library. That way, I could publish a WAPM package and use it from different projects using their corresponding glue code, all via WAPM. AFAIS, WAPM only accepts a single source file, but that doesn't allow me to publish glue code.