Skip to content

Put only major.minor in Processor.version - #2137

Closed
theRizwan wants to merge 1 commit into
postcss:mainfrom
theRizwan:fix/processor-version-major-minor
Closed

Put only major.minor in Processor.version#2137
theRizwan wants to merge 1 commit into
postcss:mainfrom
theRizwan:fix/processor-version-major-minor

Conversation

@theRizwan

@theRizwan theRizwan commented Aug 14, 2026

Copy link
Copy Markdown

Fixes #2101.

Processor.version was a full major.minor.patch string hardcoded in lib/processor.js, which meant it had to be edited on every patch release to stay in step with package.json. This drops the patch component so it only needs touching on a minor bump.

Why this is safe

The patch component was never read. The only runtime consumer is the plugin-version mismatch warning in lib/lazy-result.js:

let a = pluginVer.split('.')
let b = runtimeVer.split('.')

if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {

It compares [0] and [1] only, so '8.5' behaves identically to '8.5.26' here. postcssVersion, which lib/postcss.js sets from new Processor().version, flows into the same comparison and is unaffected. The documented example in processor.d.ts uses version.split('.')[0], which also still works.

Tests

test/version.js previously asserted exact equality with package.json, which would now always fail. It compares the major and minor components instead, so the guard against the two drifting is kept rather than removed:

let expected = pkg.version.split('.').slice(0, 2).join('.')

Two assertions matched /\d+.\d+.\d+/. Both are now /^\d+\.\d+$/ — anchored, and with the dots escaped, which the originals did not do.

I have also noted the format in the processor.d.ts doc comment, since it is a visible change for anyone reading version directly.

Checks

  • pnpm unit — 696 passing, 0 failing
  • node ./test/version.js — passes
  • pnpm test:types — clean
  • pnpm test:lint — one pre-existing warning in test/visitor.test.ts (perfectionist/sort-objects), present on an unmodified checkout and untouched here

@theRizwan
theRizwan marked this pull request as ready for review August 14, 2026 21:31
@ai

ai commented Aug 14, 2026

Copy link
Copy Markdown
Member

Duplicate #2109

And honestly, it looks like LLM slop (description is irrelevant to the changes

@ai ai closed this Aug 14, 2026
@theRizwan
theRizwan deleted the fix/processor-version-major-minor branch August 14, 2026 21:37
@theRizwan

theRizwan commented Aug 14, 2026

Copy link
Copy Markdown
Author

You're right I missed #2109, which does the same thing. Apologies for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Put opnly major.minor in Processor.version

2 participants