libsodium.js
libsodium.js copied to clipboard
ESM support
Here's a proof-of-concept of an ES Modules build.
I haven't tested if this achieves any sort of file-size reduction through tree-shaking. I'm just doing this to facilitate use in the Deno runtime (https://deno.com).
To test, with Deno installed:
- Checkout this code
- Copy
emscripten.sh
from https://github.com/jedisct1/libsodium/pull/1382 tolibsodium/dist-build/emscripten.sh
-
make esm
-
deno
-
> import sodium from "./dist/modules/libsodium-esm-wrappers.js"
-
> await sodium.ready
-
> sodium.crypto_secretbox_keygen()
Any feedback on the approach so far? If not, I'll just plan to add Make targets for the sumo builds and get the automated tests running against this (I think there are some—haven't looked deeply).