Skip to content

refactor: build dist one file per module instead of bundling - #119

Merged
Shinrai merged 2 commits into
nextfrom
refactor/per-module-build
Nov 28, 2026
Merged

Shinrai merged 2 commits into
nextfrom
refactor/per-module-build

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

No new features

🐛 Bug Fixes

No bug fixes

📦 Dependencies

  • deps: bump the CLDMV dev tools (7e16216)

🔧 Other Changes

  • refactor: build dist one file per module instead of bundling (a88a5dc)
👥 Contributors

@cldmv/vitest-runner moves to 1.11.4, @cldmv/configs to 1.5.0 and @cldmv/fix-headers to 2.6.1, with npm update for the rest. No lint fixes were needed, and the CI gate (build:ci, npm test, ci:coverage) matched the baseline in k3s-test: 227 tests passed in 14 files, coverage 81.97% lines / 80.89% statements / 75.47% branches (functions 73.41% to 72.83%).

fix-headers 2.6.1 also restamped the headers of 74 files: @filename is now written without a leading slash.

It also takes @html-eslint/eslint-plugin and @html-eslint/parser 0.69.0 from Dependabot #111.

dependabot.yml takes the npm groups from the CLDMV/.github v4.47.0 template (CLDMV/.github#593).
dist/ now mirrors src/ with one esbuild-minified file per module (bundle: false, keepNames, sourcemaps) via scripts/build.mjs, and src/index.cjs is copied verbatim; tsup is removed. The require()/import shapes and exported subpaths are unchanged.

Resolves #113
@cldmv-bot cldmv-bot Bot added the ! refactor → next v4 flow: refactor contributor PR targeting the next integration branch label Nov 28, 2026
@cldmv-bot cldmv-bot Bot added 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 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 28, 2026
Shinrai
Shinrai previously approved these changes Nov 28, 2026
Shinrai added a commit that referenced this pull request Nov 28, 2026
## 🚀 What's Changed

### 💥 Breaking Changes
_No breaking changes_

### ✨ Features
_No new features_

### 🐛 Bug Fixes
_No bug fixes_

### 📦 Dependencies
- deps: bump the CLDMV dev tools (#119) (7e16216)

### 🔧 Other Changes
_No other changes_



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

- @Shinrai

</details>
@cldmv-bot
cldmv-bot Bot dismissed Shinrai’s stale review November 28, 2026 22:41

The merge-base changed after approval.

@Shinrai
Shinrai merged commit e40b6c4 into next Nov 28, 2026
37 checks passed
@cldmv-bot
cldmv-bot Bot deleted the refactor/per-module-build branch November 28, 2026 22:41
Shinrai added a commit that referenced this pull request Nov 28, 2026
Shinrai added a commit that referenced this pull request Nov 29, 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 #119 and #120 in the v3.0.0 changelog (#118) (85d2a4d)
- docs: drop the vitest-runner line from the v3.0.0 changelog (#118)
(b4a0d45)
- docs: add the v3.0.0 changelog and promote What's New (#118) (ad8cc54)



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

- @Shinrai

</details>
cldmv-bot Bot added a commit that referenced this pull request Nov 29, 2026
# `@cldmv/holdmytask` 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/holdmytask")` now returns the module object, the same exports `import` gives, instead of the `HoldMyTask` class with the aliases attached as properties.

This is the only breaking change, and it only affects code that uses `require()` and treats the result as the class. ESM `import` is unchanged, and so is the queue itself.

---

## 💥 Breaking Changes

### `require("@cldmv/holdmytask")` returns the module object ([#116](#116), fixes [#115](#115))

The ESM entry exports several distinct values: the `HoldMyTask` class (also exported as `default`, `queue`, `Queue`, `TaskManager`, `TaskQueue`, `QueueManager` and `TaskProcessor`) and the four `create*` factories. With more than one distinct value, the shim hands back the module object:

```javascript
const holdmytask = require("@cldmv/holdmytask");
// => { default, HoldMyTask, queue, Queue, TaskManager, TaskQueue, QueueManager, TaskProcessor,
//      createHoldMyTask, createQueue, createTaskManager, createTaskProcessor }

const { HoldMyTask } = require("@cldmv/holdmytask");
const queue = new HoldMyTask();
```

- `new (require(x))()` becomes `new (require(x).HoldMyTask)()`, or `const { HoldMyTask } = require(x)`.
- Anything read off the class through the result, such as `require(x).someStatic`, goes through `.HoldMyTask`.
- `require(x).HoldMyTask`, `.queue`, `.Queue`, `.TaskManager`, `.TaskQueue`, `.QueueManager` and `.TaskProcessor` keep working, and destructuring them works as before.
- `require(x).default`, `createHoldMyTask`, `createQueue`, `createTaskManager` and `createTaskProcessor` are newly available.

`src/index.cjs` is now the same small file as in other CLDMV libraries (Node version guard, then `require("./index.mjs")`), and the build still copies it unchanged to `dist/index.cjs`. The CommonJS entry test expects the module object and checks that every export matches the ESM entry.

---

## 🔧 CI & tooling

- `ci.yml` adopts the CLDMV/.github v4.46.0 concurrency block, so superseded runs on `next`, `hotfixes` and the release PRs are cancelled ([#117](#117), fixes [#114](#114)).
- `ci.yml` is synced with the v4.43.0 template, so the release PR no longer reruns the matrix on a commit its push run already tested ([#112](#112)).
- The `sync-release-notes.yml` companion workflow is added ([#110](#110)).
- `dist/` is now built one file per module instead of bundled with tsup: esbuild minifies each `src/**/*.mjs` file in place (`bundle: false`, names kept, source maps written next to the output), so `dist/` mirrors `src/` and shares code through plain relative imports. `dist/index.mjs` imports `dist/hold-my-task.mjs` and `dist/utils.mjs`, and the deprecated `dist/main.mjs` alias re-exports `dist/index.mjs`. The exports map is unchanged, and `require()`, `import` and `@cldmv/holdmytask/main` resolve to the same values as before; the published tarball now holds a few more, smaller files under `dist/`, still without source maps ([#119](#119), fixes [#113](#113)).
- New `test:dist` script builds the package and runs the vitest suite against `dist/`, and `npm test` now includes it ([#103](#103)).

## 📚 Documentation

- **NEW:** [docs/changelog/v3/v3.0.0.md](https://github.com/CLDMV/holdmytask/blob/v3.0.0/docs/changelog/v3/v3.0.0.md): this changelog.
- README: the CommonJS example shows the module object, and the testing section lists `test:dist`.
- README What's New promoted to v3.0.0.

## 🔧 Dependencies

- The CLDMV dev tools move together: `@cldmv/vitest-runner` 1.5.6 → 1.11.4, `@cldmv/configs` 1.4.0 → 1.5.0 and `@cldmv/fix-headers` 2.2.4 → 2.6.1, with `@html-eslint/eslint-plugin` and `@html-eslint/parser` 0.67 → 0.69. File headers are restamped (`@Filename` no longer has a leading slash) and `.github/dependabot.yml` is synced to the CLDMV/.github v4.47.0 groups ([#120](#120)). This supersedes the earlier `@cldmv/fix-headers` 2.2.6 bump ([#106](#106)).
- `vitest`, `@vitest/coverage-v8` and `@vitest/ui` resolve to 5.1.x in the lockfile ([#105](#105)).
- `tsup` is replaced by `esbuild` ^0.28.2 as the build tool ([#119](#119)).
- All of the above are development only; the package still has no runtime dependencies.

---

## Upgrade notes

- `require("@cldmv/holdmytask")` no longer returns the `HoldMyTask` class. Use `const { HoldMyTask } = require("@cldmv/holdmytask")`, and read anything class-level through `HoldMyTask`.
- The existing alias names work as before; `default` and the `create*` factories are new.
- ESM `import` is unchanged.



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

- @Shinrai

</details>

---

<!-- coverage-start -->

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

| Metric | Coverage |
|--------|----------|
| Statements | 80.8% |
| Branches   | 75.4% |
| Functions  | 73.4% |
| Lines      | 81.9% |

*Avg: **77.8%** · `9cb475d` · 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 ! refactor → next v4 flow: refactor 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant