Skip to content

fix: CJS shim keeps .default and every ESM name on a single exported value - #603

Merged
Shinrai merged 2 commits into
nextfrom
fix/cjs-shim-names
Nov 29, 2026
Merged

Shinrai merged 2 commits into
nextfrom
fix/cjs-shim-names

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Nov 29, 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

@cldmv-bot cldmv-bot Bot added ! fix → next v4 flow: fix contributor PR targeting the next integration branch area: tests Touches test files, fixtures, or test infrastructure type: config Changes to repository or project configuration files type: documentation Relates to docs, README updates, guides, or inline code comments labels Nov 29, 2026
…value

When every export was one function or class, the shim returned the bare
value and dropped the names, so require(x).default, require(x).Name and
const { Name } = require(x) stopped working. It now sets .default and each
exported name on that value, the usual CommonJS shape. Multi-value
entries still get the module object.
@Shinrai
Shinrai merged commit a030f5b into next Nov 29, 2026
18 checks passed
@cldmv-bot
cldmv-bot Bot deleted the fix/cjs-shim-names branch November 29, 2026 05:57
cldmv-bot Bot added a commit that referenced this pull request Nov 29, 2026
…sion

# v4.48.0 — 2026-11-29

Minor release: a `release: vX.Y.Z` commit at the end of the release range now sets the version outright, even over breaking commits earlier in the range. The package-layout CommonJS shim keeps `.default` and the ESM names on a single exported value, and the PR-title step replaces a title that no longer matches any of the PR's commits.

## Features

- **A last `release: vX.Y.Z` commit sets the release version.** Before, a breaking commit anywhere in the range forced a major, and an explicit version only counted when the release commit was the only commit. Now, when the newest commit in the range is a plain `release: vX.Y.Z` (optionally ` - <description>` or ` (#N)`), that version wins over every other commit. "Newest" is first-parent order on the branch, skipping the bot's version-bump and lint/format autofix commits; for a PR merge commit the PR's own newest commit counts, so the commit can be pushed straight to `next`/`hotfixes` or merged through a `release/X.Y.Z` PR. A release commit anywhere else in the range keeps the old behaviour, so an old `master` release commit never pins a later release. A version at or below the released version fails the release-PR refresh with an error instead of opening a downgrade or a same-version release, and the already-bumped check now covers explicit versions too. `docs/conventions/release-flow-v4.md` §5.3 describes it. ([#606](#606))

## Bug Fixes

- **The CJS shim keeps `.default` and every ESM name on a single exported value.** When every export of `src/index.mjs` was one function or class (a default plus a named alias, or a single named export), `examples/package-layout/src/index.cjs` returned the bare value, so `require(x).default`, `require(x).Name` and `const { Name } = require(x)` stopped working. The shim now sets `.default` and each exported name on that value, which is the usual CommonJS shape, and leaves a name the value already has (a static of the same name) alone. Entries that export more than one distinct value, or a single primitive, still get the module object. `docs/conventions/package-layout.md` describes the new shape, and `examples/package-layout/index-cjs.test.mjs` covers it from `npm test`. ([#603](#603))
- **A PR title whose summary matches no commit is replaced.** `normalize-pr-title` kept any title whose type still conformed to the PR's commits. When a branch was rewritten (a commit folded into another and force-pushed), the PR kept a title none of its commits had, and the merge commit carried it. A conforming title now also has to match the summary of one of the commit subjects; otherwise it is rebuilt from the highest commit, as a non-conforming title is. A title picked from one of several commits, or one that raises a commit's type, is still kept. Fixes [#601](#601) ([#602](#602))

## Documentation

- `docs/conventions/package-layout.md`: the shim table and the rule on attaching names ([#603](#603)).
- `docs/conventions/release-flow-v4.md` §5.3: setting the version with a `release:` commit ([#606](#606)).
- `docs/conventions/release-flow-v4.md` §6.4: the title normalizer's keep and rewrite rules ([#602](#602)).
- **NEW:** [docs/changelogs/v4.48.0.md](https://github.com/CLDMV/.github/blob/v4.48.0/docs/changelogs/v4.48.0.md), this changelog.
- README What's New promoted to v4.48.0.

## Upgrade notes

- Repos that copied the old shim body update their `src/index.cjs` from `examples/package-layout/src/index.cjs`. For a package whose ESM entry exports a single function or class, `require()` gains `.default` and the export names. Other packages see no change.
- To set a release's version by hand, merge everything else (the changelog included) first, then push `release: vX.Y.Z` as the last commit on `next`.
- Nothing else to change in consumer repos. The title rule applies on the next push to a feature branch once `@v4` moves.



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

- @Shinrai

</details>

<!-- 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: tests Touches test files, fixtures, or test infrastructure ! fix → next v4 flow: fix contributor PR targeting the next integration branch type: config Changes to repository or project configuration files 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