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

chore(deps): Use crypto.randomUUID() instead of uuid module #2252

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nikeee
Copy link

@nikeee nikeee commented Dec 5, 2024

Why

The crypto global is available in all supported Node.js versions as well as in all major browsers. The uuid module is rendered unnecessary for uuidv4.

@react-three/drei is currently downloaded about 253000 times per week, so about 13409000 times per year. uuid@9 is about 3.7 kB in size (gzipped+minified). Removing this dependency saves about 50GB traffic per year.

Checklist

  • Ready to be merged

Copy link

vercel bot commented Dec 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drei ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 8, 2024 2:56pm

Copy link

vercel bot commented Dec 5, 2024

@nikeee is attempting to deploy a commit to the Poimandres Team on Vercel.

A member of the Team first needs to authorize it.

The `crypto` global is available in all supported Node.js versions as well as [in all major browsers](https://caniuse.com/mdn-api_crypto_randomuuid).
The uuid module is rendered unnecessary for uuidv4.

`@react-three/drei` is currently downloaded about 253000 times per week, so about 13409000 times per year. `uuid@9` is about 3.7 kB in size (gzipped+minified). Removing this dependency saves about 50GB traffic per year.
Copy link

codesandbox-ci bot commented Dec 6, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@nikeee
Copy link
Author

nikeee commented Dec 6, 2024

Note: the global crypto object is undefined in non-secure contexts. If it is desired that this library also works in non-secure contexts, just close this PR without any comment.

@abernier
Copy link
Member

abernier commented Dec 7, 2024

what about https://react.dev/reference/react/useId

@nikeee
Copy link
Author

nikeee commented Dec 8, 2024

I think that would be even better in the context of react. Should I change this PR?

@nikeee
Copy link
Author

nikeee commented Dec 8, 2024

Done

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.

2 participants