Repository navigation
refactor!: drop the deprecated @cldmv/uuid/main alias - #154
Merged
Merged
Conversation
The tsup bundles are replaced by scripts/build.mjs, which runs esbuild over every src/**/*.mjs file with bundle: false. Each module is minified on its own with names kept and written to the same path under dist/, with a source map. Nothing is merged or copied between entries any more, so the code the subpaths share exists once. The @cldmv/uuid/rng, /bytes and /hash self-imports stay as written, so the browser variants are still picked through the exports map. src/index.cjs is copied verbatim. The CJS entry test now checks that dist/ mirrors src/, that only dist/uuid.mjs defines the UUID class, and that the subpath imports and inlined issuer data are still there. Resolves #138
The "./main" export, src/main.mjs and its declaration are removed, along with the alias tests and the README note. The alias was kept until the next major, and v3.0.0 is that major. Import "@cldmv/uuid" instead; it exports the same objects. With main.mjs gone nothing in the package has side effects, so "sideEffects" is false. The CJS entry test now checks that "@cldmv/uuid/main" fails with ERR_PACKAGE_PATH_NOT_EXPORTED. BREAKING CHANGE: "@cldmv/uuid/main" no longer resolves. Import "@cldmv/uuid".
Shinrai
added a commit
that referenced
this pull request
Nov 30, 2026
Shinrai
previously approved these changes
Nov 30, 2026
cldmv-bot
Bot
dismissed
Shinrai’s stale review
November 30, 2026 06:50
The merge-base changed after approval.
Shinrai
added a commit
that referenced
this pull request
Nov 30, 2026
## 🚀 What's Changed ### 💥 Breaking Changes _No breaking changes_ ### ✨ Features _No new features_ ### 🐛 Bug Fixes _No bug fixes_ ### 📦 Dependencies _No dependency updates_ ### 🔧 Other Changes - docs: cover #154 in the v3.0.0 changelog (#153) (9b7c59c) - docs: cover #138 in the v3.0.0 changelog (#153) (391056e) <details> <summary>👥 Contributors</summary> - @Shinrai </details>
cldmv-bot Bot
added a commit
that referenced
this pull request
Nov 30, 2026
# `@cldmv/uuid` v3.0.0 Changelog
**Release Date**: November 2026
**Release Type**: Major
**Branch**: `release/3.0.0`
---
## Overview
v3.0.0 switches the CommonJS entry to the generic `index.cjs` shim used across the CLDMV libraries. `require("@cldmv/uuid")` now returns the module object, the same exports `import` gives, instead of the `UUID` class with properties attached.
There are two breaking changes. The `require()` shape changes, which only affects code that treats the result as the `UUID` class, and the deprecated `@cldmv/uuid/main` alias is removed ([#154](#154)). ESM `import` is unchanged, and so is every `UUID` method. The release also closes off the issuer registry: its bundled data and its entries are now private, and the registry won't let a ratified entry change ([#148](#148)). `dist/` is now built one file per module instead of as tsup bundles, so the code the subpaths share ships once ([#152](#152)).
---
## 💥 Breaking Changes
### `require("@cldmv/uuid")` returns the module object ([#141](#141), fixes [#140](#140))
The ESM entry exports two distinct values, the `UUID` class (also exported as `uuid` and `default`) and `ISSUER_CATEGORIES`, so the shim hands back the module object:
```javascript
const uuid = require("@cldmv/uuid");
// => { __esModule, default: UUID, UUID, uuid, ISSUER_CATEGORIES }
const { UUID } = require("@cldmv/uuid");
UUID.TB();
```
- `new (require(x))()` becomes `new (require(x).UUID)()`, or `const { UUID } = require(x)`.
- Statics called on the result, such as `require(x).v4()`, `require(x).NIL` and `require(x).DNS`, move to the class: `require(x).UUID.v4()`, `UUID.NIL`, `UUID.DNS`.
- `require(x).UUID`, `require(x).uuid` and destructuring keep working.
- `require(x).default` and `require(x).ISSUER_CATEGORIES` are newly available.
`src/index.cjs` is now the generic shim used by the other CLDMV libraries: the Node version guard, then `require("./index.mjs")`. With one distinct exported value it returns that value with `.default` and every export name attached; with several, as here, it returns the module object untouched. The build still copies it unchanged to `dist/index.cjs`. The CJS test expects the module object and checks that the statics are no longer top-level keys.
The first cut of the shim in [#141](#141) returned the single value or the module object without the `.default` and name aliases for the single-value case. [#147](#147) syncs `src/index.cjs` with the corrected template. Nothing changes for uuid, since its entry has two distinct values and `require()` still gives the module object, and the CJS test now also asserts that `UUID` isn't decorated with `.default` or `ISSUER_CATEGORIES`.
### The deprecated `@cldmv/uuid/main` alias is removed ([#154](#154))
`@cldmv/uuid/main` has been a deprecated alias of the package root since v1.3.0, with a one-time `DeprecationWarning` (`CLDMV_UUID_MAIN`), and was kept until the next major. The `./main` export, `src/main.mjs` and its declaration are gone, so importing `@cldmv/uuid/main` now fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`. Import `@cldmv/uuid` instead; it exports the same objects. With the alias gone nothing in the package has import-time side effects, so `package.json` sets `"sideEffects": false`.
---
## 🐛 Bug Fixes
### The issuer data and registry are private, and ratified entries can't change ([#148](#148))
The bundled Category A and B issuer data and the registry's entries could be reached and changed from outside the registry. Now:
- The bundled data is a frozen constant inside `issuer-registry.mjs`, no longer a separate `src/data/issuers.json` import, and the registry keeps its entries in a private field.
- Everything the registry returns is a frozen copy, or a fresh copy for `export()`, so `UUID.getIssuerInfo()` hands back a read-only object. `ISSUER_CATEGORIES` is frozen too.
- The shared registry instance lives in module scope instead of `UUID._registryInstance`, and concurrent first calls to `UUID.getRegistry()` share one instance.
- The reserved IDs (0, 1 and 404) and the bundled Category A and B issuers are ratified: entries carry `ratified: true` and nothing can change, replace or remove them. Entries added at runtime carry `ratified: false`. `import()` throws if it would alter a ratified entry or mark an entry ratified; an export from before the flag existed still imports when its ratified entries match.
If you were mutating a returned issuer object or reading `UUID._registryInstance`, that no longer works. Registering and looking up issuers through the public API is unchanged.
### The package loads on its stated Node.js floor again ([#148](#148))
v2.1.0 loaded the issuer data with `import issuers from "../data/issuers.json" with { type: "json" }`. The `with` form of import attributes needs Node.js 18.20, or 20.10 on the 20 line, so on the older versions `engines.node` (`>=16.12.0`) still allowed, importing the package failed with a `SyntaxError`. With the data inlined there is no JSON import left, and the built `dist/` loads and runs on Node.js 16.12.0. The `engines.node` floor of `>=16.12.0` is unchanged and now holds.
---
## 🔧 Build
### `dist/` mirrors `src/`, one minified file per module ([#152](#152), fixes [#138](#138))
The tsup build made a separate bundle for each export (`.`, `./main`, `./rng`, `./bytes`, `./hash` and `./entropy`), so the code they share was copied into several files. An app that imported more than one subpath loaded it more than once. `scripts/build.mjs` now runs esbuild over every `src/**/*.mjs` file with `bundle: false` and the `node16` target. Each module is minified on its own with names kept and written to the same path under `dist/`, so `UUID` and every helper exist once. The `@cldmv/uuid/rng`, `/bytes` and `/hash` imports are left as written, so a browser bundler still picks the browser variants through the exports map. `src/index.cjs` is still copied verbatim.
The `exports` map, the entry points and what each subpath exports are unchanged. The tarball now holds one `.mjs` file per source module, and the `.map` files are still left out by `files`.
## 🔧 CI & tooling
- `ci.yml` adopts the CLDMV/.github v4.46.0 concurrency block, so superseded runs on `next`, `hotfixes` and feature branches are cancelled ([#142](#142), fixes [#139](#139)).
## 📚 Documentation
- **NEW:** [docs/changelog/v3/v3.0.0.md](https://github.com/CLDMV/uuid/blob/v3.0.0/docs/changelog/v3/v3.0.0.md): this changelog.
- README: the CommonJS requirements note and example show the module object.
- README What's New promoted to v3.0.0.
## 🔧 Dependencies
- **CLDMV dev tools** ([#145](#145), [#150](#150)): `@cldmv/vitest-runner` 1.5.6 → 1.11.5, `@cldmv/configs` 1.4.0 → 1.5.1 and `@cldmv/fix-headers` 2.2.4 → 2.6.2, plus `npm update` for the rest. `fix-headers` 2.6.1 restamped the file headers, which now write `@Filename` without a leading slash, and `dependabot.yml` takes the npm groups from the CLDMV/.github v4.47.0 template. Development only; nothing changes for consumers.
- `esbuild` added and `tsup` removed ([#152](#152)).
---
## Upgrade notes
- `require("@cldmv/uuid")` no longer returns the `UUID` class. Use `const { UUID } = require("@cldmv/uuid")`, and call statics on `UUID` (`UUID.v4()`, `UUID.NIL`, `UUID.DNS`).
- `require(x).UUID`, `.uuid` and destructuring work as before; `.default` and `.ISSUER_CATEGORIES` are new.
- `@cldmv/uuid/main` is gone. Import `@cldmv/uuid` instead, which exports the same objects.
- ESM `import` from `@cldmv/uuid` and its other subpaths is unchanged.
- On Node.js 16.12 to 18.19 (and 20.0 to 20.9), the package loads again; v2.1.0 failed there.
<details>
<summary>👥 Contributors</summary>
- @Shinrai
</details>
---
<!-- coverage-start -->

| Metric | Coverage |
|--------|----------|
| Statements | 100.0% |
| Branches | 100.0% |
| Functions | 100.0% |
| Lines | 100.0% |
*Avg: **100.0%** · `3fdb25a` · Node lts/**
<!-- coverage-end -->
<!-- co-authors -->
Co-authored-by: Shinrai <[email protected]>
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
✨ Features
No new features
🐛 Bug Fixes
No bug fixes
📦 Dependencies
No dependency updates
🔧 Other Changes
👥 Contributors