Skip to content

fix: raise engines to the require(esm) floor ^20.19.0 || >=22.13.0 - #65

Merged
Shinrai merged 4 commits into
nextfrom
fix/cjs-entry-and-node-floor
Nov 1, 2026
Merged

Shinrai merged 4 commits into
nextfrom
fix/cjs-entry-and-node-floor

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

No new features

🐛 Bug Fixes

📦 Dependencies

No dependency updates

🔧 Other Changes

👥 Contributors

The CommonJS entry now has the same name in src/ and dist/, next to the
ESM entry it loads. tsup copies src/index.cjs to dist/index.cjs and the
wisp-dev condition's require points at it. The published dist/index.cjs
differs from before only in its @filename header line.

Adds caller-resolution tests through the CJS entry: in-process from
src/index.cjs, and a fixture that requires the package by name, run with
--conditions=wisp-dev (src/index.cjs) and without it (dist/index.cjs).
Both resolve relative paths against the calling file.

Closes #63
The CJS entry loads the ESM build through require(esm), so anything below
Node 20.19 already failed on require(), and 22.12.x prints an
ExperimentalWarning for it. engines.node and the entry's guard message now
say ^20.19.0 || >=22.13.0. The tsup target moves from node16 to node20 to
match, and the CI/publish matrix floor moves from 22.12.0 to 22.13.0.

Tests run with the wisp-dev condition: vitest gets it through
resolve.conditions, ssr.resolve.conditions and test.nodeOptions, and the
node --test run in test:cjs passes --conditions=wisp-dev. The README
states the new floor and documents the condition for checkouts.

Closes #64
@cldmv-bot cldmv-bot Bot added ! fix → next v4 flow: fix contributor PR targeting the next integration branch 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 1, 2026
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.
Node.js 22.22 retries a URL whose first import failed on attributes, like 24+, so the version gate ran the cached-failure test on a Node that no longer caches.
@Shinrai
Shinrai merged commit a3ed28a into next Nov 1, 2026
28 checks passed
@cldmv-bot
cldmv-bot Bot deleted the fix/cjs-entry-and-node-floor branch November 1, 2026 22:43
cldmv-bot Bot added a commit that referenced this pull request Nov 2, 2026
# `@cldmv/wisp` v1.0.9 Changelog

**Release Date**: November 2026
**Release Type**: Patch
**Branch**: `release/1.0.9`

---

## Overview

This release renames the CommonJS entry's source file to match its published name and adds tests for caller resolution through it. JSON loading behaves exactly as in [v1.0.8](./v1.0.8.md): the only change in `src/` is the version range named in the `require()` error message, and the published `dist/index.cjs` differs only in that message, a comment explaining it and its file header.

The supported Node.js range does not change. `engines.node` stays `>=16.0.0`, since wisp exists to load JSON on every Node.js version, and `dist/index.mjs` is still built for the Node.js 16 syntax level.

---

## 📦 Requirements

### Node.js support is unchanged; developing wisp needs 22.22.0 ([#65](#65), [#70](#70))

- `import` works on Node.js 16 and later, as before. `require()` needs Node.js `^20.19.0` or `>=22.13.0`, because the CommonJS entry loads the ES module build through synchronous `require(esm)`. 22.13 rather than 22.12 because Node.js 22.12 prints an ExperimentalWarning on `require(esm)`.
- The CommonJS entry's `ERR_REQUIRE_ESM` message now reads `require() needs Node.js ^20.19.0 or >=22.13.0` and still points to `import()`.
- Developing wisp needs Node.js 22.22.0 or newer, the floor of the build and test toolchain (Vitest 5, tsup 9). That floor is declared in the new `devEngines.runtime` field with `onFail: "error"`, which npm checks only for this project's own `npm install`, `npm ci` and `npm run`, never for consumers ([#70](#70)).
- The CI test matrix starts at Node.js 22.22.0 instead of 22.12.0, matching `devEngines`. That is not wisp's support floor, and the workflow input descriptions now say the value must match `devEngines`, not `engines` ([#70](#70)).

---

## 📦 Packaging

- **CommonJS entry renamed in source.** `src/cjs-shim.cjs` is now `src/index.cjs`, next to the ESM entry `src/index.mjs` it loads, so the source and the published `dist/index.cjs` share a name ([#65](#65), fixes [#63](#63)). The `wisp-dev` export condition's `require` target now points at `src/index.cjs`. Nothing changes for consumers of the published package.
- **Caller resolution through the CommonJS entry is tested.** wisp resolves relative paths from the file that calls it by skipping `index.*` entry frames in `src/` and `dist/`. New tests load the package by name from a CommonJS fixture, once with the `wisp-dev` condition (`src/index.cjs`) and once without it (`dist/index.cjs`), and check that paths still resolve against the calling file ([#65](#65)).

---

## 🔒 Security & supply chain

- The dev toolchain update moves Vite (via Vitest) from 8.3.2 to 8.3.5 and esbuild (via tsup) from 0.27.7 to 0.28.2, clearing the open Dependabot alerts ([#66](#66)).
- `overrides` now force `katex` to `>=0.19.1 <1.0.0` (0.16.47 → 0.19.1) and `minimatch` to `^11.0.3` (10.2.6 → 11.0.3), the patched versions ([#67](#67)). Both are development-only transitive dependencies; the package still has no runtime dependencies.

---

## 🔧 CI & tooling

- **The test setup passes the `wisp-dev` condition**: `resolve.conditions` and `ssr.resolve.conditions` in the Vitest configuration, and `--conditions=wisp-dev` on the `node --test` run in `test:cjs`, so loading the package by name in tests reaches `src/` ([#65](#65)).
- **The failed-import retry test is gated on behaviour, not the Node.js major.** Node.js 22.22 retries a URL whose first import failed on its attributes, as 24 and later do, so the old `>= 24` check ran the cached-failure test on a Node.js that no longer caches. The suite now probes the behaviour once at startup ([#65](#65)).

---

## 📚 Documentation

- The README's Requirements section states the `require()` range (`^20.19.0` or `>=22.13.0`) next to the Node.js 16 floor for `import` and notes that development needs Node.js 22.22.0 (`devEngines`), and the Contributing section explains how the `wisp-dev` condition switches a checkout between `dist/` and `src/` ([#65](#65), [#70](#70)).
- **NEW:** [docs/changelog/v1/v1.0.9.md](./v1.0.9.md): this changelog.
- README What's New promoted to v1.0.9.

---

## 🔧 Dependencies

- **Runtime**: none, unchanged.
- **tsup 9**: `tsup` 8.5.1 → 9.0.0 ([#66](#66)).
- **Dev toolchain bumps** ([#66](#66), [#49](#49)): `vitest` and `@vitest/coverage-v8` 5.0.3 → 5.0.5, `@cldmv/vitest-runner` 1.5.3 → 1.5.6, `eslint` 10.12.0 → 10.14.0, `prettier` 3.9.9 → 3.9.10, `@eslint/css` 2.0.0 → 2.0.1, `@eslint/json` 2.1.0 → 2.1.1, `globals` 17.13.0 → 17.14.0, `@types/node` 26.6.4 → 26.6.6.
- **CLDMV tooling** ([#66](#66)): `@cldmv/fix-headers` 2.2.0 → 2.2.4, `@cldmv/configs` 1.2.4 → 1.3.0, `@cldmv/jsonv` 1.1.3 → 1.1.5, `@cldmv/eslint-plugin-jsonv` 1.0.15 → 1.0.17, `@cldmv/prettier-plugin-jsonv` 1.1.3 → 1.1.4.
- `typescript` stays on `^6.0.3`, and the generated `types/` are unchanged.
- `overrides` for `katex` and `minimatch`, see Security & supply chain ([#67](#67)).

---

## Upgrade notes

- Nothing to do for the Node.js version: `engines.node` is still `>=16.0.0`. Code that calls `require()` needs Node.js `^20.19.0` or `>=22.13.0`; on older versions load the package with `import()`.
- No API changes: the exports, options and JSON loading behaviour are the same as v1.0.8.



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

- @Shinrai

</details>

---

<!-- coverage-start -->

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

| Metric | Coverage |
|--------|----------|
| Statements | 100.0% |
| Branches   | 100.0% |
| Functions  | 100.0% |
| Lines      | 100.0% |

*Avg: **100.0%** · `1aaf6cf` · 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 ! fix → next v4 flow: fix 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