Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 modules #170

Open
dchest opened this issue Aug 10, 2019 · 9 comments
Open

ES6 modules #170

dchest opened this issue Aug 10, 2019 · 9 comments

Comments

@dchest
Copy link
Owner

dchest commented Aug 10, 2019

What's the minimal amount of changes needed to support ES6 module-style export?

@hakanols
Copy link

I have published a NPM package that is a modification of this to only handle es6
https://www.npmjs.com/package/tweetnacl-es6
https://github.com/hakanols/tweetnacl-es6

@evbogue
Copy link

evbogue commented May 15, 2020

@dchest any progress on this issue?

@dchest
Copy link
Owner Author

dchest commented May 15, 2020

@evbogue not yet, sorry. I hope to work on it some time soon though.

@evbogue
Copy link

evbogue commented May 15, 2020

@dchest cool. I got @hakanols 's fork working in Deno just a moment ago.

But, I'd want to use this library in the future, if possible.

@roopakv
Copy link

roopakv commented Jun 3, 2020

@dchest would love to see this one pushed through. Am willing to help, so if there is anything I can do please let me know

@dchest
Copy link
Owner Author

dchest commented Jun 3, 2020

@roopakv thank you! I’ll try to get some time to work on it this weekend.

@bcomnes
Copy link

bcomnes commented Apr 1, 2021

If you end up tackling this, it would be great to also get https://github.com/dchest/nacl-stream-js with native esm exports. Happy to help out there once you set an example of how you want this tackled.

If you are sticking with using npm for publishing native semantically versioned esm, unpkg in ?module mode can provide browser and deno compatibility.

@dyoder
Copy link

dyoder commented Aug 5, 2021

FYI, we've published an interim module similar to @hakanols except supporting dual imports (using the exports field in packag.json):

https://www.npmjs.com/package/@dashkite/tweetnacl
https://github.com/dashkite/tweetnacl-js

@bmdelacruz
Copy link

Check out my fork bmdelacruz@5c4460f!

It's completely tested and (somewhat) backwards compatible. The only breaking change is that consumers now need to call one of the new functions called setPRNG, setGlobalCryptoPRNG, and setNodeCryptoPRNG when using functions that depends on the PRNG, e.g. nacl.sign.keyPair and nacl.box.keyPair. The resulting nacl-fast.min.js is now slightly larger though (31.4 KB -> 36.4 KB). nacl.min.js too: (18 KB -> 18.6 KB).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants