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

refactor: convert to native esm #261

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PhearZero
Copy link

@PhearZero PhearZero commented Feb 15, 2024

Overview

Node 16 and all major browsers now support esm modules. This proposes refactoring the module in a non-breaking way in order to better leverage modern bundlers.

This could be refactored to be less code changes, this work was just looking for bundle optimizations for an sdk module. The least amount of changes would be having a single file. I have no issues with reworking this PR just seeing how difficult it would be and learning more about it's structure.

TODO

  • Convert nacl.js to ESM
    • Pass node.js specifications
    • Pass full node.js specification
    • Pass browser specifications
  • Convert nacl-fast.js to ESM
    • Pass node.js specifications
    • Pass full node.js specification
    • Pass browser specifications
  • Update build artifacts
    • Build commonjs and umd artifacts
    • Define hot paths for exports key
    • Create bundle analyzer pipeline

Legal Assertion

I dedicate any and all copyright interest in this software to the
public domain. I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors. I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

@PhearZero
Copy link
Author

@dchest I have a way to load the random number generator in an esm friendly way for node.js.

If the browser doesn't support an RNG, this should fail with the check for process

Relates to: StableLib/stablelib#51 (comment)

Repository owner deleted a comment Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant