Skip to content

feat: build from src/ with tsup and keep ./main as a deprecated alias - #80

Merged
Shinrai merged 9 commits into
nextfrom
feat/library-layout
Nov 1, 2026
Merged

Shinrai merged 9 commits into
nextfrom
feat/library-layout

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

🐛 Bug Fixes

📦 Dependencies

No dependency updates

🔧 Other Changes

👥 Contributors

The entries move to src/index.mjs and src/index.cjs, and src/index.mjs
imports ./uuid.mjs instead of the package's own @cldmv/uuid/main. tsup
bundles dist/index.mjs, copies src/index.cjs to dist/index.cjs verbatim,
and builds one entry per subpath (./rng, ./bytes, ./hash and their browser
variants). The rng/bytes/hash subpaths stay external so a bundler still
picks the browser variants through the exports map.

./main is now a deprecated alias of the root: it re-exports src/index.mjs
and warns once per process with code CLDMV_UUID_MAIN. dist/main.mjs imports
dist/index.mjs instead of carrying its own copy.

The uuid-dev condition moves onto "." (import and require point at src/),
main/module/types point at dist/ and types/src/, files ships dist/, types/
and typings/, and prepack builds. build:ci runs lint, format:check (when
present), types:build and build.

The issuer registry imports data/issuers.json statically, so the data is
inlined into the bundle; reading it relative to the module's own path would
point outside dist/.

Closes #78
…e-size

coverage_build_command runs npm run build:ci, and bundle-size measures dist/**.mjs and dist/**.cjs now that the root index.* files are gone.

Refs #78
…the deprecated ./main alias

Also corrects the Node.js requirement: the engines floor is ^20.19.0 || >=22.13.0 for import as well as require().

Refs #78
@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: ci Changes to CI workflows, actions, or build pipelines labels Nov 1, 2026
@cldmv-bot cldmv-bot Bot changed the title docs: describe the src/ and dist/ layout, the uuid-dev condition and the deprecated ./main alias feat: build from src/ with tsup and keep ./main as a deprecated alias Nov 1, 2026
@cldmv-bot cldmv-bot Bot added type: config Changes to repository or project configuration files type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments labels Nov 1, 2026
@cldmv-bot

cldmv-bot Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Auto-normalized PR title: rewrote PR title to match the highest-priority commit type (feat).

  • Before: docs: describe the src/ and dist/ layout, the uuid-dev condition and the deprecated ./main alias
  • After: feat: build from src/ with tsup and keep ./main as a deprecated alias

If this isn't what you want, edit the title — the normalizer won't re-fire as long as the title stays conventional.

The dev toolchain (chokidar 6, tsup 9) needs Node 22.22, so nothing older can be tested. engines, the CJS guard message and the CI matrix floor move together.
Shinrai
Shinrai previously approved these changes Nov 1, 2026
@Shinrai
Shinrai merged commit 7f0b44d into next Nov 1, 2026
28 checks passed
@cldmv-bot
cldmv-bot Bot dismissed Shinrai’s stale review November 1, 2026 22:05

The merge-base changed after approval.

@cldmv-bot
cldmv-bot Bot deleted the feat/library-layout branch November 1, 2026 22:05
cldmv-bot Bot added a commit that referenced this pull request Nov 2, 2026
# `@cldmv/uuid` v1.3.0 Changelog

**Release Date**: November 2026
**Release Type**: Minor
**Branch**: `release/1.3.0`

---

## Overview

v1.3.0 moves the package to a built layout: the code lives in `src/`, tsup bundles it into `dist/`, and the published package ships `dist/`, `types/` and `typings/` instead of root `index.mjs` / `index.cjs` files and a raw copy of the source. The `UUID` API, the generated UUIDs and the import paths consumers use (`@cldmv/uuid`, `@cldmv/uuid/rng`, `@cldmv/uuid/bytes`, `@cldmv/uuid/hash`) are unchanged. `@cldmv/uuid/main` still works but is now a deprecated alias of the package root.

**The Node.js floor goes up from 16.12.0 to 22.22.0.** That is a real requirement change in a minor release; see [Breaking Changes](#-breaking-changes) and the upgrade notes before upgrading.

---

## ✨ Features

### Built from `src/` with tsup ([#80](#80), closes [#78](#78))

- **Entry files.** The ES module entry is `src/index.mjs` and the CommonJS entry is its sibling `src/index.cjs`. tsup bundles `src/index.mjs` into a minified `dist/index.mjs` (function and class names kept) and copies `src/index.cjs` verbatim to `dist/index.cjs`, a few lines that `require()` the sibling `index.mjs`. `require("@cldmv/uuid")` still returns the `UUID` class with `UUID`, `uuid` and `ISSUER_CATEGORIES` on it, and the CommonJS and ES module entries return the same objects.
- **Subpaths.** `./rng`, `./bytes` and `./hash` are built as their own files in `dist/lib/`, Node and browser variants both, and the main bundle imports them through the package's exports map. A bundler therefore still picks the `browser` variant instead of getting the Node one baked into `dist/index.mjs`.
- **Issuer data is bundled.** The issuer registry imports `data/issuers.json` statically instead of reading it from disk with `fs` relative to its own path, so the data is inlined into the bundle. The registry no longer imports `fs`, `path` or `url`, and the `Could not load issuers.json` warning for a missing file is gone because the file can no longer be missing.
- **Types.** Declarations come from `types/src/`. `@cldmv/uuid/main` now has the same types as the root.
- **`sideEffects`.** The package is still side-effect free except for the `./main` alias, which prints its deprecation warning on import; `sideEffects` lists that file.

### `@cldmv/uuid/main` is a deprecated alias ([#80](#80))

`@cldmv/uuid/main` used to point at its own copy of the UUID module. It now re-exports the package root, so every value is the same object `@cldmv/uuid` exports, and it gains the default export the root has. Importing it prints a `DeprecationWarning` once per process with code `CLDMV_UUID_MAIN` (`console.warn` where there is no `process`). `node --no-deprecation` silences it. The alias is removed in the next major version; import `@cldmv/uuid` instead.

### `uuid-dev` export condition on the root ([#80](#80))

The `uuid-dev` condition, which before only covered the subpaths, now sits on `.` too, for `import`, `require` and `types`. In a checkout the package resolves to the built `dist/` by default and to `src/` under `--conditions=uuid-dev`. The test suites run against `src/` through it. Installed copies never see the condition.

## 💥 Breaking Changes

### Node.js 22.22.0 or later ([#79](#79), [#80](#80))

`engines.node` is `>=22.22.0`, for `import` and `require()` alike. v1.2.6 declared `>=16.12.0` for `import`, and its README said `require()` needed `^20.19.0 || >=22.12.0`. [#79](#79) first raised the floor to `^20.19.0 || >=22.13.0`, and [#80](#80) raised it again to 22.22.0 because the development toolchain (tsup 9 among others) doesn't run on earlier 22.x releases, so they can't be tested. The `require()` error message on a Node.js without `require(esm)` and the CI matrix floor say 22.22.0 too.

This ships in a minor release, but on Node.js 16 through 22.21 installs now report `EBADENGINE` (or fail under `engine-strict`), and those versions are no longer tested.

## 🐛 Bug Fixes

### Development check removed ([#79](#79))

The root `devcheck.mjs`, which the entry tried to load in a source checkout, is gone along with its test. It was never published, so installed copies are unaffected. The `uuid-dev` condition already chooses `src/` or `dist/` in a checkout.

## 🔧 CI & tooling

- `build:ci` runs lint and format checks when present, then `types:build` and the tsup `build`; the coverage jobs run it before measuring (`coverage_build_command`) ([#80](#80)).
- `test:cjs` and `test:types` build first, and the CommonJS tests cover both `dist/` and `src/` entries. A new test covers the `./main` alias and its warning ([#80](#80)).
- The bundle-size check measures `dist/**.mjs` and `dist/**.cjs` ([#80](#80)).
- The CI matrix floor is 22.22.0 (was 22.12.0) ([#80](#80)).
- `prepack` runs the build, so a packed or published tarball always carries a fresh `dist/`.

## 📚 Documentation

- **NEW:** [docs/changelog/v1/v1.3.0.md](./v1.3.0.md): this changelog.
- README: the requirements list the 22.22.0 floor and the deprecated `./main` alias, and a new "Source layout" section covers `src/`, `dist/` and the `uuid-dev` condition ([#80](#80)).
- README What's New promoted to v1.3.0.

## 🔧 Dependencies

The package still has no runtime dependencies. Everything below is development-only ([#82](#82), which also covers Dependabot [#69](#69) and the redirected PRs [#68](#68), [#71](#71), [#73](#73), [#75](#75) and [#77](#77)).

| Package | Before | Now | Note |
| --- | --- | --- | --- |
| `tsup` | not installed | 9.0.0 | new, builds `dist/` ([#80](#80)) |
| `typescript` | 5.9.3 | 6.0.3 | 7.x held back: the types consumer test runs `typescript/bin/tsc`, which 7 no longer exports |
| `@cldmv/configs` | 1.2.4 | 1.3.0 | |
| `@cldmv/fix-headers` | 2.2.0 | 2.2.4 | |
| `@cldmv/vitest-runner` | 1.5.3 | 1.5.6 | |
| `vitest`, `@vitest/coverage-v8` | 5.0.3 | 5.0.5 | |
| `@types/node` | 26.6.4 | 26.6.6 | |
| `vite` | 8.3.2 | 8.3.5 | via `vitest`, clears the open `vite` advisories |
| `postcss`, `nanoid` | 8.5.28, 3.3.19 | 8.5.32, 3.3.20 | lockfile refresh with `npm audit fix` |

- New npm overrides: `katex` `>=0.19.1 <1.0.0` and `minimatch` `^11.0.3`, for the advisories in the ESLint chain that `@cldmv/configs` 1.3.0 brings in. Both are development-only.

---

## Upgrade notes

- **Node.js 22.22.0 or later is required** (was 16.12.0 for `import`, and `^20.19.0 || >=22.12.0` for `require()`). Upgrade Node.js first, or stay on v1.2.6.
- Replace `@cldmv/uuid/main` with `@cldmv/uuid`. It still works in 1.x but prints a `DeprecationWarning` (code `CLDMV_UUID_MAIN`) and goes away in the next major version.
- Nothing else changes for consumers: the `UUID` API, its output, and the `@cldmv/uuid`, `./rng`, `./bytes` and `./hash` import paths are the same. Code that reached into the package's file layout (root `index.mjs`, `dist/uuid.mjs`, `types/dist/`) outside the exports map has to move to the exported paths.



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>

---

<!-- coverage-start -->

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

| Metric | Coverage |
|--------|----------|
| Statements | 88.3% |
| Branches   | 88.2% |
| Functions  | 93.1% |
| Lines      | 88.1% |

*Avg: **89.4%** · `94afcc0` · Node lts/**

<!-- coverage-end -->

<!-- co-authors -->

Co-authored-by: Shinrai <[email protected]>
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: ci Changes to CI workflows, actions, or build pipelines type: config Changes to repository or project configuration files type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments 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.

1 participant