Repository navigation
release: v2.4.0 - write @Filename without a leading slash - #197
Merged
Merged
Conversation
…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
Contributor
Author
🔒 Dependency Review
|
Contributor
Author
|
| 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.
@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
Shinrai
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@cldmv/fix-headersv2.4.0 ChangelogRelease Date: November 2026
Release Type: Minor
Branch:
release/2.4.0Overview
@Filenameis now written without a leading slash. It is the file's path relative to the project root, and/src/index.mjsread as an absolute path, so it is written assrc/index.mjs. Headers written by earlier versions are rewritten on the next run.Declaration files that
tscemits with a copy of their source's header are now left alone, sotscand fix-headers stop rewriting each other's@Filenamein committedtypes/folders.✨ Features
@Filenamewithout 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@Filenameline and@Last modified timechange, and the recorded@Last modified byis 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)tsccopies a source file's leading comment into the.d.ts/.d.mts/.d.ctsit emits, so a generatedtypes/src/x.d.mtscarried@Filenamenamingsrc/x.mts. fix-headers rewrote it to the declaration's own path, and the nexttscbuild 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 inskippedand left astscwrote it. The pairs arex.d.mtsfromx.mts/x.mjs,x.d.tsfromx.ts/x.tsx/x.js/x.jsx, andx.d.ctsfromx.cts/x.cjs; the check compares file names only, so both the old slashed and the new@Filenameform 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
@Filenameexample uses the slashless form, the project-root rules say so, and the skip rules describe generated declaration files (#196, #199).🔧 Dependencies
No dependency updates.
Upgrade notes
@Filenameline (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 byand@Authorare kept on that run.skipped; nothing else about how declarations are handled changes.👥 Contributors
Avg: 99.6% ·
a32ffe5· Node lts/*Co-authored-by: Shinrai [email protected]