feat(browser): make UUID generation zero-node-builtin for browser bundlers - #23
Merged
Conversation
…dlers The static `import crypto from "crypto"` in uuid.mjs and every RFC/timestamp version file made the package unbundlable for browser targets (esbuild platform:"browser" fails to resolve "crypto"), and the internal Buffer-based representation would still throw ReferenceError at runtime even past that. Splits crypto/hex/hash access into isomorphic node+browser module pairs (./rng, ./bytes, ./hash) selected via the package's "browser" export condition, self-referenced from within the package. Node keeps its native Buffer/crypto-backed fast paths; the browser variants use globalThis.crypto.getRandomValues and hand-rolled MD5/SHA-1 (crypto.subtle is async, which would break v3/v5's synchronous API). The internal UUID buffer representation moves from Buffer to plain Uint8Array so it works in both runtimes. versions/timestamp/*, versions/issuer/*, and entropy-sources.mjs are dead code never imported by uuid.mjs and were left untouched. Verified against RFC 1321 (MD5) / FIPS 180-1 (SHA-1) test vectors, node:crypto cross-checks, and an actual headless-Chromium run confirming zero Buffer/ node:crypto references and correct output (including the standard v3/v5 DNS namespace vectors). Fixes #21
Copilot stopped reviewing on behalf of
Shinrai due to an error
August 17, 2026 14:32
Shinrai
approved these changes
Aug 17, 2026
Shinrai
added a commit
that referenced
this pull request
Aug 17, 2026
…#20) ## 🚀 What's Changed ### 💥 Breaking Changes _No breaking changes_ ### ✨ Features - #23 - feat(browser): make UUID generation zero-node-builtin for browser bundlers (f9a458d) ### 🐛 Bug Fixes _No bug fixes_ ### 📦 Dependencies - #19 - deps: bump @cldmv/fix-headers from 1.3.7 to 1.3.9 in the patch group (d382fa8) ### 🔧 Other Changes _No other changes_ <details> <summary>👥 Contributors</summary> - @Shinrai </details> --- <!-- coverage-start -->  | Metric | Coverage | |--------|----------| | Statements | 85.8% | | Branches | 84.9% | | Functions | 92.5% | | Lines | 85.5% | *Avg: **87.2%** · `e297a4a` · Node lts/** <!-- coverage-end --> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: cldmv-bot[bot] <230771808+cldmv-bot[bot]@users.noreply.github.com> Co-authored-by: Shinrai <Shinrai@users.noreply.github.com> Co-authored-by: Nathaniel H <7722267+Shinrai@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 What's Changed
💥 Breaking Changes
No breaking changes
✨ Features
🐛 Bug Fixes
No bug fixes
📦 Dependencies
No dependency updates
🔧 Other Changes
No other changes
👥 Contributors