chalk/supports-color

Claimed support for Node.js v12 missing #150

aweebit posted onGitHub

The node: namespace imports used by the library were backported to Node.js v12, see nodejs/node#35757.

They are also only supported by @types/node starting v16, see DefinitelyTyped/DefinitelyTyped#52595 (comment). That has the following TypeScript error as a consequence when trying to use the newest library version in jestjs/jest codebase that relies on "@types/node": "~14.14.45":

packages/jest-util/node_modules/supports-color/index.d.ts:1:32 - error TS2307: Cannot find module 'node:tty' or its corresponding type declarations.

1 import type {WriteStream} from 'node:tty';
                                 ~~~~~~~~~~

Please consider giving up the use of the namespace.


Hi, where do you see we support Node 12?

posted by Qix- over 1 year ago

@Qix- Hi! It is mentioned in the release notes for v9.0.0, the latest major version, and also in package.json.

https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/package.json#L18-L20

Actually, v15 is the first major release to support node: from the start, so even bumping the requirement to ">=14" would not save the day.

posted by aweebit over 1 year ago

Hmm well Node 12 works, I just checked. If there's an issue with Typescript, you'll need to take it up with them. We're not doing anything wrong here. We're not going to remove the namespace, though. Sorry about that.

Let me know if I've misunderstood you at all I'll re-open. Thanks for filing!

posted by Qix- over 1 year ago

@Qix- have you checked in a version prior to v12.20.0 where the node: backport was first included (see nodejs/node#35950)? I am still new to open source and might be wrong, but I thought v12 support meant all versions in the ">=12" range had to be supported.

posted by aweebit over 1 year ago

Hmm I think we had this same question before but I can't find it. Maybe @sindresorhus remembers why we don't have a more specific version in there?

posted by Qix- over 1 year ago

Hmm I think we had this same question before but I can't find it.

Found some similar issues:

  • #131
  • #146

Maybe @sindresorhus remembers why we don't have a more specific version in there?

The right one would be >=12.20.0 <13.0.0 || >=14.13.1 (source: changelogs), but making the change just to insist on using node: seems odd to me. Honestly, it would be just cool if you could stop using it at least while v14 is still in maintenance mode until you decide to ditch v14 support altogether. It's a pity the newer versions cannot be used in Jest because of the error which is very easy to fix.

posted by aweebit over 1 year ago

I am still new to open source and might be wrong, but I thought v12 support meant all versions in the ">=12" range had to be supported.

It's simply not always feasible to remember the exact minor Node.js version of every feature you use.

It is generally expected that users upgrade minor Node.js version for security reasons.

The version with this has been out for more than 2 years now and no one else has complained about this, so it's clear it's not a big issue.

posted by sindresorhus over 1 year ago

Honestly, it would be just cool if you could stop using it at least while v14 is still in maintenance mode.

Node.js 14 is not in maintenance mode. It's not supported at all, even by the Node.js team. The general convention in the community is to support the last active LTS version, which is Node.js 16. https://nodejs.dev/en/about/releases/

posted by sindresorhus over 1 year ago

Node.js 14 is not in maintenance mode. It's not supported at all, even by the Node.js team. The general convention in the community is to support the last active LTS version, which is Node.js 16. https://nodejs.dev/en/about/releases/

Oh, that's right, I had mixed them up, sorry.

posted by aweebit over 1 year ago

Closing as we don't intend to change anything here.

The next version (when we have any new changes to push out) of this package will be to target Node.js 16.

posted by sindresorhus over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests