Skip to content

release: v2.4.0 - write @Filename without a leading slash - #197

Merged
cldmv-bot[bot] merged 9 commits into
masterfrom
next
Nov 25, 2026
Merged

cldmv-bot[bot] merged 9 commits into
masterfrom
next

Conversation

@cldmv-bot

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

Copy link
Copy Markdown
Contributor

@cldmv/fix-headers v2.4.0 Changelog

Release Date: November 2026
Release Type: Minor
Branch: release/2.4.0


Overview

@Filename is now written without a leading slash. It is the file's path relative to the project root, and /src/index.mjs read as an absolute path, so it is written as src/index.mjs. Headers written by earlier versions are rewritten on the next run.

Declaration files that tsc emits with a copy of their source's header are now left alone, so tsc and fix-headers stop rewriting each other's @Filename in committed types/ folders.


✨ Features

@Filename without a leading slash (#199)

src/index.mjs → @Filename: src/index.mjs (was /src/index.mjs). A file with no project root above it gets just its file name. An existing header with the leading slash is rewritten on the next run like any other stale field: only the @Filename line and @Last modified time change, and the recorded @Last modified by is kept because the file's content was not edited.

Fixes #198.

🐛 Bug Fixes

Declarations carrying tsc's copy of the source header are skipped (#196)

tsc copies a source file's leading comment into the .d.ts / .d.mts / .d.cts it emits, so a generated types/src/x.d.mts carried @Filename naming src/x.mts. fix-headers rewrote it to the declaration's own path, and the next tsc build wrote it back, so every build and every fix-headers run changed the committed declarations. A declaration whose header names its own source is now reported in skipped and left as tsc wrote it. The pairs are x.d.mts from x.mts / x.mjs, x.d.ts from x.ts / x.tsx / x.js / x.jsx, and x.d.cts from x.cts / x.cjs; the check compares file names only, so both the old slashed and the new @Filename form match. A declaration with no header, or one naming any other file (a hand-written declaration that was moved or renamed), is fixed as before.

Fixes #195.

📚 Documentation

  • NEW: docs/changelog/v2/v2.4.0.md: this changelog.
  • README: every @Filename example uses the slashless form, the project-root rules say so, and the skip rules describe generated declaration files (#196, #199).
  • README What's New promoted to v2.4.0.

🔧 Dependencies

No dependency updates.


Upgrade notes

  • The first run after upgrading rewrites the @Filename line (and @Last modified time) in every file that has a header. Land it on its own, as a header-only commit, when no open PRs touch the same files.
  • @Last modified by and @Author are kept on that run.
  • Generated declarations whose header names their own source now show up in skipped; nothing else about how declarations are handled changes.
👥 Contributors

coverage

Metric Coverage
Statements 99.9%
Branches 98.8%
Functions 100.0%
Lines 99.9%

Avg: 99.6% · a32ffe5 · Node lts/*

Co-authored-by: Shinrai [email protected]

Shinrai and others added 3 commits November 25, 2026 11:27
…er alone

tsc copies a source file's header into the .d.ts/.d.mts/.d.cts it emits,
@filename included, so fix-headers and tsc kept rewriting each other's
@filename on every run. The node detector now skips a declaration file
whose header names its own source (x.d.mts from x.mts/x.mjs, x.d.ts from
x.ts/x.tsx/x.js/x.jsx, x.d.cts from x.cts/x.cjs). Declarations with no
header, or a header naming any other file, are fixed as before.

Detectors' resolveContentSkipReason now also receives the file path.

Resolves #195
…er alone (#196)

`tsc` copies a source file's header into the declaration it emits, so
fix-headers and `tsc` kept flipping `@Filename` in committed `types/`.
The node detector now skips a `.d.ts`/`.d.mts`/`.d.cts` whose header
names its own source (`x.d.mts` ← `x.mts`/`x.mjs`, `x.d.ts` ←
`x.ts`/`x.tsx`/`x.js`/`x.jsx`, `x.d.cts` ← `x.cts`/`x.cjs`).
Declarations with no header, or one naming any other file, are fixed as
before.

Resolves #195
@cldmv-bot cldmv-bot Bot added ! release → master v4 flow: persistent next → master release PR (carries the next feature release) release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected labels Nov 25, 2026
@cldmv-bot

cldmv-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

🔒 Dependency Review

  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ✅ 0 package(s) with unknown licenses
  • ✅ 0 denied package(s)
  • ✅ 0 package(s) with OpenSSF Scorecard score < 3

Full job summary

@cldmv-bot cldmv-bot Bot added area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure 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 25, 2026
@cldmv-bot

cldmv-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

⚠️ Bundle size increased

File Raw Δ Raw Gzipped Δ Gzipped
bin/fix-headers.mjs 62.2 kB +647 B (+1.0%) ⚠️ 21.4 kB +257 B
dist/index.cjs 1.8 kB −1 B (-0.1%) ✅ 1012 B −1 B
dist/index.mjs 52.2 kB +647 B (+1.2%) ⚠️ 18.3 kB +240 B
Total 116.1 kB +1.3 kB 40.7 kB +496 B

📊 Generated by bundle-size. Brotli sizes also measured but omitted from the table for brevity.

Shinrai and others added 3 commits November 25, 2026 13:07
@filename is the file's path relative to the project root, so write it as
src/index.mjs instead of /src/index.mjs. A header written by an earlier
version with the slash is rewritten on the next run, keeping the recorded
@last modified by. The #195 declaration-copy check compares only the file
name, so it accepts both forms.

Resolves #198
`@Filename` is the path relative to the project root, so it's now
written as `src/index.mjs` instead of `/src/index.mjs`. A header with
the old leading slash is rewritten on the next run and keeps its `@Last
modified by`, so picking this up in a repo is a header-only change.
README examples are updated to match. The declaration-copy check from
#196 compares only the file name, so it works with both forms.

The second commit restamps this repo's own headers with the new form.

Resolves #198
@cldmv-bot cldmv-bot Bot added type: ci Changes to CI workflows, actions, or build pipelines type: config Changes to repository or project configuration files labels Nov 25, 2026
@cldmv-bot cldmv-bot Bot changed the title release: v2.3.1 - leave declaration files that carry tsc's copy of the… release: v2.4.0 - write @Filename without a leading slash Nov 25, 2026
@cldmv-bot cldmv-bot Bot added semver: minor This release adds new functionality in a backwards-compatible way type: feature Implements new functionality — a PR or issue that adds a feature and removed semver: patch This release contains only backwards-compatible bug fixes labels Nov 25, 2026
Shinrai and others added 2 commits November 25, 2026 13:16
Release notes for v2.4.0: `docs/changelog/v2/v2.4.0.md` covering #196
and #199, and README What's New promoted to v2.4.0 (v2.3.0 moves into
Recent Releases, v2.2.4 drops off).
@cldmv-bot
cldmv-bot Bot merged commit 95c4e7e into master Nov 25, 2026
38 checks passed
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 ! release → master v4 flow: persistent next → master release PR (carries the next feature release) release Marks a pull request as a pending release — merge to publish a new version semver: minor This release adds new functionality in a backwards-compatible way type: bug Something is broken or not behaving as expected 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.

@Filename is written with a leading slash, so it reads as an absolute path Generated declaration files flip-flop with tsc over @Filename

1 participant