Skip to content

feat(browser): make UUID generation zero-node-builtin for browser bundlers - #23

Merged
Shinrai merged 1 commit into
nextfrom
feat/browser-safe-build
Aug 17, 2026
Merged

feat(browser): make UUID generation zero-node-builtin for browser bundlers#23
Shinrai merged 1 commit into
nextfrom
feat/browser-safe-build

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

  • feat(browser): make UUID generation zero-node-builtin for browser bundlers (f9a458d)

🐛 Bug Fixes

No bug fixes

📦 Dependencies

No dependency updates

🔧 Other Changes

No other changes

👥 Contributors

…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
@cldmv-bot cldmv-bot Bot added ! feature → next v4 flow: contributor PR targeting the next integration branch type: feature Implements new functionality — a PR or issue that adds a feature area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure type: dependencies Relates to dependency updates, version bumps, or package management labels Aug 17, 2026
@Shinrai
Shinrai requested a lite review from Copilot August 17, 2026 14:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Shinrai
Shinrai merged commit 2f4b23a into next Aug 17, 2026
25 of 28 checks passed
@cldmv-bot
cldmv-bot Bot deleted the feat/browser-safe-build branch August 17, 2026 14:34
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 -->


![coverage](https://img.shields.io/badge/coverage-87.2%25-green?style=for-the-badge&logo=vitest&logoColor=white)

| 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure ! feature → next v4 flow: contributor PR targeting the next integration branch type: dependencies Relates to dependency updates, version bumps, or package management type: feature Implements new functionality — a PR or issue that adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants